@sankhyalabs/sankhyablocks 2.2.2-SKA-60656.4 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/snk-application.cjs.entry.js +2 -0
- package/dist/cjs/snk-configurator_3.cjs.entry.js +9 -1
- package/dist/cjs/snk-crud.cjs.entry.js +10 -2
- package/dist/cjs/snk-filter-bar_7.cjs.entry.js +28 -16
- package/dist/cjs/snk-filter-detail.cjs.entry.js +10 -0
- package/dist/cjs/snk-form.cjs.entry.js +11 -2
- package/dist/cjs/{taskbar-elements-997af1c9.js → taskbar-elements-b995b84d.js} +26 -26
- package/dist/collection/components/snk-application/snk-application.js +3 -1
- package/dist/collection/components/snk-crud/snk-crud.js +10 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +11 -1
- package/dist/collection/components/snk-form/snk-form.js +12 -3
- package/dist/collection/components/snk-grid/snk-grid.js +10 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +26 -26
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +28 -16
- package/dist/components/snk-application2.js +3 -1
- package/dist/components/snk-crud.js +10 -2
- package/dist/components/snk-filter-detail2.js +11 -1
- package/dist/components/snk-form2.js +12 -3
- package/dist/components/snk-grid2.js +10 -1
- package/dist/components/snk-taskbar2.js +54 -42
- package/dist/esm/snk-application.entry.js +4 -2
- package/dist/esm/snk-configurator_3.entry.js +9 -1
- package/dist/esm/snk-crud.entry.js +11 -3
- package/dist/esm/snk-filter-bar_7.entry.js +28 -16
- package/dist/esm/snk-filter-detail.entry.js +11 -1
- package/dist/esm/snk-form.entry.js +12 -3
- package/dist/esm/taskbar-elements-a0a8c3ac.js +95 -0
- package/dist/sankhyablocks/p-00f6d216.entry.js +1 -0
- package/dist/sankhyablocks/{p-6340d992.entry.js → p-0e18f6e6.entry.js} +8 -8
- package/dist/sankhyablocks/p-4cbc4ae3.js +1 -0
- package/dist/sankhyablocks/p-6ca95ef3.entry.js +1 -0
- package/dist/sankhyablocks/{p-9b0f99fd.entry.js → p-975182f8.entry.js} +1 -1
- package/dist/sankhyablocks/p-c4e9394c.entry.js +1 -0
- package/dist/sankhyablocks/{p-7dcce5aa.entry.js → p-de0fe8a4.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
- package/dist/types/components/snk-form/snk-form.d.ts +2 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +2 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -2
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -2
- package/package.json +2 -3
- package/dist/esm/taskbar-elements-a0a8b106.js +0 -95
- package/dist/sankhyablocks/p-09720dd1.js +0 -1
- package/dist/sankhyablocks/p-0ffee54f.entry.js +0 -1
- package/dist/sankhyablocks/p-133cf71d.entry.js +0 -1
- package/dist/sankhyablocks/p-bc41625b.entry.js +0 -1
|
@@ -1245,10 +1245,12 @@ const SnkApplication = class {
|
|
|
1245
1245
|
window.requestAnimationFrame(() => {
|
|
1246
1246
|
this.applicationLoaded.emit(true);
|
|
1247
1247
|
});
|
|
1248
|
+
core.ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
|
|
1248
1249
|
}
|
|
1249
1250
|
render() {
|
|
1250
1251
|
return (index.h("div", null, index.h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), index.h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), index.h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
|
|
1251
1252
|
}
|
|
1253
|
+
get _element() { return index.getElement(this); }
|
|
1252
1254
|
};
|
|
1253
1255
|
class RequestListenerLoadingBar {
|
|
1254
1256
|
constructor() {
|
|
@@ -250,11 +250,19 @@ const SnkGrid = class {
|
|
|
250
250
|
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
|
|
251
251
|
this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
|
|
252
252
|
}
|
|
253
|
+
componentDidLoad() {
|
|
254
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
255
|
+
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
256
|
+
}
|
|
257
|
+
getDataElementId(suffix) {
|
|
258
|
+
const elemIdSnkGrid = this._element.getAttribute("data-element-id");
|
|
259
|
+
return `${elemIdSnkGrid}_${suffix}`;
|
|
260
|
+
}
|
|
253
261
|
render() {
|
|
254
262
|
if (!this._dataUnit) {
|
|
255
263
|
return undefined;
|
|
256
264
|
}
|
|
257
|
-
return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.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" })), index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute("data-element-id"), selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
|
|
265
|
+
return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("snk-filter-bar", { dataUnit: this._dataUnit, "data-element-id": this.getDataElementId("internal_filter"), class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": this.getDataElementId("grid_top_taskbar"), key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), index.h("ez-grid", { ref: ref => this._grid = ref, "data-element-id": this.getDataElementId("internal_grid"), dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, index.h("snk-taskbar", { dataUnit: this._dataUnit, "data-element-id": this.getDataElementId("grid_left_taskBar"), buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute("data-element-id"), selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
|
|
258
266
|
}
|
|
259
267
|
get _element() { return index.getElement(this); }
|
|
260
268
|
};
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-20e8b68a.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const constants = require('./constants-a47a5190.js');
|
|
8
|
-
const taskbarElements = require('./taskbar-elements-
|
|
8
|
+
const taskbarElements = require('./taskbar-elements-b995b84d.js');
|
|
9
9
|
|
|
10
10
|
const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
|
11
11
|
|
|
@@ -63,6 +63,10 @@ const SnkCrud = class {
|
|
|
63
63
|
this.setViewMode(GRID_MODE);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
getDataElementId(suffix) {
|
|
67
|
+
const elemIdSnkCrud = this._element.getAttribute("data-element-id");
|
|
68
|
+
return `${elemIdSnkCrud}_${suffix}`;
|
|
69
|
+
}
|
|
66
70
|
componentWillLoad() {
|
|
67
71
|
let parent = this._element.parentElement;
|
|
68
72
|
while (parent) {
|
|
@@ -89,8 +93,12 @@ const SnkCrud = class {
|
|
|
89
93
|
this.configName = application.configName;
|
|
90
94
|
}
|
|
91
95
|
}
|
|
96
|
+
componentDidLoad() {
|
|
97
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
98
|
+
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
99
|
+
}
|
|
92
100
|
render() {
|
|
93
|
-
return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, index.h("stack-item", null, index.h("snk-grid", { ref: (ref) => this._snkGrid = ref, 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 }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-form", { ref: (ref) => this._snkForm = ref, configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, index.h("slot", { name: "SnkFormTaskBar" }))), index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
|
101
|
+
return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": this.getDataElementId("crud_ViewStack") }, index.h("stack-item", null, index.h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": this.getDataElementId("crud_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 }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-form", { ref: (ref) => this._snkForm = ref, "data-element-id": this.getDataElementId("crud_form"), configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, index.h("slot", { name: "SnkFormTaskBar" }))), index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
|
94
102
|
}
|
|
95
103
|
get _element() { return index.getElement(this); }
|
|
96
104
|
};
|
|
@@ -11,7 +11,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
|
11
11
|
const ConfigStorage = require('./ConfigStorage-c112de1d.js');
|
|
12
12
|
const constants = require('./constants-a47a5190.js');
|
|
13
13
|
const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
|
|
14
|
-
const taskbarElements = require('./taskbar-elements-
|
|
14
|
+
const taskbarElements = require('./taskbar-elements-b995b84d.js');
|
|
15
15
|
require('./_commonjsHelpers-537d719a.js');
|
|
16
16
|
|
|
17
17
|
const buildFilter = (item) => {
|
|
@@ -1452,26 +1452,19 @@ const SnkTaskbar = class {
|
|
|
1452
1452
|
className += "ez-padding-left--medium";
|
|
1453
1453
|
}
|
|
1454
1454
|
if (taskbarElements.TaskbarElement[def.toString()]) {
|
|
1455
|
-
return taskbarElements.buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
1455
|
+
return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
1456
1456
|
}
|
|
1457
1457
|
else {
|
|
1458
|
-
return taskbarElements.buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
1458
|
+
return taskbarElements.buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
if (this._application) {
|
|
1465
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
|
1466
|
-
}
|
|
1467
|
-
else {
|
|
1468
|
-
this._permissions = {};
|
|
1469
|
-
}
|
|
1461
|
+
getIdElemBtnNative(taskbarElem) {
|
|
1462
|
+
const elemIdTaskbar = this._element.getAttribute("data-element-id");
|
|
1463
|
+
return `${elemIdTaskbar}_${core.StringUtils.toCamelCase(taskbarElem)}`;
|
|
1470
1464
|
}
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
}
|
|
1465
|
+
getIdElemBtnCustom(btnCustom) {
|
|
1466
|
+
const elemIdTaskbar = this._element.getAttribute("data-element-id");
|
|
1467
|
+
return `${elemIdTaskbar}_${core.StringUtils.toCamelCase(btnCustom.name)}`;
|
|
1475
1468
|
}
|
|
1476
1469
|
isDivider(element) {
|
|
1477
1470
|
var _a;
|
|
@@ -1493,6 +1486,24 @@ const SnkTaskbar = class {
|
|
|
1493
1486
|
return true;
|
|
1494
1487
|
});
|
|
1495
1488
|
}
|
|
1489
|
+
componentWillLoad() {
|
|
1490
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
1491
|
+
if (this._application) {
|
|
1492
|
+
this._application.getAllAccess().then(access => this._permissions = access);
|
|
1493
|
+
}
|
|
1494
|
+
else {
|
|
1495
|
+
this._permissions = {};
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
componentWillRender() {
|
|
1499
|
+
if (this._definitions == undefined && this._permissions) {
|
|
1500
|
+
this._definitions = this.elementsFromString(this.buttons);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
componentDidLoad() {
|
|
1504
|
+
const dataInfo = { dataUnit: this.dataUnit };
|
|
1505
|
+
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
1506
|
+
}
|
|
1496
1507
|
render() {
|
|
1497
1508
|
if (this._definitions === undefined) {
|
|
1498
1509
|
return undefined;
|
|
@@ -1514,6 +1525,7 @@ const SnkTaskbar = class {
|
|
|
1514
1525
|
return index.h("slot", { name: elem });
|
|
1515
1526
|
}))));
|
|
1516
1527
|
}
|
|
1528
|
+
get _element() { return index.getElement(this); }
|
|
1517
1529
|
static get watchers() { return {
|
|
1518
1530
|
"buttons": ["observeButtons"]
|
|
1519
1531
|
}; }
|
|
@@ -57,12 +57,22 @@ const SnkFilterDetail = class {
|
|
|
57
57
|
buildIcon(title, iconName, action) {
|
|
58
58
|
return (index.h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, index.h("ez-icon", { title: title, iconName: iconName })));
|
|
59
59
|
}
|
|
60
|
+
getNormalizedValue(params, value) {
|
|
61
|
+
return params.reduce((arrayValues, currentParam, index) => {
|
|
62
|
+
if (currentParam.dataType === core.DataType.BOOLEAN && (arrayValues == undefined || arrayValues[index] == undefined)) {
|
|
63
|
+
arrayValues = arrayValues || [];
|
|
64
|
+
arrayValues[index] = false;
|
|
65
|
+
}
|
|
66
|
+
return arrayValues;
|
|
67
|
+
}, value);
|
|
68
|
+
}
|
|
60
69
|
apply() {
|
|
61
70
|
var _a;
|
|
62
71
|
let value = this._editor["value"];
|
|
63
72
|
let isValid = true;
|
|
64
73
|
if (this.config.type === filterItemType_enum.FilterItemType.PERSONALIZED) {
|
|
65
74
|
const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
|
|
75
|
+
value = this.getNormalizedValue(params, value);
|
|
66
76
|
const paramsCount = params.length;
|
|
67
77
|
if (paramsCount === 0) {
|
|
68
78
|
//Valor do filtro personalizado sem parametros deve ser um array vazio
|
|
@@ -144,6 +144,15 @@ const SnkForm = class {
|
|
|
144
144
|
}
|
|
145
145
|
return disabled;
|
|
146
146
|
}
|
|
147
|
+
dataunitReady() {
|
|
148
|
+
this.loadInsertionConfig();
|
|
149
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
150
|
+
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
151
|
+
}
|
|
152
|
+
getDataElementId(suffix) {
|
|
153
|
+
const elemIdSnkTaskBar = this._element.getAttribute("data-element-id");
|
|
154
|
+
return `${elemIdSnkTaskBar}_${suffix}`;
|
|
155
|
+
}
|
|
147
156
|
componentWillLoad() {
|
|
148
157
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
149
158
|
let parent = this._element.parentElement;
|
|
@@ -153,7 +162,7 @@ const SnkForm = class {
|
|
|
153
162
|
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
154
163
|
this._dataState = this._snkDataUnit.dataState;
|
|
155
164
|
if (this._dataUnit) {
|
|
156
|
-
this.
|
|
165
|
+
this.dataunitReady();
|
|
157
166
|
}
|
|
158
167
|
else {
|
|
159
168
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
@@ -187,7 +196,7 @@ const SnkForm = class {
|
|
|
187
196
|
if (!this._dataUnit || !this._dataState) {
|
|
188
197
|
return undefined;
|
|
189
198
|
}
|
|
190
|
-
return (index.h("section", { class: "snk-form" }, index.h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, index.h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), index.h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, index.h("snk-taskbar", { key: "formTaskbar", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
199
|
+
return (index.h("section", { class: "snk-form" }, index.h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, index.h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), index.h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, index.h("snk-taskbar", { key: "formTaskbar", "data-element-id": this.getDataElementId("form_taskbar"), configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": this.getDataElementId("internal_form"), dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
191
200
|
index.h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), "data-element-id": this._element.getAttribute("data-element-id"), configName: this.configName, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigClose: () => this.closeConfig() }))))));
|
|
192
201
|
}
|
|
193
202
|
get _element() { return index.getElement(this); }
|
|
@@ -31,66 +31,66 @@ exports.VisibleWhenForbidden = void 0;
|
|
|
31
31
|
(function (VisibleWhenForbidden) {
|
|
32
32
|
VisibleWhenForbidden["CONFIGURATOR"] = "CONFIGURATOR";
|
|
33
33
|
})(exports.VisibleWhenForbidden || (exports.VisibleWhenForbidden = {}));
|
|
34
|
-
const buildCustomButton = (def, className, action, isEnabled) => {
|
|
34
|
+
const buildCustomButton = (def, className, dataElementId, action, isEnabled) => {
|
|
35
35
|
const { hint, text, iconName } = def;
|
|
36
36
|
if (iconName) {
|
|
37
37
|
if (text) {
|
|
38
|
-
return iconTextButton(iconName, def.name, className, hint, text, action, isEnabled);
|
|
38
|
+
return iconTextButton(iconName, def.name, className, dataElementId, hint, text, action, isEnabled);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
return iconButton(iconName, def.name, className, hint, action, isEnabled);
|
|
41
|
+
return iconButton(iconName, def.name, className, dataElementId, hint, action, isEnabled);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
return textButton(def.name, className, text, hint, action, isEnabled);
|
|
45
|
+
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
48
|
+
const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions) => {
|
|
49
49
|
const title = getTitle(element);
|
|
50
50
|
switch (element) {
|
|
51
51
|
case exports.TaskbarElement.PREVIOUS:
|
|
52
|
-
return iconButton("chevron-left", element, className, title, action, isEnabled);
|
|
52
|
+
return iconButton("chevron-left", element, className, dataElementId, title, action, isEnabled);
|
|
53
53
|
case exports.TaskbarElement.NEXT:
|
|
54
|
-
return iconButton("chevron-right", element, className, title, action, isEnabled);
|
|
54
|
+
return iconButton("chevron-right", element, className, dataElementId, title, action, isEnabled);
|
|
55
55
|
case exports.TaskbarElement.REFRESH:
|
|
56
|
-
return iconButton("sync", element, className, title, action, isEnabled);
|
|
56
|
+
return iconButton("sync", element, className, dataElementId, title, action, isEnabled);
|
|
57
57
|
case exports.TaskbarElement.UPDATE:
|
|
58
|
-
return iconButton("edit", element, className, title, action, isEnabled);
|
|
58
|
+
return iconButton("edit", element, className, dataElementId, title, action, isEnabled);
|
|
59
59
|
case exports.TaskbarElement.CLONE:
|
|
60
|
-
return iconButton("copy", element, className, title, action, isEnabled);
|
|
60
|
+
return iconButton("copy", element, className, dataElementId, title, action, isEnabled);
|
|
61
61
|
case exports.TaskbarElement.REMOVE:
|
|
62
|
-
return iconButton("delete", element, className, title, action, isEnabled);
|
|
62
|
+
return iconButton("delete", element, className, dataElementId, title, action, isEnabled);
|
|
63
63
|
case exports.TaskbarElement.INSERT:
|
|
64
|
-
return iconTextButton("plus", element, className, title, title, action, isEnabled);
|
|
64
|
+
return iconTextButton("plus", element, className, dataElementId, title, title, action, isEnabled);
|
|
65
65
|
case exports.TaskbarElement.CANCEL:
|
|
66
|
-
return textButton(element, className, title, title, action, isEnabled);
|
|
66
|
+
return textButton(element, className, dataElementId, title, title, action, isEnabled);
|
|
67
67
|
case exports.TaskbarElement.SAVE:
|
|
68
|
-
return iconTextButton("save", element, className, title, title, action, isEnabled);
|
|
68
|
+
return iconTextButton("save", element, className, dataElementId, title, title, action, isEnabled);
|
|
69
69
|
case exports.TaskbarElement.GRID_MODE:
|
|
70
|
-
return iconButton("table", element, className, title, action, isEnabled);
|
|
70
|
+
return iconButton("table", element, className, dataElementId, title, action, isEnabled);
|
|
71
71
|
case exports.TaskbarElement.FORM_MODE:
|
|
72
|
-
return iconButton("list", element, className, title, action, isEnabled);
|
|
72
|
+
return iconButton("list", element, className, dataElementId, title, action, isEnabled);
|
|
73
73
|
case exports.TaskbarElement.CONFIGURATOR:
|
|
74
|
-
return iconButton("settings-inverted", element, className, title, action, isEnabled);
|
|
74
|
+
return iconButton("settings-inverted", element, className, dataElementId, title, action, isEnabled);
|
|
75
75
|
case exports.TaskbarElement.MORE_OPTIONS:
|
|
76
|
-
return actionButton(element, className, title, action, isEnabled, actions);
|
|
76
|
+
return actionButton(element, className, dataElementId, title, action, isEnabled, actions);
|
|
77
77
|
case exports.TaskbarElement.DIVIDER:
|
|
78
78
|
return index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium", "data-taskbar-divider": true });
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
function textButton(name, className, text, title, action, isEnabled) {
|
|
82
|
-
return index.h("ez-button", { title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) });
|
|
81
|
+
function textButton(name, className, dataElementId, text, title, action, isEnabled) {
|
|
82
|
+
return index.h("ez-button", { title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) });
|
|
83
83
|
}
|
|
84
|
-
function iconButton(iconName, name, className, title, action, isEnabled) {
|
|
85
|
-
return index.h("ez-button", { name: iconName, title: title, mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
|
|
84
|
+
function iconButton(iconName, name, className, dataElementId, title, action, isEnabled) {
|
|
85
|
+
return index.h("ez-button", { name: iconName, title: title, mode: "icon", size: "small", class: className, "data-element-id": dataElementId, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
|
|
86
86
|
}
|
|
87
|
-
function iconTextButton(iconName, name, className, text, title, action, isEnabled) {
|
|
88
|
-
return index.h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) },
|
|
87
|
+
function iconTextButton(iconName, name, className, dataElementId, text, title, action, isEnabled) {
|
|
88
|
+
return index.h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) },
|
|
89
89
|
index.h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
|
90
90
|
}
|
|
91
|
-
function actionButton(element, className, title, action, isEnabled, actions) {
|
|
91
|
+
function actionButton(element, className, dataElementId, title, action, isEnabled, actions) {
|
|
92
92
|
return actions && actions.length > 0
|
|
93
|
-
? index.h("ez-actions-button", { title: title, size: "small", arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
|
|
93
|
+
? index.h("ez-actions-button", { title: title, size: "small", "data-element-id": dataElementId, arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
|
|
94
94
|
: undefined;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { DataType, ErrorTracking, DependencyType, ApplicationContext } from "@sankhyalabs/core";
|
|
2
|
+
import { DataType, ErrorTracking, DependencyType, ApplicationContext, ElementIDUtils } from "@sankhyalabs/core";
|
|
3
3
|
import { DataFetcher } from "../../lib/http/data-fetcher/DataFetcher";
|
|
4
4
|
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
5
5
|
import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
|
|
@@ -607,6 +607,7 @@ export class SnkApplication {
|
|
|
607
607
|
window.requestAnimationFrame(() => {
|
|
608
608
|
this.applicationLoaded.emit(true);
|
|
609
609
|
});
|
|
610
|
+
ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
|
|
610
611
|
}
|
|
611
612
|
render() {
|
|
612
613
|
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 })));
|
|
@@ -1707,6 +1708,7 @@ export class SnkApplication {
|
|
|
1707
1708
|
}
|
|
1708
1709
|
};
|
|
1709
1710
|
}
|
|
1711
|
+
static get elementRef() { return "_element"; }
|
|
1710
1712
|
}
|
|
1711
1713
|
class RequestListenerLoadingBar {
|
|
1712
1714
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { VIEW_MODE } from '../../lib/utils/constants';
|
|
4
4
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
|
5
5
|
const GRID_MODE = VIEW_MODE.grid;
|
|
@@ -59,6 +59,10 @@ export class SnkCrud {
|
|
|
59
59
|
this.setViewMode(GRID_MODE);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
getDataElementId(suffix) {
|
|
63
|
+
const elemIdSnkCrud = this._element.getAttribute("data-element-id");
|
|
64
|
+
return `${elemIdSnkCrud}_${suffix}`;
|
|
65
|
+
}
|
|
62
66
|
componentWillLoad() {
|
|
63
67
|
let parent = this._element.parentElement;
|
|
64
68
|
while (parent) {
|
|
@@ -85,8 +89,12 @@ export class SnkCrud {
|
|
|
85
89
|
this.configName = application.configName;
|
|
86
90
|
}
|
|
87
91
|
}
|
|
92
|
+
componentDidLoad() {
|
|
93
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
94
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
95
|
+
}
|
|
88
96
|
render() {
|
|
89
|
-
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, 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", { ref: (ref) => this._snkForm = ref, configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
|
97
|
+
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": this.getDataElementId("crud_ViewStack") }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": this.getDataElementId("crud_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", { ref: (ref) => this._snkForm = ref, "data-element-id": this.getDataElementId("crud_form"), configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
|
90
98
|
}
|
|
91
99
|
static get is() { return "snk-crud"; }
|
|
92
100
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
|
2
2
|
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
3
3
|
import FilterItemType from './filter-item-type.enum';
|
|
4
|
-
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
4
|
+
import { ElementIDUtils, DataType } from '@sankhyalabs/core';
|
|
5
5
|
export class SnkFilterDetail {
|
|
6
6
|
async show() {
|
|
7
7
|
this._editor["show"]();
|
|
@@ -48,12 +48,22 @@ export class SnkFilterDetail {
|
|
|
48
48
|
buildIcon(title, iconName, action) {
|
|
49
49
|
return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, h("ez-icon", { title: title, iconName: iconName })));
|
|
50
50
|
}
|
|
51
|
+
getNormalizedValue(params, value) {
|
|
52
|
+
return params.reduce((arrayValues, currentParam, index) => {
|
|
53
|
+
if (currentParam.dataType === DataType.BOOLEAN && (arrayValues == undefined || arrayValues[index] == undefined)) {
|
|
54
|
+
arrayValues = arrayValues || [];
|
|
55
|
+
arrayValues[index] = false;
|
|
56
|
+
}
|
|
57
|
+
return arrayValues;
|
|
58
|
+
}, value);
|
|
59
|
+
}
|
|
51
60
|
apply() {
|
|
52
61
|
var _a;
|
|
53
62
|
let value = this._editor["value"];
|
|
54
63
|
let isValid = true;
|
|
55
64
|
if (this.config.type === FilterItemType.PERSONALIZED) {
|
|
56
65
|
const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
|
|
66
|
+
value = this.getNormalizedValue(params, value);
|
|
57
67
|
const paramsCount = params.length;
|
|
58
68
|
if (paramsCount === 0) {
|
|
59
69
|
//Valor do filtro personalizado sem parametros deve ser um array vazio
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationContext, DateUtils, ObjectUtils } from '@sankhyalabs/core';
|
|
1
|
+
import { ApplicationContext, DateUtils, ObjectUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h } from '@stencil/core';
|
|
3
3
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
4
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
@@ -133,6 +133,15 @@ export class SnkForm {
|
|
|
133
133
|
}
|
|
134
134
|
return disabled;
|
|
135
135
|
}
|
|
136
|
+
dataunitReady() {
|
|
137
|
+
this.loadInsertionConfig();
|
|
138
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
139
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
140
|
+
}
|
|
141
|
+
getDataElementId(suffix) {
|
|
142
|
+
const elemIdSnkTaskBar = this._element.getAttribute("data-element-id");
|
|
143
|
+
return `${elemIdSnkTaskBar}_${suffix}`;
|
|
144
|
+
}
|
|
136
145
|
componentWillLoad() {
|
|
137
146
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
138
147
|
let parent = this._element.parentElement;
|
|
@@ -142,7 +151,7 @@ export class SnkForm {
|
|
|
142
151
|
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
143
152
|
this._dataState = this._snkDataUnit.dataState;
|
|
144
153
|
if (this._dataUnit) {
|
|
145
|
-
this.
|
|
154
|
+
this.dataunitReady();
|
|
146
155
|
}
|
|
147
156
|
else {
|
|
148
157
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
@@ -176,7 +185,7 @@ export class SnkForm {
|
|
|
176
185
|
if (!this._dataUnit || !this._dataState) {
|
|
177
186
|
return undefined;
|
|
178
187
|
}
|
|
179
|
-
return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
188
|
+
return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", "data-element-id": this.getDataElementId("form_taskbar"), configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": this.getDataElementId("internal_form"), dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
180
189
|
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), "data-element-id": this._element.getAttribute("data-element-id"), configName: this.configName, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigClose: () => this.closeConfig() }))))));
|
|
181
190
|
}
|
|
182
191
|
static get is() { return "snk-form"; }
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
1
2
|
import { h } from '@stencil/core';
|
|
2
3
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
3
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
@@ -97,11 +98,19 @@ export class SnkGrid {
|
|
|
97
98
|
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
|
|
98
99
|
this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
|
|
99
100
|
}
|
|
101
|
+
componentDidLoad() {
|
|
102
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
103
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
104
|
+
}
|
|
105
|
+
getDataElementId(suffix) {
|
|
106
|
+
const elemIdSnkGrid = this._element.getAttribute("data-element-id");
|
|
107
|
+
return `${elemIdSnkGrid}_${suffix}`;
|
|
108
|
+
}
|
|
100
109
|
render() {
|
|
101
110
|
if (!this._dataUnit) {
|
|
102
111
|
return undefined;
|
|
103
112
|
}
|
|
104
|
-
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.saveConfig(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" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute("data-element-id"), selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
|
|
113
|
+
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, "data-element-id": this.getDataElementId("internal_filter"), 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", "data-element-id": this.getDataElementId("grid_top_taskbar"), 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, "data-element-id": this.getDataElementId("internal_grid"), dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, "data-element-id": this.getDataElementId("grid_left_taskBar"), 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" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute("data-element-id"), selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
|
|
105
114
|
}
|
|
106
115
|
static get is() { return "snk-grid"; }
|
|
107
116
|
static get encapsulation() { return "scoped"; }
|
|
@@ -28,64 +28,64 @@ export var VisibleWhenForbidden;
|
|
|
28
28
|
(function (VisibleWhenForbidden) {
|
|
29
29
|
VisibleWhenForbidden["CONFIGURATOR"] = "CONFIGURATOR";
|
|
30
30
|
})(VisibleWhenForbidden || (VisibleWhenForbidden = {}));
|
|
31
|
-
export const buildCustomButton = (def, className, action, isEnabled) => {
|
|
31
|
+
export const buildCustomButton = (def, className, dataElementId, action, isEnabled) => {
|
|
32
32
|
const { hint, text, iconName } = def;
|
|
33
33
|
if (iconName) {
|
|
34
34
|
if (text) {
|
|
35
|
-
return iconTextButton(iconName, def.name, className, hint, text, action, isEnabled);
|
|
35
|
+
return iconTextButton(iconName, def.name, className, dataElementId, hint, text, action, isEnabled);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
return iconButton(iconName, def.name, className, hint, action, isEnabled);
|
|
38
|
+
return iconButton(iconName, def.name, className, dataElementId, hint, action, isEnabled);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
return textButton(def.name, className, text, hint, action, isEnabled);
|
|
42
|
+
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
export const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
45
|
+
export const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions) => {
|
|
46
46
|
const title = getTitle(element);
|
|
47
47
|
switch (element) {
|
|
48
48
|
case TaskbarElement.PREVIOUS:
|
|
49
|
-
return iconButton("chevron-left", element, className, title, action, isEnabled);
|
|
49
|
+
return iconButton("chevron-left", element, className, dataElementId, title, action, isEnabled);
|
|
50
50
|
case TaskbarElement.NEXT:
|
|
51
|
-
return iconButton("chevron-right", element, className, title, action, isEnabled);
|
|
51
|
+
return iconButton("chevron-right", element, className, dataElementId, title, action, isEnabled);
|
|
52
52
|
case TaskbarElement.REFRESH:
|
|
53
|
-
return iconButton("sync", element, className, title, action, isEnabled);
|
|
53
|
+
return iconButton("sync", element, className, dataElementId, title, action, isEnabled);
|
|
54
54
|
case TaskbarElement.UPDATE:
|
|
55
|
-
return iconButton("edit", element, className, title, action, isEnabled);
|
|
55
|
+
return iconButton("edit", element, className, dataElementId, title, action, isEnabled);
|
|
56
56
|
case TaskbarElement.CLONE:
|
|
57
|
-
return iconButton("copy", element, className, title, action, isEnabled);
|
|
57
|
+
return iconButton("copy", element, className, dataElementId, title, action, isEnabled);
|
|
58
58
|
case TaskbarElement.REMOVE:
|
|
59
|
-
return iconButton("delete", element, className, title, action, isEnabled);
|
|
59
|
+
return iconButton("delete", element, className, dataElementId, title, action, isEnabled);
|
|
60
60
|
case TaskbarElement.INSERT:
|
|
61
|
-
return iconTextButton("plus", element, className, title, title, action, isEnabled);
|
|
61
|
+
return iconTextButton("plus", element, className, dataElementId, title, title, action, isEnabled);
|
|
62
62
|
case TaskbarElement.CANCEL:
|
|
63
|
-
return textButton(element, className, title, title, action, isEnabled);
|
|
63
|
+
return textButton(element, className, dataElementId, title, title, action, isEnabled);
|
|
64
64
|
case TaskbarElement.SAVE:
|
|
65
|
-
return iconTextButton("save", element, className, title, title, action, isEnabled);
|
|
65
|
+
return iconTextButton("save", element, className, dataElementId, title, title, action, isEnabled);
|
|
66
66
|
case TaskbarElement.GRID_MODE:
|
|
67
|
-
return iconButton("table", element, className, title, action, isEnabled);
|
|
67
|
+
return iconButton("table", element, className, dataElementId, title, action, isEnabled);
|
|
68
68
|
case TaskbarElement.FORM_MODE:
|
|
69
|
-
return iconButton("list", element, className, title, action, isEnabled);
|
|
69
|
+
return iconButton("list", element, className, dataElementId, title, action, isEnabled);
|
|
70
70
|
case TaskbarElement.CONFIGURATOR:
|
|
71
|
-
return iconButton("settings-inverted", element, className, title, action, isEnabled);
|
|
71
|
+
return iconButton("settings-inverted", element, className, dataElementId, title, action, isEnabled);
|
|
72
72
|
case TaskbarElement.MORE_OPTIONS:
|
|
73
|
-
return actionButton(element, className, title, action, isEnabled, actions);
|
|
73
|
+
return actionButton(element, className, dataElementId, title, action, isEnabled, actions);
|
|
74
74
|
case TaskbarElement.DIVIDER:
|
|
75
75
|
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium", "data-taskbar-divider": true });
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
function textButton(name, className, text, title, action, isEnabled) {
|
|
79
|
-
return h("ez-button", { title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) });
|
|
78
|
+
function textButton(name, className, dataElementId, text, title, action, isEnabled) {
|
|
79
|
+
return h("ez-button", { title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) });
|
|
80
80
|
}
|
|
81
|
-
function iconButton(iconName, name, className, title, action, isEnabled) {
|
|
82
|
-
return h("ez-button", { name: iconName, title: title, mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
|
|
81
|
+
function iconButton(iconName, name, className, dataElementId, title, action, isEnabled) {
|
|
82
|
+
return h("ez-button", { name: iconName, title: title, mode: "icon", size: "small", class: className, "data-element-id": dataElementId, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
|
|
83
83
|
}
|
|
84
|
-
function iconTextButton(iconName, name, className, text, title, action, isEnabled) {
|
|
85
|
-
return h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) }, h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
|
84
|
+
function iconTextButton(iconName, name, className, dataElementId, text, title, action, isEnabled) {
|
|
85
|
+
return h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) }, h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
|
86
86
|
}
|
|
87
|
-
function actionButton(element, className, title, action, isEnabled, actions) {
|
|
87
|
+
function actionButton(element, className, dataElementId, title, action, isEnabled, actions) {
|
|
88
88
|
return actions && actions.length > 0
|
|
89
|
-
? h("ez-actions-button", { title: title, size: "small", arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
|
|
89
|
+
? h("ez-actions-button", { title: title, size: "small", "data-element-id": dataElementId, arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
|
|
90
90
|
: undefined;
|
|
91
91
|
}
|