@shoper/phoenix_design_system 1.2.21 → 1.2.22-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js +1 -0
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/button_stepper.js +42 -0
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/{stepper_action_button.js.map → button_stepper.js.map} +1 -1
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/display_stepper.js +83 -0
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/{display_input.js.map → display_stepper.js.map} +1 -1
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper.js +88 -54
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js +18 -10
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +8 -8
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js +1 -0
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/input_stepper/button_stepper.d.ts +9 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/button_stepper.js +40 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/{stepper_action_button.js.map → button_stepper.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/form/input_stepper/display_stepper.d.ts +15 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/display_stepper.js +81 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/{display_input.js.map → display_stepper.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.d.ts +15 -12
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js +90 -56
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.d.ts +15 -8
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js +16 -9
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +2 -2
- package/build/esm/packages/phoenix/src/index.js +2 -2
- package/package.json +1 -1
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/display_input.js +0 -60
- package/build/cjs/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js +0 -39
- package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.d.ts +0 -10
- package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.js +0 -58
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.d.ts +0 -6
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.js +0 -3
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.d.ts +0 -8
- package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js +0 -37
|
@@ -49,6 +49,7 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
49
49
|
});
|
|
50
50
|
this._accordionGroupProps.subscribe(this._accordionGroupPropsObserver);
|
|
51
51
|
const mutationObserver = new MutationObserver(() => {
|
|
52
|
+
this.style.height = '';
|
|
52
53
|
this._setOriginalHeightValue();
|
|
53
54
|
this._expand();
|
|
54
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var decorators = require('lit/decorators');
|
|
7
|
+
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
8
|
+
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
9
|
+
var btn_controller = require('../../../controllers/btn_controller/btn_controller.js');
|
|
10
|
+
var input_stepper_constants = require('./input_stepper_constants.js');
|
|
11
|
+
|
|
12
|
+
exports.HButtonStepper = class HButtonStepper extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this._allowedEvents = {
|
|
16
|
+
increment: input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.increment,
|
|
17
|
+
decrement: input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.decrement
|
|
18
|
+
};
|
|
19
|
+
this.type = '';
|
|
20
|
+
this._dispatchStepperEvent = () => {
|
|
21
|
+
if (!this._allowedEvents[this.type])
|
|
22
|
+
throw new Error(`The type ${this.type} is not allowed. Allowed values: 'increment', 'decrement'`);
|
|
23
|
+
this.dispatchEvent(new CustomEvent(this._allowedEvents[this.type], {
|
|
24
|
+
bubbles: true
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
this._btnController = new btn_controller.BtnController(this, this._dispatchStepperEvent);
|
|
28
|
+
}
|
|
29
|
+
async connectedCallback() {
|
|
30
|
+
super.connectedCallback();
|
|
31
|
+
this.addEventListener(input_stepper_constants.INPUT_STEPPER_EVENT_NAMES.click, this._dispatchStepperEvent);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
tslib_es6.__decorate([
|
|
35
|
+
decorators.property({ type: String }),
|
|
36
|
+
tslib_es6.__metadata("design:type", Object)
|
|
37
|
+
], exports.HButtonStepper.prototype, "type", void 0);
|
|
38
|
+
exports.HButtonStepper = tslib_es6.__decorate([
|
|
39
|
+
phoenix_custom_element.phoenixCustomElement(input_stepper_constants.INPUT_STEPPER_COMPONENT_NAMES.button),
|
|
40
|
+
tslib_es6.__metadata("design:paramtypes", [])
|
|
41
|
+
], exports.HButtonStepper);
|
|
42
|
+
//# sourceMappingURL=button_stepper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var lit = require('lit');
|
|
7
|
+
var decorators = require('lit/decorators');
|
|
8
|
+
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
|
+
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
+
var observer = require('../../../core/classes/observer/observer.js');
|
|
11
|
+
var context_consumer_controller = require('../../../core/context/context_consumer_controller.js');
|
|
12
|
+
var ref_js = require('lit-html/directives/ref.js');
|
|
13
|
+
var input_stepper_constants = require('./input_stepper_constants.js');
|
|
14
|
+
|
|
15
|
+
exports.HDisplayStepper = class HDisplayStepper extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.controlId = '';
|
|
19
|
+
this._inputRef = ref_js.createRef();
|
|
20
|
+
this._dispatchToggleEvent = (ev) => {
|
|
21
|
+
const $input = ev.target;
|
|
22
|
+
const value = /^[\d]*\.?[\d]*$/.test($input.value) ? $input.value : '0';
|
|
23
|
+
this.dispatchEvent(new CustomEvent(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.changeValue, {
|
|
24
|
+
bubbles: true,
|
|
25
|
+
detail: {
|
|
26
|
+
value: Number(value)
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async connectedCallback() {
|
|
32
|
+
super.connectedCallback();
|
|
33
|
+
this._setupProperties();
|
|
34
|
+
this._stepperContextConsumer = new context_consumer_controller.ContextConsumerController(this);
|
|
35
|
+
this._value$ = await this._stepperContextConsumer.consumeAsync(input_stepper_constants.INPUT_STEPPER_CONTEXTS_VARIABLE.stepperContext);
|
|
36
|
+
this._valueObserver = new observer.Observer((value) => {
|
|
37
|
+
if (this._inputRef.value)
|
|
38
|
+
this._inputRef.value.value = String(value);
|
|
39
|
+
});
|
|
40
|
+
this._value$.subscribe(this._valueObserver);
|
|
41
|
+
this.addEventListener(input_stepper_constants.INPUT_STEPPER_EVENT_NAMES.change, this._dispatchToggleEvent);
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
super.disconnectedCallback();
|
|
45
|
+
this.removeEventListener(input_stepper_constants.INPUT_STEPPER_EVENT_NAMES.change, this._dispatchToggleEvent);
|
|
46
|
+
}
|
|
47
|
+
_setupProperties() {
|
|
48
|
+
const $closestInputStepper = this.closest(input_stepper_constants.INPUT_STEPPER_COMPONENT_NAMES.control);
|
|
49
|
+
if (!$closestInputStepper)
|
|
50
|
+
return;
|
|
51
|
+
this.controlId = $closestInputStepper.controlId;
|
|
52
|
+
}
|
|
53
|
+
_wholeTextSelection(ev) {
|
|
54
|
+
const $input = ev.target;
|
|
55
|
+
$input.select();
|
|
56
|
+
}
|
|
57
|
+
_preventLettersAndCommaSeparatorToBeAdded(ev) {
|
|
58
|
+
const isAllowed = /^[\d\b.]$/i.test(ev.key);
|
|
59
|
+
if (!isAllowed && !['Enter', 'Backspace', 'ArrowRight', 'ArrowLeft'].includes(ev.key)) {
|
|
60
|
+
ev.preventDefault();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
return lit.html `<input
|
|
65
|
+
id=${this.controlId}
|
|
66
|
+
${ref_js.ref(this._inputRef)}
|
|
67
|
+
class="${input_stepper_constants.INPUT_STEPPER_CLASS_NAMES.displayInput}"
|
|
68
|
+
type="text"
|
|
69
|
+
@keydown=${this._preventLettersAndCommaSeparatorToBeAdded}
|
|
70
|
+
@focus="${this._wholeTextSelection}"
|
|
71
|
+
@change="${this._dispatchToggleEvent}"
|
|
72
|
+
inputmode="numeric"
|
|
73
|
+
/>`;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
tslib_es6.__decorate([
|
|
77
|
+
decorators.state(),
|
|
78
|
+
tslib_es6.__metadata("design:type", Object)
|
|
79
|
+
], exports.HDisplayStepper.prototype, "controlId", void 0);
|
|
80
|
+
exports.HDisplayStepper = tslib_es6.__decorate([
|
|
81
|
+
phoenix_custom_element.phoenixCustomElement(input_stepper_constants.INPUT_STEPPER_COMPONENT_NAMES.input)
|
|
82
|
+
], exports.HDisplayStepper);
|
|
83
|
+
//# sourceMappingURL=display_stepper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -3,97 +3,131 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
-
require('lit');
|
|
7
6
|
var decorators = require('lit/decorators');
|
|
8
7
|
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
8
|
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
9
|
+
var behavior_subject = require('../../../core/classes/behavior_subject/behavior_subject.js');
|
|
10
|
+
var context_provider_controller = require('../../../core/context/context_provider_controller.js');
|
|
10
11
|
var input_stepper_constants = require('./input_stepper_constants.js');
|
|
11
12
|
|
|
12
13
|
exports.HInputStepper = class HInputStepper extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
|
-
this.
|
|
16
|
+
this.controlId = '';
|
|
17
|
+
this.allowedFractionDigits = null;
|
|
18
|
+
this.value = 0;
|
|
16
19
|
this.min = -Infinity;
|
|
17
20
|
this.max = Infinity;
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
+
this.step = 1;
|
|
22
|
+
this.increment = () => {
|
|
23
|
+
if (this.value === this.max) {
|
|
24
|
+
this.value = this.max;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.value += this.step;
|
|
28
|
+
this._dispatchChangedValue(this.value);
|
|
21
29
|
};
|
|
22
|
-
this.
|
|
23
|
-
if (
|
|
30
|
+
this.decrement = () => {
|
|
31
|
+
if (this.value === this.min) {
|
|
32
|
+
this.value = this.min;
|
|
24
33
|
return;
|
|
25
|
-
|
|
34
|
+
}
|
|
35
|
+
this.value -= this.step;
|
|
36
|
+
this._dispatchChangedValue(this.value);
|
|
37
|
+
};
|
|
38
|
+
this.changeValue = (ev) => {
|
|
39
|
+
const value = ev.detail.value;
|
|
40
|
+
if (value >= this.max) {
|
|
41
|
+
this.value = this.max;
|
|
42
|
+
}
|
|
43
|
+
else if (value <= this.min) {
|
|
44
|
+
this.value = this.min;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.value = value;
|
|
48
|
+
}
|
|
49
|
+
this._stepperState.notify(this.value);
|
|
50
|
+
this._dispatchChangedValue(this.value);
|
|
26
51
|
};
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
52
|
+
this._dispatchChangedValue = (value) => {
|
|
53
|
+
this.dispatchEvent(new CustomEvent(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.valueChanged, {
|
|
54
|
+
bubbles: true,
|
|
55
|
+
detail: {
|
|
56
|
+
value
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
29
59
|
};
|
|
30
60
|
}
|
|
31
61
|
connectedCallback() {
|
|
32
62
|
super.connectedCallback();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
this._value = this.min;
|
|
41
|
-
}
|
|
42
|
-
this._setupEvents();
|
|
63
|
+
this._checkSetup();
|
|
64
|
+
this.addEventListener(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.increment, this.increment);
|
|
65
|
+
this.addEventListener(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.decrement, this.decrement);
|
|
66
|
+
this.addEventListener(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.changeValue, this.changeValue);
|
|
67
|
+
this._stepperState = new behavior_subject.BehaviorSubject(this.value);
|
|
68
|
+
this._stepperContext = new context_provider_controller.ContextProviderController(this);
|
|
69
|
+
this._stepperContext.provide(input_stepper_constants.INPUT_STEPPER_CONTEXTS_VARIABLE.stepperContext, this._stepperState);
|
|
43
70
|
}
|
|
44
71
|
disconnectedCallback() {
|
|
45
72
|
super.disconnectedCallback();
|
|
46
|
-
this.
|
|
73
|
+
this.removeEventListener(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.increment, this.increment);
|
|
74
|
+
this.removeEventListener(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.decrement, this.decrement);
|
|
75
|
+
this.removeEventListener(input_stepper_constants.INPUT_STEPPER_CUSTOM_EVENT_NAMES.changeValue, this.changeValue);
|
|
47
76
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
77
|
+
_checkSetup() {
|
|
78
|
+
if (this.value < this.min)
|
|
79
|
+
throw new Error('h-input-stepper initialized value cannot be lower than min. Notice that default value = 0.');
|
|
80
|
+
if (this.value > this.max)
|
|
81
|
+
throw new Error('h-input-stepper initialized value cannot be greater than max. Notice that default value = 0.');
|
|
54
82
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
83
|
+
_calculateFractionDigitsByStepSize(step) {
|
|
84
|
+
let zerosCount = 0;
|
|
85
|
+
const string = String(step);
|
|
86
|
+
if (string.includes('.'))
|
|
87
|
+
zerosCount = string.split('.')[1].length;
|
|
88
|
+
return zerosCount;
|
|
59
89
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this._value += this.step;
|
|
90
|
+
_roundToFractionDigits(fractionsDigits, number) {
|
|
91
|
+
const multiplier = Math.pow(10, fractionsDigits);
|
|
92
|
+
return Math.round(Number(number) * multiplier) / multiplier;
|
|
64
93
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return;
|
|
68
|
-
this._value -= this.step;
|
|
94
|
+
_outsideRangeEdges(number) {
|
|
95
|
+
return number > this.max || number < this.min;
|
|
69
96
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.dispatchEvent(valueChangeEvent);
|
|
97
|
+
updated() {
|
|
98
|
+
var _a;
|
|
99
|
+
if (this._outsideRangeEdges(this.value))
|
|
100
|
+
return;
|
|
101
|
+
const digits = (_a = this.allowedFractionDigits) !== null && _a !== void 0 ? _a : this._calculateFractionDigitsByStepSize(this.step);
|
|
102
|
+
this.value = this._roundToFractionDigits(digits, this.value);
|
|
103
|
+
this._stepperState.notify(this.value);
|
|
78
104
|
}
|
|
79
105
|
};
|
|
80
106
|
tslib_es6.__decorate([
|
|
81
|
-
decorators.property({ type:
|
|
107
|
+
decorators.property({ type: String, attribute: 'control-id' }),
|
|
108
|
+
tslib_es6.__metadata("design:type", String)
|
|
109
|
+
], exports.HInputStepper.prototype, "controlId", void 0);
|
|
110
|
+
tslib_es6.__decorate([
|
|
111
|
+
decorators.property({ type: Number, attribute: 'allowed-number-of-fraction-digits' }),
|
|
112
|
+
tslib_es6.__metadata("design:type", Object)
|
|
113
|
+
], exports.HInputStepper.prototype, "allowedFractionDigits", void 0);
|
|
114
|
+
tslib_es6.__decorate([
|
|
115
|
+
decorators.property({ type: Number, reflect: true }),
|
|
82
116
|
tslib_es6.__metadata("design:type", Number)
|
|
83
|
-
], exports.HInputStepper.prototype, "
|
|
117
|
+
], exports.HInputStepper.prototype, "value", void 0);
|
|
84
118
|
tslib_es6.__decorate([
|
|
85
|
-
decorators.property({ type: Number,
|
|
119
|
+
decorators.property({ type: Number, reflect: true }),
|
|
86
120
|
tslib_es6.__metadata("design:type", Number)
|
|
87
121
|
], exports.HInputStepper.prototype, "min", void 0);
|
|
88
122
|
tslib_es6.__decorate([
|
|
89
|
-
decorators.property({ type: Number,
|
|
123
|
+
decorators.property({ type: Number, reflect: true }),
|
|
90
124
|
tslib_es6.__metadata("design:type", Number)
|
|
91
125
|
], exports.HInputStepper.prototype, "max", void 0);
|
|
92
126
|
tslib_es6.__decorate([
|
|
93
|
-
decorators.
|
|
127
|
+
decorators.property({ type: Number, reflect: true }),
|
|
94
128
|
tslib_es6.__metadata("design:type", Number)
|
|
95
|
-
], exports.HInputStepper.prototype, "
|
|
129
|
+
], exports.HInputStepper.prototype, "step", void 0);
|
|
96
130
|
exports.HInputStepper = tslib_es6.__decorate([
|
|
97
|
-
phoenix_custom_element.phoenixCustomElement(
|
|
131
|
+
phoenix_custom_element.phoenixCustomElement(input_stepper_constants.INPUT_STEPPER_COMPONENT_NAMES.control)
|
|
98
132
|
], exports.HInputStepper);
|
|
99
133
|
//# sourceMappingURL=input_stepper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js
CHANGED
|
@@ -3,22 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const INPUT_STEPPER_EVENT_NAMES = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
click: 'click',
|
|
7
|
+
change: 'change'
|
|
8
8
|
};
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
decrement: 'decrement'
|
|
9
|
+
const INPUT_STEPPER_CUSTOM_EVENT_NAMES = {
|
|
10
|
+
valueChanged: 'inputStepper.valueChanged',
|
|
11
|
+
changeValue: 'inputStepper.changeValue',
|
|
12
|
+
increment: 'inputStepper.increment',
|
|
13
|
+
decrement: 'inputStepper.decrement'
|
|
15
14
|
};
|
|
16
15
|
const INPUT_STEPPER_CLASS_NAMES = {
|
|
17
16
|
displayInput: 'input-stepper__value_input'
|
|
17
|
+
};
|
|
18
|
+
const INPUT_STEPPER_COMPONENT_NAMES = {
|
|
19
|
+
control: 'h-input-stepper',
|
|
20
|
+
input: 'h-display-stepper',
|
|
21
|
+
button: 'h-button-stepper'
|
|
22
|
+
};
|
|
23
|
+
const INPUT_STEPPER_CONTEXTS_VARIABLE = {
|
|
24
|
+
stepperContext: 'stepperContext'
|
|
18
25
|
};
|
|
19
26
|
|
|
20
|
-
exports.DISPLAY_INPUT_EVENT_NAMES = DISPLAY_INPUT_EVENT_NAMES;
|
|
21
|
-
exports.INPUT_STEPPER_ACTION_TYPES = INPUT_STEPPER_ACTION_TYPES;
|
|
22
27
|
exports.INPUT_STEPPER_CLASS_NAMES = INPUT_STEPPER_CLASS_NAMES;
|
|
28
|
+
exports.INPUT_STEPPER_COMPONENT_NAMES = INPUT_STEPPER_COMPONENT_NAMES;
|
|
29
|
+
exports.INPUT_STEPPER_CONTEXTS_VARIABLE = INPUT_STEPPER_CONTEXTS_VARIABLE;
|
|
30
|
+
exports.INPUT_STEPPER_CUSTOM_EVENT_NAMES = INPUT_STEPPER_CUSTOM_EVENT_NAMES;
|
|
23
31
|
exports.INPUT_STEPPER_EVENT_NAMES = INPUT_STEPPER_EVENT_NAMES;
|
|
24
32
|
//# sourceMappingURL=input_stepper_constants.js.map
|
package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -87,9 +87,9 @@ var tooltip = require('./components/messages/tooltips/tooltip.js');
|
|
|
87
87
|
var tooltip_content = require('./components/messages/tooltips/tooltip_content.js');
|
|
88
88
|
var tag = require('./components/tag/tag.js');
|
|
89
89
|
var tag_remove_button = require('./components/tag/tag_remove_button.js');
|
|
90
|
-
var stepper_action_button = require('./components/form/input_stepper/stepper_action_button.js');
|
|
91
90
|
var input_stepper = require('./components/form/input_stepper/input_stepper.js');
|
|
92
|
-
var
|
|
91
|
+
var display_stepper = require('./components/form/input_stepper/display_stepper.js');
|
|
92
|
+
var button_stepper = require('./components/form/input_stepper/button_stepper.js');
|
|
93
93
|
var toggle_constants = require('./components/toggle/toggle_constants.js');
|
|
94
94
|
var toggle = require('./components/toggle/toggle.js');
|
|
95
95
|
var toggle_button$1 = require('./components/toggle/toggle_button.js');
|
|
@@ -516,22 +516,22 @@ Object.defineProperty(exports, 'HTagRemoveButton', {
|
|
|
516
516
|
return tag_remove_button.HTagRemoveButton;
|
|
517
517
|
}
|
|
518
518
|
});
|
|
519
|
-
Object.defineProperty(exports, '
|
|
519
|
+
Object.defineProperty(exports, 'HInputStepper', {
|
|
520
520
|
enumerable: true,
|
|
521
521
|
get: function () {
|
|
522
|
-
return
|
|
522
|
+
return input_stepper.HInputStepper;
|
|
523
523
|
}
|
|
524
524
|
});
|
|
525
|
-
Object.defineProperty(exports, '
|
|
525
|
+
Object.defineProperty(exports, 'HDisplayStepper', {
|
|
526
526
|
enumerable: true,
|
|
527
527
|
get: function () {
|
|
528
|
-
return
|
|
528
|
+
return display_stepper.HDisplayStepper;
|
|
529
529
|
}
|
|
530
530
|
});
|
|
531
|
-
Object.defineProperty(exports, '
|
|
531
|
+
Object.defineProperty(exports, 'HButtonStepper', {
|
|
532
532
|
enumerable: true,
|
|
533
533
|
get: function () {
|
|
534
|
-
return
|
|
534
|
+
return button_stepper.HButtonStepper;
|
|
535
535
|
}
|
|
536
536
|
});
|
|
537
537
|
exports.TOGGLE_ACTIONS = toggle_constants.TOGGLE_ACTIONS;
|
|
@@ -45,6 +45,7 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
45
45
|
});
|
|
46
46
|
this._accordionGroupProps.subscribe(this._accordionGroupPropsObserver);
|
|
47
47
|
const mutationObserver = new MutationObserver(() => {
|
|
48
|
+
this.style.height = '';
|
|
48
49
|
this._setOriginalHeightValue();
|
|
49
50
|
this._expand();
|
|
50
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
+
export declare class HButtonStepper extends PhoenixLightLitElement {
|
|
3
|
+
private _btnController;
|
|
4
|
+
private _allowedEvents;
|
|
5
|
+
type: string;
|
|
6
|
+
constructor();
|
|
7
|
+
connectedCallback(): Promise<void>;
|
|
8
|
+
private _dispatchStepperEvent;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { property } from 'lit/decorators';
|
|
3
|
+
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
4
|
+
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
5
|
+
import { BtnController } from '../../../controllers/btn_controller/btn_controller.js';
|
|
6
|
+
import { INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_EVENT_NAMES, INPUT_STEPPER_COMPONENT_NAMES } from './input_stepper_constants.js';
|
|
7
|
+
|
|
8
|
+
let HButtonStepper = class HButtonStepper extends PhoenixLightLitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this._allowedEvents = {
|
|
12
|
+
increment: INPUT_STEPPER_CUSTOM_EVENT_NAMES.increment,
|
|
13
|
+
decrement: INPUT_STEPPER_CUSTOM_EVENT_NAMES.decrement
|
|
14
|
+
};
|
|
15
|
+
this.type = '';
|
|
16
|
+
this._dispatchStepperEvent = () => {
|
|
17
|
+
if (!this._allowedEvents[this.type])
|
|
18
|
+
throw new Error(`The type ${this.type} is not allowed. Allowed values: 'increment', 'decrement'`);
|
|
19
|
+
this.dispatchEvent(new CustomEvent(this._allowedEvents[this.type], {
|
|
20
|
+
bubbles: true
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
this._btnController = new BtnController(this, this._dispatchStepperEvent);
|
|
24
|
+
}
|
|
25
|
+
async connectedCallback() {
|
|
26
|
+
super.connectedCallback();
|
|
27
|
+
this.addEventListener(INPUT_STEPPER_EVENT_NAMES.click, this._dispatchStepperEvent);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
__decorate([
|
|
31
|
+
property({ type: String }),
|
|
32
|
+
__metadata("design:type", Object)
|
|
33
|
+
], HButtonStepper.prototype, "type", void 0);
|
|
34
|
+
HButtonStepper = __decorate([
|
|
35
|
+
phoenixCustomElement(INPUT_STEPPER_COMPONENT_NAMES.button),
|
|
36
|
+
__metadata("design:paramtypes", [])
|
|
37
|
+
], HButtonStepper);
|
|
38
|
+
|
|
39
|
+
export { HButtonStepper };
|
|
40
|
+
//# sourceMappingURL=button_stepper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
+
export declare class HDisplayStepper extends PhoenixLightLitElement {
|
|
3
|
+
private controlId;
|
|
4
|
+
private _stepperContextConsumer;
|
|
5
|
+
private _value$;
|
|
6
|
+
private _valueObserver;
|
|
7
|
+
private _inputRef;
|
|
8
|
+
connectedCallback(): Promise<void>;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
private _dispatchToggleEvent;
|
|
11
|
+
private _setupProperties;
|
|
12
|
+
private _wholeTextSelection;
|
|
13
|
+
private _preventLettersAndCommaSeparatorToBeAdded;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { state } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import { Observer } from '../../../core/classes/observer/observer.js';
|
|
7
|
+
import { ContextConsumerController } from '../../../core/context/context_consumer_controller.js';
|
|
8
|
+
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
9
|
+
import { INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_CONTEXTS_VARIABLE, INPUT_STEPPER_EVENT_NAMES, INPUT_STEPPER_COMPONENT_NAMES, INPUT_STEPPER_CLASS_NAMES } from './input_stepper_constants.js';
|
|
10
|
+
|
|
11
|
+
let HDisplayStepper = class HDisplayStepper extends PhoenixLightLitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.controlId = '';
|
|
15
|
+
this._inputRef = createRef();
|
|
16
|
+
this._dispatchToggleEvent = (ev) => {
|
|
17
|
+
const $input = ev.target;
|
|
18
|
+
const value = /^[\d]*\.?[\d]*$/.test($input.value) ? $input.value : '0';
|
|
19
|
+
this.dispatchEvent(new CustomEvent(INPUT_STEPPER_CUSTOM_EVENT_NAMES.changeValue, {
|
|
20
|
+
bubbles: true,
|
|
21
|
+
detail: {
|
|
22
|
+
value: Number(value)
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
this._setupProperties();
|
|
30
|
+
this._stepperContextConsumer = new ContextConsumerController(this);
|
|
31
|
+
this._value$ = await this._stepperContextConsumer.consumeAsync(INPUT_STEPPER_CONTEXTS_VARIABLE.stepperContext);
|
|
32
|
+
this._valueObserver = new Observer((value) => {
|
|
33
|
+
if (this._inputRef.value)
|
|
34
|
+
this._inputRef.value.value = String(value);
|
|
35
|
+
});
|
|
36
|
+
this._value$.subscribe(this._valueObserver);
|
|
37
|
+
this.addEventListener(INPUT_STEPPER_EVENT_NAMES.change, this._dispatchToggleEvent);
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
super.disconnectedCallback();
|
|
41
|
+
this.removeEventListener(INPUT_STEPPER_EVENT_NAMES.change, this._dispatchToggleEvent);
|
|
42
|
+
}
|
|
43
|
+
_setupProperties() {
|
|
44
|
+
const $closestInputStepper = this.closest(INPUT_STEPPER_COMPONENT_NAMES.control);
|
|
45
|
+
if (!$closestInputStepper)
|
|
46
|
+
return;
|
|
47
|
+
this.controlId = $closestInputStepper.controlId;
|
|
48
|
+
}
|
|
49
|
+
_wholeTextSelection(ev) {
|
|
50
|
+
const $input = ev.target;
|
|
51
|
+
$input.select();
|
|
52
|
+
}
|
|
53
|
+
_preventLettersAndCommaSeparatorToBeAdded(ev) {
|
|
54
|
+
const isAllowed = /^[\d\b.]$/i.test(ev.key);
|
|
55
|
+
if (!isAllowed && !['Enter', 'Backspace', 'ArrowRight', 'ArrowLeft'].includes(ev.key)) {
|
|
56
|
+
ev.preventDefault();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
return html `<input
|
|
61
|
+
id=${this.controlId}
|
|
62
|
+
${ref(this._inputRef)}
|
|
63
|
+
class="${INPUT_STEPPER_CLASS_NAMES.displayInput}"
|
|
64
|
+
type="text"
|
|
65
|
+
@keydown=${this._preventLettersAndCommaSeparatorToBeAdded}
|
|
66
|
+
@focus="${this._wholeTextSelection}"
|
|
67
|
+
@change="${this._dispatchToggleEvent}"
|
|
68
|
+
inputmode="numeric"
|
|
69
|
+
/>`;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
__decorate([
|
|
73
|
+
state(),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], HDisplayStepper.prototype, "controlId", void 0);
|
|
76
|
+
HDisplayStepper = __decorate([
|
|
77
|
+
phoenixCustomElement(INPUT_STEPPER_COMPONENT_NAMES.input)
|
|
78
|
+
], HDisplayStepper);
|
|
79
|
+
|
|
80
|
+
export { HDisplayStepper };
|
|
81
|
+
//# sourceMappingURL=display_stepper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
-
import { PropertyValues } from 'lit';
|
|
3
2
|
export declare class HInputStepper extends PhoenixLightLitElement {
|
|
4
|
-
|
|
3
|
+
private _stepperState;
|
|
4
|
+
private _stepperContext;
|
|
5
|
+
controlId: string;
|
|
6
|
+
allowedFractionDigits: number | null;
|
|
7
|
+
value: number;
|
|
5
8
|
min: number;
|
|
6
9
|
max: number;
|
|
7
|
-
|
|
8
|
-
private _$inputElement;
|
|
10
|
+
step: number;
|
|
9
11
|
connectedCallback(): void;
|
|
10
12
|
disconnectedCallback(): void;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
13
|
+
increment: () => void;
|
|
14
|
+
decrement: () => void;
|
|
15
|
+
changeValue: (ev: CustomEvent) => void;
|
|
16
|
+
private _checkSetup;
|
|
17
|
+
private _calculateFractionDigitsByStepSize;
|
|
18
|
+
private _roundToFractionDigits;
|
|
19
|
+
private _outsideRangeEdges;
|
|
20
|
+
private _dispatchChangedValue;
|
|
21
|
+
updated(): void;
|
|
19
22
|
}
|
|
@@ -1,96 +1,130 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import 'lit';
|
|
3
|
-
import { property, state } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators';
|
|
4
3
|
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
4
|
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
-
import {
|
|
5
|
+
import { BehaviorSubject } from '../../../core/classes/behavior_subject/behavior_subject.js';
|
|
6
|
+
import { ContextProviderController } from '../../../core/context/context_provider_controller.js';
|
|
7
|
+
import { INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_CONTEXTS_VARIABLE, INPUT_STEPPER_COMPONENT_NAMES } from './input_stepper_constants.js';
|
|
7
8
|
|
|
8
9
|
let HInputStepper = class HInputStepper extends PhoenixLightLitElement {
|
|
9
10
|
constructor() {
|
|
10
11
|
super(...arguments);
|
|
11
|
-
this.
|
|
12
|
+
this.controlId = '';
|
|
13
|
+
this.allowedFractionDigits = null;
|
|
14
|
+
this.value = 0;
|
|
12
15
|
this.min = -Infinity;
|
|
13
16
|
this.max = Infinity;
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
(
|
|
17
|
+
this.step = 1;
|
|
18
|
+
this.increment = () => {
|
|
19
|
+
if (this.value === this.max) {
|
|
20
|
+
this.value = this.max;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.value += this.step;
|
|
24
|
+
this._dispatchChangedValue(this.value);
|
|
17
25
|
};
|
|
18
|
-
this.
|
|
19
|
-
if (
|
|
26
|
+
this.decrement = () => {
|
|
27
|
+
if (this.value === this.min) {
|
|
28
|
+
this.value = this.min;
|
|
20
29
|
return;
|
|
21
|
-
|
|
30
|
+
}
|
|
31
|
+
this.value -= this.step;
|
|
32
|
+
this._dispatchChangedValue(this.value);
|
|
33
|
+
};
|
|
34
|
+
this.changeValue = (ev) => {
|
|
35
|
+
const value = ev.detail.value;
|
|
36
|
+
if (value >= this.max) {
|
|
37
|
+
this.value = this.max;
|
|
38
|
+
}
|
|
39
|
+
else if (value <= this.min) {
|
|
40
|
+
this.value = this.min;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.value = value;
|
|
44
|
+
}
|
|
45
|
+
this._stepperState.notify(this.value);
|
|
46
|
+
this._dispatchChangedValue(this.value);
|
|
22
47
|
};
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
48
|
+
this._dispatchChangedValue = (value) => {
|
|
49
|
+
this.dispatchEvent(new CustomEvent(INPUT_STEPPER_CUSTOM_EVENT_NAMES.valueChanged, {
|
|
50
|
+
bubbles: true,
|
|
51
|
+
detail: {
|
|
52
|
+
value
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
25
55
|
};
|
|
26
56
|
}
|
|
27
57
|
connectedCallback() {
|
|
28
58
|
super.connectedCallback();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
this._value = this.min;
|
|
37
|
-
}
|
|
38
|
-
this._setupEvents();
|
|
59
|
+
this._checkSetup();
|
|
60
|
+
this.addEventListener(INPUT_STEPPER_CUSTOM_EVENT_NAMES.increment, this.increment);
|
|
61
|
+
this.addEventListener(INPUT_STEPPER_CUSTOM_EVENT_NAMES.decrement, this.decrement);
|
|
62
|
+
this.addEventListener(INPUT_STEPPER_CUSTOM_EVENT_NAMES.changeValue, this.changeValue);
|
|
63
|
+
this._stepperState = new BehaviorSubject(this.value);
|
|
64
|
+
this._stepperContext = new ContextProviderController(this);
|
|
65
|
+
this._stepperContext.provide(INPUT_STEPPER_CONTEXTS_VARIABLE.stepperContext, this._stepperState);
|
|
39
66
|
}
|
|
40
67
|
disconnectedCallback() {
|
|
41
68
|
super.disconnectedCallback();
|
|
42
|
-
this.
|
|
69
|
+
this.removeEventListener(INPUT_STEPPER_CUSTOM_EVENT_NAMES.increment, this.increment);
|
|
70
|
+
this.removeEventListener(INPUT_STEPPER_CUSTOM_EVENT_NAMES.decrement, this.decrement);
|
|
71
|
+
this.removeEventListener(INPUT_STEPPER_CUSTOM_EVENT_NAMES.changeValue, this.changeValue);
|
|
43
72
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
73
|
+
_checkSetup() {
|
|
74
|
+
if (this.value < this.min)
|
|
75
|
+
throw new Error('h-input-stepper initialized value cannot be lower than min. Notice that default value = 0.');
|
|
76
|
+
if (this.value > this.max)
|
|
77
|
+
throw new Error('h-input-stepper initialized value cannot be greater than max. Notice that default value = 0.');
|
|
50
78
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
_calculateFractionDigitsByStepSize(step) {
|
|
80
|
+
let zerosCount = 0;
|
|
81
|
+
const string = String(step);
|
|
82
|
+
if (string.includes('.'))
|
|
83
|
+
zerosCount = string.split('.')[1].length;
|
|
84
|
+
return zerosCount;
|
|
55
85
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this._value += this.step;
|
|
86
|
+
_roundToFractionDigits(fractionsDigits, number) {
|
|
87
|
+
const multiplier = Math.pow(10, fractionsDigits);
|
|
88
|
+
return Math.round(Number(number) * multiplier) / multiplier;
|
|
60
89
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return;
|
|
64
|
-
this._value -= this.step;
|
|
90
|
+
_outsideRangeEdges(number) {
|
|
91
|
+
return number > this.max || number < this.min;
|
|
65
92
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.dispatchEvent(valueChangeEvent);
|
|
93
|
+
updated() {
|
|
94
|
+
var _a;
|
|
95
|
+
if (this._outsideRangeEdges(this.value))
|
|
96
|
+
return;
|
|
97
|
+
const digits = (_a = this.allowedFractionDigits) !== null && _a !== void 0 ? _a : this._calculateFractionDigitsByStepSize(this.step);
|
|
98
|
+
this.value = this._roundToFractionDigits(digits, this.value);
|
|
99
|
+
this._stepperState.notify(this.value);
|
|
74
100
|
}
|
|
75
101
|
};
|
|
76
102
|
__decorate([
|
|
77
|
-
property({ type:
|
|
103
|
+
property({ type: String, attribute: 'control-id' }),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], HInputStepper.prototype, "controlId", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
property({ type: Number, attribute: 'allowed-number-of-fraction-digits' }),
|
|
108
|
+
__metadata("design:type", Object)
|
|
109
|
+
], HInputStepper.prototype, "allowedFractionDigits", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: Number, reflect: true }),
|
|
78
112
|
__metadata("design:type", Number)
|
|
79
|
-
], HInputStepper.prototype, "
|
|
113
|
+
], HInputStepper.prototype, "value", void 0);
|
|
80
114
|
__decorate([
|
|
81
|
-
property({ type: Number,
|
|
115
|
+
property({ type: Number, reflect: true }),
|
|
82
116
|
__metadata("design:type", Number)
|
|
83
117
|
], HInputStepper.prototype, "min", void 0);
|
|
84
118
|
__decorate([
|
|
85
|
-
property({ type: Number,
|
|
119
|
+
property({ type: Number, reflect: true }),
|
|
86
120
|
__metadata("design:type", Number)
|
|
87
121
|
], HInputStepper.prototype, "max", void 0);
|
|
88
122
|
__decorate([
|
|
89
|
-
|
|
123
|
+
property({ type: Number, reflect: true }),
|
|
90
124
|
__metadata("design:type", Number)
|
|
91
|
-
], HInputStepper.prototype, "
|
|
125
|
+
], HInputStepper.prototype, "step", void 0);
|
|
92
126
|
HInputStepper = __decorate([
|
|
93
|
-
phoenixCustomElement(
|
|
127
|
+
phoenixCustomElement(INPUT_STEPPER_COMPONENT_NAMES.control)
|
|
94
128
|
], HInputStepper);
|
|
95
129
|
|
|
96
130
|
export { HInputStepper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
export declare const INPUT_STEPPER_EVENT_NAMES: {
|
|
2
|
-
readonly
|
|
3
|
-
readonly
|
|
4
|
-
};
|
|
5
|
-
export declare const DISPLAY_INPUT_EVENT_NAMES: {
|
|
6
|
-
readonly change: "displayInput.change";
|
|
2
|
+
readonly click: "click";
|
|
3
|
+
readonly change: "change";
|
|
7
4
|
};
|
|
8
|
-
export declare const
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
5
|
+
export declare const INPUT_STEPPER_CUSTOM_EVENT_NAMES: {
|
|
6
|
+
readonly valueChanged: "inputStepper.valueChanged";
|
|
7
|
+
readonly changeValue: "inputStepper.changeValue";
|
|
8
|
+
readonly increment: "inputStepper.increment";
|
|
9
|
+
readonly decrement: "inputStepper.decrement";
|
|
11
10
|
};
|
|
12
11
|
export declare const INPUT_STEPPER_CLASS_NAMES: {
|
|
13
12
|
readonly displayInput: "input-stepper__value_input";
|
|
14
13
|
};
|
|
14
|
+
export declare const INPUT_STEPPER_COMPONENT_NAMES: {
|
|
15
|
+
readonly control: "h-input-stepper";
|
|
16
|
+
readonly input: "h-display-stepper";
|
|
17
|
+
readonly button: "h-button-stepper";
|
|
18
|
+
};
|
|
19
|
+
export declare const INPUT_STEPPER_CONTEXTS_VARIABLE: {
|
|
20
|
+
readonly stepperContext: "stepperContext";
|
|
21
|
+
};
|
package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
const INPUT_STEPPER_EVENT_NAMES = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
click: 'click',
|
|
3
|
+
change: 'change'
|
|
4
4
|
};
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
decrement: 'decrement'
|
|
5
|
+
const INPUT_STEPPER_CUSTOM_EVENT_NAMES = {
|
|
6
|
+
valueChanged: 'inputStepper.valueChanged',
|
|
7
|
+
changeValue: 'inputStepper.changeValue',
|
|
8
|
+
increment: 'inputStepper.increment',
|
|
9
|
+
decrement: 'inputStepper.decrement'
|
|
11
10
|
};
|
|
12
11
|
const INPUT_STEPPER_CLASS_NAMES = {
|
|
13
12
|
displayInput: 'input-stepper__value_input'
|
|
13
|
+
};
|
|
14
|
+
const INPUT_STEPPER_COMPONENT_NAMES = {
|
|
15
|
+
control: 'h-input-stepper',
|
|
16
|
+
input: 'h-display-stepper',
|
|
17
|
+
button: 'h-button-stepper'
|
|
18
|
+
};
|
|
19
|
+
const INPUT_STEPPER_CONTEXTS_VARIABLE = {
|
|
20
|
+
stepperContext: 'stepperContext'
|
|
14
21
|
};
|
|
15
22
|
|
|
16
|
-
export {
|
|
23
|
+
export { INPUT_STEPPER_CLASS_NAMES, INPUT_STEPPER_COMPONENT_NAMES, INPUT_STEPPER_CONTEXTS_VARIABLE, INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_EVENT_NAMES };
|
|
17
24
|
//# sourceMappingURL=input_stepper_constants.js.map
|
package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -99,8 +99,8 @@ export { HIcon } from "./components/icon/icon";
|
|
|
99
99
|
export { HTag } from "./components/tag/tag";
|
|
100
100
|
export { HTagRemoveButton } from "./components/tag/tag_remove_button";
|
|
101
101
|
export { HInputStepper } from './components/form/input_stepper/input_stepper';
|
|
102
|
-
export {
|
|
103
|
-
export {
|
|
102
|
+
export { HDisplayStepper } from './components/form/input_stepper/display_stepper';
|
|
103
|
+
export { HButtonStepper } from './components/form/input_stepper/button_stepper';
|
|
104
104
|
export { HToggle } from './components/toggle/toggle';
|
|
105
105
|
export { HToggleBtn } from './components/toggle/toggle_button';
|
|
106
106
|
export * from './components/toggle/toggle_types';
|
|
@@ -83,9 +83,9 @@ export { HTooltip } from './components/messages/tooltips/tooltip.js';
|
|
|
83
83
|
export { HTooltipContent } from './components/messages/tooltips/tooltip_content.js';
|
|
84
84
|
export { HTag } from './components/tag/tag.js';
|
|
85
85
|
export { HTagRemoveButton } from './components/tag/tag_remove_button.js';
|
|
86
|
-
export { HStepperActionButton } from './components/form/input_stepper/stepper_action_button.js';
|
|
87
86
|
export { HInputStepper } from './components/form/input_stepper/input_stepper.js';
|
|
88
|
-
export {
|
|
87
|
+
export { HDisplayStepper } from './components/form/input_stepper/display_stepper.js';
|
|
88
|
+
export { HButtonStepper } from './components/form/input_stepper/button_stepper.js';
|
|
89
89
|
export { TOGGLE_ACTIONS, TOGGLE_CONTEXT_NAME, TOGGLE_EVENT_NAME } from './components/toggle/toggle_constants.js';
|
|
90
90
|
export { HToggle } from './components/toggle/toggle.js';
|
|
91
91
|
export { HToggleBtn } from './components/toggle/toggle_button.js';
|
package/package.json
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
-
var lit = require('lit');
|
|
7
|
-
var decorators = require('lit/decorators');
|
|
8
|
-
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
|
-
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
-
var ref_js = require('lit-html/directives/ref.js');
|
|
11
|
-
var input_stepper_constants = require('./input_stepper_constants.js');
|
|
12
|
-
|
|
13
|
-
exports.HDisplayInput = class HDisplayInput extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.controlId = '';
|
|
17
|
-
this.inputRef = ref_js.createRef();
|
|
18
|
-
this._testDispatchValueChanged = () => {
|
|
19
|
-
var _a;
|
|
20
|
-
const valueChangeEvent = new CustomEvent(input_stepper_constants.DISPLAY_INPUT_EVENT_NAMES.change, {
|
|
21
|
-
bubbles: true,
|
|
22
|
-
detail: {
|
|
23
|
-
value: (_a = this.inputRef.value) === null || _a === void 0 ? void 0 : _a.value
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
this.dispatchEvent(valueChangeEvent);
|
|
27
|
-
if (this.inputRef.value) {
|
|
28
|
-
this.inputRef.value.value = this.value;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
_setInputBehavior(event) {
|
|
33
|
-
const input = event.target;
|
|
34
|
-
input.focus();
|
|
35
|
-
input.select();
|
|
36
|
-
}
|
|
37
|
-
render() {
|
|
38
|
-
return lit.html `<input
|
|
39
|
-
id="${this.controlId}"
|
|
40
|
-
class="${input_stepper_constants.INPUT_STEPPER_CLASS_NAMES.displayInput}"
|
|
41
|
-
type="number"
|
|
42
|
-
${ref_js.ref(this.inputRef)}
|
|
43
|
-
.value="${this.value}"
|
|
44
|
-
@input=${this._testDispatchValueChanged}
|
|
45
|
-
@click=${this._setInputBehavior}
|
|
46
|
-
/>`;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
tslib_es6.__decorate([
|
|
50
|
-
decorators.property({ type: String, attribute: 'value', reflect: true }),
|
|
51
|
-
tslib_es6.__metadata("design:type", String)
|
|
52
|
-
], exports.HDisplayInput.prototype, "value", void 0);
|
|
53
|
-
tslib_es6.__decorate([
|
|
54
|
-
decorators.property({ type: Number, attribute: 'control-id', reflect: true }),
|
|
55
|
-
tslib_es6.__metadata("design:type", String)
|
|
56
|
-
], exports.HDisplayInput.prototype, "controlId", void 0);
|
|
57
|
-
exports.HDisplayInput = tslib_es6.__decorate([
|
|
58
|
-
phoenix_custom_element.phoenixCustomElement('h-display-input')
|
|
59
|
-
], exports.HDisplayInput);
|
|
60
|
-
//# sourceMappingURL=display_input.js.map
|
package/build/cjs/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
-
var decorators = require('lit/decorators');
|
|
7
|
-
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
8
|
-
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
9
|
-
var btn_controller = require('../../../controllers/btn_controller/btn_controller.js');
|
|
10
|
-
var input_stepper_constants = require('./input_stepper_constants.js');
|
|
11
|
-
|
|
12
|
-
exports.HStepperActionButton = class HStepperActionButton extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
this._dispatchChangeEvent = () => {
|
|
16
|
-
const unitaryValueChangeEvent = new CustomEvent(input_stepper_constants.INPUT_STEPPER_EVENT_NAMES.change, {
|
|
17
|
-
bubbles: true,
|
|
18
|
-
detail: {
|
|
19
|
-
action: this.action
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
this.dispatchEvent(unitaryValueChangeEvent);
|
|
23
|
-
};
|
|
24
|
-
new btn_controller.BtnController(this, this._dispatchChangeEvent);
|
|
25
|
-
}
|
|
26
|
-
connectedCallback() {
|
|
27
|
-
super.connectedCallback();
|
|
28
|
-
this.addEventListener('click', this._dispatchChangeEvent);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
tslib_es6.__decorate([
|
|
32
|
-
decorators.property({ type: String, attribute: 'action', reflect: true }),
|
|
33
|
-
tslib_es6.__metadata("design:type", String)
|
|
34
|
-
], exports.HStepperActionButton.prototype, "action", void 0);
|
|
35
|
-
exports.HStepperActionButton = tslib_es6.__decorate([
|
|
36
|
-
phoenix_custom_element.phoenixCustomElement('h-stepper-action-button'),
|
|
37
|
-
tslib_es6.__metadata("design:paramtypes", [])
|
|
38
|
-
], exports.HStepperActionButton);
|
|
39
|
-
//# sourceMappingURL=stepper_action_button.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
-
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
-
export declare class HDisplayInput extends PhoenixLightLitElement {
|
|
4
|
-
value: string;
|
|
5
|
-
controlId: string;
|
|
6
|
-
inputRef: Ref<HTMLInputElement>;
|
|
7
|
-
private _setInputBehavior;
|
|
8
|
-
private _testDispatchValueChanged;
|
|
9
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
import { property } from 'lit/decorators';
|
|
4
|
-
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
-
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
-
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
7
|
-
import { DISPLAY_INPUT_EVENT_NAMES, INPUT_STEPPER_CLASS_NAMES } from './input_stepper_constants.js';
|
|
8
|
-
|
|
9
|
-
let HDisplayInput = class HDisplayInput extends PhoenixLightLitElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.controlId = '';
|
|
13
|
-
this.inputRef = createRef();
|
|
14
|
-
this._testDispatchValueChanged = () => {
|
|
15
|
-
var _a;
|
|
16
|
-
const valueChangeEvent = new CustomEvent(DISPLAY_INPUT_EVENT_NAMES.change, {
|
|
17
|
-
bubbles: true,
|
|
18
|
-
detail: {
|
|
19
|
-
value: (_a = this.inputRef.value) === null || _a === void 0 ? void 0 : _a.value
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
this.dispatchEvent(valueChangeEvent);
|
|
23
|
-
if (this.inputRef.value) {
|
|
24
|
-
this.inputRef.value.value = this.value;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
_setInputBehavior(event) {
|
|
29
|
-
const input = event.target;
|
|
30
|
-
input.focus();
|
|
31
|
-
input.select();
|
|
32
|
-
}
|
|
33
|
-
render() {
|
|
34
|
-
return html `<input
|
|
35
|
-
id="${this.controlId}"
|
|
36
|
-
class="${INPUT_STEPPER_CLASS_NAMES.displayInput}"
|
|
37
|
-
type="number"
|
|
38
|
-
${ref(this.inputRef)}
|
|
39
|
-
.value="${this.value}"
|
|
40
|
-
@input=${this._testDispatchValueChanged}
|
|
41
|
-
@click=${this._setInputBehavior}
|
|
42
|
-
/>`;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
__decorate([
|
|
46
|
-
property({ type: String, attribute: 'value', reflect: true }),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], HDisplayInput.prototype, "value", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
property({ type: Number, attribute: 'control-id', reflect: true }),
|
|
51
|
-
__metadata("design:type", String)
|
|
52
|
-
], HDisplayInput.prototype, "controlId", void 0);
|
|
53
|
-
HDisplayInput = __decorate([
|
|
54
|
-
phoenixCustomElement('h-display-input')
|
|
55
|
-
], HDisplayInput);
|
|
56
|
-
|
|
57
|
-
export { HDisplayInput };
|
|
58
|
-
//# sourceMappingURL=display_input.js.map
|
package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input_stepper_types.js","sourceRoot":"","sources":["../../../../../../../../src/components/form/input_stepper/input_stepper_types.ts"],"names":[],"mappings":"AAAA,OAAoB,aAAa,CAAC;AAClC,OAA2C,2BAA2B,CAAC"}
|
package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
-
import type { TInputStepperAction } from './input_stepper_types';
|
|
3
|
-
export declare class HStepperActionButton extends PhoenixLightLitElement {
|
|
4
|
-
action: TInputStepperAction;
|
|
5
|
-
constructor();
|
|
6
|
-
connectedCallback(): void;
|
|
7
|
-
private _dispatchChangeEvent;
|
|
8
|
-
}
|
package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
3
|
-
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
4
|
-
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
5
|
-
import { BtnController } from '../../../controllers/btn_controller/btn_controller.js';
|
|
6
|
-
import { INPUT_STEPPER_EVENT_NAMES } from './input_stepper_constants.js';
|
|
7
|
-
|
|
8
|
-
let HStepperActionButton = class HStepperActionButton extends PhoenixLightLitElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this._dispatchChangeEvent = () => {
|
|
12
|
-
const unitaryValueChangeEvent = new CustomEvent(INPUT_STEPPER_EVENT_NAMES.change, {
|
|
13
|
-
bubbles: true,
|
|
14
|
-
detail: {
|
|
15
|
-
action: this.action
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
this.dispatchEvent(unitaryValueChangeEvent);
|
|
19
|
-
};
|
|
20
|
-
new BtnController(this, this._dispatchChangeEvent);
|
|
21
|
-
}
|
|
22
|
-
connectedCallback() {
|
|
23
|
-
super.connectedCallback();
|
|
24
|
-
this.addEventListener('click', this._dispatchChangeEvent);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
__decorate([
|
|
28
|
-
property({ type: String, attribute: 'action', reflect: true }),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], HStepperActionButton.prototype, "action", void 0);
|
|
31
|
-
HStepperActionButton = __decorate([
|
|
32
|
-
phoenixCustomElement('h-stepper-action-button'),
|
|
33
|
-
__metadata("design:paramtypes", [])
|
|
34
|
-
], HStepperActionButton);
|
|
35
|
-
|
|
36
|
-
export { HStepperActionButton };
|
|
37
|
-
//# sourceMappingURL=stepper_action_button.js.map
|