@sankhyalabs/ezui 7.1.0-dev.21 → 7.1.0-dev.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ApplicationUtils-4fb87a9e.js → ApplicationUtils-006ca96f.js} +1 -1
- package/dist/cjs/FormLayout-fe8da83c.js +9 -0
- package/dist/cjs/{app-globals-cb31a206.js → app-globals-5cb12916.js} +1 -1
- package/dist/cjs/{ez-combo-box-list_5.cjs.entry.js → classic-search-list_7.cjs.entry.js} +212 -5
- package/dist/cjs/ez-actions-button.cjs.entry.js +4 -3
- package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-avatar.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-combo-box.cjs.entry.js +36 -15
- package/dist/cjs/ez-classic-date-input.cjs.entry.js +201 -0
- package/dist/cjs/ez-classic-date-time-input.cjs.entry.js +246 -0
- package/dist/cjs/ez-classic-input.cjs.entry.js +99 -18
- package/dist/cjs/ez-classic-number-input.cjs.entry.js +205 -0
- package/dist/cjs/ez-classic-search-plus.cjs.entry.js +407 -0
- package/dist/cjs/ez-classic-search.cjs.entry.js +683 -0
- package/dist/cjs/ez-classic-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-time-input.cjs.entry.js +197 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +4 -3
- package/dist/cjs/ez-combo-box.cjs.entry.js +4 -3
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-double-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +121 -35
- package/dist/cjs/ez-form.cjs.entry.js +11 -7
- package/dist/cjs/ez-grid.cjs.entry.js +7 -6
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-link-builder_6.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-pagination.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-search-plus.cjs.entry.js +7 -6
- package/dist/cjs/ez-search-result-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +10 -9
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ez-sortable-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-spinner.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +13 -14
- package/dist/cjs/ez-split-item.cjs.entry.js +4 -3
- package/dist/cjs/ez-text-input.cjs.entry.js +37 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-tree.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +2 -2
- package/dist/cjs/ezui.cjs.js +3 -3
- package/dist/cjs/filter-column.cjs.entry.js +1 -1
- package/dist/cjs/{index-e61642ff.js → index-350d0fa0.js} +30 -0
- package/dist/cjs/index-a7b0c73d.js +42 -18
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{search-column-51e50b59.js → search-column-fbf680d7.js} +10 -5
- package/dist/cjs/searchFormatters-051f8677.js +23 -0
- package/dist/cjs/{FormLayout-18853e70.js → types-6a5df0c7.js} +0 -6
- package/dist/collection/collection-manifest.json +58 -5
- package/dist/collection/components/ez-classic-combo-box/ez-classic-combo-box.css +5 -0
- package/dist/collection/components/ez-classic-combo-box/ez-classic-combo-box.js +77 -18
- package/dist/collection/components/ez-classic-date-input/ez-classic-date-input.css +44 -0
- package/dist/collection/components/ez-classic-date-input/ez-classic-date-input.js +541 -0
- package/dist/collection/components/ez-classic-date-time-input/ez-classic-date-time-input.css +44 -0
- package/dist/collection/components/ez-classic-date-time-input/ez-classic-date-time-input.js +586 -0
- package/dist/collection/components/ez-classic-input/ez-classic-input.css +33 -5
- package/dist/collection/components/ez-classic-input/ez-classic-input.js +155 -19
- package/dist/collection/components/ez-classic-number-input/ez-classic-number-input.css +16 -0
- package/dist/collection/components/ez-classic-number-input/ez-classic-number-input.js +583 -0
- package/dist/collection/components/ez-classic-search/ez-classic-search.css +126 -0
- package/dist/collection/components/ez-classic-search/ez-classic-search.js +1330 -0
- package/dist/collection/components/ez-classic-search/subcomponent/classic-search-list/classic-search-list.css +227 -0
- package/dist/collection/components/ez-classic-search/subcomponent/classic-search-list/classic-search-list.js +316 -0
- package/dist/collection/components/ez-classic-search/utils/searchFormatters.js +18 -0
- package/dist/collection/components/ez-classic-search-plus/ez-classic-search-plus.css +406 -0
- package/dist/collection/components/ez-classic-search-plus/ez-classic-search-plus.js +988 -0
- package/dist/collection/components/ez-classic-search-plus/subcomponent/ez-search-result-list/ez-classic-search-result-list.css +221 -0
- package/dist/collection/components/ez-classic-search-plus/subcomponent/ez-search-result-list/ez-classic-search-result-list.js +298 -0
- package/dist/collection/components/ez-classic-text-area/ez-classic-text-area.css +1 -0
- package/dist/collection/components/ez-classic-time-input/ez-classic-time-input.css +14 -0
- package/dist/collection/components/ez-classic-time-input/ez-classic-time-input.js +511 -0
- package/dist/collection/components/ez-form/ez-form.js +9 -5
- package/dist/collection/components/ez-form-view/ez-form-view.css +8 -3
- package/dist/collection/components/ez-form-view/ez-form-view.js +40 -4
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +6 -3
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +9 -6
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +8 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +30 -6
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +12 -5
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/RichText.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +9 -3
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInputPlus.tpl.js +8 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.js +7 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +8 -1
- package/dist/collection/components/ez-form-view/structure/index.js +1 -1
- package/dist/collection/components/ez-icon/ez-icon.css +1 -0
- package/dist/collection/components/ez-rich-text/ez-rich-text.js +2 -3
- package/dist/collection/components/ez-split-button/ez-split-button.js +18 -13
- package/dist/collection/components/ez-text-input/ez-text-input.js +38 -1
- package/dist/collection/utils/form/DataBinder.js +2 -2
- package/dist/collection/utils/form/interfaces/FormLayout.js +3 -1
- package/dist/collection/utils/i18n/locales/en-us.js +10 -0
- package/dist/collection/utils/i18n/locales/es-es.js +10 -0
- package/dist/collection/utils/i18n/locales/pt-br.js +10 -0
- package/dist/collection/utils/searchColumn/search-column.js +6 -1
- package/dist/custom-elements/index.d.ts +48 -0
- package/dist/custom-elements/index.js +2722 -337
- package/dist/esm/{ApplicationUtils-985c24ae.js → ApplicationUtils-0c5cb207.js} +1 -1
- package/dist/esm/FormLayout-bda67973.js +9 -0
- package/dist/esm/{app-globals-75f8a758.js → app-globals-1db10325.js} +1 -1
- package/dist/esm/{ez-combo-box-list_5.entry.js → classic-search-list_7.entry.js} +212 -7
- package/dist/esm/ez-actions-button.entry.js +4 -3
- package/dist/esm/ez-alert-list.entry.js +1 -1
- package/dist/esm/ez-avatar.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-classic-combo-box.entry.js +36 -15
- package/dist/esm/ez-classic-date-input.entry.js +197 -0
- package/dist/esm/ez-classic-date-time-input.entry.js +242 -0
- package/dist/esm/ez-classic-input.entry.js +100 -19
- package/dist/esm/ez-classic-number-input.entry.js +201 -0
- package/dist/esm/ez-classic-search-plus.entry.js +403 -0
- package/dist/esm/ez-classic-search.entry.js +679 -0
- package/dist/esm/ez-classic-text-area.entry.js +1 -1
- package/dist/esm/ez-classic-time-input.entry.js +193 -0
- package/dist/esm/ez-collapsible-box.entry.js +4 -3
- package/dist/esm/ez-combo-box.entry.js +4 -3
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-double-list.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +121 -35
- package/dist/esm/ez-form.entry.js +11 -7
- package/dist/esm/ez-grid.entry.js +5 -4
- package/dist/esm/ez-guide-navigator.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-link-builder_6.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-pagination.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-search-plus.entry.js +4 -3
- package/dist/esm/ez-search-result-list.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +4 -3
- package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
- package/dist/esm/ez-skeleton.entry.js +1 -1
- package/dist/esm/ez-sortable-list.entry.js +1 -1
- package/dist/esm/ez-spinner.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +13 -14
- package/dist/esm/ez-split-item.entry.js +4 -3
- package/dist/esm/ez-text-input.entry.js +37 -0
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-tree.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +2 -2
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/filter-column.entry.js +1 -1
- package/dist/esm/{index-a3b24b5d.js → index-225aa0c3.js} +30 -0
- package/dist/esm/index-baa5e267.js +42 -18
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{search-column-0c42248b.js → search-column-40a78cac.js} +10 -5
- package/dist/esm/searchFormatters-6d9b06e4.js +20 -0
- package/dist/esm/{FormLayout-071d324c.js → types-6f6b2650.js} +1 -7
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-1c3f43e8.entry.js → p-0248846f.entry.js} +1 -1
- package/dist/ezui/p-0625743b.entry.js +1 -0
- package/dist/ezui/p-07fb22c3.entry.js +1 -0
- package/dist/ezui/p-26cd4c2e.entry.js +1 -0
- package/dist/ezui/{p-2fd16ff2.entry.js → p-2da9faf1.entry.js} +1 -1
- package/dist/ezui/{p-1bf40959.entry.js → p-34d459e4.entry.js} +1 -1
- package/dist/ezui/p-44183c39.entry.js +1 -0
- package/dist/ezui/p-47e4a8ce.js +1 -0
- package/dist/ezui/p-4af745e1.entry.js +1 -0
- package/dist/ezui/{p-6c484770.entry.js → p-4c2a4435.entry.js} +1 -1
- package/dist/ezui/{p-782fe2e3.entry.js → p-4c76b365.entry.js} +1 -1
- package/dist/ezui/p-4e576bb9.entry.js +1 -0
- package/dist/ezui/{p-5e6de2c1.entry.js → p-4e869617.entry.js} +1 -1
- package/dist/ezui/{p-0e325699.entry.js → p-4f7ad3ee.entry.js} +1 -1
- package/dist/ezui/{p-582c3f90.entry.js → p-544605c4.entry.js} +1 -1
- package/dist/ezui/p-556bf329.entry.js +1 -0
- package/dist/ezui/{p-2676e2a3.entry.js → p-56565777.entry.js} +1 -1
- package/dist/ezui/p-57b68d43.entry.js +1 -0
- package/dist/ezui/p-5895e687.js +1 -0
- package/dist/ezui/{p-714452c7.entry.js → p-5abb220b.entry.js} +1 -1
- package/dist/ezui/p-619225ce.entry.js +1 -0
- package/dist/ezui/p-679a2942.entry.js +1 -0
- package/dist/ezui/{p-474076b3.js → p-6a794336.js} +1 -1
- package/dist/ezui/{p-4ea5c8a7.entry.js → p-6ac056d7.entry.js} +1 -1
- package/dist/ezui/p-7134726a.entry.js +1 -0
- package/dist/ezui/{p-67f9fadb.entry.js → p-729bd1be.entry.js} +1 -1
- package/dist/ezui/p-7953ecb9.entry.js +1 -0
- package/dist/ezui/{p-e2e0dd76.entry.js → p-7edc3ef7.entry.js} +1 -1
- package/dist/ezui/p-88a115b3.js +1 -0
- package/dist/ezui/{p-f45ddc1f.entry.js → p-8e5f1c74.entry.js} +1 -1
- package/dist/ezui/p-951b32a1.entry.js +1 -0
- package/dist/ezui/{p-9568a93d.entry.js → p-97312709.entry.js} +1 -1
- package/dist/ezui/{p-0ec5c128.js → p-9825c1d2.js} +1 -1
- package/dist/ezui/p-987185c4.entry.js +1 -0
- package/dist/ezui/p-a0f51b99.entry.js +1 -0
- package/dist/ezui/p-a3bad8f8.entry.js +1 -0
- package/dist/ezui/{p-6570ca10.entry.js → p-a4351519.entry.js} +1 -1
- package/dist/ezui/{p-7624767b.entry.js → p-a872c642.entry.js} +1 -1
- package/dist/ezui/p-b0a716ef.entry.js +1 -0
- package/dist/ezui/p-b36475f9.entry.js +1 -0
- package/dist/ezui/{p-2b23906a.entry.js → p-b705b342.entry.js} +1 -1
- package/dist/ezui/{p-9771ea3c.entry.js → p-b8078832.entry.js} +1 -1
- package/dist/ezui/p-c0ae79fa.entry.js +1 -0
- package/dist/ezui/{p-98218fbc.js → p-c178730b.js} +1 -1
- package/dist/ezui/{p-a1a63294.entry.js → p-c56ee8c0.entry.js} +1 -1
- package/dist/ezui/{p-3d71e8e1.entry.js → p-cd8be0c7.entry.js} +1 -1
- package/dist/ezui/{p-a13e65a4.entry.js → p-ce0a0036.entry.js} +1 -1
- package/dist/ezui/{p-0aafbc30.entry.js → p-df802548.entry.js} +1 -1
- package/dist/ezui/p-e2689b33.entry.js +1 -0
- package/dist/ezui/{p-dc192d01.entry.js → p-e2972977.entry.js} +1 -1
- package/dist/ezui/{p-47d9256e.entry.js → p-e3a42f47.entry.js} +1 -1
- package/dist/ezui/p-e3cd5080.entry.js +1 -0
- package/dist/ezui/{p-28af6826.entry.js → p-e493ad57.entry.js} +1 -1
- package/dist/ezui/{p-3fcf79c7.entry.js → p-f5552540.entry.js} +1 -1
- package/dist/ezui/p-ff4312d5.js +1 -0
- package/dist/types/components/ez-classic-combo-box/ez-classic-combo-box.d.ts +9 -3
- package/dist/types/components/ez-classic-date-input/ez-classic-date-input.d.ts +91 -0
- package/dist/types/components/ez-classic-date-time-input/ez-classic-date-time-input.d.ts +95 -0
- package/dist/types/components/ez-classic-input/ez-classic-input.d.ts +18 -1
- package/dist/types/components/ez-classic-number-input/ez-classic-number-input.d.ts +101 -0
- package/dist/types/components/ez-classic-search/ez-classic-search.d.ts +219 -0
- package/dist/types/components/ez-classic-search/subcomponent/classic-search-list/classic-search-list.d.ts +29 -0
- package/dist/types/components/ez-classic-search/utils/searchFormatters.d.ts +2 -0
- package/dist/types/components/ez-classic-search-plus/ez-classic-search-plus.d.ts +186 -0
- package/dist/types/components/ez-classic-search-plus/subcomponent/ez-search-result-list/ez-classic-search-result-list.d.ts +29 -0
- package/dist/types/components/ez-form/ez-form.d.ts +1 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +7 -0
- package/dist/types/components/ez-form-view/fieldbuilder/FieldBuilder.d.ts +7 -2
- package/dist/types/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.d.ts +3 -2
- package/dist/types/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.d.ts +2 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.d.ts +5 -4
- package/dist/types/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.d.ts +2 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.d.ts +3 -2
- package/dist/types/components/ez-form-view/fieldbuilder/templates/RichText.tpl.d.ts +2 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +2 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInputPlus.tpl.d.ts +2 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.d.ts +2 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +2 -1
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +1 -2
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
- package/dist/types/components.d.ts +2967 -1814
- package/dist/types/utils/form/interfaces/FormLayout.d.ts +3 -1
- package/dist/types/utils/i18n/locales/en-us.d.ts +10 -0
- package/dist/types/utils/i18n/locales/es-es.d.ts +10 -0
- package/dist/types/utils/i18n/locales/pt-br.d.ts +10 -0
- package/dist/types/utils/i18n/translations.d.ts +30 -0
- package/package.json +1 -1
- package/react/components.d.ts +8 -0
- package/react/components.js +8 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-2e5de2a7.entry.js +0 -1
- package/dist/ezui/p-30ffb9ed.js +0 -1
- package/dist/ezui/p-48effc69.entry.js +0 -1
- package/dist/ezui/p-6a982147.js +0 -1
- package/dist/ezui/p-6d7f2fdc.entry.js +0 -1
- package/dist/ezui/p-6f466aec.entry.js +0 -1
- package/dist/ezui/p-7fe97ef5.entry.js +0 -1
- package/dist/ezui/p-8709c4f6.entry.js +0 -1
- package/dist/ezui/p-8a8006e6.entry.js +0 -1
- package/dist/ezui/p-8d626d2b.entry.js +0 -1
- package/dist/ezui/p-9b2e6438.entry.js +0 -1
- package/dist/ezui/p-9d004e22.entry.js +0 -1
- package/dist/ezui/p-c711900a.entry.js +0 -1
- package/dist/ezui/p-dee18824.entry.js +0 -1
- package/dist/ezui/p-e4a579f2.entry.js +0 -1
- package/dist/ezui/p-e82a12c6.entry.js +0 -1
- package/dist/ezui/p-f1bbf23f.entry.js +0 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-baa5e267.js';
|
|
2
|
+
import { NumberUtils, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { C as CSSVarsUtils } from './CSSVarsUtils-acba92d7.js';
|
|
4
|
+
import { i as initI18n } from './index-225aa0c3.js';
|
|
5
|
+
|
|
6
|
+
const ezClassicNumberInputCss = ":host{--ez-classic-number-input__min-width:0px;--ez-classic-number-input__max-width:100%;display:block;width:100%}.number__input{height:100%;min-width:var(--ez-classic-number-input__min-width);max-width:var(--ez-classic-number-input__max-width)}";
|
|
7
|
+
|
|
8
|
+
const EzClassicNumberInput = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.ezChange = createEvent(this, "ezChange", 7);
|
|
12
|
+
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
13
|
+
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
14
|
+
this._focused = false;
|
|
15
|
+
this._changePending = false;
|
|
16
|
+
this._valuePromiseCallbacks = [];
|
|
17
|
+
this._value = undefined;
|
|
18
|
+
this.label = undefined;
|
|
19
|
+
this.value = undefined;
|
|
20
|
+
this.enabled = true;
|
|
21
|
+
this.required = false;
|
|
22
|
+
this.canShowError = true;
|
|
23
|
+
this.errorMessage = undefined;
|
|
24
|
+
this.allowNegative = true;
|
|
25
|
+
this.precision = undefined;
|
|
26
|
+
this.prettyPrecision = undefined;
|
|
27
|
+
this.mode = "regular";
|
|
28
|
+
this.size = "default";
|
|
29
|
+
this.autoFocus = false;
|
|
30
|
+
this.alternativePlaceholder = undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Aplica o foco no campo.
|
|
34
|
+
*/
|
|
35
|
+
async setFocus(options) {
|
|
36
|
+
this._textInput.setFocus(options);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Remove o foco do campo.
|
|
40
|
+
*/
|
|
41
|
+
async setBlur() {
|
|
42
|
+
this._textInput.setBlur();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Retorna se o conteúdo é inválido.
|
|
46
|
+
*/
|
|
47
|
+
async isInvalid() {
|
|
48
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
49
|
+
}
|
|
50
|
+
/*
|
|
51
|
+
* Retorna uma promise com o valor da opção selecionada,
|
|
52
|
+
* que será resolvida quando o backend devolver este dado.
|
|
53
|
+
*/
|
|
54
|
+
async getValueAsync() {
|
|
55
|
+
if (this._changePending) {
|
|
56
|
+
return new Promise(accept => {
|
|
57
|
+
this._valuePromiseCallbacks.push(accept);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return Promise.resolve(this.value);
|
|
61
|
+
}
|
|
62
|
+
observeLabel() {
|
|
63
|
+
if (this._textInput) {
|
|
64
|
+
this._textInput.label = this.label;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
observeErrorMessage() {
|
|
68
|
+
var _a;
|
|
69
|
+
if (this._textInput) {
|
|
70
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
71
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
72
|
+
this.setInputValue();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
observeValue(newValue, oldValue) {
|
|
77
|
+
if (this._textInput && newValue != oldValue) {
|
|
78
|
+
this.handleNewValue(newValue, oldValue);
|
|
79
|
+
}
|
|
80
|
+
this._changePending = false;
|
|
81
|
+
}
|
|
82
|
+
observePrecision() {
|
|
83
|
+
if (this._textInput) {
|
|
84
|
+
this.setInputValue();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
handleNewValue(newValue, oldValue) {
|
|
88
|
+
const newValueValidated = this.validateValue(newValue);
|
|
89
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
90
|
+
if (newValueValidated === null) {
|
|
91
|
+
this._value = '';
|
|
92
|
+
}
|
|
93
|
+
if (newValueValidated === oldValueValidated) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
97
|
+
const parsedNumber = this.getParsedNumber(textValue);
|
|
98
|
+
if ((this._value || '') !== textValue && (parsedNumber !== undefined || !this._focused)) {
|
|
99
|
+
this._value = textValue;
|
|
100
|
+
this._focused = false;
|
|
101
|
+
this.errorMessage = "";
|
|
102
|
+
}
|
|
103
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
104
|
+
this.ezChange.emit(valueEmitted);
|
|
105
|
+
}
|
|
106
|
+
validateValue(value) {
|
|
107
|
+
return isNaN(value) || value === undefined ? null : value;
|
|
108
|
+
}
|
|
109
|
+
getTextValue(value) {
|
|
110
|
+
if (value == undefined)
|
|
111
|
+
return undefined;
|
|
112
|
+
let textValue = this.precision >= 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
113
|
+
return (this.precision === 0) ? StringUtils.replaceAll(textValue, ".", "") : textValue;
|
|
114
|
+
}
|
|
115
|
+
changeValue(newValue) {
|
|
116
|
+
this.errorMessage = "";
|
|
117
|
+
if (this.value != newValue) {
|
|
118
|
+
this.value = newValue === undefined ? null : newValue;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.setInputValue();
|
|
122
|
+
this.ezCancelWaitingChange.emit();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
setError(msg) {
|
|
126
|
+
this.value = null;
|
|
127
|
+
this.errorMessage = msg;
|
|
128
|
+
this.ezCancelWaitingChange.emit();
|
|
129
|
+
}
|
|
130
|
+
handleBlur() {
|
|
131
|
+
if (!this._changePending) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const parsedNumber = this.getParsedNumber();
|
|
136
|
+
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
137
|
+
this.setError(this.i18n("ez-classic-number-input.invalidNumber"));
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
try {
|
|
141
|
+
this.changeValue(parsedNumber);
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
this.setError(e.message);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
for (const callback of this._valuePromiseCallbacks) {
|
|
151
|
+
callback(this.value);
|
|
152
|
+
}
|
|
153
|
+
this._valuePromiseCallbacks = [];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
handleInput() {
|
|
157
|
+
const parsedNumber = this.getParsedNumber();
|
|
158
|
+
if (parsedNumber !== this.value) {
|
|
159
|
+
this._focused = true;
|
|
160
|
+
this._changePending = true;
|
|
161
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
getParsedNumber(value = this._textInput.value) {
|
|
165
|
+
return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils.stringToNumber(value) : undefined;
|
|
166
|
+
}
|
|
167
|
+
setInputValue() {
|
|
168
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
169
|
+
if ((this._value || '') !== textValue) {
|
|
170
|
+
this._value = textValue;
|
|
171
|
+
this._textInput.value = this._value;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
async componentWillLoad() {
|
|
175
|
+
this.i18n = await initI18n();
|
|
176
|
+
}
|
|
177
|
+
componentDidLoad() {
|
|
178
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
179
|
+
this.setInputValue();
|
|
180
|
+
if (this.autoFocus) {
|
|
181
|
+
requestAnimationFrame(() => {
|
|
182
|
+
this.setFocus({ selectText: true });
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
render() {
|
|
187
|
+
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
188
|
+
return (h("ez-classic-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: (elem) => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), enabled: this.enabled, errorMessage: this.errorMessage, size: this.size, value: this._value, required: this.required, onEzChange: (event) => event.stopPropagation() }));
|
|
189
|
+
}
|
|
190
|
+
get _elem() { return getElement(this); }
|
|
191
|
+
static get watchers() { return {
|
|
192
|
+
"label": ["observeLabel"],
|
|
193
|
+
"errorMessage": ["observeErrorMessage"],
|
|
194
|
+
"value": ["observeValue"],
|
|
195
|
+
"precision": ["observePrecision"],
|
|
196
|
+
"prettyPrecision": ["observePrecision"]
|
|
197
|
+
}; }
|
|
198
|
+
};
|
|
199
|
+
EzClassicNumberInput.style = ezClassicNumberInputCss;
|
|
200
|
+
|
|
201
|
+
export { EzClassicNumberInput as ez_classic_number_input };
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
|
|
2
|
+
import { StringUtils, KeyboardManager, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import './ApplicationUtils-0c5cb207.js';
|
|
4
|
+
import { C as CSSVarsUtils } from './CSSVarsUtils-acba92d7.js';
|
|
5
|
+
import './DialogType-54a62731.js';
|
|
6
|
+
import './CheckMode-bdb2ec19.js';
|
|
7
|
+
import { i as initI18n } from './index-225aa0c3.js';
|
|
8
|
+
import { S as SearchMode } from './types-6f6b2650.js';
|
|
9
|
+
import './FormLayout-bda67973.js';
|
|
10
|
+
|
|
11
|
+
const ezClassicSearchPlusCss = ":host{--ez-classic-search--height:42px;--ez-classic-search--width:100%;--ez-classic-search__icon--width:48px;--ez-classic-search--border-radius:var(--border--radius-medium, 12px);--ez-classic-search--border-radius-small:var(--border--radius-small, 6px);--ez-classic-search--font-size:var(--text--medium, 14px);--ez-classic-search--font-family:var(--font-pattern, Arial);--ez-classic-search--font-weight--large:var(--text-weight--large, 500);--ez-classic-search--font-weight--medium:var(--text-weight--medium, 400);--ez-classic-search--background-color--xlight:var(--background--xlight, #fff);--ez-classic-search--background-medium:var(--background--medium, #f0f3f7);--ez-classic-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-classic-search__input--background-color:var(--background--medium, #e0e0e0);--ez-classic-search__input--border:var(--border--medium, 2px solid);--ez-classic-search__input--border-color:var(--ez-classic-search__input--background-color);--ez-classic-search__input--focus--border-color:var(--color--primary, #008561);--ez-classic-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-classic-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-classic-search__input--error--border-color:#CC2936;--ez-classic-search__btn--color:var(--title--primary, #2B3A54);--ez-classic-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-classic-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-classic-search__label--color:var(--title--primary, #2B3A54);--ez-classic-search__list-title--primary:var(--title--primary, #2B3A54);--ez-classic-search__list-text--primary:var(--text--primary, #626e82);--ez-classic-search__list-height:calc(var(--ez-classic-search--font-size) + var(--ez-classic-search--space--medium) + 4px);--ez-classic-search__list-min-width:64px;--ez-classic-search--space--medium:var(--space--medium, 12px);--ez-classic-search--space--small:var(--space--small, 6px);--ez-classic-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-classic-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-classic-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-classic-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-classic-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-classic-search__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-classic-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-classic-input__input--border-color:var(--color--strokes, #dce0e8);--ez-classic-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-classic-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-classic-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-classic-search--background-color--xlight);border-radius:var(--ez-classic-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.list-options{margin-top:0px;box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-classic-search__scrollbar--color-clicked) var(--ez-classic-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-classic-search__scrollbar--color-background);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-classic-search__scrollbar--color-default);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-classic-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-classic-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-classic-search--border-radius-small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size);line-height:var(--ez-classic-search--line-height)}.item__label{font-weight:var(--ez-classic-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-classic-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-classic-search__list-text--primary);font-weight:var(--ez-classic-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-classic-search__list-height)}.message__no-result{color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-classic-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-classic-search--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-classic-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-classic-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-classic-search__btn-disabled--color)}.btn:hover{color:var(--ez-classic-search__btn-hover--color)}.btn__close{visibility:hidden}ez-classic-input:hover .btn__close,ez-c-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}.ez-classic-search-plus__container{display:flex;flex-grow:1;gap:3px}.ez-classic-search-plus__wrapper{display:flex;flex-direction:column;flex-grow:1;overflow:hidden}.ez-classic-search-plus__label-container{display:flex;flex-grow:1;gap:3px;overflow:hidden}.ez-classic-search-plus__label-container label{overflow:hidden;text-overflow:ellipsis;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);white-space:nowrap}.ez-classic-search-plus__text-input{--ez-classic-input--border-top-left-radius:0px;--ez-classic-input--border-bottom-left-radius:0px;outline:none}.ez-classic-search-plus__code-input-no-border{--ez-classic-input--border-top-right-radius:0px;--ez-classic-input--border-bottom-right-radius:0px}.ez-classic-search-plus__code-input{max-width:85px;--ez-classic-input--padding-inline:6px;--ez-classic-input--gap:6px}.ez-classic-search-plus__code-input-full{width:100%}.description-input-container{width:100%;outline:none}.required-indicator{font-size:var(--font--size--default, 14px);font-family:var(--font--pattern, 'Roboto');color:var(--color--red-600, #BD0025);margin-left:var(--space--4, 4px);vertical-align:top}";
|
|
12
|
+
|
|
13
|
+
const EzClassicSearchPlus = class {
|
|
14
|
+
constructor(hostRef) {
|
|
15
|
+
registerInstance(this, hostRef);
|
|
16
|
+
this.ezChange = createEvent(this, "ezChange", 7);
|
|
17
|
+
this.SEARCH_DESCRIPTION_TIMEOUT = 2000;
|
|
18
|
+
this.INTERVAL_TO_RETRY_ASYNC_VALUE = 100;
|
|
19
|
+
this._ignoreNextValue = false;
|
|
20
|
+
this.value = undefined;
|
|
21
|
+
this.enabled = true;
|
|
22
|
+
this.disableCodeInput = false;
|
|
23
|
+
this.disableDescriptionInput = false;
|
|
24
|
+
this.label = undefined;
|
|
25
|
+
this.hideDescriptionInput = false;
|
|
26
|
+
this.canShowError = true;
|
|
27
|
+
this.errorMessage = undefined;
|
|
28
|
+
this.mode = "regular";
|
|
29
|
+
this.size = "default";
|
|
30
|
+
this.required = false;
|
|
31
|
+
this.contextProperties = undefined;
|
|
32
|
+
this.optionLoader = undefined;
|
|
33
|
+
this.showOptionValue = true;
|
|
34
|
+
this.stopPropagateEnterKeyEvent = false;
|
|
35
|
+
this.autoFocus = false;
|
|
36
|
+
this.showSelectedValue = true;
|
|
37
|
+
this.suppressEmptyOption = false;
|
|
38
|
+
this.hideErrorOnFocusOut = true;
|
|
39
|
+
this.listOptionsPosition = undefined;
|
|
40
|
+
this.isTextSearch = false;
|
|
41
|
+
this.ignoreLimitCharsToSearch = false;
|
|
42
|
+
this.suppressSearch = false;
|
|
43
|
+
this.suppressPreLoad = true;
|
|
44
|
+
this.ensureClearButtonVisible = false;
|
|
45
|
+
this.descriptionValue = "";
|
|
46
|
+
this.codeValue = "";
|
|
47
|
+
this.isLoadingDescription = false;
|
|
48
|
+
this.searchDescriptionIsOpen = false;
|
|
49
|
+
this.visibleOptions = undefined;
|
|
50
|
+
this.showLoading = true;
|
|
51
|
+
}
|
|
52
|
+
async observeValue(newValue, oldValue) {
|
|
53
|
+
var _a;
|
|
54
|
+
if (this._ignoreNextValue) {
|
|
55
|
+
this._ignoreNextValue = false;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const newNormalizedValue = this.normalizeValueToCodeValue(newValue);
|
|
59
|
+
const oldNormalizedValue = this.normalizeValueToCodeValue(oldValue);
|
|
60
|
+
if (newNormalizedValue === oldNormalizedValue) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (newNormalizedValue === undefined) {
|
|
64
|
+
this.codeValue = undefined;
|
|
65
|
+
this.descriptionValue = undefined;
|
|
66
|
+
this.ezChange.emit(undefined);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.codeValue = newNormalizedValue;
|
|
70
|
+
try {
|
|
71
|
+
this.descriptionValue = await this.normalizeCodeToDescriptionValue(newValue);
|
|
72
|
+
if (this.descriptionValue === null || this.descriptionValue === undefined) {
|
|
73
|
+
throw new Error("Valor não encontrado!");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
this._ignoreNextValue = true;
|
|
78
|
+
this.clearSearch();
|
|
79
|
+
console.warn("[EzSearchPlus] Erro ao obter descrição do registro.", err);
|
|
80
|
+
if (((_a = err === null || err === void 0 ? void 0 : err.constructor) === null || _a === void 0 ? void 0 : _a.name) === "WarningException") {
|
|
81
|
+
this.errorMessage = err.message;
|
|
82
|
+
}
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
85
|
+
this.value = this.buildCurrentValue();
|
|
86
|
+
this.ezChange.emit(this.value);
|
|
87
|
+
this.errorMessage = null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Aplica o foco no campo.
|
|
91
|
+
*/
|
|
92
|
+
async setFocus(options) {
|
|
93
|
+
var _a;
|
|
94
|
+
if (this.disableCodeInput) {
|
|
95
|
+
(_a = this._textInputDescriptionValue) === null || _a === void 0 ? void 0 : _a.setFocus(options);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (this._latestFocusedInputElement) {
|
|
99
|
+
this._latestFocusedInputElement.setFocus(options);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this._textInputCodeValue.setFocus(options);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Obtém o valor do componente só após a compo de apresentação
|
|
106
|
+
* ter sido resolvido pelo option loader quando necessário
|
|
107
|
+
*/
|
|
108
|
+
async getValueAsync() {
|
|
109
|
+
if (!this.isLoadingDescription) {
|
|
110
|
+
const currentOpt = this.buildCurrentValue();
|
|
111
|
+
return new Promise(resolve => resolve(currentOpt));
|
|
112
|
+
}
|
|
113
|
+
return new Promise(resolve => {
|
|
114
|
+
let id = setInterval(() => {
|
|
115
|
+
if (!this.isLoadingDescription) {
|
|
116
|
+
clearInterval(id);
|
|
117
|
+
const currentOpt = this.buildCurrentValue();
|
|
118
|
+
resolve(currentOpt);
|
|
119
|
+
}
|
|
120
|
+
}, this.INTERVAL_TO_RETRY_ASYNC_VALUE);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Limpa o valor do campo de pesquisa
|
|
125
|
+
*/
|
|
126
|
+
async clearValue() {
|
|
127
|
+
this.clearSearch();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Remove o foco do campo.
|
|
131
|
+
*/
|
|
132
|
+
async setBlur() {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
(_a = this._textInputCodeValue) === null || _a === void 0 ? void 0 : _a.setBlur();
|
|
135
|
+
(_b = this._textInputDescriptionValue) === null || _b === void 0 ? void 0 : _b.setBlur();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Retorna se o conteúdo é inválido.
|
|
139
|
+
*/
|
|
140
|
+
async isInvalid() {
|
|
141
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
142
|
+
}
|
|
143
|
+
async componentWillLoad() {
|
|
144
|
+
this.i18n = await initI18n();
|
|
145
|
+
if (this.value && StringUtils.isEmpty(this.codeValue)) {
|
|
146
|
+
await this.observeValue(this.value, undefined);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
componentDidLoad() {
|
|
150
|
+
CSSVarsUtils.applyVarsTextInput(this.el, this._textInputCodeValue);
|
|
151
|
+
CSSVarsUtils.applyVarsTextInput(this.el, this._textInputDescriptionValue);
|
|
152
|
+
}
|
|
153
|
+
connectedCallback() {
|
|
154
|
+
this.initKeyboardManager();
|
|
155
|
+
if (this.autoFocus) {
|
|
156
|
+
requestAnimationFrame(() => {
|
|
157
|
+
this.setFocus({ selectText: true });
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
clearSearch() {
|
|
162
|
+
this.value = null;
|
|
163
|
+
this.codeValue = null;
|
|
164
|
+
this.descriptionValue = null;
|
|
165
|
+
if (!this.hideDescriptionInput) {
|
|
166
|
+
this._textInputDescriptionValue.value = null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async normalizeCodeToDescriptionValue(valueToNormalize) {
|
|
170
|
+
if (!valueToNormalize) {
|
|
171
|
+
return "";
|
|
172
|
+
}
|
|
173
|
+
if (typeof valueToNormalize == 'string') {
|
|
174
|
+
try {
|
|
175
|
+
valueToNormalize = JSON.parse(valueToNormalize);
|
|
176
|
+
if ((valueToNormalize === null || valueToNormalize === void 0 ? void 0 : valueToNormalize.value) && !(valueToNormalize === null || valueToNormalize === void 0 ? void 0 : valueToNormalize.label)) {
|
|
177
|
+
return await this.loadDescriptionValueByCode(valueToNormalize === null || valueToNormalize === void 0 ? void 0 : valueToNormalize.value);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (e) {
|
|
181
|
+
return await this.loadDescriptionValueByCode(valueToNormalize);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//Se é diferente de objeto, temos que resolver a descrição
|
|
185
|
+
if (typeof valueToNormalize != 'object') {
|
|
186
|
+
return await this.loadDescriptionValueByCode(valueToNormalize);
|
|
187
|
+
}
|
|
188
|
+
return valueToNormalize === null || valueToNormalize === void 0 ? void 0 : valueToNormalize.label;
|
|
189
|
+
}
|
|
190
|
+
normalizeValueToCodeValue(valueToNormalize) {
|
|
191
|
+
if (!valueToNormalize) {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
if (typeof valueToNormalize == 'string') {
|
|
195
|
+
try {
|
|
196
|
+
valueToNormalize = JSON.parse(valueToNormalize);
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
return valueToNormalize;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (typeof valueToNormalize != 'object') {
|
|
203
|
+
return typeof valueToNormalize === 'number'
|
|
204
|
+
? String(valueToNormalize)
|
|
205
|
+
: valueToNormalize;
|
|
206
|
+
}
|
|
207
|
+
return valueToNormalize === null || valueToNormalize === void 0 ? void 0 : valueToNormalize.value;
|
|
208
|
+
}
|
|
209
|
+
async loadDescriptionValueByCode(codeValue) {
|
|
210
|
+
if (!this.optionLoader) {
|
|
211
|
+
console.warn(this.i18n("ez-search-plus.optionLoaderNotDefined"));
|
|
212
|
+
return "";
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
this.isLoadingDescription = true;
|
|
216
|
+
const searchArgument = { mode: SearchMode.LOAD_DESCRIPTION, argument: codeValue };
|
|
217
|
+
const loadedOption = await this.optionLoader(searchArgument);
|
|
218
|
+
if (!loadedOption) {
|
|
219
|
+
return "";
|
|
220
|
+
}
|
|
221
|
+
if (Array.isArray(loadedOption)) {
|
|
222
|
+
return loadedOption[0].label;
|
|
223
|
+
}
|
|
224
|
+
return loadedOption.label;
|
|
225
|
+
}
|
|
226
|
+
finally {
|
|
227
|
+
this.isLoadingDescription = false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
handleCodeInputFocusOut() {
|
|
231
|
+
this.cancelSelection();
|
|
232
|
+
if (this.codeValue == this._textInputCodeValue.value)
|
|
233
|
+
return;
|
|
234
|
+
this.value = this._textInputCodeValue.value;
|
|
235
|
+
}
|
|
236
|
+
handleSearchClick() {
|
|
237
|
+
this.loadAdvancedSearch();
|
|
238
|
+
}
|
|
239
|
+
async loadAdvancedSearch() {
|
|
240
|
+
if (!this.optionLoader) {
|
|
241
|
+
console.warn(this.i18n("ez-search-plus.optionLoaderNotDefined"));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const searchArgument = { mode: SearchMode.ADVANCED, argument: "" };
|
|
245
|
+
let selectedItem = undefined;
|
|
246
|
+
try {
|
|
247
|
+
selectedItem = await this.optionLoader(searchArgument, this.contextProperties);
|
|
248
|
+
}
|
|
249
|
+
catch (ignore) { }
|
|
250
|
+
if (!selectedItem)
|
|
251
|
+
return;
|
|
252
|
+
this.value = selectedItem;
|
|
253
|
+
}
|
|
254
|
+
buildCurrentValue() {
|
|
255
|
+
if (StringUtils.isEmpty(this.codeValue)) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
value: this.codeValue,
|
|
260
|
+
label: this.descriptionValue
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
async handleTextInputChangeHandler(event) {
|
|
264
|
+
if (!this.searchDescriptionIsOpen) {
|
|
265
|
+
this._popover.showUnder(this.el);
|
|
266
|
+
}
|
|
267
|
+
const argument = event.target.value;
|
|
268
|
+
await this.debounceLoaderOptions(argument);
|
|
269
|
+
}
|
|
270
|
+
async debounceLoaderOptions(argument) {
|
|
271
|
+
if (this._debounceSearch)
|
|
272
|
+
clearTimeout(this._debounceSearch);
|
|
273
|
+
return new Promise((resolve) => {
|
|
274
|
+
this._debounceSearch = setTimeout(async () => {
|
|
275
|
+
await this.processOptionsLoader(argument);
|
|
276
|
+
resolve();
|
|
277
|
+
}, this.SEARCH_DESCRIPTION_TIMEOUT);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
updateKeyOption(option) {
|
|
281
|
+
return (Object.assign(Object.assign({}, option), { presentationValue: option.value, presentationLabel: option.label }));
|
|
282
|
+
}
|
|
283
|
+
parseSearchOptions(options = []) {
|
|
284
|
+
if (Array.isArray(options)) {
|
|
285
|
+
const firstOption = options[0];
|
|
286
|
+
if (!firstOption) {
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
if ("label" in firstOption || "value" in firstOption) {
|
|
290
|
+
return options.map((option) => this.updateKeyOption(option));
|
|
291
|
+
}
|
|
292
|
+
return options;
|
|
293
|
+
}
|
|
294
|
+
if ("label" in options || "value" in options) {
|
|
295
|
+
[this.updateKeyOption(options)];
|
|
296
|
+
}
|
|
297
|
+
return [options];
|
|
298
|
+
}
|
|
299
|
+
async processOptionsLoader(argument) {
|
|
300
|
+
try {
|
|
301
|
+
this.showLoading = true;
|
|
302
|
+
const searchArgument = { mode: SearchMode.PREDICTIVE, argument };
|
|
303
|
+
const options = await this.optionLoader(searchArgument);
|
|
304
|
+
this.visibleOptions = this.parseSearchOptions(options);
|
|
305
|
+
}
|
|
306
|
+
finally {
|
|
307
|
+
this.showLoading = false;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
handleSelectItem(evt) {
|
|
311
|
+
const currentOpt = evt.detail;
|
|
312
|
+
this.value = currentOpt;
|
|
313
|
+
this._popover.hide();
|
|
314
|
+
window.requestAnimationFrame(() => {
|
|
315
|
+
var _a;
|
|
316
|
+
(_a = this._textInputDescriptionValue) === null || _a === void 0 ? void 0 : _a.setFocus({ selectText: true });
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async handleArrowUp() {
|
|
320
|
+
if (!this.isOptionsVisible()) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
await this._classicSearchList.previousOption();
|
|
324
|
+
}
|
|
325
|
+
async handleArrowDown() {
|
|
326
|
+
if (!this.isOptionsVisible()) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
await this._classicSearchList.nextOption();
|
|
330
|
+
}
|
|
331
|
+
async selectCurrentItem() {
|
|
332
|
+
var _a;
|
|
333
|
+
await ((_a = this._classicSearchList) === null || _a === void 0 ? void 0 : _a.selectCurrentItem());
|
|
334
|
+
}
|
|
335
|
+
async cancelSelection() {
|
|
336
|
+
var _a, _b, _c;
|
|
337
|
+
const description = typeof this.value === 'object' ? (_a = this.value) === null || _a === void 0 ? void 0 : _a.label : "";
|
|
338
|
+
if (this._textInputDescriptionValue && description && this._textInputDescriptionValue.value != description) {
|
|
339
|
+
this._textInputDescriptionValue.value = description;
|
|
340
|
+
}
|
|
341
|
+
await ((_b = this._classicSearchList) === null || _b === void 0 ? void 0 : _b.cancelSelection());
|
|
342
|
+
(_c = this._popover) === null || _c === void 0 ? void 0 : _c.hide();
|
|
343
|
+
}
|
|
344
|
+
async handleInputTab() {
|
|
345
|
+
await this.cancelSelection();
|
|
346
|
+
}
|
|
347
|
+
async handleInputEsc() {
|
|
348
|
+
var _a;
|
|
349
|
+
await this.cancelSelection();
|
|
350
|
+
await ((_a = this._latestFocusedInputElement) === null || _a === void 0 ? void 0 : _a.setFocus({ selectText: true }));
|
|
351
|
+
}
|
|
352
|
+
async initKeyboardManager() {
|
|
353
|
+
this._keyboardManager = new KeyboardManager();
|
|
354
|
+
const defaultOpts = { element: this.el, propagate: true };
|
|
355
|
+
this._keyboardManager
|
|
356
|
+
.bind("ArrowUp", () => this.handleArrowUp(), Object.assign(Object.assign({}, defaultOpts), { propagate: false }))
|
|
357
|
+
.bind("ArrowDown", () => this.handleArrowDown(), Object.assign(Object.assign({}, defaultOpts), { propagate: false }))
|
|
358
|
+
.bind("Enter", () => this.selectCurrentItem(), Object.assign(Object.assign({}, defaultOpts), { propagate: !this.stopPropagateEnterKeyEvent }))
|
|
359
|
+
.bind("Tab", () => this.handleInputTab(), defaultOpts)
|
|
360
|
+
.bind("Escape", () => this.handleInputEsc(), defaultOpts);
|
|
361
|
+
}
|
|
362
|
+
disconnectedCallback() {
|
|
363
|
+
this._keyboardManager
|
|
364
|
+
.unbind("ArrowUp")
|
|
365
|
+
.unbind("ArrowDown")
|
|
366
|
+
.unbind("Enter")
|
|
367
|
+
.unbind("Tab")
|
|
368
|
+
.unbind("Escape");
|
|
369
|
+
}
|
|
370
|
+
isOptionsVisible() {
|
|
371
|
+
return this._popover.opened;
|
|
372
|
+
}
|
|
373
|
+
setLatestFocusedInputElement(el) {
|
|
374
|
+
this._latestFocusedInputElement = el;
|
|
375
|
+
}
|
|
376
|
+
handleCodeInputFocus() {
|
|
377
|
+
this.setLatestFocusedInputElement(this._textInputCodeValue);
|
|
378
|
+
}
|
|
379
|
+
handleDescriptionInputFocus() {
|
|
380
|
+
this.setLatestFocusedInputElement(this._textInputDescriptionValue);
|
|
381
|
+
}
|
|
382
|
+
handleOnEzVisibilityChange(event) {
|
|
383
|
+
event.stopPropagation();
|
|
384
|
+
this.searchDescriptionIsOpen = event.detail;
|
|
385
|
+
}
|
|
386
|
+
render() {
|
|
387
|
+
var _a, _b;
|
|
388
|
+
ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
|
|
389
|
+
const canShowClearButton = !this.ensureClearButtonVisible && (!this.value && !((_a = this._textInputCodeValue) === null || _a === void 0 ? void 0 : _a.value) && !((_b = this._textInputDescriptionValue) === null || _b === void 0 ? void 0 : _b.value));
|
|
390
|
+
return (h(Host, null, h("div", { class: "ez-classic-search-plus__wrapper" }, h("div", { class: "ez-classic-search-plus__label-container" }, h("label", { title: this.label }, this.label), this.required && h("span", { class: "required-indicator" }, "*")), h("div", { class: "ez-classic-search-plus__container" }, h("ez-classic-input", { ref: (elem) => this._textInputCodeValue = elem, class: {
|
|
391
|
+
"ez-classic-search-plus__code-input": !this.hideDescriptionInput,
|
|
392
|
+
"ez-classic-search-plus__code-input-no-border": !this.hideDescriptionInput,
|
|
393
|
+
"ez-classic-search-plus__code-input-full": this.hideDescriptionInput
|
|
394
|
+
}, "data-element-id": ElementIDUtils.getInternalIDInfo("codeInput"), "data-slave-mode": "true", enabled: !this.disableCodeInput && this.enabled, size: this.size, label: null, errorMessage: this.hideDescriptionInput ? this.errorMessage : "", value: this.codeValue, onFocusout: () => this.handleCodeInputFocusOut(), onFocus: () => this.handleCodeInputFocus(), leftIconName: "search", leftIconClickable: this.enabled, onIconClick: () => this.handleSearchClick(), onEzChange: (event) => event.stopPropagation() }), !this.hideDescriptionInput && (h("div", { class: "description-input-container" }, h("ez-classic-input", { ref: (elem) => this._textInputDescriptionValue = elem, tabIndex: -1, class: { "ez-classic-search-plus__text-input": true }, "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), "data-slave-mode": "true", enabled: !this.disableDescriptionInput && this.enabled, label: null, errorMessage: this.errorMessage, size: this.size, value: this.descriptionValue, onInput: (event) => this.handleTextInputChangeHandler(event), onFocus: () => this.handleDescriptionInputFocus(), rightIconName: canShowClearButton ? "close" : null, rightIconClickable: this.enabled, onIconClick: () => this.clearSearch(), onEzChange: (event) => event.stopPropagation() }), h("ez-popover-plus", { ref: elem => this._popover = elem, anchorElement: this.el, autoClose: true, boxWidth: 'fit-content', overlayType: 'none', useAnchorSize: true, onEzVisibilityChange: (event) => this.handleOnEzVisibilityChange(event), "data-element-id": this.el.getAttribute("data-element-id") }, h("ez-classic-search-result-list", { ref: (ref) => this._classicSearchList = ref, showLoading: this.showLoading, visibleOptions: this.visibleOptions, value: this.value, showOptionValue: this.showOptionValue, onChangeValue: (evt) => this.handleSelectItem(evt) }))))))));
|
|
395
|
+
}
|
|
396
|
+
get el() { return getElement(this); }
|
|
397
|
+
static get watchers() { return {
|
|
398
|
+
"value": ["observeValue"]
|
|
399
|
+
}; }
|
|
400
|
+
};
|
|
401
|
+
EzClassicSearchPlus.style = ezClassicSearchPlusCss;
|
|
402
|
+
|
|
403
|
+
export { EzClassicSearchPlus as ez_classic_search_plus };
|