@sankhyalabs/ezui 5.22.0-dev.124 → 5.22.0-dev.125

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.
Files changed (79) hide show
  1. package/dist/cjs/{types-6a5df0c7.js → FormLayout-18853e70.js} +6 -0
  2. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -2
  3. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -2
  4. package/dist/cjs/ez-combo-box-list_3.cjs.entry.js +2 -3
  5. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -2
  6. package/dist/cjs/ez-form.cjs.entry.js +60 -5
  7. package/dist/cjs/ez-grid.cjs.entry.js +61 -12
  8. package/dist/cjs/ez-search-plus.cjs.entry.js +4 -5
  9. package/dist/cjs/ez-search.cjs.entry.js +1 -2
  10. package/dist/cjs/ez-split-button.cjs.entry.js +15 -6
  11. package/dist/cjs/ez-split-item.cjs.entry.js +1 -2
  12. package/dist/cjs/ez-text-input.cjs.entry.js +16 -2
  13. package/dist/cjs/ezui.cjs.js +1 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/{DataBinder-b9973a19.js → search-column-e9409a62.js} +31 -0
  16. package/dist/collection/components/ez-form/ez-form.js +95 -2
  17. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +18 -1
  18. package/dist/collection/components/ez-grid/ez-grid.js +56 -4
  19. package/dist/collection/components/ez-split-button/ez-split-button.css +1 -1
  20. package/dist/collection/components/ez-split-button/ez-split-button.js +87 -10
  21. package/dist/collection/components/ez-text-input/ez-text-input.css +7 -0
  22. package/dist/collection/components/ez-text-input/ez-text-input.js +15 -1
  23. package/dist/collection/utils/index.js +1 -0
  24. package/dist/collection/utils/searchColumn/search-column.js +35 -0
  25. package/dist/custom-elements/index.js +168 -17
  26. package/dist/esm/{types-6f6b2650.js → FormLayout-071d324c.js} +7 -1
  27. package/dist/esm/ez-actions-button.entry.js +1 -2
  28. package/dist/esm/ez-collapsible-box.entry.js +1 -2
  29. package/dist/esm/ez-combo-box-list_3.entry.js +1 -2
  30. package/dist/esm/ez-combo-box.entry.js +1 -2
  31. package/dist/esm/ez-form.entry.js +59 -4
  32. package/dist/esm/ez-grid.entry.js +56 -7
  33. package/dist/esm/ez-search-plus.entry.js +1 -2
  34. package/dist/esm/ez-search.entry.js +1 -2
  35. package/dist/esm/ez-split-button.entry.js +15 -6
  36. package/dist/esm/ez-split-item.entry.js +1 -2
  37. package/dist/esm/ez-text-input.entry.js +16 -2
  38. package/dist/esm/ezui.js +1 -1
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/{DataBinder-1035e36f.js → search-column-d0a74266.js} +26 -1
  41. package/dist/ezui/ezui.esm.js +1 -1
  42. package/dist/ezui/p-07894c4a.entry.js +1 -0
  43. package/dist/ezui/p-1eb34cad.entry.js +1 -0
  44. package/dist/ezui/p-30ffb9ed.js +1 -0
  45. package/dist/ezui/p-341da682.entry.js +1 -0
  46. package/dist/ezui/p-35115d5d.entry.js +1 -0
  47. package/dist/ezui/p-41e3ecf5.entry.js +1 -0
  48. package/dist/ezui/p-64a9c36f.entry.js +1 -0
  49. package/dist/ezui/p-998afb6a.entry.js +1 -0
  50. package/dist/ezui/p-a3bf8cf1.entry.js +1 -0
  51. package/dist/ezui/p-b53571cc.entry.js +1 -0
  52. package/dist/ezui/{p-6b39b79a.entry.js → p-c0368531.entry.js} +46 -46
  53. package/dist/ezui/p-e3792c2a.js +1 -0
  54. package/dist/ezui/p-f2a3fcbe.entry.js +1 -0
  55. package/dist/types/components/ez-form/ez-form.d.ts +18 -0
  56. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +1 -1
  57. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -1
  58. package/dist/types/components/ez-grid/ez-grid.d.ts +7 -0
  59. package/dist/types/components/ez-split-button/ez-split-button.d.ts +14 -2
  60. package/dist/types/components/ez-text-input/ez-text-input.d.ts +2 -0
  61. package/dist/types/components.d.ts +42 -0
  62. package/dist/types/utils/index.d.ts +1 -0
  63. package/dist/types/utils/searchColumn/search-column.d.ts +9 -0
  64. package/package.json +1 -1
  65. package/dist/cjs/FormLayout-c2451c7f.js +0 -7
  66. package/dist/esm/FormLayout-54092963.js +0 -7
  67. package/dist/ezui/p-15ea0c98.js +0 -1
  68. package/dist/ezui/p-173f68ea.js +0 -1
  69. package/dist/ezui/p-5895e687.js +0 -1
  70. package/dist/ezui/p-5a14f506.entry.js +0 -1
  71. package/dist/ezui/p-5ec0ae79.entry.js +0 -1
  72. package/dist/ezui/p-6754489a.entry.js +0 -1
  73. package/dist/ezui/p-a4cee65d.entry.js +0 -1
  74. package/dist/ezui/p-c00df4be.entry.js +0 -1
  75. package/dist/ezui/p-ebd23857.entry.js +0 -1
  76. package/dist/ezui/p-ecaac11f.entry.js +0 -1
  77. package/dist/ezui/p-f4861c6a.entry.js +0 -1
  78. package/dist/ezui/p-f6316720.entry.js +0 -1
  79. package/dist/ezui/p-ff1d8b8f.entry.js +0 -1
@@ -1,10 +1,11 @@
1
1
  import { ElementIDUtils, JSUtils, OverflowWatcher, OVERFLOWED_CLASS_NAME, StringUtils, ApplicationContext, KeyboardManager, } from '@sankhyalabs/core';
2
2
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
3
3
  import { Host, h } from '@stencil/core';
4
- import { ApplicationUtils } from '../../utils';
4
+ import { ApplicationUtils, buildFieldSearch } from '../../utils';
5
5
  import AgGridController from './controller/ag-grid/AgGridController';
6
6
  import { SelectionCounter } from './subcomponents/selection-counter';
7
7
  import InMemoryFilterColumnDataSource from './utils/InMemoryFilterColumnDataSource';
8
+ import { focusOnFieldSerch, LABEL_SEARCH_COLUMN, SEARCH_FIELD_FULL_WIDTH, SHORTCUT_SEARCH_FIELD } from '../../utils/searchColumn/search-column';
8
9
  const windowInstace = window;
9
10
  const matches = (text, filter) => {
10
11
  const normalizedText = StringUtils.replaceAccentuatedCharsLower(text === null || text === void 0 ? void 0 : text.toLocaleLowerCase());
@@ -45,6 +46,7 @@ export class EzGrid {
45
46
  this.outlineMode = false;
46
47
  this.enableRowTableStriped = true;
47
48
  this.compact = false;
49
+ this.useSearchColumn = true;
48
50
  }
49
51
  /**
50
52
  * Aplica a definição de colunas.
@@ -98,7 +100,7 @@ export class EzGrid {
98
100
  * Localiza determinada coluna tornando-a visível.
99
101
  */
100
102
  async locateColumn(columnName) {
101
- this._gridController.locateColumn(columnName);
103
+ this._gridController.locateColumn(columnName, this._element);
102
104
  }
103
105
  /**
104
106
  * Usa um argumento para filtrar as colunas po label
@@ -596,11 +598,43 @@ export class EzGrid {
596
598
  this.nextPage();
597
599
  }
598
600
  }, { description: "Avança para a próxima página.", element: this._element });
601
+ if (this.useSearchColumn) {
602
+ this._keyboardManager.bind(SHORTCUT_SEARCH_FIELD, async () => {
603
+ if (!this._container || !this._ezPopoverSearchColumn)
604
+ return;
605
+ const container = this._container.getBoundingClientRect();
606
+ await focusOnFieldSerch(this._columnSearch);
607
+ this._ezPopoverSearchColumn.showUnder(this._container, { horizontalGap: container.width - (SEARCH_FIELD_FULL_WIDTH), verticalGap: container.height * -1 });
608
+ }, { description: LABEL_SEARCH_COLUMN, element: this._element });
609
+ }
599
610
  }
600
611
  async removeShortcuts() {
601
612
  var _a;
602
613
  (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
603
614
  }
615
+ renderFieldSearchColumn() {
616
+ this._columnSearch = buildFieldSearch({
617
+ value: StringUtils.generateUUID(),
618
+ label: LABEL_SEARCH_COLUMN,
619
+ }, ({ argument }) => new Promise(accept => {
620
+ this.filterColumns(argument).then((columns) => {
621
+ accept(columns
622
+ .filter(column => !column.hidden)
623
+ .map(column => ({ label: column.label, value: column.name })));
624
+ });
625
+ }), async (option) => {
626
+ if (option != undefined && option.value != undefined) {
627
+ await this.locateColumn(option.value);
628
+ if (this._ezPopoverSearchColumn) {
629
+ this._ezPopoverSearchColumn.hide();
630
+ }
631
+ if (this._container) {
632
+ requestAnimationFrame(() => this._container.focus());
633
+ }
634
+ }
635
+ });
636
+ return this._columnSearch;
637
+ }
604
638
  render() {
605
639
  var _a;
606
640
  return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: {
@@ -609,11 +643,11 @@ export class EzGrid {
609
643
  'shadow-mode': !this.outlineMode,
610
644
  'no-padding': this.compact,
611
645
  'header-overlay': !this.hideHeader(),
612
- }, ref: elem => (this._container = elem) }), h("div", { class: {
646
+ }, ref: elem => (this._container = elem), tabindex: "0" }), h("div", { class: {
613
647
  'ez-box ez-padding--small grid-header': true,
614
648
  'outline-mode': this.outlineMode,
615
649
  'shadow-mode': !this.outlineMode && !this.hideHeader(),
616
- } }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: `grid-header__container grid-header__left-container ${this.resolveLeftHeaderClass()}` }, h("slot", { name: "leftButtons" })), this.getPaginationControl())), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
650
+ }, tabindex: "0" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: `grid-header__container grid-header__left-container ${this.resolveLeftHeaderClass()}` }, h("slot", { name: "leftButtons" })), this.getPaginationControl())), h("ez-popover", { ref: elem => (this._ezPopoverSearchColumn = elem), overlayType: "none" }, this.renderFieldSearchColumn()), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
617
651
  ${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
618
652
  ` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
619
653
  }
@@ -1005,6 +1039,24 @@ export class EzGrid {
1005
1039
  "attribute": "compact",
1006
1040
  "reflect": false,
1007
1041
  "defaultValue": "false"
1042
+ },
1043
+ "useSearchColumn": {
1044
+ "type": "boolean",
1045
+ "mutable": false,
1046
+ "complexType": {
1047
+ "original": "boolean",
1048
+ "resolved": "boolean",
1049
+ "references": {}
1050
+ },
1051
+ "required": false,
1052
+ "optional": false,
1053
+ "docs": {
1054
+ "tags": [],
1055
+ "text": "Define se a grade deve exibir um buscador de coluna com uso do Ctrl+F"
1056
+ },
1057
+ "attribute": "use-search-column",
1058
+ "reflect": false,
1059
+ "defaultValue": "true"
1008
1060
  }
1009
1061
  };
1010
1062
  }
@@ -258,7 +258,7 @@
258
258
  position: absolute;
259
259
  background-color: #f1f1f1;
260
260
  min-width: 160px;
261
- z-index: --ez-elevation--8;
261
+ z-index: var(--ez-elevation--8);
262
262
  border-radius: var(--ez-split-button--border-radius);
263
263
  }
264
264
 
@@ -13,6 +13,7 @@ export class EzSplitButton {
13
13
  this.rightTitle = 'Mais opções';
14
14
  this.mode = 'default';
15
15
  this.size = 'medium';
16
+ this.itemBuilder = undefined;
16
17
  }
17
18
  /**
18
19
  * Remove o foco de ambos os botões.
@@ -33,6 +34,18 @@ export class EzSplitButton {
33
34
  async setRightButtonFocus() {
34
35
  this.rightButton.focus();
35
36
  }
37
+ /**
38
+ * Abre ou Fecha o dropdown do Split Button.
39
+ */
40
+ async toggleDropdown() {
41
+ this.show = !this.show;
42
+ }
43
+ /**
44
+ * Informa se a lista de ações está aberta.
45
+ */
46
+ async isOpenedDropdown() {
47
+ return this.show;
48
+ }
36
49
  clickListener(evt) {
37
50
  if (!this.enabled) {
38
51
  evt.preventDefault();
@@ -49,16 +62,12 @@ export class EzSplitButton {
49
62
  closeDropdown() {
50
63
  this.show = false;
51
64
  }
52
- toggleDropdown() {
53
- this.show = !this.show;
54
- }
55
65
  handleButtonClick() {
56
66
  this.buttonClick.emit();
57
67
  }
58
68
  handleDropdownItemClick(evt) {
59
69
  this.dropdownItemClick.emit(evt.detail);
60
70
  evt.stopPropagation();
61
- this.closeDropdown();
62
71
  }
63
72
  handleDropdownSubActionClick(evt) {
64
73
  this.dropdownSubActionClick.emit(evt.detail);
@@ -140,7 +149,7 @@ export class EzSplitButton {
140
149
  const hasIconButton = this.shouldShowIconOnLeftButton();
141
150
  const hasLabelButton = this.shouldShowLabelOnLeftButton();
142
151
  const iconSize = this.getIconSize();
143
- return (h("div", { class: "label-icon" }, h("button", { class: `ez-split-button__left-button ${iconSize} ${this.mode}`, title: this.leftTitle || this.label, type: "button", disabled: !this.enabled, onClick: () => { this.handleButtonClick(); }, ref: el => (this.leftButton = el) }, hasIconButton && h("ez-icon", { href: this.image, iconName: this.iconName, size: iconSize }), hasLabelButton && h("label", { title: this.leftTitle || this.label }, this.label)), h("div", { class: "dropdown" }, h("button", { class: `ez-split-button__right-button ${iconSize} ez-split-button__right-button--${iconSize} ez-split-button__right-button--divider`, title: this.rightTitle || this.rightDefaultTitle, type: "button", disabled: !this.enabled, onClick: () => { this.toggleDropdown(); }, ref: el => (this.rightButton = el) }, h("ez-icon", { class: `ez-split-button__right-button-container ` + (iconSize ? `btn-icon--${iconSize}` : ''), iconName: 'chevron-down', size: iconSize })), h("div", { class: `dropdown-content dropdown-content--${this.size}`, ref: (ref) => (this.dropdownParent = ref) }, this.show && (h("ez-dropdown", { items: this.items, onClick: evt => { evt.stopPropagation(); }, onEzOutsideClick: () => { this.closeDropdown(); }, onEzClick: evt => { this.handleDropdownItemClick(evt); }, onEzSubActionClick: evt => { this.handleDropdownSubActionClick(evt); } }))))));
152
+ return (h("div", { class: "label-icon" }, h("button", { class: `ez-split-button__left-button ${iconSize} ${this.mode}`, title: this.leftTitle || this.label, type: "button", disabled: !this.enabled, onClick: () => { this.handleButtonClick(); }, ref: el => (this.leftButton = el) }, hasIconButton && h("ez-icon", { href: this.image, iconName: this.iconName, size: iconSize }), hasLabelButton && h("label", { title: this.leftTitle || this.label }, this.label)), h("div", { class: "dropdown" }, h("button", { class: `ez-split-button__right-button ${iconSize} ez-split-button__right-button--${iconSize} ez-split-button__right-button--divider`, title: this.rightTitle || this.rightDefaultTitle, type: "button", disabled: !this.enabled, onClick: () => { this.toggleDropdown(); }, ref: el => (this.rightButton = el) }, h("ez-icon", { class: `ez-split-button__right-button-container ` + (iconSize ? `btn-icon--${iconSize}` : ''), iconName: 'chevron-down', size: iconSize })), h("div", { class: `dropdown-content dropdown-content--${this.size}`, ref: (ref) => (this.dropdownParent = ref) }, this.show && (h("ez-dropdown", { items: this.items, onClick: evt => { evt.stopPropagation(); }, onEzOutsideClick: () => { this.closeDropdown(); }, onEzClick: evt => { this.handleDropdownItemClick(evt); }, onEzSubActionClick: evt => { this.handleDropdownSubActionClick(evt); }, itemBuilder: this.itemBuilder }))))));
144
153
  }
145
154
  shouldShowLabelOnLeftButton() {
146
155
  return ['icon-left', 'default'].includes(this.mode);
@@ -162,6 +171,24 @@ export class EzSplitButton {
162
171
  }
163
172
  static get properties() {
164
173
  return {
174
+ "show": {
175
+ "type": "boolean",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "boolean",
179
+ "resolved": "boolean",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": false,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": ""
187
+ },
188
+ "attribute": "show",
189
+ "reflect": true,
190
+ "defaultValue": "false"
191
+ },
165
192
  "enabled": {
166
193
  "type": "boolean",
167
194
  "mutable": false,
@@ -324,14 +351,32 @@ export class EzSplitButton {
324
351
  "attribute": "size",
325
352
  "reflect": true,
326
353
  "defaultValue": "'medium'"
354
+ },
355
+ "itemBuilder": {
356
+ "type": "unknown",
357
+ "mutable": false,
358
+ "complexType": {
359
+ "original": "(item: IDropdownItem, level: number) => HTMLElement | string",
360
+ "resolved": "(item: IDropdownItem, level: number) => string | HTMLElement",
361
+ "references": {
362
+ "IDropdownItem": {
363
+ "location": "import",
364
+ "path": "../ez-dropdown/structure/DropdownItem"
365
+ },
366
+ "HTMLElement": {
367
+ "location": "global"
368
+ }
369
+ }
370
+ },
371
+ "required": false,
372
+ "optional": false,
373
+ "docs": {
374
+ "tags": [],
375
+ "text": "Fun\u00E7\u00E3o builder que possibilita alterar como o item da lista vai ser apresentado.\nObserva\u00E7\u00E3o: No react ele se transforma em VNode e n\u00E3o como HTMLElement."
376
+ }
327
377
  }
328
378
  };
329
379
  }
330
- static get states() {
331
- return {
332
- "show": {}
333
- };
334
- }
335
380
  static get events() {
336
381
  return [{
337
382
  "method": "buttonClick",
@@ -439,6 +484,38 @@ export class EzSplitButton {
439
484
  "text": "Aplica o foco no bot\u00E3o do dropdown.",
440
485
  "tags": []
441
486
  }
487
+ },
488
+ "toggleDropdown": {
489
+ "complexType": {
490
+ "signature": "() => Promise<void>",
491
+ "parameters": [],
492
+ "references": {
493
+ "Promise": {
494
+ "location": "global"
495
+ }
496
+ },
497
+ "return": "Promise<void>"
498
+ },
499
+ "docs": {
500
+ "text": "Abre ou Fecha o dropdown do Split Button.",
501
+ "tags": []
502
+ }
503
+ },
504
+ "isOpenedDropdown": {
505
+ "complexType": {
506
+ "signature": "() => Promise<boolean>",
507
+ "parameters": [],
508
+ "references": {
509
+ "Promise": {
510
+ "location": "global"
511
+ }
512
+ },
513
+ "return": "Promise<boolean>"
514
+ },
515
+ "docs": {
516
+ "text": "Informa se a lista de a\u00E7\u00F5es est\u00E1 aberta.",
517
+ "tags": []
518
+ }
442
519
  }
443
520
  };
444
521
  }
@@ -158,6 +158,13 @@ input:focus {
158
158
  border-color: var(--ez-text-input__input--focus--border-color);
159
159
  }
160
160
 
161
+ input.focused{
162
+ /*private*/
163
+ border: var(--border--medium, 2px solid);
164
+ /*public*/
165
+ border-color: var(--ez-text-input__input--focus--border-color);
166
+ }
167
+
161
168
  input.icon--left {
162
169
  padding-left: var(--ez-text-input__icon--width);
163
170
  }
@@ -123,7 +123,12 @@ export class EzTextInput {
123
123
  const { selectText } = options || {};
124
124
  if (selectText)
125
125
  this._inputElem.select();
126
- this._inputElem.focus();
126
+ if (this._inputElem.disabled) {
127
+ this._inputElem.classList.add("focused");
128
+ this._inputElem.scrollIntoView({ behavior: "smooth", block: "start" });
129
+ return;
130
+ }
131
+ requestAnimationFrame(() => this._inputElem.focus());
127
132
  }
128
133
  /**
129
134
  * Remove o foco do campo.
@@ -318,6 +323,15 @@ export class EzTextInput {
318
323
  var _a;
319
324
  this._inputElem.setSelectionRange(0, (_a = this._inputElem) === null || _a === void 0 ? void 0 : _a.value.length);
320
325
  });
326
+ this.onClickOutside = (event) => {
327
+ if (!this._inputElem.contains(event.target)) {
328
+ this._inputElem.classList.remove("focused");
329
+ }
330
+ };
331
+ document.addEventListener("click", this.onClickOutside);
332
+ }
333
+ disconnectedCallback() {
334
+ document.removeEventListener("click", this.onClickOutside);
321
335
  }
322
336
  componentDidRender() {
323
337
  this.adjustFloatingLabel();
@@ -8,3 +8,4 @@ export { CustomEditorSource } from './customEditor/interfaces/ICustomEditor';
8
8
  export { CustomRenderSource } from './customRender/interfaces/ICustomRender';
9
9
  export { SearchMode } from './search/types';
10
10
  export { FormLayout } from './form/interfaces';
11
+ export { buildFieldSearch, openFieldSearch, focusOnFieldSerch, SEARCH_FIELD_FULL_WIDTH } from './searchColumn/search-column';
@@ -0,0 +1,35 @@
1
+ import { h } from '@stencil/core';
2
+ export const LABEL_SEARCH_FIELD = "Buscar campos (ctrl+F)";
3
+ export const LABEL_SEARCH_COLUMN = "Buscar colunas (Ctrl+F)";
4
+ export const SHORTCUT_SEARCH_FIELD = "ctrl+f";
5
+ export const SEARCH_FIELD_FULL_WIDTH = 240;
6
+ const SEARCH_FIELD_MARGIN_BOTTOM = "0px";
7
+ const SEARCH_FIELD_WIDTH = String(SEARCH_FIELD_FULL_WIDTH - 30) + "px";
8
+ export const buildFieldSearch = (action, optionLoader, onSelectField) => {
9
+ return h("ez-search", { class: 'ez-padding--small ez-margin--none', style: {
10
+ "--ez-text-input__margin-bottom": SEARCH_FIELD_MARGIN_BOTTOM,
11
+ "--ez-search--width": SEARCH_FIELD_WIDTH
12
+ }, canShowError: 'false', showSelectedValue: 'false', showOptionValue: 'false', suppressEmptyOption: 'true', label: action.label, value: null, optionLoader: optionLoader, onEzChange: (evt) => onSelectField(evt.detail), ignoreLimitCharsToSearch: true });
13
+ };
14
+ export const openFieldSearch = async (splitButton, field) => {
15
+ if (!splitButton) {
16
+ return;
17
+ }
18
+ const isOpen = await splitButton.isOpenedDropdown();
19
+ if (isOpen) {
20
+ await focusOnFieldSerch(field);
21
+ return;
22
+ }
23
+ await splitButton.toggleDropdown();
24
+ };
25
+ export const focusOnFieldSerch = async (field) => {
26
+ requestAnimationFrame(async () => {
27
+ if (field) {
28
+ const realElement = field['$elm$'];
29
+ if (!realElement)
30
+ return;
31
+ realElement.value = null;
32
+ await realElement.setFocus();
33
+ }
34
+ });
35
+ };