@sankhyalabs/ezui 5.10.8 → 5.11.0-dev.10
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/README.md +8 -11
- package/dist/cjs/{CSSVarsUtils-af809e73.js → CSSVarsUtils-b136a156.js} +5 -0
- package/dist/cjs/RecordValidationProcessor-edd23705.js +102 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +34 -5
- package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +99 -16
- package/dist/cjs/ez-date-input.cjs.entry.js +53 -22
- package/dist/cjs/ez-date-time-input.cjs.entry.js +53 -19
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +42 -1
- package/dist/cjs/ez-form.cjs.entry.js +11 -84
- package/dist/cjs/ez-grid.cjs.entry.js +575 -44
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +3 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +39 -15
- package/dist/cjs/ez-search.cjs.entry.js +13 -2
- package/dist/cjs/ez-text-area.cjs.entry.js +6 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +7 -4
- package/dist/cjs/ez-time-input.cjs.entry.js +11 -7
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +30 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/ez-calendar/ez-calendar.js +63 -6
- package/dist/collection/components/ez-card-item/ez-card-item.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +6 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +168 -14
- package/dist/collection/components/ez-date-input/ez-date-input.js +71 -21
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +71 -18
- package/dist/collection/components/ez-form/ez-form.js +20 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
- package/dist/collection/components/ez-form-view/structure/index.js +34 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +41 -8
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +230 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +49 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.js +10 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.js +4 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +38 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +20 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +15 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +41 -0
- package/dist/collection/components/ez-grid/ez-grid.js +78 -39
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +50 -8
- package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +21 -1
- package/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +62 -15
- package/dist/collection/components/ez-search/ez-search.css +1 -1
- package/dist/collection/components/ez-search/ez-search.js +84 -1
- package/dist/collection/components/ez-text-area/ez-text-area.css +4 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
- package/dist/collection/components/ez-text-input/ez-text-input.css +8 -1
- package/dist/collection/components/ez-text-input/ez-text-input.js +14 -5
- package/dist/collection/components/ez-time-input/ez-time-input.css +4 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +18 -7
- package/dist/collection/utils/CSSVarsUtils.js +5 -0
- package/dist/collection/utils/form/DataBinder.js +8 -63
- package/dist/collection/utils/form/FormMetadata.js +3 -22
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +21 -0
- package/dist/collection/utils/validators/recordvalidator/IValidationResult.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/IValidationSource.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +74 -0
- package/dist/custom-elements/index.js +1101 -256
- package/dist/esm/{CSSVarsUtils-00f67f32.js → CSSVarsUtils-a97cfa29.js} +5 -0
- package/dist/esm/RecordValidationProcessor-abc814af.js +99 -0
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +35 -6
- package/dist/esm/ez-card-item.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +99 -16
- package/dist/esm/ez-date-input.entry.js +53 -22
- package/dist/esm/ez-date-time-input.entry.js +53 -19
- package/dist/esm/ez-filter-input_2.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +42 -1
- package/dist/esm/ez-form.entry.js +12 -85
- package/dist/esm/ez-grid.entry.js +576 -45
- package/dist/esm/ez-multi-selection-list.entry.js +3 -1
- package/dist/esm/ez-number-input.entry.js +39 -15
- package/dist/esm/ez-search.entry.js +13 -2
- package/dist/esm/ez-text-area.entry.js +6 -2
- package/dist/esm/ez-text-input.entry.js +7 -4
- package/dist/esm/ez-time-input.entry.js +11 -7
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +30 -7
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-028f264f.entry.js +1 -0
- package/dist/ezui/p-061f4d73.entry.js +1 -0
- package/dist/ezui/p-25562cf8.entry.js +1 -0
- package/dist/ezui/p-3078d25c.entry.js +1 -0
- package/dist/ezui/p-391de0e4.entry.js +1 -0
- package/dist/ezui/{p-68352e41.entry.js → p-47afb974.entry.js} +1 -1
- package/dist/ezui/p-5cef0264.entry.js +1 -0
- package/dist/ezui/p-5e55a42b.entry.js +1 -0
- package/dist/ezui/p-7526f2b6.entry.js +1 -0
- package/dist/ezui/p-7eb3e1a5.js +1 -0
- package/dist/ezui/p-86a2036d.js +1 -0
- package/dist/ezui/{p-12303d2e.entry.js → p-87e85160.entry.js} +1 -1
- package/dist/ezui/{p-c7a23be9.entry.js → p-964e5571.entry.js} +2 -2
- package/dist/ezui/p-ce035beb.entry.js +1 -0
- package/dist/ezui/p-d43b22f3.entry.js +1 -0
- package/dist/ezui/p-df93558d.entry.js +1 -0
- package/dist/ezui/p-e2dfd935.entry.js +1 -0
- package/dist/ezui/p-e67d0bd5.entry.js +1 -0
- package/dist/ezui/{p-f1a537e3.entry.js → p-ff82b176.entry.js} +1 -1
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +9 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +23 -0
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +4 -0
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +4 -0
- package/dist/types/components/ez-form/ez-form.d.ts +5 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
- package/dist/types/components/ez-form-view/interfaces/IFormViewField.d.ts +2 -14
- package/dist/types/components/ez-form-view/structure/index.d.ts +15 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +18 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +38 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.d.ts +9 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.d.ts +5 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.d.ts +3 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +16 -5
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
- package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +5 -1
- package/dist/types/components/ez-search/ez-search.d.ts +14 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -1
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +2 -1
- package/dist/types/components.d.ts +116 -6
- package/dist/types/utils/form/DataBinder.d.ts +1 -3
- package/dist/types/utils/form/interfaces/IFormConfig.d.ts +1 -1
- package/dist/types/utils/form/interfaces/index.d.ts +4 -4
- package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +17 -0
- package/dist/types/utils/{form/interfaces → interfaces}/IFieldConfig.d.ts +2 -2
- package/dist/types/utils/validators/recordvalidator/IValidationSource.d.ts +6 -0
- package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +13 -0
- package/package.json +3 -3
- package/dist/ezui/p-00c7c25d.entry.js +0 -1
- package/dist/ezui/p-0b160fec.entry.js +0 -1
- package/dist/ezui/p-0bd54a6f.entry.js +0 -1
- package/dist/ezui/p-2a0e1679.entry.js +0 -1
- package/dist/ezui/p-39153935.entry.js +0 -1
- package/dist/ezui/p-4a5e37a7.js +0 -1
- package/dist/ezui/p-4c8b029b.entry.js +0 -1
- package/dist/ezui/p-4e31b69b.entry.js +0 -1
- package/dist/ezui/p-5782443e.entry.js +0 -1
- package/dist/ezui/p-5d45e384.entry.js +0 -1
- package/dist/ezui/p-70ea4beb.entry.js +0 -1
- package/dist/ezui/p-78a6e049.entry.js +0 -1
- package/dist/ezui/p-8bcb197f.entry.js +0 -1
- package/dist/ezui/p-a4c9f3c4.entry.js +0 -1
- /package/dist/collection/{utils/form/interfaces/IFieldConfig.js → components/ez-grid/controller/ag-grid/editor/IUICellEditor.js} +0 -0
- /package/dist/collection/utils/{form/interfaces/IInvalidField.js → interfaces/IFieldConfig.js} +0 -0
- /package/dist/collection/utils/{form/interfaces/IRecordValidator.js → validators/recordvalidator/IInvalidField.js} +0 -0
- /package/dist/collection/utils/{form/interfaces/IValidationResult.js → validators/recordvalidator/IRecordValidator.js} +0 -0
- /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IInvalidField.d.ts +0 -0
- /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IRecordValidator.d.ts +0 -0
- /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IValidationResult.d.ts +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-296b8458.js';
|
|
2
|
-
import { Action, ObjectUtils as ObjectUtils$1, ApplicationContext, StringUtils as StringUtils$1,
|
|
2
|
+
import { Action, ObjectUtils as ObjectUtils$1, HTMLBuilder, ApplicationContext, UserInterface, StringUtils as StringUtils$1, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, ElementIDUtils, DateUtils as DateUtils$1, JSUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
4
4
|
import { D as DISTINCT_FILTER_NAME_PREFIX } from './constants-6dab64f7.js';
|
|
5
|
+
import { b as buildFieldMetadata, R as RecordValidationProcessor } from './RecordValidationProcessor-abc814af.js';
|
|
5
6
|
import { A as ApplicationUtils } from './ApplicationUtils-d9a34a16.js';
|
|
6
7
|
import './DialogType-54a62731.js';
|
|
7
8
|
import './CheckMode-bdb2ec19.js';
|
|
@@ -118850,6 +118851,7 @@ class DataSource {
|
|
|
118850
118851
|
case Action.DATA_SAVED:
|
|
118851
118852
|
case Action.EDITION_CANCELED:
|
|
118852
118853
|
case Action.DATA_CHANGED:
|
|
118854
|
+
case Action.DATA_RESOLVED:
|
|
118853
118855
|
this._controller.refresh();
|
|
118854
118856
|
break;
|
|
118855
118857
|
case Action.SELECTION_CHANGED:
|
|
@@ -118972,7 +118974,7 @@ class EzGridCustomHeader {
|
|
|
118972
118974
|
onClickFilter() {
|
|
118973
118975
|
var _a;
|
|
118974
118976
|
const iconLeft = (_a = this.filterButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left;
|
|
118975
|
-
this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px
|
|
118977
|
+
this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`, true);
|
|
118976
118978
|
}
|
|
118977
118979
|
configSortIcon() {
|
|
118978
118980
|
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
@@ -119183,6 +119185,443 @@ const gridTerms = {
|
|
|
119183
119185
|
ctrlV: "Ctrl+V"
|
|
119184
119186
|
};
|
|
119185
119187
|
|
|
119188
|
+
const buildEditorMetadata = (descriptor, eGridCell, dataUnit, editionManager) => {
|
|
119189
|
+
return Object.assign(Object.assign({}, buildFieldMetadata(descriptor)), { eGridCell, dataUnit, editionManager });
|
|
119190
|
+
};
|
|
119191
|
+
|
|
119192
|
+
const MINIMIUM_WIDTH_TEXTAREA = 210;
|
|
119193
|
+
const PADDING_VALUE_TEXTAREA = 12;
|
|
119194
|
+
const buildTextInput = ({ name, contextName }) => {
|
|
119195
|
+
return HTMLBuilder.parseElement(`<ez-text-input
|
|
119196
|
+
class="ez-grid grid_editor"
|
|
119197
|
+
data-field-name=${name}
|
|
119198
|
+
data-context-name=${contextName}
|
|
119199
|
+
mode="slim"
|
|
119200
|
+
/>`);
|
|
119201
|
+
};
|
|
119202
|
+
const buildTextAreaInput = ({ eGridCell, editionManager }) => {
|
|
119203
|
+
const element = HTMLBuilder.parseElement(`<ez-text-area
|
|
119204
|
+
can-show-error="false"
|
|
119205
|
+
enable-resize="true"
|
|
119206
|
+
/>`);
|
|
119207
|
+
element.addEventListener('keydown', event => handlePressEnterEvent(event, element, editionManager));
|
|
119208
|
+
setElementInitialWidth(eGridCell, element);
|
|
119209
|
+
element.isPopUp = true;
|
|
119210
|
+
return element;
|
|
119211
|
+
};
|
|
119212
|
+
function setElementInitialWidth(eGridCell, element) {
|
|
119213
|
+
const { width } = eGridCell.getBoundingClientRect();
|
|
119214
|
+
const newValue = width > MINIMIUM_WIDTH_TEXTAREA ? width : MINIMIUM_WIDTH_TEXTAREA;
|
|
119215
|
+
element.style.minWidth = `${newValue - PADDING_VALUE_TEXTAREA}px`;
|
|
119216
|
+
element.style.resize = "both";
|
|
119217
|
+
}
|
|
119218
|
+
function handlePressEnterEvent(event, element, editionManager) {
|
|
119219
|
+
if (isEnter(event)) {
|
|
119220
|
+
const shouldBreakLine = event.ctrlKey;
|
|
119221
|
+
if (shouldBreakLine) {
|
|
119222
|
+
element.appendTextToSelection('\n');
|
|
119223
|
+
event.preventDefault();
|
|
119224
|
+
return;
|
|
119225
|
+
}
|
|
119226
|
+
editionManager.navigateByEnterKey(event);
|
|
119227
|
+
}
|
|
119228
|
+
}
|
|
119229
|
+
function isEnter(event) {
|
|
119230
|
+
return [event.key, event.code].includes('Enter');
|
|
119231
|
+
}
|
|
119232
|
+
|
|
119233
|
+
const LIMIT_TIME_VALUE = 2359;
|
|
119234
|
+
const buildDate = () => {
|
|
119235
|
+
const dateInput = HTMLBuilder.parseElement(`<ez-date-input
|
|
119236
|
+
class="ez-grid grid_editor"
|
|
119237
|
+
mode="slim"
|
|
119238
|
+
data-is-fixed="true"
|
|
119239
|
+
/>`);
|
|
119240
|
+
dateInput.valueGetter = () => dateInput.getValueAsync();
|
|
119241
|
+
return dateInput;
|
|
119242
|
+
};
|
|
119243
|
+
const buildTime = ({ readOnly }) => {
|
|
119244
|
+
const timeInputElement = HTMLBuilder.parseElement(`<ez-time-input
|
|
119245
|
+
class="ez-grid grid_editor"
|
|
119246
|
+
enabled=${!readOnly}
|
|
119247
|
+
mode="slim"
|
|
119248
|
+
/>`);
|
|
119249
|
+
timeInputElement.valueGetter = () => {
|
|
119250
|
+
const value = timeInputElement.value;
|
|
119251
|
+
const isAllowedTime = parseInt(value) <= LIMIT_TIME_VALUE;
|
|
119252
|
+
return isAllowedTime ? value : null;
|
|
119253
|
+
};
|
|
119254
|
+
timeInputElement.valueSetter = (value) => {
|
|
119255
|
+
const isAllowedTime = parseInt(value) <= LIMIT_TIME_VALUE;
|
|
119256
|
+
if (!isAllowedTime)
|
|
119257
|
+
return timeInputElement.value = null;
|
|
119258
|
+
return timeInputElement.value = value;
|
|
119259
|
+
};
|
|
119260
|
+
return timeInputElement;
|
|
119261
|
+
};
|
|
119262
|
+
const buildDateTime = ({ readOnly }) => {
|
|
119263
|
+
const dateTimeInput = HTMLBuilder.parseElement(`<ez-date-time-input
|
|
119264
|
+
class="ez-grid grid_editor"
|
|
119265
|
+
mode="slim"
|
|
119266
|
+
enabled=${!readOnly}
|
|
119267
|
+
data-is-fixed="true"
|
|
119268
|
+
/>`);
|
|
119269
|
+
dateTimeInput.valueGetter = () => dateTimeInput.getValueAsync();
|
|
119270
|
+
return dateTimeInput;
|
|
119271
|
+
};
|
|
119272
|
+
|
|
119273
|
+
const buildDecimal = ({ readOnly, props }) => {
|
|
119274
|
+
const precision = Number((props === null || props === void 0 ? void 0 : props.precision) || 2);
|
|
119275
|
+
const prettyPrecision = Number((props === null || props === void 0 ? void 0 : props.prettyPrecision) || precision);
|
|
119276
|
+
return buildNumeric(readOnly, precision, prettyPrecision);
|
|
119277
|
+
};
|
|
119278
|
+
const buildInteger = ({ readOnly }) => {
|
|
119279
|
+
return buildNumeric(readOnly, 0, 0);
|
|
119280
|
+
};
|
|
119281
|
+
function buildNumeric(readOnly, precision, prettyPrecision) {
|
|
119282
|
+
const input = HTMLBuilder.parseElement(`<ez-number-input
|
|
119283
|
+
class="ez-grid grid_editor"
|
|
119284
|
+
enabled=${!readOnly}
|
|
119285
|
+
precision=${precision}
|
|
119286
|
+
pretty-precision=${prettyPrecision}
|
|
119287
|
+
mode="slim"
|
|
119288
|
+
/>`);
|
|
119289
|
+
input.valueGetter = () => input.getValueAsync();
|
|
119290
|
+
return input;
|
|
119291
|
+
}
|
|
119292
|
+
|
|
119293
|
+
function getViewPortHeight(cell) {
|
|
119294
|
+
let currentElem = cell;
|
|
119295
|
+
while (currentElem) {
|
|
119296
|
+
const viewPort = currentElem.querySelector("[ref=eBodyViewport]");
|
|
119297
|
+
if (viewPort) {
|
|
119298
|
+
return viewPort.getBoundingClientRect().bottom;
|
|
119299
|
+
}
|
|
119300
|
+
currentElem = currentElem.parentElement;
|
|
119301
|
+
}
|
|
119302
|
+
}
|
|
119303
|
+
|
|
119304
|
+
const BOOLEAN_OPTIONS = new Map([[true, { value: "S", label: "Sim" }], [false, { value: "N", label: "Não" }]]);
|
|
119305
|
+
const buildComboBox = ({ required, props, eGridCell }) => {
|
|
119306
|
+
const prop = props === null || props === void 0 ? void 0 : props.options;
|
|
119307
|
+
let options;
|
|
119308
|
+
if (typeof prop === "string") {
|
|
119309
|
+
const parsed = JSON.parse(prop);
|
|
119310
|
+
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
119311
|
+
}
|
|
119312
|
+
else {
|
|
119313
|
+
options = prop;
|
|
119314
|
+
}
|
|
119315
|
+
const combo = HTMLBuilder.parseElement(`<ez-combo-box
|
|
119316
|
+
class="grid_editor"
|
|
119317
|
+
suppress-empty-option=${required}
|
|
119318
|
+
mode="slim"
|
|
119319
|
+
/>`);
|
|
119320
|
+
combo.options = options;
|
|
119321
|
+
combo.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
|
|
119322
|
+
return combo;
|
|
119323
|
+
};
|
|
119324
|
+
const buildSwitch = (fieldMetadata) => {
|
|
119325
|
+
const combo = buildComboBox(Object.assign(Object.assign({}, fieldMetadata), { props: Object.assign(Object.assign({}, fieldMetadata.props), { options: Array.from(BOOLEAN_OPTIONS.values()) }) }));
|
|
119326
|
+
combo.valueGetter = () => {
|
|
119327
|
+
const value = combo.value;
|
|
119328
|
+
if (value == undefined) {
|
|
119329
|
+
return;
|
|
119330
|
+
}
|
|
119331
|
+
return value.value == "S";
|
|
119332
|
+
};
|
|
119333
|
+
combo.valueSetter = (value) => {
|
|
119334
|
+
if (value != undefined) {
|
|
119335
|
+
combo.value = BOOLEAN_OPTIONS.get(value);
|
|
119336
|
+
}
|
|
119337
|
+
};
|
|
119338
|
+
return combo;
|
|
119339
|
+
};
|
|
119340
|
+
|
|
119341
|
+
const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) => {
|
|
119342
|
+
const ezSearch = HTMLBuilder.parseElement(`<ez-search
|
|
119343
|
+
class="ez-grid grid_editor"
|
|
119344
|
+
mode="slim"
|
|
119345
|
+
suppress-empty-option=${required}
|
|
119346
|
+
enabled=${!readOnly}
|
|
119347
|
+
/>`);
|
|
119348
|
+
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
119349
|
+
ezSearch.optionLoader = (argument) => loader(argument, name, dataUnit);
|
|
119350
|
+
ezSearch.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
|
|
119351
|
+
ezSearch.valueGetter = () => ezSearch.getValueAsync();
|
|
119352
|
+
return ezSearch;
|
|
119353
|
+
};
|
|
119354
|
+
|
|
119355
|
+
const uiBuilders = new Map();
|
|
119356
|
+
uiBuilders.set(UserInterface.DATE, buildDate);
|
|
119357
|
+
uiBuilders.set(UserInterface.TIME, buildTime);
|
|
119358
|
+
uiBuilders.set(UserInterface.DATETIME, buildDateTime);
|
|
119359
|
+
uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
|
|
119360
|
+
uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
|
|
119361
|
+
uiBuilders.set(UserInterface.SWITCH, buildSwitch);
|
|
119362
|
+
uiBuilders.set(UserInterface.CHECKBOX, buildSwitch);
|
|
119363
|
+
uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
119364
|
+
uiBuilders.set(UserInterface.LONGTEXT, buildTextAreaInput);
|
|
119365
|
+
uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
119366
|
+
class EzCellEditor {
|
|
119367
|
+
init(params) {
|
|
119368
|
+
const fieldName = params.column.getColId();
|
|
119369
|
+
const dataUnit = params.context.dataUnit;
|
|
119370
|
+
const fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
|
|
119371
|
+
const builder = uiBuilders.get(fieldMetadata.userInterface) || buildTextInput;
|
|
119372
|
+
this._gui = builder(fieldMetadata);
|
|
119373
|
+
if (this._gui.valueSetter != undefined) {
|
|
119374
|
+
this._gui.valueSetter(params.value);
|
|
119375
|
+
}
|
|
119376
|
+
else {
|
|
119377
|
+
this._gui.value = params.value;
|
|
119378
|
+
}
|
|
119379
|
+
}
|
|
119380
|
+
getGui() {
|
|
119381
|
+
return this._gui;
|
|
119382
|
+
}
|
|
119383
|
+
afterGuiAttached() {
|
|
119384
|
+
this.focusIn();
|
|
119385
|
+
}
|
|
119386
|
+
focusIn() {
|
|
119387
|
+
this._gui.focus();
|
|
119388
|
+
this._gui.setFocus({ selectText: true });
|
|
119389
|
+
}
|
|
119390
|
+
getValue() {
|
|
119391
|
+
return this._gui.valueGetter != undefined ? this._gui.valueGetter() : this._gui.value;
|
|
119392
|
+
}
|
|
119393
|
+
isPopup() {
|
|
119394
|
+
return this._gui.isPopUp;
|
|
119395
|
+
}
|
|
119396
|
+
}
|
|
119397
|
+
|
|
119398
|
+
class GridEditionManager {
|
|
119399
|
+
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled) {
|
|
119400
|
+
this._dataUnit = dataUnit;
|
|
119401
|
+
this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
119402
|
+
getRequiredFields: () => this.getRequiredFields(),
|
|
119403
|
+
markAsInvalid: () => { },
|
|
119404
|
+
getMessageForField: () => null
|
|
119405
|
+
}, recordsValidator);
|
|
119406
|
+
this._useEnterLikeTab = useEnterLikeTab;
|
|
119407
|
+
this._editionIsDisabled = editionIsDisabled;
|
|
119408
|
+
}
|
|
119409
|
+
configureGrid(options) {
|
|
119410
|
+
this._gridOptions = options;
|
|
119411
|
+
options.readOnlyEdit = true;
|
|
119412
|
+
options.onCellEditRequest = evt => this.onCellEditRequest(evt);
|
|
119413
|
+
options.onCellKeyDown = evt => {
|
|
119414
|
+
if (evt.event && evt["column"]) {
|
|
119415
|
+
this.onCellKeyDown(evt);
|
|
119416
|
+
}
|
|
119417
|
+
};
|
|
119418
|
+
return options;
|
|
119419
|
+
}
|
|
119420
|
+
proceedAutoSave() {
|
|
119421
|
+
if (!this._dataUnit.isDirty()) {
|
|
119422
|
+
this.saveSuccess();
|
|
119423
|
+
return;
|
|
119424
|
+
}
|
|
119425
|
+
if (!this._isGridEdition) {
|
|
119426
|
+
return;
|
|
119427
|
+
}
|
|
119428
|
+
const currentRercord = this._dataUnit.getSelectedRecord();
|
|
119429
|
+
if (currentRercord == undefined) {
|
|
119430
|
+
return;
|
|
119431
|
+
}
|
|
119432
|
+
this._recordValidationProcessor
|
|
119433
|
+
.validate()
|
|
119434
|
+
.then(() => {
|
|
119435
|
+
this._dataUnit.saveData()
|
|
119436
|
+
.then(() => this.saveSuccess())
|
|
119437
|
+
.catch(reason => this.saveFail(reason));
|
|
119438
|
+
})
|
|
119439
|
+
.catch(reason => this.saveFail(reason));
|
|
119440
|
+
}
|
|
119441
|
+
navigateByEnterKey(keyboardEvent) {
|
|
119442
|
+
const backwards = keyboardEvent.shiftKey;
|
|
119443
|
+
if (this._useEnterLikeTab) {
|
|
119444
|
+
if (backwards) {
|
|
119445
|
+
this._gridOptions.api.tabToPreviousCell(keyboardEvent);
|
|
119446
|
+
}
|
|
119447
|
+
else {
|
|
119448
|
+
this._gridOptions.api.tabToNextCell(keyboardEvent);
|
|
119449
|
+
}
|
|
119450
|
+
}
|
|
119451
|
+
else {
|
|
119452
|
+
const editionCell = this._gridOptions.api.getEditingCells()[0];
|
|
119453
|
+
if (editionCell) {
|
|
119454
|
+
let { rowIndex } = editionCell;
|
|
119455
|
+
this.nextEditionRow(rowIndex, editionCell.column, backwards);
|
|
119456
|
+
}
|
|
119457
|
+
}
|
|
119458
|
+
}
|
|
119459
|
+
getComponents() {
|
|
119460
|
+
return { ezCellEditor: EzCellEditor };
|
|
119461
|
+
}
|
|
119462
|
+
verifyClickToEdition(api, cellClicked) {
|
|
119463
|
+
if (this.isSecondClick(cellClicked)) {
|
|
119464
|
+
api.startEditingCell({ rowIndex: cellClicked.rowIndex, colKey: cellClicked.column.getColId() });
|
|
119465
|
+
}
|
|
119466
|
+
this._lastCellClicked = cellClicked;
|
|
119467
|
+
}
|
|
119468
|
+
configureColumn(col) {
|
|
119469
|
+
col.cellEditor = 'ezCellEditor';
|
|
119470
|
+
col.editable = params => this.canEdit(params);
|
|
119471
|
+
col.suppressKeyboardEvent = (params) => {
|
|
119472
|
+
return params.event.key === KeyCode.ENTER;
|
|
119473
|
+
};
|
|
119474
|
+
return col;
|
|
119475
|
+
}
|
|
119476
|
+
getRequiredFields() {
|
|
119477
|
+
return this._gridOptions.columnApi.getAllDisplayedColumns().filter(c => {
|
|
119478
|
+
const fieldDefinition = this._dataUnit.getField(c.getColId());
|
|
119479
|
+
return fieldDefinition && fieldDefinition.required;
|
|
119480
|
+
}).map(c => c.getColId());
|
|
119481
|
+
}
|
|
119482
|
+
saveSuccess() {
|
|
119483
|
+
this.focusOnCell(this._targetEditionCell);
|
|
119484
|
+
this._lastCellEdited = undefined;
|
|
119485
|
+
this._targetEditionCell = undefined;
|
|
119486
|
+
this._isGridEdition = false;
|
|
119487
|
+
}
|
|
119488
|
+
saveFail(reason) {
|
|
119489
|
+
this.focusOnCell(this._lastCellEdited);
|
|
119490
|
+
this._isGridEdition = false;
|
|
119491
|
+
if (reason) {
|
|
119492
|
+
Promise.reject(reason);
|
|
119493
|
+
}
|
|
119494
|
+
}
|
|
119495
|
+
focusOnCell(cell) {
|
|
119496
|
+
if (cell == undefined) {
|
|
119497
|
+
return;
|
|
119498
|
+
}
|
|
119499
|
+
const { rowIndex, column } = cell;
|
|
119500
|
+
this._gridOptions.api.getDisplayedRowAtIndex(rowIndex).setSelected(true, true);
|
|
119501
|
+
this._gridOptions.api.clearRangeSelection();
|
|
119502
|
+
this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [column] });
|
|
119503
|
+
this._gridOptions.api.startEditingCell({ colKey: column.getColId(), rowIndex });
|
|
119504
|
+
this._gridOptions.api.setFocusedCell(rowIndex, column.getColId());
|
|
119505
|
+
const cellEditor = this._gridOptions.api.getCellEditorInstances()[0];
|
|
119506
|
+
if (cellEditor) {
|
|
119507
|
+
cellEditor.focusIn();
|
|
119508
|
+
}
|
|
119509
|
+
}
|
|
119510
|
+
onCellKeyDown(event) {
|
|
119511
|
+
const keyboardEvent = event.event;
|
|
119512
|
+
switch (keyboardEvent.key) {
|
|
119513
|
+
case KeyCode.ENTER:
|
|
119514
|
+
this.processEnterKey(keyboardEvent, event);
|
|
119515
|
+
break;
|
|
119516
|
+
case KeyCode.UP:
|
|
119517
|
+
this.editPreviousRow(event.api);
|
|
119518
|
+
break;
|
|
119519
|
+
case KeyCode.DOWN:
|
|
119520
|
+
this.editNextRow(event.api);
|
|
119521
|
+
break;
|
|
119522
|
+
}
|
|
119523
|
+
}
|
|
119524
|
+
processEnterKey(keyboardEvent, event) {
|
|
119525
|
+
const editionCell = event.api.getEditingCells()[0];
|
|
119526
|
+
if (!editionCell) {
|
|
119527
|
+
event.api.startEditingCell({ colKey: event.column.getColId(), rowIndex: event.rowIndex });
|
|
119528
|
+
return;
|
|
119529
|
+
}
|
|
119530
|
+
this.navigateByEnterKey(keyboardEvent);
|
|
119531
|
+
}
|
|
119532
|
+
nextEditionRow(rowIndex, column, backwards) {
|
|
119533
|
+
if (backwards) {
|
|
119534
|
+
rowIndex = rowIndex - 1;
|
|
119535
|
+
if (rowIndex < 0) {
|
|
119536
|
+
rowIndex = this._dataUnit.records.length - 1;
|
|
119537
|
+
}
|
|
119538
|
+
}
|
|
119539
|
+
else {
|
|
119540
|
+
rowIndex = rowIndex + 1;
|
|
119541
|
+
if (rowIndex >= this._dataUnit.records.length) {
|
|
119542
|
+
rowIndex = 0;
|
|
119543
|
+
}
|
|
119544
|
+
}
|
|
119545
|
+
this._targetEditionCell = new TargetEdition(rowIndex, column, true);
|
|
119546
|
+
this.finishEdition();
|
|
119547
|
+
}
|
|
119548
|
+
editPreviousRow(api) {
|
|
119549
|
+
this.moveEditionVertically(api, -1);
|
|
119550
|
+
}
|
|
119551
|
+
editNextRow(api) {
|
|
119552
|
+
this.moveEditionVertically(api, 1);
|
|
119553
|
+
}
|
|
119554
|
+
moveEditionVertically(api, offset) {
|
|
119555
|
+
const editionCell = api.getEditingCells()[0];
|
|
119556
|
+
if (!editionCell) {
|
|
119557
|
+
return;
|
|
119558
|
+
}
|
|
119559
|
+
const rowIndex = editionCell.rowIndex + offset;
|
|
119560
|
+
if (api.getDisplayedRowAtIndex(rowIndex)) {
|
|
119561
|
+
this._targetEditionCell = new TargetEdition(rowIndex, editionCell.column, offset < 0);
|
|
119562
|
+
this.finishEdition();
|
|
119563
|
+
}
|
|
119564
|
+
}
|
|
119565
|
+
finishEdition() {
|
|
119566
|
+
this._gridOptions.api.stopEditing();
|
|
119567
|
+
setTimeout(() => {
|
|
119568
|
+
//O Timeout foi inserido para permitir que o ciclo de finalização prossiga
|
|
119569
|
+
//pois precisamos aguardar o fim da edição para executar o autosave.
|
|
119570
|
+
this.proceedAutoSave();
|
|
119571
|
+
}, 0);
|
|
119572
|
+
}
|
|
119573
|
+
canEdit(params) {
|
|
119574
|
+
if (this._editionIsDisabled()) {
|
|
119575
|
+
return false;
|
|
119576
|
+
}
|
|
119577
|
+
return this.isColEditable(params.colDef.field);
|
|
119578
|
+
}
|
|
119579
|
+
isColEditable(fieldName) {
|
|
119580
|
+
const fieldDefinition = this._dataUnit.getField(fieldName);
|
|
119581
|
+
if (fieldDefinition) {
|
|
119582
|
+
return !fieldDefinition.readOnly;
|
|
119583
|
+
}
|
|
119584
|
+
return false;
|
|
119585
|
+
}
|
|
119586
|
+
isSecondClick(cellClicked) {
|
|
119587
|
+
if (!this._lastCellClicked) {
|
|
119588
|
+
return false;
|
|
119589
|
+
}
|
|
119590
|
+
if (this._lastCellClicked.column != cellClicked.column) {
|
|
119591
|
+
return false;
|
|
119592
|
+
}
|
|
119593
|
+
if (this._lastCellClicked.rowIndex != cellClicked.rowIndex) {
|
|
119594
|
+
return false;
|
|
119595
|
+
}
|
|
119596
|
+
return true;
|
|
119597
|
+
}
|
|
119598
|
+
onCellEditRequest(event) {
|
|
119599
|
+
const fieldName = event.colDef.field;
|
|
119600
|
+
const value = event.newValue;
|
|
119601
|
+
if (event.oldValue != value) {
|
|
119602
|
+
if (value instanceof Promise) {
|
|
119603
|
+
const fieldDescriptor = this._dataUnit.getField(event.colDef.colId);
|
|
119604
|
+
event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: (fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.userInterface) === UserInterface.SEARCH ? value : event.oldValue }));
|
|
119605
|
+
value.then(resolved => event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: resolved })));
|
|
119606
|
+
}
|
|
119607
|
+
else {
|
|
119608
|
+
event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: value }));
|
|
119609
|
+
}
|
|
119610
|
+
this._isGridEdition = true;
|
|
119611
|
+
this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__]);
|
|
119612
|
+
this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
|
|
119613
|
+
}
|
|
119614
|
+
}
|
|
119615
|
+
}
|
|
119616
|
+
class TargetEdition {
|
|
119617
|
+
constructor(rowIndex, column, backwards) {
|
|
119618
|
+
this.rowPinned = null;
|
|
119619
|
+
this.rowIndex = rowIndex;
|
|
119620
|
+
this.column = column;
|
|
119621
|
+
this.backwards = backwards;
|
|
119622
|
+
}
|
|
119623
|
+
}
|
|
119624
|
+
|
|
119186
119625
|
class AgGridController {
|
|
119187
119626
|
configFilterColumn(filterColumn) {
|
|
119188
119627
|
this._filterColumn = filterColumn;
|
|
@@ -119218,6 +119657,9 @@ class AgGridController {
|
|
|
119218
119657
|
getGridConfig() {
|
|
119219
119658
|
return this._gridConfig;
|
|
119220
119659
|
}
|
|
119660
|
+
getGridApi() {
|
|
119661
|
+
return this._gridOptions.api;
|
|
119662
|
+
}
|
|
119221
119663
|
getSort() {
|
|
119222
119664
|
const sortedColumns = [];
|
|
119223
119665
|
this._gridOptions.columnApi
|
|
@@ -119278,6 +119720,7 @@ class AgGridController {
|
|
|
119278
119720
|
this._doubleClickCallBack = options.onDoubleClick;
|
|
119279
119721
|
this._multipleSelection = options.allowMultipleSelection;
|
|
119280
119722
|
this._dataUnit = options.dataUnit;
|
|
119723
|
+
this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled);
|
|
119281
119724
|
this._statusResolver = options.statusResolver;
|
|
119282
119725
|
if (this._dataUnit) {
|
|
119283
119726
|
this._dataUnit.sortingProvider = this;
|
|
@@ -119297,12 +119740,14 @@ class AgGridController {
|
|
|
119297
119740
|
defaultColDef: {
|
|
119298
119741
|
headerClass: 'ez-grid__cell-header',
|
|
119299
119742
|
cellClass: 'ez-grid__cell-body',
|
|
119743
|
+
cellStyle: {
|
|
119744
|
+
height: '100%'
|
|
119745
|
+
}
|
|
119300
119746
|
},
|
|
119301
|
-
components: {
|
|
119302
|
-
ezGridHeaderComponent: SelectionHeader,
|
|
119303
|
-
ezGridCustomHeader: EzGridCustomHeader,
|
|
119304
|
-
},
|
|
119747
|
+
components: Object.assign({ ezGridHeaderComponent: SelectionHeader, ezGridCustomHeader: EzGridCustomHeader }, this._editionManager.getComponents()),
|
|
119305
119748
|
context: {
|
|
119749
|
+
editionManager: this._editionManager,
|
|
119750
|
+
dataUnit: this._dataUnit,
|
|
119306
119751
|
headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
|
|
119307
119752
|
headerCheckStatusSetter: (selectAll) => this.updateSelectionForAll(selectAll),
|
|
119308
119753
|
},
|
|
@@ -119310,6 +119755,7 @@ class AgGridController {
|
|
|
119310
119755
|
this.defineRowModelType(this._gridOptions, options);
|
|
119311
119756
|
this.setOptionsEvents(this._gridOptions);
|
|
119312
119757
|
this.setOptionsSupress(this._gridOptions);
|
|
119758
|
+
this._gridOptions = this._editionManager.configureGrid(this._gridOptions);
|
|
119313
119759
|
if (this._enterprise) {
|
|
119314
119760
|
this._grid = new Grid(container, this._gridOptions);
|
|
119315
119761
|
}
|
|
@@ -119456,6 +119902,7 @@ class AgGridController {
|
|
|
119456
119902
|
opt.onSelectionChanged = e => this.onSelectionChange(e);
|
|
119457
119903
|
opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
|
|
119458
119904
|
opt.onDragStopped = evt => this.onCallStateChange('columnMovedEnd', evt);
|
|
119905
|
+
opt.onCellClicked = evt => this.onCellClicked(evt);
|
|
119459
119906
|
}
|
|
119460
119907
|
setOptionsSupress(opt) {
|
|
119461
119908
|
opt.suppressDragLeaveHidesColumns = true;
|
|
@@ -119759,7 +120206,7 @@ class AgGridController {
|
|
|
119759
120206
|
else if (propSortable === false) {
|
|
119760
120207
|
tooltip = 'Coluna não pode ser ordenada';
|
|
119761
120208
|
}
|
|
119762
|
-
return {
|
|
120209
|
+
return this._editionManager.configureColumn({
|
|
119763
120210
|
headerName: source.label,
|
|
119764
120211
|
field: source.name,
|
|
119765
120212
|
sortable: propSortable,
|
|
@@ -119769,13 +120216,22 @@ class AgGridController {
|
|
|
119769
120216
|
tooltip: tooltip,
|
|
119770
120217
|
isSortable: propSortable,
|
|
119771
120218
|
hasFilter: () => this.hasFilterColumn(source.name),
|
|
119772
|
-
showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name) }),
|
|
120219
|
+
showColumnFilter: (leftPosition, fromIcon) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon }),
|
|
119773
120220
|
},
|
|
119774
120221
|
valueFormatter: params => {
|
|
120222
|
+
if (params.value == undefined) {
|
|
120223
|
+
return "";
|
|
120224
|
+
}
|
|
120225
|
+
if (params.value instanceof Promise) {
|
|
120226
|
+
return "Carregando...";
|
|
120227
|
+
}
|
|
120228
|
+
if (this._dataUnit) {
|
|
120229
|
+
return this._dataUnit.getFormattedValue(source.name, params.value);
|
|
120230
|
+
}
|
|
119775
120231
|
return this.getFormatterByColumn(params, source);
|
|
119776
120232
|
},
|
|
119777
120233
|
cellStyle: this.getStyleByColumn(source),
|
|
119778
|
-
};
|
|
120234
|
+
});
|
|
119779
120235
|
}
|
|
119780
120236
|
getInitCellStyle() {
|
|
119781
120237
|
return {
|
|
@@ -119848,6 +120304,13 @@ class AgGridController {
|
|
|
119848
120304
|
return params.value.toLocaleDateString();
|
|
119849
120305
|
}
|
|
119850
120306
|
}
|
|
120307
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.ELAPSEDTIME || (source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.TIME) {
|
|
120308
|
+
if (!!params.value) {
|
|
120309
|
+
const maskFormatter = new MaskFormatter("##:##");
|
|
120310
|
+
const formattedValue = String(params.value).padStart(4, '0');
|
|
120311
|
+
return maskFormatter.format(formattedValue);
|
|
120312
|
+
}
|
|
120313
|
+
}
|
|
119851
120314
|
}
|
|
119852
120315
|
onCallStateChange(type, e) {
|
|
119853
120316
|
const finished = !('finished' in e) || e['finished'];
|
|
@@ -119862,6 +120325,13 @@ class AgGridController {
|
|
|
119862
120325
|
this._columnStateChangeCallback(type, this.getColumnsState(), info);
|
|
119863
120326
|
}
|
|
119864
120327
|
}
|
|
120328
|
+
onCellClicked(event) {
|
|
120329
|
+
this._editionManager.verifyClickToEdition(event.api, {
|
|
120330
|
+
rowIndex: event.rowIndex,
|
|
120331
|
+
column: event.column,
|
|
120332
|
+
rowPinned: undefined
|
|
120333
|
+
});
|
|
120334
|
+
}
|
|
119865
120335
|
isElementResize(e) {
|
|
119866
120336
|
return e['target'] && e['target'].getAttribute('ref') === 'eResize';
|
|
119867
120337
|
}
|
|
@@ -119879,6 +120349,7 @@ class AgGridController {
|
|
|
119879
120349
|
if (this._selectionChangeCallback) {
|
|
119880
120350
|
clearTimeout(this._selectionChangeDeboucing);
|
|
119881
120351
|
this._selectionChangeDeboucing = window.setTimeout(() => {
|
|
120352
|
+
this._editionManager.proceedAutoSave();
|
|
119882
120353
|
if (this._dataUnit) {
|
|
119883
120354
|
if (event.context.selectionChangeQuietly) {
|
|
119884
120355
|
const selectionInfo = this._dataUnit;
|
|
@@ -119968,6 +120439,84 @@ function getElementID(sufix) {
|
|
|
119968
120439
|
};
|
|
119969
120440
|
}
|
|
119970
120441
|
|
|
120442
|
+
class InMemoryFilterColumnDataSource {
|
|
120443
|
+
constructor(dataUnit) {
|
|
120444
|
+
var _a;
|
|
120445
|
+
this.onDataUnitAction = (action) => {
|
|
120446
|
+
if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
|
|
120447
|
+
this.originalRecords = this.dataUnit.records;
|
|
120448
|
+
}
|
|
120449
|
+
};
|
|
120450
|
+
this.dataUnit = dataUnit;
|
|
120451
|
+
this.originalRecords = (_a = this.dataUnit.records) !== null && _a !== void 0 ? _a : [];
|
|
120452
|
+
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
120453
|
+
}
|
|
120454
|
+
fetchData(filterTerm, fieldName) {
|
|
120455
|
+
return new Promise(resolve => {
|
|
120456
|
+
const filteredRecords = this.originalRecords.filter(record => this.includesSearchTerm(record, fieldName, filterTerm));
|
|
120457
|
+
const options = filteredRecords.map(item => this.buildFieldOption(item, fieldName));
|
|
120458
|
+
resolve(this.removeDuplicatedOptions(options));
|
|
120459
|
+
});
|
|
120460
|
+
}
|
|
120461
|
+
buildFieldOption(item, fieldName) {
|
|
120462
|
+
return {
|
|
120463
|
+
value: this.buildValue(item, fieldName),
|
|
120464
|
+
label: this.formatLabel(fieldName, item[fieldName]),
|
|
120465
|
+
check: true,
|
|
120466
|
+
};
|
|
120467
|
+
}
|
|
120468
|
+
buildValue(item, fieldName) {
|
|
120469
|
+
var _a;
|
|
120470
|
+
let value = item[fieldName];
|
|
120471
|
+
if (((_a = this.dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.dataType) === DataType.OBJECT) {
|
|
120472
|
+
value = value.value;
|
|
120473
|
+
}
|
|
120474
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
|
120475
|
+
}
|
|
120476
|
+
removeDuplicatedOptions(options) {
|
|
120477
|
+
const noDuplicatedOptions = [];
|
|
120478
|
+
options.forEach(option => {
|
|
120479
|
+
if (!noDuplicatedOptions.find(({ label }) => label === option.label)) {
|
|
120480
|
+
noDuplicatedOptions.push(option);
|
|
120481
|
+
}
|
|
120482
|
+
});
|
|
120483
|
+
return noDuplicatedOptions;
|
|
120484
|
+
}
|
|
120485
|
+
includesSearchTerm(record, fieldName, filterTerm) {
|
|
120486
|
+
let label = this.buildLabel(fieldName, record[fieldName]);
|
|
120487
|
+
return label.toLowerCase().includes(filterTerm.toLowerCase());
|
|
120488
|
+
}
|
|
120489
|
+
buildLabel(fieldName, value) {
|
|
120490
|
+
var _a;
|
|
120491
|
+
const { dataType } = this.dataUnit.getField(fieldName);
|
|
120492
|
+
if (dataType === DataType.NUMBER) {
|
|
120493
|
+
return value === null || value === void 0 ? void 0 : value.toString().replace('.', ',');
|
|
120494
|
+
}
|
|
120495
|
+
if (dataType === DataType.DATE) {
|
|
120496
|
+
return (typeof value === 'object')
|
|
120497
|
+
? (_a = DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString()
|
|
120498
|
+
: value === null || value === void 0 ? void 0 : value.toString();
|
|
120499
|
+
}
|
|
120500
|
+
if (dataType === DataType.OBJECT) {
|
|
120501
|
+
return `${value === null || value === void 0 ? void 0 : value.value} - ${value === null || value === void 0 ? void 0 : value.label}`;
|
|
120502
|
+
}
|
|
120503
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
|
120504
|
+
}
|
|
120505
|
+
formatLabel(fieldName, value) {
|
|
120506
|
+
var _a, _b;
|
|
120507
|
+
const { userInterface, dataType } = this.dataUnit.getField(fieldName);
|
|
120508
|
+
if (dataType === DataType.DATE) {
|
|
120509
|
+
return (typeof value === 'object')
|
|
120510
|
+
? DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value))
|
|
120511
|
+
: value === null || value === void 0 ? void 0 : value.toString();
|
|
120512
|
+
}
|
|
120513
|
+
if (dataType === DataType.NUMBER && userInterface !== UserInterface.DECIMALNUMBER) {
|
|
120514
|
+
return (_a = parseInt(this.dataUnit.getFormattedValue(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString();
|
|
120515
|
+
}
|
|
120516
|
+
return (_b = this.dataUnit.getFormattedValue(fieldName, value)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
120517
|
+
}
|
|
120518
|
+
}
|
|
120519
|
+
|
|
119971
120520
|
const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ez-grid__header--background-color:var(--background--xlight, #FFF);--ez-grid__selection-counter--z-index:var(--visible, 1);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%)}.grid-header.sc-ez-grid{display:grid;justify-content:space-between;align-items:center;grid-template-columns:1fr;background-color:var(--ez-grid__header--background-color, #FFF);z-index:var(--more-visible, 2)}.grid__container.sc-ez-grid{padding-top:15px;margin-top:-12px;box-shadow:var(--ez-grid__container--shadow);background-color:var(--ez-grid__header--background-color)}.grid-header__popover.sc-ez-grid{position:relative;top:var(--space--sm, 16px)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}.grid-header__position.sc-ez-grid{display:flex;align-items:center;justify-content:space-between}.grid__selection-counter.sc-ez-grid{position:fixed;white-space:nowrap;transform:translate(-50%, 0px);left:50%;opacity:0;bottom:-100%;transition:opacity 0.1s, bottom 0.5s;z-index:var(--ez-grid__selection-counter--z-index)}.grid__selection-counter--opened.sc-ez-grid{opacity:1;bottom:0px}.grid__btn-close.sc-ez-grid{display:flex;align-items:center;justify-content:center;padding:0;outline:none;width:20px;height:20px;border:none;background-color:unset;cursor:pointer}.grid__btn-clear.sc-ez-grid{--ez-button--link-color:var(--color--alert-warning-900, #8C6B00);--ez-button--link--hover-color:var(--color--alert-warning-900, #8C6B00)}[no-header].sc-ez-grid-h .grid-header.sc-ez-grid{height:0;padding:0}";
|
|
119972
120521
|
|
|
119973
120522
|
const windowInstace = window;
|
|
@@ -119981,18 +120530,13 @@ const EzGrid = class {
|
|
|
119981
120530
|
this.componentReady = createEvent(this, "componentReady", 7);
|
|
119982
120531
|
this._gridController = new AgGridController(false);
|
|
119983
120532
|
this._messageFilterAppliedSuccess = 'Filtro de coluna aplicado com sucesso!';
|
|
119984
|
-
this.onDataUnitAction = (action) => {
|
|
119985
|
-
if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
|
|
119986
|
-
this._originalRecords = this.dataUnit.records;
|
|
119987
|
-
}
|
|
119988
|
-
};
|
|
119989
120533
|
this._paginationInfo = undefined;
|
|
119990
120534
|
this._paginationChangedByKeyboard = true;
|
|
119991
120535
|
this._showSelectionCounter = false;
|
|
119992
120536
|
this._isAllSelection = false;
|
|
119993
120537
|
this._currentPageSelected = undefined;
|
|
119994
120538
|
this._selectionCount = undefined;
|
|
119995
|
-
this.
|
|
120539
|
+
this._hasLeftButtons = false;
|
|
119996
120540
|
this.multipleSelection = undefined;
|
|
119997
120541
|
this.config = undefined;
|
|
119998
120542
|
this.selectionToastConfig = undefined;
|
|
@@ -120000,6 +120544,9 @@ const EzGrid = class {
|
|
|
120000
120544
|
this.dataUnit = undefined;
|
|
120001
120545
|
this.statusResolver = undefined;
|
|
120002
120546
|
this.columnfilterDataSource = undefined;
|
|
120547
|
+
this.useEnterLikeTab = false;
|
|
120548
|
+
this.recordsValidator = undefined;
|
|
120549
|
+
this.canEdit = true;
|
|
120003
120550
|
}
|
|
120004
120551
|
/**
|
|
120005
120552
|
* Aplica a definição de colunas.
|
|
@@ -120233,6 +120780,9 @@ const EzGrid = class {
|
|
|
120233
120780
|
serverURL: this.serverUrl,
|
|
120234
120781
|
dataUnit: this.dataUnit,
|
|
120235
120782
|
statusResolver: this.statusResolver,
|
|
120783
|
+
useEnterLikeTab: this.useEnterLikeTab,
|
|
120784
|
+
recordsValidator: this.recordsValidator,
|
|
120785
|
+
editionIsDisabled: () => !this.canEdit
|
|
120236
120786
|
});
|
|
120237
120787
|
if (this.config) {
|
|
120238
120788
|
this.observeConfig(this.config);
|
|
@@ -120241,6 +120791,11 @@ const EzGrid = class {
|
|
|
120241
120791
|
this.setEvents();
|
|
120242
120792
|
this.componentReady.emit();
|
|
120243
120793
|
this._gridController.configFilterColumn(this._filterColumn);
|
|
120794
|
+
this._container.addEventListener('focusout', (event) => {
|
|
120795
|
+
const api = this._gridController.getGridApi();
|
|
120796
|
+
if (api && !this._container.contains(event.relatedTarget))
|
|
120797
|
+
api.clearFocusedCell();
|
|
120798
|
+
});
|
|
120244
120799
|
}
|
|
120245
120800
|
componentWillRender() {
|
|
120246
120801
|
this.configSelectionCounter();
|
|
@@ -120251,44 +120806,20 @@ const EzGrid = class {
|
|
|
120251
120806
|
});
|
|
120252
120807
|
}
|
|
120253
120808
|
componentWillLoad() {
|
|
120809
|
+
this._hasLeftButtons = !!this._element.querySelector('[slot="leftButtons"]');
|
|
120254
120810
|
if (!this.dataUnit.name.includes("InMemoryDataUnit"))
|
|
120255
120811
|
return;
|
|
120256
|
-
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
120257
120812
|
}
|
|
120258
120813
|
getDataSource() {
|
|
120259
|
-
|
|
120260
|
-
|
|
120261
|
-
buildDefaultDataSource() {
|
|
120262
|
-
var _a, _b;
|
|
120263
|
-
if (this._originalRecords.length === 0) {
|
|
120264
|
-
this._originalRecords = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : [];
|
|
120265
|
-
}
|
|
120266
|
-
return {
|
|
120267
|
-
fetchData: (filterTerm, fieldName) => {
|
|
120268
|
-
return new Promise(resolve => {
|
|
120269
|
-
const filteredRecords = this._originalRecords.filter(record => {
|
|
120270
|
-
var _a, _b;
|
|
120271
|
-
const label = typeof record[fieldName] === "object" ? `${(_a = record[fieldName]) === null || _a === void 0 ? void 0 : _a.value} - ${(_b = record[fieldName]) === null || _b === void 0 ? void 0 : _b.label}` : record[fieldName];
|
|
120272
|
-
return label === null || label === void 0 ? void 0 : label.toString().toLowerCase().includes(filterTerm.toLowerCase());
|
|
120273
|
-
});
|
|
120274
|
-
const options = filteredRecords.map(item => {
|
|
120275
|
-
return { value: item[fieldName].toString(), label: this.formatLabel(fieldName, item[fieldName]), check: true };
|
|
120276
|
-
});
|
|
120277
|
-
resolve(options);
|
|
120278
|
-
});
|
|
120279
|
-
}
|
|
120280
|
-
};
|
|
120814
|
+
var _a;
|
|
120815
|
+
return (_a = this.columnfilterDataSource) !== null && _a !== void 0 ? _a : new InMemoryFilterColumnDataSource(this.dataUnit);
|
|
120281
120816
|
}
|
|
120282
|
-
|
|
120283
|
-
|
|
120284
|
-
if (userInterface === UserInterface.DATETIME) {
|
|
120285
|
-
return DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value));
|
|
120286
|
-
}
|
|
120287
|
-
return String(this.dataUnit.getFormattedValue(fieldName, value));
|
|
120817
|
+
hideHeader() {
|
|
120818
|
+
return (!!this._element.getAttribute("no-header") && !this._paginationInfo);
|
|
120288
120819
|
}
|
|
120289
120820
|
render() {
|
|
120290
120821
|
var _a;
|
|
120291
|
-
return (h(Host,
|
|
120822
|
+
return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter
|
|
120292
120823
|
${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
|
|
120293
120824
|
` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
|
|
120294
120825
|
}
|