@sankhyalabs/sankhyablocks 5.17.0 → 5.18.1
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/ParamType-90b440a0.js +13 -0
- package/dist/cjs/{SnkMessageBuilder-cf80308c.js → SnkMessageBuilder-3b5b5614.js} +30 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +704 -0
- package/dist/cjs/snk-actions-form.cjs.entry.js +200 -0
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-client-confirm.cjs.entry.js +52 -0
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-bd271acd.js → snk-data-unit-e9c20097.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +4 -4
- package/dist/cjs/{snk-guides-viewer-0ab3746e.js → snk-guides-viewer-c8843478.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-bar_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-taskbar.cjs.entry.js +1 -1
- package/dist/cjs/{taskbar-elements-bc2598f9.js → taskbar-elements-3be287d6.js} +3 -0
- package/dist/cjs/{taskbar-processor-e1e3bbf7.js → taskbar-processor-02f0fc84.js} +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-actions-button/actions/enum/ActionsType.js +8 -0
- package/dist/collection/components/snk-actions-button/actions/enum/ParamType.js +11 -0
- package/dist/collection/components/snk-actions-button/actions/enum/RefreshType.js +7 -0
- package/dist/collection/components/snk-actions-button/actions/executor/java.executor.js +22 -0
- package/dist/collection/components/snk-actions-button/actions/executor/javascript.executor.js +20 -0
- package/dist/collection/components/snk-actions-button/actions/executor/launch-screen.executor.js +42 -0
- package/dist/collection/components/snk-actions-button/actions/executor/procedure.executor.js +26 -0
- package/dist/collection/components/snk-actions-button/actions/factory/executor.factory.js +26 -0
- package/dist/collection/components/snk-actions-button/actions/index.js +343 -0
- package/dist/collection/components/snk-actions-button/actions/interfaces/IAction.js +7 -0
- package/dist/collection/components/snk-actions-button/actions/interfaces/IExecSource.js +1 -0
- package/dist/collection/components/snk-actions-button/actions/interfaces/IExecuteActions.js +1 -0
- package/dist/collection/components/snk-actions-button/actions/interfaces/IExecuteActionsProps.js +1 -0
- package/dist/collection/components/snk-actions-button/actions/interfaces/IResultParam.js +1 -0
- package/dist/collection/components/snk-actions-button/clientEvent/index.js +87 -0
- package/dist/collection/components/snk-actions-button/clientEvent/interfaces/IClientEventConfirm.js +1 -0
- package/dist/collection/components/snk-actions-button/snk-actions-button.css +38 -0
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +139 -0
- package/dist/collection/components/snk-actions-button/subcomponents/snk-actions-form.js +263 -0
- package/dist/collection/components/snk-actions-button/subcomponents/snk-client-confirm.js +134 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +2 -2
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-actions-button.msg.js +27 -0
- package/dist/components/ParamType.js +13 -0
- package/dist/components/SnkMessageBuilder.js +30 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/snk-actions-button.d.ts +11 -0
- package/dist/components/snk-actions-button.js +6 -0
- package/dist/components/snk-actions-button2.js +718 -0
- package/dist/components/snk-actions-form.d.ts +11 -0
- package/dist/components/snk-actions-form.js +218 -0
- package/dist/components/snk-attach2.js +7 -1
- package/dist/components/snk-client-confirm.d.ts +11 -0
- package/dist/components/snk-client-confirm.js +71 -0
- package/dist/components/snk-crud.js +7 -1
- package/dist/components/snk-detail-view2.js +13 -2
- package/dist/components/snk-filter-binary-select.js +1 -1
- package/dist/components/snk-grid2.js +9 -3
- package/dist/components/snk-simple-crud2.js +7 -1
- package/dist/components/snk-taskbar2.js +10 -1
- package/dist/esm/ParamType-d5152b06.js +13 -0
- package/dist/esm/{SnkMessageBuilder-1a169545.js → SnkMessageBuilder-188a38bb.js} +30 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +700 -0
- package/dist/esm/snk-actions-form.entry.js +196 -0
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-client-confirm.entry.js +48 -0
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-476024e9.js → snk-data-unit-79b1583a.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +4 -4
- package/dist/esm/{snk-guides-viewer-767f5a74.js → snk-guides-viewer-59d3a78c.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-bar_2.entry.js +2 -2
- package/dist/esm/snk-taskbar.entry.js +1 -1
- package/dist/esm/{taskbar-elements-e6af3e93.js → taskbar-elements-8ff33c26.js} +3 -0
- package/dist/esm/{taskbar-processor-a40798b8.js → taskbar-processor-20de6616.js} +1 -1
- package/dist/sankhyablocks/{p-3e17b147.js → p-0b40c655.js} +1 -1
- package/dist/sankhyablocks/{p-de9caf1e.entry.js → p-0b6ddb67.entry.js} +1 -1
- package/dist/sankhyablocks/p-19692f92.js +1 -0
- package/dist/sankhyablocks/{p-6df8c88b.entry.js → p-257c71a7.entry.js} +1 -1
- package/dist/sankhyablocks/{p-551165d8.js → p-28c12f65.js} +1 -1
- package/dist/sankhyablocks/{p-78de64fb.entry.js → p-2d0fc912.entry.js} +1 -1
- package/dist/sankhyablocks/p-384c4a6b.js +1 -0
- package/dist/sankhyablocks/{p-f43629f3.entry.js → p-44c2ed16.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ec1c64be.entry.js → p-8ce9ea9f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e0c04667.entry.js → p-9c7f7214.entry.js} +1 -1
- package/dist/sankhyablocks/p-9f66bc54.entry.js +1 -0
- package/dist/sankhyablocks/{p-c74fca58.js → p-b34d23fa.js} +1 -1
- package/dist/sankhyablocks/p-b680fa7a.entry.js +1 -0
- package/dist/sankhyablocks/p-b75ce8b8.entry.js +1 -0
- package/dist/sankhyablocks/{p-9e92ed74.entry.js → p-cbe93a18.entry.js} +2 -2
- package/dist/sankhyablocks/p-eaad0aa8.js +1 -0
- package/dist/sankhyablocks/{p-7956b9dd.entry.js → p-eb07d0eb.entry.js} +1 -1
- package/dist/sankhyablocks/p-f27dc5e9.entry.js +1 -0
- package/dist/sankhyablocks/p-fa2d0376.entry.js +1 -0
- package/dist/sankhyablocks/p-ff398057.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/enum/ActionsType.d.ts +7 -0
- package/dist/types/components/snk-actions-button/actions/enum/ParamType.d.ts +10 -0
- package/dist/types/components/snk-actions-button/actions/enum/RefreshType.d.ts +6 -0
- package/dist/types/components/snk-actions-button/actions/executor/java.executor.d.ts +6 -0
- package/dist/types/components/snk-actions-button/actions/executor/javascript.executor.d.ts +6 -0
- package/dist/types/components/snk-actions-button/actions/executor/launch-screen.executor.d.ts +10 -0
- package/dist/types/components/snk-actions-button/actions/executor/procedure.executor.d.ts +6 -0
- package/dist/types/components/snk-actions-button/actions/factory/executor.factory.d.ts +7 -0
- package/dist/types/components/snk-actions-button/actions/index.d.ts +27 -0
- package/dist/types/components/snk-actions-button/actions/interfaces/IAction.d.ts +55 -0
- package/dist/types/components/snk-actions-button/actions/interfaces/IExecSource.d.ts +17 -0
- package/dist/types/components/snk-actions-button/actions/interfaces/IExecuteActions.d.ts +4 -0
- package/dist/types/components/snk-actions-button/actions/interfaces/IExecuteActionsProps.d.ts +4 -0
- package/dist/types/components/snk-actions-button/actions/interfaces/IResultParam.d.ts +14 -0
- package/dist/types/components/snk-actions-button/clientEvent/index.d.ts +4 -0
- package/dist/types/components/snk-actions-button/clientEvent/interfaces/IClientEventConfirm.d.ts +35 -0
- package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +27 -0
- package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +41 -0
- package/dist/types/components/snk-actions-button/subcomponents/snk-client-confirm.d.ts +31 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
- package/dist/types/components.d.ts +96 -0
- package/dist/types/lib/message/resources/snk-actions-button.msg.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-1c5d5e5c.entry.js +0 -1
- package/dist/sankhyablocks/p-39082fc3.js +0 -1
- package/dist/sankhyablocks/p-8d40909d.entry.js +0 -1
- package/dist/sankhyablocks/p-9cbc3925.entry.js +0 -1
- package/dist/sankhyablocks/p-d410f45a.js +0 -1
@@ -0,0 +1,196 @@
|
|
1
|
+
import { r as registerInstance, h } from './index-cfd4bb13.js';
|
2
|
+
import { DataUnit, UserInterface, DataType, ApplicationContext } from '@sankhyalabs/core';
|
3
|
+
import { P as ParamType } from './ParamType-d5152b06.js';
|
4
|
+
|
5
|
+
const SnkActionsForm = class {
|
6
|
+
constructor(hostRef) {
|
7
|
+
registerInstance(this, hostRef);
|
8
|
+
this.APPLY = 'OK';
|
9
|
+
this.CANCEL = 'CANCEL';
|
10
|
+
this.CLOSE = 'CLOSE';
|
11
|
+
this.action = undefined;
|
12
|
+
this.applyParameters = undefined;
|
13
|
+
this.dataUnit = new DataUnit();
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Responsável por abrir a popup.
|
17
|
+
*/
|
18
|
+
async openPopup() {
|
19
|
+
this._ezPopup.opened = true;
|
20
|
+
}
|
21
|
+
;
|
22
|
+
exitPopup() {
|
23
|
+
this._ezPopup.opened = false;
|
24
|
+
}
|
25
|
+
async handleApply() {
|
26
|
+
try {
|
27
|
+
await this._ezForm.validate();
|
28
|
+
let row = this.dataUnit.getSelectedRecord();
|
29
|
+
if (row) {
|
30
|
+
this._params.forEach((param, index) => {
|
31
|
+
if (row.hasOwnProperty(param.name)) {
|
32
|
+
if (param.paramType == ParamType.ENTITY) {
|
33
|
+
let searchValue = row[param.name];
|
34
|
+
if (!searchValue) {
|
35
|
+
param.value = null;
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
param.value = typeof searchValue === 'object' ? searchValue.value : searchValue;
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
this._params[index].value = row[param.name];
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
this._params[index].value = undefined;
|
45
|
+
}
|
46
|
+
});
|
47
|
+
this.action.actionConfig.params.promptParam = this._params;
|
48
|
+
}
|
49
|
+
this.exitPopup();
|
50
|
+
this.applyParameters(this.action);
|
51
|
+
}
|
52
|
+
catch (e) {
|
53
|
+
// exceção ignorada, quando o validate() falha.
|
54
|
+
}
|
55
|
+
}
|
56
|
+
searchLoader(evt, param) {
|
57
|
+
const options = {
|
58
|
+
entity: param.entityName,
|
59
|
+
entityDescription: param.label
|
60
|
+
};
|
61
|
+
return this._application.executePreparedSearch(evt.mode, evt.argument, options);
|
62
|
+
}
|
63
|
+
;
|
64
|
+
getUserInterface(paramType) {
|
65
|
+
switch (paramType) {
|
66
|
+
case ParamType.TEXT:
|
67
|
+
return UserInterface.SHORTTEXT;
|
68
|
+
case ParamType.INTEGER:
|
69
|
+
return UserInterface.INTEGERNUMBER;
|
70
|
+
case ParamType.DECIMAL:
|
71
|
+
return UserInterface.DECIMALNUMBER;
|
72
|
+
case ParamType.DATE:
|
73
|
+
return UserInterface.DATE;
|
74
|
+
case ParamType.DATETIME:
|
75
|
+
return UserInterface.DATETIME;
|
76
|
+
case ParamType.BOOLEAN:
|
77
|
+
return UserInterface.CHECKBOX;
|
78
|
+
case ParamType.ENTITY:
|
79
|
+
return UserInterface.SEARCH;
|
80
|
+
case ParamType.OPTIONS:
|
81
|
+
return UserInterface.OPTIONSELECTOR;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
getDataType(paramType) {
|
85
|
+
switch (paramType) {
|
86
|
+
case ParamType.TEXT:
|
87
|
+
case ParamType.OPTIONS:
|
88
|
+
return DataType.TEXT;
|
89
|
+
case ParamType.INTEGER:
|
90
|
+
case ParamType.DECIMAL:
|
91
|
+
return DataType.NUMBER;
|
92
|
+
case ParamType.DATE:
|
93
|
+
case ParamType.DATETIME:
|
94
|
+
return DataType.DATE;
|
95
|
+
case ParamType.BOOLEAN:
|
96
|
+
return DataType.BOOLEAN;
|
97
|
+
case ParamType.ENTITY:
|
98
|
+
return DataType.OBJECT;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
getProps(param) {
|
102
|
+
switch (param.paramType) {
|
103
|
+
case ParamType.DECIMAL:
|
104
|
+
return param.precision ? { precision: Number(param.precision) } : undefined;
|
105
|
+
case ParamType.ENTITY:
|
106
|
+
return { ENTITYNAME: param.entityName };
|
107
|
+
case ParamType.OPTIONS:
|
108
|
+
return { options: this.prepareOptions(param.options) };
|
109
|
+
default:
|
110
|
+
return undefined;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
buildFields() {
|
114
|
+
let fields = [];
|
115
|
+
this._params.forEach((param, index) => {
|
116
|
+
const hasName = !!param.name;
|
117
|
+
let paramName = hasName ? param.name : `param_${index}`;
|
118
|
+
fields.push({
|
119
|
+
name: paramName,
|
120
|
+
label: param.label,
|
121
|
+
dataType: this.getDataType(param.paramType),
|
122
|
+
userInterface: this.getUserInterface(param.paramType),
|
123
|
+
readOnly: false,
|
124
|
+
required: param.paramType == 'B' ? false : param.required === "true",
|
125
|
+
properties: this.getProps(param)
|
126
|
+
});
|
127
|
+
this._params[index].name = paramName;
|
128
|
+
this._params[index].isGeneratedName = !hasName;
|
129
|
+
});
|
130
|
+
const metadata = {
|
131
|
+
name: 'params',
|
132
|
+
label: 'params',
|
133
|
+
fields: fields
|
134
|
+
};
|
135
|
+
this._metadata = metadata;
|
136
|
+
}
|
137
|
+
fillFields() {
|
138
|
+
this._params.forEach((param) => {
|
139
|
+
if (param.saveLast == 'true') {
|
140
|
+
this.dataUnit.setFieldValue(param.name, param.value);
|
141
|
+
}
|
142
|
+
});
|
143
|
+
}
|
144
|
+
prepareOptions(options) {
|
145
|
+
const optionsArray = options.split(";");
|
146
|
+
let optionsList = optionsArray.map(function (opc, index) {
|
147
|
+
let value;
|
148
|
+
let label;
|
149
|
+
if (opc.indexOf('=') > -1) {
|
150
|
+
let opcArr = opc.split('=');
|
151
|
+
value = opcArr[0];
|
152
|
+
label = opcArr[1];
|
153
|
+
}
|
154
|
+
else {
|
155
|
+
value = (index + 1).toString();
|
156
|
+
label = opc;
|
157
|
+
}
|
158
|
+
return {
|
159
|
+
value: value,
|
160
|
+
label: label
|
161
|
+
};
|
162
|
+
});
|
163
|
+
return optionsList;
|
164
|
+
}
|
165
|
+
componentWillLoad() {
|
166
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
167
|
+
this._params = [...this.action.actionConfig.params.promptParam];
|
168
|
+
this.dataUnit.metadataLoader = this.metadataLoader.bind(this);
|
169
|
+
this.dataUnit.loadMetadata().then(() => {
|
170
|
+
this.fillFields();
|
171
|
+
});
|
172
|
+
this.dataUnit.addRecord();
|
173
|
+
}
|
174
|
+
async metadataLoader() {
|
175
|
+
return new Promise((resolve) => {
|
176
|
+
this.buildFields();
|
177
|
+
resolve(this._metadata);
|
178
|
+
});
|
179
|
+
}
|
180
|
+
handleModalAction(evt) {
|
181
|
+
switch (evt) {
|
182
|
+
case this.APPLY:
|
183
|
+
this.handleApply();
|
184
|
+
break;
|
185
|
+
case this.CANCEL:
|
186
|
+
case this.CLOSE:
|
187
|
+
this.exitPopup();
|
188
|
+
break;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
render() {
|
192
|
+
return (h("ez-popup", { size: "medium", heightMode: "auto", useHeader: false, ref: (ref) => this._ezPopup = ref }, h("ez-modal-container", { modalTitle: this._application.messagesBuilder.getMessage("snkActionsButton.form.fillParams", undefined), okButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.apply", undefined), cancelButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.cancel", undefined), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, h("div", { class: "ez-margin-vertical--medium" }, h("ez-form", { ref: (ref) => this._ezForm = ref, dataUnit: this.dataUnit })))));
|
193
|
+
}
|
194
|
+
};
|
195
|
+
|
196
|
+
export { SnkActionsForm as snk_actions_form };
|
@@ -6,7 +6,7 @@ import { P as PesquisaFetcher } from './pesquisa-fetcher-bd6af0e3.js';
|
|
6
6
|
import { G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage-e6c17998.js';
|
7
7
|
import { D as DataUnitFetcher } from './dataunit-fetcher-d32c6a47.js';
|
8
8
|
import { R as ResourceFetcher } from './resource-fetcher-02642924.js';
|
9
|
-
import { S as SnkMessageBuilder } from './SnkMessageBuilder-
|
9
|
+
import { S as SnkMessageBuilder } from './SnkMessageBuilder-188a38bb.js';
|
10
10
|
import './_commonjsHelpers-9943807e.js';
|
11
11
|
import './form-config-fetcher-cac8cd96.js';
|
12
12
|
import './filter-bar-config-fetcher-edc48f4b.js';
|
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action } from '@sankhyalabs/core';
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher-b3d8b2d5.js';
|
4
4
|
import { c as VIEW_MODE } from './constants-e916ccc3.js';
|
5
5
|
import { D as DataUnitFetcher } from './dataunit-fetcher-d32c6a47.js';
|
6
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
6
|
+
import { T as TaskbarElement } from './taskbar-elements-8ff33c26.js';
|
7
7
|
import './_commonjsHelpers-9943807e.js';
|
8
8
|
import './index-507e19ec.js';
|
9
9
|
import './index-8efbf198.js';
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { r as registerInstance, h } from './index-cfd4bb13.js';
|
2
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
3
|
+
|
4
|
+
const SnkActionsForm = class {
|
5
|
+
constructor(hostRef) {
|
6
|
+
registerInstance(this, hostRef);
|
7
|
+
this.APLICAR = 'OK';
|
8
|
+
this.CANCELAR = 'CANCEL';
|
9
|
+
this.FECHAR = 'CLOSE';
|
10
|
+
this.titleMessage = undefined;
|
11
|
+
this.message = undefined;
|
12
|
+
this.accept = undefined;
|
13
|
+
this.cancel = undefined;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Responsável por abrir a popup.
|
17
|
+
*/
|
18
|
+
async openPopup() {
|
19
|
+
this._ezPopup.opened = true;
|
20
|
+
}
|
21
|
+
;
|
22
|
+
exitPopup() {
|
23
|
+
this._ezPopup.opened = false;
|
24
|
+
}
|
25
|
+
handleModalAction(evt) {
|
26
|
+
switch (evt) {
|
27
|
+
case this.APLICAR:
|
28
|
+
this.exitPopup();
|
29
|
+
this.accept();
|
30
|
+
break;
|
31
|
+
case this.CANCELAR:
|
32
|
+
this.exitPopup();
|
33
|
+
this.cancel();
|
34
|
+
break;
|
35
|
+
case this.FECHAR:
|
36
|
+
this.exitPopup();
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
componentWillLoad() {
|
41
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
42
|
+
}
|
43
|
+
render() {
|
44
|
+
return (h("ez-popup", { size: "small", heightMode: "auto", useHeader: false, ref: (ref) => this._ezPopup = ref }, h("ez-modal-container", { modalTitle: this.titleMessage, okButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.yes", undefined), cancelButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.no", undefined), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, h("div", { class: "ez-margin-bottom--large ez-flex ez-flex--column" }, h("label", { class: "ez-text ez-text--large ez-text--primary" }, this.message), h("label", { class: "ez-text ez-text--large ez-text--primary" }, h("br", null), this._application.messagesBuilder.getMessage("snkActionsButton.clientEvent.cancelMessage", undefined))))));
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
48
|
+
export { SnkActionsForm as snk_client_confirm };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
|
2
2
|
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
3
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
3
|
+
import { T as TaskbarElement } from './taskbar-elements-8ff33c26.js';
|
4
4
|
import './DataFetcher-b3d8b2d5.js';
|
5
5
|
import './pesquisa-fetcher-bd6af0e3.js';
|
6
6
|
import { P as PresentationMode } from './index-507e19ec.js';
|
@@ -4,9 +4,9 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
|
|
4
4
|
import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType } from './index-507e19ec.js';
|
5
5
|
import { d as KEY_PORT_EXPORT, W as WEB_CONNECTION, R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-e916ccc3.js';
|
6
6
|
import { D as DataFetcher } from './DataFetcher-b3d8b2d5.js';
|
7
|
-
import { S as SnkDataUnit } from './snk-data-unit-
|
7
|
+
import { S as SnkDataUnit } from './snk-data-unit-79b1583a.js';
|
8
8
|
import './_commonjsHelpers-9943807e.js';
|
9
|
-
import './SnkMessageBuilder-
|
9
|
+
import './SnkMessageBuilder-188a38bb.js';
|
10
10
|
|
11
11
|
class ItemBuilder {
|
12
12
|
constructor(getMessage, selectedNumber) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-cfd4bb13.js';
|
2
2
|
import { Action, ObjectUtils, JSUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
|
-
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-
|
4
|
+
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-188a38bb.js';
|
5
5
|
|
6
6
|
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
7
7
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
export { S as snk_data_unit } from './snk-data-unit-
|
1
|
+
export { S as snk_data_unit } from './snk-data-unit-79b1583a.js';
|
2
2
|
import './index-cfd4bb13.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
4
|
import '@sankhyalabs/ezui/dist/collection/utils';
|
5
|
-
import './SnkMessageBuilder-
|
5
|
+
import './SnkMessageBuilder-188a38bb.js';
|
@@ -5,10 +5,10 @@ import './DataFetcher-b3d8b2d5.js';
|
|
5
5
|
import './pesquisa-fetcher-bd6af0e3.js';
|
6
6
|
import '@sankhyalabs/core';
|
7
7
|
import { P as PresentationMode } from './index-507e19ec.js';
|
8
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
8
|
+
import { T as TaskbarElement } from './taskbar-elements-8ff33c26.js';
|
9
9
|
import { c as VIEW_MODE } from './constants-e916ccc3.js';
|
10
|
-
import { S as SnkGuidesViewer } from './snk-guides-viewer-
|
11
|
-
import { S as SnkMessageBuilder } from './SnkMessageBuilder-
|
10
|
+
import { S as SnkGuidesViewer } from './snk-guides-viewer-59d3a78c.js';
|
11
|
+
import { S as SnkMessageBuilder } from './SnkMessageBuilder-188a38bb.js';
|
12
12
|
import './ConfigStorage-e6c17998.js';
|
13
13
|
import './form-config-fetcher-cac8cd96.js';
|
14
14
|
import './resource-fetcher-02642924.js';
|
@@ -16,7 +16,7 @@ import './filter-bar-config-fetcher-edc48f4b.js';
|
|
16
16
|
import './filter-item-type.enum-5028ed3f.js';
|
17
17
|
import './_commonjsHelpers-9943807e.js';
|
18
18
|
import './index-8efbf198.js';
|
19
|
-
import './taskbar-processor-
|
19
|
+
import './taskbar-processor-20de6616.js';
|
20
20
|
|
21
21
|
class GuideBuilder {
|
22
22
|
constructor(parentGuide, formMetadata, dataUnit) {
|
@@ -62,7 +62,7 @@ const SnkFilterBinarySelect = class {
|
|
62
62
|
}
|
63
63
|
const [optOne, optTwo] = this.config.props.options;
|
64
64
|
if (this.presentationMode === EPresentationMode.MODAL) {
|
65
|
-
return (h(Host, null, h("div", { class: "ez-
|
65
|
+
return (h(Host, null, h("div", { class: "ez-row ez-size-height--full" }, h("label", { class: "ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4" }, this.config.detailModal), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkOne = ref, id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: this.isSelected(optOne.name), compact: true })), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkTwo = ref, id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: this.isSelected(optTwo.name), compact: true })))));
|
66
66
|
}
|
67
67
|
return (h(Host, null, h("ez-radio-button", { value: this._radioButtonValue }, h("ez-radio-button-option", { id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: optOne.name }), h("ez-radio-button-option", { id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: optTwo.name }), h("ez-radio-button-option", { id: `${this.config.id}_option3`, class: "sc-snk-filter-bar editor__ez-check", label: `${optOne.label} + ${optTwo.label}`, value: this._noOptionValue }))));
|
68
68
|
}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
|
2
2
|
import { ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
3
3
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
4
|
+
import { T as TaskbarElement } from './taskbar-elements-8ff33c26.js';
|
5
5
|
import { C as ConfigStorage } from './ConfigStorage-e6c17998.js';
|
6
6
|
import { P as PresentationMode } from './index-507e19ec.js';
|
7
|
-
import { T as TaskbarProcessor } from './taskbar-processor-
|
7
|
+
import { T as TaskbarProcessor } from './taskbar-processor-20de6616.js';
|
8
8
|
import { s as store } from './index-8efbf198.js';
|
9
9
|
import './form-config-fetcher-cac8cd96.js';
|
10
10
|
import './DataFetcher-b3d8b2d5.js';
|
@@ -27,8 +27,8 @@ const SnkGrid = class {
|
|
27
27
|
"snkGridTopTaskbar.finish_edition.secondary": []
|
28
28
|
});
|
29
29
|
this._headerTaskbarProcessor = new TaskbarProcessor({
|
30
|
-
"snkGridHeaderTaskbar.unselected": ["REFRESH", "DATA_EXPORTER"],
|
31
|
-
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "REFRESH", "DATA_EXPORTER"],
|
30
|
+
"snkGridHeaderTaskbar.unselected": ["REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
31
|
+
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
32
32
|
"snkGridHeaderTaskbar.detail.unselected": ["REFRESH"],
|
33
33
|
"snkGridHeaderTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
|
34
34
|
});
|
@@ -2,8 +2,8 @@ import { r as registerInstance, c as createEvent, h, F as Fragment } from './ind
|
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager-e60367a0.js';
|
4
4
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
5
|
-
import { T as TaskbarProcessor } from './taskbar-processor-
|
6
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
5
|
+
import { T as TaskbarProcessor } from './taskbar-processor-20de6616.js';
|
6
|
+
import { T as TaskbarElement } from './taskbar-elements-8ff33c26.js';
|
7
7
|
import { c as VIEW_MODE } from './constants-e916ccc3.js';
|
8
8
|
import './DataFetcher-b3d8b2d5.js';
|
9
9
|
import './pesquisa-fetcher-bd6af0e3.js';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-59d3a78c.js';
|
2
2
|
import './index-cfd4bb13.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
4
|
import './SnkFormConfigManager-e60367a0.js';
|
@@ -10,8 +10,8 @@ import './resource-fetcher-02642924.js';
|
|
10
10
|
import './filter-bar-config-fetcher-edc48f4b.js';
|
11
11
|
import './filter-item-type.enum-5028ed3f.js';
|
12
12
|
import '@sankhyalabs/ezui/dist/collection/utils/form';
|
13
|
-
import './taskbar-processor-
|
14
|
-
import './taskbar-elements-
|
13
|
+
import './taskbar-processor-20de6616.js';
|
14
|
+
import './taskbar-elements-8ff33c26.js';
|
15
15
|
import './index-507e19ec.js';
|
16
16
|
import './index-8efbf198.js';
|
17
17
|
import './constants-e916ccc3.js';
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
|
2
2
|
import { ElementIDUtils, ApplicationContext, DataUnit, StringUtils, SortMode, DataType, ChangeOperation, ObjectUtils, UserInterface } from '@sankhyalabs/core';
|
3
3
|
import { c as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-e916ccc3.js';
|
4
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
4
|
+
import { T as TaskbarElement } from './taskbar-elements-8ff33c26.js';
|
5
5
|
import './DataFetcher-b3d8b2d5.js';
|
6
6
|
import './pesquisa-fetcher-bd6af0e3.js';
|
7
7
|
import { P as PresentationMode } from './index-507e19ec.js';
|
8
|
-
import { T as TaskbarProcessor } from './taskbar-processor-
|
8
|
+
import { T as TaskbarProcessor } from './taskbar-processor-20de6616.js';
|
9
9
|
import './index-8efbf198.js';
|
10
10
|
import './_commonjsHelpers-9943807e.js';
|
11
11
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
|
2
2
|
import { StringUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
|
4
|
-
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-
|
4
|
+
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-8ff33c26.js';
|
5
5
|
import { P as PresentationMode } from './index-507e19ec.js';
|
6
6
|
import './index-8efbf198.js';
|
7
7
|
|
@@ -20,6 +20,7 @@ var TaskbarElement;
|
|
20
20
|
TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
|
21
21
|
TaskbarElement["DATA_EXPORTER"] = "DATA_EXPORTER";
|
22
22
|
TaskbarElement["ATTACH"] = "ATTACH";
|
23
|
+
TaskbarElement["ACTIONS_BUTTON"] = "ACTIONS_BUTTON";
|
23
24
|
})(TaskbarElement || (TaskbarElement = {}));
|
24
25
|
var AuthorizationElements;
|
25
26
|
(function (AuthorizationElements) {
|
@@ -94,6 +95,8 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
|
|
94
95
|
return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId });
|
95
96
|
case TaskbarElement.ATTACH:
|
96
97
|
return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
|
98
|
+
case TaskbarElement.ACTIONS_BUTTON:
|
99
|
+
return h("snk-actions-button", { "data-element-id": dataElementId });
|
97
100
|
}
|
98
101
|
};
|
99
102
|
function textButton(name, className, dataElementId, text, title, action, isEnabled) {
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as i,h as s,g as e,H as n}from"./p-b9667fbe.js";import{Action as a,ObjectUtils as o,JSUtils as h,ApplicationContext as r,DataType as l}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as c}from"@sankhyalabs/ezui/dist/collection/utils";import{O as v,S as u}from"./p-
|
1
|
+
import{r as t,c as i,h as s,g as e,H as n}from"./p-b9667fbe.js";import{Action as a,ObjectUtils as o,JSUtils as h,ApplicationContext as r,DataType as l}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as c}from"@sankhyalabs/ezui/dist/collection/utils";import{O as v,S as u}from"./p-b34d23fa.js";const f=class{constructor(s){t(this,s),this.dataStateChange=i(this,"dataStateChange",3),this.dataUnitReady=i(this,"dataUnitReady",3),this.messagesBuilderUpdated=i(this,"messagesBuilderUpdated",3),this.insertionMode=i(this,"insertionMode",3),this.cancelEdition=i(this,"cancelEdition",3),this._onDataUnitResolve=[],this._openedAlert=!1,this._dataUnitObserver=t=>{var i,s;const e=this.buildDataState();if(this.dataState=e,t.type===a.DATA_SAVED){const i=this.getMessage("snkDataUnit.saveInfo",t.payload.records[0]);null!=i&&this.showSuccessMessage(i)}if(t.type!==a.RECORDS_ADDED&&t.type!==a.RECORDS_COPIED||this.insertionMode.emit(),t.type===a.EDITION_CANCELED&&this.cancelEdition.emit(),t.type===a.RECORDS_REMOVED){const e=t.payload.cachedRecords;let n;n=(null==e?void 0:e.length)>1?this.getMessage("snkDataUnit.removeAllInfo",{size:e.length}):this.getMessage("snkDataUnit.removeInfo",t.payload.cachedRecords[0]),null!=n&&this.showSuccessMessage(n);const a=null!==(s=null===(i=this.dataUnit.records)||void 0===i?void 0:i.length)&&void 0!==s?s:0,o=this.dataUnit.getPaginationInfo();o&&this.dataUnit.gotoPage(a>0||o.hasMore?o.currentPage:0)}this.messagesBuilder.currentOperation=this.getMessageOperation()},this.dataState=void 0,this.messagesBuilder=void 0,this.dataUnitName=void 0,this.entityName=void 0,this.pageSize=150,this.dataUnit=void 0,this.beforeSave=void 0,this.afterSave=void 0,this.useCancelConfirm=!0}observePageSize(){this.dataUnit&&(this.dataUnit.pageSize=this.pageSize)}observeDataUnitName(t,i){i!=t&&(this.dataUnit?this._application.updateDataunitCache(i,this.dataUnitName,this.dataUnit):this.loadDataUnit())}observeEntityName(t,i){i!=t&&(this.dataUnit=void 0,this.entityName=t,this.loadDataUnit())}observeDataState(t,i){o.objectToString(i)!=o.objectToString(t)&&this.dataStateChange.emit(t)}observeDataUnit(){this.handlerLinkFields(),this.dataUnitReady.emit(this.dataUnit)}observeMessagesBuilder(t){t&&this.messagesBuilderUpdated.emit(t)}async getDataUnit(){return new Promise((t=>{this.dataUnit?t(this.dataUnit):this._onDataUnitResolve.push(t)}))}async getSelectedRecordsIDsInfo(){var t;const i=null===(t=this.dataUnit)||void 0===t?void 0:t.getSelectionInfo();if(null==i?void 0:i.isAllRecords())return[];const s=[],e=null==i?void 0:i.records;return(null==e?void 0:e.length)>0&&e.forEach((({__record__id__:t})=>{if(!this.dataUnit.isNewRecord(t)){if(!h.isBase64(t))return void s.push({name:"__record__id__",type:l.TEXT,value:t});const i=JSON.parse(window.atob(t));Object.entries(i).forEach((([t,i])=>{var e;const n=null===(e=this.dataUnit)||void 0===e?void 0:e.getField(t);null!=n&&s.push(Object.assign({name:t,type:n.dataType},i))}))}})),s}async interceptAction(t){return new Promise((i=>{var s,e;switch(t.type){case a.RECORDS_ADDED:this.isAllowed("INSERT")?i(t):d.info(this.getMessage("snkDataUnit.forbiddenInsert"));break;case a.RECORDS_COPIED:this.isAllowed("CLONE")?i(t):d.info(this.getMessage("snkDataUnit.forbiddenClone"));break;case a.DATA_CHANGED:case a.CHANGING_DATA:if(this.isAllowed("UPDATE"))return i(t);if(this._openedAlert)return this.dataUnit.cancelEdition();this._openedAlert=!0,this.dataUnit.cancelEdition(),d.alert(this.getMessage("snkDataUnit.forbidden"),this.getMessage("snkDataUnit.forbiddenUpdate")).then((()=>{this._openedAlert=!1}));break;case a.SAVING_DATA:if(this.beforeSave){const s=this.beforeSave(this.dataUnit);s instanceof Promise?s.then((s=>i(s?t:void 0))):i(s?t:void 0)}else i(t);break;case a.DATA_SAVED:this.afterSave?this.afterSave(this.dataUnit):i(t);break;case a.EDITION_CANCELED:if(!this.useCancelConfirm)return i(t);if(this.dataState.hasDirtyRecords){const e=this.getMessage("snkDataUnit.cancelConfirmation");if(null===(s=t.payload)||void 0===s?void 0:s.fromParent)return void i(t);if(null==e)this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo")),i(t);else{const s=this.getMessage("snkDataUnit.cancelConfirmationTitle");d.confirm(s,e).then((s=>{s&&this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo")),i(s?t:void 0)}))}}else i(t);break;case a.REMOVING_RECORDS:if(this.isAllowed("REMOVE")){let s=!1,n=this.getMessage("snkDataUnit.removeConfirmation");const a=null===(e=this.dataUnit)||void 0===e?void 0:e.getSelectionInfo();if((null==a?void 0:a.length)>1&&(n=this.getMessage("snkDataUnit.removeAllConfirmation",{size:a.length}),s=!0),null==n)i(t);else{const e={canClose:!1,labelCancel:this.getMessage("snkDataUnit.confirm."+(s?"no":"cancel")),labelConfirm:this.getMessage("snkDataUnit.confirm."+(s?"yes":"delete")),btnConfirmDanger:!1},a=this.getMessage("snkDataUnit.removeConfirmationTitle");d.confirm(a,n,null,c.WARN,e).then((s=>i(s?t:void 0)))}}else d.info(this.getMessage("snkDataUnit.forbiddenRemove"));break;default:i(t)}}))}showSuccessMessage(t){d.info(t,{iconName:"check"})}isAllowed(t){return!!this._permissions&&(this._permissions.isSup||this._permissions[t])}buildDataState(){const t=this.dataUnit.getSelectionInfo(),i=(this.dataUnit.hasDirtyRecords()||this.dataUnit.hasWaitingChanges())&&(null==t?void 0:t.isEmpty());return new m({insertionMode:this.dataUnit.hasNewRecord(),isStartingInsertionMode:i,hasNext:this.dataUnit.hasNext(),hasPrevious:this.dataUnit.hasPrevious(),copyMode:this.dataUnit.hasCopiedRecord(),isDirty:this.dataUnit.isDirty(),hasDirtyRecords:this.dataUnit.hasDirtyRecords(),selectedRecords:void 0,selectionInfo:t,selectedRecord:this.dataUnit.getSelectedRecord()})}getMessage(t,i){return i||(i=this.getMessageParams()),this.messagesBuilder.getMessage(t,i)}getMessageParams(){return this.dataState.selectedRecord}getMessageOperation(){return this.dataState.copyMode?v.CLONE:this.dataState.insertionMode||this.dataState.isStartingInsertionMode?v.INSERT:this.dataState.isDirty?v.UPDATE:v.CLEAN}async getDataUnitParentOrChild(){var t;const i=this.dataUnitName?this.dataUnitName:this.entityName;return this._parentSnkDataUnit?(this._parentDataUnit=await(null===(t=this._parentSnkDataUnit)||void 0===t?void 0:t.getDataUnit()),await this._application.getDataUnit(this.entityName,i,this._parentDataUnit)):await this._application.getDataUnit(this.entityName,i)}async loadDataUnit(){if(null==this.dataUnit&&this._application&&this.entityName&&(this.dataUnit=await this.getDataUnitParentOrChild()),this.dataUnit){let t;for(this.dataUnit.pageSize=this.pageSize,this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this._dataUnitObserver),this.dataState=this.buildDataState();t=this._onDataUnitResolve.pop();)t(this.dataUnit)}}getParentSnkDataUnit(){let t=this.element;for(;t.parentNode;){if("SNK-DATA-UNIT"===t.parentNode.nodeName)return t.parentNode;t=t.parentNode}}handlerLinkFields(){var t,i;const s=Object.assign({},this.dataUnit.metadata);if(!this._parentDataUnit)return;const e=this._parentDataUnit.getChildInfo(this.entityName);if(!e)return;const n=null===(t=null==e?void 0:e.links)||void 0===t?void 0:t.map((t=>t.target));null===(i=null==s?void 0:s.fields)||void 0===i||i.forEach((t=>{(null==n?void 0:n.includes(t.name))&&(t.visible=!1)})),this.dataUnit.metadata=s}static getNearestInstance(t){let i=t.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase())return i;i=i.parentElement}}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__"),this._application.getAllAccess().then((t=>this._permissions=t)),this._parentSnkDataUnit=this.getParentSnkDataUnit(),null==this.messagesBuilder&&(this.messagesBuilder=new u(this.entityName))}disconnectedCallback(){this.dataUnit&&(this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.removeInterceptor(this))}componentDidLoad(){this.loadDataUnit()}render(){return s(n,null)}get element(){return e(this)}static get watchers(){return{pageSize:["observePageSize"],dataUnitName:["observeDataUnitName"],entityName:["observeEntityName"],dataState:["observeDataState"],dataUnit:["observeDataUnit"],messagesBuilder:["observeMessagesBuilder"]}}};class m{constructor(t){this.copyMode=t.copyMode,this.insertionMode=t.insertionMode,this.isStartingInsertionMode=t.isStartingInsertionMode,this.isDirty=t.isDirty,this.hasDirtyRecords=t.hasDirtyRecords,this.hasNext=t.hasNext,this.hasPrevious=t.hasPrevious,this.selectionInfo=t.selectionInfo,this.selectedRecord=t.selectedRecord}get selectedRecords(){var t;if(console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`."),null===(t=this.selectionInfo)||void 0===t?void 0:t.isAllRecords())throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");return this.selectionInfo.records}}f.style=".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%;width:100%}";export{f as S}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as s,h as i,g as e}from"./p-b9667fbe.js";import{ElementIDUtils as r,ApplicationContext as a,DataUnit as n,StringUtils as o,SortMode as h,DataType as l,ChangeOperation as d,ObjectUtils as m,UserInterface as c}from"@sankhyalabs/core";import{c as u,S as p}from"./p-17375123.js";import{T as b}from"./p-
|
1
|
+
import{r as t,c as s,h as i,g as e}from"./p-b9667fbe.js";import{ElementIDUtils as r,ApplicationContext as a,DataUnit as n,StringUtils as o,SortMode as h,DataType as l,ChangeOperation as d,ObjectUtils as m,UserInterface as c}from"@sankhyalabs/core";import{c as u,S as p}from"./p-17375123.js";import{T as b}from"./p-19692f92.js";import"./p-41d92871.js";import"./p-11028eba.js";import{P as g}from"./p-4c2015a9.js";import{T as k}from"./p-384c4a6b.js";import"./p-6a02e236.js";import"./p-112455b1.js";const f=class{constructor(i){t(this,i),this.clickBreadcrumbItem=s(this,"clickBreadcrumbItem",3),this.exit=s(this,"exit",3),this.label=void 0,this.breadcrumbItens=void 0,this.messagesBuilder=void 0}getMessage(t,s){var i;return this.messagesBuilder?this.messagesBuilder.getMessage(t,s):(null===(i=this._application)||void 0===i?void 0:i.messagesBuilder)?this._application.messagesBuilder.getMessage(t,s):void 0}componentDidLoad(){this._element&&(r.addIDInfo(this._element),this._application=a.getContextValue("__SNK__APPLICATION__"))}render(){return i("div",{class:"simple-bar__container ez-margin-vertical--medium ez-padding--extra-small"},i("div",{class:"simple-bar__left-slot"},i("ez-button",{class:"ez-padding-right--medium",title:this.getMessage("snkSimpleBar.backTitle"),mode:"icon",iconName:"arrow_back",size:"medium",onClick:()=>this.exit.emit()}),i("div",{class:"simple-bar__column"},i("h1",{class:"ez-title ez-title--primary ez-title--extra-large"},this.label),i("ez-breadcrumb",{items:this.breadcrumbItens,onSelectedItem:({detail:t})=>this.clickBreadcrumbItem.emit(t)}))),i("div",{class:"simple-bar__right-slot"},i("slot",{name:"rightSlot"})))}get _element(){return e(this)}};f.style=".sc-snk-simple-bar-h{display:flex;height:100%;width:100%}.simple-bar__container.sc-snk-simple-bar{flex:1;display:flex;align-items:stretch;gap:var(--space--small)}.simple-bar__left-slot.sc-snk-simple-bar{min-width:280px;flex:1;display:flex;align-items:center}.simple-bar__right-slot.sc-snk-simple-bar{flex:1;display:flex;align-items:center;justify-content:flex-end}.simple-bar__column.sc-snk-simple-bar{flex:1;display:flex;flex-direction:column}";class v{constructor(t,s){this.records=s||[],this.metadata=t,this._dataUnit=new n("InMemoryDataUnit"),this._dataUnit.metadataLoader=()=>this.metadaLoader(),this._dataUnit.dataLoader=(t,s)=>this.dataLoader(t,s),this._dataUnit.saveLoader=(t,s)=>this.saveLoader(t,s),this._dataUnit.removeLoader=(t,s)=>this.removeLoader(t,s),this.dataUnit.loadMetadata().then((()=>this.dataUnit.loadData()))}get dataUnit(){return this._dataUnit}get records(){return this._records}set records(t){this._records=null==t?void 0:t.map((t=>(t.__record__id__||(t.__record__id__=this.generateUniqueId()),t))),this._dataUnit&&(this._dataUnit.records=[...this._records])}get metadata(){return this._metadata}set metadata(t){this._metadata=t,this._dataUnit&&(this._dataUnit.metadata=this._metadata)}generateUniqueId(){return o.generateUUID()}metadaLoader(){return Promise.resolve(this._metadata)}dataLoader(t,s){let i=[...this._records];return s.sort&&s.sort.forEach((t=>{i=i.sort(((s,i)=>{const e=s[t.field],r=i[t.field];return this.getSortFn(t.dataType)(e,r)*(t.mode==h.ASC?1:-1)}))})),Promise.resolve({records:i})}getSortFn(t){switch(t){case l.NUMBER:return this.sortNumber;case l.DATE:return this.sortDate;case l.OBJECT:return this.sortObject;default:return o.compare}}sortObject(t,s){return o.compare(t.label,s.label)}sortNumber(t,s){return t-s}sortDate(t,s){let i=t.getTime(),e=s.getTime();return i===e?0:i<e?-1:1}saveLoader(t,s){return new Promise((t=>{let i=[];s.forEach((t=>{let{record:s,updatingFields:e,operation:r}=t,a=!1;r!==d.INSERT&&r!==d.COPY||(s.__old__id__=s.__record__id__,s.__record__id__=this.generateUniqueId(),a=!0);const n=Object.assign(Object.assign({},s),e);if(a)this.records.push(n);else{const t=this.records.findIndex((t=>t.__record__id__==n.__record__id__));this.records[t]=n}i.push(n)})),t(i)}))}removeLoader(t,s){return new Promise((t=>{this._records=this._records.filter((t=>!s.includes(t.__record__id__))),t(s)}))}}const _=class{constructor(i){t(this,i),this.dataStateChange=s(this,"dataStateChange",3),this.dataUnitReady=s(this,"dataUnitReady",3),this.actionClick=s(this,"actionClick",7),this.REGULAR_DEFAULT_BTNS=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER"],this.REGULAR_SELECTED_BTNS=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","DIVIDER"],this._taskbarProcessor=new k({"snkSimpleCrudTaskbar.form_regular":this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(b.GRID_MODE),"snkSimpleCrudTaskbar.grid_regular":this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(b.FORM_MODE),"snkSimpleCrudTaskbar.form_selected":this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(b.GRID_MODE),"snkSimpleCrudTaskbar.grid_selected":this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(b.FORM_MODE),"snkSimpleCrudTaskbar.finish_edition":["CANCEL","SAVE"]}),this._currentViewMode=u.GRID,this._config=void 0,this.dataState=void 0,this.dataUnit=void 0,this.mode=p.SERVER,this.gridConfig=void 0,this.formConfig=void 0,this.useCancelConfirm=!0,this.taskbarManager=void 0,this.messagesBuilder=void 0}resolveInMemoryBtns(t){const s=[...t];return this.mode===p.IN_MEMORY&&s.splice(1,1),s}async goToView(t){this._currentViewMode=t,this._viewStack&&this._viewStack.show(t)}actionClickListener(t){const s=t.detail;s===b.GRID_MODE?this.goToView(u.GRID):s===b.FORM_MODE&&this.goToView(u.FORM),t.stopPropagation()}onModeChange(){this.mode==p.IN_MEMORY&&this.initInMemoryDataUnit()}observeDataState(t,s){m.objectToString(s)!=m.objectToString(t)&&this.dataStateChange.emit(t)}componentWillRender(){this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.getTaskBarDisabledButtons())}componentWillLoad(){this.processMetadata(),this.onModeChange()}getTaskBarId(){var t,s,i;return(null===(t=this.dataState)||void 0===t?void 0:t.isDirty)?"snkSimpleCrudTaskbar.finish_edition":(null===(s=this.dataState)||void 0===s?void 0:s.selectionInfo)&&!this.dataState.selectionInfo.isAllRecords()&&(null===(i=this.dataState.selectionInfo.records)||void 0===i?void 0:i.length)>0?this._currentViewMode===u.GRID?"snkSimpleCrudTaskbar.grid_selected":"snkSimpleCrudTaskbar.form_selected":this._currentViewMode===u.GRID?"snkSimpleCrudTaskbar.grid_regular":"snkSimpleCrudTaskbar.form_regular"}initInMemoryDataUnit(){this._inMemoryLoader=new v(this._metadata),this.dataUnit=this._inMemoryLoader.dataUnit,this.dataUnitReady.emit(this.dataUnit)}setMetadata(t){return this._inMemoryLoader?this._inMemoryLoader.metadata=t:this.dataUnit&&(this.dataUnit.metadata=t),Promise.resolve()}setRecords(t){return this._inMemoryLoader?this._inMemoryLoader.records=t:this.dataUnit&&(this.dataUnit.records=t),Promise.resolve()}getRecords(){return Promise.resolve(this.dataUnit.records)}processMetadata(){const t=this._element.querySelectorAll("snk-field-metadata"),s=[],i={fields:[],emptyConfig:!1};t.forEach((t=>{const e={name:t.getAttribute("name")||t.getAttribute("label"),label:t.getAttribute("label"),dataType:l[t.getAttribute("dataType")]||l.TEXT,userInterface:c[t.getAttribute("userInterface")]||c.SHORTTEXT,readOnly:"true"==t.getAttribute("readOnly"),required:"true"==t.getAttribute("required"),tab:t.getAttribute("tab")||void 0,visible:"false"!=t.getAttribute("visible")};i.fields.push({name:e.name,tab:e.tab,visible:e.visible}),s.push(e)})),s.length>0&&(this.formConfig||(this.formConfig=i),this._metadata={name:"SimpleCrud",label:"SimpleCrud",fields:s})}onDataStateChange(t){this.dataState=Object.assign({},t.detail)}getTaskBarDisabledButtons(){var t,s;const i=[];return(null===(t=this.dataState)||void 0===t?void 0:t.hasNext)||i.push(b.NEXT),(null===(s=this.dataState)||void 0===s?void 0:s.hasPrevious)||i.push(b.PREVIOUS),i}render(){var t;return i("snk-data-unit",{class:"simple-crud__container",dataUnit:this.dataUnit,useCancelConfirm:this.useCancelConfirm,onDataStateChange:t=>this.onDataStateChange(t),onInsertionMode:()=>this.goToView(u.FORM),onDataUnitReady:t=>this.dataUnitReady.emit(t.detail),onMessagesBuilderUpdated:t=>this.messagesBuilder=t.detail},i("header",null,i("slot",{name:"snkSimpleCrudHeader"})),i("section",{class:"ez-flex ez-box ez-box--shadow"},i("snk-taskbar",{class:"simple-crud__taskbar ez-box ez-box--shadow ez-padding--medium",dataUnit:this.dataUnit,primaryButton:(null===(t=this.dataState)||void 0===t?void 0:t.isDirty)?"SAVE":"INSERT","data-element-id":"grid_left",messagesBuilder:this.messagesBuilder,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,slot:"leftButtons",presentationMode:g.SECONDARY}),i("ez-view-stack",{class:"ez-flex ez-flex--column",ref:t=>this._viewStack=t,"data-element-id":"simple-crud"},i("stack-item",null,i("ez-grid",{dataUnit:this.dataUnit,onEzDoubleClick:()=>this.goToView(u.FORM),config:this.gridConfig,"no-header":!0},i("div",{slot:"footer"},i("slot",{name:"snkSimpleCrudFooter"})))),i("stack-item",null,i("ez-form",{dataUnit:this.dataUnit,config:this.formConfig})))))}get _element(){return e(this)}static get watchers(){return{mode:["onModeChange"],dataState:["observeDataState"]}}};_.style=".sc-snk-simple-crud-h{display:flex;height:100%;width:100%}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto;row-gap:12px;height:100%;width:100%}.simple-crud__taskbar.sc-snk-simple-crud{z-index:var(--more-visible, 2);margin-bottom:var(--space--medium)}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;min-height:300px}ez-form.sc-snk-simple-crud{min-height:300px}";export{f as snk_simple_bar,_ as snk_simple_crud}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{h as e}from"./p-b9667fbe.js";import{P as t}from"./p-4c2015a9.js";import{s as n}from"./p-6a02e236.js";var a,r,s;!function(e){e.PREVIOUS="PREVIOUS",e.NEXT="NEXT",e.REFRESH="REFRESH",e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CANCEL="CANCEL",e.SAVE="SAVE",e.GRID_MODE="GRID_MODE",e.FORM_MODE="FORM_MODE",e.MORE_OPTIONS="MORE_OPTIONS",e.DIVIDER="DIVIDER",e.CONFIGURATOR="CONFIGURATOR",e.DATA_EXPORTER="DATA_EXPORTER",e.ATTACH="ATTACH",e.ACTIONS_BUTTON="ACTIONS_BUTTON"}(a||(a={})),function(e){e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CONFIGURATOR="CONFIGURATOR"}(r||(r={})),function(e){e.CONFIGURATOR="CONFIGURATOR"}(s||(s={}));const i=(e,t,n,a,r)=>{const{hint:s,text:i,iconName:c}=e;return c?i?u(c,e.name,t,n,s,i,a,r):l(c,e.name,t,n,s,a,r):o(e.name,t,n,i,s,a,r)},c=(r,s,i,c,d,m,E,O,R)=>{var v;const T=c(r);switch(r){case a.PREVIOUS:return l("chevron-left",r,s,i,T,d,m);case a.NEXT:return l("chevron-right",r,s,i,T,d,m);case a.REFRESH:return l("sync",r,s,i,T,d,m);case a.UPDATE:return l("edit",r,s,i,T,d,m);case a.CLONE:return l("copy",r,s,i,T,d,m);case a.REMOVE:return l("delete",r,s,i,T,d,m);case a.INSERT:return R===t.PRIMARY?u("plus",r,s,i,T,T,d,m):l("plus",r,s,i,T,d,m);case a.CANCEL:return o(r,s,i,T,T,d,m);case a.SAVE:return R===t.PRIMARY?u("save",r,s,i,T,T,d,m):l("save",r,s,i,T,d,m);case a.GRID_MODE:return l("table",r,s,i,T,d,m);case a.FORM_MODE:return l("list",r,s,i,T,d,m);case a.CONFIGURATOR:return l("settings-inverted",r,s,i,T,d,m);case a.MORE_OPTIONS:return function(t,n,a,r,s,i,c){return c&&c.length>0?e("ez-actions-button",{title:r,size:"small","data-element-id":a,arrowActive:!0,class:n,enabled:i(t),onEzAction:e=>s(e.detail.value),actions:c}):void 0}(r,s,i,T,d,m,E);case a.DIVIDER:return e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium","data-taskbar-divider":!0});case a.DATA_EXPORTER:const c=null===(v=n.get("exporterProviders"))||void 0===v?void 0:v[O];return e("snk-data-exporter",{class:s,provider:c,"data-element-id":i});case a.ATTACH:return l("anexo",r,s,i,T,d,m);case a.ACTIONS_BUTTON:return e("snk-actions-button",{"data-element-id":i})}};function o(t,n,a,r,s,i,c){return e("ez-button",{title:s,label:r,size:"small",class:n,"data-element-id":a,enabled:c(t),onClick:()=>i(t)})}function l(t,n,a,r,s,i,c){return e("ez-button",{title:s,mode:"icon",size:"small",class:a,"data-element-id":r,iconName:t,enabled:c(n),onClick:()=>i(n)})}function u(t,n,a,r,s,i,c,o){return e("ez-button",{title:i,label:s,size:"small",class:a,"data-element-id":r,enabled:o(n),onClick:()=>c(n)},e("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:t}))}export{r as A,a as T,s as V,i as a,c as b}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as s,h as i,H as e,g as a}from"./p-b9667fbe.js";import{StringUtils as r,ApplicationContext as h,ElementIDUtils as n}from"@sankhyalabs/core";import{A as o}from"./p-dc36cfbf.js";import{T as l,V as k,A as d,b,a as c}from"./p-
|
1
|
+
import{r as t,c as s,h as i,H as e,g as a}from"./p-b9667fbe.js";import{StringUtils as r,ApplicationContext as h,ElementIDUtils as n}from"@sankhyalabs/core";import{A as o}from"./p-dc36cfbf.js";import{T as l,V as k,A as d,b,a as c}from"./p-19692f92.js";import{P as m}from"./p-4c2015a9.js";import"./p-6a02e236.js";const u=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this._titleKeyByElement={[l.UPDATE]:"snkTaskbar.titleUpdate",[l.PREVIOUS]:"snkTaskbar.titlePrevious",[l.NEXT]:"snkTaskbar.titleNext",[l.REFRESH]:"snkTaskbar.titleRefresh",[l.CLONE]:"snkTaskbar.titleClone",[l.REMOVE]:"snkTaskbar.titleRemove",[l.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[l.INSERT]:"snkTaskbar.titleInsert",[l.CANCEL]:"snkTaskbar.titleCancel",[l.SAVE]:"snkTaskbar.titleSave",[l.GRID_MODE]:"snkTaskbar.titleGridMode",[l.FORM_MODE]:"snkTaskbar.titleFormMode",[l.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[l.ATTACH]:"snkTaskbar.titleAttach"},this._permissions=void 0,this.configName=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=m.PRIMARY,this.messagesBuilder=void 0}observeButtons(){this._definitions=void 0}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(k[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===d.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[o.CONFIG_GRID]||this._permissions[o.CONFIG]):!d[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case l.PREVIOUS:this.dataUnit.previousRecord();break;case l.NEXT:this.dataUnit.nextRecord();break;case l.REFRESH:this.dataUnit.loadData();break;case l.CLONE:this.dataUnit.copySelected();break;case l.REMOVE:this.dataUnit.removeSelectedRecords();break;case l.INSERT:this.dataUnit.addRecord();break;case l.CANCEL:this.dataUnit.cancelEdition();break;case l.SAVE:this.dataUnit.saveData()}this.isEnabled(t)&&this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(m).includes(this.presentationMode)||(this.presentationMode=m.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";return t>1&&(i+="ez-padding-left--medium"),l[s.toString()]?b(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.actionsList,this.configName,this.presentationMode):c(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}getIdElemBtnNative(t){return r.toCamelCase(t)}getIdElemBtnCustom(t){return r.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}componentWillLoad(){this._application=h.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess().then((t=>this._permissions=t)):this._permissions={}}componentWillRender(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons)),this.validatePresentationMode()}componentDidLoad(){n.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}render(){if(void 0===this._definitions)return;let t=0;return i(e,null,this.removeEmpty(this._definitions.map((s=>(s===l.DIVIDER?t=0:t++,l[s]?this.getElement(t,l[s]):this.customButtons.has(s)?this.getElement(t,this.customButtons.get(s)):i("slot",{name:s}))))))}get _element(){return a(this)}static get watchers(){return{buttons:["observeButtons"]}}};u.style=".sc-snk-taskbar-h{display:flex}";export{u as snk_taskbar}
|