@3t-transform/threeteeui 0.2.73 → 0.2.75
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tttx-multiselect-box.cjs.entry.js +130 -0
- package/dist/cjs/tttx-select-box.cjs.entry.js +1 -1
- package/dist/cjs/tttx.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.css +135 -0
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.js +339 -0
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.js +201 -0
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.css +2 -1
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.stories.js +10 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/tttx-multiselect-box.d.ts +11 -0
- package/dist/components/tttx-multiselect-box.js +172 -0
- package/dist/components/tttx-select-box.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tttx-multiselect-box.entry.js +126 -0
- package/dist/esm/tttx-select-box.entry.js +1 -1
- package/dist/esm/tttx.js +1 -1
- package/dist/tttx/p-77fed2a6.entry.js +1 -0
- package/dist/tttx/{p-d9444b12.entry.js → p-887f56cb.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/molecules/tttx-multiselect-box/interfaces.d.ts +6 -0
- package/dist/types/components/molecules/tttx-multiselect-box/tttx-multiselect-box.d.ts +38 -0
- package/dist/types/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.d.ts +15 -0
- package/dist/types/components.d.ts +39 -4
- package/package.json +1 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { p as purify, d as domSanitiserOptions } from './domsanitiser.options.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './tttx-button2.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './tttx-icon2.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './tttx-standalone-input2.js';
|
|
6
|
+
|
|
7
|
+
const tttxMultiselectBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{display:grid;position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{grid-row:1;align-items:center;gap:8px;padding:6px 8px 6px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-selector-html-content{display:flex;gap:8px;flex-wrap:wrap}.dropdown-body-container{grid-row:2;position:relative}.dropdown-body{position:absolute;display:flex;position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;width:100%}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;scrollbar-gutter:stable;max-height:288px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer;display:flex;gap:8px}.dropdown-option .checkbox-icon{height:24px}.dropdown-option .plaintext-option{line-height:24px}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#9e9e9e}.searchbox{padding:8px 16px 8px 16px;height:52px;box-sizing:border-box}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}.footer{display:flex;gap:8px;flex-direction:row-reverse;padding:8px 16px 0 16px;border-top:1px solid #d5d5d5}";
|
|
8
|
+
|
|
9
|
+
const TttxMultiselectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.selectItemEvent = createEvent(this, "selectItemEvent", 7);
|
|
15
|
+
this.toggleOpen = createEvent(this, "toggleOpen", 7);
|
|
16
|
+
this.changesApplied = createEvent(this, "changesApplied", 7);
|
|
17
|
+
this.bodyOffset = {};
|
|
18
|
+
this.optionsData = null;
|
|
19
|
+
this.label = undefined;
|
|
20
|
+
this.inline = undefined;
|
|
21
|
+
this.placeholder = '';
|
|
22
|
+
this.searchEnabled = undefined;
|
|
23
|
+
this.htmlVisibleValue = undefined;
|
|
24
|
+
this.visibleValue = undefined;
|
|
25
|
+
this.open = false;
|
|
26
|
+
this.unsavedSelectedItems = undefined;
|
|
27
|
+
this.searchTerm = '';
|
|
28
|
+
}
|
|
29
|
+
handleCloseSelectBox() {
|
|
30
|
+
this.open = false;
|
|
31
|
+
}
|
|
32
|
+
handleBlur() {
|
|
33
|
+
this.open = false;
|
|
34
|
+
this.toggleOpen.emit(false);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* We want to generally clone instances of optionsData, _optionsData and unsavedSelectedItems
|
|
38
|
+
* This is because they may be assigned from each other, but have different purposes
|
|
39
|
+
* If we don't clone them, changing one may propagate to the others
|
|
40
|
+
* JSON.parse/stringify will deep clone them, so the references of the array elements will also change
|
|
41
|
+
*/
|
|
42
|
+
safelyCloneArray(arr) {
|
|
43
|
+
return JSON.parse(JSON.stringify(arr));
|
|
44
|
+
}
|
|
45
|
+
onDropdownClicked() {
|
|
46
|
+
this.open = !this.open;
|
|
47
|
+
this.searchTerm = '';
|
|
48
|
+
this.calculateDropdownMenuOffset();
|
|
49
|
+
this.toggleOpen.emit(this.open);
|
|
50
|
+
}
|
|
51
|
+
onCancel() {
|
|
52
|
+
this.open = false;
|
|
53
|
+
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
54
|
+
this.toggleOpen.emit(false);
|
|
55
|
+
}
|
|
56
|
+
applyChanges() {
|
|
57
|
+
this.open = false;
|
|
58
|
+
this.changesApplied.emit(this.safelyCloneArray(this.unsavedSelectedItems));
|
|
59
|
+
}
|
|
60
|
+
onItemSelected(option) {
|
|
61
|
+
const optionIndex = this.unsavedSelectedItems.findIndex((item) => item.value === option.value);
|
|
62
|
+
this.unsavedSelectedItems[optionIndex] = Object.assign(Object.assign({}, option), { selected: !option.selected });
|
|
63
|
+
this.unsavedSelectedItems = [...this.unsavedSelectedItems];
|
|
64
|
+
this.selectItemEvent.emit(option);
|
|
65
|
+
}
|
|
66
|
+
dropdownSelectorContent() {
|
|
67
|
+
if (!this._optionsData.find((item) => item.selected))
|
|
68
|
+
return h("div", { class: "placeholder" }, this.placeholder);
|
|
69
|
+
if (this.htmlVisibleValue) {
|
|
70
|
+
const sanitisedHTML = purify.sanitize(this.visibleValue, domSanitiserOptions);
|
|
71
|
+
return h("div", { class: "dropdown-selector-html-content", innerHTML: sanitisedHTML });
|
|
72
|
+
}
|
|
73
|
+
return h("div", null, this.visibleValue);
|
|
74
|
+
}
|
|
75
|
+
dropdownOption(option) {
|
|
76
|
+
// This is tested in e2e tests
|
|
77
|
+
/* istanbul ignore next */
|
|
78
|
+
const hideOption = this.searchEnabled && option.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()) === -1;
|
|
79
|
+
const checkboxIcon = option.selected ? 'check_box' : 'check_box_outline_blank';
|
|
80
|
+
const checkboxColor = option.selected ? 'blue' : 'grey';
|
|
81
|
+
if (option.html) {
|
|
82
|
+
const sanitisedHTML = purify.sanitize(option.html, domSanitiserOptions);
|
|
83
|
+
// This is tested in e2e tests
|
|
84
|
+
/* istanbul ignore next */
|
|
85
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), h("div", { innerHTML: sanitisedHTML })));
|
|
86
|
+
}
|
|
87
|
+
// This is tested in e2e tests
|
|
88
|
+
/* istanbul ignore next */
|
|
89
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), h("div", { class: "plaintext-option" }, option.label)));
|
|
90
|
+
}
|
|
91
|
+
// This is tested in e2e tests
|
|
92
|
+
/* istanbul ignore next */
|
|
93
|
+
handleSearchInput(event) {
|
|
94
|
+
const target = event.target;
|
|
95
|
+
this.searchTerm = target.value;
|
|
96
|
+
}
|
|
97
|
+
calculateDropdownMenuOffset() {
|
|
98
|
+
const dropdownSelector = this.el.shadowRoot.querySelector('.dropdown-selector');
|
|
99
|
+
const bottomPosY = dropdownSelector.getBoundingClientRect().bottom;
|
|
100
|
+
// (Max list height OR 36px * number of items) + 52px for search bar + 45px for footer + 8px padding at bottom
|
|
101
|
+
let dropdownMenuMaxHeight = Math.min((288), 36 * this._optionsData.length) + 45 + 8;
|
|
102
|
+
if (this.searchEnabled)
|
|
103
|
+
dropdownMenuMaxHeight += 52;
|
|
104
|
+
if (bottomPosY + dropdownMenuMaxHeight > window.innerHeight) {
|
|
105
|
+
this.bodyOffset = { bottom: '16px', position: 'fixed', width: `${dropdownSelector.offsetWidth}px` };
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
this.bodyOffset = {};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
if (!this.optionsData)
|
|
113
|
+
return;
|
|
114
|
+
this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
|
|
115
|
+
// initialise, if not already. After initialisation, this will be managed by internal state
|
|
116
|
+
// Check is performed in render in case initial render did not include optionsData
|
|
117
|
+
if (!this.unsavedSelectedItems)
|
|
118
|
+
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
119
|
+
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
120
|
+
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" }))), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
|
|
121
|
+
/* istanbul ignore next */
|
|
122
|
+
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
|
|
123
|
+
return this.dropdownOption(option);
|
|
124
|
+
})), h("div", { class: 'footer' }, h("tttx-button", { design: "primary", onClick: this.applyChanges.bind(this) }, "Apply"), h("tttx-button", { onClick: this.onCancel.bind(this) }, "Cancel"))))))));
|
|
125
|
+
}
|
|
126
|
+
get el() { return this; }
|
|
127
|
+
static get style() { return tttxMultiselectBoxCss; }
|
|
128
|
+
}, [1, "tttx-multiselect-box", {
|
|
129
|
+
"optionsData": [1, "options-data"],
|
|
130
|
+
"label": [1],
|
|
131
|
+
"inline": [4],
|
|
132
|
+
"placeholder": [1],
|
|
133
|
+
"searchEnabled": [4, "search-enabled"],
|
|
134
|
+
"htmlVisibleValue": [4, "html-visible-value"],
|
|
135
|
+
"visibleValue": [1, "visible-value"],
|
|
136
|
+
"open": [32],
|
|
137
|
+
"unsavedSelectedItems": [32],
|
|
138
|
+
"searchTerm": [32]
|
|
139
|
+
}, [[0, "closeSelectBox", "handleCloseSelectBox"], [0, "blur", "handleBlur"]]]);
|
|
140
|
+
function defineCustomElement$1() {
|
|
141
|
+
if (typeof customElements === "undefined") {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const components = ["tttx-multiselect-box", "tttx-button", "tttx-icon", "tttx-standalone-input"];
|
|
145
|
+
components.forEach(tagName => { switch (tagName) {
|
|
146
|
+
case "tttx-multiselect-box":
|
|
147
|
+
if (!customElements.get(tagName)) {
|
|
148
|
+
customElements.define(tagName, TttxMultiselectBox$1);
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
case "tttx-button":
|
|
152
|
+
if (!customElements.get(tagName)) {
|
|
153
|
+
defineCustomElement$4();
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case "tttx-icon":
|
|
157
|
+
if (!customElements.get(tagName)) {
|
|
158
|
+
defineCustomElement$3();
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
case "tttx-standalone-input":
|
|
162
|
+
if (!customElements.get(tagName)) {
|
|
163
|
+
defineCustomElement$2();
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
} });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const TttxMultiselectBox = TttxMultiselectBox$1;
|
|
170
|
+
const defineCustomElement = defineCustomElement$1;
|
|
171
|
+
|
|
172
|
+
export { TttxMultiselectBox, defineCustomElement };
|
|
@@ -3,7 +3,7 @@ import { p as purify, d as domSanitiserOptions } from './domsanitiser.options.js
|
|
|
3
3
|
import { d as defineCustomElement$3 } from './tttx-icon2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './tttx-standalone-input2.js';
|
|
5
5
|
|
|
6
|
-
const tttxSelectBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{align-items:center;gap:8px;padding:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body{display:flex;position:absolute;flex-direction:column;top:inherit;margin-top:45px;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-body.search{max-height:410px}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:8px 8px 8px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#
|
|
6
|
+
const tttxSelectBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{align-items:center;gap:8px;padding:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body{display:flex;position:absolute;flex-direction:column;top:inherit;margin-top:45px;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;z-index:1000}.dropdown-body.search{max-height:410px}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:8px 8px 8px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575}.searchbox{padding:8px 16px 0 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}";
|
|
7
7
|
|
|
8
8
|
const TttxSelectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
9
|
constructor() {
|
package/dist/esm/loader.js
CHANGED
|
@@ -11,7 +11,7 @@ const patchEsm = () => {
|
|
|
11
11
|
const defineCustomElements = (win, options) => {
|
|
12
12
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
13
13
|
return patchEsm().then(() => {
|
|
14
|
-
return bootstrapLazy([["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
14
|
+
return bootstrapLazy([["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-6a372ea6.js';
|
|
2
|
+
import { p as purify, d as domSanitiserOptions } from './domsanitiser.options-97a33389.js';
|
|
3
|
+
import './_commonjsHelpers-9943807e.js';
|
|
4
|
+
|
|
5
|
+
const tttxMultiselectBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{display:grid;position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{grid-row:1;align-items:center;gap:8px;padding:6px 8px 6px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-selector-html-content{display:flex;gap:8px;flex-wrap:wrap}.dropdown-body-container{grid-row:2;position:relative}.dropdown-body{position:absolute;display:flex;position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;width:100%}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;scrollbar-gutter:stable;max-height:288px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer;display:flex;gap:8px}.dropdown-option .checkbox-icon{height:24px}.dropdown-option .plaintext-option{line-height:24px}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#9e9e9e}.searchbox{padding:8px 16px 8px 16px;height:52px;box-sizing:border-box}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}.footer{display:flex;gap:8px;flex-direction:row-reverse;padding:8px 16px 0 16px;border-top:1px solid #d5d5d5}";
|
|
6
|
+
|
|
7
|
+
const TttxMultiselectBox = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
this.selectItemEvent = createEvent(this, "selectItemEvent", 7);
|
|
11
|
+
this.toggleOpen = createEvent(this, "toggleOpen", 7);
|
|
12
|
+
this.changesApplied = createEvent(this, "changesApplied", 7);
|
|
13
|
+
this.bodyOffset = {};
|
|
14
|
+
this.optionsData = null;
|
|
15
|
+
this.label = undefined;
|
|
16
|
+
this.inline = undefined;
|
|
17
|
+
this.placeholder = '';
|
|
18
|
+
this.searchEnabled = undefined;
|
|
19
|
+
this.htmlVisibleValue = undefined;
|
|
20
|
+
this.visibleValue = undefined;
|
|
21
|
+
this.open = false;
|
|
22
|
+
this.unsavedSelectedItems = undefined;
|
|
23
|
+
this.searchTerm = '';
|
|
24
|
+
}
|
|
25
|
+
handleCloseSelectBox() {
|
|
26
|
+
this.open = false;
|
|
27
|
+
}
|
|
28
|
+
handleBlur() {
|
|
29
|
+
this.open = false;
|
|
30
|
+
this.toggleOpen.emit(false);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* We want to generally clone instances of optionsData, _optionsData and unsavedSelectedItems
|
|
34
|
+
* This is because they may be assigned from each other, but have different purposes
|
|
35
|
+
* If we don't clone them, changing one may propagate to the others
|
|
36
|
+
* JSON.parse/stringify will deep clone them, so the references of the array elements will also change
|
|
37
|
+
*/
|
|
38
|
+
safelyCloneArray(arr) {
|
|
39
|
+
return JSON.parse(JSON.stringify(arr));
|
|
40
|
+
}
|
|
41
|
+
onDropdownClicked() {
|
|
42
|
+
this.open = !this.open;
|
|
43
|
+
this.searchTerm = '';
|
|
44
|
+
this.calculateDropdownMenuOffset();
|
|
45
|
+
this.toggleOpen.emit(this.open);
|
|
46
|
+
}
|
|
47
|
+
onCancel() {
|
|
48
|
+
this.open = false;
|
|
49
|
+
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
50
|
+
this.toggleOpen.emit(false);
|
|
51
|
+
}
|
|
52
|
+
applyChanges() {
|
|
53
|
+
this.open = false;
|
|
54
|
+
this.changesApplied.emit(this.safelyCloneArray(this.unsavedSelectedItems));
|
|
55
|
+
}
|
|
56
|
+
onItemSelected(option) {
|
|
57
|
+
const optionIndex = this.unsavedSelectedItems.findIndex((item) => item.value === option.value);
|
|
58
|
+
this.unsavedSelectedItems[optionIndex] = Object.assign(Object.assign({}, option), { selected: !option.selected });
|
|
59
|
+
this.unsavedSelectedItems = [...this.unsavedSelectedItems];
|
|
60
|
+
this.selectItemEvent.emit(option);
|
|
61
|
+
}
|
|
62
|
+
dropdownSelectorContent() {
|
|
63
|
+
if (!this._optionsData.find((item) => item.selected))
|
|
64
|
+
return h("div", { class: "placeholder" }, this.placeholder);
|
|
65
|
+
if (this.htmlVisibleValue) {
|
|
66
|
+
const sanitisedHTML = purify.sanitize(this.visibleValue, domSanitiserOptions);
|
|
67
|
+
return h("div", { class: "dropdown-selector-html-content", innerHTML: sanitisedHTML });
|
|
68
|
+
}
|
|
69
|
+
return h("div", null, this.visibleValue);
|
|
70
|
+
}
|
|
71
|
+
dropdownOption(option) {
|
|
72
|
+
// This is tested in e2e tests
|
|
73
|
+
/* istanbul ignore next */
|
|
74
|
+
const hideOption = this.searchEnabled && option.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()) === -1;
|
|
75
|
+
const checkboxIcon = option.selected ? 'check_box' : 'check_box_outline_blank';
|
|
76
|
+
const checkboxColor = option.selected ? 'blue' : 'grey';
|
|
77
|
+
if (option.html) {
|
|
78
|
+
const sanitisedHTML = purify.sanitize(option.html, domSanitiserOptions);
|
|
79
|
+
// This is tested in e2e tests
|
|
80
|
+
/* istanbul ignore next */
|
|
81
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), h("div", { innerHTML: sanitisedHTML })));
|
|
82
|
+
}
|
|
83
|
+
// This is tested in e2e tests
|
|
84
|
+
/* istanbul ignore next */
|
|
85
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), h("div", { class: "plaintext-option" }, option.label)));
|
|
86
|
+
}
|
|
87
|
+
// This is tested in e2e tests
|
|
88
|
+
/* istanbul ignore next */
|
|
89
|
+
handleSearchInput(event) {
|
|
90
|
+
const target = event.target;
|
|
91
|
+
this.searchTerm = target.value;
|
|
92
|
+
}
|
|
93
|
+
calculateDropdownMenuOffset() {
|
|
94
|
+
const dropdownSelector = this.el.shadowRoot.querySelector('.dropdown-selector');
|
|
95
|
+
const bottomPosY = dropdownSelector.getBoundingClientRect().bottom;
|
|
96
|
+
// (Max list height OR 36px * number of items) + 52px for search bar + 45px for footer + 8px padding at bottom
|
|
97
|
+
let dropdownMenuMaxHeight = Math.min((288), 36 * this._optionsData.length) + 45 + 8;
|
|
98
|
+
if (this.searchEnabled)
|
|
99
|
+
dropdownMenuMaxHeight += 52;
|
|
100
|
+
if (bottomPosY + dropdownMenuMaxHeight > window.innerHeight) {
|
|
101
|
+
this.bodyOffset = { bottom: '16px', position: 'fixed', width: `${dropdownSelector.offsetWidth}px` };
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.bodyOffset = {};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
render() {
|
|
108
|
+
if (!this.optionsData)
|
|
109
|
+
return;
|
|
110
|
+
this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
|
|
111
|
+
// initialise, if not already. After initialisation, this will be managed by internal state
|
|
112
|
+
// Check is performed in render in case initial render did not include optionsData
|
|
113
|
+
if (!this.unsavedSelectedItems)
|
|
114
|
+
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
115
|
+
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
116
|
+
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" }))), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
|
|
117
|
+
/* istanbul ignore next */
|
|
118
|
+
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
|
|
119
|
+
return this.dropdownOption(option);
|
|
120
|
+
})), h("div", { class: 'footer' }, h("tttx-button", { design: "primary", onClick: this.applyChanges.bind(this) }, "Apply"), h("tttx-button", { onClick: this.onCancel.bind(this) }, "Cancel"))))))));
|
|
121
|
+
}
|
|
122
|
+
get el() { return getElement(this); }
|
|
123
|
+
};
|
|
124
|
+
TttxMultiselectBox.style = tttxMultiselectBoxCss;
|
|
125
|
+
|
|
126
|
+
export { TttxMultiselectBox as tttx_multiselect_box };
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
|
|
|
2
2
|
import { p as purify, d as domSanitiserOptions } from './domsanitiser.options-97a33389.js';
|
|
3
3
|
import './_commonjsHelpers-9943807e.js';
|
|
4
4
|
|
|
5
|
-
const tttxSelectBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{align-items:center;gap:8px;padding:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body{display:flex;position:absolute;flex-direction:column;top:inherit;margin-top:45px;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-body.search{max-height:410px}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:8px 8px 8px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#
|
|
5
|
+
const tttxSelectBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{align-items:center;gap:8px;padding:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body{display:flex;position:absolute;flex-direction:column;top:inherit;margin-top:45px;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;z-index:1000}.dropdown-body.search{max-height:410px}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:8px 8px 8px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575}.searchbox{padding:8px 16px 0 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}";
|
|
6
6
|
|
|
7
7
|
const TttxSelectBox = class {
|
|
8
8
|
constructor(hostRef) {
|
package/dist/esm/tttx.js
CHANGED
|
@@ -14,5 +14,5 @@ const patchBrowser = () => {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
patchBrowser().then(options => {
|
|
17
|
-
return bootstrapLazy([["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
17
|
+
return bootstrapLazy([["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
18
18
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,c as t,h as i,H as s,g as e}from"./p-3f1b6013.js";import{p as n,d}from"./p-5ed38d61.js";import"./p-112455b1.js";const r=class{constructor(i){o(this,i),this.selectItemEvent=t(this,"selectItemEvent",7),this.toggleOpen=t(this,"toggleOpen",7),this.changesApplied=t(this,"changesApplied",7),this.bodyOffset={},this.optionsData=null,this.label=void 0,this.inline=void 0,this.placeholder="",this.searchEnabled=void 0,this.htmlVisibleValue=void 0,this.visibleValue=void 0,this.open=!1,this.unsavedSelectedItems=void 0,this.searchTerm=""}handleCloseSelectBox(){this.open=!1}handleBlur(){this.open=!1,this.toggleOpen.emit(!1)}safelyCloneArray(o){return JSON.parse(JSON.stringify(o))}onDropdownClicked(){this.open=!this.open,this.searchTerm="",this.calculateDropdownMenuOffset(),this.toggleOpen.emit(this.open)}onCancel(){this.open=!1,this.unsavedSelectedItems=this.safelyCloneArray(this._optionsData),this.toggleOpen.emit(!1)}applyChanges(){this.open=!1,this.changesApplied.emit(this.safelyCloneArray(this.unsavedSelectedItems))}onItemSelected(o){const t=this.unsavedSelectedItems.findIndex((t=>t.value===o.value));this.unsavedSelectedItems[t]=Object.assign(Object.assign({},o),{selected:!o.selected}),this.unsavedSelectedItems=[...this.unsavedSelectedItems],this.selectItemEvent.emit(o)}dropdownSelectorContent(){if(!this._optionsData.find((o=>o.selected)))return i("div",{class:"placeholder"},this.placeholder);if(this.htmlVisibleValue){const o=n.sanitize(this.visibleValue,d);return i("div",{class:"dropdown-selector-html-content",innerHTML:o})}return i("div",null,this.visibleValue)}dropdownOption(o){const t=this.searchEnabled&&-1===o.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()),s=o.selected?"check_box":"check_box_outline_blank",e=o.selected?"blue":"grey";if(o.html){const r=n.sanitize(o.html,d);return i("div",{class:`dropdown-option ${t?"hidden":""} ${o.selected?"selected":""}`,onClick:this.onItemSelected.bind(this,o),key:o.label},i("tttx-icon",{icon:s,color:e,class:"checkbox-icon"}),i("div",{innerHTML:r}))}return i("div",{class:`dropdown-option ${t?"hidden":""} ${o.selected?"selected":""}`,onClick:this.onItemSelected.bind(this,o),key:o.label},i("tttx-icon",{icon:s,color:e,class:"checkbox-icon"}),i("div",{class:"plaintext-option"},o.label))}handleSearchInput(o){this.searchTerm=o.target.value}calculateDropdownMenuOffset(){const o=this.el.shadowRoot.querySelector(".dropdown-selector"),t=o.getBoundingClientRect().bottom;let i=Math.min(288,36*this._optionsData.length)+45+8;this.searchEnabled&&(i+=52),this.bodyOffset=t+i>window.innerHeight?{bottom:"16px",position:"fixed",width:`${o.offsetWidth}px`}:{}}render(){if(!this.optionsData)return;this._optionsData="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData,this.unsavedSelectedItems||(this.unsavedSelectedItems=this.safelyCloneArray(this._optionsData));const o=this.open?"expand_less":"expand_more";return i(s,{class:this.inline?"inline":"block"},this.label&&i("div",{class:"label"},this.label),i("div",{tabindex:"0",class:"dropdown-container"},i("div",{class:"dropdown-selector",onClick:this.onDropdownClicked.bind(this)},this.dropdownSelectorContent(),i("div",{class:"dropdown-selector-chevron"},i("tttx-icon",{icon:o,color:"black"}))),this.open&&i("div",{class:"dropdown-body-container"},i("div",{class:"dropdown-body",style:Object.assign({},this.bodyOffset)},this.searchEnabled&&i("div",{class:"searchbox"},i("tttx-standalone-input",{type:"text",label:"",required:!0,showerrorbubble:!1,iconleft:"search",onInput:this.handleSearchInput.bind(this),inline:!0})),i("div",{class:"dropdown-options-list"},this.unsavedSelectedItems.map((o=>this.dropdownOption(o)))),i("div",{class:"footer"},i("tttx-button",{design:"primary",onClick:this.applyChanges.bind(this)},"Apply"),i("tttx-button",{onClick:this.onCancel.bind(this)},"Cancel"))))))}get el(){return e(this)}};r.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{display:grid;position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{grid-row:1;align-items:center;gap:8px;padding:6px 8px 6px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-selector-html-content{display:flex;gap:8px;flex-wrap:wrap}.dropdown-body-container{grid-row:2;position:relative}.dropdown-body{position:absolute;display:flex;position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;width:100%}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;scrollbar-gutter:stable;max-height:288px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer;display:flex;gap:8px}.dropdown-option .checkbox-icon{height:24px}.dropdown-option .plaintext-option{line-height:24px}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#9e9e9e}.searchbox{padding:8px 16px 8px 16px;height:52px;box-sizing:border-box}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}.footer{display:flex;gap:8px;flex-direction:row-reverse;padding:8px 16px 0 16px;border-top:1px solid #d5d5d5}';export{r as tttx_multiselect_box}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,c as t,h as i,H as s,g as e}from"./p-3f1b6013.js";import{p as n,d}from"./p-5ed38d61.js";import"./p-112455b1.js";const r=class{constructor(i){o(this,i),this.selectItemEvent=t(this,"selectItemEvent",3),this.toggleOpen=t(this,"toggleOpen",3),this.optionsData=null,this.label=void 0,this.inline=void 0,this.placeholder="",this.searchEnabled=void 0,this.selectedValue=void 0,this.open=!1,this.selectedItem=void 0,this.searchTerm=""}async componentWillLoad(){if(this.optionsData){const o=("string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData).filter((o=>o.value==this.selectedValue));this.selectedItem=o.length>0?o[0]:void 0}}handleCloseSelectBox(){this.open=!1}handleBlur(){this.open=!1,this.toggleOpen.emit(!1)}onDropdownClicked(){this.open=!this.open,this.searchTerm="",this.toggleOpen.emit(this.open)}onItemSelected(o){this.selectedItem=o,this.selectItemEvent.emit(this.selectedItem),this.el.blur()}dropdownSelectorContent(){return this.selectedItem?this.selectedItem.html?i("div",{innerHTML:this.selectedItem.html}):i("div",null,this.selectedItem.label):i("div",{class:"placeholder"},this.placeholder)}dropdownOption(o){const t=this.searchEnabled&&-1===o.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()),s=this.selectedItem&&o.value===this.selectedItem.value;if(o.html){const e=n.sanitize(o.html,d);return i("div",{class:`dropdown-option ${t?"hidden":""} ${s?"selected":""}`,onClick:this.onItemSelected.bind(this,o),key:o.label,innerHTML:e})}return i("div",{class:`dropdown-option ${t?"hidden":""} ${s?"selected":""}`,onClick:this.onItemSelected.bind(this,o),key:o.label},o.label)}handleSearchInput(o){this.searchTerm=o.target.value}render(){if(!this.optionsData)return;const o="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData,t=this.open?"expand_less":"expand_more";return i(s,{class:this.inline?"inline":"block"},this.label&&i("div",{class:"label"},this.label),i("div",{tabindex:"0",class:"dropdown-container"},i("div",{class:"dropdown-selector",onClick:this.onDropdownClicked.bind(this)},this.dropdownSelectorContent(),i("div",{class:"dropdown-selector-chevron"},i("tttx-icon",{icon:t,color:"black"}))),this.open&&i("div",{class:"dropdown-body",style:{width:`${this.el.offsetWidth}px`}},this.searchEnabled&&i("div",{class:"searchbox"},i("tttx-standalone-input",{type:"text",label:"",required:!0,showerrorbubble:!1,iconleft:"search",onInput:this.handleSearchInput.bind(this)})),i("div",{class:"dropdown-options-list"},o.map((o=>this.dropdownOption(o)))))))}get el(){return e(this)}};r.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{align-items:center;gap:8px;padding:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body{display:flex;position:absolute;flex-direction:column;top:inherit;margin-top:45px;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-body.search{max-height:410px}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:8px 8px 8px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#
|
|
1
|
+
import{r as o,c as t,h as i,H as s,g as e}from"./p-3f1b6013.js";import{p as n,d}from"./p-5ed38d61.js";import"./p-112455b1.js";const r=class{constructor(i){o(this,i),this.selectItemEvent=t(this,"selectItemEvent",3),this.toggleOpen=t(this,"toggleOpen",3),this.optionsData=null,this.label=void 0,this.inline=void 0,this.placeholder="",this.searchEnabled=void 0,this.selectedValue=void 0,this.open=!1,this.selectedItem=void 0,this.searchTerm=""}async componentWillLoad(){if(this.optionsData){const o=("string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData).filter((o=>o.value==this.selectedValue));this.selectedItem=o.length>0?o[0]:void 0}}handleCloseSelectBox(){this.open=!1}handleBlur(){this.open=!1,this.toggleOpen.emit(!1)}onDropdownClicked(){this.open=!this.open,this.searchTerm="",this.toggleOpen.emit(this.open)}onItemSelected(o){this.selectedItem=o,this.selectItemEvent.emit(this.selectedItem),this.el.blur()}dropdownSelectorContent(){return this.selectedItem?this.selectedItem.html?i("div",{innerHTML:this.selectedItem.html}):i("div",null,this.selectedItem.label):i("div",{class:"placeholder"},this.placeholder)}dropdownOption(o){const t=this.searchEnabled&&-1===o.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()),s=this.selectedItem&&o.value===this.selectedItem.value;if(o.html){const e=n.sanitize(o.html,d);return i("div",{class:`dropdown-option ${t?"hidden":""} ${s?"selected":""}`,onClick:this.onItemSelected.bind(this,o),key:o.label,innerHTML:e})}return i("div",{class:`dropdown-option ${t?"hidden":""} ${s?"selected":""}`,onClick:this.onItemSelected.bind(this,o),key:o.label},o.label)}handleSearchInput(o){this.searchTerm=o.target.value}render(){if(!this.optionsData)return;const o="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData,t=this.open?"expand_less":"expand_more";return i(s,{class:this.inline?"inline":"block"},this.label&&i("div",{class:"label"},this.label),i("div",{tabindex:"0",class:"dropdown-container"},i("div",{class:"dropdown-selector",onClick:this.onDropdownClicked.bind(this)},this.dropdownSelectorContent(),i("div",{class:"dropdown-selector-chevron"},i("tttx-icon",{icon:t,color:"black"}))),this.open&&i("div",{class:"dropdown-body",style:{width:`${this.el.offsetWidth}px`}},this.searchEnabled&&i("div",{class:"searchbox"},i("tttx-standalone-input",{type:"text",label:"",required:!0,showerrorbubble:!1,iconleft:"search",onInput:this.handleSearchInput.bind(this)})),i("div",{class:"dropdown-options-list"},o.map((o=>this.dropdownOption(o)))))))}get el(){return e(this)}};r.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{align-items:center;gap:8px;padding:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body{display:flex;position:absolute;flex-direction:column;top:inherit;margin-top:45px;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;z-index:1000}.dropdown-body.search{max-height:410px}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:8px 8px 8px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575}.searchbox{padding:8px 16px 0 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}';export{r as tttx_select_box}
|
package/dist/tttx/tttx.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-3f1b6013.js";export{s as setNonce}from"./p-3f1b6013.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-f34bface",[[1,"tttx-dialog-box",{data:[1025],size:[1],open:[1028],allowOverflow:[4,"allow-overflow"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-3f1b6013.js";export{s as setNonce}from"./p-3f1b6013.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-77fed2a6",[[1,"tttx-multiselect-box",{optionsData:[1,"options-data"],label:[1],inline:[4],placeholder:[1],searchEnabled:[4,"search-enabled"],htmlVisibleValue:[4,"html-visible-value"],visibleValue:[1,"visible-value"],open:[32],unsavedSelectedItems:[32],searchTerm:[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["p-f34bface",[[1,"tttx-dialog-box",{data:[1025],size:[1],open:[1028],allowOverflow:[4,"allow-overflow"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["p-887f56cb",[[1,"tttx-select-box",{optionsData:[1,"options-data"],label:[1],inline:[4],placeholder:[1],searchEnabled:[4,"search-enabled"],selectedValue:[1,"selected-value"],open:[32],selectedItem:[32],searchTerm:[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["p-75c31e23",[[1,"tttx-tree-view",{data:[1040],treeData:[32]}]]],["p-c714f7c0",[[1,"tttx-filter",{filterKey:[1,"filter-key"],filterOptions:[1,"filter-options"],showSelectAll:[4,"show-select-all"],showSearchField:[4,"show-search-field"],showOptionIcons:[4,"show-option-icons"],filterButtonStyle:[1,"filter-button-style"],filterHeader:[1,"filter-header"],defaultFilterOptions:[1,"default-filter-options"],popoverWidth:[1,"popover-width"],showPopover:[32],displayedFilterSettings:[32],selectedFilters:[32],filterSearchTerm:[32],allSelected:[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["p-750cf31b",[[1,"tttx-list",{data:[1025],name:[1],_data:[32]}]]],["p-5290db99",[[1,"tttx-sorter",{sorterKey:[1,"sorter-key"],defaultSortDirection:[1,"default-sort-direction"],fieldOptionsData:[1,"field-options-data"],defaultOption:[1,"default-option"],selectedField:[32],sortDirection:[32],dropdownExpand:[32],dropdownOptions:[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["p-67c342d7",[[2,"tttx-tabs",{tabsName:[1,"tabs-name"],navigation:[4],wide:[4],tabs:[1],_tabs:[32]},[[0,"keydown","handleKeyDown"]]]]],["p-895526aa",[[1,"tttx-form",{formschema:[1032],data:[1032],submit:[64]}]]],["p-6fe0af4e",[[1,"tttx-keyvalue-block",{keyvalues:[8],horizontal:[4]}]]],["p-e55a967b",[[1,"tttx-loading-spinner",{loadingMessage:[1028,"loading-message"],size:[1025]}]]],["p-50cdce65",[[1,"tttx-qrcode",{link:[1025],size:[1026]}]]],["p-a6582ab0",[[1,"tttx-tag",{text:[1],color:[1]}]]],["p-c0c022cd",[[1,"tttx-toolbar",{border:[4],viewSize:[32]},[[9,"resize","handleResize"]]]]],["p-e89b053f",[[1,"tttx-icon",{icon:[1],color:[1]}]]],["p-818574fe",[[2,"tttx-standalone-input",{label:[1],secondarylabel:[1],showerrormsg:[4],showerrorbubble:[4],errormsg:[1],iconleft:[1],iconleftcolor:[1],iconright:[1],iconrightcolor:[1],inputicon:[1],inputiconcolor:[1],inline:[4],inputautocapitalize:[1],inputautofocus:[4],inputkeyhint:[1],inputindex:[8],inputtitle:[1],autocomplete:[1],checked:[4],disabled:[4],max:[8],maxlength:[8],min:[8],minlength:[8],name:[1],pattern:[1],placeholder:[1],readonly:[8],required:[4],step:[8],type:[1],value:[1032]}]]],["p-5b7b8539",[[1,"tttx-button",{notext:[4],icon:[1],iconposition:[1],iconcolor:[1025],design:[1]}]]]],e)));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
import { SelectItem } from './interfaces';
|
|
3
|
+
export declare class TttxMultiselectBox {
|
|
4
|
+
optionsData: string | SelectItem[];
|
|
5
|
+
label: string;
|
|
6
|
+
inline: boolean;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
searchEnabled: boolean;
|
|
9
|
+
htmlVisibleValue: boolean;
|
|
10
|
+
visibleValue: string;
|
|
11
|
+
open: boolean;
|
|
12
|
+
unsavedSelectedItems: SelectItem[];
|
|
13
|
+
searchTerm: string;
|
|
14
|
+
private _optionsData;
|
|
15
|
+
private bodyOffset;
|
|
16
|
+
el: any;
|
|
17
|
+
selectItemEvent: EventEmitter<SelectItem>;
|
|
18
|
+
toggleOpen: EventEmitter<boolean>;
|
|
19
|
+
changesApplied: EventEmitter<SelectItem[]>;
|
|
20
|
+
handleCloseSelectBox(): void;
|
|
21
|
+
handleBlur(): void;
|
|
22
|
+
/**
|
|
23
|
+
* We want to generally clone instances of optionsData, _optionsData and unsavedSelectedItems
|
|
24
|
+
* This is because they may be assigned from each other, but have different purposes
|
|
25
|
+
* If we don't clone them, changing one may propagate to the others
|
|
26
|
+
* JSON.parse/stringify will deep clone them, so the references of the array elements will also change
|
|
27
|
+
*/
|
|
28
|
+
safelyCloneArray(arr: Array<any>): any;
|
|
29
|
+
onDropdownClicked(): void;
|
|
30
|
+
onCancel(): void;
|
|
31
|
+
applyChanges(): void;
|
|
32
|
+
onItemSelected(option: SelectItem): void;
|
|
33
|
+
dropdownSelectorContent(): any;
|
|
34
|
+
dropdownOption(option: SelectItem): any;
|
|
35
|
+
handleSearchInput(event: InputEvent): void;
|
|
36
|
+
calculateDropdownMenuOffset(): void;
|
|
37
|
+
render(): any;
|
|
38
|
+
}
|
package/dist/types/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
component: string;
|
|
4
|
+
parameters: {
|
|
5
|
+
actions: {
|
|
6
|
+
handles: string[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
decorators: (<T extends import("@storybook/types").Renderer>(storyFn: import("@storybook/types").PartialStoryFn<T, import("@storybook/types").Args>) => T["storyResult"])[];
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
12
|
+
export declare const BasicMultiselectBox: any;
|
|
13
|
+
export declare const HtmlVisibleValueWrap: any;
|
|
14
|
+
export declare const HtmlVisibleValue: any;
|
|
15
|
+
export declare const DialogBoxWithDropdown: any;
|
|
@@ -8,7 +8,8 @@ import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
|
8
8
|
import { DialogItems } from "./components/molecules/tttx-dialog-box/interfaces";
|
|
9
9
|
import { FilterChangeEvent, FilterSettings } from "./components/molecules/tttx-filter/tttx-filter";
|
|
10
10
|
import { ListItem } from "./components/molecules/tttx-list/interfaces";
|
|
11
|
-
import { SelectItem } from "./components/molecules/tttx-
|
|
11
|
+
import { SelectItem } from "./components/molecules/tttx-multiselect-box/interfaces";
|
|
12
|
+
import { SelectItem as SelectItem1 } from "./components/molecules/tttx-select-box/interfaces";
|
|
12
13
|
import { SorterChangeEvent, SorterData } from "./components/molecules/tttx-sorter/interfaces";
|
|
13
14
|
import { MinMaxDates } from "./components/molecules/tttx-standalone-input/tttx-standalone-input";
|
|
14
15
|
import { Tab } from "./components/molecules/tttx-tabs/interfaces";
|
|
@@ -59,6 +60,15 @@ export namespace Components {
|
|
|
59
60
|
"loadingMessage": boolean;
|
|
60
61
|
"size": 'small' | 'large';
|
|
61
62
|
}
|
|
63
|
+
interface TttxMultiselectBox {
|
|
64
|
+
"htmlVisibleValue": boolean;
|
|
65
|
+
"inline": boolean;
|
|
66
|
+
"label": string;
|
|
67
|
+
"optionsData": string | SelectItem[];
|
|
68
|
+
"placeholder": string;
|
|
69
|
+
"searchEnabled": boolean;
|
|
70
|
+
"visibleValue": string;
|
|
71
|
+
}
|
|
62
72
|
interface TttxQrcode {
|
|
63
73
|
"link": string;
|
|
64
74
|
"size": number;
|
|
@@ -66,7 +76,7 @@ export namespace Components {
|
|
|
66
76
|
interface TttxSelectBox {
|
|
67
77
|
"inline": boolean;
|
|
68
78
|
"label": string;
|
|
69
|
-
"optionsData": string |
|
|
79
|
+
"optionsData": string | SelectItem1[];
|
|
70
80
|
"placeholder": string;
|
|
71
81
|
"searchEnabled": boolean;
|
|
72
82
|
"selectedValue": string;
|
|
@@ -155,6 +165,10 @@ export interface TttxListCustomEvent<T> extends CustomEvent<T> {
|
|
|
155
165
|
detail: T;
|
|
156
166
|
target: HTMLTttxListElement;
|
|
157
167
|
}
|
|
168
|
+
export interface TttxMultiselectBoxCustomEvent<T> extends CustomEvent<T> {
|
|
169
|
+
detail: T;
|
|
170
|
+
target: HTMLTttxMultiselectBoxElement;
|
|
171
|
+
}
|
|
158
172
|
export interface TttxSelectBoxCustomEvent<T> extends CustomEvent<T> {
|
|
159
173
|
detail: T;
|
|
160
174
|
target: HTMLTttxSelectBoxElement;
|
|
@@ -224,6 +238,12 @@ declare global {
|
|
|
224
238
|
prototype: HTMLTttxLoadingSpinnerElement;
|
|
225
239
|
new (): HTMLTttxLoadingSpinnerElement;
|
|
226
240
|
};
|
|
241
|
+
interface HTMLTttxMultiselectBoxElement extends Components.TttxMultiselectBox, HTMLStencilElement {
|
|
242
|
+
}
|
|
243
|
+
var HTMLTttxMultiselectBoxElement: {
|
|
244
|
+
prototype: HTMLTttxMultiselectBoxElement;
|
|
245
|
+
new (): HTMLTttxMultiselectBoxElement;
|
|
246
|
+
};
|
|
227
247
|
interface HTMLTttxQrcodeElement extends Components.TttxQrcode, HTMLStencilElement {
|
|
228
248
|
}
|
|
229
249
|
var HTMLTttxQrcodeElement: {
|
|
@@ -281,6 +301,7 @@ declare global {
|
|
|
281
301
|
"tttx-keyvalue-block": HTMLTttxKeyvalueBlockElement;
|
|
282
302
|
"tttx-list": HTMLTttxListElement;
|
|
283
303
|
"tttx-loading-spinner": HTMLTttxLoadingSpinnerElement;
|
|
304
|
+
"tttx-multiselect-box": HTMLTttxMultiselectBoxElement;
|
|
284
305
|
"tttx-qrcode": HTMLTttxQrcodeElement;
|
|
285
306
|
"tttx-select-box": HTMLTttxSelectBoxElement;
|
|
286
307
|
"tttx-sorter": HTMLTttxSorterElement;
|
|
@@ -344,6 +365,18 @@ declare namespace LocalJSX {
|
|
|
344
365
|
"loadingMessage"?: boolean;
|
|
345
366
|
"size"?: 'small' | 'large';
|
|
346
367
|
}
|
|
368
|
+
interface TttxMultiselectBox {
|
|
369
|
+
"htmlVisibleValue"?: boolean;
|
|
370
|
+
"inline"?: boolean;
|
|
371
|
+
"label"?: string;
|
|
372
|
+
"onChangesApplied"?: (event: TttxMultiselectBoxCustomEvent<SelectItem[]>) => void;
|
|
373
|
+
"onSelectItemEvent"?: (event: TttxMultiselectBoxCustomEvent<SelectItem>) => void;
|
|
374
|
+
"onToggleOpen"?: (event: TttxMultiselectBoxCustomEvent<boolean>) => void;
|
|
375
|
+
"optionsData"?: string | SelectItem[];
|
|
376
|
+
"placeholder"?: string;
|
|
377
|
+
"searchEnabled"?: boolean;
|
|
378
|
+
"visibleValue"?: string;
|
|
379
|
+
}
|
|
347
380
|
interface TttxQrcode {
|
|
348
381
|
"link"?: string;
|
|
349
382
|
"size"?: number;
|
|
@@ -351,9 +384,9 @@ declare namespace LocalJSX {
|
|
|
351
384
|
interface TttxSelectBox {
|
|
352
385
|
"inline"?: boolean;
|
|
353
386
|
"label"?: string;
|
|
354
|
-
"onSelectItemEvent"?: (event: TttxSelectBoxCustomEvent<
|
|
387
|
+
"onSelectItemEvent"?: (event: TttxSelectBoxCustomEvent<SelectItem1>) => void;
|
|
355
388
|
"onToggleOpen"?: (event: TttxSelectBoxCustomEvent<boolean>) => void;
|
|
356
|
-
"optionsData"?: string |
|
|
389
|
+
"optionsData"?: string | SelectItem1[];
|
|
357
390
|
"placeholder"?: string;
|
|
358
391
|
"searchEnabled"?: boolean;
|
|
359
392
|
"selectedValue"?: string;
|
|
@@ -447,6 +480,7 @@ declare namespace LocalJSX {
|
|
|
447
480
|
"tttx-keyvalue-block": TttxKeyvalueBlock;
|
|
448
481
|
"tttx-list": TttxList;
|
|
449
482
|
"tttx-loading-spinner": TttxLoadingSpinner;
|
|
483
|
+
"tttx-multiselect-box": TttxMultiselectBox;
|
|
450
484
|
"tttx-qrcode": TttxQrcode;
|
|
451
485
|
"tttx-select-box": TttxSelectBox;
|
|
452
486
|
"tttx-sorter": TttxSorter;
|
|
@@ -469,6 +503,7 @@ declare module "@stencil/core" {
|
|
|
469
503
|
"tttx-keyvalue-block": LocalJSX.TttxKeyvalueBlock & JSXBase.HTMLAttributes<HTMLTttxKeyvalueBlockElement>;
|
|
470
504
|
"tttx-list": LocalJSX.TttxList & JSXBase.HTMLAttributes<HTMLTttxListElement>;
|
|
471
505
|
"tttx-loading-spinner": LocalJSX.TttxLoadingSpinner & JSXBase.HTMLAttributes<HTMLTttxLoadingSpinnerElement>;
|
|
506
|
+
"tttx-multiselect-box": LocalJSX.TttxMultiselectBox & JSXBase.HTMLAttributes<HTMLTttxMultiselectBoxElement>;
|
|
472
507
|
"tttx-qrcode": LocalJSX.TttxQrcode & JSXBase.HTMLAttributes<HTMLTttxQrcodeElement>;
|
|
473
508
|
"tttx-select-box": LocalJSX.TttxSelectBox & JSXBase.HTMLAttributes<HTMLTttxSelectBoxElement>;
|
|
474
509
|
"tttx-sorter": LocalJSX.TttxSorter & JSXBase.HTMLAttributes<HTMLTttxSorterElement>;
|