@zeedhi/common 1.118.0 → 1.120.0
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/types/components/index.d.ts +151 -0
- package/dist/types/components/zd-alert/alert.d.ts +94 -0
- package/dist/types/components/zd-alert/interfaces.d.ts +18 -0
- package/dist/types/components/zd-badge/badge.d.ts +28 -0
- package/dist/types/components/zd-badge/interfaces.d.ts +10 -0
- package/dist/types/components/zd-breadcrumbs/breadcrumbs.d.ts +32 -0
- package/dist/types/components/zd-breadcrumbs/interfaces.d.ts +24 -0
- package/dist/types/components/zd-button/button.d.ts +89 -0
- package/dist/types/components/zd-button/interfaces.d.ts +48 -0
- package/dist/types/components/zd-button-group/button-group.d.ts +67 -0
- package/dist/types/components/zd-button-group/interfaces.d.ts +25 -0
- package/dist/types/components/zd-card/card.d.ts +152 -0
- package/dist/types/components/zd-card/interfaces.d.ts +40 -0
- package/dist/types/components/zd-carousel/carousel.d.ts +163 -0
- package/dist/types/components/zd-carousel/interfaces.d.ts +49 -0
- package/dist/types/components/zd-checkbox/checkbox.d.ts +12 -0
- package/dist/types/components/zd-checkbox/interfaces.d.ts +5 -0
- package/dist/types/components/zd-checkbox-multiple/checkbox-multiple.d.ts +39 -0
- package/dist/types/components/zd-checkbox-multiple/interfaces.d.ts +13 -0
- package/dist/types/components/zd-chip/chip.d.ts +60 -0
- package/dist/types/components/zd-chip/interfaces.d.ts +18 -0
- package/dist/types/components/zd-code-viewer/code-viewer.d.ts +86 -0
- package/dist/types/components/zd-code-viewer/interfaces.d.ts +13 -0
- package/dist/types/components/zd-col/col.d.ts +33 -0
- package/dist/types/components/zd-col/interfaces.d.ts +15 -0
- package/dist/types/components/zd-collapse-card/collapse-card.d.ts +56 -0
- package/dist/types/components/zd-collapse-card/interfaces.d.ts +14 -0
- package/dist/types/components/zd-component/child-not-found.d.ts +6 -0
- package/dist/types/components/zd-component/component-render.d.ts +16 -0
- package/dist/types/components/zd-component/component.d.ts +120 -0
- package/dist/types/components/zd-component/interfaces.d.ts +74 -0
- package/dist/types/components/zd-container/container.d.ts +45 -0
- package/dist/types/components/zd-container/interfaces.d.ts +12 -0
- package/dist/types/components/zd-currency/currency.d.ts +12 -0
- package/dist/types/components/zd-currency/interfaces.d.ts +6 -0
- package/dist/types/components/zd-date-input/date-input.d.ts +152 -0
- package/dist/types/components/zd-date-input/interfaces.d.ts +27 -0
- package/dist/types/components/zd-date-range/date-range.d.ts +158 -0
- package/dist/types/components/zd-date-range/interfaces.d.ts +18 -0
- package/dist/types/components/zd-dialog/dialog.d.ts +76 -0
- package/dist/types/components/zd-dialog/interfaces.d.ts +13 -0
- package/dist/types/components/zd-divider/divider.d.ts +20 -0
- package/dist/types/components/zd-divider/interfaces.d.ts +8 -0
- package/dist/types/components/zd-dropdown/dropdown.d.ts +81 -0
- package/dist/types/components/zd-dropdown/interfaces.d.ts +23 -0
- package/dist/types/components/zd-footer/footer.d.ts +80 -0
- package/dist/types/components/zd-footer/interfaces.d.ts +26 -0
- package/dist/types/components/zd-form/form.d.ts +174 -0
- package/dist/types/components/zd-form/interfaces.d.ts +36 -0
- package/dist/types/components/zd-frame/frame.d.ts +81 -0
- package/dist/types/components/zd-frame/interfaces.d.ts +23 -0
- package/dist/types/components/zd-frame-page/frame-page.d.ts +14 -0
- package/dist/types/components/zd-frame-page/interfaces.d.ts +4 -0
- package/dist/types/components/zd-grid/data-navigator.d.ts +12 -0
- package/dist/types/components/zd-grid/data-selector.d.ts +25 -0
- package/dist/types/components/zd-grid/grid-column.d.ts +47 -0
- package/dist/types/components/zd-grid/grid-events.d.ts +26 -0
- package/dist/types/components/zd-grid/grid.d.ts +85 -0
- package/dist/types/components/zd-grid/index.d.ts +11 -0
- package/dist/types/components/zd-grid/interfaces.d.ts +148 -0
- package/dist/types/components/zd-grid/iterable-table.d.ts +28 -0
- package/dist/types/components/zd-grid/keymap-merger.d.ts +26 -0
- package/dist/types/components/zd-grid/keymap-navigation.d.ts +6 -0
- package/dist/types/components/zd-grid/table-action-builder.d.ts +19 -0
- package/dist/types/components/zd-grid/view-navigator.d.ts +10 -0
- package/dist/types/components/zd-grid-editable/data-editor-with-add.d.ts +35 -0
- package/dist/types/components/zd-grid-editable/data-editor.d.ts +64 -0
- package/dist/types/components/zd-grid-editable/errors/index.d.ts +2 -0
- package/dist/types/components/zd-grid-editable/errors/not-editing.d.ts +6 -0
- package/dist/types/components/zd-grid-editable/errors/row-not-found.d.ts +6 -0
- package/dist/types/components/zd-grid-editable/grid-column-editable.d.ts +9 -0
- package/dist/types/components/zd-grid-editable/grid-editable-controller.d.ts +8 -0
- package/dist/types/components/zd-grid-editable/grid-editable-events.d.ts +32 -0
- package/dist/types/components/zd-grid-editable/grid-editable.d.ts +124 -0
- package/dist/types/components/zd-grid-editable/index.d.ts +8 -0
- package/dist/types/components/zd-grid-editable/interfaces.d.ts +66 -0
- package/dist/types/components/zd-grid-editable/keymap-editing.d.ts +7 -0
- package/dist/types/components/zd-header/header.d.ts +94 -0
- package/dist/types/components/zd-header/interfaces.d.ts +29 -0
- package/dist/types/components/zd-icon/icon.d.ts +55 -0
- package/dist/types/components/zd-icon/interfaces.d.ts +13 -0
- package/dist/types/components/zd-image/image.d.ts +73 -0
- package/dist/types/components/zd-image/interfaces.d.ts +17 -0
- package/dist/types/components/zd-increment/increment.d.ts +56 -0
- package/dist/types/components/zd-increment/interfaces.d.ts +9 -0
- package/dist/types/components/zd-input/input-factory.d.ts +6 -0
- package/dist/types/components/zd-input/input.d.ts +223 -0
- package/dist/types/components/zd-input/interfaces.d.ts +38 -0
- package/dist/types/components/zd-iterable/column-not-found.d.ts +6 -0
- package/dist/types/components/zd-iterable/column.d.ts +78 -0
- package/dist/types/components/zd-iterable/conditions-manager.d.ts +49 -0
- package/dist/types/components/zd-iterable/interfaces.d.ts +103 -0
- package/dist/types/components/zd-iterable/iterable-columns-button-controller.d.ts +9 -0
- package/dist/types/components/zd-iterable/iterable-columns-button.d.ts +35 -0
- package/dist/types/components/zd-iterable/iterable-controller.d.ts +8 -0
- package/dist/types/components/zd-iterable/iterable-page-component.d.ts +27 -0
- package/dist/types/components/zd-iterable/iterable-page-info.d.ts +7 -0
- package/dist/types/components/zd-iterable/iterable-page-size.d.ts +62 -0
- package/dist/types/components/zd-iterable/iterable-pagination.d.ts +28 -0
- package/dist/types/components/zd-iterable/iterable.d.ts +77 -0
- package/dist/types/components/zd-iterable/search.d.ts +31 -0
- package/dist/types/components/zd-iterable-component-render/interfaces.d.ts +34 -0
- package/dist/types/components/zd-iterable-component-render/iterable-component-render.d.ts +84 -0
- package/dist/types/components/zd-layout/interfaces.d.ts +7 -0
- package/dist/types/components/zd-layout/layout.d.ts +9 -0
- package/dist/types/components/zd-list/interfaces.d.ts +44 -0
- package/dist/types/components/zd-list/item-not-found.d.ts +6 -0
- package/dist/types/components/zd-list/list-group.d.ts +30 -0
- package/dist/types/components/zd-list/list-item.d.ts +46 -0
- package/dist/types/components/zd-list/list.d.ts +81 -0
- package/dist/types/components/zd-loading/interfaces.d.ts +7 -0
- package/dist/types/components/zd-loading/loading.d.ts +21 -0
- package/dist/types/components/zd-login/interfaces.d.ts +25 -0
- package/dist/types/components/zd-login/login-button.d.ts +50 -0
- package/dist/types/components/zd-login/login.d.ts +54 -0
- package/dist/types/components/zd-main/interfaces.d.ts +5 -0
- package/dist/types/components/zd-main/main.d.ts +7 -0
- package/dist/types/components/zd-master-detail/detail-not-found.d.ts +7 -0
- package/dist/types/components/zd-master-detail/interfaces.d.ts +10 -0
- package/dist/types/components/zd-master-detail/master-detail.d.ts +18 -0
- package/dist/types/components/zd-master-detail/master-not-found.d.ts +7 -0
- package/dist/types/components/zd-menu/interfaces.d.ts +68 -0
- package/dist/types/components/zd-menu/menu-button.d.ts +29 -0
- package/dist/types/components/zd-menu/menu-group.d.ts +61 -0
- package/dist/types/components/zd-menu/menu-link.d.ts +50 -0
- package/dist/types/components/zd-menu/menu-separator.d.ts +7 -0
- package/dist/types/components/zd-menu/menu.d.ts +199 -0
- package/dist/types/components/zd-modal/interfaces.d.ts +35 -0
- package/dist/types/components/zd-modal/modal-close-button.d.ts +28 -0
- package/dist/types/components/zd-modal/modal.d.ts +53 -0
- package/dist/types/components/zd-month/interfaces.d.ts +6 -0
- package/dist/types/components/zd-month/month.d.ts +33 -0
- package/dist/types/components/zd-number-input/interfaces.d.ts +8 -0
- package/dist/types/components/zd-number-input/number-input.d.ts +43 -0
- package/dist/types/components/zd-password/interfaces.d.ts +6 -0
- package/dist/types/components/zd-password/password.d.ts +17 -0
- package/dist/types/components/zd-progress/interfaces.d.ts +10 -0
- package/dist/types/components/zd-progress/progress.d.ts +41 -0
- package/dist/types/components/zd-radio/interfaces.d.ts +11 -0
- package/dist/types/components/zd-radio/radio.d.ts +35 -0
- package/dist/types/components/zd-row/interfaces.d.ts +13 -0
- package/dist/types/components/zd-row/row.d.ts +39 -0
- package/dist/types/components/zd-select/interfaces.d.ts +24 -0
- package/dist/types/components/zd-select/select.d.ts +238 -0
- package/dist/types/components/zd-select-multiple/interfaces.d.ts +18 -0
- package/dist/types/components/zd-select-multiple/select-multiple.d.ts +113 -0
- package/dist/types/components/zd-svg-map/interfaces.d.ts +26 -0
- package/dist/types/components/zd-svg-map/svg-map.d.ts +35 -0
- package/dist/types/components/zd-switch/interfaces.d.ts +7 -0
- package/dist/types/components/zd-switch/switch.d.ts +16 -0
- package/dist/types/components/zd-table/interfaces.d.ts +25 -0
- package/dist/types/components/zd-table/table.d.ts +42 -0
- package/dist/types/components/zd-tabs/interfaces.d.ts +40 -0
- package/dist/types/components/zd-tabs/tab-not-found.d.ts +11 -0
- package/dist/types/components/zd-tabs/tab.d.ts +57 -0
- package/dist/types/components/zd-tabs/tabs.d.ts +86 -0
- package/dist/types/components/zd-tag/interfaces.d.ts +7 -0
- package/dist/types/components/zd-tag/tag.d.ts +13 -0
- package/dist/types/components/zd-text/interfaces.d.ts +9 -0
- package/dist/types/components/zd-text/text.d.ts +8 -0
- package/dist/types/components/zd-text-input/interfaces.d.ts +23 -0
- package/dist/types/components/zd-text-input/text-input.d.ts +91 -0
- package/dist/types/components/zd-textarea/interfaces.d.ts +21 -0
- package/dist/types/components/zd-textarea/textarea.d.ts +71 -0
- package/dist/types/components/zd-time/interfaces.d.ts +22 -0
- package/dist/types/components/zd-time/time-format-selector.d.ts +8 -0
- package/dist/types/components/zd-time/time.d.ts +149 -0
- package/dist/types/components/zd-toggleable/interfaces.d.ts +6 -0
- package/dist/types/components/zd-toggleable/toggleable.d.ts +21 -0
- package/dist/types/components/zd-tooltip/interfaces.d.ts +18 -0
- package/dist/types/components/zd-tooltip/tooltip.d.ts +57 -0
- package/dist/types/components/zd-tree/interfaces.d.ts +107 -0
- package/dist/types/components/zd-tree/tree.d.ts +161 -0
- package/dist/types/components/zd-tree-grid/index.d.ts +6 -0
- package/dist/types/components/zd-tree-grid/interfaces.d.ts +35 -0
- package/dist/types/components/zd-tree-grid/iterable-tree.d.ts +10 -0
- package/dist/types/components/zd-tree-grid/keymap-tree.d.ts +7 -0
- package/dist/types/components/zd-tree-grid/tree-data-navigator.d.ts +10 -0
- package/dist/types/components/zd-tree-grid/tree-data-selector.d.ts +18 -0
- package/dist/types/components/zd-tree-grid/tree-grid.d.ts +119 -0
- package/dist/types/error/delete-rows.d.ts +7 -0
- package/dist/types/error/index.d.ts +3 -0
- package/dist/types/error/non-initialized.d.ts +7 -0
- package/dist/types/error/zeedhi-error.d.ts +6 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/services/index.d.ts +4 -0
- package/dist/types/services/zd-alert/alert-queue.d.ts +13 -0
- package/dist/types/services/zd-alert/alert-replace.d.ts +18 -0
- package/dist/types/services/zd-alert/alert-service.d.ts +45 -0
- package/dist/types/services/zd-alert/alert-stack.d.ts +9 -0
- package/dist/types/services/zd-alert/index.d.ts +5 -0
- package/dist/types/services/zd-alert/interfaces.d.ts +6 -0
- package/dist/types/services/zd-dialog/dialog-service.d.ts +24 -0
- package/dist/types/services/zd-loading/loading-service.d.ts +17 -0
- package/dist/types/services/zd-modal/modal-service.d.ts +39 -0
- package/dist/types/utils/data-value-out/data-value-out.d.ts +5 -0
- package/dist/types/utils/data-value-out/index.d.ts +2 -0
- package/dist/types/utils/data-value-out/interfaces.d.ts +8 -0
- package/dist/types/utils/datasource-searcher/datasource-searcher.d.ts +6 -0
- package/dist/types/utils/datasource-searcher/index.d.ts +2 -0
- package/dist/types/utils/datasource-searcher/interfaces.d.ts +5 -0
- package/dist/types/utils/icons/icons.d.ts +24 -0
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/omit/omit.d.ts +11 -0
- package/dist/types/utils/theme/theme.d.ts +34 -0
- package/dist/types/utils/tree-data-structure/index.d.ts +2 -0
- package/dist/types/utils/tree-data-structure/interfaces.d.ts +30 -0
- package/dist/types/utils/tree-data-structure/tree-data-structure.d.ts +155 -0
- package/dist/types/utils/unique-by/unique-by.d.ts +3 -0
- package/dist/zd-common.esm.js +87 -24
- package/dist/zd-common.js +13133 -0
- package/dist/zd-common.min.js +13133 -0
- package/dist/zd-common.umd.js +87 -24
- package/package.json +2 -2
- package/types/components/zd-apex-chart/apex-chart.d.ts +1 -1
- package/types/components/zd-apex-chart/interfaces.d.ts +1 -1
- package/types/components/zd-card/card.d.ts +1 -1
- package/types/components/zd-card/interfaces.d.ts +1 -1
- package/types/components/zd-carousel/carousel.d.ts +1 -1
- package/types/components/zd-carousel/interfaces.d.ts +1 -1
- package/types/components/zd-code-editor/code-editor.d.ts +1 -1
- package/types/components/zd-code-editor/interfaces.d.ts +1 -1
- package/types/components/zd-col/col.d.ts +1 -1
- package/types/components/zd-col/interfaces.d.ts +1 -1
- package/types/components/zd-container/container.d.ts +1 -1
- package/types/components/zd-container/interfaces.d.ts +1 -1
- package/types/components/zd-dashboard/dashboard.d.ts +1 -1
- package/types/components/zd-dashboard/interfaces.d.ts +1 -1
- package/types/components/zd-date/date-range.d.ts +24 -4
- package/types/components/zd-form/form.d.ts +1 -1
- package/types/components/zd-form/interfaces.d.ts +1 -1
- package/types/components/zd-frame/frame.d.ts +1 -1
- package/types/components/zd-frame/interfaces.d.ts +1 -1
- package/types/components/zd-grid/grid.d.ts +1 -1
- package/types/components/zd-grid/interfaces.d.ts +1 -1
- package/types/components/zd-image/image.d.ts +1 -1
- package/types/components/zd-image/interfaces.d.ts +1 -1
- package/types/components/zd-iterable-component-render/interfaces.d.ts +1 -1
- package/types/components/zd-iterable-component-render/iterable-component-render.d.ts +1 -1
- package/types/components/zd-list/interfaces.d.ts +1 -1
- package/types/components/zd-list/list.d.ts +1 -1
- package/types/components/zd-master-detail/interfaces.d.ts +1 -1
- package/types/components/zd-master-detail/master-detail.d.ts +1 -1
- package/types/components/zd-row/interfaces.d.ts +1 -1
- package/types/components/zd-row/row.d.ts +1 -1
- package/types/components/zd-selectable-list/interfaces.d.ts +1 -1
- package/types/components/zd-selectable-list/selectable-list.d.ts +1 -1
- package/types/components/zd-table/interfaces.d.ts +1 -1
- package/types/components/zd-table/table.d.ts +1 -1
- package/types/components/zd-tabs/interfaces.d.ts +1 -1
- package/types/components/zd-tabs/tabs.d.ts +1 -1
- package/types/components/zd-textarea/interfaces.d.ts +1 -1
- package/types/components/zd-textarea/textarea.d.ts +1 -1
- package/types/components/zd-tooltip/interfaces.d.ts +1 -0
- package/types/components/zd-tooltip/tooltip.d.ts +4 -0
- package/types/components/zd-tree/interfaces.d.ts +1 -1
- package/types/components/zd-tree/tree.d.ts +1 -1
- package/types/services/zd-json-cache/json-cache-service.d.ts +0 -12
package/dist/zd-common.umd.js
CHANGED
|
@@ -4335,6 +4335,13 @@
|
|
|
4335
4335
|
});
|
|
4336
4336
|
InputFactory.register('ZdDate', Date$1);
|
|
4337
4337
|
|
|
4338
|
+
const ERROR_MAP = {
|
|
4339
|
+
invalid_range: 'VALIDATION_INVALID_RANGE',
|
|
4340
|
+
incomplete_range: 'VALIDATION_INVALID_DATE',
|
|
4341
|
+
empty: 'VALIDATION_INVALID_DATE',
|
|
4342
|
+
invalid_date: 'VALIDATION_INVALID_DATE',
|
|
4343
|
+
none: '',
|
|
4344
|
+
};
|
|
4338
4345
|
class DateRange extends TextInput {
|
|
4339
4346
|
/* istanbul ignore next */
|
|
4340
4347
|
/**
|
|
@@ -4343,6 +4350,10 @@
|
|
|
4343
4350
|
*/
|
|
4344
4351
|
constructor(props) {
|
|
4345
4352
|
super(props);
|
|
4353
|
+
/**
|
|
4354
|
+
* Restricts which dates can be selected.
|
|
4355
|
+
*/
|
|
4356
|
+
this.allowedDates = undefined;
|
|
4346
4357
|
/**
|
|
4347
4358
|
* Input auto complete.
|
|
4348
4359
|
*/
|
|
@@ -4410,6 +4421,7 @@
|
|
|
4410
4421
|
this.parserFn = core.FormatterParserProvider.getParser('ZdDateRange');
|
|
4411
4422
|
this.previousHint = '';
|
|
4412
4423
|
this.previousPersistentHint = false;
|
|
4424
|
+
this.allowedDates = this.getInitValue('allowedDates', props.allowedDates, this.allowedDates);
|
|
4413
4425
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
|
|
4414
4426
|
this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
|
|
4415
4427
|
this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
|
|
@@ -4449,7 +4461,7 @@
|
|
|
4449
4461
|
* Character that will separate the two dates
|
|
4450
4462
|
*/
|
|
4451
4463
|
get splitter() {
|
|
4452
|
-
return core.I18n.translate(this.internalSplitter)
|
|
4464
|
+
return ` ${core.I18n.translate(this.internalSplitter).trim()} `;
|
|
4453
4465
|
}
|
|
4454
4466
|
set splitter(splitter) {
|
|
4455
4467
|
this.internalSplitter = splitter;
|
|
@@ -4512,36 +4524,79 @@
|
|
|
4512
4524
|
return format.replace(/[A-Za-z]/gi, '#');
|
|
4513
4525
|
}
|
|
4514
4526
|
setDateValue(displayValue) {
|
|
4515
|
-
const
|
|
4516
|
-
const values = this.
|
|
4517
|
-
|
|
4527
|
+
const lastDisplayValue = this.displayValue;
|
|
4528
|
+
const values = this.parser(displayValue);
|
|
4529
|
+
const validation = this.isValidDateArray(values);
|
|
4530
|
+
if (validation.isValid) {
|
|
4518
4531
|
this.internalDisplayValue = displayValue;
|
|
4519
4532
|
this.internalValue = this.parser(displayValue);
|
|
4520
4533
|
this.dateError = false;
|
|
4521
|
-
if (
|
|
4534
|
+
if (lastDisplayValue !== this.displayValue) {
|
|
4522
4535
|
this.change(this.value);
|
|
4536
|
+
}
|
|
4523
4537
|
}
|
|
4524
|
-
else {
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
this.change(this.value);
|
|
4538
|
+
else if (validation.errorType === 'empty') {
|
|
4539
|
+
this.internalDisplayValue = '';
|
|
4540
|
+
this.internalValue = [];
|
|
4541
|
+
if (lastDisplayValue !== this.displayValue) {
|
|
4542
|
+
this.change(this.value);
|
|
4530
4543
|
}
|
|
4531
|
-
this.dateError = !!displayValue;
|
|
4532
4544
|
}
|
|
4533
|
-
|
|
4545
|
+
else {
|
|
4546
|
+
this.dateError = validation.errorType;
|
|
4547
|
+
}
|
|
4548
|
+
this.value = this.internalValue;
|
|
4534
4549
|
}
|
|
4535
4550
|
/**
|
|
4536
4551
|
* Faz a validação do array de datas
|
|
4537
|
-
* @param
|
|
4538
|
-
* @param values o array de datas
|
|
4552
|
+
* @param values o array de datas formatadas de acordo com o dateFormat
|
|
4539
4553
|
* @returns true se todos os valores forem validados
|
|
4540
4554
|
* */
|
|
4541
|
-
isValidDateArray(
|
|
4542
|
-
if (!values || values.length
|
|
4543
|
-
return false;
|
|
4544
|
-
|
|
4555
|
+
isValidDateArray(values) {
|
|
4556
|
+
if (!values || values.length === 0 || values.every((value) => !value)) {
|
|
4557
|
+
return { isValid: false, errorType: 'empty' };
|
|
4558
|
+
}
|
|
4559
|
+
if (values.length === 1 && values[0] !== '') {
|
|
4560
|
+
return { isValid: false, errorType: 'incomplete_range' };
|
|
4561
|
+
}
|
|
4562
|
+
const invalidRange = !this.isAllowedRange(values);
|
|
4563
|
+
if (invalidRange) {
|
|
4564
|
+
return { isValid: false, errorType: 'invalid_range' };
|
|
4565
|
+
}
|
|
4566
|
+
const allDatesValid = values.every((value) => this.isValidDate(value, this.dateFormat));
|
|
4567
|
+
if (!allDatesValid) {
|
|
4568
|
+
return { isValid: false, errorType: 'invalid_date' };
|
|
4569
|
+
}
|
|
4570
|
+
return { isValid: true, errorType: 'none' };
|
|
4571
|
+
}
|
|
4572
|
+
isAllowedDate(value, format) {
|
|
4573
|
+
if (this.allowedDates === undefined)
|
|
4574
|
+
return true;
|
|
4575
|
+
const dateStr = core.dayjs(value, format).format(this.dateFormat);
|
|
4576
|
+
if (this.allowedDates instanceof Function) {
|
|
4577
|
+
return this.allowedDates(dateStr);
|
|
4578
|
+
}
|
|
4579
|
+
return this.allowedDates.includes(dateStr);
|
|
4580
|
+
}
|
|
4581
|
+
/**
|
|
4582
|
+
* Checks if a range is allowed
|
|
4583
|
+
* @param value range to be checked, must be in dateFormat
|
|
4584
|
+
*/
|
|
4585
|
+
isAllowedRange(value) {
|
|
4586
|
+
if (!this.allowedDates)
|
|
4587
|
+
return true;
|
|
4588
|
+
const startDate = core.dayjs(value[0], this.dateFormat);
|
|
4589
|
+
const endDate = core.dayjs(value[1], this.dateFormat);
|
|
4590
|
+
let currentDate = startDate;
|
|
4591
|
+
while (currentDate.isBefore(endDate) || currentDate.isSame(endDate)) {
|
|
4592
|
+
const dateToCheck = currentDate.format(this.dateFormat);
|
|
4593
|
+
const isAllowed = this.isAllowedDate(dateToCheck, this.dateFormat);
|
|
4594
|
+
if (!isAllowed) {
|
|
4595
|
+
return false;
|
|
4596
|
+
}
|
|
4597
|
+
currentDate = currentDate.add(1, 'day');
|
|
4598
|
+
}
|
|
4599
|
+
return true;
|
|
4545
4600
|
}
|
|
4546
4601
|
splitValues(value) {
|
|
4547
4602
|
let splitedValue = [];
|
|
@@ -4568,6 +4623,9 @@
|
|
|
4568
4623
|
const isValidMax = !maxDate || date.isBefore(maxDate) || date.isSame(maxDate);
|
|
4569
4624
|
if (!isValidMax)
|
|
4570
4625
|
return false;
|
|
4626
|
+
if (!this.isAllowedDate(value, format)) {
|
|
4627
|
+
return false;
|
|
4628
|
+
}
|
|
4571
4629
|
return true;
|
|
4572
4630
|
}
|
|
4573
4631
|
isValidFormatDate(value, format, strict = true) {
|
|
@@ -4612,7 +4670,10 @@
|
|
|
4612
4670
|
return parsedValue.sort((a, b) => (core.dayjs(a, this.dateFormat).isAfter(core.dayjs(b, this.dateFormat)) ? 1 : -1));
|
|
4613
4671
|
}
|
|
4614
4672
|
dateValidation() {
|
|
4615
|
-
|
|
4673
|
+
if (this.dateError) {
|
|
4674
|
+
return core.I18n.translate(ERROR_MAP[this.dateError]);
|
|
4675
|
+
}
|
|
4676
|
+
return true;
|
|
4616
4677
|
}
|
|
4617
4678
|
click(event, element) {
|
|
4618
4679
|
const clickEvent = event || new MouseEvent('click');
|
|
@@ -4658,7 +4719,7 @@
|
|
|
4658
4719
|
*/
|
|
4659
4720
|
removeDateMask() {
|
|
4660
4721
|
if (isUndefined__default["default"](this.getInitialMask()) || !this.value || this.dateError
|
|
4661
|
-
|| !this.isValidDateArray(this.
|
|
4722
|
+
|| !this.isValidDateArray(this.value).isValid) {
|
|
4662
4723
|
return;
|
|
4663
4724
|
}
|
|
4664
4725
|
this.mask = '';
|
|
@@ -12667,9 +12728,6 @@
|
|
|
12667
12728
|
return this.checkboxAllValue;
|
|
12668
12729
|
}
|
|
12669
12730
|
set checkboxAll(value) {
|
|
12670
|
-
if (this.showCheckboxAll) {
|
|
12671
|
-
this.disabled = value;
|
|
12672
|
-
}
|
|
12673
12731
|
this.checkboxAllValue = value;
|
|
12674
12732
|
}
|
|
12675
12733
|
/**
|
|
@@ -14919,6 +14977,10 @@
|
|
|
14919
14977
|
* Nudge the content to the top
|
|
14920
14978
|
*/
|
|
14921
14979
|
this.top = false;
|
|
14980
|
+
/**
|
|
14981
|
+
* Render the label as HTML
|
|
14982
|
+
*/
|
|
14983
|
+
this.html = false;
|
|
14922
14984
|
this.bottom = this.getInitValue('bottom', props.bottom, this.bottom);
|
|
14923
14985
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
14924
14986
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
@@ -14932,6 +14994,7 @@
|
|
|
14932
14994
|
this.openOnHover = this.getInitValue('openOnHover', props.openOnHover, this.openOnHover);
|
|
14933
14995
|
this.right = this.getInitValue('right', props.right, this.right);
|
|
14934
14996
|
this.top = this.getInitValue('top', props.top, this.top);
|
|
14997
|
+
this.html = this.getInitValue('html', props.html, this.html);
|
|
14935
14998
|
this.createAccessors();
|
|
14936
14999
|
}
|
|
14937
15000
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.120.0",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"lodash.times": "4.3.*",
|
|
44
44
|
"mockdate": "3.0.*"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "72115bb43c1a824c34f1ab524a9af273cba17723"
|
|
47
47
|
}
|
|
@@ -27,7 +27,7 @@ export declare class ApexChart extends ComponentRender implements IApexChart {
|
|
|
27
27
|
/**
|
|
28
28
|
* Set component height to fill all space available
|
|
29
29
|
*/
|
|
30
|
-
fillHeight: boolean;
|
|
30
|
+
fillHeight: boolean | string;
|
|
31
31
|
/**
|
|
32
32
|
* Chart options. See <a href=\"https://apexcharts.com/docs/options/\"
|
|
33
33
|
* target=\"_blank\" alt=\"Apex Charts API Reference\">Apex Chart API
|
|
@@ -40,7 +40,7 @@ export interface IApexChart extends IComponentRender {
|
|
|
40
40
|
height?: string | number;
|
|
41
41
|
minHeight?: string | number;
|
|
42
42
|
maxHeight?: string | number;
|
|
43
|
-
fillHeight?: boolean;
|
|
43
|
+
fillHeight?: boolean | string;
|
|
44
44
|
width?: string | number;
|
|
45
45
|
minWidth?: string | number;
|
|
46
46
|
maxWidth?: string | number;
|
|
@@ -76,7 +76,7 @@ export declare class Card extends ComponentRender implements ICard {
|
|
|
76
76
|
/**
|
|
77
77
|
* Set component height to fill all space available
|
|
78
78
|
*/
|
|
79
|
-
fillHeight: boolean;
|
|
79
|
+
fillHeight: boolean | string;
|
|
80
80
|
/**
|
|
81
81
|
* Removes card elevation shadow and adds a thin border
|
|
82
82
|
*/
|
|
@@ -23,7 +23,7 @@ export interface ICard extends IComponentRender {
|
|
|
23
23
|
height?: number | string;
|
|
24
24
|
maxHeight?: number | string;
|
|
25
25
|
minHeight?: number | string;
|
|
26
|
-
fillHeight?: boolean;
|
|
26
|
+
fillHeight?: boolean | string;
|
|
27
27
|
width?: number | string;
|
|
28
28
|
maxWidth?: number | string;
|
|
29
29
|
minWidth?: number | string;
|
|
@@ -53,7 +53,7 @@ export declare class Carousel extends ComponentRender implements ICarousel {
|
|
|
53
53
|
/**
|
|
54
54
|
* Set component height to fill all space available
|
|
55
55
|
*/
|
|
56
|
-
fillHeight: boolean;
|
|
56
|
+
fillHeight: boolean | string;
|
|
57
57
|
/**
|
|
58
58
|
* Configures the carousel as infinite (the slide after the last one is the first slide, and vice-versa)
|
|
59
59
|
*/
|
|
@@ -26,7 +26,7 @@ export declare class CodeEditor extends ComponentRender implements ICodeEditor {
|
|
|
26
26
|
/**
|
|
27
27
|
* Set component height to fill all space available
|
|
28
28
|
*/
|
|
29
|
-
fillHeight: boolean;
|
|
29
|
+
fillHeight: boolean | string;
|
|
30
30
|
/**
|
|
31
31
|
* Defines the component width. Possible values for this property can be
|
|
32
32
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -6,7 +6,7 @@ export interface ICodeEditor extends IComponentRender {
|
|
|
6
6
|
height?: number | string;
|
|
7
7
|
maxHeight?: number | string;
|
|
8
8
|
minHeight?: number | string;
|
|
9
|
-
fillHeight?: boolean;
|
|
9
|
+
fillHeight?: boolean | string;
|
|
10
10
|
width?: number | string;
|
|
11
11
|
maxWidth?: number | string;
|
|
12
12
|
minWidth?: number | string;
|
|
@@ -4,7 +4,7 @@ export interface IContainer extends IComponentRender {
|
|
|
4
4
|
height?: number | string;
|
|
5
5
|
maxHeight?: number | string;
|
|
6
6
|
minHeight?: number | string;
|
|
7
|
-
fillHeight?: boolean;
|
|
7
|
+
fillHeight?: boolean | string;
|
|
8
8
|
width?: number | string;
|
|
9
9
|
maxWidth?: number | string;
|
|
10
10
|
minWidth?: number | string;
|
|
@@ -38,7 +38,7 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
|
|
|
38
38
|
/**
|
|
39
39
|
* Set component height to fill all space available
|
|
40
40
|
*/
|
|
41
|
-
fillHeight: boolean;
|
|
41
|
+
fillHeight: boolean | string;
|
|
42
42
|
/**
|
|
43
43
|
* Defines the component width. Possible values for this property can be
|
|
44
44
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -22,7 +22,7 @@ export interface IDashboard extends IComponentRender {
|
|
|
22
22
|
height?: number | string;
|
|
23
23
|
maxHeight?: number | string;
|
|
24
24
|
minHeight?: number | string;
|
|
25
|
-
fillHeight?: boolean;
|
|
25
|
+
fillHeight?: boolean | string;
|
|
26
26
|
width?: number | string;
|
|
27
27
|
maxWidth?: number | string;
|
|
28
28
|
minWidth?: number | string;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { IDateRange, IDateEvents } from './interfaces';
|
|
2
2
|
import { TextInput } from '../zd-text-input/text-input';
|
|
3
|
+
declare const ERROR_MAP: {
|
|
4
|
+
readonly invalid_range: "VALIDATION_INVALID_RANGE";
|
|
5
|
+
readonly incomplete_range: "VALIDATION_INVALID_DATE";
|
|
6
|
+
readonly empty: "VALIDATION_INVALID_DATE";
|
|
7
|
+
readonly invalid_date: "VALIDATION_INVALID_DATE";
|
|
8
|
+
readonly none: "";
|
|
9
|
+
};
|
|
3
10
|
export declare class DateRange extends TextInput implements IDateRange {
|
|
11
|
+
/**
|
|
12
|
+
* Restricts which dates can be selected.
|
|
13
|
+
*/
|
|
14
|
+
allowedDates?: ((date: string) => boolean) | string[];
|
|
4
15
|
/**
|
|
5
16
|
* Input auto complete.
|
|
6
17
|
*/
|
|
@@ -72,7 +83,7 @@ export declare class DateRange extends TextInput implements IDateRange {
|
|
|
72
83
|
*/
|
|
73
84
|
helperValue?: string;
|
|
74
85
|
protected isoFormat: string;
|
|
75
|
-
protected dateError:
|
|
86
|
+
protected dateError: false | keyof typeof ERROR_MAP;
|
|
76
87
|
protected formatterFn: Function;
|
|
77
88
|
protected parserFn: Function;
|
|
78
89
|
protected initialMask?: string;
|
|
@@ -102,11 +113,19 @@ export declare class DateRange extends TextInput implements IDateRange {
|
|
|
102
113
|
setDateValue(displayValue: string): void;
|
|
103
114
|
/**
|
|
104
115
|
* Faz a validação do array de datas
|
|
105
|
-
* @param
|
|
106
|
-
* @param values o array de datas
|
|
116
|
+
* @param values o array de datas formatadas de acordo com o dateFormat
|
|
107
117
|
* @returns true se todos os valores forem validados
|
|
108
118
|
* */
|
|
109
|
-
isValidDateArray(
|
|
119
|
+
isValidDateArray(values: string[]): {
|
|
120
|
+
isValid: boolean;
|
|
121
|
+
errorType: keyof typeof ERROR_MAP;
|
|
122
|
+
};
|
|
123
|
+
private isAllowedDate;
|
|
124
|
+
/**
|
|
125
|
+
* Checks if a range is allowed
|
|
126
|
+
* @param value range to be checked, must be in dateFormat
|
|
127
|
+
*/
|
|
128
|
+
isAllowedRange(value: string[]): boolean;
|
|
110
129
|
private splitValues;
|
|
111
130
|
isValidDate(value: string, format: string, strict?: boolean): boolean;
|
|
112
131
|
isValidFormatDate(value: string, format: string, strict?: boolean): boolean;
|
|
@@ -150,3 +169,4 @@ export declare class DateRange extends TextInput implements IDateRange {
|
|
|
150
169
|
change(event?: Event, element?: any): void;
|
|
151
170
|
getMaskValue(): any;
|
|
152
171
|
}
|
|
172
|
+
export {};
|
|
@@ -38,7 +38,7 @@ export declare class Form extends ComponentRender implements IForm {
|
|
|
38
38
|
/**
|
|
39
39
|
* Set component height to fill all space available
|
|
40
40
|
*/
|
|
41
|
-
fillHeight: boolean;
|
|
41
|
+
fillHeight: boolean | string;
|
|
42
42
|
/**
|
|
43
43
|
* Defines the component width. Possible values for this property can be
|
|
44
44
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -25,7 +25,7 @@ export interface IForm extends IComponentRender {
|
|
|
25
25
|
height?: number | string;
|
|
26
26
|
maxHeight?: number | string;
|
|
27
27
|
minHeight?: number | string;
|
|
28
|
-
fillHeight?: boolean;
|
|
28
|
+
fillHeight?: boolean | string;
|
|
29
29
|
width?: number | string;
|
|
30
30
|
maxWidth?: number | string;
|
|
31
31
|
minWidth?: number | string;
|
|
@@ -33,7 +33,7 @@ export declare class Frame extends ComponentRender implements IFrame {
|
|
|
33
33
|
/**
|
|
34
34
|
* Set component height to fill all space available
|
|
35
35
|
*/
|
|
36
|
-
fillHeight: boolean;
|
|
36
|
+
fillHeight: boolean | string;
|
|
37
37
|
/**
|
|
38
38
|
* Defines the component width. Possible values for this property can be
|
|
39
39
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -17,7 +17,7 @@ export interface IFrame extends IComponentRender {
|
|
|
17
17
|
height?: number | string;
|
|
18
18
|
maxHeight?: number | string;
|
|
19
19
|
minHeight?: number | string;
|
|
20
|
-
fillHeight?: boolean;
|
|
20
|
+
fillHeight?: boolean | string;
|
|
21
21
|
width?: number | string;
|
|
22
22
|
maxWidth?: number | string;
|
|
23
23
|
minWidth?: number | string;
|
|
@@ -58,7 +58,7 @@ export declare class Grid extends Iterable implements IGrid {
|
|
|
58
58
|
/**
|
|
59
59
|
* Set component height to fill all space available
|
|
60
60
|
*/
|
|
61
|
-
fillHeight: boolean;
|
|
61
|
+
fillHeight: boolean | string;
|
|
62
62
|
/**
|
|
63
63
|
* Defines the component width. Possible values for this property can be
|
|
64
64
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -28,7 +28,7 @@ export interface IGrid extends IIterable {
|
|
|
28
28
|
height?: number | string;
|
|
29
29
|
maxHeight?: number | string;
|
|
30
30
|
minHeight?: number | string;
|
|
31
|
-
fillHeight?: boolean;
|
|
31
|
+
fillHeight?: boolean | string;
|
|
32
32
|
width?: number | string;
|
|
33
33
|
maxWidth?: number | string;
|
|
34
34
|
minWidth?: number | string;
|
|
@@ -41,7 +41,7 @@ export declare class Image extends ComponentRender implements IImage {
|
|
|
41
41
|
/**
|
|
42
42
|
* Set component height to fill all space available
|
|
43
43
|
*/
|
|
44
|
-
fillHeight: boolean;
|
|
44
|
+
fillHeight: boolean | string;
|
|
45
45
|
/**
|
|
46
46
|
* Defines the component width. Possible values for this property can be
|
|
47
47
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -14,7 +14,7 @@ export interface IImage extends IComponentRender {
|
|
|
14
14
|
height?: number | string;
|
|
15
15
|
maxHeight?: number | string;
|
|
16
16
|
minHeight?: number | string;
|
|
17
|
-
fillHeight?: boolean;
|
|
17
|
+
fillHeight?: boolean | string;
|
|
18
18
|
width?: number | string;
|
|
19
19
|
maxWidth?: number | string;
|
|
20
20
|
minWidth?: number | string;
|
|
@@ -11,7 +11,7 @@ export interface IIterableComponentRender extends IIterable {
|
|
|
11
11
|
height?: number | string;
|
|
12
12
|
maxHeight?: number | string;
|
|
13
13
|
minHeight?: number | string;
|
|
14
|
-
fillHeight?: boolean;
|
|
14
|
+
fillHeight?: boolean | string;
|
|
15
15
|
width?: number | string;
|
|
16
16
|
maxWidth?: number | string;
|
|
17
17
|
minWidth?: number | string;
|
|
@@ -52,7 +52,7 @@ export declare class IterableComponentRender extends Iterable implements IIterab
|
|
|
52
52
|
/**
|
|
53
53
|
* Set component height to fill all space available
|
|
54
54
|
*/
|
|
55
|
-
fillHeight: boolean;
|
|
55
|
+
fillHeight: boolean | string;
|
|
56
56
|
/**
|
|
57
57
|
* Defines the component width. Possible values for this property can be
|
|
58
58
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -15,7 +15,7 @@ export interface IList extends IComponentRender {
|
|
|
15
15
|
height?: number | string;
|
|
16
16
|
maxHeight?: number | string;
|
|
17
17
|
minHeight?: number | string;
|
|
18
|
-
fillHeight?: boolean;
|
|
18
|
+
fillHeight?: boolean | string;
|
|
19
19
|
width?: number | string;
|
|
20
20
|
maxWidth?: number | string;
|
|
21
21
|
minWidth?: number | string;
|
|
@@ -59,7 +59,7 @@ export declare class List extends ComponentRender implements IList {
|
|
|
59
59
|
/**
|
|
60
60
|
* Set component height to fill all space available
|
|
61
61
|
*/
|
|
62
|
-
fillHeight: boolean;
|
|
62
|
+
fillHeight: boolean | string;
|
|
63
63
|
/**
|
|
64
64
|
* Defines the component width. Possible values for this property can be
|
|
65
65
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -31,7 +31,7 @@ export declare class MasterDetail extends ComponentRender implements IMasterDeta
|
|
|
31
31
|
/**
|
|
32
32
|
* Set component height to fill all space available
|
|
33
33
|
*/
|
|
34
|
-
fillHeight: boolean;
|
|
34
|
+
fillHeight: boolean | string;
|
|
35
35
|
/**
|
|
36
36
|
* Creates a new Master Detail.
|
|
37
37
|
* @param props Master detail properties
|
|
@@ -8,7 +8,7 @@ export interface ISelectableList extends IList {
|
|
|
8
8
|
height?: number | string;
|
|
9
9
|
maxHeight?: number | string;
|
|
10
10
|
minHeight?: number | string;
|
|
11
|
-
fillHeight?: boolean;
|
|
11
|
+
fillHeight?: boolean | string;
|
|
12
12
|
width?: number | string;
|
|
13
13
|
maxWidth?: number | string;
|
|
14
14
|
minWidth?: number | string;
|
|
@@ -42,7 +42,7 @@ export declare class SelectableList extends List implements ISelectableList {
|
|
|
42
42
|
/**
|
|
43
43
|
* Set component height to fill all space available
|
|
44
44
|
*/
|
|
45
|
-
fillHeight: boolean;
|
|
45
|
+
fillHeight: boolean | string;
|
|
46
46
|
/**
|
|
47
47
|
* Defines the component width. Possible values for this property can be
|
|
48
48
|
* <samp>'auto', '100%', '400px' or 400</samp>
|
|
@@ -66,7 +66,7 @@ export declare class Textarea extends TextInput implements ITextarea {
|
|
|
66
66
|
/**
|
|
67
67
|
* Set component height to fill all space available
|
|
68
68
|
*/
|
|
69
|
-
fillHeight: boolean;
|
|
69
|
+
fillHeight: boolean | string;
|
|
70
70
|
/**
|
|
71
71
|
* Create a new Textarea.
|
|
72
72
|
* @param props Textarea properties
|