@sankhyalabs/ezui 1.1.131 → 1.1.132
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/ez-form.cjs.entry.js +14 -3
- package/dist/cjs/ez-grid.cjs.entry.js +22 -12
- package/dist/cjs/ez-list.cjs.entry.js +11 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/grid-config.cjs.entry.js +44 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-form/DataBinder.js +13 -2
- package/dist/collection/components/ez-form/ez-form.js +1 -1
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +6 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +10 -4
- package/dist/collection/components/ez-grid/ez-grid.js +22 -12
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +44 -2
- package/dist/collection/components/ez-list/ez-list.js +27 -0
- package/dist/custom-elements/index.js +92 -19
- package/dist/esm/ez-form.entry.js +14 -3
- package/dist/esm/ez-grid.entry.js +23 -13
- package/dist/esm/ez-list.entry.js +11 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/grid-config.entry.js +44 -2
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-2d165ca8.entry.js → p-a0e6f47b.entry.js} +7 -7
- package/dist/ezui/{p-47fe4273.entry.js → p-cfa7378a.entry.js} +1 -1
- package/dist/ezui/p-d5c93280.entry.js +1 -0
- package/dist/ezui/p-d9bb2a96.entry.js +1 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +3 -3
- package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +1 -0
- package/dist/types/components/ez-list/ez-list.d.ts +4 -0
- package/dist/types/components.d.ts +5 -0
- package/package.json +1 -1
- package/dist/ezui/p-6d39b7ea.entry.js +0 -1
- package/dist/ezui/p-7d5b2ebf.entry.js +0 -1
|
@@ -641,7 +641,12 @@ class DataBinder {
|
|
|
641
641
|
const oldValue = field["value"];
|
|
642
642
|
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
643
643
|
if (oldValue != newValue) {
|
|
644
|
-
|
|
644
|
+
if (newValue === undefined) {
|
|
645
|
+
field.removeAttribute("value");
|
|
646
|
+
}
|
|
647
|
+
else {
|
|
648
|
+
field["value"] = newValue;
|
|
649
|
+
}
|
|
645
650
|
}
|
|
646
651
|
}
|
|
647
652
|
updateBind(fieldName, field) {
|
|
@@ -649,7 +654,13 @@ class DataBinder {
|
|
|
649
654
|
if (oldBind) {
|
|
650
655
|
oldBind.destroy();
|
|
651
656
|
}
|
|
652
|
-
|
|
657
|
+
const value = this._dataUnit.getFieldValue(fieldName);
|
|
658
|
+
if (value === undefined) {
|
|
659
|
+
field.removeAttribute("value");
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
field["value"] = value;
|
|
663
|
+
}
|
|
653
664
|
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
654
665
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
655
666
|
this.applyEzUploadContext(fieldName, field);
|
|
@@ -736,7 +747,7 @@ let EzForm = class {
|
|
|
736
747
|
.filter(f => f.dataset.required)
|
|
737
748
|
.map(f => f.dataset.fieldName)
|
|
738
749
|
.concat(metadata.getRequiredFields());
|
|
739
|
-
const records = this.dataUnit.
|
|
750
|
+
const records = this.dataUnit.getModifiedRecords();
|
|
740
751
|
for (let i = 0; i < records.length; i++) {
|
|
741
752
|
if (!this.validateRequired(requiredFields, records[i])) {
|
|
742
753
|
reject();
|
|
@@ -110357,19 +110357,24 @@ class AgGridController {
|
|
|
110357
110357
|
});
|
|
110358
110358
|
return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
|
|
110359
110359
|
}
|
|
110360
|
-
if ((source === null || source === void 0 ? void 0 : source.userInterface) ===
|
|
110361
|
-
if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
|
|
110360
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UnitMetadata.UserInterface.SWITCH) {
|
|
110361
|
+
if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true || (params === null || params === void 0 ? void 0 : params.value) === "true") {
|
|
110362
110362
|
return "Sim";
|
|
110363
110363
|
}
|
|
110364
|
-
else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
|
|
110364
|
+
else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false || (params === null || params === void 0 ? void 0 : params.value) === "false") {
|
|
110365
110365
|
return "Não";
|
|
110366
110366
|
}
|
|
110367
110367
|
}
|
|
110368
|
-
if ((source === null || source === void 0 ? void 0 : source.userInterface) ===
|
|
110368
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UnitMetadata.UserInterface.SEARCH) {
|
|
110369
110369
|
if (params.value !== undefined) {
|
|
110370
110370
|
return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
|
|
110371
110371
|
}
|
|
110372
110372
|
}
|
|
110373
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UnitMetadata.UserInterface.DECIMALNUMBER) {
|
|
110374
|
+
if (params.value !== undefined) {
|
|
110375
|
+
return core.NumberUtils.format(params.value.toString(), 2, 2);
|
|
110376
|
+
}
|
|
110377
|
+
}
|
|
110373
110378
|
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UnitMetadata.UserInterface.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UnitMetadata.UserInterface.DATETIME) {
|
|
110374
110379
|
if (params.value !== undefined) {
|
|
110375
110380
|
return params.value.toLocaleDateString();
|
|
@@ -110475,7 +110480,12 @@ class DataUnitBridge {
|
|
|
110475
110480
|
this._dataUnit.metadata.fields.forEach(f => {
|
|
110476
110481
|
var _a;
|
|
110477
110482
|
if (f.visible !== false) {
|
|
110478
|
-
|
|
110483
|
+
const props = new Map();
|
|
110484
|
+
const properties = this._dataUnit.getField(f.name).properties;
|
|
110485
|
+
for (const value in properties) {
|
|
110486
|
+
props.set(value, properties[value]);
|
|
110487
|
+
}
|
|
110488
|
+
columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options, props });
|
|
110479
110489
|
}
|
|
110480
110490
|
});
|
|
110481
110491
|
}
|
|
@@ -110496,7 +110506,7 @@ let EzGrid = class {
|
|
|
110496
110506
|
this.ezDoubleClick = index.createEvent(this, "ezDoubleClick", 7);
|
|
110497
110507
|
this.configChange = index.createEvent(this, "configChange", 7);
|
|
110498
110508
|
this._gridController = new AgGridController(false);
|
|
110499
|
-
this.
|
|
110509
|
+
this._popUpGridConfig = false;
|
|
110500
110510
|
/**
|
|
110501
110511
|
* Determina o número de linhas de cada página. Caso informado o valor -1
|
|
110502
110512
|
* não haverá paginação.
|
|
@@ -110670,18 +110680,18 @@ let EzGrid = class {
|
|
|
110670
110680
|
}
|
|
110671
110681
|
applyConfig(config) {
|
|
110672
110682
|
this._gridController.setColumnsState(config.columns);
|
|
110673
|
-
this.
|
|
110683
|
+
this.closeGridConfig();
|
|
110674
110684
|
}
|
|
110675
|
-
|
|
110676
|
-
this.
|
|
110685
|
+
closeGridConfig() {
|
|
110686
|
+
this._popUpGridConfig = false;
|
|
110677
110687
|
}
|
|
110678
|
-
|
|
110688
|
+
openGridConfig() {
|
|
110679
110689
|
this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
|
|
110680
110690
|
this._gridConfig.selectedTab = "Colunas";
|
|
110681
|
-
this.
|
|
110691
|
+
this._popUpGridConfig = true;
|
|
110682
110692
|
}
|
|
110683
110693
|
render() {
|
|
110684
|
-
return (index.h(index.Host, null, index.h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, index.h("div", { class: "grid-header__container" }, index.h("slot", { name: "leftButtons" })), index.h("div", { class: "grid-header__container" }, this.getPaginationControl()
|
|
110694
|
+
return (index.h(index.Host, null, index.h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, index.h("div", { class: "grid-header__container" }, index.h("slot", { name: "leftButtons" })), index.h("div", { class: "grid-header__container" }, this.getPaginationControl())), index.h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), index.h("div", { class: "grid__footer" }), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.applyConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeGridConfig() }))));
|
|
110685
110695
|
}
|
|
110686
110696
|
static get assetsDirs() { return ["../assets"]; }
|
|
110687
110697
|
static get watchers() { return {
|
|
@@ -59,6 +59,17 @@ let EzList = class {
|
|
|
59
59
|
this._listItemsHistory = [];
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
+
* Responsável por dar um scroll top no componente da lista.
|
|
63
|
+
*/
|
|
64
|
+
async scrollToTop() {
|
|
65
|
+
if (this.useGroups) {
|
|
66
|
+
this._element.shadowRoot.querySelector('.group-container').scrollTop = 0;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this._element.shadowRoot.querySelector('.items-container').scrollTop = 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
62
73
|
* Recebe como argumento um ListItem {label: string} e um booleano que define se o componente deve fazer scroll para exibir o item específico (opcional).
|
|
63
74
|
*/
|
|
64
75
|
async setSelection(selectedItem, scrollToOption) {
|
package/dist/cjs/ezui.cjs.js
CHANGED
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"
|
|
18
|
+
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpGridConfig":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64],"openGridConfig":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input.cjs",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config.cjs",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040],"config":[1040]}]]],["ez-modal.cjs",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input.cjs",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search.cjs",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["select-box.cjs",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-date-input.cjs",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input.cjs",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input.cjs",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-list.cjs",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"clearHistory":[64],"scrollToTop":[64],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area.cjs",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-icon.cjs",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-collapsible-box.cjs",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"stretchTitle":[516,"stretch-title"],"showHide":[64]}]]],["ez-upload.cjs",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button.cjs",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar.cjs",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check.cjs",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector.cjs",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box.cjs",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-form.cjs",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]],["test-du.cjs",[[0,"test-du",{"isDirty":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-0e284e03.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const AssetsUtils = require('./AssetsUtils-78164781.js');
|
|
8
|
+
const ApplicationUtils = require('./ApplicationUtils-4a223c7a.js');
|
|
8
9
|
|
|
9
10
|
const gridConfigCss = ".sc-grid-config-h{--ez-grid-config__footer--padding-top:var(--space--medium, 12px);--ez-grid-config__main--padding-right:var(--space--medium, 12px);--ez-grid-config__tabselector-container--padding:var(--space--medium, 12px);--ez-grid-config__button-close--padding-left:var(--space--medium, 12px);--ez-grid-config__subtitle--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-weight:var(--text-weight--large, 700);--ez-grid-config__subtitle--font-size:var(--text--medium, 14px);--ez-grid-config__scrollbar--width:var(--space--medium, 12px);--ez-grid-config__main__scrollbar--background-color:var(--text--primary, #626e82);--ez-grid-config__main__scrollbar--border-radius:var(--border--radius-medium, 12px);--ez-grid__group--font-family:var(--font-pattern, \"Sora\");--ez-grid__group--font-size:var(--text--medium, 14px);--ez-grid__group--font-weight:var(--text-weight--large, 600);--ez-grid__group--padding-bottom:var(--space-small, 6px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.padding-right--medium.sc-grid-config{padding-right:var(--space--medium)}ez-list.sc-grid-config{height:100%}.heigth-calc.sc-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-grid-config{padding-top:var(--ez-grid-config__footer--padding-top);display:flex;justify-content:flex-end;width:100%}.hidden.sc-grid-config{display:none}.grid-config__main.sc-grid-config{padding-right:var(--ez-grid-config__main--padding-right);overflow-y:auto}.tabselector-container.sc-grid-config{padding:var(--ez-grid-config__tabselector-container--padding) 0}.button-close.sc-grid-config{padding-left:var(--ez-grid-config__button-close--padding-left)}.title-container.sc-grid-config{display:flex;justify-content:space-between;align-items:center;width:359px}.subtitle.sc-grid-config{font-family:var(--ez-grid-config__subtitle--font-family);font-size:var(--ez-grid-config__subtitle--font-size);color:var(--text--primary)}.title.sc-grid-config{display:flex;margin:0;font-family:var(--ez-grid-config__title--font-family);font-size:var(--title--large);font-weight:var(--ez-grid-config__title--font-weight);line-height:normal;letter-spacing:0em;text-align:left;color:var(--title--primary)}.grid-config__main.sc-grid-config::-webkit-scrollbar-track{background-color:#f0f2f5}.grid-config__main.sc-grid-config::-webkit-scrollbar-thumb{background-color:var(--ez-grid-config__main__scrollbar--background-color);border-radius:var(--ez-grid-config__main__scrollbar--border-radius)}.grid-config__main.sc-grid-config::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-grid-config__scrollbar--width);max-width:var(--ez-grid-config__scrollbar--width);min-width:var(--ez-grid-config__scrollbar--width)}.group-name.sc-grid-config{font-family:var(--ez-grid__group--font-family);font-size:var(--ez-grid__group--font-size);font-weight:var(--ez-grid__group--font-weight);padding-bottom:var(--ez-grid__group--padding-bottom)}";
|
|
10
11
|
|
|
@@ -17,6 +18,7 @@ let GridConfig = class {
|
|
|
17
18
|
this._orderPriorityList = [];
|
|
18
19
|
this._columListItems = [];
|
|
19
20
|
this._selectedIndex = -1;
|
|
21
|
+
this._dataChanged = false;
|
|
20
22
|
this.selectedTab = "Colunas";
|
|
21
23
|
}
|
|
22
24
|
/* Creation Methods */
|
|
@@ -92,6 +94,7 @@ let GridConfig = class {
|
|
|
92
94
|
}
|
|
93
95
|
updateOrder(sortOrder, updatedItemLabel) {
|
|
94
96
|
var _a;
|
|
97
|
+
this._dataChanged = true;
|
|
95
98
|
let newList = [...this.columns];
|
|
96
99
|
let newItem = newList.find(item => item.label === updatedItemLabel);
|
|
97
100
|
if (newItem) {
|
|
@@ -120,6 +123,7 @@ let GridConfig = class {
|
|
|
120
123
|
switchColumnGroup(ev, switchedItem) {
|
|
121
124
|
ev.stopPropagation();
|
|
122
125
|
let newList = [...this._columListItems];
|
|
126
|
+
this._dataChanged = true;
|
|
123
127
|
if (ev.detail === true) {
|
|
124
128
|
let hiddenGroup = newList.find(group => group.group === "Ocultas");
|
|
125
129
|
let index = hiddenGroup.items.findIndex(item => item.label === switchedItem.label);
|
|
@@ -159,6 +163,9 @@ let GridConfig = class {
|
|
|
159
163
|
});
|
|
160
164
|
});
|
|
161
165
|
this.columns = newColumnList;
|
|
166
|
+
this._dataChanged = false;
|
|
167
|
+
this.closeConfig();
|
|
168
|
+
ApplicationUtils.ApplicationUtils.info("As configurações foram salvas com sucesso!");
|
|
162
169
|
this.save();
|
|
163
170
|
}
|
|
164
171
|
save() {
|
|
@@ -341,13 +348,46 @@ let GridConfig = class {
|
|
|
341
348
|
return false;
|
|
342
349
|
}
|
|
343
350
|
closeConfig() {
|
|
344
|
-
this.
|
|
345
|
-
this.
|
|
351
|
+
this._orderList.scrollToTop();
|
|
352
|
+
this._columnList.scrollToTop();
|
|
353
|
+
this._searchElement.value = "";
|
|
354
|
+
if (this._dataChanged) {
|
|
355
|
+
let options = {
|
|
356
|
+
canClose: false,
|
|
357
|
+
labelCancel: "Descartar",
|
|
358
|
+
labelConfirm: "Salvar",
|
|
359
|
+
btnConfirmDanger: false
|
|
360
|
+
};
|
|
361
|
+
ApplicationUtils.ApplicationUtils.confirm("Aviso", "As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?", null, false, options)
|
|
362
|
+
.then(response => {
|
|
363
|
+
if (!response) {
|
|
364
|
+
this._dataChanged = false;
|
|
365
|
+
this.configCancel.emit();
|
|
366
|
+
this._orderList.clearHistory();
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
this.finish();
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
this.configCancel.emit();
|
|
375
|
+
this._orderList.clearHistory();
|
|
376
|
+
}
|
|
346
377
|
}
|
|
347
378
|
/* Handlers */
|
|
348
379
|
handleTabChange(ev) {
|
|
349
380
|
var _a;
|
|
350
381
|
if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.selectedTab) {
|
|
382
|
+
if (this.selectedTab !== ev.target.selectedTab) {
|
|
383
|
+
if (ev.target.selectedTab === "Colunas") {
|
|
384
|
+
this._orderList.scrollToTop();
|
|
385
|
+
}
|
|
386
|
+
else if (ev.target.selectedTab === "Ordenação das linhas") {
|
|
387
|
+
this._columnList.scrollToTop();
|
|
388
|
+
}
|
|
389
|
+
this._searchElement.value = "";
|
|
390
|
+
}
|
|
351
391
|
if (ev.target.selectedTab === "Ordenação das linhas") {
|
|
352
392
|
this.createOrderList();
|
|
353
393
|
}
|
|
@@ -359,6 +399,7 @@ let GridConfig = class {
|
|
|
359
399
|
if (ev.detail) {
|
|
360
400
|
let visibleItems = (_a = ev.detail.find(group => group.group === "Visíveis")) === null || _a === void 0 ? void 0 : _a.items;
|
|
361
401
|
if (visibleItems) {
|
|
402
|
+
this._dataChanged = true;
|
|
362
403
|
this._orderListItems = visibleItems;
|
|
363
404
|
}
|
|
364
405
|
}
|
|
@@ -367,6 +408,7 @@ let GridConfig = class {
|
|
|
367
408
|
if (ev.detail) {
|
|
368
409
|
let orderPriorityList = ev.detail;
|
|
369
410
|
if (orderPriorityList) {
|
|
411
|
+
this._dataChanged = true;
|
|
370
412
|
this._orderPriorityList = orderPriorityList;
|
|
371
413
|
}
|
|
372
414
|
}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"
|
|
17
|
+
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpGridConfig":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64],"openGridConfig":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input.cjs",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config.cjs",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040],"config":[1040]}]]],["ez-modal.cjs",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input.cjs",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search.cjs",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["select-box.cjs",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-date-input.cjs",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input.cjs",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input.cjs",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-list.cjs",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"clearHistory":[64],"scrollToTop":[64],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area.cjs",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-icon.cjs",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-collapsible-box.cjs",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"stretchTitle":[516,"stretch-title"],"showHide":[64]}]]],["ez-upload.cjs",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button.cjs",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar.cjs",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check.cjs",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector.cjs",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box.cjs",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-form.cjs",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]],["test-du.cjs",[[0,"test-du",{"isDirty":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -39,7 +39,12 @@ export default class DataBinder {
|
|
|
39
39
|
const oldValue = field["value"];
|
|
40
40
|
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
41
41
|
if (oldValue != newValue) {
|
|
42
|
-
|
|
42
|
+
if (newValue === undefined) {
|
|
43
|
+
field.removeAttribute("value");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
field["value"] = newValue;
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
updateBind(fieldName, field) {
|
|
@@ -47,7 +52,13 @@ export default class DataBinder {
|
|
|
47
52
|
if (oldBind) {
|
|
48
53
|
oldBind.destroy();
|
|
49
54
|
}
|
|
50
|
-
|
|
55
|
+
const value = this._dataUnit.getFieldValue(fieldName);
|
|
56
|
+
if (value === undefined) {
|
|
57
|
+
field.removeAttribute("value");
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
field["value"] = value;
|
|
61
|
+
}
|
|
51
62
|
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
52
63
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
53
64
|
this.applyEzUploadContext(fieldName, field);
|
|
@@ -27,7 +27,7 @@ export class EzForm {
|
|
|
27
27
|
.filter(f => f.dataset.required)
|
|
28
28
|
.map(f => f.dataset.fieldName)
|
|
29
29
|
.concat(metadata.getRequiredFields());
|
|
30
|
-
const records = this.dataUnit.
|
|
30
|
+
const records = this.dataUnit.getModifiedRecords();
|
|
31
31
|
for (let i = 0; i < records.length; i++) {
|
|
32
32
|
if (!this.validateRequired(requiredFields, records[i])) {
|
|
33
33
|
reject();
|
|
@@ -38,7 +38,12 @@ export default class DataUnitBridge {
|
|
|
38
38
|
this._dataUnit.metadata.fields.forEach(f => {
|
|
39
39
|
var _a;
|
|
40
40
|
if (f.visible !== false) {
|
|
41
|
-
|
|
41
|
+
const props = new Map();
|
|
42
|
+
const properties = this._dataUnit.getField(f.name).properties;
|
|
43
|
+
for (const value in properties) {
|
|
44
|
+
props.set(value, properties[value]);
|
|
45
|
+
}
|
|
46
|
+
columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options, props });
|
|
42
47
|
}
|
|
43
48
|
});
|
|
44
49
|
}
|
|
@@ -5,6 +5,7 @@ import HeaderColumnTemplate from "./template/HeaderColumnTemplate.js";
|
|
|
5
5
|
import DataSource from "./DataSource";
|
|
6
6
|
import { DataType } from "@sankhyalabs/core";
|
|
7
7
|
import { SortMode, UserInterface } from "@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";
|
|
8
|
+
import { NumberUtils } from "@sankhyalabs/core";
|
|
8
9
|
export default class AgGridController {
|
|
9
10
|
constructor(enterprise) {
|
|
10
11
|
this._menuItems = [];
|
|
@@ -301,19 +302,24 @@ export default class AgGridController {
|
|
|
301
302
|
});
|
|
302
303
|
return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
|
|
303
304
|
}
|
|
304
|
-
if ((source === null || source === void 0 ? void 0 : source.userInterface) ===
|
|
305
|
-
if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
|
|
305
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SWITCH) {
|
|
306
|
+
if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true || (params === null || params === void 0 ? void 0 : params.value) === "true") {
|
|
306
307
|
return "Sim";
|
|
307
308
|
}
|
|
308
|
-
else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
|
|
309
|
+
else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false || (params === null || params === void 0 ? void 0 : params.value) === "false") {
|
|
309
310
|
return "Não";
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
|
-
if ((source === null || source === void 0 ? void 0 : source.userInterface) ===
|
|
313
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SEARCH) {
|
|
313
314
|
if (params.value !== undefined) {
|
|
314
315
|
return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
|
|
315
316
|
}
|
|
316
317
|
}
|
|
318
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DECIMALNUMBER) {
|
|
319
|
+
if (params.value !== undefined) {
|
|
320
|
+
return NumberUtils.format(params.value.toString(), 2, 2);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
317
323
|
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATETIME) {
|
|
318
324
|
if (params.value !== undefined) {
|
|
319
325
|
return params.value.toLocaleDateString();
|
|
@@ -4,7 +4,7 @@ import DataUnitBridge from "./controller/DataUnitBridge";
|
|
|
4
4
|
export class EzGrid {
|
|
5
5
|
constructor() {
|
|
6
6
|
this._gridController = new AgGridController(false);
|
|
7
|
-
this.
|
|
7
|
+
this._popUpGridConfig = false;
|
|
8
8
|
/**
|
|
9
9
|
* Determina o número de linhas de cada página. Caso informado o valor -1
|
|
10
10
|
* não haverá paginação.
|
|
@@ -180,28 +180,26 @@ export class EzGrid {
|
|
|
180
180
|
}
|
|
181
181
|
applyConfig(config) {
|
|
182
182
|
this._gridController.setColumnsState(config.columns);
|
|
183
|
-
this.
|
|
183
|
+
this.closeGridConfig();
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
this.
|
|
185
|
+
closeGridConfig() {
|
|
186
|
+
this._popUpGridConfig = false;
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
openGridConfig() {
|
|
189
189
|
this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
|
|
190
190
|
this._gridConfig.selectedTab = "Colunas";
|
|
191
|
-
this.
|
|
191
|
+
this._popUpGridConfig = true;
|
|
192
192
|
}
|
|
193
193
|
render() {
|
|
194
194
|
return (h(Host, null,
|
|
195
195
|
h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" },
|
|
196
196
|
h("div", { class: "grid-header__container" },
|
|
197
197
|
h("slot", { name: "leftButtons" })),
|
|
198
|
-
h("div", { class: "grid-header__container" },
|
|
199
|
-
this.getPaginationControl(),
|
|
200
|
-
h("ez-button", { size: "small", iconName: "settings", class: "ez-button--secondary", mode: "icon", onClick: () => { this.openConfig(); } }))),
|
|
198
|
+
h("div", { class: "grid-header__container" }, this.getPaginationControl())),
|
|
201
199
|
h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }),
|
|
202
200
|
h("div", { class: "grid__footer" }),
|
|
203
|
-
h("ez-modal", { modalSize: "small", closeEsc:
|
|
204
|
-
h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.applyConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.
|
|
201
|
+
h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() },
|
|
202
|
+
h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.applyConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeGridConfig() }))));
|
|
205
203
|
}
|
|
206
204
|
static get is() { return "ez-grid"; }
|
|
207
205
|
static get encapsulation() { return "scoped"; }
|
|
@@ -312,7 +310,7 @@ export class EzGrid {
|
|
|
312
310
|
"_navigationFirstRow": {},
|
|
313
311
|
"_navigationLastRow": {},
|
|
314
312
|
"_navigationTotalRows": {},
|
|
315
|
-
"
|
|
313
|
+
"_popUpGridConfig": {}
|
|
316
314
|
}; }
|
|
317
315
|
static get events() { return [{
|
|
318
316
|
"method": "ezColumnStateChange",
|
|
@@ -591,6 +589,18 @@ export class EzGrid {
|
|
|
591
589
|
"text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
|
|
592
590
|
"tags": []
|
|
593
591
|
}
|
|
592
|
+
},
|
|
593
|
+
"openGridConfig": {
|
|
594
|
+
"complexType": {
|
|
595
|
+
"signature": "() => Promise<void>",
|
|
596
|
+
"parameters": [],
|
|
597
|
+
"references": {},
|
|
598
|
+
"return": "Promise<void>"
|
|
599
|
+
},
|
|
600
|
+
"docs": {
|
|
601
|
+
"text": "",
|
|
602
|
+
"tags": []
|
|
603
|
+
}
|
|
594
604
|
}
|
|
595
605
|
}; }
|
|
596
606
|
static get watchers() { return [{
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { StringUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { Component, Event, h, Host, Prop } from '@stencil/core';
|
|
3
3
|
import { getSpritePath } from '../../../../utils/AssetsUtils';
|
|
4
|
+
import ApplicationUtils from '../../../../utils/ApplicationUtils';
|
|
4
5
|
export class GridConfig {
|
|
5
6
|
constructor() {
|
|
6
7
|
this._orderListItems = [];
|
|
7
8
|
this._orderPriorityList = [];
|
|
8
9
|
this._columListItems = [];
|
|
9
10
|
this._selectedIndex = -1;
|
|
11
|
+
this._dataChanged = false;
|
|
10
12
|
this.selectedTab = "Colunas";
|
|
11
13
|
}
|
|
12
14
|
/* Creation Methods */
|
|
@@ -84,6 +86,7 @@ export class GridConfig {
|
|
|
84
86
|
}
|
|
85
87
|
updateOrder(sortOrder, updatedItemLabel) {
|
|
86
88
|
var _a;
|
|
89
|
+
this._dataChanged = true;
|
|
87
90
|
let newList = [...this.columns];
|
|
88
91
|
let newItem = newList.find(item => item.label === updatedItemLabel);
|
|
89
92
|
if (newItem) {
|
|
@@ -112,6 +115,7 @@ export class GridConfig {
|
|
|
112
115
|
switchColumnGroup(ev, switchedItem) {
|
|
113
116
|
ev.stopPropagation();
|
|
114
117
|
let newList = [...this._columListItems];
|
|
118
|
+
this._dataChanged = true;
|
|
115
119
|
if (ev.detail === true) {
|
|
116
120
|
let hiddenGroup = newList.find(group => group.group === "Ocultas");
|
|
117
121
|
let index = hiddenGroup.items.findIndex(item => item.label === switchedItem.label);
|
|
@@ -151,6 +155,9 @@ export class GridConfig {
|
|
|
151
155
|
});
|
|
152
156
|
});
|
|
153
157
|
this.columns = newColumnList;
|
|
158
|
+
this._dataChanged = false;
|
|
159
|
+
this.closeConfig();
|
|
160
|
+
ApplicationUtils.info("As configurações foram salvas com sucesso!");
|
|
154
161
|
this.save();
|
|
155
162
|
}
|
|
156
163
|
save() {
|
|
@@ -333,13 +340,46 @@ export class GridConfig {
|
|
|
333
340
|
return false;
|
|
334
341
|
}
|
|
335
342
|
closeConfig() {
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
343
|
+
this._orderList.scrollToTop();
|
|
344
|
+
this._columnList.scrollToTop();
|
|
345
|
+
this._searchElement.value = "";
|
|
346
|
+
if (this._dataChanged) {
|
|
347
|
+
let options = {
|
|
348
|
+
canClose: false,
|
|
349
|
+
labelCancel: "Descartar",
|
|
350
|
+
labelConfirm: "Salvar",
|
|
351
|
+
btnConfirmDanger: false
|
|
352
|
+
};
|
|
353
|
+
ApplicationUtils.confirm("Aviso", "As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?", null, false, options)
|
|
354
|
+
.then(response => {
|
|
355
|
+
if (!response) {
|
|
356
|
+
this._dataChanged = false;
|
|
357
|
+
this.configCancel.emit();
|
|
358
|
+
this._orderList.clearHistory();
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
this.finish();
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
this.configCancel.emit();
|
|
367
|
+
this._orderList.clearHistory();
|
|
368
|
+
}
|
|
338
369
|
}
|
|
339
370
|
/* Handlers */
|
|
340
371
|
handleTabChange(ev) {
|
|
341
372
|
var _a;
|
|
342
373
|
if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.selectedTab) {
|
|
374
|
+
if (this.selectedTab !== ev.target.selectedTab) {
|
|
375
|
+
if (ev.target.selectedTab === "Colunas") {
|
|
376
|
+
this._orderList.scrollToTop();
|
|
377
|
+
}
|
|
378
|
+
else if (ev.target.selectedTab === "Ordenação das linhas") {
|
|
379
|
+
this._columnList.scrollToTop();
|
|
380
|
+
}
|
|
381
|
+
this._searchElement.value = "";
|
|
382
|
+
}
|
|
343
383
|
if (ev.target.selectedTab === "Ordenação das linhas") {
|
|
344
384
|
this.createOrderList();
|
|
345
385
|
}
|
|
@@ -351,6 +391,7 @@ export class GridConfig {
|
|
|
351
391
|
if (ev.detail) {
|
|
352
392
|
let visibleItems = (_a = ev.detail.find(group => group.group === "Visíveis")) === null || _a === void 0 ? void 0 : _a.items;
|
|
353
393
|
if (visibleItems) {
|
|
394
|
+
this._dataChanged = true;
|
|
354
395
|
this._orderListItems = visibleItems;
|
|
355
396
|
}
|
|
356
397
|
}
|
|
@@ -359,6 +400,7 @@ export class GridConfig {
|
|
|
359
400
|
if (ev.detail) {
|
|
360
401
|
let orderPriorityList = ev.detail;
|
|
361
402
|
if (orderPriorityList) {
|
|
403
|
+
this._dataChanged = true;
|
|
362
404
|
this._orderPriorityList = orderPriorityList;
|
|
363
405
|
}
|
|
364
406
|
}
|