@sankhyalabs/ezui 6.1.0-dev.20 → 6.1.0-dev.21
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-c9d1205c.js → ApplicationUtils-39807831.js} +43 -15
- package/dist/cjs/{RichToolbarHelper-438916fa.js → RichToolbarHelper-ea12328f.js} +0 -13
- package/dist/cjs/app-globals-86776e90.js +12 -0
- package/dist/cjs/{constants-569271bc.js → constants-72b7e05e.js} +0 -2
- package/dist/cjs/ez-actions-button.cjs.entry.js +2 -1
- package/dist/cjs/ez-alert-list.cjs.entry.js +5 -3
- package/dist/cjs/ez-avatar.cjs.entry.js +6 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +7 -6
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +13 -10
- package/dist/cjs/ez-combo-box-list_4.cjs.entry.js +24 -14
- package/dist/cjs/ez-combo-box.cjs.entry.js +7 -6
- package/dist/cjs/ez-date-input.cjs.entry.js +5 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +5 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +8 -6
- package/dist/cjs/ez-double-list.cjs.entry.js +12 -4
- package/dist/cjs/ez-file-item.cjs.entry.js +9 -6
- package/dist/cjs/ez-form-view.cjs.entry.js +3 -2
- package/dist/cjs/ez-form.cjs.entry.js +3 -2
- package/dist/cjs/ez-grid.cjs.entry.js +126 -127
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +5 -1
- package/dist/cjs/ez-link-builder_6.cjs.entry.js +33 -13
- package/dist/cjs/ez-list.cjs.entry.js +4 -2
- package/dist/cjs/ez-modal-container.cjs.entry.js +5 -1
- package/dist/cjs/ez-modal.cjs.entry.js +5 -1
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +9 -5
- package/dist/cjs/ez-number-input.cjs.entry.js +5 -1
- package/dist/cjs/ez-search-plus.cjs.entry.js +8 -6
- package/dist/cjs/ez-search-result-list.cjs.entry.js +5 -2
- package/dist/cjs/ez-search.cjs.entry.js +8 -9
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +5 -7
- package/dist/cjs/ez-skeleton.cjs.entry.js +5 -3
- package/dist/cjs/ez-sortable-list.cjs.entry.js +12 -5
- package/dist/cjs/ez-split-button.cjs.entry.js +5 -4
- package/dist/cjs/ez-split-item.cjs.entry.js +6 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +12 -10
- package/dist/cjs/ez-tree.cjs.entry.js +5 -1
- package/dist/cjs/ez-upload.cjs.entry.js +17 -11
- package/dist/cjs/ezui.cjs.js +4 -0
- package/dist/cjs/filter-column.cjs.entry.js +8 -4
- package/dist/cjs/index-02854309.js +3672 -0
- package/dist/cjs/loader.cjs.js +4 -0
- package/dist/cjs/{search-column-27d1f72f.js → search-column-82c52e20.js} +11 -5
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +5 -3
- package/dist/collection/components/ez-avatar/ez-avatar.js +5 -1
- package/dist/collection/components/ez-calendar/ez-calendar.js +7 -6
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +12 -9
- package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.js +7 -4
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +7 -7
- package/dist/collection/components/ez-date-input/ez-date-input.js +5 -1
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +5 -1
- package/dist/collection/components/ez-dialog/ez-dialog.js +8 -6
- package/dist/collection/components/ez-double-list/ez-double-list.js +12 -4
- package/dist/collection/components/ez-file-item/ez-file-item.js +9 -6
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +3 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +10 -9
- package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +3 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/utils/buildLocaleText.js +67 -0
- package/dist/collection/components/ez-grid/ez-grid.js +15 -13
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +7 -3
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +2 -2
- package/dist/collection/components/ez-grid/subcomponents/utils/selectionCounterUtils.js +11 -7
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.js +5 -1
- package/dist/collection/components/ez-list/ez-list.js +4 -2
- package/dist/collection/components/ez-modal/ez-modal.js +5 -1
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +5 -1
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +9 -5
- package/dist/collection/components/ez-number-input/ez-number-input.js +5 -1
- package/dist/collection/components/ez-rich-text/ez-link-builder/ez-link-builder.js +5 -1
- package/dist/collection/components/ez-rich-text/ez-rich-text.js +13 -9
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/RichToolbarHelper.js +0 -12
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-arrows/ez-rich-toolbar-arrows.js +6 -2
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-configs/ez-rich-toolbar-configs.js +6 -2
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-letters/ez-rich-toolbar-letters.js +6 -2
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar.js +8 -4
- package/dist/collection/components/ez-rich-text/ez-simple-image-uploader/ez-simple-image-uploader.js +9 -5
- package/dist/collection/components/ez-search/ez-search.js +7 -8
- package/dist/collection/components/ez-search-plus/ez-search-plus.js +7 -5
- package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.js +5 -2
- package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.js +5 -2
- package/dist/collection/components/ez-skeleton/ez-skeleton.constants.js +0 -1
- package/dist/collection/components/ez-skeleton/ez-skeleton.js +4 -2
- package/dist/collection/components/ez-sortable-list/ez-sortable-list.js +15 -11
- package/dist/collection/components/ez-split-button/ez-split-button.js +6 -6
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +5 -1
- package/dist/collection/components/ez-text-edit/ez-text-edit.js +5 -1
- package/dist/collection/components/ez-text-input/ez-text-input.js +1 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +12 -10
- package/dist/collection/components/ez-tree/ez-tree.js +5 -1
- package/dist/collection/components/ez-upload/ez-upload.js +18 -12
- package/dist/collection/global/app-init.js +6 -0
- package/dist/collection/setupTests.js +1 -1
- package/dist/collection/utils/ApplicationUtils.js +43 -15
- package/dist/collection/utils/constants.js +0 -1
- package/dist/collection/utils/i18n/elanguages.js +6 -0
- package/dist/collection/utils/i18n/i18nUtils.js +20 -0
- package/dist/collection/utils/i18n/index.js +30 -0
- package/dist/collection/utils/i18n/locales/en-us.js +275 -0
- package/dist/collection/utils/i18n/locales/es-es.js +275 -0
- package/dist/collection/utils/i18n/locales/pt-br.js +275 -0
- package/dist/collection/utils/i18n/translations.js +9 -0
- package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +8 -2
- package/dist/custom-elements/index.js +4056 -278
- package/dist/esm/{ApplicationUtils-eaf91331.js → ApplicationUtils-72f474e8.js} +43 -15
- package/dist/esm/{RichToolbarHelper-fd6427df.js → RichToolbarHelper-f3a149c4.js} +1 -13
- package/dist/esm/app-globals-2ccb253f.js +10 -0
- package/dist/esm/{constants-b036528f.js → constants-3fabe81e.js} +1 -2
- package/dist/esm/ez-actions-button.entry.js +2 -1
- package/dist/esm/ez-alert-list.entry.js +5 -3
- package/dist/esm/ez-avatar.entry.js +6 -1
- package/dist/esm/ez-calendar.entry.js +7 -6
- package/dist/esm/ez-collapsible-box.entry.js +13 -10
- package/dist/esm/ez-combo-box-list_4.entry.js +24 -14
- package/dist/esm/ez-combo-box.entry.js +7 -6
- package/dist/esm/ez-date-input.entry.js +5 -1
- package/dist/esm/ez-date-time-input.entry.js +5 -1
- package/dist/esm/ez-dialog.entry.js +8 -6
- package/dist/esm/ez-double-list.entry.js +12 -4
- package/dist/esm/ez-file-item.entry.js +9 -6
- package/dist/esm/ez-form-view.entry.js +3 -2
- package/dist/esm/ez-form.entry.js +3 -2
- package/dist/esm/ez-grid.entry.js +108 -109
- package/dist/esm/ez-guide-navigator.entry.js +5 -1
- package/dist/esm/ez-link-builder_6.entry.js +33 -13
- package/dist/esm/ez-list.entry.js +4 -2
- package/dist/esm/ez-modal-container.entry.js +5 -1
- package/dist/esm/ez-modal.entry.js +5 -1
- package/dist/esm/ez-multi-selection-list.entry.js +9 -5
- package/dist/esm/ez-number-input.entry.js +5 -1
- package/dist/esm/ez-search-plus.entry.js +8 -6
- package/dist/esm/ez-search-result-list.entry.js +5 -2
- package/dist/esm/ez-search.entry.js +8 -9
- package/dist/esm/ez-sidebar-navigator.entry.js +5 -7
- package/dist/esm/ez-skeleton.entry.js +5 -3
- package/dist/esm/ez-sortable-list.entry.js +12 -5
- package/dist/esm/ez-split-button.entry.js +5 -4
- package/dist/esm/ez-split-item.entry.js +6 -2
- package/dist/esm/ez-text-input.entry.js +1 -0
- package/dist/esm/ez-time-input.entry.js +12 -10
- package/dist/esm/ez-tree.entry.js +5 -1
- package/dist/esm/ez-upload.entry.js +17 -11
- package/dist/esm/ezui.js +4 -0
- package/dist/esm/filter-column.entry.js +8 -4
- package/dist/esm/index-b623906e.js +3669 -0
- package/dist/esm/loader.js +4 -0
- package/dist/esm/{search-column-e609d513.js → search-column-5a55f676.js} +9 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-0603bcc7.entry.js +1 -0
- package/dist/ezui/p-0ec7aa3a.entry.js +1 -0
- package/dist/ezui/p-0f0f3efe.entry.js +1 -0
- package/dist/ezui/p-1c3efd36.entry.js +1 -0
- package/dist/ezui/p-1ffb75d5.js +1 -0
- package/dist/ezui/p-22934e19.entry.js +1 -0
- package/dist/ezui/p-2f471aca.entry.js +1 -0
- package/dist/ezui/p-303b3b8c.entry.js +1 -0
- package/dist/ezui/p-3b89a9a0.entry.js +1 -0
- package/dist/ezui/p-3e71ca08.entry.js +1 -0
- package/dist/ezui/p-3e767a74.js +1 -0
- package/dist/ezui/p-3e88fbb6.entry.js +1 -0
- package/dist/ezui/p-4044a7d7.entry.js +1 -0
- package/dist/ezui/p-45c9b292.entry.js +1 -0
- package/dist/ezui/p-45e64547.entry.js +1 -0
- package/dist/ezui/p-46913da7.js +1 -0
- package/dist/ezui/p-4773ff4c.js +1 -0
- package/dist/ezui/p-4fc5f926.entry.js +1 -0
- package/dist/ezui/p-53bc30a1.entry.js +1 -0
- package/dist/ezui/p-627ff5a2.entry.js +1 -0
- package/dist/ezui/p-629e32e2.entry.js +1 -0
- package/dist/ezui/{p-66354b29.entry.js → p-6562b5c8.entry.js} +46 -46
- package/dist/ezui/p-6e6fccfb.entry.js +1 -0
- package/dist/ezui/{p-ad0deb16.entry.js → p-713dc93e.entry.js} +1 -1
- package/dist/ezui/p-84a136bf.entry.js +1 -0
- package/dist/ezui/p-973e6a40.entry.js +1 -0
- package/dist/ezui/p-a12f6074.entry.js +1 -0
- package/dist/ezui/p-a482aae1.entry.js +1 -0
- package/dist/ezui/p-a687f14c.entry.js +7 -0
- package/dist/ezui/p-adbc3261.entry.js +1 -0
- package/dist/ezui/p-b115058e.entry.js +1 -0
- package/dist/ezui/p-b1e45320.js +1 -0
- package/dist/ezui/p-b4215a04.entry.js +1 -0
- package/dist/ezui/p-b8ed876d.entry.js +1 -0
- package/dist/ezui/p-ba07b3df.js +1 -0
- package/dist/ezui/p-c00ad772.entry.js +1 -0
- package/dist/ezui/p-c2a8139d.entry.js +1 -0
- package/dist/ezui/p-caf2584a.entry.js +1 -0
- package/dist/ezui/p-d1d0868b.entry.js +1 -0
- package/dist/ezui/p-e5260556.entry.js +1 -0
- package/dist/ezui/p-ed3bed1e.entry.js +1 -0
- package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +2 -1
- package/dist/types/components/ez-avatar/ez-avatar.d.ts +2 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +2 -3
- package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +2 -0
- package/dist/types/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.d.ts +2 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +2 -2
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +2 -0
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +2 -0
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -2
- package/dist/types/components/ez-double-list/ez-double-list.d.ts +2 -0
- package/dist/types/components/ez-file-item/ez-file-item.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +5 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/utils/buildLocaleText.d.ts +66 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +2 -2
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +2 -0
- package/dist/types/components/ez-grid/subcomponents/selection-counter.d.ts +2 -0
- package/dist/types/components/ez-grid/subcomponents/utils/selectionCounterUtils.d.ts +2 -2
- package/dist/types/components/ez-guide-navigator/ez-guide-navigator.d.ts +2 -0
- package/dist/types/components/ez-list/ez-list.d.ts +2 -1
- package/dist/types/components/ez-modal/ez-modal.d.ts +2 -0
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +2 -0
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +2 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-link-builder/ez-link-builder.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-rich-text.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/RichToolbarHelper.d.ts +0 -12
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-arrows/ez-rich-toolbar-arrows.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-configs/ez-rich-toolbar-configs.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-letters/ez-rich-toolbar-letters.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-simple-image-uploader/ez-simple-image-uploader.d.ts +2 -0
- package/dist/types/components/ez-search/ez-search.d.ts +2 -3
- package/dist/types/components/ez-search-plus/ez-search-plus.d.ts +2 -1
- package/dist/types/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.d.ts +2 -1
- package/dist/types/components/ez-sidebar-navigator/ez-sidebar-navigator.d.ts +2 -0
- package/dist/types/components/ez-skeleton/ez-skeleton.constants.d.ts +0 -1
- package/dist/types/components/ez-skeleton/ez-skeleton.d.ts +2 -1
- package/dist/types/components/ez-sortable-list/ez-sortable-list.d.ts +2 -0
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +2 -2
- package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +2 -0
- package/dist/types/components/ez-text-edit/ez-text-edit.d.ts +2 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +2 -1
- package/dist/types/components/ez-tree/ez-tree.d.ts +2 -0
- package/dist/types/components/ez-upload/ez-upload.d.ts +3 -1
- package/dist/types/global/app-init.d.ts +1 -0
- package/dist/types/utils/ApplicationUtils.d.ts +3 -1
- package/dist/types/utils/constants.d.ts +0 -1
- package/dist/types/utils/i18n/elanguages.d.ts +5 -0
- package/dist/types/utils/i18n/i18nUtils.d.ts +2 -0
- package/dist/types/utils/i18n/index.d.ts +5 -0
- package/dist/types/utils/i18n/locales/en-us.d.ts +276 -0
- package/dist/types/utils/i18n/locales/es-es.d.ts +276 -0
- package/dist/types/utils/i18n/locales/pt-br.d.ts +276 -0
- package/dist/types/utils/i18n/translations.d.ts +828 -0
- package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +1 -0
- package/package.json +7 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +0 -75
- package/dist/collection/components/ez-sidebar-navigator/messages/constants.js +0 -5
- package/dist/ezui/p-0306dff7.entry.js +0 -1
- package/dist/ezui/p-07894c4a.entry.js +0 -1
- package/dist/ezui/p-09de35a2.entry.js +0 -1
- package/dist/ezui/p-1276ef79.entry.js +0 -1
- package/dist/ezui/p-1cebdc92.js +0 -1
- package/dist/ezui/p-1eb34cad.entry.js +0 -1
- package/dist/ezui/p-2187f86c.js +0 -1
- package/dist/ezui/p-33326ac5.entry.js +0 -1
- package/dist/ezui/p-3ba9565c.entry.js +0 -1
- package/dist/ezui/p-454bba13.entry.js +0 -1
- package/dist/ezui/p-496f7832.entry.js +0 -1
- package/dist/ezui/p-4bb47bbe.entry.js +0 -1
- package/dist/ezui/p-4bd6dd6a.entry.js +0 -1
- package/dist/ezui/p-555c9018.entry.js +0 -1
- package/dist/ezui/p-57363cfd.entry.js +0 -1
- package/dist/ezui/p-58f69d24.entry.js +0 -1
- package/dist/ezui/p-59561756.entry.js +0 -7
- package/dist/ezui/p-5eea9886.js +0 -1
- package/dist/ezui/p-6bcf4ba2.entry.js +0 -1
- package/dist/ezui/p-6e429cff.entry.js +0 -1
- package/dist/ezui/p-7019f782.entry.js +0 -1
- package/dist/ezui/p-77a4bd35.entry.js +0 -1
- package/dist/ezui/p-7eae6986.entry.js +0 -1
- package/dist/ezui/p-9478b13b.entry.js +0 -1
- package/dist/ezui/p-98ee5c31.entry.js +0 -1
- package/dist/ezui/p-998afb6a.entry.js +0 -1
- package/dist/ezui/p-a148e994.entry.js +0 -1
- package/dist/ezui/p-ad79f9d1.entry.js +0 -1
- package/dist/ezui/p-b796e213.entry.js +0 -1
- package/dist/ezui/p-bac0f920.entry.js +0 -1
- package/dist/ezui/p-bff24a7b.js +0 -1
- package/dist/ezui/p-da1b4a38.entry.js +0 -1
- package/dist/ezui/p-dc73e1fe.entry.js +0 -1
- package/dist/ezui/p-ddd1e05f.entry.js +0 -1
- package/dist/ezui/p-e4528470.entry.js +0 -1
- package/dist/ezui/p-e6a9041d.entry.js +0 -1
- package/dist/ezui/p-ec0d8122.entry.js +0 -1
- package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +0 -2
- package/dist/types/components/ez-sidebar-navigator/messages/constants.d.ts +0 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import Sortable, { MultiDrag } from 'sortablejs';
|
|
3
3
|
import { ArrayUtils } from '@sankhyalabs/core';
|
|
4
|
+
import initI18n from '../../utils/i18n';
|
|
4
5
|
Sortable.mount(new MultiDrag());
|
|
5
6
|
export class EzSortableList {
|
|
6
7
|
constructor() {
|
|
@@ -11,9 +12,9 @@ export class EzSortableList {
|
|
|
11
12
|
this.group = 'default';
|
|
12
13
|
this.dataSource = [];
|
|
13
14
|
this.idSortableList = 'DEFAULT_LIST';
|
|
14
|
-
this.entityLabel =
|
|
15
|
-
this.entityLabelPlural =
|
|
16
|
-
this.emptyMessage =
|
|
15
|
+
this.entityLabel = undefined;
|
|
16
|
+
this.entityLabelPlural = undefined;
|
|
17
|
+
this.emptyMessage = undefined;
|
|
17
18
|
this.hoverFeedback = true;
|
|
18
19
|
this.enableMultipleSelection = false;
|
|
19
20
|
this.removeItensMoved = false;
|
|
@@ -34,6 +35,12 @@ export class EzSortableList {
|
|
|
34
35
|
});
|
|
35
36
|
this.ezSelectItens.emit([]);
|
|
36
37
|
}
|
|
38
|
+
async componentWillLoad() {
|
|
39
|
+
this.i18n = await initI18n();
|
|
40
|
+
this.emptyMessage = this.i18n("ez-sortable-list.emptyMessage");
|
|
41
|
+
this.entityLabel = this.i18n("ez-sortable-list.entityLabel");
|
|
42
|
+
this.entityLabelPlural = this.i18n("ez-sortable-list.entityLabelPlural");
|
|
43
|
+
}
|
|
37
44
|
componentDidLoad() {
|
|
38
45
|
this.initSortable();
|
|
39
46
|
}
|
|
@@ -174,7 +181,7 @@ export class EzSortableList {
|
|
|
174
181
|
}
|
|
175
182
|
}
|
|
176
183
|
buildTotalizer() {
|
|
177
|
-
return
|
|
184
|
+
return `${this.i18n("ez-sortable-list.total")} ${this.dataSource.length} ${this.dataSource.length === 1 ? this.entityLabel : this.entityLabelPlural}`;
|
|
178
185
|
}
|
|
179
186
|
renderItems() {
|
|
180
187
|
const itemsToRender = ArrayUtils.applyStringFilter(this.filterTerm, this.dataSource);
|
|
@@ -196,7 +203,7 @@ export class EzSortableList {
|
|
|
196
203
|
renderHeader() {
|
|
197
204
|
if (this.hideHeader)
|
|
198
205
|
return;
|
|
199
|
-
return (h("div", { class: 'sortable-header' }, h("span", { class: 'sortable-label' }, this.title), h("ez-filter-input", { label:
|
|
206
|
+
return (h("div", { class: 'sortable-header' }, h("span", { class: 'sortable-label' }, this.title), h("ez-filter-input", { label: `${this.i18n("ez-sortable-list.search")} ${this.entityLabel}`, mode: "slim", onEzChange: evt => this.handleFilterChanged(evt) })));
|
|
200
207
|
}
|
|
201
208
|
render() {
|
|
202
209
|
return (h("div", { class: 'sortable-content' }, this.renderHeader(), h("div", { class: `sortable-list ${this.dataSource.length < 1 ? 'empty-content' : ''} list-scroller--fix`, "data-content": this.emptyMessage, style: { '--empty-content': `"${this.emptyMessage}"` }, id: this.idSortableList, key: this.idSortableList }, this.renderItems()), this.renderTotalizer()));
|
|
@@ -342,8 +349,7 @@ export class EzSortableList {
|
|
|
342
349
|
"text": "Nome da entidade listada.\nExemplo: \"Campo\", \"Item\", \"Empresa\"."
|
|
343
350
|
},
|
|
344
351
|
"attribute": "entity-label",
|
|
345
|
-
"reflect": false
|
|
346
|
-
"defaultValue": "'item'"
|
|
352
|
+
"reflect": false
|
|
347
353
|
},
|
|
348
354
|
"entityLabelPlural": {
|
|
349
355
|
"type": "string",
|
|
@@ -360,8 +366,7 @@ export class EzSortableList {
|
|
|
360
366
|
"text": "Varia\u00E7\u00E3o plural do nome da entidade listada.\nExemplo: \"Campos\", \"Itens\", \"Empresas\"."
|
|
361
367
|
},
|
|
362
368
|
"attribute": "entity-label-plural",
|
|
363
|
-
"reflect": false
|
|
364
|
-
"defaultValue": "'itens'"
|
|
369
|
+
"reflect": false
|
|
365
370
|
},
|
|
366
371
|
"emptyMessage": {
|
|
367
372
|
"type": "string",
|
|
@@ -378,8 +383,7 @@ export class EzSortableList {
|
|
|
378
383
|
"text": "Mensagem exibida quando a lista est\u00E1 vazia"
|
|
379
384
|
},
|
|
380
385
|
"attribute": "empty-message",
|
|
381
|
-
"reflect": false
|
|
382
|
-
"defaultValue": "'Nenhum item na lista'"
|
|
386
|
+
"reflect": false
|
|
383
387
|
},
|
|
384
388
|
"hoverFeedback": {
|
|
385
389
|
"type": "boolean",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h } from '@stencil/core';
|
|
3
|
+
import initI18n from '../../utils/i18n';
|
|
3
4
|
export class EzSplitButton {
|
|
4
5
|
constructor() {
|
|
5
|
-
this.rightDefaultTitle = 'Mais opções';
|
|
6
6
|
this.show = false;
|
|
7
7
|
this.enabled = true;
|
|
8
8
|
this.iconName = undefined;
|
|
@@ -10,7 +10,7 @@ export class EzSplitButton {
|
|
|
10
10
|
this.items = undefined;
|
|
11
11
|
this.label = undefined;
|
|
12
12
|
this.leftTitle = undefined;
|
|
13
|
-
this.rightTitle =
|
|
13
|
+
this.rightTitle = undefined;
|
|
14
14
|
this.mode = 'default';
|
|
15
15
|
this.size = 'medium';
|
|
16
16
|
this.itemBuilder = undefined;
|
|
@@ -123,7 +123,8 @@ export class EzSplitButton {
|
|
|
123
123
|
window.removeEventListener('scroll', this.positionDropdown.bind(this));
|
|
124
124
|
window.addEventListener('scroll', this.positionDropdown.bind(this));
|
|
125
125
|
}
|
|
126
|
-
componentWillLoad() {
|
|
126
|
+
async componentWillLoad() {
|
|
127
|
+
this.i18n = await initI18n();
|
|
127
128
|
this.setEvents();
|
|
128
129
|
}
|
|
129
130
|
componentWillRender() {
|
|
@@ -149,7 +150,7 @@ export class EzSplitButton {
|
|
|
149
150
|
const hasIconButton = this.shouldShowIconOnLeftButton();
|
|
150
151
|
const hasLabelButton = this.shouldShowLabelOnLeftButton();
|
|
151
152
|
const iconSize = this.getIconSize();
|
|
152
|
-
return (h("div", { class: "label-icon" }, h("button", { class: `ez-split-button__left-button ${iconSize} ${this.mode}`, title: this.leftTitle || this.label, type: "button", disabled: !this.enabled, onClick: () => { this.handleButtonClick(); }, ref: el => (this.leftButton = el) }, hasIconButton && h("ez-icon", { href: this.image, iconName: this.iconName, size: iconSize }), hasLabelButton && h("label", { title: this.leftTitle || this.label }, this.label)), h("div", { class: "dropdown" }, h("button", { class: `ez-split-button__right-button ${iconSize} ez-split-button__right-button--${iconSize} ez-split-button__right-button--divider`, title: this.rightTitle || this.
|
|
153
|
+
return (h("div", { class: "label-icon" }, h("button", { class: `ez-split-button__left-button ${iconSize} ${this.mode}`, title: this.leftTitle || this.label, type: "button", disabled: !this.enabled, onClick: () => { this.handleButtonClick(); }, ref: el => (this.leftButton = el) }, hasIconButton && h("ez-icon", { href: this.image, iconName: this.iconName, size: iconSize }), hasLabelButton && h("label", { title: this.leftTitle || this.label }, this.label)), h("div", { class: "dropdown" }, h("button", { class: `ez-split-button__right-button ${iconSize} ez-split-button__right-button--${iconSize} ez-split-button__right-button--divider`, title: this.rightTitle || this.i18n("ez-split-button.moreOptions"), type: "button", disabled: !this.enabled, onClick: () => { this.toggleDropdown(); }, ref: el => (this.rightButton = el) }, h("ez-icon", { class: `ez-split-button__right-button-container ` + (iconSize ? `btn-icon--${iconSize}` : ''), iconName: 'chevron-down', size: iconSize })), h("div", { class: `dropdown-content dropdown-content--${this.size}`, ref: (ref) => (this.dropdownParent = ref) }, this.show && (h("ez-dropdown", { items: this.items, onClick: evt => { evt.stopPropagation(); }, onEzOutsideClick: () => { this.closeDropdown(); }, onEzClick: evt => { this.handleDropdownItemClick(evt); }, onEzSubActionClick: evt => { this.handleDropdownSubActionClick(evt); }, itemBuilder: this.itemBuilder }))))));
|
|
153
154
|
}
|
|
154
155
|
shouldShowLabelOnLeftButton() {
|
|
155
156
|
return ['icon-left', 'default'].includes(this.mode);
|
|
@@ -313,8 +314,7 @@ export class EzSplitButton {
|
|
|
313
314
|
"text": "Texto a ser apresentado como title do bot\u00E3o dropdown"
|
|
314
315
|
},
|
|
315
316
|
"attribute": "right-title",
|
|
316
|
-
"reflect": true
|
|
317
|
-
"defaultValue": "'Mais op\u00E7\u00F5es'"
|
|
317
|
+
"reflect": true
|
|
318
318
|
},
|
|
319
319
|
"mode": {
|
|
320
320
|
"type": "string",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
2
|
import { CSSVarsUtils } from '../../../../utils';
|
|
3
|
+
import initI18n from '../../../../utils/i18n';
|
|
3
4
|
export class SplitItem {
|
|
4
5
|
constructor() {
|
|
5
6
|
this.label = undefined;
|
|
@@ -16,11 +17,14 @@ export class SplitItem {
|
|
|
16
17
|
this._expanded = !this._expanded;
|
|
17
18
|
(_b = (_a = this.expandButtonRef.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('button')) === null || _b === void 0 ? void 0 : _b.blur();
|
|
18
19
|
}
|
|
20
|
+
async componentWillLoad() {
|
|
21
|
+
this.i18n = await initI18n();
|
|
22
|
+
}
|
|
19
23
|
componentDidLoad() {
|
|
20
24
|
CSSVarsUtils.applyVarsGrid(this._element, this._slot.children[0]);
|
|
21
25
|
}
|
|
22
26
|
render() {
|
|
23
|
-
return (h(Host, { class: `box_split-item ${this._expanded ? 'expanded__item' : ''} ${this.structural ? 'structural__item' : 'content__item'}`, ref: el => (this._element = el) }, h("div", { class: "ez-split-item--header" }, h("slot", { name: "leftButtons" }), h("div", { class: "ez-split-item--header-title" }, this.label && (h("h3", { class: "ez-text ez-text--primary ez-title ez-title--medium ez-margin--small", title: this.label }, this.label))), h("div", { class: "ez-split-item--header-buttons" }, h("slot", { name: "rightButtons" }), this.enableExpand && (h("ez-button", { ref: el => this.expandButtonRef = el, size: "small", mode: "icon", iconName: "expand", class: 'ez-button--tertiary', onClick: () => this.toggleExpandItem(), title: this._expanded ? '
|
|
27
|
+
return (h(Host, { class: `box_split-item ${this._expanded ? 'expanded__item' : ''} ${this.structural ? 'structural__item' : 'content__item'}`, ref: el => (this._element = el) }, h("div", { class: "ez-split-item--header" }, h("slot", { name: "leftButtons" }), h("div", { class: "ez-split-item--header-title" }, this.label && (h("h3", { class: "ez-text ez-text--primary ez-title ez-title--medium ez-margin--small", title: this.label }, this.label))), h("div", { class: "ez-split-item--header-buttons" }, h("slot", { name: "rightButtons" }), this.enableExpand && (h("ez-button", { ref: el => this.expandButtonRef = el, size: "small", mode: "icon", iconName: "expand", class: 'ez-button--tertiary', onClick: () => this.toggleExpandItem(), title: this._expanded ? this.i18n('app.collapse') : this.i18n('app.expand') })))), h("div", { class: "ez-split-item--content grid_height-0", ref: el => (this._slot = el) }, h("slot", null))));
|
|
24
28
|
}
|
|
25
29
|
static get is() { return "ez-split-item"; }
|
|
26
30
|
static get originalStyleUrls() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils } from "../../utils";
|
|
4
|
+
import initI18n from '../../utils/i18n';
|
|
4
5
|
export class EzTextEdit {
|
|
5
6
|
constructor() {
|
|
6
7
|
this._newValue = undefined;
|
|
@@ -63,7 +64,7 @@ export class EzTextEdit {
|
|
|
63
64
|
}
|
|
64
65
|
handleSaveEdition() {
|
|
65
66
|
if (!this._newValue) {
|
|
66
|
-
ApplicationUtils.alert("
|
|
67
|
+
ApplicationUtils.alert(this.i18n("app.warning"), this.i18n("ez-text-edit.emptyFieldWarning")).then(() => {
|
|
67
68
|
this.setNewValue(this.value, true);
|
|
68
69
|
});
|
|
69
70
|
return;
|
|
@@ -77,6 +78,9 @@ export class EzTextEdit {
|
|
|
77
78
|
this._newValue = value;
|
|
78
79
|
this.calcSizeInput(this._newValue, setSelect);
|
|
79
80
|
}
|
|
81
|
+
async componentWillLoad() {
|
|
82
|
+
this.i18n = await initI18n();
|
|
83
|
+
}
|
|
80
84
|
componentDidLoad() {
|
|
81
85
|
this.applyFocusSelect();
|
|
82
86
|
this.setNewValue(this.value);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { TimeFormatter, MaskFormatter, NumberUtils, ElementIDUtils } from "@sankhyalabs/core";
|
|
3
3
|
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
4
|
+
import initI18n from '../../utils/i18n';
|
|
4
5
|
export class EzTimeInput {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.label = undefined;
|
|
@@ -41,7 +42,7 @@ export class EzTimeInput {
|
|
|
41
42
|
this._viewValue = newValueValidated == undefined ? "" : newValueValidated.toString();
|
|
42
43
|
this.prepareValue(this._viewValue);
|
|
43
44
|
if (this._viewValue && !TimeFormatter.validateTime(this._viewValue, this.showSeconds)) {
|
|
44
|
-
this.setError("
|
|
45
|
+
this.setError(this.i18n("ez-time-input.invalidTime"));
|
|
45
46
|
newValueValidated = undefined;
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
@@ -130,15 +131,8 @@ export class EzTimeInput {
|
|
|
130
131
|
//---------------------------------------------
|
|
131
132
|
// Lifecycle web component
|
|
132
133
|
//---------------------------------------------
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (this.autoFocus) {
|
|
136
|
-
requestAnimationFrame(() => {
|
|
137
|
-
this.setFocus({ selectText: true });
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
componentWillLoad() {
|
|
134
|
+
async componentWillLoad() {
|
|
135
|
+
this.i18n = await initI18n();
|
|
142
136
|
this.observeShowSeconds();
|
|
143
137
|
if (this.value) {
|
|
144
138
|
this.prepareValue(this.value.toString());
|
|
@@ -147,6 +141,14 @@ export class EzTimeInput {
|
|
|
147
141
|
this.prepareValue(this._viewValue);
|
|
148
142
|
}
|
|
149
143
|
}
|
|
144
|
+
componentDidLoad() {
|
|
145
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
146
|
+
if (this.autoFocus) {
|
|
147
|
+
requestAnimationFrame(() => {
|
|
148
|
+
this.setFocus({ selectText: true });
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
150
152
|
render() {
|
|
151
153
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
152
154
|
return (h(Host, null, h("ez-text-input", { class: "time__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: (el) => this._textInput = el, "data-slave-mode": "true", value: this._viewValue, enabled: this.enabled, label: this.label, restrict: "0123456789:", onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError, alternativePlaceholder: this.alternativePlaceholder }, h("ez-icon", { slot: "leftIcon", iconName: "timer-outline" }))));
|
|
@@ -3,6 +3,7 @@ import { forceUpdate, h, Host } from '@stencil/core';
|
|
|
3
3
|
import { defaultIconResolver, defaultTooltipResolver } from './subcomponents';
|
|
4
4
|
import { TreeItem } from './subcomponents/TreeItem';
|
|
5
5
|
import { Tree } from './types/Tree';
|
|
6
|
+
import initI18n from '../../utils/i18n';
|
|
6
7
|
export class EzTree {
|
|
7
8
|
constructor() {
|
|
8
9
|
this._onItemClick = (item) => {
|
|
@@ -253,6 +254,9 @@ export class EzTree {
|
|
|
253
254
|
this._tree.load(this.items);
|
|
254
255
|
}
|
|
255
256
|
}
|
|
257
|
+
async componentWillLoad() {
|
|
258
|
+
this.i18n = await initI18n();
|
|
259
|
+
}
|
|
256
260
|
componentWillRender() {
|
|
257
261
|
var _a;
|
|
258
262
|
if (!this.selectedId || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.id) === this.selectedId) {
|
|
@@ -270,7 +274,7 @@ export class EzTree {
|
|
|
270
274
|
}
|
|
271
275
|
this._visibleItems = [];
|
|
272
276
|
return (h(Host, { tabindex: "-1" }, this._waintingForLoad ?
|
|
273
|
-
h("label", null, "
|
|
277
|
+
h("label", null, this.i18n("app.loading"), "...")
|
|
274
278
|
:
|
|
275
279
|
this._tree.getChildren().map(node => {
|
|
276
280
|
var _a;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { h, forceUpdate } from "@stencil/core";
|
|
2
|
-
import ApplicationUtils from "../../utils/ApplicationUtils";
|
|
3
1
|
import { ElementIDUtils } from "@sankhyalabs/core";
|
|
2
|
+
import { forceUpdate, h } from "@stencil/core";
|
|
3
|
+
import ApplicationUtils from "../../utils/ApplicationUtils";
|
|
4
|
+
import initI18n from "../../utils/i18n";
|
|
4
5
|
import RemoteFile from "./RemoteFile";
|
|
5
6
|
export class EzUpload {
|
|
6
7
|
constructor() {
|
|
@@ -61,7 +62,7 @@ export class EzUpload {
|
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
if (countDistinctFiles > this.maxFiles) {
|
|
64
|
-
this.showError(
|
|
65
|
+
this.showError(this.i18n("ez-upload.maxFilesError", { maxFiles: this.maxFiles }));
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
@@ -82,8 +83,7 @@ export class EzUpload {
|
|
|
82
83
|
async addFile(file) {
|
|
83
84
|
const oldFile = this._filePointers.get(file.name);
|
|
84
85
|
if (oldFile) {
|
|
85
|
-
ApplicationUtils.confirm("
|
|
86
|
-
.then(ok => {
|
|
86
|
+
ApplicationUtils.confirm(this.i18n("ez-upload.replaceFileTitle"), this.i18n("ez-upload.replaceFileMessage", { fileName: file.name })).then(ok => {
|
|
87
87
|
if (ok) {
|
|
88
88
|
if (this.isRemoteFile(oldFile)) {
|
|
89
89
|
oldFile.abortUpload();
|
|
@@ -99,7 +99,10 @@ export class EzUpload {
|
|
|
99
99
|
async doAddFile(file) {
|
|
100
100
|
try {
|
|
101
101
|
if (this.validateFile(file)) {
|
|
102
|
-
this.ezStartChange.emit({
|
|
102
|
+
this.ezStartChange.emit({
|
|
103
|
+
waitmessage: this.i18n("ez-upload.uploadingMessage"),
|
|
104
|
+
blocking: true
|
|
105
|
+
});
|
|
103
106
|
const uploadingFile = new RemoteFile(file);
|
|
104
107
|
const oldPointer = this._filePointers.get(file.name);
|
|
105
108
|
if (oldPointer && this.isRemoteFile(oldPointer)) {
|
|
@@ -152,25 +155,25 @@ export class EzUpload {
|
|
|
152
155
|
}
|
|
153
156
|
validateFile(file) {
|
|
154
157
|
if (!this._filePointers.has(file.name) && this.maxFiles > 0 && this._filePointers.size >= this.maxFiles) {
|
|
155
|
-
this.showError(
|
|
158
|
+
this.showError(this.i18n("ez-upload.maxFilesError", { maxFiles: this.maxFiles }));
|
|
156
159
|
return false;
|
|
157
160
|
}
|
|
158
161
|
if (file.size === 0) {
|
|
159
|
-
this.showError(
|
|
162
|
+
this.showError(this.i18n("ez-upload.emptyFileError", { fileName: file.name }));
|
|
160
163
|
return false;
|
|
161
164
|
}
|
|
162
165
|
if (!this.urlUpload) {
|
|
163
|
-
this.showError("
|
|
166
|
+
this.showError(this.i18n("ez-upload.missingUploadUrlError"));
|
|
164
167
|
return false;
|
|
165
168
|
}
|
|
166
169
|
if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
|
|
167
|
-
this.showError("
|
|
170
|
+
this.showError(this.i18n("ez-upload.maxFileSizeError", { maxSize: this.formatBytes(this.maxFileSize) }));
|
|
168
171
|
return false;
|
|
169
172
|
}
|
|
170
173
|
return true;
|
|
171
174
|
}
|
|
172
175
|
showError(message) {
|
|
173
|
-
ApplicationUtils.alert("
|
|
176
|
+
ApplicationUtils.alert(this.i18n("ez-upload.uploadErrorTitle"), message);
|
|
174
177
|
}
|
|
175
178
|
formatBytes(bytes, decimals = 1) {
|
|
176
179
|
if (bytes === 0)
|
|
@@ -247,8 +250,11 @@ export class EzUpload {
|
|
|
247
250
|
}
|
|
248
251
|
}
|
|
249
252
|
}
|
|
253
|
+
async componentWillLoad() {
|
|
254
|
+
this.i18n = await initI18n();
|
|
255
|
+
}
|
|
250
256
|
render() {
|
|
251
|
-
return (h("div", { ref: (el) => this._dropZone = el, class: this.evalDisabledClass("iu", "background--disabled") }, h("div", { class: "iu__container", onClick: () => this.openFilesDialog() }, h("div", { class: "iu_header" }, this.label ? h("label", { class: this.evalDisabledClass("iu__label", "text--disabled"), title: this.label }, this.label) : null, h("div", { class: "padding-large" }, h("div", { class: this.evalDisabledClass("iu__icon-label", "mouse-pointer--disabled") }, h("button", { class: "iu__file-icon", disabled: !this.enabled }), h("div", { class: this.evalDisabledClass("text text--center text--medium text--primary", "text--disabled") }, this.enabled ? "
|
|
257
|
+
return (h("div", { ref: (el) => this._dropZone = el, class: this.evalDisabledClass("iu", "background--disabled") }, h("div", { class: "iu__container", onClick: () => this.openFilesDialog() }, h("div", { class: "iu_header" }, this.label ? h("label", { class: this.evalDisabledClass("iu__label", "text--disabled"), title: this.label }, this.label) : null, h("div", { class: "padding-large" }, h("div", { class: this.evalDisabledClass("iu__icon-label", "mouse-pointer--disabled") }, h("button", { class: "iu__file-icon", disabled: !this.enabled }), h("div", { class: this.evalDisabledClass("text text--center text--medium text--primary", "text--disabled") }, this.enabled ? this.i18n("ez-upload.enable") : this.i18n("ez-upload.disable"))), this.subtitle &&
|
|
252
258
|
h("div", { class: this.evalDisabledClass("padding-extra-small text text--center text--small text--secondary", "text--disabled") }, this.subtitle))), this.buildFooter()), h("input", { ref: (el) => this._fileInput = el, onChange: (ev) => this.onFileInputChange(ev), type: "file", multiple: true, class: "appearanceNone" })));
|
|
253
259
|
}
|
|
254
260
|
buildFooter() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
global.ResizeObserver = require('resize-observer-polyfill')
|
|
1
|
+
global.ResizeObserver = require('resize-observer-polyfill');
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { v4 as uuid } from "uuid";
|
|
2
2
|
import { DialogType } from "../components/ez-dialog/DialogType";
|
|
3
|
+
import initI18n from "./i18n";
|
|
3
4
|
export default class ApplicationUtils {
|
|
5
|
+
static async getDefaultMessageOptions() {
|
|
6
|
+
if (!this.i18n) {
|
|
7
|
+
this.i18n = await initI18n();
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
canClose: true,
|
|
11
|
+
labelCancel: this.i18n("app.no"),
|
|
12
|
+
labelConfirm: this.i18n("app.yes"),
|
|
13
|
+
btnConfirmDanger: false
|
|
14
|
+
};
|
|
15
|
+
}
|
|
4
16
|
static async showDialog(title, message, icon = null, confirm, dialogType = DialogType.DEFAULT, options) {
|
|
5
17
|
if (options) {
|
|
6
|
-
|
|
18
|
+
const defaultMessageOptions = await this.getDefaultMessageOptions();
|
|
19
|
+
options = Object.assign(Object.assign({}, defaultMessageOptions), options);
|
|
7
20
|
}
|
|
8
21
|
return new Promise(resolve => {
|
|
9
22
|
let dialog = document.createElement("ez-dialog");
|
|
@@ -15,24 +28,45 @@ export default class ApplicationUtils {
|
|
|
15
28
|
});
|
|
16
29
|
});
|
|
17
30
|
}
|
|
18
|
-
static async alert(title, message, icon = null, options
|
|
31
|
+
static async alert(title, message, icon = null, options) {
|
|
32
|
+
if (!options) {
|
|
33
|
+
const defaultMessageOptions = await this.getDefaultMessageOptions();
|
|
34
|
+
options = defaultMessageOptions;
|
|
35
|
+
}
|
|
19
36
|
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.WARN, options);
|
|
20
37
|
}
|
|
21
|
-
static async error(title, message, icon = null, options
|
|
38
|
+
static async error(title, message, icon = null, options) {
|
|
39
|
+
if (!options) {
|
|
40
|
+
const defaultMessageOptions = await this.getDefaultMessageOptions();
|
|
41
|
+
options = defaultMessageOptions;
|
|
42
|
+
}
|
|
22
43
|
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.CRITICAL, options);
|
|
23
44
|
}
|
|
24
|
-
static async success(title, message, icon = null, options
|
|
45
|
+
static async success(title, message, icon = null, options) {
|
|
46
|
+
if (!options) {
|
|
47
|
+
const defaultMessageOptions = await this.getDefaultMessageOptions();
|
|
48
|
+
options = defaultMessageOptions;
|
|
49
|
+
}
|
|
25
50
|
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.SUCCESS, options);
|
|
26
51
|
}
|
|
27
|
-
static async confirm(title, message, icon = null, dialogType = DialogType.WARN, options
|
|
52
|
+
static async confirm(title, message, icon = null, dialogType = DialogType.WARN, options) {
|
|
53
|
+
if (!options) {
|
|
54
|
+
const defaultMessageOptions = await this.getDefaultMessageOptions();
|
|
55
|
+
options = defaultMessageOptions;
|
|
56
|
+
}
|
|
28
57
|
return ApplicationUtils.showDialog(title, message, icon, true, dialogType, options);
|
|
29
58
|
}
|
|
30
|
-
static async message(title, message, icon = null, options
|
|
59
|
+
static async message(title, message, icon = null, options) {
|
|
60
|
+
if (!options) {
|
|
61
|
+
const defaultMessageOptions = await this.getDefaultMessageOptions();
|
|
62
|
+
options = defaultMessageOptions;
|
|
63
|
+
}
|
|
31
64
|
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.DEFAULT, options);
|
|
32
65
|
}
|
|
33
|
-
static async info(message, options
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
static async info(message, options) {
|
|
67
|
+
const defaultMessageOptions = await this.getDefaultMessageOptions();
|
|
68
|
+
if (options !== defaultMessageOptions) {
|
|
69
|
+
options = Object.assign(Object.assign({}, defaultMessageOptions), options);
|
|
36
70
|
}
|
|
37
71
|
let useIcon = false;
|
|
38
72
|
let toast = document.querySelector("ez-toast");
|
|
@@ -120,12 +154,6 @@ export default class ApplicationUtils {
|
|
|
120
154
|
alertList.alerts = props.alerts;
|
|
121
155
|
}
|
|
122
156
|
}
|
|
123
|
-
ApplicationUtils.defaultMessageOptions = {
|
|
124
|
-
canClose: true,
|
|
125
|
-
labelCancel: 'Não',
|
|
126
|
-
labelConfirm: 'Sim',
|
|
127
|
-
btnConfirmDanger: false
|
|
128
|
-
};
|
|
129
157
|
ApplicationUtils.defaultModalProps = {
|
|
130
158
|
content: null,
|
|
131
159
|
position: 'right',
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ELanguages } from "./elanguages";
|
|
2
|
+
export function getDocumentLang() {
|
|
3
|
+
if (process.env.NODE_ENV === 'development') {
|
|
4
|
+
return ELanguages.PT_BR;
|
|
5
|
+
}
|
|
6
|
+
const lang = document.documentElement.lang || navigator.language || "pt-BR";
|
|
7
|
+
switch (lang.toLocaleLowerCase()) {
|
|
8
|
+
case "en":
|
|
9
|
+
case "en_us":
|
|
10
|
+
case "en-us":
|
|
11
|
+
return ELanguages.EN_US;
|
|
12
|
+
case "es":
|
|
13
|
+
case "es_es":
|
|
14
|
+
case "es-es":
|
|
15
|
+
return ELanguages.ES_ES;
|
|
16
|
+
default:
|
|
17
|
+
return ELanguages.PT_BR;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as i18nNext } from 'i18next';
|
|
2
|
+
import LanguageDetector from "i18next-browser-languagedetector";
|
|
3
|
+
import translations from "./translations";
|
|
4
|
+
import { ELanguages } from './elanguages';
|
|
5
|
+
import { getDocumentLang } from './i18nUtils';
|
|
6
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
7
|
+
const KEY_I18N = "__EZ_UI_I18N_INSTANCE__";
|
|
8
|
+
export function getI18n() {
|
|
9
|
+
let i18nInstance = ApplicationContext.getContextValue(KEY_I18N);
|
|
10
|
+
return i18nInstance;
|
|
11
|
+
}
|
|
12
|
+
const initI18n = async (forceLang) => {
|
|
13
|
+
let i18nTFunction = getI18n();
|
|
14
|
+
if (!i18nTFunction) {
|
|
15
|
+
const i18nInstance = i18nNext.createInstance();
|
|
16
|
+
const i18nextOptions = {
|
|
17
|
+
resources: translations,
|
|
18
|
+
fallbackLng: ELanguages.PT_BR
|
|
19
|
+
};
|
|
20
|
+
await i18nInstance
|
|
21
|
+
.use(LanguageDetector)
|
|
22
|
+
.init(i18nextOptions);
|
|
23
|
+
const lang = forceLang !== null && forceLang !== void 0 ? forceLang : getDocumentLang();
|
|
24
|
+
await i18nInstance.changeLanguage(lang);
|
|
25
|
+
ApplicationContext.setContextValue(KEY_I18N, i18nInstance.t);
|
|
26
|
+
i18nTFunction = i18nInstance.t;
|
|
27
|
+
}
|
|
28
|
+
return i18nTFunction;
|
|
29
|
+
};
|
|
30
|
+
export default initI18n;
|