@shoper/phoenix_design_system 1.2.0-3 → 1.2.0-5
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/form/select/components/option/select_option.js +5 -6
- package/build/cjs/packages/phoenix/src/components/form/select/components/option/select_option.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/base_select_controller.js +13 -13
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js +6 -6
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_controller.js +2 -2
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +79 -23
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select_constants.js +5 -0
- package/build/cjs/packages/phoenix/src/components/form/select/select_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js +6 -0
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/modal/modal.js +1 -1
- package/build/cjs/packages/phoenix/src/index.js +0 -21
- package/build/cjs/packages/phoenix/src/index.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.d.ts +9 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.js +49 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.d.ts +19 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js +93 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.d.ts +11 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js +12 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.js +3 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.d.ts +8 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js +35 -0
- package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js +5 -6
- package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/controllers/base_select_controller.d.ts +10 -10
- package/build/esm/packages/phoenix/src/components/form/select/controllers/base_select_controller.js +13 -13
- package/build/esm/packages/phoenix/src/components/form/select/controllers/multi_select_controller.d.ts +3 -3
- package/build/esm/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js +6 -6
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controller.d.ts +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controller.js +2 -2
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controllers_types.d.ts +9 -9
- package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +16 -3
- package/build/esm/packages/phoenix/src/components/form/select/select.js +80 -24
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_constants.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/form/select/select_constants.js +5 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_types.d.ts +2 -0
- package/build/esm/packages/phoenix/src/components/form/select/select_types.js +2 -0
- package/build/esm/packages/phoenix/src/components/form/select/select_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.d.ts +2 -0
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js +6 -0
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/modal/modal.js +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +0 -3
- package/build/esm/packages/phoenix/src/index.js +0 -3
- package/build/esm/packages/phoenix/src/index.js.map +1 -1
- package/package.json +2 -2
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js +0 -67
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js.map +0 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file_model.js +0 -18
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file_model.js.map +0 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js +0 -177
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js.map +0 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +0 -37
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map +0 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js +0 -59
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.d.ts +0 -12
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.js +0 -65
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.d.ts +0 -9
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.js +0 -14
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.d.ts +0 -31
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js +0 -175
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.d.ts +0 -29
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +0 -29
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.d.ts +0 -13
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js +0 -57
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map +0 -1
package/build/cjs/packages/phoenix/src/components/form/select/components/option/select_option.js
CHANGED
|
@@ -9,6 +9,7 @@ var decorators_js = require('@lit/reactive-element/decorators.js');
|
|
|
9
9
|
var select_components_constatns = require('../select_components_constatns.js');
|
|
10
10
|
var btn_controller = require('../../../../../controllers/btn_controller/btn_controller.js');
|
|
11
11
|
var select_option_constants = require('./select_option_constants.js');
|
|
12
|
+
require('@lit/reactive-element');
|
|
12
13
|
|
|
13
14
|
exports.HOption = class HOption extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
14
15
|
constructor() {
|
|
@@ -37,12 +38,10 @@ exports.HOption = class HOption extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
37
38
|
_setupEvents() {
|
|
38
39
|
this.addEventListener('click', this._dispatchClickedEvent);
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
super.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.selected ? this._addSelectedIcon() : this._removeSelectedIcon();
|
|
45
|
-
}
|
|
41
|
+
updated(changedProperties) {
|
|
42
|
+
super.updated(changedProperties);
|
|
43
|
+
if (changedProperties.has('selected'))
|
|
44
|
+
this.selected ? this._addSelectedIcon() : this._removeSelectedIcon();
|
|
46
45
|
}
|
|
47
46
|
_addSelectedIcon() {
|
|
48
47
|
this._$checkedIcon = document.createElement('h-icon');
|
package/build/cjs/packages/phoenix/src/components/form/select/components/option/select_option.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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/select/controllers/base_select_controller.js
CHANGED
|
@@ -29,16 +29,16 @@ class BaseSelectController {
|
|
|
29
29
|
this._optionsObserver = new observer.Observer(this._calculateValuesRelatedToOptions);
|
|
30
30
|
this.options$.subscribe(this._optionsObserver);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
option.selected ? this.
|
|
32
|
+
toggle(option) {
|
|
33
|
+
option.selected ? this.deselect(option) : this.select(option);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
remove(optionValue) {
|
|
36
36
|
const options = this.options$.getValue();
|
|
37
37
|
if (!options)
|
|
38
38
|
return;
|
|
39
39
|
this.options$.notify(options.filter((option) => option.value !== optionValue));
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
add(option, position) {
|
|
42
42
|
var _a;
|
|
43
43
|
const options = (_a = this.options$.getValue()) !== null && _a !== void 0 ? _a : [];
|
|
44
44
|
if (position === undefined) {
|
|
@@ -48,22 +48,22 @@ class BaseSelectController {
|
|
|
48
48
|
}
|
|
49
49
|
this.options$.notify([...options.slice(0, position - 1), option, ...options.slice(position - 1)]);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
replace(options) {
|
|
52
52
|
this.options$.notify(options);
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
deselectAll() {
|
|
55
55
|
var _a;
|
|
56
56
|
(_a = this.options$.getValue()) === null || _a === void 0 ? void 0 : _a.forEach((option) => (option.selected = false));
|
|
57
57
|
this.selectedOptions$.notify([]);
|
|
58
|
-
this.
|
|
58
|
+
this.requestUpdate();
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
deselect(option) {
|
|
61
61
|
var _a;
|
|
62
62
|
(_a = this.options$.getValue()) === null || _a === void 0 ? void 0 : _a.forEach((option) => (option.selected = false));
|
|
63
63
|
this.selectedOptions$.notify([]);
|
|
64
|
-
this.
|
|
64
|
+
this.requestUpdate();
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
filter(value) {
|
|
67
67
|
const selectOptions = this.options$.getValue();
|
|
68
68
|
if (!selectOptions)
|
|
69
69
|
return;
|
|
@@ -72,16 +72,16 @@ class BaseSelectController {
|
|
|
72
72
|
filtered.forEach((option) => {
|
|
73
73
|
option.hidden = false;
|
|
74
74
|
});
|
|
75
|
-
this.
|
|
75
|
+
this.requestUpdate();
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
requestUpdate() {
|
|
78
78
|
const selectOptions = this.options$.getValue();
|
|
79
79
|
if (!selectOptions)
|
|
80
80
|
return;
|
|
81
81
|
this.options$.notify([...selectOptions]);
|
|
82
82
|
this.host.requestUpdate();
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
getOption(selectValue) {
|
|
85
85
|
var _a;
|
|
86
86
|
return (_a = this.options$.getValue()) === null || _a === void 0 ? void 0 : _a.find((option) => option.value === selectValue);
|
|
87
87
|
}
|
package/build/cjs/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js
CHANGED
|
@@ -5,18 +5,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var base_select_controller = require('./base_select_controller.js');
|
|
6
6
|
|
|
7
7
|
class MultiSelectController extends base_select_controller.BaseSelectController {
|
|
8
|
-
|
|
9
|
-
option.selected ? this.
|
|
8
|
+
toggle(option) {
|
|
9
|
+
option.selected ? this.deselect(option) : this.select(option);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
select(option) {
|
|
12
12
|
option.selected = true;
|
|
13
13
|
this.selectedOptions$.notify((selectedOptions) => [...selectedOptions, option]);
|
|
14
|
-
this.
|
|
14
|
+
this.requestUpdate();
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
deselect(option) {
|
|
17
17
|
option.selected = false;
|
|
18
18
|
this.selectedOptions$.notify((selectedOptions) => selectedOptions.filter((currOption) => currOption.value !== option.value));
|
|
19
|
-
this.
|
|
19
|
+
this.requestUpdate();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_controller.js
CHANGED
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var base_select_controller = require('./base_select_controller.js');
|
|
6
6
|
|
|
7
7
|
class SelectController extends base_select_controller.BaseSelectController {
|
|
8
|
-
|
|
8
|
+
select(option) {
|
|
9
9
|
var _a;
|
|
10
10
|
const selectedOptions = (_a = this.options$.getValue()) !== null && _a !== void 0 ? _a : [];
|
|
11
11
|
selectedOptions.forEach((option) => (option.selected = false));
|
|
12
12
|
option.selected = true;
|
|
13
13
|
this.selectedOptions$.notify([option]);
|
|
14
|
-
this.
|
|
14
|
+
this.requestUpdate();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -30,9 +30,10 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
30
30
|
constructor() {
|
|
31
31
|
var _a;
|
|
32
32
|
super();
|
|
33
|
-
this.
|
|
33
|
+
this.multiple = false;
|
|
34
34
|
this.opened = false;
|
|
35
35
|
this.offset = 2;
|
|
36
|
+
this.type = select_constants.SELECT_TYPES.select;
|
|
36
37
|
this._searchValue = '';
|
|
37
38
|
this._$options = {};
|
|
38
39
|
this._$dropdown = ref_js.createRef();
|
|
@@ -45,10 +46,11 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
45
46
|
this._$dropdownContent.value.style.width = `${width !== null && width !== void 0 ? width : ''}px`;
|
|
46
47
|
};
|
|
47
48
|
this._handleOptionDeselect = (event) => {
|
|
48
|
-
const selectedOption = this._selectController.
|
|
49
|
+
const selectedOption = this._selectController.getOption(event.detail);
|
|
49
50
|
if (!selectedOption)
|
|
50
51
|
return;
|
|
51
|
-
this._selectController.
|
|
52
|
+
this._selectController.deselect(selectedOption);
|
|
53
|
+
this._dispatchChangeEvent();
|
|
52
54
|
};
|
|
53
55
|
this._updateOptionsView = (options) => {
|
|
54
56
|
if (options.length < Object.keys(this._$options).length)
|
|
@@ -63,16 +65,11 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
63
65
|
select_utils.SelectControlUtils.syncHTMLOptionWithModel(option, $option);
|
|
64
66
|
if (!selected)
|
|
65
67
|
return;
|
|
66
|
-
$option.setAttribute(this.
|
|
68
|
+
$option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
|
|
67
69
|
});
|
|
68
70
|
};
|
|
69
71
|
this._handleOptionClicked = (event) => {
|
|
70
|
-
|
|
71
|
-
if (!selectedOption)
|
|
72
|
-
return;
|
|
73
|
-
this._selectController.toggleOption(selectedOption);
|
|
74
|
-
if (!this.multiselect)
|
|
75
|
-
this._closeSelect();
|
|
72
|
+
this._selectOption(event.detail.$option.value);
|
|
76
73
|
};
|
|
77
74
|
this._handleDropdownHidden = () => {
|
|
78
75
|
this._searchValue = '';
|
|
@@ -85,7 +82,11 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
85
82
|
(_a = this._$dropdown.value) === null || _a === void 0 ? void 0 : _a.hide();
|
|
86
83
|
};
|
|
87
84
|
this._clearOptions = () => {
|
|
88
|
-
this._selectController.
|
|
85
|
+
this._selectController.deselectAll();
|
|
86
|
+
this._dispatchChangeEvent();
|
|
87
|
+
};
|
|
88
|
+
this._dispatchChangeEvent = () => {
|
|
89
|
+
this.dispatchEvent(new Event('change'));
|
|
89
90
|
};
|
|
90
91
|
this._handleResize = debounce['default'](() => {
|
|
91
92
|
this._closeSelect();
|
|
@@ -94,6 +95,39 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
94
95
|
const $options = Array.from(this.querySelectorAll(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.option));
|
|
95
96
|
$options.forEach(($option) => $option.setAttribute('slot', select_constants.SELECT_SLOT_NAMES.content));
|
|
96
97
|
this.$placeholder = (_a = this.querySelector(`[slot="${select_components_constatns.SELECT_INPUT_PLACEHOLDER_SLOT_NAME}"]`)) !== null && _a !== void 0 ? _a : 'Select';
|
|
98
|
+
if (this.multiple)
|
|
99
|
+
this.type = select_constants.SELECT_TYPES.multiple;
|
|
100
|
+
}
|
|
101
|
+
get selectedIndex() {
|
|
102
|
+
const selectedOptions = this._selectController.selectedOptions$.getValue();
|
|
103
|
+
if (!selectedOptions || selectedOptions.length === 0)
|
|
104
|
+
return -1;
|
|
105
|
+
const htmlOptions = Object.values(this._$options);
|
|
106
|
+
return this.multiple
|
|
107
|
+
? select_utils.SelectControlUtils.getFirstIndexSelectedOption(htmlOptions)
|
|
108
|
+
: select_utils.SelectControlUtils.getLastIndexOfSelectedOption(htmlOptions);
|
|
109
|
+
}
|
|
110
|
+
set selectedIndex(index) {
|
|
111
|
+
const option = Object.values(this._$options)[index];
|
|
112
|
+
if (!option) {
|
|
113
|
+
this._selectController.deselectAll();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this._selectOption(option.value);
|
|
117
|
+
}
|
|
118
|
+
get selectedOptions() {
|
|
119
|
+
var _a;
|
|
120
|
+
const selectedOptions = (_a = this._selectController.selectedOptions$.getValue()) !== null && _a !== void 0 ? _a : [];
|
|
121
|
+
return selectedOptions.filter((option) => option.selected).map((option) => this._$options[option.value]);
|
|
122
|
+
}
|
|
123
|
+
get name() {
|
|
124
|
+
return this.controlName;
|
|
125
|
+
}
|
|
126
|
+
get id() {
|
|
127
|
+
return this.controlId;
|
|
128
|
+
}
|
|
129
|
+
get options() {
|
|
130
|
+
return Object.values(this._$options);
|
|
97
131
|
}
|
|
98
132
|
updated(changedProperties) {
|
|
99
133
|
super.updated(changedProperties);
|
|
@@ -120,9 +154,9 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
120
154
|
connectedCallback() {
|
|
121
155
|
super.connectedCallback();
|
|
122
156
|
this.classList.add(select_constants.SELECT_CSS_CLASSES.select);
|
|
123
|
-
this._selectController = this.
|
|
157
|
+
this._selectController = this.multiple ? new multi_select_controller.MultiSelectController({ host: this }) : new select_controller.SelectController({ host: this });
|
|
124
158
|
this._selectContext.provide(select_constants.SELECT_CONTEXTS.selectedOptions$, this._selectController.selectedOptions$);
|
|
125
|
-
this._selectContext.provide(select_constants.SELECT_CONTEXTS.isMultiselect, this.
|
|
159
|
+
this._selectContext.provide(select_constants.SELECT_CONTEXTS.isMultiselect, this.multiple);
|
|
126
160
|
const $options = Array.from(this.querySelectorAll(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.option));
|
|
127
161
|
this._optionsObserver = new observer.Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
|
|
128
162
|
this._selectController.options$.subscribe(this._optionsObserver);
|
|
@@ -166,29 +200,38 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
166
200
|
const { value, selected } = option;
|
|
167
201
|
const $option = select_utils.SelectControlUtils.createHTMLOption(option);
|
|
168
202
|
if (selected)
|
|
169
|
-
$option.setAttribute(this.
|
|
203
|
+
$option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
|
|
170
204
|
this._$options[value] = $option;
|
|
171
205
|
select_utils.SelectControlUtils.appendHTMLOption($option, $list, position);
|
|
172
206
|
}
|
|
173
207
|
_removeHTMLOptions(optionsValues) {
|
|
174
208
|
this._$options = select_utils.SelectControlUtils.removeHTMLOptions(Object.values(this._$options), optionsValues);
|
|
175
209
|
}
|
|
210
|
+
_selectOption(value) {
|
|
211
|
+
const option = this._selectController.getOption(value);
|
|
212
|
+
if (!option)
|
|
213
|
+
return;
|
|
214
|
+
this._selectController.toggle(option);
|
|
215
|
+
if (!this.multiple)
|
|
216
|
+
this._closeSelect();
|
|
217
|
+
this._dispatchChangeEvent();
|
|
218
|
+
}
|
|
176
219
|
_handleSearch({ detail }) {
|
|
177
220
|
this._searchValue = detail;
|
|
178
221
|
}
|
|
179
222
|
update(changedProperties) {
|
|
180
223
|
super.update(changedProperties);
|
|
181
224
|
if (changedProperties.has('_searchValue'))
|
|
182
|
-
this._selectController.
|
|
225
|
+
this._selectController.filter(this._searchValue);
|
|
183
226
|
}
|
|
184
|
-
|
|
185
|
-
this._selectController.
|
|
227
|
+
add(option, position) {
|
|
228
|
+
this._selectController.add(option, position);
|
|
186
229
|
}
|
|
187
230
|
removeOption(optionValue) {
|
|
188
|
-
this._selectController.
|
|
231
|
+
this._selectController.remove(optionValue);
|
|
189
232
|
}
|
|
190
|
-
|
|
191
|
-
this._selectController.
|
|
233
|
+
replace(options) {
|
|
234
|
+
this._selectController.replace(options);
|
|
192
235
|
}
|
|
193
236
|
disconnectedCallback() {
|
|
194
237
|
super.disconnectedCallback();
|
|
@@ -218,6 +261,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
218
261
|
<h-dropdown-toggler name=${this.controlName}> ${this.getSlot(select_constants.SELECT_SLOT_NAMES.toggler)} </h-dropdown-toggler>
|
|
219
262
|
|
|
220
263
|
<h-dropdown-content
|
|
264
|
+
@focusout=${this._dispatchChangeEvent}
|
|
221
265
|
class="${select_constants.SELECT_CSS_CLASSES.selectContent} ${this.error ? select_constants.SELECT_CSS_CLASSES.selectContentError : ''}"
|
|
222
266
|
${ref_js.ref(this._$dropdownContent)}
|
|
223
267
|
name=${this.controlName}
|
|
@@ -257,7 +301,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
257
301
|
</p>
|
|
258
302
|
</div>`
|
|
259
303
|
: lit.nothing}
|
|
260
|
-
${this.
|
|
304
|
+
${this.multiple && this._selectController.selectedOptionsCount >= 1
|
|
261
305
|
? lit.html `
|
|
262
306
|
<section class=${select_constants.SELECT_CSS_CLASSES.selectFooter}>
|
|
263
307
|
<button class="${select_constants.SELECT_CSS_CLASSES.selectClearButton}" @click=${this._clearOptions}>clear</button>
|
|
@@ -281,13 +325,17 @@ exports.HSelect._components = {
|
|
|
281
325
|
toggler: select_toggler.HSelectToggler
|
|
282
326
|
};
|
|
283
327
|
tslib_es6.__decorate([
|
|
284
|
-
decorators_js.property({ type: String }),
|
|
328
|
+
decorators_js.property({ type: String, attribute: 'control-name' }),
|
|
285
329
|
tslib_es6.__metadata("design:type", String)
|
|
286
330
|
], exports.HSelect.prototype, "controlName", void 0);
|
|
331
|
+
tslib_es6.__decorate([
|
|
332
|
+
decorators_js.property({ type: String, attribute: 'control-id' }),
|
|
333
|
+
tslib_es6.__metadata("design:type", String)
|
|
334
|
+
], exports.HSelect.prototype, "controlId", void 0);
|
|
287
335
|
tslib_es6.__decorate([
|
|
288
336
|
decorators_js.property({ type: Boolean }),
|
|
289
337
|
tslib_es6.__metadata("design:type", Boolean)
|
|
290
|
-
], exports.HSelect.prototype, "
|
|
338
|
+
], exports.HSelect.prototype, "multiple", void 0);
|
|
291
339
|
tslib_es6.__decorate([
|
|
292
340
|
decorators_js.property({ type: Boolean }),
|
|
293
341
|
tslib_es6.__metadata("design:type", Boolean)
|
|
@@ -304,6 +352,14 @@ tslib_es6.__decorate([
|
|
|
304
352
|
decorators_js.property({ type: Boolean }),
|
|
305
353
|
tslib_es6.__metadata("design:type", Boolean)
|
|
306
354
|
], exports.HSelect.prototype, "disabled", void 0);
|
|
355
|
+
tslib_es6.__decorate([
|
|
356
|
+
decorators_js.property({ type: String }),
|
|
357
|
+
tslib_es6.__metadata("design:type", String)
|
|
358
|
+
], exports.HSelect.prototype, "type", void 0);
|
|
359
|
+
tslib_es6.__decorate([
|
|
360
|
+
decorators_js.property({ type: Boolean }),
|
|
361
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
362
|
+
], exports.HSelect.prototype, "required", void 0);
|
|
307
363
|
tslib_es6.__decorate([
|
|
308
364
|
decorators.state(),
|
|
309
365
|
tslib_es6.__metadata("design:type", String)
|
|
@@ -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,uBAAuB,+CAAmD;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,uBAAuB,+CAAmD;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -10,6 +10,10 @@ const SELECT_SLOT_NAMES = {
|
|
|
10
10
|
content: 'content',
|
|
11
11
|
toggler: 'toggler'
|
|
12
12
|
};
|
|
13
|
+
const SELECT_TYPES = {
|
|
14
|
+
select: 'select-one',
|
|
15
|
+
multiple: 'select-multiple'
|
|
16
|
+
};
|
|
13
17
|
const SELECT_EVENT_NAMES = {
|
|
14
18
|
selectOption: 'selectOption.select',
|
|
15
19
|
deselectOption: 'selectOption.deselect'
|
|
@@ -42,4 +46,5 @@ exports.SELECT_CSS_CLASSES = SELECT_CSS_CLASSES;
|
|
|
42
46
|
exports.SELECT_EVENT_NAMES = SELECT_EVENT_NAMES;
|
|
43
47
|
exports.SELECT_RESIZE_DEBOUNCE_TIME = SELECT_RESIZE_DEBOUNCE_TIME;
|
|
44
48
|
exports.SELECT_SLOT_NAMES = SELECT_SLOT_NAMES;
|
|
49
|
+
exports.SELECT_TYPES = SELECT_TYPES;
|
|
45
50
|
//# sourceMappingURL=select_constants.js.map
|
|
@@ -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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -46,6 +46,12 @@ class SelectControlUtils {
|
|
|
46
46
|
}
|
|
47
47
|
$list.append($option);
|
|
48
48
|
}
|
|
49
|
+
static getFirstIndexSelectedOption(options) {
|
|
50
|
+
return options.findIndex((option) => option.selected);
|
|
51
|
+
}
|
|
52
|
+
static getLastIndexOfSelectedOption(options) {
|
|
53
|
+
return [...options].reverse().findIndex((option) => option.selected);
|
|
54
|
+
}
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
exports.SelectControlUtils = SelectControlUtils;
|
|
@@ -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;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -6,11 +6,11 @@ var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
|
6
6
|
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
7
7
|
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
8
8
|
var decorators_js = require('@lit/reactive-element/decorators.js');
|
|
9
|
+
require('@lit/reactive-element');
|
|
9
10
|
var litHtml = require('lit-html');
|
|
10
11
|
var ref_js = require('lit-html/directives/ref.js');
|
|
11
12
|
var portal_constants = require('../portal/portal_constants.js');
|
|
12
13
|
var backdrop_controller = require('../backdrop/controller/backdrop_controller.js');
|
|
13
|
-
require('@lit/reactive-element');
|
|
14
14
|
var modal_constants = require('./modal_constants.js');
|
|
15
15
|
|
|
16
16
|
var HModal_1;
|
|
@@ -23,9 +23,6 @@ var dropdown_toggler = require('./components/dropdown/dropdown_toggler.js');
|
|
|
23
23
|
var relative_position_controller = require('./controllers/relative_position_controller/relative_position_controller.js');
|
|
24
24
|
var dropdown = require('./components/dropdown/dropdown.js');
|
|
25
25
|
var select = require('./components/form/select/select.js');
|
|
26
|
-
var file = require('./components/form/file_picker/file/file.js');
|
|
27
|
-
var file_picker = require('./components/form/file_picker/file_picker.js');
|
|
28
|
-
var file_picker_label = require('./components/form/file_picker/file_picker_label.js');
|
|
29
26
|
var modal = require('./components/modal/modal.js');
|
|
30
27
|
var modal_opener = require('./components/modal/modal_opener.js');
|
|
31
28
|
var modal_body = require('./components/modal/modal_body.js');
|
|
@@ -165,24 +162,6 @@ Object.defineProperty(exports, 'HSelect', {
|
|
|
165
162
|
return select.HSelect;
|
|
166
163
|
}
|
|
167
164
|
});
|
|
168
|
-
Object.defineProperty(exports, 'HFile', {
|
|
169
|
-
enumerable: true,
|
|
170
|
-
get: function () {
|
|
171
|
-
return file.HFile;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
Object.defineProperty(exports, 'HFilePicker', {
|
|
175
|
-
enumerable: true,
|
|
176
|
-
get: function () {
|
|
177
|
-
return file_picker.HFilePicker;
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
Object.defineProperty(exports, 'HFilePickerLabel', {
|
|
181
|
-
enumerable: true,
|
|
182
|
-
get: function () {
|
|
183
|
-
return file_picker_label.HFilePickerLabel;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
165
|
Object.defineProperty(exports, 'HModal', {
|
|
187
166
|
enumerable: true,
|
|
188
167
|
get: function () {
|
|
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
export declare class HDisplayInput extends PhoenixLightLitElement {
|
|
4
|
+
value: string;
|
|
5
|
+
inputRef: Ref<HTMLInputElement>;
|
|
6
|
+
private _setInputBehavior;
|
|
7
|
+
private _testDispatchValueChanged;
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { DISPLAY_INPUT_EVENT_NAMES } from '@phoenixRoot/components/form/input_stepper/input_stepper_constants';
|
|
3
|
+
import { phoenixCustomElement } from '@phoenixRoot/core/decorators/phoenix_custom_element';
|
|
4
|
+
import { PhoenixLightLitElement } from '@phoenixRoot/core/phoenix_light_lit_element/phoenix_light_lit_element';
|
|
5
|
+
import { html } from 'lit';
|
|
6
|
+
import { property } from 'lit/decorators';
|
|
7
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
|
8
|
+
let HDisplayInput = class HDisplayInput extends PhoenixLightLitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.inputRef = createRef();
|
|
12
|
+
this._testDispatchValueChanged = () => {
|
|
13
|
+
var _a;
|
|
14
|
+
const valueChangeEvent = new CustomEvent(DISPLAY_INPUT_EVENT_NAMES.change, {
|
|
15
|
+
bubbles: true,
|
|
16
|
+
detail: {
|
|
17
|
+
value: (_a = this.inputRef.value) === null || _a === void 0 ? void 0 : _a.value
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
this.dispatchEvent(valueChangeEvent);
|
|
21
|
+
if (this.inputRef.value) {
|
|
22
|
+
this.inputRef.value.value = this.value;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
_setInputBehavior(event) {
|
|
27
|
+
const input = event.target;
|
|
28
|
+
input.focus();
|
|
29
|
+
input.select();
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return html `<input
|
|
33
|
+
type="text"
|
|
34
|
+
${ref(this.inputRef)}
|
|
35
|
+
.value="${this.value}"
|
|
36
|
+
@input=${this._testDispatchValueChanged}
|
|
37
|
+
@click=${(event) => this._setInputBehavior(event)}
|
|
38
|
+
/>`;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
property({ type: String, attribute: 'value', reflect: true }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], HDisplayInput.prototype, "value", void 0);
|
|
45
|
+
HDisplayInput = __decorate([
|
|
46
|
+
phoenixCustomElement('h-display-input')
|
|
47
|
+
], HDisplayInput);
|
|
48
|
+
export { HDisplayInput };
|
|
49
|
+
//# sourceMappingURL=display_input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display_input.js","sourceRoot":"","sources":["../../../../../../../../src/components/form/input_stepper/display_input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oEAAoE,CAAC;AAC/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAC/G,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,GAAG,EAAO,MAAM,uBAAuB,CAAC;AAG5D,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,sBAAsB;IAAzD;;QAIW,aAAQ,GAA0B,SAAS,EAAE,CAAC;QAQ7C,8BAAyB,GAAG,GAAG,EAAE;;YACrC,MAAM,gBAAgB,GAAG,IAAI,WAAW,CAAC,yBAAyB,CAAC,MAAM,EAAE;gBACvE,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE;oBACJ,KAAK,EAAE,MAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,0CAAE,KAAK;iBACpC;aACJ,CAAC,CAAC;YACH,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;YACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;gBACrB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC1C;QACL,CAAC,CAAC;IAWN,CAAC;IA5BW,iBAAiB,CAAC,KAAY;QAClC,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;IAeM,MAAM;QACT,OAAO,IAAI,CAAA;;cAEL,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;sBACV,IAAI,CAAC,KAAK;qBACX,IAAI,CAAC,yBAAyB;qBAC9B,CAAC,KAAY,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;WACzD,CAAC;IACR,CAAC;CACJ,CAAA;AAhCG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4CAChD;AAFL,aAAa;IADzB,oBAAoB,CAAC,iBAAiB,CAAC;GAC3B,aAAa,CAkCzB;SAlCY,aAAa"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
+
import { PropertyValues } from 'lit';
|
|
3
|
+
export declare class HInputStepper extends PhoenixLightLitElement {
|
|
4
|
+
step: number;
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
private _value;
|
|
8
|
+
private _$inputElement;
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
12
|
+
private _setupEvents;
|
|
13
|
+
private _handleInputChange;
|
|
14
|
+
private _handleDisplayChange;
|
|
15
|
+
private _handleUpdateValue;
|
|
16
|
+
private _increment;
|
|
17
|
+
private _decrement;
|
|
18
|
+
private _dispatchValueChanged;
|
|
19
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@phoenixRoot/components/form/input_stepper/stepper_action_button';
|
|
3
|
+
import { phoenixCustomElement } from '@phoenixRoot/core/decorators/phoenix_custom_element';
|
|
4
|
+
import { PhoenixLightLitElement } from '@phoenixRoot/core/phoenix_light_lit_element/phoenix_light_lit_element';
|
|
5
|
+
import 'lit';
|
|
6
|
+
import { property, state } from 'lit/decorators';
|
|
7
|
+
import { DISPLAY_INPUT_EVENT_NAMES, INPUT_STEPPER_ACTION_TYPES, INPUT_STEPPER_EVENT_NAMES } from './input_stepper_constants';
|
|
8
|
+
let HInputStepper = class HInputStepper extends PhoenixLightLitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.step = 1;
|
|
12
|
+
this.min = -Infinity;
|
|
13
|
+
this.max = Infinity;
|
|
14
|
+
this._handleInputChange = (event) => {
|
|
15
|
+
var _a;
|
|
16
|
+
((_a = event.target) === null || _a === void 0 ? void 0 : _a.action) === INPUT_STEPPER_ACTION_TYPES.increment ? this._increment() : this._decrement();
|
|
17
|
+
};
|
|
18
|
+
this._handleDisplayChange = (event) => {
|
|
19
|
+
if (event.detail.value > this.max)
|
|
20
|
+
return;
|
|
21
|
+
this._value = Number(event.detail.value);
|
|
22
|
+
};
|
|
23
|
+
this._handleUpdateValue = () => {
|
|
24
|
+
this._value = Number(this._$inputElement.value) || 0;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
const $element = this.querySelector('h-display-input');
|
|
30
|
+
if (!$element) {
|
|
31
|
+
throw new Error();
|
|
32
|
+
}
|
|
33
|
+
this._$inputElement = $element;
|
|
34
|
+
this._value = Number($element.value) || 0;
|
|
35
|
+
this._setupEvents();
|
|
36
|
+
}
|
|
37
|
+
disconnectedCallback() {
|
|
38
|
+
super.disconnectedCallback();
|
|
39
|
+
this._$inputElement.removeEventListener('input', this._handleUpdateValue);
|
|
40
|
+
}
|
|
41
|
+
updated(changedProperties) {
|
|
42
|
+
super.updated(changedProperties);
|
|
43
|
+
if (changedProperties.has('_value')) {
|
|
44
|
+
this._dispatchValueChanged();
|
|
45
|
+
this._$inputElement.value = String(this._value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
_setupEvents() {
|
|
49
|
+
this.addEventListener(INPUT_STEPPER_EVENT_NAMES.change, this._handleInputChange);
|
|
50
|
+
this.addEventListener(DISPLAY_INPUT_EVENT_NAMES.change, this._handleDisplayChange);
|
|
51
|
+
this._$inputElement.addEventListener('input', this._handleUpdateValue);
|
|
52
|
+
}
|
|
53
|
+
_increment() {
|
|
54
|
+
if (this._value >= this.max)
|
|
55
|
+
return;
|
|
56
|
+
this._value += this.step;
|
|
57
|
+
}
|
|
58
|
+
_decrement() {
|
|
59
|
+
if (this._value <= this.min)
|
|
60
|
+
return;
|
|
61
|
+
this._value -= this.step;
|
|
62
|
+
}
|
|
63
|
+
_dispatchValueChanged() {
|
|
64
|
+
const valueChangeEvent = new CustomEvent(INPUT_STEPPER_EVENT_NAMES.valueChanged, {
|
|
65
|
+
bubbles: true,
|
|
66
|
+
detail: {
|
|
67
|
+
value: this._value
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
this.dispatchEvent(valueChangeEvent);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: Number, attribute: 'step', reflect: true }),
|
|
75
|
+
__metadata("design:type", Number)
|
|
76
|
+
], HInputStepper.prototype, "step", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
property({ type: Number, attribute: 'min', reflect: true }),
|
|
79
|
+
__metadata("design:type", Number)
|
|
80
|
+
], HInputStepper.prototype, "min", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: Number, attribute: 'max', reflect: true }),
|
|
83
|
+
__metadata("design:type", Number)
|
|
84
|
+
], HInputStepper.prototype, "max", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
state(),
|
|
87
|
+
__metadata("design:type", Number)
|
|
88
|
+
], HInputStepper.prototype, "_value", void 0);
|
|
89
|
+
HInputStepper = __decorate([
|
|
90
|
+
phoenixCustomElement('h-input-stepper')
|
|
91
|
+
], HInputStepper);
|
|
92
|
+
export { HInputStepper };
|
|
93
|
+
//# sourceMappingURL=input_stepper.js.map
|