@sankhyalabs/sankhyablocks 2.1.1 → 2.1.3
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/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -1
- package/dist/cjs/snk-configurator_6.cjs.entry.js +31 -11
- package/dist/cjs/snk-crud.cjs.entry.js +6 -2
- package/dist/cjs/snk-field-config_2.cjs.entry.js +1 -1
- package/dist/cjs/{taskbar-elements-90350a55.js → taskbar-elements-d762e436.js} +1 -1
- package/dist/collection/components/snk-application/snk-application.js +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +25 -1
- package/dist/collection/components/snk-grid/snk-grid.js +18 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +1 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +30 -10
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -0
- package/dist/components/snk-application2.js +2 -1
- package/dist/components/snk-crud.js +6 -1
- package/dist/components/snk-grid2.js +2 -1
- package/dist/components/snk-taskbar2.js +31 -11
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -1
- package/dist/esm/snk-configurator_6.entry.js +31 -11
- package/dist/esm/snk-crud.entry.js +6 -2
- package/dist/esm/snk-field-config_2.entry.js +1 -1
- package/dist/esm/{taskbar-elements-0f41cd77.js → taskbar-elements-1092b0b7.js} +1 -1
- package/dist/sankhyablocks/{p-e8591491.entry.js → p-429c5e3f.entry.js} +1 -1
- package/dist/sankhyablocks/p-4fab64ec.js +1 -0
- package/dist/sankhyablocks/{p-eb23420d.entry.js → p-6511d132.entry.js} +1 -1
- package/dist/sankhyablocks/{p-599846fb.entry.js → p-8c14bbfb.entry.js} +2 -1
- package/dist/sankhyablocks/p-c4ae984b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +3 -1
- package/dist/types/components.d.ts +16 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-59d8c47a.js +0 -1
- package/dist/sankhyablocks/p-e128f747.entry.js +0 -1
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period",[[0,"snk-filter-period",{"config":[16],"value":[8],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16],"show":[64]}]]],["snk-filter-search",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-config-options",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"_defaultType":[32]}]]],["snk-tab-config",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["snk-filter-detail",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["snk-field-config_2",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"setShowGridConfig":[64],"setConfig":[64]}],[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16]}]]],["snk-form-config",[[2,"snk-form-config",{"dataUnit":[16],"formConfig":[16],"parentForm":[16],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["snk-config-modal",[[2,"snk-config-modal",{"configName":[1,"config-name"],"gridMode":[4,"grid-mode"]}]]],["snk-configurator_6",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[6,"snk-taskbar",{"configName":[1,"config-name"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[2,"snk-configurator",{"configName":[1,"config-name"],"name":[1],"enabled":[4]}]]],["snk-form",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32],"_showFormConfig":[32],"setShowFormConfig":[64],"setConfig":[64]}]]],["snk-crud",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["snk-application",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"fetchUserAvailableConfigs":[64],"fetchLegacyConfig":[64],"fetchDefaultConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"saveFormConfig":[64],"getDefaultValues":[64],"getDefaultValue":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]]], options);
|
|
16
|
+
return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period",[[0,"snk-filter-period",{"config":[16],"value":[8],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16],"show":[64]}]]],["snk-filter-search",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-config-options",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"_defaultType":[32]}]]],["snk-tab-config",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["snk-filter-detail",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["snk-field-config_2",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"setShowGridConfig":[64],"setConfig":[64]}],[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16]}]]],["snk-form-config",[[2,"snk-form-config",{"dataUnit":[16],"formConfig":[16],"parentForm":[16],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["snk-config-modal",[[2,"snk-config-modal",{"configName":[1,"config-name"],"gridMode":[4,"grid-mode"]}]]],["snk-configurator_6",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[6,"snk-taskbar",{"configName":[1,"config-name"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[2,"snk-configurator",{"configName":[1,"config-name"],"name":[1],"enabled":[4]}]]],["snk-form",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32],"_showFormConfig":[32],"setShowFormConfig":[64],"setConfig":[64]}]]],["snk-crud",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["snk-application",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"fetchUserAvailableConfigs":[64],"fetchLegacyConfig":[64],"fetchDefaultConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"saveFormConfig":[64],"getDefaultValues":[64],"getDefaultValue":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]]], options);
|
|
17
17
|
});
|
|
@@ -227,6 +227,7 @@ class DataUnitFetcher {
|
|
|
227
227
|
dataType
|
|
228
228
|
userInterface
|
|
229
229
|
calculated
|
|
230
|
+
group
|
|
230
231
|
properties{
|
|
231
232
|
name
|
|
232
233
|
value
|
|
@@ -1274,7 +1275,7 @@ const SnkApplication = class {
|
|
|
1274
1275
|
});
|
|
1275
1276
|
}
|
|
1276
1277
|
render() {
|
|
1277
|
-
return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "
|
|
1278
|
+
return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
|
|
1278
1279
|
}
|
|
1279
1280
|
};
|
|
1280
1281
|
class RequestListenerLoadingBar {
|
|
@@ -6,7 +6,7 @@ import { C as ConfigurableElementsStorage } from './configurableElementsStorage-
|
|
|
6
6
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
7
7
|
import { ModalAction, ModalButtonStatus } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
|
8
8
|
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
9
|
-
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-
|
|
9
|
+
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-1092b0b7.js';
|
|
10
10
|
|
|
11
11
|
const GRID_MODE = VIEW_MODE.grid;
|
|
12
12
|
const FORM_MODE = VIEW_MODE.form;
|
|
@@ -1021,14 +1021,14 @@ const SnkTaskbar = class {
|
|
|
1021
1021
|
// Internal methods
|
|
1022
1022
|
elementsFromString(strButtons) {
|
|
1023
1023
|
const elements = [];
|
|
1024
|
-
if (strButtons)
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1024
|
+
if (strButtons == null)
|
|
1025
|
+
return elements;
|
|
1026
|
+
strButtons.split(",").forEach(buttonName => {
|
|
1027
|
+
buttonName = buttonName.trim();
|
|
1028
|
+
if (VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
|
|
1029
|
+
elements.push(buttonName.trim());
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
1032
|
return elements;
|
|
1033
1033
|
}
|
|
1034
1034
|
isAllowed(buttonName) {
|
|
@@ -1117,12 +1117,32 @@ const SnkTaskbar = class {
|
|
|
1117
1117
|
this._definitions = this.elementsFromString(this.buttons);
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
|
+
isDivider(element) {
|
|
1121
|
+
var _a;
|
|
1122
|
+
if (element === undefined) {
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1125
|
+
return (_a = element.$attrs$) === null || _a === void 0 ? void 0 : _a["data-taskbar-divider"];
|
|
1126
|
+
}
|
|
1127
|
+
removeEmpty(elements) {
|
|
1128
|
+
let lastElem;
|
|
1129
|
+
return elements.filter(elem => {
|
|
1130
|
+
if (elem == undefined) {
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1133
|
+
if (this.isDivider(lastElem) && this.isDivider(elem)) {
|
|
1134
|
+
return false;
|
|
1135
|
+
}
|
|
1136
|
+
lastElem = elem;
|
|
1137
|
+
return true;
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1120
1140
|
render() {
|
|
1121
1141
|
if (this._definitions === undefined) {
|
|
1122
1142
|
return undefined;
|
|
1123
1143
|
}
|
|
1124
1144
|
let index = 0;
|
|
1125
|
-
return (h(Host, null, this._definitions.map((elem) => {
|
|
1145
|
+
return (h(Host, null, this.removeEmpty(this._definitions.map((elem) => {
|
|
1126
1146
|
if (elem === TaskbarElement.DIVIDER) {
|
|
1127
1147
|
index = 0;
|
|
1128
1148
|
}
|
|
@@ -1136,7 +1156,7 @@ const SnkTaskbar = class {
|
|
|
1136
1156
|
return this.getElement(index, this.customButtons.get(elem));
|
|
1137
1157
|
}
|
|
1138
1158
|
return h("slot", { name: elem });
|
|
1139
|
-
})));
|
|
1159
|
+
}))));
|
|
1140
1160
|
}
|
|
1141
1161
|
static get watchers() { return {
|
|
1142
1162
|
"buttons": ["observeButtons"]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-e4121713.js';
|
|
2
2
|
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { c as VIEW_MODE } from './constants-c6039d3d.js';
|
|
4
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
|
4
|
+
import { T as TaskbarElement } from './taskbar-elements-1092b0b7.js';
|
|
5
5
|
|
|
6
6
|
const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
|
7
7
|
|
|
@@ -11,6 +11,10 @@ const SnkCrud = class {
|
|
|
11
11
|
constructor(hostRef) {
|
|
12
12
|
registerInstance(this, hostRef);
|
|
13
13
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
14
|
+
/**
|
|
15
|
+
* Determina se pode haver mais de uma linha selecionada na grade
|
|
16
|
+
*/
|
|
17
|
+
this.multipleSelection = true;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* Usado para alternar a visão entre GRID e FORM externamente.
|
|
@@ -65,7 +69,7 @@ const SnkCrud = class {
|
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
render() {
|
|
68
|
-
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
|
|
72
|
+
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
|
|
69
73
|
}
|
|
70
74
|
get _element() { return getElement(this); }
|
|
71
75
|
};
|
|
@@ -126,7 +126,7 @@ const SnkGrid = class {
|
|
|
126
126
|
if (!this._dataUnit) {
|
|
127
127
|
return undefined;
|
|
128
128
|
}
|
|
129
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver }, h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" }))));
|
|
129
|
+
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" }))));
|
|
130
130
|
}
|
|
131
131
|
get _element() { return getElement(this); }
|
|
132
132
|
};
|
|
@@ -74,7 +74,7 @@ const buildElem = (element, className, getTitle, action, isEnabled, actions, con
|
|
|
74
74
|
case TaskbarElement.MORE_OPTIONS:
|
|
75
75
|
return actions && actions.length > 0 ? h("ez-actions-button", { title: title, size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions }) : undefined;
|
|
76
76
|
case TaskbarElement.DIVIDER:
|
|
77
|
-
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
|
|
77
|
+
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium", "data-taskbar-divider": true });
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
function textButton(name, className, text, title, action, isEnabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,g as s,H as r}from"./p-9ba3df4c.js";import{ObjectUtils as l,ApplicationContext as n,DataType as a,StringUtils as o,ErrorException as h,FloatingManager as c,ArrayUtils as d}from"@sankhyalabs/core";import{ApplicationUtils as u,CheckMode as m}from"@sankhyalabs/ezui/dist/collection/utils";import{C as f,c as b}from"./p-a5b26df2.js";import{C as k}from"./p-d50651a3.js";import{F as p}from"./p-9dd2b8cb.js";import{ModalAction as _,ModalButtonStatus as v}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{toString as g}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{T as F,V as z,A as x,b as y,a as T}from"./p-59d8c47a.js";const C=b.grid,L=b.form,I=class{constructor(e){t(this,e),this.changeViewMode=i(this,"changeViewMode",7),this.name="snkConfigurator",this.enabled=!0}getMessage(t){return this._application.messagesBuilder.getMessage(t,{})}controlConfigModal(t){var i;null!=this._modal&&(this._modal.opened=t,null!=this._configModal&&(this._configModal.gridMode=null!=(null===(i=this._grid)||void 0===i?void 0:i.offsetParent)))}changeConfigModal(t){const i=null==t?void 0:t.detail;(null==i?void 0:i.openConfig)?(this.controlConfigModal(!1),this.callShowConfig(null==i?void 0:i.viewMode)):(null==i?void 0:i.viewMode)===C.index?this.changeViewMode.emit(C.name):(null==i?void 0:i.viewMode)===L.index&&this.changeViewMode.emit(L.name)}callShowConfig(t){t===C.index?(null==this._grid&&this.findGrid(),null!=this._grid&&this._grid.setShowGridConfig(!0)):t===L.index&&(null==this._form&&this.findForm(),null!=this._form&&this._form.setShowFormConfig(!0))}getConfigModal(){const t=document.createElement("ez-modal");t.modalSize="small",t.opened=!1,t.closeEsc=!1,t.closeOutsideClick=!1,t.dataset.configuratorModal=this.name,t.addEventListener(f.closeModal,(()=>{this.controlConfigModal(!1)}));const i=document.createElement("snk-config-modal");return i.addEventListener(f.cancelConfig,(()=>{this.controlConfigModal(!1)})),i.addEventListener(f.changeConfig,(t=>{this.changeConfigModal(t)})),i.configName=this.configName,t.append(i),t}findConfigModal(){let t=document.body.querySelector(`[data-configurator-modal="${this.name}"]`);null==t&&(t=this.getConfigModal(),document.body.appendChild(t)),this._modal=t,this._configModal=t.querySelector("snk-config-modal")}findGrid(){null==this._grid&&(this._grid=k.getGrid(this.configName),null!=this._grid&&null==this._grid.dataset.eventConfigChanged&&(this._grid.dataset.eventConfigChanged="true",this._grid.addEventListener(f.configChanged,(t=>{this.saveConfig(t)}))))}findForm(){null==this._form&&(this._form=k.getForm(this.configName),null!=this._form&&null==this._form.dataset.eventConfigChanged&&(this._form.dataset.eventConfigChanged="true",this._form.addEventListener(f.configChanged,(t=>{this.saveConfig(t)}))))}saveConfig(t){const i=null==t?void 0:t.detail;null!=this._application&&null!=i&&(null!=(null==i?void 0:i.fields)?this._application.saveFormConfig(i,this.configName).then((t=>{null!=(null==t?void 0:t.resource)&&this.loadFormConfig(!0)})):null!=(null==i?void 0:i.columns)&&this._application.saveGridConfig(i).then((t=>{null!=(null==t?void 0:t.resource)&&this.setGridConfig(t.resource)})))}setGridConfig(t){if(null!=this._grid){const i=l.stringToObject(t);this._grid.setConfig(i).then((()=>{u.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"),{iconName:"check"})}))}}loadGridConfig(){null!=this._application&&null!=this.configName&&null!=this._grid&&this._application.loadGridConfig(this.configName).then((t=>{this._grid.setConfig(t)}))}loadFormConfig(t=!1){null!=this._application&&null!=this.configName&&null!=this._form&&this._application.loadFormConfig(this.configName).then((i=>{this._form.setConfig(i).then((()=>{t&&u.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"),{iconName:"check"})}))}))}loadConfig(){this._application=n.getContextValue("__SNK__APPLICATION__"),this.loadGridConfig(),this.loadFormConfig()}componentDidLoad(){this.findConfigModal(),this.findGrid(),this.findForm(),this.loadConfig()}render(){return e("ez-button",{mode:"icon",iconName:"settings-inverted",size:"small",enabled:this.enabled,onClick:()=>this.controlConfigModal(!0)})}get _element(){return s(this)}},w=class{constructor(i){t(this,i),this._updateSequence=[],this._loadingPending=!1,this._configUpdated=!1,this._pendingFilters=[],this._calculateSortIndex=t=>{let i=t.hardFixed?1e6:0;return t.hardFixed||(i+=t.fixed?1e5:0,i+=null==t.value?0:1e4,i+=this._updateSequence.lastIndexOf(t.id)+1),i},this._filtersComparator=(t,i)=>this._calculateSortIndex(i)-this._calculateSortIndex(t)}observeFilterConfig(t,i){if(null!=i&&null==t)this._loadingPending=!0,this._configUpdated=!0;else{const e=new Map(i?i.map((t=>[t.id,t])):void 0);t.forEach((t=>{const i=e.get(t.id);null!=i?(this._configUpdated=this._configUpdated||l.objectToString(i)!=l.objectToString(t),this._loadingPending=this._loadingPending||l.objectToString(i.value)!==l.objectToString(t.value)):(this._configUpdated=!0,this._loadingPending=this._loadingPending||null!=t.value)}))}this.processAfterUpdateConfig()}processPendingFilter(){this._pendingFilters.length>0&&null==this._currentPendingFilter&&(this._currentPendingFilter=this._element.querySelector("#filter-"+this._pendingFilters.pop()),this._currentPendingFilter&&this._currentPendingFilter.showUp(!0).then((()=>{this._currentPendingFilter=void 0,this.processPendingFilter()}))),null==this._currentPendingFilter&&this.processAfterUpdateConfig()}processAfterUpdateConfig(){this._pendingFilters.length>0||(this._loadingPending&&(this._loadingPending=!1,this.dataUnit.loadData()),this._configUpdated&&(this._configUpdated=!1,this._application.saveFilterBarConfig(this.filterConfig,this.configName)))}getMessage(t,i){return this._application.messagesBuilder.getMessage(t,i)}getFilter(t){var i;const e=[];return null===(i=this.filterConfig)||void 0===i||i.filter((t=>this.isActiveFilter(t))).forEach((t=>{const i=(t=>{switch(t.type){case p.DEFAULT_FILTER:return function(t){return{name:t.id,expression:t.props.expression,params:[]}}(t);case p.BINARY_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.options.find((t=>t.name===e)).expression,params:[]}}(t);case p.MULTI_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:e}]}}(t);case p.PERIOD:return function(t){const{id:i,value:e,props:s}=t;let{end:r,start:l}=e;"string"==typeof r&&(r=new Date(r)),"string"==typeof l&&(l=new Date(l));const n=[];let o;return r&&l?(o=s.expression.fullfill,n.push({name:`${i}.START`,dataType:a.DATE,value:g(a.DATE,l)},{name:`${i}.END`,dataType:a.DATE,value:g(a.DATE,r)})):l?(o=s.expression.onlystart,n.push({name:i,dataType:a.DATE,value:g(a.DATE,l)})):(o=s.expression.onlyend,n.push({name:i,dataType:a.DATE,value:g(a.DATE,r)})),{name:i,expression:o,params:n}}(t);case p.SEARCH:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:g(a.TEXT,e.value)}]}}(t);case p.TEXT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:g(a.TEXT,e)}]}}(t);case p.NUMBER:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.NUMBER,value:g(a.NUMBER,e)}]}}(t);case p.PERSONALIZED:return function(t){var i;const{id:e,value:s,props:r}=t;return{name:e,expression:r.expression,params:((null===(i=r.personalizedFilter)||void 0===i?void 0:i.parameters)||[]).map(((t,i)=>{const e=Array.from(s),r=t.dataType;let l=i>=0&&i<e.length?e[i]:null;return null!=l&&"object"==typeof l&&"value"in l&&(l=l.value),null==l&&r===a.BOOLEAN&&(l=!1),{name:t.name,dataType:r,value:"string"==typeof l?l:g(r,l)}}))}}(t);default:return}})(t);i&&e.push(i)})),e}isActiveFilter(t){return t.visible&&null!=t.value||t.type===p.DEFAULT_FILTER}registryFilterProvider(){this.dataUnit.addFilterProvider(this),this.filterConfig&&this.dataUnit.loadData()}itemFocused(t){this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach((i=>{i.id===t?"snk-filter-item"===i.tagName.toLowerCase()&&i.getClientRects()[0].x<0&&i.scrollIntoView({behavior:"auto",inline:"nearest"}):i.hideDetail()}))}getFilterItems(){const t=[],i=[];this.filterConfig.filter((t=>t.visible)).forEach(((s,r)=>{const l=`filter-${s.id}`,n=e("snk-filter-item",{onFocusin:()=>this.itemFocused(l),id:l,config:s,class:r>0?"ez-padding-left--medium":"",getMessage:(t,i)=>this.getMessage(t,i),key:s.id});return s.fixed||s.hardFixed?t.push(n):i.push(n),n}));const s=[];return s.push(...t),t.length>0&&i.length>0&&s.push(e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider"})),s.push(...i),s}calculateUpdateSequence(t){t&&(this._updateSequence=this._updateSequence.filter((i=>t.id!==i)),this._updateSequence.push(t.id))}normalizeItem(t){const i=Object.assign({},t);return["props","value","hardFixed","fixed"].forEach((t=>{null==i[t]&&delete i[t]})),""===t.value&&delete t.value,i}updateFilter(t){this.filterConfig=this.filterConfig.map((i=>(t=this.normalizeItem(t),i.id===t.id?(l.objectToString(i)!=l.objectToString(t)&&this.calculateUpdateSequence(t),t):i))).sort(((t,i)=>this._filtersComparator(t,i)))}getAddListItems(){const t=this.filterConfig.filter((t=>!t.visible&&this.isListable(t))),i=[{name:"PERSONALIZED_FILTER",label:this.getMessage("snkFilterBar.customFilter"),iconName:"tune",kind:"FOOTER"}];return this.allowDefault&&i.push({name:"DEFAULT_FILTER",label:this.getMessage("snkFilterBar.defaultFilter"),iconName:"configuration",kind:"FOOTER"}),t.map((t=>({name:t.id,label:t.label,kind:"FILTER",iconName:null}))).concat(i)}getActiveClass(){return this.filterConfig.filter((t=>null!=t.value)).length>0?"sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active":""}isListable(t,i=!1){return t.type!==p.DEFAULT_FILTER&&(i||t.type!==p.PERSONALIZED)}getAppliedListItems(){return this.filterConfig.filter((t=>this.isActiveFilter(t)&&this.isListable(t,!0))).map((t=>({name:t.id,label:t.label,kind:"FILTER",iconName:null}))).concat([{name:"CLEAR_ALL_FILTERS",label:this.getMessage("snkFilterBar.clearAllFilters"),iconName:"cleaning",kind:"FOOTER"}])}addPersonalizedFilters(t){const i={};t.forEach((t=>{t.active&&(i[t.id]=!0)})),this.filterConfig=this.filterConfig.map((t=>{var e,s;if(t.type===p.PERSONALIZED){const r=i[t.id];return!t.visible&&r&&(this.calculateUpdateSequence(t),null!=(null===(s=null===(e=t.props)||void 0===e?void 0:e.personalizedFilter)||void 0===s?void 0:s.parameters)&&this._pendingFilters.push(t.id)),this.normalizeItem(Object.assign(Object.assign({},t),r?{visible:r}:{visible:r,value:void 0,fixed:void 0}))}return t})).sort(((t,i)=>this._filtersComparator(t,i)))}openDefaultFilterModal(){const t=document.createElement("snk-filter-modal"),i=this.filterConfig.filter((t=>t.type===p.DEFAULT_FILTER));t.getMessage=(t,i)=>this.getMessage(t,i),t.modalTitle=this.getMessage("snkFilterBar.modalDefaultFilterTitle"),t.infoText=this.getMessage(0==i.length?"snkFilterBar.modalInfoTextCreateDefault":"snkFilterBar.modalInfoTextEditDefault"),t.items=i.map((t=>({id:t.id,active:!0,enabled:!1,label:t.label}))),t.processModalAction=()=>{this._application.closeModal()},this._application.showModal(t)}openPersonalizedModal(){const t=document.createElement("snk-filter-modal"),i=this.filterConfig.filter((t=>t.type===p.PERSONALIZED)).sort(((t,i)=>o.compare(t.label,i.label)));t.getMessage=(t,i)=>this.getMessage(t,i),t.modalTitle=this.getMessage("snkFilterBar.modalPersonalizedFilterTitle"),t.modalSubTitle=this.getMessage("snkFilterBar.modalPersonalizedFilterSubTitle"),t.okButtonLabel=this.getMessage("snkFilterBar.modalOkButtonLabel"),t.cancelButtonLabel=this.getMessage("snkFilterBar.modalCancelButtonLabel"),t.infoText=this.getMessage("snkFilterBar.modalInfoTextCreateEditPersonalized"),t.useSearch=!0,t.items=i.map((t=>({id:t.id,active:t.visible,enabled:!0,label:t.label}))),t.processModalAction=i=>{i===_.CANCEL?t.items=t.items.map((t=>Object.assign(Object.assign({},t),{active:!1}))):(i===_.OK&&this.addPersonalizedFilters(t.items),this._application.closeModal())},this._application.showModal(t)}clearFilters(){let t=!1;return this.filterConfig=this.filterConfig.map((i=>(null!=i.value&&(t=!0),Object.assign(Object.assign({},i),{value:void 0})))).sort(((t,i)=>this._filtersComparator(t,i))),t}loadPermitions(){this._application.isUserSup().then((t=>this.allowDefault=t))}loadConfigFromApplication(){this._application.getFilterBarConfig(this.configName).then((t=>{this.filterConfig=t.map((t=>this.normalizeItem(t))),this.dataUnit&&this.dataUnit.loadData()})).catch((t=>{throw new h(this.getMessage("snkFilterBar.failToLoadConfig"),t)}))}attachDataUnit(){if(null==this.dataUnit){let t=this._element.parentElement;for(;t;)if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){const i=t;this.dataUnit=i.dataUnit,this.dataUnit?this.registryFilterProvider():i.addEventListener("dataUnitReady",(t=>{this.dataUnit=t.detail,this.registryFilterProvider()}));break}t=t.parentElement}else this.registryFilterProvider()}filterChangeListener(t){this.updateFilter(t.detail)}addFilterHandler(t){const i=this.filterConfig.find((i=>i.id===t));"PERSONALIZED_FILTER"===t?this.openPersonalizedModal():"DEFAULT_FILTER"===t?this.openDefaultFilterModal():i&&(this._pendingFilters.push(t),this.updateFilter(Object.assign(Object.assign({},i),{visible:!0})))}appliedFilterHandler(t){if("CLEAR_ALL_FILTERS"===t)this.clearFilters()&&this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"),{iconName:"check"});else{const i=this._element.querySelector("#filter-"+t);i&&i.showUp(!0)}}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__"),this._application&&(this.loadPermitions(),this.loadConfigFromApplication()),this.attachDataUnit()}componentDidRender(){this.processPendingFilter()}render(){if(this.dataUnit&&this.filterConfig&&0!==this.filterConfig.length)return e(r,null,e("ez-scroller",{direction:"horizontal"},this.getFilterItems()),e("snk-filter-list",{id:"APPLIED_FILTERS",onFocusin:()=>this.itemFocused("APPLIED_FILTERS"),items:this.getAppliedListItems(),getMessage:(t,i)=>this.getMessage(t,i),emptyText:this.getMessage("snkFilterBar.emptyAppliedFiltersList"),findFilterText:this.getMessage("snkFilterBar.findFilter"),iconName:"filter",class:"ez-padding-left--medium",buttonClass:this.getActiveClass(),onSnkItemSelected:t=>this.appliedFilterHandler(t.detail)}),e("snk-filter-list",{id:"ADD_FILTER",onFocusin:()=>this.itemFocused("ADD_FILTER"),items:this.getAddListItems(),label:this.getMessage("snkFilterBar.addFilter"),getMessage:(t,i)=>this.getMessage(t,i),emptyText:this.getMessage("snkFilterBar.emptyFiltersList"),findFilterText:this.getMessage("snkFilterBar.findField"),class:"ez-padding-left--medium",onSnkItemSelected:t=>this.addFilterHandler(t.detail)},e("ez-icon",{slot:"leftIcon",class:"ez-padding-right--small",iconName:"plus"})))}get _element(){return s(this)}static get watchers(){return{filterConfig:["observeFilterConfig"]}}};w.style='.sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 2);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:"";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:100%;height:100%}';const E=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.innerClickCheck=(t,i)=>i.id!=c.MODAL_ELEMENT_ID||(this.detailIsVisible=!1,!1)}async showUp(t=!1){return new Promise((i=>{this._filterItemElement.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}),t&&(this._closeCallback=i,window.requestAnimationFrame((()=>{this._floatingID=c.float(this._popover,this._popoverContainer,{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onDetailCloseCallback(),left:this.getScrollOffset(),useOverlay:!0}),this._popover.show(),this.detailIsVisible=!0})))}))}getScrollOffset(){const t=getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");return`calc(${this._filterItemElement.getBoundingClientRect().left}px + ${t})`}async hideDetail(){this.detailIsVisible&&null!=this._floatingID&&c.close(this._floatingID)}onDetailCloseCallback(){this._floatingID=void 0,this.detailIsVisible=!1,this._closeCallback&&(this._closeCallback(),this._closeCallback=void 0)}clickListener(t){[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.target===this._rightIconElement&&null!=this.config.value?this.filterChange.emit(Object.assign(Object.assign({},this.config),{value:void 0})):this.detailIsVisible?this.hideDetail():this.showUp(!0),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}mouseDownListener(t){this.detailIsVisible&&[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}getLabel(){const{type:t,value:i,label:e,props:s}=this.config;if(i){if(t===p.BINARY_SELECT){const[t,e]=s.options;if(t.name===i)return t.label;if(e.name===i)return e.label}if(t===p.MULTI_SELECT)return`${e}: ${s.options.find((t=>t.value===i)).label}`;if(t===p.PERIOD){let{end:t,start:s}=i;"string"==typeof t&&(t=new Date(t),t.setMinutes(t.getMinutes()+t.getTimezoneOffset())),"string"==typeof s&&(s=new Date(s),s.setMinutes(s.getMinutes()+s.getTimezoneOffset()));const r=new Intl.DateTimeFormat("pt-BR");return t&&s?`${e}: ${r.format(s)} a ${r.format(t)}`:s?`${e}: A partir de ${r.format(s)}`:t?`${e}: Até ${r.format(t)}`:e}return t===p.SEARCH?`${e}: ${i.value} - ${i.label}`:t===p.PERSONALIZED?e:`${e}: ${i}`}return e}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}filterChangeListener(){this.hideDetail()}getRightIconName(){return null!=this.config.value?"close":this.detailIsVisible?"chevron-up":"chevron-down"}getLeftIconName(){switch(this.config.type){case p.PERIOD:return"calendar";case p.PERSONALIZED:return"tune"}}render(){const t=this.getLeftIconName();return e(r,null,e("ez-chip",{ref:t=>this._chipElement=t,label:this.getLabel(),value:null!=this.config.value},t?e("ez-icon",{ref:t=>this._leftIconElement=t,iconName:t,class:"ez-padding-right--small",slot:"leftIcon"}):void 0,e("ez-icon",{ref:t=>this._rightIconElement=t,iconName:this.getRightIconName(),class:"ez-padding-left--small",slot:"rightIcon"})),e("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},e("snk-filter-detail",{config:this.config,getMessage:this.getMessage,class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t,key:this.config.id})))}get _filterItemElement(){return s(this)}},A=class{constructor(e){t(this,e),this.snkItemSelected=i(this,"snkItemSelected",7),this._preselection=-1,this.innerClickCheck=(t,i)=>i.id!=c.MODAL_ELEMENT_ID||(this._detailIsVisible=!1,!1)}showDetail(){this._preselection=-1,this._floatingID=c.float(this._popover,this._popoverContainer,{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onListCloseCallback(),useOverlay:!0}),this._detailIsVisible=!0,this._showAll=!1,this._filterArgument="",this._filterInput.setFocus()}async hideDetail(){null!=this._floatingID&&c.close(this._floatingID)}onListCloseCallback(){this._floatingID=void 0,this._detailIsVisible=!1}buttonClick(){this._detailIsVisible?this.hideDetail():this.showDetail()}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}buildItemElement(t){const i=++this._selectableItemsCount;return e("button",{id:`filter-item${i}`,onFocusin:()=>this._preselection=i,class:"ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item",onClick:()=>this.itemSelected(t.name)},t.iconName?e("ez-icon",{iconName:t.iconName,size:"small",class:`ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${t.iconClass||""}`}):void 0,e("div",{class:`ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${t.labelClass||""}`},t.label))}itemSelected(t){"__SHOWMORE__"===t?this._showAll=!0:(this.hideDetail(),this.snkItemSelected.emit(t))}getFilterItems(){const t=this.items?d.applyStringFilter(this._filterArgument,this.items.filter((t=>"FILTER"===t.kind))):[];return 0===t.length?e("div",{class:"ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty"},this.emptyText):(!this._filterArgument&&!this._showAll&&t.length>6&&(t.splice(5),t.push({kind:"INTERNAL",label:"Mostrar mais",iconName:"dots-horizontal",name:"__SHOWMORE__",iconClass:"snk-filter-bar__filter-list-item__icon--secondary",labelClass:"snk-filter-bar__filter-list-item__label--secondary"})),this._selectableItemsCount=0,e("div",{class:"sc-snk-filter-bar snk-filter-bar__filter-list-items-container"},t.map((t=>this.buildItemElement(t)))))}getFooterItems(){return this.items.filter((t=>"FOOTER"===t.kind))}keyDownHandler(t){switch(t.key){case"ArrowDown":this.changePreselection(this._preselection+1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.changePreselection(this._preselection-1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()}}changePreselection(t){if(t<0&&(t=this._selectableItemsCount),this._preselection=t>this._selectableItemsCount?0:t,0===this._preselection)this._filterInput.setFocus();else{const t=this._element.querySelector(`#filter-item${this._preselection}`);t&&t.focus()}}render(){return e(r,{class:"ez-flex ez-flex--column"},e("ez-button",{class:this.buttonClass,label:this.label,onClick:()=>this.buttonClick(),mode:this.iconName?"icon":void 0,iconName:this.iconName,size:"small"},e("slot",{name:"leftIcon"})),e("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},e("div",{class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t},e("ez-filter-input",{ref:t=>this._filterInput=t,mode:"slim",label:this.findFilterText,value:this._filterArgument,onEzChange:t=>this._filterArgument=t.detail,onFocus:()=>this._preselection=0}),this.getFilterItems(),e("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),this.items?this.getFooterItems().map((t=>this.buildItemElement(t))):void 0)))}get _element(){return s(this)}},O=class{constructor(i){t(this,i)}updateValue(t,i){this.items=this.items.map((e=>e.id===t&&e.enabled?(null==i&&(i=!e.active),Object.assign(Object.assign({},e),{active:i})):e))}getActiveFiltersMsg(){const t=this.items.filter((t=>t.active)).length;return 0===t?this.getMessage("snkFilterBar.noActiveFilters"):this.getMessage(t>1?"snkFilterBar.activeFilters":"snkFilterBar.activeFilter",{ACTIVE_FILTERS:t})}buildItems(t){return t.map((t=>e("button",{onClick:()=>this.updateValue(t.id),class:"ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small"},e("ez-check",{id:`checkbox_${t.id}`,tabIndex:"-1",class:"sc-snk-filter-bar snk-filter-bar__filter-modal-item__check",onEzChange:i=>this.updateValue(t.id,i.detail),enabled:t.enabled,value:t.active,mode:m.SWITCH}),e("div",{class:"ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label"},t.label))))}itemKeyBoardSelect(t,i){"Enter"!==t.key&&" "!==t.key||this.updateValue(i.id)}modalActionListener(t){const i=t.detail;i===_.LOAD?this._filterInput&&this._filterInput.setFocus():this.processModalAction(i)}render(){const t=this.items.filter((t=>t.active)).length>0,i=this.items?d.applyStringFilter(this._filterArgument,this.items):[];return e("ez-modal-container",{modalTitle:this.modalTitle,modalSubTitle:this.modalSubTitle,cancelButtonLabel:this.cancelButtonLabel,okButtonLabel:this.okButtonLabel,onEzModalAction:t=>this.modalActionListener(t),cancelButtonStatus:t?v.ENABLED:v.DISABLED},e("div",{class:"sc-snk-filter-bar snk-filter-bar__filter-modal-content"},e("div",null,this.useSearch?e("ez-filter-input",{ref:t=>this._filterInput=t,label:this.getMessage("snkFilterBar.modalFindFilter"),onEzChange:t=>this._filterArgument=t.detail}):void 0),i.length>0?e("div",{class:"ez-text ez-text--medium ez-text--primary ez-padding-bottom--small"},this.getActiveFiltersMsg()):void 0,e("div",null,this.buildItems(i)),e("div",{class:"ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large"},this.infoText)))}},R=class{constructor(e){t(this,e),this.actionClick=i(this,"actionClick",7),this.actionChange=i(this,"actionChange",7),this._titleKeyByElement={[F.UPDATE]:"snkTaskbar.titleUpdate",[F.PREVIOUS]:"snkTaskbar.titlePrevious",[F.NEXT]:"snkTaskbar.titleNext",[F.REFRESH]:"snkTaskbar.titleRefresh",[F.CLONE]:"snkTaskbar.titleClone",[F.REMOVE]:"snkTaskbar.titleRemove",[F.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[F.INSERT]:"snkTaskbar.titleInsert",[F.CANCEL]:"snkTaskbar.titleCancel",[F.SAVE]:"snkTaskbar.titleSave",[F.GRID_MODE]:"snkTaskbar.titleGridMode",[F.FORM_MODE]:"snkTaskbar.titleFormMode",[F.CONFIGURATOR]:"snkTaskbar.titleConfigurator"}}observeButtons(){this._definitions=void 0}elementsFromString(t){const i=[];return t&&t.split(",").forEach((t=>{t=t.trim(),(z[t]||this.isAllowed(t))&&i.push(t.trim())})),i}isAllowed(t){return!x[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?this._application.messagesBuilder.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case F.PREVIOUS:this.dataUnit.previousRecord();break;case F.NEXT:this.dataUnit.nextRecord();break;case F.REFRESH:this.dataUnit.loadData();break;case F.CLONE:this.dataUnit.copySelected();break;case F.REMOVE:this.dataUnit.removeSelectedRecords();break;case F.INSERT:this.dataUnit.addRecord();break;case F.CANCEL:this.dataUnit.cancelEdition();break;case F.SAVE:this.dataUnit.saveData()}this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}getElement(t,i){let e=i===this.primaryButton?"ez-button--primary ":"";return t>1&&(e+="ez-padding-left--medium"),F[i.toString()]?y(i,e,(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.actionsList,this.configName):T(i,e,(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess().then((t=>this._permissions=t)):this._permissions={}}componentWillRender(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}render(){if(void 0===this._definitions)return;let t=0;return e(r,null,this._definitions.map((i=>(i===F.DIVIDER?t=0:t++,F[i]?this.getElement(t,F[i]):this.customButtons.has(i)?this.getElement(t,this.customButtons.get(i)):e("slot",{name:i})))))}static get watchers(){return{buttons:["observeButtons"]}}};R.style=".sc-snk-taskbar-h{display:flex}";export{I as snk_configurator,w as snk_filter_bar,E as snk_filter_item,A as snk_filter_list,O as snk_filter_modal,R as snk_taskbar}
|
|
1
|
+
import{r as t,c as i,h as e,g as s,H as r}from"./p-9ba3df4c.js";import{ObjectUtils as l,ApplicationContext as n,DataType as a,StringUtils as o,ErrorException as h,FloatingManager as c,ArrayUtils as d}from"@sankhyalabs/core";import{ApplicationUtils as u,CheckMode as m}from"@sankhyalabs/ezui/dist/collection/utils";import{C as f,c as b}from"./p-a5b26df2.js";import{C as k}from"./p-d50651a3.js";import{F as p}from"./p-9dd2b8cb.js";import{ModalAction as _,ModalButtonStatus as v}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{toString as g}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{T as F,V as z,A as x,b as y,a as T}from"./p-4fab64ec.js";const C=b.grid,L=b.form,I=class{constructor(e){t(this,e),this.changeViewMode=i(this,"changeViewMode",7),this.name="snkConfigurator",this.enabled=!0}getMessage(t){return this._application.messagesBuilder.getMessage(t,{})}controlConfigModal(t){var i;null!=this._modal&&(this._modal.opened=t,null!=this._configModal&&(this._configModal.gridMode=null!=(null===(i=this._grid)||void 0===i?void 0:i.offsetParent)))}changeConfigModal(t){const i=null==t?void 0:t.detail;(null==i?void 0:i.openConfig)?(this.controlConfigModal(!1),this.callShowConfig(null==i?void 0:i.viewMode)):(null==i?void 0:i.viewMode)===C.index?this.changeViewMode.emit(C.name):(null==i?void 0:i.viewMode)===L.index&&this.changeViewMode.emit(L.name)}callShowConfig(t){t===C.index?(null==this._grid&&this.findGrid(),null!=this._grid&&this._grid.setShowGridConfig(!0)):t===L.index&&(null==this._form&&this.findForm(),null!=this._form&&this._form.setShowFormConfig(!0))}getConfigModal(){const t=document.createElement("ez-modal");t.modalSize="small",t.opened=!1,t.closeEsc=!1,t.closeOutsideClick=!1,t.dataset.configuratorModal=this.name,t.addEventListener(f.closeModal,(()=>{this.controlConfigModal(!1)}));const i=document.createElement("snk-config-modal");return i.addEventListener(f.cancelConfig,(()=>{this.controlConfigModal(!1)})),i.addEventListener(f.changeConfig,(t=>{this.changeConfigModal(t)})),i.configName=this.configName,t.append(i),t}findConfigModal(){let t=document.body.querySelector(`[data-configurator-modal="${this.name}"]`);null==t&&(t=this.getConfigModal(),document.body.appendChild(t)),this._modal=t,this._configModal=t.querySelector("snk-config-modal")}findGrid(){null==this._grid&&(this._grid=k.getGrid(this.configName),null!=this._grid&&null==this._grid.dataset.eventConfigChanged&&(this._grid.dataset.eventConfigChanged="true",this._grid.addEventListener(f.configChanged,(t=>{this.saveConfig(t)}))))}findForm(){null==this._form&&(this._form=k.getForm(this.configName),null!=this._form&&null==this._form.dataset.eventConfigChanged&&(this._form.dataset.eventConfigChanged="true",this._form.addEventListener(f.configChanged,(t=>{this.saveConfig(t)}))))}saveConfig(t){const i=null==t?void 0:t.detail;null!=this._application&&null!=i&&(null!=(null==i?void 0:i.fields)?this._application.saveFormConfig(i,this.configName).then((t=>{null!=(null==t?void 0:t.resource)&&this.loadFormConfig(!0)})):null!=(null==i?void 0:i.columns)&&this._application.saveGridConfig(i).then((t=>{null!=(null==t?void 0:t.resource)&&this.setGridConfig(t.resource)})))}setGridConfig(t){if(null!=this._grid){const i=l.stringToObject(t);this._grid.setConfig(i).then((()=>{u.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"),{iconName:"check"})}))}}loadGridConfig(){null!=this._application&&null!=this.configName&&null!=this._grid&&this._application.loadGridConfig(this.configName).then((t=>{this._grid.setConfig(t)}))}loadFormConfig(t=!1){null!=this._application&&null!=this.configName&&null!=this._form&&this._application.loadFormConfig(this.configName).then((i=>{this._form.setConfig(i).then((()=>{t&&u.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"),{iconName:"check"})}))}))}loadConfig(){this._application=n.getContextValue("__SNK__APPLICATION__"),this.loadGridConfig(),this.loadFormConfig()}componentDidLoad(){this.findConfigModal(),this.findGrid(),this.findForm(),this.loadConfig()}render(){return e("ez-button",{mode:"icon",iconName:"settings-inverted",size:"small",enabled:this.enabled,onClick:()=>this.controlConfigModal(!0)})}get _element(){return s(this)}},w=class{constructor(i){t(this,i),this._updateSequence=[],this._loadingPending=!1,this._configUpdated=!1,this._pendingFilters=[],this._calculateSortIndex=t=>{let i=t.hardFixed?1e6:0;return t.hardFixed||(i+=t.fixed?1e5:0,i+=null==t.value?0:1e4,i+=this._updateSequence.lastIndexOf(t.id)+1),i},this._filtersComparator=(t,i)=>this._calculateSortIndex(i)-this._calculateSortIndex(t)}observeFilterConfig(t,i){if(null!=i&&null==t)this._loadingPending=!0,this._configUpdated=!0;else{const e=new Map(i?i.map((t=>[t.id,t])):void 0);t.forEach((t=>{const i=e.get(t.id);null!=i?(this._configUpdated=this._configUpdated||l.objectToString(i)!=l.objectToString(t),this._loadingPending=this._loadingPending||l.objectToString(i.value)!==l.objectToString(t.value)):(this._configUpdated=!0,this._loadingPending=this._loadingPending||null!=t.value)}))}this.processAfterUpdateConfig()}processPendingFilter(){this._pendingFilters.length>0&&null==this._currentPendingFilter&&(this._currentPendingFilter=this._element.querySelector("#filter-"+this._pendingFilters.pop()),this._currentPendingFilter&&this._currentPendingFilter.showUp(!0).then((()=>{this._currentPendingFilter=void 0,this.processPendingFilter()}))),null==this._currentPendingFilter&&this.processAfterUpdateConfig()}processAfterUpdateConfig(){this._pendingFilters.length>0||(this._loadingPending&&(this._loadingPending=!1,this.dataUnit.loadData()),this._configUpdated&&(this._configUpdated=!1,this._application.saveFilterBarConfig(this.filterConfig,this.configName)))}getMessage(t,i){return this._application.messagesBuilder.getMessage(t,i)}getFilter(t){var i;const e=[];return null===(i=this.filterConfig)||void 0===i||i.filter((t=>this.isActiveFilter(t))).forEach((t=>{const i=(t=>{switch(t.type){case p.DEFAULT_FILTER:return function(t){return{name:t.id,expression:t.props.expression,params:[]}}(t);case p.BINARY_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.options.find((t=>t.name===e)).expression,params:[]}}(t);case p.MULTI_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:e}]}}(t);case p.PERIOD:return function(t){const{id:i,value:e,props:s}=t;let{end:r,start:l}=e;"string"==typeof r&&(r=new Date(r)),"string"==typeof l&&(l=new Date(l));const n=[];let o;return r&&l?(o=s.expression.fullfill,n.push({name:`${i}.START`,dataType:a.DATE,value:g(a.DATE,l)},{name:`${i}.END`,dataType:a.DATE,value:g(a.DATE,r)})):l?(o=s.expression.onlystart,n.push({name:i,dataType:a.DATE,value:g(a.DATE,l)})):(o=s.expression.onlyend,n.push({name:i,dataType:a.DATE,value:g(a.DATE,r)})),{name:i,expression:o,params:n}}(t);case p.SEARCH:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:g(a.TEXT,e.value)}]}}(t);case p.TEXT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:g(a.TEXT,e)}]}}(t);case p.NUMBER:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.NUMBER,value:g(a.NUMBER,e)}]}}(t);case p.PERSONALIZED:return function(t){var i;const{id:e,value:s,props:r}=t;return{name:e,expression:r.expression,params:((null===(i=r.personalizedFilter)||void 0===i?void 0:i.parameters)||[]).map(((t,i)=>{const e=Array.from(s),r=t.dataType;let l=i>=0&&i<e.length?e[i]:null;return null!=l&&"object"==typeof l&&"value"in l&&(l=l.value),null==l&&r===a.BOOLEAN&&(l=!1),{name:t.name,dataType:r,value:"string"==typeof l?l:g(r,l)}}))}}(t);default:return}})(t);i&&e.push(i)})),e}isActiveFilter(t){return t.visible&&null!=t.value||t.type===p.DEFAULT_FILTER}registryFilterProvider(){this.dataUnit.addFilterProvider(this),this.filterConfig&&this.dataUnit.loadData()}itemFocused(t){this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach((i=>{i.id===t?"snk-filter-item"===i.tagName.toLowerCase()&&i.getClientRects()[0].x<0&&i.scrollIntoView({behavior:"auto",inline:"nearest"}):i.hideDetail()}))}getFilterItems(){const t=[],i=[];this.filterConfig.filter((t=>t.visible)).forEach(((s,r)=>{const l=`filter-${s.id}`,n=e("snk-filter-item",{onFocusin:()=>this.itemFocused(l),id:l,config:s,class:r>0?"ez-padding-left--medium":"",getMessage:(t,i)=>this.getMessage(t,i),key:s.id});return s.fixed||s.hardFixed?t.push(n):i.push(n),n}));const s=[];return s.push(...t),t.length>0&&i.length>0&&s.push(e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider"})),s.push(...i),s}calculateUpdateSequence(t){t&&(this._updateSequence=this._updateSequence.filter((i=>t.id!==i)),this._updateSequence.push(t.id))}normalizeItem(t){const i=Object.assign({},t);return["props","value","hardFixed","fixed"].forEach((t=>{null==i[t]&&delete i[t]})),""===t.value&&delete t.value,i}updateFilter(t){this.filterConfig=this.filterConfig.map((i=>(t=this.normalizeItem(t),i.id===t.id?(l.objectToString(i)!=l.objectToString(t)&&this.calculateUpdateSequence(t),t):i))).sort(((t,i)=>this._filtersComparator(t,i)))}getAddListItems(){const t=this.filterConfig.filter((t=>!t.visible&&this.isListable(t))),i=[{name:"PERSONALIZED_FILTER",label:this.getMessage("snkFilterBar.customFilter"),iconName:"tune",kind:"FOOTER"}];return this.allowDefault&&i.push({name:"DEFAULT_FILTER",label:this.getMessage("snkFilterBar.defaultFilter"),iconName:"configuration",kind:"FOOTER"}),t.map((t=>({name:t.id,label:t.label,kind:"FILTER",iconName:null}))).concat(i)}getActiveClass(){return this.filterConfig.filter((t=>null!=t.value)).length>0?"sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active":""}isListable(t,i=!1){return t.type!==p.DEFAULT_FILTER&&(i||t.type!==p.PERSONALIZED)}getAppliedListItems(){return this.filterConfig.filter((t=>this.isActiveFilter(t)&&this.isListable(t,!0))).map((t=>({name:t.id,label:t.label,kind:"FILTER",iconName:null}))).concat([{name:"CLEAR_ALL_FILTERS",label:this.getMessage("snkFilterBar.clearAllFilters"),iconName:"cleaning",kind:"FOOTER"}])}addPersonalizedFilters(t){const i={};t.forEach((t=>{t.active&&(i[t.id]=!0)})),this.filterConfig=this.filterConfig.map((t=>{var e,s;if(t.type===p.PERSONALIZED){const r=i[t.id];return!t.visible&&r&&(this.calculateUpdateSequence(t),null!=(null===(s=null===(e=t.props)||void 0===e?void 0:e.personalizedFilter)||void 0===s?void 0:s.parameters)&&this._pendingFilters.push(t.id)),this.normalizeItem(Object.assign(Object.assign({},t),r?{visible:r}:{visible:r,value:void 0,fixed:void 0}))}return t})).sort(((t,i)=>this._filtersComparator(t,i)))}openDefaultFilterModal(){const t=document.createElement("snk-filter-modal"),i=this.filterConfig.filter((t=>t.type===p.DEFAULT_FILTER));t.getMessage=(t,i)=>this.getMessage(t,i),t.modalTitle=this.getMessage("snkFilterBar.modalDefaultFilterTitle"),t.infoText=this.getMessage(0==i.length?"snkFilterBar.modalInfoTextCreateDefault":"snkFilterBar.modalInfoTextEditDefault"),t.items=i.map((t=>({id:t.id,active:!0,enabled:!1,label:t.label}))),t.processModalAction=()=>{this._application.closeModal()},this._application.showModal(t)}openPersonalizedModal(){const t=document.createElement("snk-filter-modal"),i=this.filterConfig.filter((t=>t.type===p.PERSONALIZED)).sort(((t,i)=>o.compare(t.label,i.label)));t.getMessage=(t,i)=>this.getMessage(t,i),t.modalTitle=this.getMessage("snkFilterBar.modalPersonalizedFilterTitle"),t.modalSubTitle=this.getMessage("snkFilterBar.modalPersonalizedFilterSubTitle"),t.okButtonLabel=this.getMessage("snkFilterBar.modalOkButtonLabel"),t.cancelButtonLabel=this.getMessage("snkFilterBar.modalCancelButtonLabel"),t.infoText=this.getMessage("snkFilterBar.modalInfoTextCreateEditPersonalized"),t.useSearch=!0,t.items=i.map((t=>({id:t.id,active:t.visible,enabled:!0,label:t.label}))),t.processModalAction=i=>{i===_.CANCEL?t.items=t.items.map((t=>Object.assign(Object.assign({},t),{active:!1}))):(i===_.OK&&this.addPersonalizedFilters(t.items),this._application.closeModal())},this._application.showModal(t)}clearFilters(){let t=!1;return this.filterConfig=this.filterConfig.map((i=>(null!=i.value&&(t=!0),Object.assign(Object.assign({},i),{value:void 0})))).sort(((t,i)=>this._filtersComparator(t,i))),t}loadPermitions(){this._application.isUserSup().then((t=>this.allowDefault=t))}loadConfigFromApplication(){this._application.getFilterBarConfig(this.configName).then((t=>{this.filterConfig=t.map((t=>this.normalizeItem(t))),this.dataUnit&&this.dataUnit.loadData()})).catch((t=>{throw new h(this.getMessage("snkFilterBar.failToLoadConfig"),t)}))}attachDataUnit(){if(null==this.dataUnit){let t=this._element.parentElement;for(;t;)if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){const i=t;this.dataUnit=i.dataUnit,this.dataUnit?this.registryFilterProvider():i.addEventListener("dataUnitReady",(t=>{this.dataUnit=t.detail,this.registryFilterProvider()}));break}t=t.parentElement}else this.registryFilterProvider()}filterChangeListener(t){this.updateFilter(t.detail)}addFilterHandler(t){const i=this.filterConfig.find((i=>i.id===t));"PERSONALIZED_FILTER"===t?this.openPersonalizedModal():"DEFAULT_FILTER"===t?this.openDefaultFilterModal():i&&(this._pendingFilters.push(t),this.updateFilter(Object.assign(Object.assign({},i),{visible:!0})))}appliedFilterHandler(t){if("CLEAR_ALL_FILTERS"===t)this.clearFilters()&&this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"),{iconName:"check"});else{const i=this._element.querySelector("#filter-"+t);i&&i.showUp(!0)}}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__"),this._application&&(this.loadPermitions(),this.loadConfigFromApplication()),this.attachDataUnit()}componentDidRender(){this.processPendingFilter()}render(){if(this.dataUnit&&this.filterConfig&&0!==this.filterConfig.length)return e(r,null,e("ez-scroller",{direction:"horizontal"},this.getFilterItems()),e("snk-filter-list",{id:"APPLIED_FILTERS",onFocusin:()=>this.itemFocused("APPLIED_FILTERS"),items:this.getAppliedListItems(),getMessage:(t,i)=>this.getMessage(t,i),emptyText:this.getMessage("snkFilterBar.emptyAppliedFiltersList"),findFilterText:this.getMessage("snkFilterBar.findFilter"),iconName:"filter",class:"ez-padding-left--medium",buttonClass:this.getActiveClass(),onSnkItemSelected:t=>this.appliedFilterHandler(t.detail)}),e("snk-filter-list",{id:"ADD_FILTER",onFocusin:()=>this.itemFocused("ADD_FILTER"),items:this.getAddListItems(),label:this.getMessage("snkFilterBar.addFilter"),getMessage:(t,i)=>this.getMessage(t,i),emptyText:this.getMessage("snkFilterBar.emptyFiltersList"),findFilterText:this.getMessage("snkFilterBar.findField"),class:"ez-padding-left--medium",onSnkItemSelected:t=>this.addFilterHandler(t.detail)},e("ez-icon",{slot:"leftIcon",class:"ez-padding-right--small",iconName:"plus"})))}get _element(){return s(this)}static get watchers(){return{filterConfig:["observeFilterConfig"]}}};w.style='.sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 2);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:"";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:100%;height:100%}';const E=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.innerClickCheck=(t,i)=>i.id!=c.MODAL_ELEMENT_ID||(this.detailIsVisible=!1,!1)}async showUp(t=!1){return new Promise((i=>{this._filterItemElement.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}),t&&(this._closeCallback=i,window.requestAnimationFrame((()=>{this._floatingID=c.float(this._popover,this._popoverContainer,{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onDetailCloseCallback(),left:this.getScrollOffset(),useOverlay:!0}),this._popover.show(),this.detailIsVisible=!0})))}))}getScrollOffset(){const t=getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");return`calc(${this._filterItemElement.getBoundingClientRect().left}px + ${t})`}async hideDetail(){this.detailIsVisible&&null!=this._floatingID&&c.close(this._floatingID)}onDetailCloseCallback(){this._floatingID=void 0,this.detailIsVisible=!1,this._closeCallback&&(this._closeCallback(),this._closeCallback=void 0)}clickListener(t){[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.target===this._rightIconElement&&null!=this.config.value?this.filterChange.emit(Object.assign(Object.assign({},this.config),{value:void 0})):this.detailIsVisible?this.hideDetail():this.showUp(!0),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}mouseDownListener(t){this.detailIsVisible&&[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}getLabel(){const{type:t,value:i,label:e,props:s}=this.config;if(i){if(t===p.BINARY_SELECT){const[t,e]=s.options;if(t.name===i)return t.label;if(e.name===i)return e.label}if(t===p.MULTI_SELECT)return`${e}: ${s.options.find((t=>t.value===i)).label}`;if(t===p.PERIOD){let{end:t,start:s}=i;"string"==typeof t&&(t=new Date(t),t.setMinutes(t.getMinutes()+t.getTimezoneOffset())),"string"==typeof s&&(s=new Date(s),s.setMinutes(s.getMinutes()+s.getTimezoneOffset()));const r=new Intl.DateTimeFormat("pt-BR");return t&&s?`${e}: ${r.format(s)} a ${r.format(t)}`:s?`${e}: A partir de ${r.format(s)}`:t?`${e}: Até ${r.format(t)}`:e}return t===p.SEARCH?`${e}: ${i.value} - ${i.label}`:t===p.PERSONALIZED?e:`${e}: ${i}`}return e}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}filterChangeListener(){this.hideDetail()}getRightIconName(){return null!=this.config.value?"close":this.detailIsVisible?"chevron-up":"chevron-down"}getLeftIconName(){switch(this.config.type){case p.PERIOD:return"calendar";case p.PERSONALIZED:return"tune"}}render(){const t=this.getLeftIconName();return e(r,null,e("ez-chip",{ref:t=>this._chipElement=t,label:this.getLabel(),value:null!=this.config.value},t?e("ez-icon",{ref:t=>this._leftIconElement=t,iconName:t,class:"ez-padding-right--small",slot:"leftIcon"}):void 0,e("ez-icon",{ref:t=>this._rightIconElement=t,iconName:this.getRightIconName(),class:"ez-padding-left--small",slot:"rightIcon"})),e("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},e("snk-filter-detail",{config:this.config,getMessage:this.getMessage,class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t,key:this.config.id})))}get _filterItemElement(){return s(this)}},A=class{constructor(e){t(this,e),this.snkItemSelected=i(this,"snkItemSelected",7),this._preselection=-1,this.innerClickCheck=(t,i)=>i.id!=c.MODAL_ELEMENT_ID||(this._detailIsVisible=!1,!1)}showDetail(){this._preselection=-1,this._floatingID=c.float(this._popover,this._popoverContainer,{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onListCloseCallback(),useOverlay:!0}),this._detailIsVisible=!0,this._showAll=!1,this._filterArgument="",this._filterInput.setFocus()}async hideDetail(){null!=this._floatingID&&c.close(this._floatingID)}onListCloseCallback(){this._floatingID=void 0,this._detailIsVisible=!1}buttonClick(){this._detailIsVisible?this.hideDetail():this.showDetail()}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}buildItemElement(t){const i=++this._selectableItemsCount;return e("button",{id:`filter-item${i}`,onFocusin:()=>this._preselection=i,class:"ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item",onClick:()=>this.itemSelected(t.name)},t.iconName?e("ez-icon",{iconName:t.iconName,size:"small",class:`ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${t.iconClass||""}`}):void 0,e("div",{class:`ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${t.labelClass||""}`},t.label))}itemSelected(t){"__SHOWMORE__"===t?this._showAll=!0:(this.hideDetail(),this.snkItemSelected.emit(t))}getFilterItems(){const t=this.items?d.applyStringFilter(this._filterArgument,this.items.filter((t=>"FILTER"===t.kind))):[];return 0===t.length?e("div",{class:"ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty"},this.emptyText):(!this._filterArgument&&!this._showAll&&t.length>6&&(t.splice(5),t.push({kind:"INTERNAL",label:"Mostrar mais",iconName:"dots-horizontal",name:"__SHOWMORE__",iconClass:"snk-filter-bar__filter-list-item__icon--secondary",labelClass:"snk-filter-bar__filter-list-item__label--secondary"})),this._selectableItemsCount=0,e("div",{class:"sc-snk-filter-bar snk-filter-bar__filter-list-items-container"},t.map((t=>this.buildItemElement(t)))))}getFooterItems(){return this.items.filter((t=>"FOOTER"===t.kind))}keyDownHandler(t){switch(t.key){case"ArrowDown":this.changePreselection(this._preselection+1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.changePreselection(this._preselection-1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()}}changePreselection(t){if(t<0&&(t=this._selectableItemsCount),this._preselection=t>this._selectableItemsCount?0:t,0===this._preselection)this._filterInput.setFocus();else{const t=this._element.querySelector(`#filter-item${this._preselection}`);t&&t.focus()}}render(){return e(r,{class:"ez-flex ez-flex--column"},e("ez-button",{class:this.buttonClass,label:this.label,onClick:()=>this.buttonClick(),mode:this.iconName?"icon":void 0,iconName:this.iconName,size:"small"},e("slot",{name:"leftIcon"})),e("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},e("div",{class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t},e("ez-filter-input",{ref:t=>this._filterInput=t,mode:"slim",label:this.findFilterText,value:this._filterArgument,onEzChange:t=>this._filterArgument=t.detail,onFocus:()=>this._preselection=0}),this.getFilterItems(),e("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),this.items?this.getFooterItems().map((t=>this.buildItemElement(t))):void 0)))}get _element(){return s(this)}},O=class{constructor(i){t(this,i)}updateValue(t,i){this.items=this.items.map((e=>e.id===t&&e.enabled?(null==i&&(i=!e.active),Object.assign(Object.assign({},e),{active:i})):e))}getActiveFiltersMsg(){const t=this.items.filter((t=>t.active)).length;return 0===t?this.getMessage("snkFilterBar.noActiveFilters"):this.getMessage(t>1?"snkFilterBar.activeFilters":"snkFilterBar.activeFilter",{ACTIVE_FILTERS:t})}buildItems(t){return t.map((t=>e("button",{onClick:()=>this.updateValue(t.id),class:"ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small"},e("ez-check",{id:`checkbox_${t.id}`,tabIndex:"-1",class:"sc-snk-filter-bar snk-filter-bar__filter-modal-item__check",onEzChange:i=>this.updateValue(t.id,i.detail),enabled:t.enabled,value:t.active,mode:m.SWITCH}),e("div",{class:"ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label"},t.label))))}itemKeyBoardSelect(t,i){"Enter"!==t.key&&" "!==t.key||this.updateValue(i.id)}modalActionListener(t){const i=t.detail;i===_.LOAD?this._filterInput&&this._filterInput.setFocus():this.processModalAction(i)}render(){const t=this.items.filter((t=>t.active)).length>0,i=this.items?d.applyStringFilter(this._filterArgument,this.items):[];return e("ez-modal-container",{modalTitle:this.modalTitle,modalSubTitle:this.modalSubTitle,cancelButtonLabel:this.cancelButtonLabel,okButtonLabel:this.okButtonLabel,onEzModalAction:t=>this.modalActionListener(t),cancelButtonStatus:t?v.ENABLED:v.DISABLED},e("div",{class:"sc-snk-filter-bar snk-filter-bar__filter-modal-content"},e("div",null,this.useSearch?e("ez-filter-input",{ref:t=>this._filterInput=t,label:this.getMessage("snkFilterBar.modalFindFilter"),onEzChange:t=>this._filterArgument=t.detail}):void 0),i.length>0?e("div",{class:"ez-text ez-text--medium ez-text--primary ez-padding-bottom--small"},this.getActiveFiltersMsg()):void 0,e("div",null,this.buildItems(i)),e("div",{class:"ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large"},this.infoText)))}},R=class{constructor(e){t(this,e),this.actionClick=i(this,"actionClick",7),this.actionChange=i(this,"actionChange",7),this._titleKeyByElement={[F.UPDATE]:"snkTaskbar.titleUpdate",[F.PREVIOUS]:"snkTaskbar.titlePrevious",[F.NEXT]:"snkTaskbar.titleNext",[F.REFRESH]:"snkTaskbar.titleRefresh",[F.CLONE]:"snkTaskbar.titleClone",[F.REMOVE]:"snkTaskbar.titleRemove",[F.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[F.INSERT]:"snkTaskbar.titleInsert",[F.CANCEL]:"snkTaskbar.titleCancel",[F.SAVE]:"snkTaskbar.titleSave",[F.GRID_MODE]:"snkTaskbar.titleGridMode",[F.FORM_MODE]:"snkTaskbar.titleFormMode",[F.CONFIGURATOR]:"snkTaskbar.titleConfigurator"}}observeButtons(){this._definitions=void 0}elementsFromString(t){const i=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(z[t]||this.isAllowed(t))&&i.push(t.trim())})),i}isAllowed(t){return!x[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?this._application.messagesBuilder.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case F.PREVIOUS:this.dataUnit.previousRecord();break;case F.NEXT:this.dataUnit.nextRecord();break;case F.REFRESH:this.dataUnit.loadData();break;case F.CLONE:this.dataUnit.copySelected();break;case F.REMOVE:this.dataUnit.removeSelectedRecords();break;case F.INSERT:this.dataUnit.addRecord();break;case F.CANCEL:this.dataUnit.cancelEdition();break;case F.SAVE:this.dataUnit.saveData()}this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}getElement(t,i){let e=i===this.primaryButton?"ez-button--primary ":"";return t>1&&(e+="ez-padding-left--medium"),F[i.toString()]?y(i,e,(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.actionsList,this.configName):T(i,e,(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess().then((t=>this._permissions=t)):this._permissions={}}componentWillRender(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}isDivider(t){var i;return void 0!==t&&(null===(i=t.t)||void 0===i?void 0:i["data-taskbar-divider"])}removeEmpty(t){let i;return t.filter((t=>!(null==t||this.isDivider(i)&&this.isDivider(t)||(i=t,0))))}render(){if(void 0===this._definitions)return;let t=0;return e(r,null,this.removeEmpty(this._definitions.map((i=>(i===F.DIVIDER?t=0:t++,F[i]?this.getElement(t,F[i]):this.customButtons.has(i)?this.getElement(t,this.customButtons.get(i)):e("slot",{name:i}))))))}static get watchers(){return{buttons:["observeButtons"]}}};R.style=".sc-snk-taskbar-h{display:flex}";export{I as snk_configurator,w as snk_filter_bar,E as snk_filter_item,A as snk_filter_list,O as snk_filter_modal,R as snk_taskbar}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e}from"./p-9ba3df4c.js";var n,t,a;!function(e){e.PREVIOUS="PREVIOUS",e.NEXT="NEXT",e.REFRESH="REFRESH",e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CANCEL="CANCEL",e.SAVE="SAVE",e.GRID_MODE="GRID_MODE",e.FORM_MODE="FORM_MODE",e.CONFIG_GRID="CONFIG_GRID",e.MORE_OPTIONS="MORE_OPTIONS",e.DIVIDER="DIVIDER",e.CONFIGURATOR="CONFIGURATOR"}(n||(n={})),function(e){e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CONFIG_GRID="CONFIG_GRID"}(t||(t={})),function(e){e.CONFIG_GRID="CONFIG_GRID"}(a||(a={}));const r=(e,n,t,a)=>{const{hint:r,text:s,iconName:l}=e;return l?s?o(l,e.name,n,r,s,t,a):i(l,e.name,n,r,t,a):c(e.name,n,s,r,t,a)},s=(t,a,r,s,l,u,d)=>{const E=r(t);switch(t){case n.PREVIOUS:return i("chevron-left",t,a,E,s,l);case n.NEXT:return i("chevron-right",t,a,E,s,l);case n.REFRESH:return i("sync",t,a,E,s,l);case n.UPDATE:return i("edit",t,a,E,s,l);case n.CLONE:return i("copy",t,a,E,s,l);case n.REMOVE:return i("delete",t,a,E,s,l);case n.INSERT:return o("plus",t,a,E,E,s,l);case n.CANCEL:return c(t,a,E,E,s,l);case n.SAVE:return o("save",t,a,E,E,s,l);case n.GRID_MODE:return i("table",t,a,E,s,l);case n.FORM_MODE:return i("list",t,a,E,s,l);case n.CONFIGURATOR:return function(n,t,a,r,s,c){return e("snk-configurator",{key:"configurator",configName:c,title:a(n),class:t,enabled:s(n),onChangeViewMode:e=>r(null==e?void 0:e.detail)})}(t,a,r,s,l,d);case n.MORE_OPTIONS:return u&&u.length>0?e("ez-actions-button",{title:E,size:"small",class:a,enabled:l(t),onEzAction:e=>s(e.detail.value),actions:u}):void 0;case n.DIVIDER:return e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium","data-taskbar-divider":!0})}};function c(n,t,a,r,s,c){return e("ez-button",{title:r,label:a,size:"small",class:t,enabled:c(n),onClick:()=>s(n)})}function i(n,t,a,r,s,c){return e("ez-button",{name:n,title:r,mode:"icon",size:"small",class:a,iconName:n,enabled:c(t),onClick:()=>s(t)})}function o(n,t,a,r,s,c,i){return e("ez-button",{name:n,title:s,label:r,size:"small",class:a,enabled:i(t),onClick:()=>c(t)},e("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:n}))}export{t as A,n as T,a as V,r as a,s as b}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as n,h as s,H as o,g as e}from"./p-9ba3df4c.js";import{ApplicationContext as t}from"@sankhyalabs/core";import{A as r}from"./p-a5b26df2.js";import{T as d}from"./p-03f9c407.js";import{C as
|
|
1
|
+
import{r as i,c as n,h as s,H as o,g as e}from"./p-9ba3df4c.js";import{ApplicationContext as t}from"@sankhyalabs/core";import{A as r}from"./p-a5b26df2.js";import{T as d}from"./p-03f9c407.js";import{C as l}from"./p-d50651a3.js";const a=class{constructor(s){i(this,s),this.ezClickIcon=n(this,"ezClickIcon",7),this.isConfigActive=!1,this.modeInsertion=!0}handleAction(i,n){i.preventDefault(),i.stopPropagation();const s=this.fieldConfig;n!==r.configuration&&(s.group=void 0),this.ezClickIcon.emit({field:s,type:n})}getMessage(i){return this._application.messagesBuilder.getMessage(i,{})}isRequired(){var i,n;const s=this.dataUnit&&this.dataUnit.getField(null===(i=this.fieldConfig)||void 0===i?void 0:i.name);return!0===(null==s?void 0:s.required)||!0===(null===(n=this.fieldConfig)||void 0===n?void 0:n.required)}componentWillLoad(){this._application=t.getContextValue("__SNK__APPLICATION__")}render(){if(null!=this.fieldConfig)return s(o,null,s("div",{class:"field-config"},s("div",{class:"field-config__draggable"},s("ez-icon",{iconName:"drag-indicator",size:"small"})),s("div",null,this.fieldConfig.label,this.isRequired()&&s("span",{class:"field-config__required-label"},"*")),this.modeInsertion?s("div",{class:"field-config__add"},s("ez-button",{onClick:i=>this.handleAction(i,r.add),mode:"icon",class:"ez-button--tertiary",iconName:"plus",size:"large",title:this.getMessage("snkFieldConfig.titleAdd")})):s("div",{class:"field-config__options"+(this.isConfigActive?" field-config__options--is-active":" ")},s("ez-button",{mode:"icon",class:"ez-button--tertiary field-config__remove-icon",onClick:i=>this.handleAction(i,r.remove),iconName:"minus",size:"large",title:this.getMessage("snkFieldConfig.titleRemove")}),s("ez-button",{id:"buttonConfig_"+this.fieldConfig.name,mode:"icon",class:"ez-button--tertiary",onClick:i=>this.handleAction(i,r.configuration),iconName:this.isConfigActive?"chevron-up":"settings-inverted",size:"large",title:this.getMessage("snkFieldConfig.titleConfigurations")}))),this.isConfigActive&&s("div",{class:"field-config__config-popover"},s("div",{class:"field-config__config-outer-arrow"},s("div",{class:"field-config__config-inner-arrow"}))))}};a.style=".sc-snk-field-config-h{--snk-field-config--height:42px;--snk-field-config--width:100%;--snk-field-config__icon--width:48px;--snk-field-config--height--slim:32px;--snk-field-config--border-radius:var(--border--radius-medium, 12px);--snk-field-config--font-size:var(--text--medium, 14px);--snk-field-config--font-family:var(--font-pattern, Arial);--snk-field-config--font-weight:var(--text-weight--medium, 400);--snk-field-config--color:var(--title--primary, #000);--snk-field-config__input--background-color:var(--background--medium, #e0e0e0);--snk-field-config__input--border:var(--border--medium, 2px solid);--snk-field-config__input--border-color:var(--background--xlight, #fff);--snk-field-config__required--color:var(--color--error, #FF0000);--snk-field-config__transition--visibility:var(--transition, 0.2s linear);--snk-field-config__transition--opacity:var(--transition, 0.15s linear);display:flex;flex-wrap:wrap;position:relative;width:var(--snk-field-config--width)}.field-config.sc-snk-field-config{width:100%;box-sizing:border-box;display:flex;align-items:center;padding-left:var(--space--medium, 6px);font-weight:var(--snk-field-config--font-weight);height:var(--snk-field-config--height);border-radius:var(--snk-field-config--border-radius);font-family:var(--snk-field-config--font-family);font-size:var(--snk-field-config--font-size);border:var(--snk-field-config__input--border);border-color:var(--snk-field-config__input--border-color);background-color:var(--snk-field-config__input--background-color);color:var(--snk-field-config--color)}.field-config__config-popover.sc-snk-field-config{width:40px;margin-left:auto;z-index:var(--more-visible, 2)}.field-config__required-label.sc-snk-field-config{padding-left:var(--space--extra-small, 3px);color:var(--snk-field-config__required--color)}.field-config__add.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options--is-active.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config__remove-icon.sc-snk-field-config{margin-right:-15px}.field-config.sc-snk-field-config:hover .field-config__options.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config.sc-snk-field-config:hover .field-config__add.sc-snk-field-config{visibility:visible;opacity:1}.field-config__draggable.sc-snk-field-config{padding-right:var(--space--small, 6px)}.field-config__config-outer-arrow.sc-snk-field-config{background-color:var(--color--secondary-200);clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px;padding-top:3px;border-bottom:1px solid #FFFFFF}.field-config__config-inner-arrow.sc-snk-field-config{background-color:#FFFFFF;clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px}.ez-box__container.sc-snk-field-config ez-collapsible-box.sc-snk-field-config{--snk-collapsible-box__header--padding-left:6px}ez-icon.sc-snk-field-config{--snk-icon--color:var(--snk-field-config--color)}ez-popover.sc-snk-field-config{--snk-popover__box--background-color:transparent;--snk-popover__box--box-shadow:none}.field-config__options.sc-snk-field-config ez-button.sc-snk-field-config{--snk-button--background-color:transparent;--snk-button--focus--border:none;--snk-button--focus--box-shadow:none}";const c=class{constructor(s){i(this,s),this.actionClick=n(this,"actionClick",7),this.gridDoubleClick=n(this,"gridDoubleClick",7),this.configChanged=n(this,"configChanged",7),this._topTaskbarProcessor=new d({snkGridTopTaskbar:["FORM_MODE","CONFIGURATOR","INSERT"]}),this._headerTaskbarProcessor=new d({"snkGridHeaderTaskbar.unselected":["REFRESH"],"snkGridHeaderTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"]})}async setShowGridConfig(i){null!=this._grid&&(!0===i?this._grid.openGridConfig():this._grid.closeGridConfig())}async setConfig(i){this._gridConfig=i}changeConfig(i){this.configChanged.emit(i)}componentDidRender(){l.setGrid(this.configName,this._element)}componentWillLoad(){let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit||this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail})),this._snkDataUnit.addEventListener("dataStateChange",(i=>{this._dataState=i.detail}));break}i=i.parentElement}}componentWillRender(){this._headerTaskbarProcessor.process(this._dataState&&this._dataState.selectedRecords.length>0?"snkGridHeaderTaskbar.selected":"snkGridHeaderTaskbar.unselected",this.taskbarManager,this._dataState),this._topTaskbarProcessor.process("snkGridTopTaskbar",this.taskbarManager,this._dataState)}render(){if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large"},s("div",{class:"snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium"},s("snk-filter-bar",{dataUnit:this._dataUnit,class:"snk-grid__filter-bar ez-align--top",configName:this.configName}),s("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider"}),s("snk-taskbar",{class:"ez-padding-left--medium",key:"topTaskbar",configName:this.configName,dataUnit:this._dataUnit,buttons:this._topTaskbarProcessor.buttons,disabledButtons:this._topTaskbarProcessor.disabledButtons,customButtons:this._topTaskbarProcessor.customButtons,primaryButton:"INSERT"})),s("ez-grid",{ref:i=>this._grid=i,dataUnit:this._dataUnit,key:"grid-"+this._snkDataUnit.entityName,config:this._gridConfig,onConfigChange:i=>{this.changeConfig(i.detail)},onEzDoubleClick:()=>this.gridDoubleClick.emit(),statusResolver:this.statusResolver,multipleSelection:this.multipleSelection},s("snk-taskbar",{dataUnit:this._dataUnit,buttons:this._headerTaskbarProcessor.buttons,disabledButtons:this._headerTaskbarProcessor.disabledButtons,customButtons:this._headerTaskbarProcessor.customButtons,slot:"leftButtons",actionsList:this.actionsList})),s("div",{class:"ez-col ez-col--sd-12"},s("slot",{name:"SnkGridFooter"})))}get _element(){return e(this)}};c.style=".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--small)}";export{a as snk_field_config,c as snk_grid}
|
|
@@ -21,6 +21,7 @@ import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException
|
|
|
21
21
|
dataType
|
|
22
22
|
userInterface
|
|
23
23
|
calculated
|
|
24
|
+
group
|
|
24
25
|
properties{
|
|
25
26
|
name
|
|
26
27
|
value
|
|
@@ -72,4 +73,4 @@ import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException
|
|
|
72
73
|
name
|
|
73
74
|
resource
|
|
74
75
|
}
|
|
75
|
-
}`)}async getParam(t){const e=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return l.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource)?"":t.resource}}const O=U;function U(t,e){const s=F();return(U=function(t){return s[t-=378]})(t,e)}function F(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(F=function(){return t})()}!function(){const t=U,e=F();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class R{[O(397)](t){const e=O;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new L("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class L{constructor(t){const e=O;this.isSup=t,this[e(384)]={}}[O(378)](t,e){this[O(384)][t]=e}[O(393)](t){const e=O;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class j extends g{constructor(){super(...arguments),this.GRID_CONFIG_VERSION="V3:"}getConfig(t,e){const s=`cfg://grid/${this.GRID_CONFIG_VERSION}${e}`;return new Promise(((t,e)=>{this.loadResource(s).then((e=>{let s;e&&(s=JSON.parse(e)),t(s)})).catch((t=>{e(t)}))}))}saveConfig(t,e){const s=`cfg://grid/${this.GRID_CONFIG_VERSION}${e}`;return new Promise(((e,i)=>{this.saveResource(t,s).then((t=>{e(t)})).catch((t=>{i(t)}))}))}}class k extends g{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=a.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var M;function x(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>x(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=x(t[s]):delete e[s]})),e}}return t}!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(M||(M={}));class B extends g{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=x(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}class z extends g{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}const J=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new V}get parameters(){return this._parameters||(this._parameters=new b),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||q.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new G(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(M).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full"){this.clearContent(this._popUp),"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){q.openAppActivity(t,e)}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e){return new Promise(((s,i)=>{const r=this.getDuPromissesStack(e),n=r.length>0;if(r.push(new G(s,i)),!n){const s=this.dataUnitFetcher.getDataUnit(t,this.resourceID);s.loadMetadata().then((()=>{for(e&&this._duCache.set(e,s);r.length>0;)r.pop().resolve(s)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async getDataUnit(t,e){return new Promise(((s,i)=>{const r=this._duCache.get(e);r?s(r):this.createDataunit(t,e).then((t=>{s(t)})).catch((t=>i(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return I.alert(t,e,s,i)}async error(t,e,s,i){return I.error(t,e,s,i)}async success(t,e,s,i){return I.success(t,e,s,i)}async message(t,e,s,i){return I.message(t,e,s,i)}async confirm(t,e,s,i,r){return I.confirm(t,e,s,i,r)}async info(t,e){return I.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new R).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=v.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new N),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new w),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new j),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new T),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new _),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new k),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new B),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new z),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:c,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let p;const m={rootEntity:h,descriptionFieldName:c,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===d.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||o.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:p,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new $(this),this.messagesBuilder=new P,p.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${v.getUrlBase()}/mge/upload/file`),p.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),p.setContextValue("__EZUI__GRID_LICENSE__",A),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),m.init(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){p.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"col col--sd-3",closeOutsideClick:!0,closeEsc:!0}))}};class V{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class G{constructor(t,e){this.resolve=t,this.reject=e}}J.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{J as snk_application}
|
|
76
|
+
}`)}async getParam(t){const e=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return l.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource)?"":t.resource}}const O=U;function U(t,e){const s=F();return(U=function(t){return s[t-=378]})(t,e)}function F(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(F=function(){return t})()}!function(){const t=U,e=F();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class R{[O(397)](t){const e=O;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new L("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class L{constructor(t){const e=O;this.isSup=t,this[e(384)]={}}[O(378)](t,e){this[O(384)][t]=e}[O(393)](t){const e=O;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class j extends g{constructor(){super(...arguments),this.GRID_CONFIG_VERSION="V3:"}getConfig(t,e){const s=`cfg://grid/${this.GRID_CONFIG_VERSION}${e}`;return new Promise(((t,e)=>{this.loadResource(s).then((e=>{let s;e&&(s=JSON.parse(e)),t(s)})).catch((t=>{e(t)}))}))}saveConfig(t,e){const s=`cfg://grid/${this.GRID_CONFIG_VERSION}${e}`;return new Promise(((e,i)=>{this.saveResource(t,s).then((t=>{e(t)})).catch((t=>{i(t)}))}))}}class k extends g{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=a.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var M;function x(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>x(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=x(t[s]):delete e[s]})),e}}return t}!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(M||(M={}));class B extends g{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=x(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}class z extends g{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}const J=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new V}get parameters(){return this._parameters||(this._parameters=new b),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||q.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new G(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(M).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full"){this.clearContent(this._popUp),"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){q.openAppActivity(t,e)}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e){return new Promise(((s,i)=>{const r=this.getDuPromissesStack(e),n=r.length>0;if(r.push(new G(s,i)),!n){const s=this.dataUnitFetcher.getDataUnit(t,this.resourceID);s.loadMetadata().then((()=>{for(e&&this._duCache.set(e,s);r.length>0;)r.pop().resolve(s)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async getDataUnit(t,e){return new Promise(((s,i)=>{const r=this._duCache.get(e);r?s(r):this.createDataunit(t,e).then((t=>{s(t)})).catch((t=>i(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return I.alert(t,e,s,i)}async error(t,e,s,i){return I.error(t,e,s,i)}async success(t,e,s,i){return I.success(t,e,s,i)}async message(t,e,s,i){return I.message(t,e,s,i)}async confirm(t,e,s,i,r){return I.confirm(t,e,s,i,r)}async info(t,e){return I.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new R).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=v.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new N),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new w),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new j),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new T),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new _),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new k),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new B),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new z),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:c,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let p;const m={rootEntity:h,descriptionFieldName:c,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===d.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||o.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:p,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new $(this),this.messagesBuilder=new P,p.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${v.getUrlBase()}/mge/upload/file`),p.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),p.setContextValue("__EZUI__GRID_LICENSE__",A),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),m.init(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){p.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}};class V{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class G{constructor(t,e){this.resolve=t,this.reject=e}}J.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{J as snk_application}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as s,g as a}from"./p-9ba3df4c.js";import{ApplicationContext as n}from"@sankhyalabs/core";import{c as o}from"./p-a5b26df2.js";import{T as e}from"./p-4fab64ec.js";const r=o.grid,h=o.form,c=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.multipleSelection=!0}async goToView(t){this.executeAction(t)}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===r.index,this._viewStack.show(h.index)}async executeAction(t){t===e.GRID_MODE?this._viewStack.show(r.index):t!==e.FORM_MODE&&t!==e.UPDATE||this.gridToForm(t!==e.UPDATE)}insertionModeHandler(){this.gridToForm()}cancelHandler(){this._backToGrid&&this._viewStack.show(r.index)}componentWillLoad(){let t=this._element.parentElement;for(;t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit||this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail})),this._snkDataUnit.addEventListener("dataStateChange",(t=>{this._dataState=t.detail}));break}t=t.parentElement}if(!this.configName){const t=n.getContextValue("__SNK__APPLICATION__");this.configName=t.configName}}render(){return s("ez-view-stack",{ref:t=>this._viewStack=t,"data-configurator-parent":"snkConfigurator"},s("stack-item",null,s("snk-grid",{configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection},s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-form",{configName:this.configName,actionsList:this.actionsList,onExit:()=>this._viewStack.show(r.index),recordsValidator:this.recordsValidator,taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail)},s("slot",{name:"SnkFormTaskBar"}))))}get _element(){return a(this)}};c.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{c as snk_crud}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-9ba3df4c.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-44ce5b90",[[1,"teste-pesquisa"]]],["p-92782503",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],beforeSave:[16],afterSave:[16],getDataUnit:[64]}]]],["p-9dc4426d",[[0,"snk-filter-binary-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-3a276f3d",[[0,"snk-filter-multi-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-cc4bef9f",[[0,"snk-filter-number",{config:[16],value:[2],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-029ae4e4",[[0,"snk-filter-period",{config:[16],value:[8],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-12ad2a19",[[0,"snk-filter-personalized",{config:[16],value:[1040],fix:[16],unfix:[16],show:[64]}]]],["p-2dc76d79",[[0,"snk-filter-search",{config:[16],value:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-e9beab79",[[0,"snk-filter-text",{config:[16],value:[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-ac71ef38",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-8706fe65",[[2,"snk-config-options",{fieldConfig:[16],idConfig:[513,"id-config"],dataUnit:[16],_defaultType:[32]}]]],["p-f37cdeb5",[[6,"snk-tab-config",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32],_activeEditText:[32],_activeEditTextIndex:[32],_actionsHide:[32],_actionsShow:[32]}]]],["p-deb1f523",[[0,"snk-filter-detail",{config:[1040],getMessage:[16],show:[64]}]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-9ba3df4c.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-44ce5b90",[[1,"teste-pesquisa"]]],["p-92782503",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],beforeSave:[16],afterSave:[16],getDataUnit:[64]}]]],["p-9dc4426d",[[0,"snk-filter-binary-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-3a276f3d",[[0,"snk-filter-multi-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-cc4bef9f",[[0,"snk-filter-number",{config:[16],value:[2],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-029ae4e4",[[0,"snk-filter-period",{config:[16],value:[8],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-12ad2a19",[[0,"snk-filter-personalized",{config:[16],value:[1040],fix:[16],unfix:[16],show:[64]}]]],["p-2dc76d79",[[0,"snk-filter-search",{config:[16],value:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-e9beab79",[[0,"snk-filter-text",{config:[16],value:[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-ac71ef38",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-8706fe65",[[2,"snk-config-options",{fieldConfig:[16],idConfig:[513,"id-config"],dataUnit:[16],_defaultType:[32]}]]],["p-f37cdeb5",[[6,"snk-tab-config",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32],_activeEditText:[32],_activeEditTextIndex:[32],_actionsHide:[32],_actionsShow:[32]}]]],["p-deb1f523",[[0,"snk-filter-detail",{config:[1040],getMessage:[16],show:[64]}]]],["p-6511d132",[[6,"snk-grid",{configName:[1,"config-name"],actionsList:[16],taskbarManager:[16],statusResolver:[16],multipleSelection:[4,"multiple-selection"],_dataUnit:[32],_dataState:[32],_gridConfig:[32],setShowGridConfig:[64],setConfig:[64]}],[2,"snk-field-config",{isConfigActive:[16],fieldConfig:[16],modeInsertion:[516,"mode-insertion"],dataUnit:[16]}]]],["p-626cf022",[[2,"snk-form-config",{dataUnit:[16],formConfig:[16],parentForm:[16],_formConfigOptions:[32],_fieldConfigSelected:[32],_layoutFormConfig:[32],_fieldsAvailable:[32],_formConfig:[32],_formConfigChanged:[32],_optionFormConfigSelected:[32],_optionFormConfigChanged:[32],_tempGroups:[32]}]]],["p-60eef7cd",[[2,"snk-config-modal",{configName:[1,"config-name"],gridMode:[4,"grid-mode"]}]]],["p-429c5e3f",[[2,"snk-filter-bar",{dataUnit:[1040],configName:[1,"config-name"],filterConfig:[1040],allowDefault:[32]},[[0,"filterChange","filterChangeListener"]]],[6,"snk-taskbar",{configName:[1,"config-name"],buttons:[1],customButtons:[16],actionsList:[16],primaryButton:[1,"primary-button"],disabledButtons:[16],dataUnit:[16],_permissions:[32]}],[0,"snk-filter-item",{config:[1040],getMessage:[16],detailIsVisible:[32],showUp:[64],hideDetail:[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{label:[1],iconName:[1,"icon-name"],items:[16],getMessage:[16],emptyText:[1,"empty-text"],findFilterText:[1,"find-filter-text"],buttonClass:[1,"button-class"],_filterArgument:[32],_showAll:[32],hideDetail:[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{getMessage:[16],items:[1040],modalTitle:[1,"modal-title"],modalSubTitle:[1,"modal-sub-title"],cancelButtonLabel:[1,"cancel-button-label"],okButtonLabel:[1,"ok-button-label"],infoText:[1,"info-text"],useSearch:[4,"use-search"],processModalAction:[16],_filterArgument:[32]}],[2,"snk-configurator",{configName:[1,"config-name"],name:[1],enabled:[4]}]]],["p-ce7c38a1",[[2,"snk-form",{configName:[1,"config-name"],recordsValidator:[16],actionsList:[16],taskbarManager:[16],_dataUnit:[32],_dataState:[32],_editionFormConfig:[32],_insertionFormConfig:[32],_showFormConfig:[32],setShowFormConfig:[64],setConfig:[64]}]]],["p-c4ae984b",[[6,"snk-crud",{configName:[1025,"config-name"],actionsList:[16],taskbarManager:[16],recordsValidator:[16],statusResolver:[16],multipleSelection:[4,"multiple-selection"],_dataUnit:[32],_dataState:[32],goToView:[64]}]]],["p-8c14bbfb",[[2,"snk-application",{messagesBuilder:[1040],configName:[1,"config-name"],isUserSup:[64],hasAccess:[64],getAllAccess:[64],getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],showPopUp:[64],showModal:[64],closeModal:[64],closePopUp:[64],temOpcional:[64],getConfig:[64],saveConfig:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getDataUnit:[64],getResourceID:[64],getUserID:[64],alert:[64],error:[64],success:[64],message:[64],confirm:[64],info:[64],loadFormConfig:[64],loadGridConfig:[64],fetchUserAvailableConfigs:[64],fetchLegacyConfig:[64],fetchDefaultConfig:[64],loadTotals:[64],saveGridConfig:[64],getFilterBarConfig:[64],saveFilterBarConfig:[64],saveFormConfig:[64],getDefaultValues:[64],getDefaultValue:[64],executeSearch:[64],executePreparedSearch:[64],isDebugMode:[64]}]]]],e)));
|
|
@@ -33,6 +33,10 @@ export declare class SnkCrud {
|
|
|
33
33
|
* Exemplo: { "RECDESP": { "-1" : "#BD0025", "1" : "#157A00" } }
|
|
34
34
|
*/
|
|
35
35
|
statusResolver: IStatusResolver;
|
|
36
|
+
/**
|
|
37
|
+
* Determina se pode haver mais de uma linha selecionada na grade
|
|
38
|
+
*/
|
|
39
|
+
multipleSelection: boolean;
|
|
36
40
|
/**
|
|
37
41
|
* Emitido pela taskbar sempre que houver click de botão ou ação
|
|
38
42
|
*/
|
|
@@ -31,6 +31,10 @@ export declare class SnkGrid {
|
|
|
31
31
|
* Exemplo: { "RECDESP": { "-1" : "#BD0025", "1" : "#157A00" } }
|
|
32
32
|
*/
|
|
33
33
|
statusResolver: IStatusResolver;
|
|
34
|
+
/**
|
|
35
|
+
* Determina se pode haver mais de uma linha selecionada
|
|
36
|
+
*/
|
|
37
|
+
multipleSelection: boolean;
|
|
34
38
|
/**
|
|
35
39
|
* Emitido sempre que houver click de botão ou ação
|
|
36
40
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataUnit } from '@sankhyalabs/core';
|
|
2
|
-
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { EventEmitter, VNode } from '../../stencil-public-runtime';
|
|
3
3
|
import { SnkApplication } from '../snk-application/snk-application';
|
|
4
4
|
import { DataState } from '../snk-data-unit/snk-data-unit';
|
|
5
5
|
import { TaskbarElement } from './elements/taskbar-elements';
|
|
@@ -74,6 +74,8 @@ export declare class SnkTaskbar {
|
|
|
74
74
|
getElement(index: number, def: TaskbarElement | CustomButton): HTMLElement;
|
|
75
75
|
componentWillLoad(): void;
|
|
76
76
|
componentWillRender(): void;
|
|
77
|
+
isDivider(element: VNode): boolean;
|
|
78
|
+
removeEmpty(elements: Array<VNode>): VNode[];
|
|
77
79
|
render(): any;
|
|
78
80
|
}
|
|
79
81
|
export interface Action {
|