@3t-transform/threeteeui 0.2.115 → 0.2.117

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.
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[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.cjs",[[1,"tttx-tree-view",{"data":[1040],"firstSelected":[1028,"first-selected"],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[1,"tttx-dialog",{"header":[1],"type":[1],"size":[1],"open":[4],"allowOverflow":[4,"allow-overflow"],"closeEnabled":[4,"close-enabled"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-expander.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64],"setSelectOptions":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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-filter_4.cjs",[[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"]]],[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}],[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"]]],[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
17
+ return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64],"setSelectOptions":[64]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-tree-view.cjs",[[1,"tttx-tree-view",{"data":[1040],"firstSelected":[1028,"first-selected"],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[1,"tttx-dialog",{"header":[1],"type":[1],"size":[1],"open":[4],"allowOverflow":[4,"allow-overflow"],"closeEnabled":[4,"close-enabled"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-expander.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-select-box.cjs",[[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],"setSelectedItem":[64]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-filter_4.cjs",[[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"]]],[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}],[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"]]],[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]],["tttx-standalone-input.cjs",[[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]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -194,7 +194,7 @@ const TttxForm = class {
194
194
  */
195
195
  async setSelectOptions(fieldname, options) {
196
196
  const select = this.fieldset.querySelector(`[name=${fieldname}]`);
197
- select.innerHTML = '';
197
+ const tttxSelect = this.fieldset.querySelector(`[name=overlay-${fieldname}]`);
198
198
  const fragment = new DocumentFragment();
199
199
  for (const option of options) {
200
200
  const o = document.createElement('option');
@@ -202,7 +202,10 @@ const TttxForm = class {
202
202
  o.value = option.value;
203
203
  fragment.appendChild(o);
204
204
  }
205
- select.appendChild(fragment);
205
+ select.replaceChildren(fragment);
206
+ tttxSelect.optionsData = options;
207
+ //await tttxSelect.setOptionsData(options);
208
+ await tttxSelect.setSelectedItem(options[0].value);
206
209
  }
207
210
  /**
208
211
  * Submits the form data to the server.
@@ -259,7 +262,7 @@ const TttxForm = class {
259
262
  * @param {boolean} [formProperties.options[].placeholder]
260
263
  */
261
264
  createSelect(formKey, formProperties) {
262
- var _a;
265
+ var _a, _b, _c, _d;
263
266
  const select = document.createElement('select');
264
267
  select.setAttribute('name', formKey);
265
268
  formProperties.options.forEach(optionProperties => {
@@ -267,7 +270,23 @@ const TttxForm = class {
267
270
  });
268
271
  if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey])
269
272
  select.classList.remove('placeholder');
270
- return select;
273
+ const tttxSelect = document.createElement('tttx-select-box');
274
+ tttxSelect.optionsData = (_b = formProperties.options) === null || _b === void 0 ? void 0 : _b.filter(o => !o.placeholder);
275
+ tttxSelect.placeholder = (_d = (_c = formProperties.options) === null || _c === void 0 ? void 0 : _c.filter(o => o.placeholder)[0]) === null || _d === void 0 ? void 0 : _d.label;
276
+ tttxSelect.inline = false;
277
+ tttxSelect.searchEnabled = true;
278
+ tttxSelect.style.width = '100%';
279
+ tttxSelect.style.marginTop = '6px';
280
+ tttxSelect.setAttribute('name', 'overlay-' + formKey);
281
+ const fragment = document.createDocumentFragment();
282
+ fragment.append(tttxSelect);
283
+ select.style.display = 'none';
284
+ tttxSelect.addEventListener('selectItemEvent', function (ev) {
285
+ select.value = ev.detail.value;
286
+ select.onblur({ target: select }); // triggers validator
287
+ select.onchange({ target: select }); // triggers dataChanged event
288
+ });
289
+ return { input: select, overlay: fragment };
271
290
  }
272
291
  /**
273
292
  * Appends an option to a select element
@@ -495,10 +514,11 @@ const TttxForm = class {
495
514
  *
496
515
  * @param {Record<string, any>} formProperties - An object containing properties for the form field, including its label text and validation rules.
497
516
  * @param {HTMLInputElement | HTMLSelectElement} input - The input element to associate with the label.
517
+ * @param {never} overlay - The Child Element which will be rendered atop the standard HTML5 element
498
518
  * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
499
519
  * @return {HTMLLabelElement} - The new label element.
500
520
  */
501
- createLabel(formProperties, input, errorBubble) {
521
+ createLabel(formProperties, input, overlay, errorBubble) {
502
522
  var _a;
503
523
  const outerContainer = document.createElement('div');
504
524
  let outerContainerClassName = 'outer-container inputBlock';
@@ -524,6 +544,9 @@ const TttxForm = class {
524
544
  }
525
545
  else {
526
546
  // Append the input element and error bubble element to the outerContainer
547
+ if (overlay) {
548
+ outerContainer.appendChild(overlay);
549
+ }
527
550
  outerContainer.appendChild(input);
528
551
  }
529
552
  if (formProperties.type !== 'checkbox') {
@@ -593,33 +616,33 @@ const TttxForm = class {
593
616
  this.template.content.append(end);
594
617
  continue;
595
618
  }
596
- let input;
619
+ let fragments = {};
597
620
  switch (formProperties.type) {
598
621
  case 'select':
599
- input = this.createSelect(formKey, formProperties);
622
+ fragments = this.createSelect(formKey, formProperties);
600
623
  break;
601
624
  case 'radio':
602
- input = this.createRadio(formKey, formProperties);
625
+ fragments.input = this.createRadio(formKey, formProperties);
603
626
  break;
604
627
  case 'textarea':
605
- input = this.createTextArea(formKey, formProperties);
628
+ fragments.input = this.createTextArea(formKey, formProperties);
606
629
  break;
607
630
  default:
608
- input = this.createInput(formKey, formProperties);
631
+ fragments.input = this.createInput(formKey, formProperties);
609
632
  }
610
633
  // If the form property has validation, apply it to the input
611
634
  if (formProperties.validation &&
612
635
  formProperties.type !== 'radio') {
613
- this.applyValidation(input, formProperties.validation);
636
+ this.applyValidation(fragments.input, formProperties.validation);
614
637
  }
615
638
  // Create an error bubble and label element for the input
616
639
  const errorBubble = this.createErrorBubble();
617
- const label = this.createLabel(formProperties, input, errorBubble);
640
+ const label = this.createLabel(formProperties, fragments.input, fragments.overlay, errorBubble);
618
641
  // If explicitly setting input as invalid, set invalid state and error message on render
619
642
  if ((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.invalid) {
620
643
  const errorMessage = formProperties.validation.invalid.message;
621
- input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
622
- setErrorState(input, true, errorMessage);
644
+ fragments.input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
645
+ setErrorState(fragments.input, true, errorMessage);
623
646
  }
624
647
  // Append the label element to the form template
625
648
  this.template.content.append(label);
@@ -640,7 +663,7 @@ const TttxForm = class {
640
663
  return;
641
664
  }
642
665
  // Clone the template's content and store it in a variable
643
- const formItems = this.template.content.cloneNode(true);
666
+ const formItems = this.template.content;
644
667
  // Bind event listeners to form elements
645
668
  const properties = this._formSchema.properties;
646
669
  const propertyKeys = Object.keys(properties);
@@ -688,6 +711,11 @@ const TttxForm = class {
688
711
  formItem.checked = true;
689
712
  }
690
713
  break;
714
+ case 'select':
715
+ case 'select-one':
716
+ formItems.querySelector(`[name=overlay-${key}]`).selectedValue = this._data[key];
717
+ formItem.value = this._data[key];
718
+ break;
691
719
  default:
692
720
  formItem.value = this._data[key];
693
721
  }
@@ -26,12 +26,23 @@ const TttxSelectBox = class {
26
26
  }
27
27
  async componentWillLoad() {
28
28
  if (this.optionsData) {
29
- // attempt to preselect an item if specified
30
- const parsedOptionsData = (typeof this.optionsData === 'string') ? JSON.parse(this.optionsData) : this.optionsData;
31
- const matchingItems = parsedOptionsData.filter((item) => { return item.value == this.selectedValue; });
29
+ this.setOptionsData();
30
+ const matchingItems = this._optionsData.filter((item) => { return item.value == this.selectedValue; });
32
31
  this.selectedItem = (matchingItems.length > 0) ? matchingItems[0] : undefined;
33
32
  }
34
33
  }
34
+ async setOptionsData() {
35
+ this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
36
+ }
37
+ async setSelectedItem(value) {
38
+ if (!value)
39
+ return;
40
+ const item = this._optionsData.find(x => x.value.toLowerCase() === value.toLowerCase());
41
+ if (!item)
42
+ return;
43
+ this.selectedValue = item.value;
44
+ this.selectedItem = item;
45
+ }
35
46
  handleCloseSelectBox() {
36
47
  this.open = false;
37
48
  }
@@ -111,7 +122,6 @@ const TttxSelectBox = class {
111
122
  render() {
112
123
  if (!this.optionsData)
113
124
  return;
114
- this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
115
125
  return (index.h(index.Host, { class: this.inline ? 'inline' : 'block' }, this.label && index.h("div", { class: "label" }, this.label), index.h("div", { tabindex: "0", class: "dropdown-container" }, index.h("div", { class: "dropdown-selector", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (index.h("div", { class: "dropdown-body-container" }, index.h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
116
126
  /* istanbul ignore next */
117
127
  index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), index.h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
@@ -119,6 +129,9 @@ const TttxSelectBox = class {
119
129
  }))))))));
120
130
  }
121
131
  get el() { return index.getElement(this); }
132
+ static get watchers() { return {
133
+ "optionsData": ["setOptionsData"]
134
+ }; }
122
135
  };
123
136
  TttxSelectBox.style = tttxSelectBoxCss;
124
137
 
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[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.cjs",[[1,"tttx-tree-view",{"data":[1040],"firstSelected":[1028,"first-selected"],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[1,"tttx-dialog",{"header":[1],"type":[1],"size":[1],"open":[4],"allowOverflow":[4,"allow-overflow"],"closeEnabled":[4,"close-enabled"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-expander.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64],"setSelectOptions":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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-filter_4.cjs",[[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"]]],[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}],[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"]]],[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
20
+ return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64],"setSelectOptions":[64]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-tree-view.cjs",[[1,"tttx-tree-view",{"data":[1040],"firstSelected":[1028,"first-selected"],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[1,"tttx-dialog",{"header":[1],"type":[1],"size":[1],"open":[4],"allowOverflow":[4,"allow-overflow"],"closeEnabled":[4,"close-enabled"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-expander.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-select-box.cjs",[[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],"setSelectedItem":[64]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-filter_4.cjs",[[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"]]],[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}],[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"]]],[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]],["tttx-standalone-input.cjs",[[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]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -64,7 +64,7 @@ export class TttxForm {
64
64
  */
65
65
  async setSelectOptions(fieldname, options) {
66
66
  const select = this.fieldset.querySelector(`[name=${fieldname}]`);
67
- select.innerHTML = '';
67
+ const tttxSelect = this.fieldset.querySelector(`[name=overlay-${fieldname}]`);
68
68
  const fragment = new DocumentFragment();
69
69
  for (const option of options) {
70
70
  const o = document.createElement('option');
@@ -72,7 +72,10 @@ export class TttxForm {
72
72
  o.value = option.value;
73
73
  fragment.appendChild(o);
74
74
  }
75
- select.appendChild(fragment);
75
+ select.replaceChildren(fragment);
76
+ tttxSelect.optionsData = options;
77
+ //await tttxSelect.setOptionsData(options);
78
+ await tttxSelect.setSelectedItem(options[0].value);
76
79
  }
77
80
  /**
78
81
  * Submits the form data to the server.
@@ -129,7 +132,7 @@ export class TttxForm {
129
132
  * @param {boolean} [formProperties.options[].placeholder]
130
133
  */
131
134
  createSelect(formKey, formProperties) {
132
- var _a;
135
+ var _a, _b, _c, _d;
133
136
  const select = document.createElement('select');
134
137
  select.setAttribute('name', formKey);
135
138
  formProperties.options.forEach(optionProperties => {
@@ -137,7 +140,23 @@ export class TttxForm {
137
140
  });
138
141
  if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey])
139
142
  select.classList.remove('placeholder');
140
- return select;
143
+ const tttxSelect = document.createElement('tttx-select-box');
144
+ tttxSelect.optionsData = (_b = formProperties.options) === null || _b === void 0 ? void 0 : _b.filter(o => !o.placeholder);
145
+ tttxSelect.placeholder = (_d = (_c = formProperties.options) === null || _c === void 0 ? void 0 : _c.filter(o => o.placeholder)[0]) === null || _d === void 0 ? void 0 : _d.label;
146
+ tttxSelect.inline = false;
147
+ tttxSelect.searchEnabled = true;
148
+ tttxSelect.style.width = '100%';
149
+ tttxSelect.style.marginTop = '6px';
150
+ tttxSelect.setAttribute('name', 'overlay-' + formKey);
151
+ const fragment = document.createDocumentFragment();
152
+ fragment.append(tttxSelect);
153
+ select.style.display = 'none';
154
+ tttxSelect.addEventListener('selectItemEvent', function (ev) {
155
+ select.value = ev.detail.value;
156
+ select.onblur({ target: select }); // triggers validator
157
+ select.onchange({ target: select }); // triggers dataChanged event
158
+ });
159
+ return { input: select, overlay: fragment };
141
160
  }
142
161
  /**
143
162
  * Appends an option to a select element
@@ -365,10 +384,11 @@ export class TttxForm {
365
384
  *
366
385
  * @param {Record<string, any>} formProperties - An object containing properties for the form field, including its label text and validation rules.
367
386
  * @param {HTMLInputElement | HTMLSelectElement} input - The input element to associate with the label.
387
+ * @param {never} overlay - The Child Element which will be rendered atop the standard HTML5 element
368
388
  * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
369
389
  * @return {HTMLLabelElement} - The new label element.
370
390
  */
371
- createLabel(formProperties, input, errorBubble) {
391
+ createLabel(formProperties, input, overlay, errorBubble) {
372
392
  var _a;
373
393
  const outerContainer = document.createElement('div');
374
394
  let outerContainerClassName = 'outer-container inputBlock';
@@ -394,6 +414,9 @@ export class TttxForm {
394
414
  }
395
415
  else {
396
416
  // Append the input element and error bubble element to the outerContainer
417
+ if (overlay) {
418
+ outerContainer.appendChild(overlay);
419
+ }
397
420
  outerContainer.appendChild(input);
398
421
  }
399
422
  if (formProperties.type !== 'checkbox') {
@@ -463,33 +486,33 @@ export class TttxForm {
463
486
  this.template.content.append(end);
464
487
  continue;
465
488
  }
466
- let input;
489
+ let fragments = {};
467
490
  switch (formProperties.type) {
468
491
  case 'select':
469
- input = this.createSelect(formKey, formProperties);
492
+ fragments = this.createSelect(formKey, formProperties);
470
493
  break;
471
494
  case 'radio':
472
- input = this.createRadio(formKey, formProperties);
495
+ fragments.input = this.createRadio(formKey, formProperties);
473
496
  break;
474
497
  case 'textarea':
475
- input = this.createTextArea(formKey, formProperties);
498
+ fragments.input = this.createTextArea(formKey, formProperties);
476
499
  break;
477
500
  default:
478
- input = this.createInput(formKey, formProperties);
501
+ fragments.input = this.createInput(formKey, formProperties);
479
502
  }
480
503
  // If the form property has validation, apply it to the input
481
504
  if (formProperties.validation &&
482
505
  formProperties.type !== 'radio') {
483
- this.applyValidation(input, formProperties.validation);
506
+ this.applyValidation(fragments.input, formProperties.validation);
484
507
  }
485
508
  // Create an error bubble and label element for the input
486
509
  const errorBubble = this.createErrorBubble();
487
- const label = this.createLabel(formProperties, input, errorBubble);
510
+ const label = this.createLabel(formProperties, fragments.input, fragments.overlay, errorBubble);
488
511
  // If explicitly setting input as invalid, set invalid state and error message on render
489
512
  if ((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.invalid) {
490
513
  const errorMessage = formProperties.validation.invalid.message;
491
- input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
492
- setErrorState(input, true, errorMessage);
514
+ fragments.input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
515
+ setErrorState(fragments.input, true, errorMessage);
493
516
  }
494
517
  // Append the label element to the form template
495
518
  this.template.content.append(label);
@@ -510,7 +533,7 @@ export class TttxForm {
510
533
  return;
511
534
  }
512
535
  // Clone the template's content and store it in a variable
513
- const formItems = this.template.content.cloneNode(true);
536
+ const formItems = this.template.content;
514
537
  // Bind event listeners to form elements
515
538
  const properties = this._formSchema.properties;
516
539
  const propertyKeys = Object.keys(properties);
@@ -558,6 +581,11 @@ export class TttxForm {
558
581
  formItem.checked = true;
559
582
  }
560
583
  break;
584
+ case 'select':
585
+ case 'select-one':
586
+ formItems.querySelector(`[name=overlay-${key}]`).selectedValue = this._data[key];
587
+ formItem.value = this._data[key];
588
+ break;
561
589
  default:
562
590
  formItem.value = this._data[key];
563
591
  }
@@ -771,6 +799,9 @@ export class TttxForm {
771
799
  "references": {
772
800
  "Promise": {
773
801
  "location": "global"
802
+ },
803
+ "HTMLTttxSelectBoxElement": {
804
+ "location": "global"
774
805
  }
775
806
  },
776
807
  "return": "Promise<void>"
@@ -17,12 +17,23 @@ export class TttxSelectBox {
17
17
  }
18
18
  async componentWillLoad() {
19
19
  if (this.optionsData) {
20
- // attempt to preselect an item if specified
21
- const parsedOptionsData = (typeof this.optionsData === 'string') ? JSON.parse(this.optionsData) : this.optionsData;
22
- const matchingItems = parsedOptionsData.filter((item) => { return item.value == this.selectedValue; });
20
+ this.setOptionsData();
21
+ const matchingItems = this._optionsData.filter((item) => { return item.value == this.selectedValue; });
23
22
  this.selectedItem = (matchingItems.length > 0) ? matchingItems[0] : undefined;
24
23
  }
25
24
  }
25
+ async setOptionsData() {
26
+ this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
27
+ }
28
+ async setSelectedItem(value) {
29
+ if (!value)
30
+ return;
31
+ const item = this._optionsData.find(x => x.value.toLowerCase() === value.toLowerCase());
32
+ if (!item)
33
+ return;
34
+ this.selectedValue = item.value;
35
+ this.selectedItem = item;
36
+ }
26
37
  handleCloseSelectBox() {
27
38
  this.open = false;
28
39
  }
@@ -102,7 +113,6 @@ export class TttxSelectBox {
102
113
  render() {
103
114
  if (!this.optionsData)
104
115
  return;
105
- this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
106
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", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
107
117
  /* istanbul ignore next */
108
118
  h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
@@ -279,7 +289,36 @@ export class TttxSelectBox {
279
289
  }
280
290
  }];
281
291
  }
292
+ static get methods() {
293
+ return {
294
+ "setSelectedItem": {
295
+ "complexType": {
296
+ "signature": "(value: string) => Promise<void>",
297
+ "parameters": [{
298
+ "tags": [],
299
+ "text": ""
300
+ }],
301
+ "references": {
302
+ "Promise": {
303
+ "location": "global"
304
+ }
305
+ },
306
+ "return": "Promise<void>"
307
+ },
308
+ "docs": {
309
+ "text": "",
310
+ "tags": []
311
+ }
312
+ }
313
+ };
314
+ }
282
315
  static get elementRef() { return "el"; }
316
+ static get watchers() {
317
+ return [{
318
+ "propName": "optionsData",
319
+ "methodName": "setOptionsData"
320
+ }];
321
+ }
283
322
  static get listeners() {
284
323
  return [{
285
324
  "name": "closeSelectBox",