mirror of
https://gitlab.com/wirelos/sprocket-ui.git
synced 2025-12-16 06:34:32 +01:00
copy old frontend
This commit is contained in:
2
src/app/components/base/ColorPicker/ColorPicker.html
Normal file
2
src/app/components/base/ColorPicker/ColorPicker.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<label for="{{name}}">{{label}}</label>
|
||||
<input type="color" class="{{name}} ColorPicker" name="{{name}}">
|
||||
34
src/app/components/base/ColorPicker/ColorPicker.js
Normal file
34
src/app/components/base/ColorPicker/ColorPicker.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import $ from 'jquery';
|
||||
import Component from '../../../core/Component';
|
||||
import markup from './ColorPicker.html';
|
||||
|
||||
export default class ColorPicker extends Component {
|
||||
|
||||
constructor(ctx, node, template) {
|
||||
super(ctx, node, template || markup);
|
||||
this.render(this.config);
|
||||
}
|
||||
|
||||
onChange(evt) {}
|
||||
|
||||
inputChange(evt) {
|
||||
this.value = evt.target.value;
|
||||
this.onChange(evt);
|
||||
}
|
||||
|
||||
|
||||
subscribe() {
|
||||
// change to event input when ws is implemented
|
||||
this.node.delegate('input', 'input',
|
||||
this.inputChange.bind(this));
|
||||
}
|
||||
|
||||
/* delegate() {
|
||||
return [{
|
||||
selector: 'input',
|
||||
event: 'input',
|
||||
handler: this.inputChange.bind(this)
|
||||
}];
|
||||
} */
|
||||
|
||||
}
|
||||
2
src/app/components/base/Slider/Slider.html
Normal file
2
src/app/components/base/Slider/Slider.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<label>{{label}}</label>
|
||||
<input type="range" name="{{name}}" value="{{value}}" min="{{min}}" max="{{max}}">
|
||||
25
src/app/components/base/Slider/Slider.js
Normal file
25
src/app/components/base/Slider/Slider.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import $ from 'jquery';
|
||||
import Component from '../../../core/Component';
|
||||
import markup from './Slider.html';
|
||||
|
||||
export default class Slider extends Component {
|
||||
|
||||
constructor(ctx, node, template) {
|
||||
super(ctx, node, template || markup);
|
||||
this.render(this.config);
|
||||
}
|
||||
|
||||
onChange(evt) {}
|
||||
|
||||
sliderChange(evt) {
|
||||
this.value = evt.target.value;
|
||||
this.onChange(evt);
|
||||
}
|
||||
|
||||
|
||||
subscribe() {
|
||||
this.node.delegate('input', 'input',
|
||||
this.sliderChange.bind(this));
|
||||
}
|
||||
|
||||
}
|
||||
5
src/app/components/base/Switch/Switch.html
Normal file
5
src/app/components/base/Switch/Switch.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<label for="{{name}}">{{label}}</label>
|
||||
<label class="switch {{name}}" name="{{name}}">
|
||||
<input type="checkbox" name="{{name}}">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
30
src/app/components/base/Switch/Switch.js
Normal file
30
src/app/components/base/Switch/Switch.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import $ from 'jquery';
|
||||
import Component from '../../../core/Component';
|
||||
import markup from './Switch.html';
|
||||
|
||||
export default class Switch extends Component {
|
||||
|
||||
constructor(ctx, node, template) {
|
||||
super(ctx, node, template || markup);
|
||||
this.state = false;
|
||||
this.render(this.config);
|
||||
this._subscribe();
|
||||
}
|
||||
|
||||
onClick(evt) {}
|
||||
|
||||
switchState(evt) {
|
||||
this.state = !this.state;
|
||||
}
|
||||
|
||||
clickSwitch(evt) {
|
||||
this.switchState(evt);
|
||||
this.onClick(evt);
|
||||
}
|
||||
|
||||
_subscribe() {
|
||||
this.node.delegate('.slider', 'click',
|
||||
this.clickSwitch.bind(this));
|
||||
}
|
||||
|
||||
}
|
||||
2
src/app/components/base/TextInput/TextInput.html
Normal file
2
src/app/components/base/TextInput/TextInput.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<label for="{{name}}">{{label}}</label>
|
||||
<input type="text" class="{{name}}" name="{{name}}" placeholder="{{placeholder}}">
|
||||
25
src/app/components/base/TextInput/TextInput.js
Normal file
25
src/app/components/base/TextInput/TextInput.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import $ from 'jquery';
|
||||
import Component from '../../../core/Component';
|
||||
import markup from './TextInput.html';
|
||||
|
||||
export default class TextInput extends Component {
|
||||
|
||||
constructor(ctx, node, template) {
|
||||
super(ctx, node, template || markup);
|
||||
this.render(this.config);
|
||||
}
|
||||
|
||||
onChange(evt) {}
|
||||
|
||||
inputChange(evt) {
|
||||
this.value = evt.target.value;
|
||||
this.onInput(evt);
|
||||
}
|
||||
|
||||
|
||||
subscribe() {
|
||||
this.node.delegate('input', 'input',
|
||||
this.inputChange.bind(this));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user