@3t-transform/threeteeui 0.2.115 → 0.2.116

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,22 @@ 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 });
287
+ });
288
+ return { input: select, overlay: fragment };
271
289
  }
272
290
  /**
273
291
  * Appends an option to a select element
@@ -495,10 +513,11 @@ const TttxForm = class {
495
513
  *
496
514
  * @param {Record<string, any>} formProperties - An object containing properties for the form field, including its label text and validation rules.
497
515
  * @param {HTMLInputElement | HTMLSelectElement} input - The input element to associate with the label.
516
+ * @param {never} overlay - The Child Element which will be rendered atop the standard HTML5 element
498
517
  * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
499
518
  * @return {HTMLLabelElement} - The new label element.
500
519
  */
501
- createLabel(formProperties, input, errorBubble) {
520
+ createLabel(formProperties, input, overlay, errorBubble) {
502
521
  var _a;
503
522
  const outerContainer = document.createElement('div');
504
523
  let outerContainerClassName = 'outer-container inputBlock';
@@ -524,6 +543,9 @@ const TttxForm = class {
524
543
  }
525
544
  else {
526
545
  // Append the input element and error bubble element to the outerContainer
546
+ if (overlay) {
547
+ outerContainer.appendChild(overlay);
548
+ }
527
549
  outerContainer.appendChild(input);
528
550
  }
529
551
  if (formProperties.type !== 'checkbox') {
@@ -593,33 +615,33 @@ const TttxForm = class {
593
615
  this.template.content.append(end);
594
616
  continue;
595
617
  }
596
- let input;
618
+ let fragments = {};
597
619
  switch (formProperties.type) {
598
620
  case 'select':
599
- input = this.createSelect(formKey, formProperties);
621
+ fragments = this.createSelect(formKey, formProperties);
600
622
  break;
601
623
  case 'radio':
602
- input = this.createRadio(formKey, formProperties);
624
+ fragments.input = this.createRadio(formKey, formProperties);
603
625
  break;
604
626
  case 'textarea':
605
- input = this.createTextArea(formKey, formProperties);
627
+ fragments.input = this.createTextArea(formKey, formProperties);
606
628
  break;
607
629
  default:
608
- input = this.createInput(formKey, formProperties);
630
+ fragments.input = this.createInput(formKey, formProperties);
609
631
  }
610
632
  // If the form property has validation, apply it to the input
611
633
  if (formProperties.validation &&
612
634
  formProperties.type !== 'radio') {
613
- this.applyValidation(input, formProperties.validation);
635
+ this.applyValidation(fragments.input, formProperties.validation);
614
636
  }
615
637
  // Create an error bubble and label element for the input
616
638
  const errorBubble = this.createErrorBubble();
617
- const label = this.createLabel(formProperties, input, errorBubble);
639
+ const label = this.createLabel(formProperties, fragments.input, fragments.overlay, errorBubble);
618
640
  // If explicitly setting input as invalid, set invalid state and error message on render
619
641
  if ((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.invalid) {
620
642
  const errorMessage = formProperties.validation.invalid.message;
621
- input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
622
- setErrorState(input, true, errorMessage);
643
+ fragments.input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
644
+ setErrorState(fragments.input, true, errorMessage);
623
645
  }
624
646
  // Append the label element to the form template
625
647
  this.template.content.append(label);
@@ -640,7 +662,7 @@ const TttxForm = class {
640
662
  return;
641
663
  }
642
664
  // Clone the template's content and store it in a variable
643
- const formItems = this.template.content.cloneNode(true);
665
+ const formItems = this.template.content;
644
666
  // Bind event listeners to form elements
645
667
  const properties = this._formSchema.properties;
646
668
  const propertyKeys = Object.keys(properties);
@@ -688,6 +710,11 @@ const TttxForm = class {
688
710
  formItem.checked = true;
689
711
  }
690
712
  break;
713
+ case 'select':
714
+ case 'select-one':
715
+ formItems.querySelector(`[name=overlay-${key}]`).selectedValue = this._data[key];
716
+ formItem.value = this._data[key];
717
+ break;
691
718
  default:
692
719
  formItem.value = this._data[key];
693
720
  }
@@ -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,22 @@ 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 });
157
+ });
158
+ return { input: select, overlay: fragment };
141
159
  }
142
160
  /**
143
161
  * Appends an option to a select element
@@ -365,10 +383,11 @@ export class TttxForm {
365
383
  *
366
384
  * @param {Record<string, any>} formProperties - An object containing properties for the form field, including its label text and validation rules.
367
385
  * @param {HTMLInputElement | HTMLSelectElement} input - The input element to associate with the label.
386
+ * @param {never} overlay - The Child Element which will be rendered atop the standard HTML5 element
368
387
  * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
369
388
  * @return {HTMLLabelElement} - The new label element.
370
389
  */
371
- createLabel(formProperties, input, errorBubble) {
390
+ createLabel(formProperties, input, overlay, errorBubble) {
372
391
  var _a;
373
392
  const outerContainer = document.createElement('div');
374
393
  let outerContainerClassName = 'outer-container inputBlock';
@@ -394,6 +413,9 @@ export class TttxForm {
394
413
  }
395
414
  else {
396
415
  // Append the input element and error bubble element to the outerContainer
416
+ if (overlay) {
417
+ outerContainer.appendChild(overlay);
418
+ }
397
419
  outerContainer.appendChild(input);
398
420
  }
399
421
  if (formProperties.type !== 'checkbox') {
@@ -463,33 +485,33 @@ export class TttxForm {
463
485
  this.template.content.append(end);
464
486
  continue;
465
487
  }
466
- let input;
488
+ let fragments = {};
467
489
  switch (formProperties.type) {
468
490
  case 'select':
469
- input = this.createSelect(formKey, formProperties);
491
+ fragments = this.createSelect(formKey, formProperties);
470
492
  break;
471
493
  case 'radio':
472
- input = this.createRadio(formKey, formProperties);
494
+ fragments.input = this.createRadio(formKey, formProperties);
473
495
  break;
474
496
  case 'textarea':
475
- input = this.createTextArea(formKey, formProperties);
497
+ fragments.input = this.createTextArea(formKey, formProperties);
476
498
  break;
477
499
  default:
478
- input = this.createInput(formKey, formProperties);
500
+ fragments.input = this.createInput(formKey, formProperties);
479
501
  }
480
502
  // If the form property has validation, apply it to the input
481
503
  if (formProperties.validation &&
482
504
  formProperties.type !== 'radio') {
483
- this.applyValidation(input, formProperties.validation);
505
+ this.applyValidation(fragments.input, formProperties.validation);
484
506
  }
485
507
  // Create an error bubble and label element for the input
486
508
  const errorBubble = this.createErrorBubble();
487
- const label = this.createLabel(formProperties, input, errorBubble);
509
+ const label = this.createLabel(formProperties, fragments.input, fragments.overlay, errorBubble);
488
510
  // If explicitly setting input as invalid, set invalid state and error message on render
489
511
  if ((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.invalid) {
490
512
  const errorMessage = formProperties.validation.invalid.message;
491
- input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
492
- setErrorState(input, true, errorMessage);
513
+ fragments.input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
514
+ setErrorState(fragments.input, true, errorMessage);
493
515
  }
494
516
  // Append the label element to the form template
495
517
  this.template.content.append(label);
@@ -510,7 +532,7 @@ export class TttxForm {
510
532
  return;
511
533
  }
512
534
  // Clone the template's content and store it in a variable
513
- const formItems = this.template.content.cloneNode(true);
535
+ const formItems = this.template.content;
514
536
  // Bind event listeners to form elements
515
537
  const properties = this._formSchema.properties;
516
538
  const propertyKeys = Object.keys(properties);
@@ -558,6 +580,11 @@ export class TttxForm {
558
580
  formItem.checked = true;
559
581
  }
560
582
  break;
583
+ case 'select':
584
+ case 'select-one':
585
+ formItems.querySelector(`[name=overlay-${key}]`).selectedValue = this._data[key];
586
+ formItem.value = this._data[key];
587
+ break;
561
588
  default:
562
589
  formItem.value = this._data[key];
563
590
  }
@@ -771,6 +798,9 @@ export class TttxForm {
771
798
  "references": {
772
799
  "Promise": {
773
800
  "location": "global"
801
+ },
802
+ "HTMLTttxSelectBoxElement": {
803
+ "location": "global"
774
804
  }
775
805
  },
776
806
  "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",