@sankhyalabs/sankhyablocks 2.2.2-SKA-60656.4 → 2.4.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 +3 -1
- 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 +32 -20
- package/dist/cjs/snk-filter-detail.cjs.entry.js +11 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
- package/dist/cjs/snk-form.cjs.entry.js +12 -3
- package/dist/cjs/{taskbar-elements-997af1c9.js → taskbar-elements-b995b84d.js} +26 -26
- package/dist/collection/components/snk-application/snk-application.js +4 -2
- package/dist/collection/components/snk-crud/snk-crud.js +10 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +12 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
- package/dist/collection/components/snk-form/snk-form.js +13 -4
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +2 -2
- package/dist/collection/components/snk-grid/snk-grid.js +10 -1
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +2 -2
- 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 +4 -2
- package/dist/components/snk-crud.js +10 -2
- package/dist/components/snk-filter-bar2.js +1 -1
- package/dist/components/snk-filter-detail2.js +12 -2
- package/dist/components/snk-filter-item2.js +1 -1
- package/dist/components/snk-form-config2.js +3 -3
- package/dist/components/snk-form2.js +13 -4
- package/dist/components/snk-grid-config2.js +3 -3
- package/dist/components/snk-grid2.js +10 -1
- package/dist/components/snk-taskbar2.js +54 -42
- package/dist/esm/snk-application.entry.js +5 -3
- 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 +32 -20
- package/dist/esm/snk-filter-detail.entry.js +12 -2
- package/dist/esm/snk-form-config.entry.js +3 -3
- package/dist/esm/snk-form.entry.js +13 -4
- package/dist/esm/taskbar-elements-a0a8c3ac.js +95 -0
- package/dist/sankhyablocks/p-2e0747f9.entry.js +1 -0
- package/dist/sankhyablocks/p-4cbc4ae3.js +1 -0
- package/dist/sankhyablocks/{p-7dcce5aa.entry.js → p-60e7e86d.entry.js} +1 -1
- package/dist/sankhyablocks/p-825c8975.entry.js +1 -0
- package/dist/sankhyablocks/{p-6340d992.entry.js → p-a72a0a5d.entry.js} +8 -8
- package/dist/sankhyablocks/p-cd486089.entry.js +1 -0
- package/dist/sankhyablocks/p-d2b0f1fc.entry.js +1 -0
- package/dist/sankhyablocks/p-d61f2170.entry.js +1 -0
- 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 +3 -4
- 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-7e79ab39.entry.js +0 -1
- package/dist/sankhyablocks/p-9b0f99fd.entry.js +0 -1
- package/dist/sankhyablocks/p-bc41625b.entry.js +0 -1
package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js
CHANGED
|
@@ -100,11 +100,11 @@ export class EzGridConfig {
|
|
|
100
100
|
this._columListItems = [visibleGroup, hiddenGroup];
|
|
101
101
|
}
|
|
102
102
|
buildColumnListSlot(item, group) {
|
|
103
|
-
const dataElementId = `${this._element.getAttribute(
|
|
103
|
+
const dataElementId = `${this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_configItem_${StringUtils.toCamelCase(item.label)}`;
|
|
104
104
|
return (h("div", null, h("ez-check", { mode: 'switch', id: 'switch' + ((item === null || item === void 0 ? void 0 : item.label) || '') + ((group === null || group === void 0 ? void 0 : group.group) || ''), value: group.group === this.getMessage("snkGridConfig.group.visible"), "data-element-id": dataElementId, onEzChange: (evt) => { this.switchColumnGroup(evt, item); } })));
|
|
105
105
|
}
|
|
106
106
|
buildOrderListSlot(item) {
|
|
107
|
-
const dataElementId = `${this._element.getAttribute(
|
|
107
|
+
const dataElementId = `${this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_configItem_${StringUtils.toCamelCase(item.label)}`;
|
|
108
108
|
let selectedOption = ORDER_VALUES.none.value;
|
|
109
109
|
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
110
110
|
selectedOption = item.ascending == true ? ORDER_VALUES.asc.value : ORDER_VALUES.desc.value;
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
|
1
|
+
import { ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h, Host } from '@stencil/core';
|
|
3
3
|
import { AuthorizationConfig } from '../snk-configurator/AuthorizationConfig';
|
|
4
4
|
import { TaskbarElement, buildElem, AuthorizationElements, buildCustomButton, VisibleWhenForbidden } from './elements/taskbar-elements';
|
|
@@ -108,26 +108,19 @@ export class SnkTaskbar {
|
|
|
108
108
|
className += "ez-padding-left--medium";
|
|
109
109
|
}
|
|
110
110
|
if (TaskbarElement[def.toString()]) {
|
|
111
|
-
return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
111
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
114
|
-
return buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
114
|
+
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (this._application) {
|
|
121
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
this._permissions = {};
|
|
125
|
-
}
|
|
117
|
+
getIdElemBtnNative(taskbarElem) {
|
|
118
|
+
const elemIdTaskbar = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
119
|
+
return `${elemIdTaskbar}_${StringUtils.toCamelCase(taskbarElem)}`;
|
|
126
120
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
121
|
+
getIdElemBtnCustom(btnCustom) {
|
|
122
|
+
const elemIdTaskbar = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
123
|
+
return `${elemIdTaskbar}_${StringUtils.toCamelCase(btnCustom.name)}`;
|
|
131
124
|
}
|
|
132
125
|
isDivider(element) {
|
|
133
126
|
var _a;
|
|
@@ -149,6 +142,24 @@ export class SnkTaskbar {
|
|
|
149
142
|
return true;
|
|
150
143
|
});
|
|
151
144
|
}
|
|
145
|
+
componentWillLoad() {
|
|
146
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
147
|
+
if (this._application) {
|
|
148
|
+
this._application.getAllAccess().then(access => this._permissions = access);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this._permissions = {};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
componentWillRender() {
|
|
155
|
+
if (this._definitions == undefined && this._permissions) {
|
|
156
|
+
this._definitions = this.elementsFromString(this.buttons);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
componentDidLoad() {
|
|
160
|
+
const dataInfo = { dataUnit: this.dataUnit };
|
|
161
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
162
|
+
}
|
|
152
163
|
render() {
|
|
153
164
|
if (this._definitions === undefined) {
|
|
154
165
|
return undefined;
|
|
@@ -358,6 +369,7 @@ export class SnkTaskbar {
|
|
|
358
369
|
}
|
|
359
370
|
}];
|
|
360
371
|
}
|
|
372
|
+
static get elementRef() { return "_element"; }
|
|
361
373
|
static get watchers() {
|
|
362
374
|
return [{
|
|
363
375
|
"propName": "buttons",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DataType, DataUnit, StringUtils, ChangeOperation, DateUtils, DependencyType, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
|
|
2
|
+
import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DataType, DataUnit, StringUtils, ChangeOperation, DateUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
|
|
3
3
|
import { d as dist, D as DataFetcher, R as ResourceFetcher, U as UrlUtils, F as FormConfigFetcher, G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
|
|
4
4
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
|
@@ -1172,7 +1172,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1172
1172
|
if (mode === "ADVANCED") {
|
|
1173
1173
|
return new Promise(accept => {
|
|
1174
1174
|
const pesquisaContent = document.createElement("snk-pesquisa");
|
|
1175
|
-
pesquisaContent[
|
|
1175
|
+
pesquisaContent[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME] = `entity_${entity}`;
|
|
1176
1176
|
pesquisaContent.argument = argument;
|
|
1177
1177
|
pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
|
|
1178
1178
|
pesquisaContent.selectItem = (option) => {
|
|
@@ -1242,10 +1242,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1242
1242
|
window.requestAnimationFrame(() => {
|
|
1243
1243
|
this.applicationLoaded.emit(true);
|
|
1244
1244
|
});
|
|
1245
|
+
ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
|
|
1245
1246
|
}
|
|
1246
1247
|
render() {
|
|
1247
1248
|
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 })));
|
|
1248
1249
|
}
|
|
1250
|
+
get _element() { return this; }
|
|
1249
1251
|
static get style() { return snkApplicationCss; }
|
|
1250
1252
|
}, [2, "snk-application", {
|
|
1251
1253
|
"messagesBuilder": [1040],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { V as VIEW_MODE } from './constants.js';
|
|
4
4
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
5
5
|
import { d as defineCustomElement$g } from './snk-config-options2.js';
|
|
@@ -74,6 +74,10 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
74
74
|
this.setViewMode(GRID_MODE);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
getDataElementId(suffix) {
|
|
78
|
+
const elemIdSnkCrud = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
79
|
+
return `${elemIdSnkCrud}_${suffix}`;
|
|
80
|
+
}
|
|
77
81
|
componentWillLoad() {
|
|
78
82
|
let parent = this._element.parentElement;
|
|
79
83
|
while (parent) {
|
|
@@ -100,8 +104,12 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
100
104
|
this.configName = application.configName;
|
|
101
105
|
}
|
|
102
106
|
}
|
|
107
|
+
componentDidLoad() {
|
|
108
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
109
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
110
|
+
}
|
|
103
111
|
render() {
|
|
104
|
-
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) })));
|
|
112
|
+
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) })));
|
|
105
113
|
}
|
|
106
114
|
get _element() { return this; }
|
|
107
115
|
static get style() { return snkCrudCss; }
|
|
@@ -160,7 +160,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
160
160
|
if (this._element) {
|
|
161
161
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
162
162
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
163
|
-
const dataElementIdFilterBar = this._element.getAttribute(
|
|
163
|
+
const dataElementIdFilterBar = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
164
164
|
this._idSnkFilterItem = dataElementIdFilterBar;
|
|
165
165
|
this._idSnkFilterList = dataElementIdFilterBar;
|
|
166
166
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum.js';
|
|
4
|
-
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
4
|
+
import { ElementIDUtils, DataType } from '@sankhyalabs/core';
|
|
5
5
|
|
|
6
6
|
const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -15,7 +15,7 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
15
15
|
componentDidLoad() {
|
|
16
16
|
if (this._element) {
|
|
17
17
|
ElementIDUtils.addIDInfo(this._element);
|
|
18
|
-
const dataElementIdDoFilterItem = this._element.getAttribute(
|
|
18
|
+
const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
19
19
|
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -54,12 +54,22 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
54
54
|
buildIcon(title, iconName, action) {
|
|
55
55
|
return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, h("ez-icon", { title: title, iconName: iconName })));
|
|
56
56
|
}
|
|
57
|
+
getNormalizedValue(params, value) {
|
|
58
|
+
return params.reduce((arrayValues, currentParam, index) => {
|
|
59
|
+
if (currentParam.dataType === DataType.BOOLEAN && (arrayValues == undefined || arrayValues[index] == undefined)) {
|
|
60
|
+
arrayValues = arrayValues || [];
|
|
61
|
+
arrayValues[index] = false;
|
|
62
|
+
}
|
|
63
|
+
return arrayValues;
|
|
64
|
+
}, value);
|
|
65
|
+
}
|
|
57
66
|
apply() {
|
|
58
67
|
var _a;
|
|
59
68
|
let value = this._editor["value"];
|
|
60
69
|
let isValid = true;
|
|
61
70
|
if (this.config.type === FilterItemType.PERSONALIZED) {
|
|
62
71
|
const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
|
|
72
|
+
value = this.getNormalizedValue(params, value);
|
|
63
73
|
const paramsCount = params.length;
|
|
64
74
|
if (paramsCount === 0) {
|
|
65
75
|
//Valor do filtro personalizado sem parametros deve ser um array vazio
|
|
@@ -142,7 +142,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
142
142
|
componentDidLoad() {
|
|
143
143
|
if (this._filterItemElement) {
|
|
144
144
|
ElementIDUtils.addIDInfo(this._filterItemElement);
|
|
145
|
-
const dataElementIdDoFilterItem = this._filterItemElement.getAttribute(
|
|
145
|
+
const dataElementIdDoFilterItem = this._filterItemElement.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
146
146
|
this._idSnkFilterDetail = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
|
147
147
|
this._idEzChip = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
|
148
148
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { a as draggable_bundle, d as defineCustomElement$1 } from './snk-tab-config2.js';
|
|
3
|
-
import { ObjectUtils, ArrayUtils, ApplicationContext
|
|
3
|
+
import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
4
4
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import { C as CONFIG_EVENTS, b as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants.js';
|
|
6
6
|
import { a as UserConfigType, C as ConfigStorage } from './ConfigStorage.js';
|
|
@@ -240,8 +240,8 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
240
240
|
var _a;
|
|
241
241
|
return ((_a = group.fields) === null || _a === void 0 ? void 0 : _a.length) ? group.fields.map((field) => {
|
|
242
242
|
var _a, _b;
|
|
243
|
-
return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, "data-element-id": this._element.getAttribute(
|
|
244
|
-
h("div", { class: "ez-flex form-config__config-options" }, h("snk-config-options", { idConfig: field.name, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, "data-element-id": this._element.getAttribute(
|
|
243
|
+
return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
|
|
244
|
+
h("div", { class: "ez-flex form-config__config-options" }, h("snk-config-options", { idConfig: field.name, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), onConfigOptionsChanged: (evt) => this.handleconfigOptionsChanged(evt.detail) })));
|
|
245
245
|
}) : h("div", { class: "form-config__add-group-container" }, h("div", { class: "form-config__add-group-content" }, h("div", { class: "form-config__add-group-label" }, h("label", { class: "ez-text ez-text--center ez-text--medium ez-text--primary ez-text--bold" }, this.getMessage("snkFormConfig.form.labelDropField")))));
|
|
246
246
|
}
|
|
247
247
|
handleconfigOptionsChanged(fieldEdited) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { DateUtils, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
import { DateUtils, ObjectUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { T as TaskbarProcessor } from './taskbar-processor.js';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
5
5
|
import { d as defineCustomElement$5 } from './snk-config-options2.js';
|
|
@@ -145,6 +145,15 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
145
145
|
}
|
|
146
146
|
return disabled;
|
|
147
147
|
}
|
|
148
|
+
dataunitReady() {
|
|
149
|
+
this.loadInsertionConfig();
|
|
150
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
151
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
152
|
+
}
|
|
153
|
+
getDataElementId(suffix) {
|
|
154
|
+
const elemIdSnkTaskBar = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
155
|
+
return `${elemIdSnkTaskBar}_${suffix}`;
|
|
156
|
+
}
|
|
148
157
|
componentWillLoad() {
|
|
149
158
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
150
159
|
let parent = this._element.parentElement;
|
|
@@ -154,7 +163,7 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
154
163
|
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
155
164
|
this._dataState = this._snkDataUnit.dataState;
|
|
156
165
|
if (this._dataUnit) {
|
|
157
|
-
this.
|
|
166
|
+
this.dataunitReady();
|
|
158
167
|
}
|
|
159
168
|
else {
|
|
160
169
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
@@ -188,8 +197,8 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
188
197
|
if (!this._dataUnit || !this._dataState) {
|
|
189
198
|
return undefined;
|
|
190
199
|
}
|
|
191
|
-
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 &&
|
|
192
|
-
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), "data-element-id": this._element.getAttribute(
|
|
200
|
+
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 &&
|
|
201
|
+
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), configName: this.configName, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigClose: () => this.closeConfig() }))))));
|
|
193
202
|
}
|
|
194
203
|
get _element() { return this; }
|
|
195
204
|
static get style() { return snkFormCss; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { StringUtils,
|
|
2
|
+
import { StringUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
5
5
|
import { O as ORDER_VALUES } from './constants.js';
|
|
@@ -108,11 +108,11 @@ const EzGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
108
108
|
this._columListItems = [visibleGroup, hiddenGroup];
|
|
109
109
|
}
|
|
110
110
|
buildColumnListSlot(item, group) {
|
|
111
|
-
const dataElementId = `${this._element.getAttribute(
|
|
111
|
+
const dataElementId = `${this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_configItem_${StringUtils.toCamelCase(item.label)}`;
|
|
112
112
|
return (h("div", null, h("ez-check", { mode: 'switch', id: 'switch' + ((item === null || item === void 0 ? void 0 : item.label) || '') + ((group === null || group === void 0 ? void 0 : group.group) || ''), value: group.group === this.getMessage("snkGridConfig.group.visible"), "data-element-id": dataElementId, onEzChange: (evt) => { this.switchColumnGroup(evt, item); } })));
|
|
113
113
|
}
|
|
114
114
|
buildOrderListSlot(item) {
|
|
115
|
-
const dataElementId = `${this._element.getAttribute(
|
|
115
|
+
const dataElementId = `${this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_configItem_${StringUtils.toCamelCase(item.label)}`;
|
|
116
116
|
let selectedOption = ORDER_VALUES.none.value;
|
|
117
117
|
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
118
118
|
selectedOption = item.ascending == true ? ORDER_VALUES.asc.value : ORDER_VALUES.desc.value;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
3
|
import { T as TaskbarProcessor } from './taskbar-processor.js';
|
|
3
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
4
5
|
import { d as defineCustomElement$8 } from './snk-filter-bar2.js';
|
|
@@ -112,11 +113,19 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
112
113
|
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
|
|
113
114
|
this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
|
|
114
115
|
}
|
|
116
|
+
componentDidLoad() {
|
|
117
|
+
const dataInfo = { dataUnit: this._dataUnit };
|
|
118
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
119
|
+
}
|
|
120
|
+
getDataElementId(suffix) {
|
|
121
|
+
const elemIdSnkGrid = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
122
|
+
return `${elemIdSnkGrid}_${suffix}`;
|
|
123
|
+
}
|
|
115
124
|
render() {
|
|
116
125
|
if (!this._dataUnit) {
|
|
117
126
|
return undefined;
|
|
118
127
|
}
|
|
119
|
-
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(
|
|
128
|
+
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(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
|
|
120
129
|
}
|
|
121
130
|
get _element() { return this; }
|
|
122
131
|
static get style() { return snkGridCss; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
import { ElementIDUtils, StringUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { A as AuthorizationConfig } from './AuthorizationConfig.js';
|
|
4
4
|
|
|
5
5
|
var TaskbarElement;
|
|
@@ -31,66 +31,66 @@ var VisibleWhenForbidden;
|
|
|
31
31
|
(function (VisibleWhenForbidden) {
|
|
32
32
|
VisibleWhenForbidden["CONFIGURATOR"] = "CONFIGURATOR";
|
|
33
33
|
})(VisibleWhenForbidden || (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 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 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 TaskbarElement.REFRESH:
|
|
56
|
-
return iconButton("sync", element, className, title, action, isEnabled);
|
|
56
|
+
return iconButton("sync", element, className, dataElementId, title, action, isEnabled);
|
|
57
57
|
case TaskbarElement.UPDATE:
|
|
58
|
-
return iconButton("edit", element, className, title, action, isEnabled);
|
|
58
|
+
return iconButton("edit", element, className, dataElementId, title, action, isEnabled);
|
|
59
59
|
case TaskbarElement.CLONE:
|
|
60
|
-
return iconButton("copy", element, className, title, action, isEnabled);
|
|
60
|
+
return iconButton("copy", element, className, dataElementId, title, action, isEnabled);
|
|
61
61
|
case TaskbarElement.REMOVE:
|
|
62
|
-
return iconButton("delete", element, className, title, action, isEnabled);
|
|
62
|
+
return iconButton("delete", element, className, dataElementId, title, action, isEnabled);
|
|
63
63
|
case 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 TaskbarElement.CANCEL:
|
|
66
|
-
return textButton(element, className, title, title, action, isEnabled);
|
|
66
|
+
return textButton(element, className, dataElementId, title, title, action, isEnabled);
|
|
67
67
|
case 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 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 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 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 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 TaskbarElement.DIVIDER:
|
|
78
78
|
return 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 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 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 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 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 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 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
|
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
|
-
? h("ez-actions-button", { title: title, size: "small", arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
|
|
93
|
+
? 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
|
|
|
@@ -206,26 +206,19 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
206
206
|
className += "ez-padding-left--medium";
|
|
207
207
|
}
|
|
208
208
|
if (TaskbarElement[def.toString()]) {
|
|
209
|
-
return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
209
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
210
210
|
}
|
|
211
211
|
else {
|
|
212
|
-
return buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
212
|
+
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (this._application) {
|
|
219
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
this._permissions = {};
|
|
223
|
-
}
|
|
215
|
+
getIdElemBtnNative(taskbarElem) {
|
|
216
|
+
const elemIdTaskbar = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
217
|
+
return `${elemIdTaskbar}_${StringUtils.toCamelCase(taskbarElem)}`;
|
|
224
218
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
219
|
+
getIdElemBtnCustom(btnCustom) {
|
|
220
|
+
const elemIdTaskbar = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
221
|
+
return `${elemIdTaskbar}_${StringUtils.toCamelCase(btnCustom.name)}`;
|
|
229
222
|
}
|
|
230
223
|
isDivider(element) {
|
|
231
224
|
var _a;
|
|
@@ -247,6 +240,24 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
247
240
|
return true;
|
|
248
241
|
});
|
|
249
242
|
}
|
|
243
|
+
componentWillLoad() {
|
|
244
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
245
|
+
if (this._application) {
|
|
246
|
+
this._application.getAllAccess().then(access => this._permissions = access);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
this._permissions = {};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
componentWillRender() {
|
|
253
|
+
if (this._definitions == undefined && this._permissions) {
|
|
254
|
+
this._definitions = this.elementsFromString(this.buttons);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
componentDidLoad() {
|
|
258
|
+
const dataInfo = { dataUnit: this.dataUnit };
|
|
259
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
260
|
+
}
|
|
250
261
|
render() {
|
|
251
262
|
if (this._definitions === undefined) {
|
|
252
263
|
return undefined;
|
|
@@ -268,6 +279,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
268
279
|
return h("slot", { name: elem });
|
|
269
280
|
}))));
|
|
270
281
|
}
|
|
282
|
+
get _element() { return this; }
|
|
271
283
|
static get watchers() { return {
|
|
272
284
|
"buttons": ["observeButtons"]
|
|
273
285
|
}; }
|