@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,197 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
|
|
2
|
+
import { DateUtils, 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 ezClassicDateInputCss = ":host{display:block;width:100%;--ez-classic-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-classic-date-input__input--border-color:var(--ez-classic-date-input__input--background-color);--ez-classic-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:not-allowed}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-classic-date-input__calendar-image);mask-image:var(--ez-classic-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-classic-input{--text-input__input--background-color:var(--ez-classic-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-classic-date-input__input--border-color, #DCE0E8)}";
|
|
7
|
+
|
|
8
|
+
const EzClassicDateInput = 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.ezInput = createEvent(this, "ezInput", 7);
|
|
15
|
+
this._changePending = false;
|
|
16
|
+
this._focused = false;
|
|
17
|
+
this._valuePromiseCallbacks = [];
|
|
18
|
+
this.label = undefined;
|
|
19
|
+
this.value = undefined;
|
|
20
|
+
this.enabled = true;
|
|
21
|
+
this.errorMessage = undefined;
|
|
22
|
+
this.mode = "regular";
|
|
23
|
+
this.size = "default";
|
|
24
|
+
this.required = false;
|
|
25
|
+
this.canShowError = true;
|
|
26
|
+
this.autoFocus = false;
|
|
27
|
+
this.alternativePlaceholder = undefined;
|
|
28
|
+
}
|
|
29
|
+
observeLabel() {
|
|
30
|
+
if (this._textInput) {
|
|
31
|
+
this._textInput.label = this.label;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
observeErrorMessage() {
|
|
35
|
+
var _a;
|
|
36
|
+
if (this._textInput) {
|
|
37
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
38
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
39
|
+
this.setInputValue();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
observeValue(newValue, oldValue) {
|
|
44
|
+
if (this._textInput && newValue != oldValue) {
|
|
45
|
+
const newValueValidated = DateUtils.validateDate(newValue);
|
|
46
|
+
const oldValueValidated = DateUtils.validateDate(oldValue);
|
|
47
|
+
if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
|
|
48
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
49
|
+
const parsedDate = DateUtils.strToDate(textValue);
|
|
50
|
+
if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
|
|
51
|
+
this._textInput.value = textValue;
|
|
52
|
+
this._focused = false;
|
|
53
|
+
this.errorMessage = "";
|
|
54
|
+
}
|
|
55
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
56
|
+
this.ezChange.emit(valueEmitted);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
this._changePending = false;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Aplica o foco no campo.
|
|
63
|
+
*/
|
|
64
|
+
async setFocus(options) {
|
|
65
|
+
this._textInput.setFocus(options);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Remove o foco do campo.
|
|
69
|
+
*/
|
|
70
|
+
async setBlur() {
|
|
71
|
+
this._textInput.setBlur();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Retorna se o conteúdo é inválido.
|
|
75
|
+
*/
|
|
76
|
+
async isInvalid() {
|
|
77
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
78
|
+
}
|
|
79
|
+
/*
|
|
80
|
+
* Retorna uma promise com o valor da opção selecionada,
|
|
81
|
+
* que será resolvida quando o backend devolver este dado.
|
|
82
|
+
*/
|
|
83
|
+
async getValueAsync() {
|
|
84
|
+
if (this._changePending) {
|
|
85
|
+
return new Promise(accept => {
|
|
86
|
+
this._valuePromiseCallbacks.push(accept);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return Promise.resolve(this.value);
|
|
90
|
+
}
|
|
91
|
+
changeValue(newValue) {
|
|
92
|
+
const currentValue = DateUtils.validateDate(this.value);
|
|
93
|
+
const newValueValidated = DateUtils.validateDate(newValue);
|
|
94
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
95
|
+
this.value = newValueValidated;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
this._changePending = false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async handleChangeCalendar(event) {
|
|
102
|
+
this.changeValue(this._calendar.value);
|
|
103
|
+
this.ezInput.emit(this._calendar.value);
|
|
104
|
+
this._popover.hide();
|
|
105
|
+
await this.setFocus();
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
}
|
|
108
|
+
handleBlur() {
|
|
109
|
+
if (!this._changePending) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const strValue = this._textInput.value;
|
|
114
|
+
const newValue = DateUtils.strToDate(strValue);
|
|
115
|
+
if (newValue || !strValue) {
|
|
116
|
+
this.errorMessage = "";
|
|
117
|
+
const currentValue = DateUtils.validateDate(this.value);
|
|
118
|
+
const newValueValidated = DateUtils.validateDate(newValue);
|
|
119
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
120
|
+
if (newValueValidated) {
|
|
121
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
122
|
+
this._focused = false;
|
|
123
|
+
}
|
|
124
|
+
this.ezCancelWaitingChange.emit();
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this._focused = false;
|
|
128
|
+
this.changeValue(newValueValidated);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
this.changeValue(undefined);
|
|
133
|
+
this.ezCancelWaitingChange.emit();
|
|
134
|
+
this.errorMessage = this.i18n("ez-classic-date-input.invalidDate");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
for (const callback of this._valuePromiseCallbacks) {
|
|
139
|
+
callback(this.value);
|
|
140
|
+
}
|
|
141
|
+
this._valuePromiseCallbacks = [];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
getTextValue(d) {
|
|
145
|
+
return d ? DateUtils.formatDate(d) : undefined;
|
|
146
|
+
}
|
|
147
|
+
handleInput(event) {
|
|
148
|
+
const strValue = this._textInput.value;
|
|
149
|
+
const newValue = DateUtils.strToDate(strValue);
|
|
150
|
+
const currentValue = DateUtils.validateDate(this.value);
|
|
151
|
+
const newValueValidated = DateUtils.validateDate(newValue);
|
|
152
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
153
|
+
this._changePending = true;
|
|
154
|
+
this._focused = true;
|
|
155
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
156
|
+
}
|
|
157
|
+
if (event['data'] === "H" || event['data'] === "h") {
|
|
158
|
+
const currentDate = new Date();
|
|
159
|
+
this.ezInput.emit(currentDate);
|
|
160
|
+
this.changeValue(currentDate);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
setInputValue() {
|
|
164
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
165
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
166
|
+
this._textInput.value = textValue;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
disconnectedCallback() {
|
|
170
|
+
this._popover.hide();
|
|
171
|
+
}
|
|
172
|
+
async componentWillLoad() {
|
|
173
|
+
this.i18n = await initI18n();
|
|
174
|
+
}
|
|
175
|
+
componentDidLoad() {
|
|
176
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
177
|
+
this.setInputValue();
|
|
178
|
+
if (this.autoFocus) {
|
|
179
|
+
requestAnimationFrame(() => {
|
|
180
|
+
this.setFocus({ selectText: true });
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
render() {
|
|
185
|
+
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
186
|
+
return (h(Host, null, h("ez-classic-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: (elem) => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: (evt) => this.handleInput(evt), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, size: this.size, canShowError: this.canShowError, alternativePlaceholder: this.alternativePlaceholder, required: this.required, leftIconName: "calendar", leftIconClickable: this.enabled, onIconClick: () => { var _a; return (_a = this._popover) === null || _a === void 0 ? void 0 : _a.showUnder(this._textInput); }, onEzChange: (event) => event.stopPropagation() }), h("ez-popover-plus", { ref: elem => this._popover = elem, anchorElement: this._textInput, autoClose: true, boxWidth: 'fit-content', overlayType: 'none', "data-element-id": this._elem.getAttribute("data-element-id"), onEzVisibilityChange: (event) => event.stopPropagation() }, h("ez-calendar", { ref: elem => this._calendar = elem, "data-element-id": ElementIDUtils.getInternalIDInfo("calendar"), onEzChange: (event) => this.handleChangeCalendar(event), value: this.value }))));
|
|
187
|
+
}
|
|
188
|
+
get _elem() { return getElement(this); }
|
|
189
|
+
static get watchers() { return {
|
|
190
|
+
"label": ["observeLabel"],
|
|
191
|
+
"errorMessage": ["observeErrorMessage"],
|
|
192
|
+
"value": ["observeValue"]
|
|
193
|
+
}; }
|
|
194
|
+
};
|
|
195
|
+
EzClassicDateInput.style = ezClassicDateInputCss;
|
|
196
|
+
|
|
197
|
+
export { EzClassicDateInput as ez_classic_date_input };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
|
|
2
|
+
import { DateUtils, TimeFormatter, 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 ezClassicDateTimeInputCss = ":host{display:block;width:100%;--ez-classic-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-classic-date-input__input--border-color:var(--ez-classic-date-input__input--background-color);--ez-classic-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:not-allowed}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-classic-date-input__calendar-image);mask-image:var(--ez-classic-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-classic-input{--text-input__input--background-color:var(--ez-classic-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-classic-date-input__input--border-color, #DCE0E8)}";
|
|
7
|
+
|
|
8
|
+
const EzClassicDateTimeInput = 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._changePending = false;
|
|
15
|
+
this._focused = false;
|
|
16
|
+
this._valuePromiseCallbacks = [];
|
|
17
|
+
this.label = undefined;
|
|
18
|
+
this.value = undefined;
|
|
19
|
+
this.enabled = true;
|
|
20
|
+
this.errorMessage = undefined;
|
|
21
|
+
this.showSeconds = false;
|
|
22
|
+
this.mode = "regular";
|
|
23
|
+
this.size = "default";
|
|
24
|
+
this.required = false;
|
|
25
|
+
this.canShowError = true;
|
|
26
|
+
this.autoFocus = false;
|
|
27
|
+
this.alternativePlaceholder = undefined;
|
|
28
|
+
}
|
|
29
|
+
observeLabel() {
|
|
30
|
+
if (this._textInput) {
|
|
31
|
+
this._textInput.label = this.label;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
observeErrorMessage() {
|
|
35
|
+
var _a;
|
|
36
|
+
if (this._textInput) {
|
|
37
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
38
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
39
|
+
this.setInputValue();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
observeValue(newValue, oldValue) {
|
|
44
|
+
if (this._textInput && newValue != oldValue) {
|
|
45
|
+
const newValueValidated = DateUtils.validateDate(newValue, true);
|
|
46
|
+
const oldValueValidated = DateUtils.validateDate(oldValue, true);
|
|
47
|
+
if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
|
|
48
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
49
|
+
const parsedDate = this.getParsedDateTime(textValue);
|
|
50
|
+
if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
|
|
51
|
+
this._textInput.value = textValue;
|
|
52
|
+
this._focused = false;
|
|
53
|
+
this.errorMessage = "";
|
|
54
|
+
}
|
|
55
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
56
|
+
this.ezChange.emit(valueEmitted);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
this._changePending = false;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Aplica o foco no campo.
|
|
63
|
+
*/
|
|
64
|
+
async setFocus(options) {
|
|
65
|
+
this._textInput.setFocus(options);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Remove o foco do campo.
|
|
69
|
+
*/
|
|
70
|
+
async setBlur() {
|
|
71
|
+
this._textInput.setBlur();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Retorna se o conteúdo é inválido.
|
|
75
|
+
*/
|
|
76
|
+
async isInvalid() {
|
|
77
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
78
|
+
}
|
|
79
|
+
/*
|
|
80
|
+
* Retorna uma promise com o valor da opção selecionada,
|
|
81
|
+
* que será resolvida quando o backend devolver este dado.
|
|
82
|
+
*/
|
|
83
|
+
async getValueAsync() {
|
|
84
|
+
if (this._changePending) {
|
|
85
|
+
return new Promise(accept => {
|
|
86
|
+
this._valuePromiseCallbacks.push(accept);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return Promise.resolve(this.value);
|
|
90
|
+
}
|
|
91
|
+
handleKeyDown(event) {
|
|
92
|
+
const input = this._textInput.shadowRoot.querySelector('input');
|
|
93
|
+
if (event.shiftKey && event.key === "Tab") {
|
|
94
|
+
if (input.selectionStart > 0) {
|
|
95
|
+
let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
|
|
96
|
+
if (selectIni !== -1) {
|
|
97
|
+
input.setSelectionRange(0, selectIni);
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (event.key === "Tab") {
|
|
103
|
+
if (input.value.length !== input.selectionEnd) {
|
|
104
|
+
let selectIni = input.value.indexOf(" ", input.selectionEnd);
|
|
105
|
+
selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
|
|
106
|
+
input.setSelectionRange(selectIni, input.value.length);
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
handleFocus() {
|
|
112
|
+
const input = this._textInput.shadowRoot.querySelector('input');
|
|
113
|
+
if (input.selectionStart !== input.selectionEnd) {
|
|
114
|
+
let selectIni = input.value.indexOf(" ", input.selectionStart);
|
|
115
|
+
selectIni = selectIni === -1 ? input.value.length : selectIni;
|
|
116
|
+
input.setSelectionRange(0, selectIni);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
handleClick() {
|
|
120
|
+
const input = this._textInput.shadowRoot.querySelector('input');
|
|
121
|
+
let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
|
|
122
|
+
selectIni = selectIni === -1 ? 0 : selectIni + 1;
|
|
123
|
+
selectIni = selectIni > input.selectionEnd ? 0 : selectIni;
|
|
124
|
+
let selectFin = selectIni === 0 ? input.value.indexOf(" ") : input.value.length;
|
|
125
|
+
input.setSelectionRange(selectIni, selectFin);
|
|
126
|
+
}
|
|
127
|
+
changeValue(newValue) {
|
|
128
|
+
const currentValue = DateUtils.validateDate(this.value, true);
|
|
129
|
+
const newValueValidated = DateUtils.validateDate(newValue, true);
|
|
130
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
131
|
+
this.value = newValueValidated;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
hideCalendar() {
|
|
135
|
+
this.changeValue(this._calendar.value);
|
|
136
|
+
this._popover.hide();
|
|
137
|
+
}
|
|
138
|
+
getParsedDateTime(strValue) {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
if (strValue === void 0) {
|
|
141
|
+
strValue = (((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "");
|
|
142
|
+
}
|
|
143
|
+
if (!strValue) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const partsDateTime = strValue.split(" ");
|
|
147
|
+
const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
|
|
148
|
+
const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
|
|
149
|
+
const parsedTime = TimeFormatter.prepareValue(onlyTime, this.showSeconds);
|
|
150
|
+
const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
|
|
151
|
+
return DateUtils.strToDate(strDateTime);
|
|
152
|
+
}
|
|
153
|
+
handleBlur() {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
if (!this._changePending) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const strValue = ((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "";
|
|
160
|
+
const newValue = this.getParsedDateTime();
|
|
161
|
+
if (newValue || !strValue) {
|
|
162
|
+
this.errorMessage = "";
|
|
163
|
+
const currentValue = DateUtils.validateDate(this.value, true);
|
|
164
|
+
const newValueValidated = DateUtils.validateDate(newValue, true);
|
|
165
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
166
|
+
if (newValueValidated) {
|
|
167
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
168
|
+
this._focused = false;
|
|
169
|
+
}
|
|
170
|
+
this.ezCancelWaitingChange.emit();
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this.changeValue(newValueValidated);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this.changeValue(undefined);
|
|
178
|
+
this.ezCancelWaitingChange.emit();
|
|
179
|
+
this.errorMessage = this.i18n("ez-classic-date-time-input.invalidDate");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
for (const callback of this._valuePromiseCallbacks) {
|
|
184
|
+
callback(this.value);
|
|
185
|
+
}
|
|
186
|
+
this._valuePromiseCallbacks = [];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
getTextValue(date) {
|
|
190
|
+
if (!date) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
return DateUtils.formatDateTime(date, this.showSeconds);
|
|
194
|
+
}
|
|
195
|
+
handleInput(event) {
|
|
196
|
+
const newValue = this.getParsedDateTime();
|
|
197
|
+
const currentValue = DateUtils.validateDate(this.value, true);
|
|
198
|
+
const newValueValidated = DateUtils.validateDate(newValue, true);
|
|
199
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
200
|
+
this._changePending = true;
|
|
201
|
+
this._focused = true;
|
|
202
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
203
|
+
}
|
|
204
|
+
if (event['data'] === "H" || event['data'] === "h") {
|
|
205
|
+
this.changeValue(new Date());
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
setInputValue() {
|
|
209
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
210
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
211
|
+
this._textInput.value = textValue;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
disconnectedCallback() {
|
|
215
|
+
this._popover.hide();
|
|
216
|
+
}
|
|
217
|
+
async componentWillLoad() {
|
|
218
|
+
this.i18n = await initI18n();
|
|
219
|
+
}
|
|
220
|
+
componentDidLoad() {
|
|
221
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
222
|
+
this.setInputValue();
|
|
223
|
+
if (this.autoFocus) {
|
|
224
|
+
requestAnimationFrame(() => {
|
|
225
|
+
this.setFocus({ selectText: true });
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
render() {
|
|
230
|
+
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
231
|
+
return (h(Host, null, h("ez-classic-input", { ref: (elem) => this._textInput = elem, "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), "data-slave-mode": "true", label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, size: this.size, onKeyDown: (event) => { this.handleKeyDown(event); }, onBlur: () => this.handleBlur(), onInput: (evt) => this.handleInput(evt), onFocus: () => this.handleFocus(), onClick: () => this.handleClick(), required: this.required, leftIconName: "calendar", leftIconClickable: this.enabled, onIconClick: () => { var _a; return (_a = this._popover) === null || _a === void 0 ? void 0 : _a.showUnder(this._textInput); }, onEzChange: (event) => event.stopPropagation() }), h("ez-popover-plus", { ref: elem => this._popover = elem, anchorElement: this._textInput, autoClose: true, boxWidth: 'fit-content', overlayType: 'none', "data-element-id": this._elem.getAttribute("data-element-id") }, h("ez-calendar", { ref: elem => this._calendar = elem, "data-element-id": ElementIDUtils.getInternalIDInfo("calendar"), onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, time: true, showSeconds: this.showSeconds }))));
|
|
232
|
+
}
|
|
233
|
+
get _elem() { return getElement(this); }
|
|
234
|
+
static get watchers() { return {
|
|
235
|
+
"label": ["observeLabel"],
|
|
236
|
+
"errorMessage": ["observeErrorMessage"],
|
|
237
|
+
"value": ["observeValue"]
|
|
238
|
+
}; }
|
|
239
|
+
};
|
|
240
|
+
EzClassicDateTimeInput.style = ezClassicDateTimeInputCss;
|
|
241
|
+
|
|
242
|
+
export { EzClassicDateTimeInput as ez_classic_date_time_input };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
|
|
2
|
-
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { ElementIDUtils, MaskFormatter as MaskFormatter$1 } from '@sankhyalabs/core';
|
|
3
3
|
|
|
4
4
|
class MaskFormatter {
|
|
5
5
|
constructor(mask) {
|
|
@@ -196,7 +196,7 @@ class MaskFormatter {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
const ezClassicInputCss = ":host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0
|
|
199
|
+
const ezClassicInputCss = ":host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0;padding-inline:var(--space--2, 2px);width:100%;--ez-classic-input--label-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--border-color-default:var(--color--gray-200, #D2D2D3);--ez-classic-input--border-color-focus:var(--color--gray-300, #A4A5A7);--ez-classic-input--border-color-success:var(--color--green-600, #157A00);--ez-classic-input--border-color-error:var(--color--red-600, #BD0025);--ez-classic-input--border-color-warning:var(--color--yellow-600, #EFB103);--ez-classic-input--background-color:var(--color--gray-70, #FFFFFF);--ez-classic-input--background-color-disabled:var(--color--gray-90, #EAEAEA);--ez-classic-input--text-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--placeholder-color:#bdbdbd;--ez-classic-input--icon-color:var(--color--gray-400, #77777A);--ez-classic-input--helptext-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--height:var(--space--56, 56px);--ez-classic-input--height-small:var(--space--48, 48px);--ez-classic-input--height-xsmall:var(--space--40, 40px);--ez-classic-input--gap:var(--space--10, 10px);--ez-classic-input--padding-inline:var(--space--16, 16px)}.input-container{display:flex;flex-direction:row;align-items:center;width:100%;border:none;border-radius:var(--border--radius-8, 8px);padding-inline:var(--ez-classic-input--padding-inline);box-sizing:border-box;gap:var(--ez-classic-input--gap);margin-block:var(--space--4, 4px);transition:box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);height:var(--ez-classic-input--height);background-color:var(--ez-classic-input--background-color)}.input-container--small{height:var(--ez-classic-input--height-small)}.input-container--xsmall{height:var(--ez-classic-input--height-xsmall)}.input-container,.input-container[data-state=\"default\"]{box-shadow:0 0 0 1px var(--ez-classic-input--border-color-default)}.input-container[data-state=\"success\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-success)}.input-container[data-state=\"error\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-error)}.input-container[data-state=\"warning\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-warning)}.input-container:focus-within{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-focus)}ez-icon{min-width:var(--space--24, 24px);color:var(--ez-classic-input--icon-color)}input{flex:1;border:none;outline:none;background:transparent;height:100%;width:100%;padding:0;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);text-overflow:ellipsis;color:var(--ez-classic-input--text-color)}input::placeholder{color:var(--ez-classic-input--placeholder-color)}.input-container[data-disabled=\"true\"]{cursor:not-allowed;background:var(--ez-classic-input--background-color-disabled);border-color:var(--ez-classic-input--border-color-default)}.input-container[data-disabled=\"true\"]>*{cursor:not-allowed}.input-container input:read-only{cursor:default}@keyframes ez-helptext-fadein{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}span{font-size:var(--font-size--xsmall, 10px);line-height:var(--line-height--16, 16px);overflow:hidden;text-overflow:ellipsis;animation:ez-helptext-fadein 0.3s ease;color:var(--ez-classic-input--helptext-color)}label{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-input--label-color)}.icon-clickable{cursor:pointer}.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}";
|
|
200
200
|
|
|
201
201
|
const EzClassicInput = class {
|
|
202
202
|
constructor(hostRef) {
|
|
@@ -210,10 +210,13 @@ const EzClassicInput = class {
|
|
|
210
210
|
this.value = undefined;
|
|
211
211
|
this.label = undefined;
|
|
212
212
|
this.helpText = undefined;
|
|
213
|
+
this.errorMessage = undefined;
|
|
213
214
|
this.placeholder = undefined;
|
|
214
215
|
this.enabled = true;
|
|
215
216
|
this.readonly = false;
|
|
217
|
+
this.required = false;
|
|
216
218
|
this.name = undefined;
|
|
219
|
+
this.size = "default";
|
|
217
220
|
this.minlength = undefined;
|
|
218
221
|
this.maxlength = undefined;
|
|
219
222
|
this.leftIconName = undefined;
|
|
@@ -257,29 +260,67 @@ const EzClassicInput = class {
|
|
|
257
260
|
this._inputElem.value = this.value || '';
|
|
258
261
|
}
|
|
259
262
|
}
|
|
263
|
+
async observeErrorMessage(newValue) {
|
|
264
|
+
if (newValue && newValue.trim() !== '') {
|
|
265
|
+
this.state = "error";
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
this.state = "default";
|
|
269
|
+
}
|
|
260
270
|
onInput(event) {
|
|
261
271
|
try {
|
|
262
272
|
const inputElement = event.target;
|
|
263
|
-
|
|
273
|
+
const inputValue = inputElement.value;
|
|
264
274
|
if (this._maskFormatter) {
|
|
265
|
-
const formattedValue = this.
|
|
266
|
-
|
|
267
|
-
inputElement.value = formattedValue;
|
|
268
|
-
this._internalValueChange = true;
|
|
269
|
-
this.value = cleanValue;
|
|
270
|
-
const emitValue = this.emitMaskedValue ? formattedValue : cleanValue;
|
|
271
|
-
this.ezChange.emit(emitValue);
|
|
275
|
+
const { formattedValue, cleanValue } = this.processInputWithMask(inputValue);
|
|
276
|
+
this.updateInputValue(inputElement, formattedValue, cleanValue);
|
|
272
277
|
}
|
|
273
278
|
else {
|
|
274
|
-
this.
|
|
275
|
-
this.value = inputValue;
|
|
276
|
-
this.ezChange.emit(inputValue);
|
|
279
|
+
this.updateInputValueWithoutMask(inputValue);
|
|
277
280
|
}
|
|
278
281
|
}
|
|
279
282
|
catch (error) {
|
|
280
283
|
console.error("Error processing input event:", error);
|
|
281
284
|
}
|
|
282
285
|
}
|
|
286
|
+
processInputWithMask(inputValue) {
|
|
287
|
+
if (this.mask === "cgc_cpf") {
|
|
288
|
+
return this.processCgcCpfMask(inputValue);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
return this.processRegularMask(inputValue);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
processCgcCpfMask(inputValue) {
|
|
295
|
+
const numericOnly = inputValue.replace(/\D/g, '');
|
|
296
|
+
if (numericOnly.length === 11 || numericOnly.length === 14) {
|
|
297
|
+
const maskToUse = numericOnly.length === 11
|
|
298
|
+
? MaskFormatter$1.DEFAULT_MASKS.cpf
|
|
299
|
+
: MaskFormatter$1.DEFAULT_MASKS.cnpj;
|
|
300
|
+
this._maskFormatter = new MaskFormatter(maskToUse);
|
|
301
|
+
const formattedValue = this._maskFormatter.format(numericOnly);
|
|
302
|
+
return { formattedValue, cleanValue: numericOnly };
|
|
303
|
+
}
|
|
304
|
+
// Se não tem o tamanho correto, mantém apenas os números
|
|
305
|
+
return { formattedValue: numericOnly, cleanValue: numericOnly };
|
|
306
|
+
}
|
|
307
|
+
processRegularMask(inputValue) {
|
|
308
|
+
const formattedValue = this._maskFormatter.format(inputValue);
|
|
309
|
+
const cleanValue = this._maskFormatter.removeMask(formattedValue);
|
|
310
|
+
return { formattedValue, cleanValue };
|
|
311
|
+
}
|
|
312
|
+
updateInputValue(inputElement, formattedValue, cleanValue) {
|
|
313
|
+
inputElement.value = formattedValue;
|
|
314
|
+
this._internalValueChange = true;
|
|
315
|
+
this.value = cleanValue;
|
|
316
|
+
const emitValue = this.emitMaskedValue ? formattedValue : cleanValue;
|
|
317
|
+
this.ezChange.emit(emitValue);
|
|
318
|
+
}
|
|
319
|
+
updateInputValueWithoutMask(inputValue) {
|
|
320
|
+
this._internalValueChange = true;
|
|
321
|
+
this.value = inputValue;
|
|
322
|
+
this.ezChange.emit(inputValue);
|
|
323
|
+
}
|
|
283
324
|
onBlur() {
|
|
284
325
|
this.ezBlur.emit(this.value);
|
|
285
326
|
}
|
|
@@ -306,24 +347,64 @@ const EzClassicInput = class {
|
|
|
306
347
|
ElementIDUtils.addIDInfo(this._inputElem, 'classic-input', dataInfo);
|
|
307
348
|
}
|
|
308
349
|
}
|
|
309
|
-
|
|
310
|
-
if (this.mask && !this._maskFormatter) {
|
|
311
|
-
this._maskFormatter = new MaskFormatter(this.mask);
|
|
312
|
-
}
|
|
350
|
+
buildPlaceholder() {
|
|
313
351
|
if (!this.placeholder && this._maskFormatter) {
|
|
314
352
|
this.placeholder = this._maskFormatter.generatePlaceholder();
|
|
315
353
|
}
|
|
316
354
|
}
|
|
355
|
+
buildMaskFormatter() {
|
|
356
|
+
if (this.mask && (!this._maskFormatter || this.mask === 'cgc_cpf')) {
|
|
357
|
+
const maskToBuilder = this.getMaskToBuilder();
|
|
358
|
+
this._maskFormatter = maskToBuilder ? new MaskFormatter(maskToBuilder) : undefined;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
getMaskToBuilder() {
|
|
362
|
+
if (this.mask === "cgc_cpf") {
|
|
363
|
+
return this.getCGCCpfMask();
|
|
364
|
+
}
|
|
365
|
+
if (this.mask === 'phone') {
|
|
366
|
+
return this.getPhoneMask();
|
|
367
|
+
}
|
|
368
|
+
if (this.mask in MaskFormatter$1.DEFAULT_MASKS) {
|
|
369
|
+
return MaskFormatter$1.DEFAULT_MASKS[this.mask];
|
|
370
|
+
}
|
|
371
|
+
return this.mask;
|
|
372
|
+
}
|
|
373
|
+
getPhoneMask() {
|
|
374
|
+
if (this.value && this.value.length === 10) {
|
|
375
|
+
return MaskFormatter.DEFAULT_MASKS ? MaskFormatter.DEFAULT_MASKS.phone : undefined;
|
|
376
|
+
}
|
|
377
|
+
if (this.value && this.value.length === 11) {
|
|
378
|
+
return MaskFormatter.DEFAULT_MASKS ? MaskFormatter.DEFAULT_MASKS.phone_mobile : undefined;
|
|
379
|
+
}
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
getCGCCpfMask() {
|
|
383
|
+
var _a, _b;
|
|
384
|
+
if (((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === 11) {
|
|
385
|
+
return MaskFormatter$1.DEFAULT_MASKS.cpf;
|
|
386
|
+
}
|
|
387
|
+
if (((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) === 14) {
|
|
388
|
+
return MaskFormatter$1.DEFAULT_MASKS.cnpj;
|
|
389
|
+
}
|
|
390
|
+
return undefined;
|
|
391
|
+
}
|
|
392
|
+
componentDidRender() {
|
|
393
|
+
this.buildMaskFormatter();
|
|
394
|
+
this.buildPlaceholder();
|
|
395
|
+
this.syncValue();
|
|
396
|
+
}
|
|
317
397
|
componentDidLoad() {
|
|
318
398
|
this.syncValue();
|
|
319
399
|
this.addInfoId();
|
|
320
400
|
}
|
|
321
401
|
render() {
|
|
322
|
-
return (h(Host, null, h("label", { title: this.label, htmlFor: this.name }, this.label), h("div", { class: "input-container", "data-state": this.state, "data-disabled": (!this.enabled).toString(), onClick: () => this.setFocus({ preventScroll: true }) }, this.leftIconName && (h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), h("input", { ref: el => this._inputElem = el, id: this.name, type: this.type, title: this.value, placeholder: this.placeholder, disabled: !this.enabled, readonly: this.readonly, name: this.name, minlength: this.minlength, maxlength: this.maxlength, onInput: (event) => this.onInput(event), onBlur: this.onBlur.bind(this), onFocus: this.onFocus.bind(this) }), this.rightIconName && (h("ez-icon", { iconName: this.rightIconName, title: this.rightIconTooltip, onClick: (event) => this.handleIconClick(event, "right"), class: { 'icon-clickable': this.rightIconClickable } }))), this.helpText && (h("span", { title: this.helpText }, this.helpText))));
|
|
402
|
+
return (h(Host, null, h("label", { title: this.label, htmlFor: this.name }, this.label, this.required && h("span", { class: "required-indicator" }, "*")), h("div", { class: "input-container " + (this.size ? `input-container--${this.size}` : ""), "data-state": this.state, "data-disabled": (!this.enabled).toString(), onClick: () => this.setFocus({ preventScroll: true }) }, this.leftIconName && (h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), h("input", { ref: el => this._inputElem = el, id: this.name, type: this.type, title: this.value, placeholder: this.placeholder, disabled: !this.enabled, readonly: this.readonly, name: this.name, minlength: this.minlength, maxlength: this.maxlength, onInput: (event) => this.onInput(event), onBlur: this.onBlur.bind(this), onFocus: this.onFocus.bind(this) }), this.rightIconName && (h("ez-icon", { iconName: this.rightIconName, title: this.rightIconTooltip, onClick: (event) => this.handleIconClick(event, "right"), class: { 'icon-clickable': this.rightIconClickable } }))), (this.helpText || this.errorMessage) && (h("span", { id: "input_helpText", title: this.errorMessage || this.helpText }, this.errorMessage || this.helpText))));
|
|
323
403
|
}
|
|
324
404
|
get _element() { return getElement(this); }
|
|
325
405
|
static get watchers() { return {
|
|
326
|
-
"value": ["syncValue"]
|
|
406
|
+
"value": ["syncValue"],
|
|
407
|
+
"errorMessage": ["observeErrorMessage"]
|
|
327
408
|
}; }
|
|
328
409
|
};
|
|
329
410
|
EzClassicInput.style = ezClassicInputCss;
|