@sankhyalabs/sankhyablocks 1.3.31-beta.4 → 1.3.31
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/{index-ebe8245e.js → index-1133bc2a.js} +9 -453
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +95 -118
- package/dist/cjs/snk-pesquisa.cjs.entry.js +2 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +0 -4
- package/dist/collection/components/snk-application/snk-application.js +20 -61
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +21 -36
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +3 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -0
- package/dist/components/snk-application2.js +94 -118
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/esm/{index-7565ae23.js → index-ffda6382.js} +10 -453
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +95 -118
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-bb31ea2a.entry.js → p-2a7b4cb3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6d82d7fd.entry.js → p-49fdec1f.entry.js} +1 -1
- package/dist/sankhyablocks/p-9bc9abe0.entry.js +69 -0
- package/dist/sankhyablocks/p-edcb9d8e.js +2 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +5 -6
- package/dist/types/components.d.ts +1 -119
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
- package/package.json +5 -5
- package/react/components.d.ts +0 -4
- package/react/components.js +0 -4
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +0 -174
- package/dist/cjs/snk-form.cjs.entry.js +0 -95
- package/dist/cjs/snk-grid.cjs.entry.js +0 -64
- package/dist/cjs/snk-taskbar.cjs.entry.js +0 -159
- package/dist/cjs/taskbar-elements-589a3744.js +0 -68
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +0 -6
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -429
- package/dist/collection/components/snk-form/snk-form.css +0 -3
- package/dist/collection/components/snk-form/snk-form.js +0 -194
- package/dist/collection/components/snk-grid/snk-grid.css +0 -5
- package/dist/collection/components/snk-grid/snk-grid.js +0 -128
- package/dist/collection/components/snk-taskbar/component/snk-popup-button.js +0 -7
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +0 -63
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +0 -3
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +0 -268
- package/dist/components/snk-data-unit.d.ts +0 -11
- package/dist/components/snk-data-unit.js +0 -198
- package/dist/components/snk-form.d.ts +0 -11
- package/dist/components/snk-form.js +0 -121
- package/dist/components/snk-grid.d.ts +0 -11
- package/dist/components/snk-grid.js +0 -88
- package/dist/components/snk-taskbar.d.ts +0 -11
- package/dist/components/snk-taskbar.js +0 -6
- package/dist/components/snk-taskbar2.js +0 -239
- package/dist/esm/snk-data-unit.entry.js +0 -170
- package/dist/esm/snk-form.entry.js +0 -91
- package/dist/esm/snk-grid.entry.js +0 -60
- package/dist/esm/snk-taskbar.entry.js +0 -155
- package/dist/esm/taskbar-elements-b6822601.js +0 -66
- package/dist/sankhyablocks/p-306224bf.entry.js +0 -1
- package/dist/sankhyablocks/p-4ee1e12b.js +0 -1
- package/dist/sankhyablocks/p-88278b85.entry.js +0 -1
- package/dist/sankhyablocks/p-90b832f7.js +0 -2
- package/dist/sankhyablocks/p-a4b2fa10.entry.js +0 -69
- package/dist/sankhyablocks/p-bb8d8fe7.entry.js +0 -1
- package/dist/sankhyablocks/p-e7ade160.entry.js +0 -1
- package/dist/types/components/snk-taskbar/component/snk-popup-button.d.ts +0 -12
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +0 -24
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -28
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-ebe8245e.js');
|
|
4
|
-
|
|
5
|
-
exports.TaskbarElement = void 0;
|
|
6
|
-
(function (TaskbarElement) {
|
|
7
|
-
TaskbarElement["PREVIOUS"] = "PREVIOUS";
|
|
8
|
-
TaskbarElement["NEXT"] = "NEXT";
|
|
9
|
-
TaskbarElement["REFRESH"] = "REFRESH";
|
|
10
|
-
TaskbarElement["UPDATE"] = "UPDATE";
|
|
11
|
-
TaskbarElement["CLONE"] = "CLONE";
|
|
12
|
-
TaskbarElement["REMOVE"] = "REMOVE";
|
|
13
|
-
TaskbarElement["INSERT"] = "INSERT";
|
|
14
|
-
TaskbarElement["CANCEL"] = "CANCEL";
|
|
15
|
-
TaskbarElement["SAVE"] = "SAVE";
|
|
16
|
-
TaskbarElement["GRID_MODE"] = "GRID_MODE";
|
|
17
|
-
TaskbarElement["FORM_MODE"] = "FORM_MODE";
|
|
18
|
-
TaskbarElement["CONFIG_GRID"] = "CONFIG_GRID";
|
|
19
|
-
TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
|
|
20
|
-
TaskbarElement["DIVIDER"] = "DIVIDER";
|
|
21
|
-
})(exports.TaskbarElement || (exports.TaskbarElement = {}));
|
|
22
|
-
exports.AuthorizationElements = void 0;
|
|
23
|
-
(function (AuthorizationElements) {
|
|
24
|
-
AuthorizationElements["UPDATE"] = "UPDATE";
|
|
25
|
-
AuthorizationElements["CLONE"] = "CLONE";
|
|
26
|
-
AuthorizationElements["REMOVE"] = "REMOVE";
|
|
27
|
-
AuthorizationElements["INSERT"] = "INSERT";
|
|
28
|
-
AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
|
|
29
|
-
})(exports.AuthorizationElements || (exports.AuthorizationElements = {}));
|
|
30
|
-
const buildElem = (element, className, getTitle, action, isEnabled) => {
|
|
31
|
-
switch (element) {
|
|
32
|
-
case exports.TaskbarElement.PREVIOUS:
|
|
33
|
-
return iconButton("chevron-left", element, className, getTitle, action, isEnabled);
|
|
34
|
-
case exports.TaskbarElement.NEXT:
|
|
35
|
-
return iconButton("chevron-right", element, className, getTitle, action, isEnabled);
|
|
36
|
-
case exports.TaskbarElement.REFRESH:
|
|
37
|
-
return iconButton("sync", element, className, getTitle, action, isEnabled);
|
|
38
|
-
case exports.TaskbarElement.UPDATE:
|
|
39
|
-
return iconButton("edit", element, className, getTitle, action, isEnabled);
|
|
40
|
-
case exports.TaskbarElement.CLONE:
|
|
41
|
-
return iconButton("copy", element, className, getTitle, action, isEnabled);
|
|
42
|
-
case exports.TaskbarElement.REMOVE:
|
|
43
|
-
return iconButton("delete", element, className, getTitle, action, isEnabled);
|
|
44
|
-
case exports.TaskbarElement.INSERT:
|
|
45
|
-
return iconTextButton("plus", element, className, getTitle, action, isEnabled);
|
|
46
|
-
case exports.TaskbarElement.CANCEL:
|
|
47
|
-
return index.h("ez-button", { label: getTitle(element), size: "small", enabled: isEnabled(element), onClick: () => action(element) });
|
|
48
|
-
case exports.TaskbarElement.SAVE:
|
|
49
|
-
return iconTextButton("save", element, className, getTitle, action, isEnabled);
|
|
50
|
-
case exports.TaskbarElement.GRID_MODE:
|
|
51
|
-
return iconButton("table", element, className, getTitle, action, isEnabled);
|
|
52
|
-
case exports.TaskbarElement.FORM_MODE:
|
|
53
|
-
return iconButton("list", element, className, getTitle, action, isEnabled);
|
|
54
|
-
case exports.TaskbarElement.CONFIG_GRID:
|
|
55
|
-
return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
|
|
56
|
-
case exports.TaskbarElement.DIVIDER:
|
|
57
|
-
return index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
function iconButton(iconName, element, className, getTitle, action, isEnabled) {
|
|
61
|
-
return index.h("ez-button", { key: iconName, title: getTitle(element), mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(element), onClick: () => action(element) });
|
|
62
|
-
}
|
|
63
|
-
function iconTextButton(iconName, element, className, getTitle, action, isEnabled) {
|
|
64
|
-
return index.h("ez-button", { key: iconName, title: getTitle(element), label: getTitle(element), size: "small", class: className, enabled: isEnabled(element), onClick: () => action(element) },
|
|
65
|
-
index.h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
exports.buildElem = buildElem;
|
|
@@ -1,429 +0,0 @@
|
|
|
1
|
-
import { Component, Host, h, Event, Element, Prop, Watch, Method } from '@stencil/core';
|
|
2
|
-
import { Action, ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
-
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
-
export class SnkDataUnit {
|
|
5
|
-
constructor() {
|
|
6
|
-
this._onDataUnitResolve = [];
|
|
7
|
-
this._dataUnitObserver = (action) => {
|
|
8
|
-
let msg = this.getActionInfo(action.type);
|
|
9
|
-
if (msg) {
|
|
10
|
-
ApplicationUtils.info(msg);
|
|
11
|
-
}
|
|
12
|
-
if (action.type === Action.RECORDS_ADDED || action.type === Action.RECORDS_COPIED) {
|
|
13
|
-
this.insertionMode.emit();
|
|
14
|
-
}
|
|
15
|
-
const duState = {
|
|
16
|
-
insertionMode: false,
|
|
17
|
-
hasNext: this.dataUnit.hasNext(),
|
|
18
|
-
hasPrevious: this.dataUnit.hasPrevious(),
|
|
19
|
-
copyMode: false,
|
|
20
|
-
isDirty: this.dataUnit.isDirty(),
|
|
21
|
-
selectedRecords: this.dataUnit.getSelectedRecords()
|
|
22
|
-
};
|
|
23
|
-
this.dataUnit.records.forEach(r => {
|
|
24
|
-
if (r.__record__id__.startsWith('NEW_')) {
|
|
25
|
-
duState.insertionMode = true;
|
|
26
|
-
duState.copyMode || (duState.copyMode = r['__record__source__id__'] != undefined);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
this.dataState = duState;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
async getDataUnit() {
|
|
33
|
-
return new Promise((resolve) => {
|
|
34
|
-
if (this.dataUnit) {
|
|
35
|
-
resolve(this.dataUnit);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
this._onDataUnitResolve.push(resolve);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async interceptAction(action) {
|
|
43
|
-
return new Promise(resolve => {
|
|
44
|
-
switch (action.type) {
|
|
45
|
-
case Action.SAVING_DATA:
|
|
46
|
-
if (this.beforeSave) {
|
|
47
|
-
const continueAction = this.beforeSave(this.dataUnit);
|
|
48
|
-
if (continueAction instanceof Promise) {
|
|
49
|
-
continueAction.then(result => resolve(result ? action : undefined));
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
resolve(continueAction ? action : undefined);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
resolve(action);
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
case Action.DATA_SAVED:
|
|
60
|
-
if (this.afterSave) {
|
|
61
|
-
this.afterSave(this.dataUnit);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
resolve(action);
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
case Action.EDITION_CANCELED:
|
|
68
|
-
ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
69
|
-
.then((result) => resolve(result ? action : undefined));
|
|
70
|
-
break;
|
|
71
|
-
case Action.REMOVING_RECORDS:
|
|
72
|
-
ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
|
|
73
|
-
.then((result) => resolve(result ? action : undefined));
|
|
74
|
-
break;
|
|
75
|
-
default:
|
|
76
|
-
resolve(action);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
getActionInfo(action) {
|
|
81
|
-
if (this.messageBuilder) {
|
|
82
|
-
return this.messageBuilder(action, this.dataState, this.dataUnit);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
if (action === Action.EDITION_CANCELED) {
|
|
86
|
-
return this.i18n("components.editionCanceled");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
observePageSize() {
|
|
91
|
-
if (this.dataUnit) {
|
|
92
|
-
this.dataUnit.pageSize = this.pageSize;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
observeDataUnitName(newValue, oldValue) {
|
|
96
|
-
if (oldValue != newValue) {
|
|
97
|
-
this.dataUnit = undefined;
|
|
98
|
-
this.dataUnitName = newValue;
|
|
99
|
-
this.loadDataUnit();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
observeEntityName(newValue, oldValue) {
|
|
103
|
-
if (oldValue != newValue) {
|
|
104
|
-
this.dataUnit = undefined;
|
|
105
|
-
this.entityName = newValue;
|
|
106
|
-
this.loadDataUnit();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
observeDataState(newValue, oldValue) {
|
|
110
|
-
if (oldValue != newValue) {
|
|
111
|
-
this.dataStateChange.emit(newValue);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
observeDataUnit() {
|
|
115
|
-
this.dataUnitReady.emit(this.dataUnit);
|
|
116
|
-
}
|
|
117
|
-
async loadDataUnit() {
|
|
118
|
-
if (!this.dataUnit) {
|
|
119
|
-
const app = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
120
|
-
if (app && this.entityName) {
|
|
121
|
-
this.dataUnit = await app.getOrCreateDataUnit(this.entityName, this.dataUnitName);
|
|
122
|
-
this.dataUnit.pageSize = this.pageSize;
|
|
123
|
-
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
|
124
|
-
this.dataUnit.addInterceptor(this);
|
|
125
|
-
this.dataUnit.subscribe(this._dataUnitObserver);
|
|
126
|
-
let resolver;
|
|
127
|
-
while (resolver = this._onDataUnitResolve.pop()) {
|
|
128
|
-
resolver(this.dataUnit);
|
|
129
|
-
}
|
|
130
|
-
if (this.autoLoad) {
|
|
131
|
-
this.dataUnit.loadData();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
i18n(key) {
|
|
137
|
-
const pt_br = {
|
|
138
|
-
"components.warning": "Aviso",
|
|
139
|
-
"components.delete": "Excluir",
|
|
140
|
-
"components.confirmRemoveRecord": "Deseja realmente excluir o registro atual?",
|
|
141
|
-
"components.confirmCancelEdition": "As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de sair?</b>",
|
|
142
|
-
"components.editionCanceled": "Todas as alterações foram descartadas.",
|
|
143
|
-
};
|
|
144
|
-
return pt_br[key];
|
|
145
|
-
}
|
|
146
|
-
componentDidRender() {
|
|
147
|
-
this.loadDataUnit();
|
|
148
|
-
}
|
|
149
|
-
render() {
|
|
150
|
-
return (h(Host, null));
|
|
151
|
-
}
|
|
152
|
-
static get is() { return "snk-data-unit"; }
|
|
153
|
-
static get encapsulation() { return "scoped"; }
|
|
154
|
-
static get originalStyleUrls() { return {
|
|
155
|
-
"$": ["snk-data-unit.css"]
|
|
156
|
-
}; }
|
|
157
|
-
static get styleUrls() { return {
|
|
158
|
-
"$": ["snk-data-unit.css"]
|
|
159
|
-
}; }
|
|
160
|
-
static get properties() { return {
|
|
161
|
-
"dataState": {
|
|
162
|
-
"type": "unknown",
|
|
163
|
-
"mutable": true,
|
|
164
|
-
"complexType": {
|
|
165
|
-
"original": "DataState",
|
|
166
|
-
"resolved": "DataState",
|
|
167
|
-
"references": {
|
|
168
|
-
"DataState": {
|
|
169
|
-
"location": "local"
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
"required": false,
|
|
174
|
-
"optional": false,
|
|
175
|
-
"docs": {
|
|
176
|
-
"tags": [],
|
|
177
|
-
"text": ""
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
"dataUnitName": {
|
|
181
|
-
"type": "string",
|
|
182
|
-
"mutable": false,
|
|
183
|
-
"complexType": {
|
|
184
|
-
"original": "string",
|
|
185
|
-
"resolved": "string",
|
|
186
|
-
"references": {}
|
|
187
|
-
},
|
|
188
|
-
"required": false,
|
|
189
|
-
"optional": false,
|
|
190
|
-
"docs": {
|
|
191
|
-
"tags": [],
|
|
192
|
-
"text": ""
|
|
193
|
-
},
|
|
194
|
-
"attribute": "data-unit-name",
|
|
195
|
-
"reflect": false
|
|
196
|
-
},
|
|
197
|
-
"entityName": {
|
|
198
|
-
"type": "string",
|
|
199
|
-
"mutable": false,
|
|
200
|
-
"complexType": {
|
|
201
|
-
"original": "string",
|
|
202
|
-
"resolved": "string",
|
|
203
|
-
"references": {}
|
|
204
|
-
},
|
|
205
|
-
"required": false,
|
|
206
|
-
"optional": false,
|
|
207
|
-
"docs": {
|
|
208
|
-
"tags": [],
|
|
209
|
-
"text": ""
|
|
210
|
-
},
|
|
211
|
-
"attribute": "entity-name",
|
|
212
|
-
"reflect": false
|
|
213
|
-
},
|
|
214
|
-
"pageSize": {
|
|
215
|
-
"type": "number",
|
|
216
|
-
"mutable": false,
|
|
217
|
-
"complexType": {
|
|
218
|
-
"original": "number",
|
|
219
|
-
"resolved": "number",
|
|
220
|
-
"references": {}
|
|
221
|
-
},
|
|
222
|
-
"required": false,
|
|
223
|
-
"optional": false,
|
|
224
|
-
"docs": {
|
|
225
|
-
"tags": [],
|
|
226
|
-
"text": ""
|
|
227
|
-
},
|
|
228
|
-
"attribute": "page-size",
|
|
229
|
-
"reflect": false
|
|
230
|
-
},
|
|
231
|
-
"dataUnit": {
|
|
232
|
-
"type": "unknown",
|
|
233
|
-
"mutable": true,
|
|
234
|
-
"complexType": {
|
|
235
|
-
"original": "DataUnit",
|
|
236
|
-
"resolved": "DataUnit",
|
|
237
|
-
"references": {
|
|
238
|
-
"DataUnit": {
|
|
239
|
-
"location": "import",
|
|
240
|
-
"path": "@sankhyalabs/core"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
"required": false,
|
|
245
|
-
"optional": false,
|
|
246
|
-
"docs": {
|
|
247
|
-
"tags": [],
|
|
248
|
-
"text": ""
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
"messageBuilder": {
|
|
252
|
-
"type": "unknown",
|
|
253
|
-
"mutable": false,
|
|
254
|
-
"complexType": {
|
|
255
|
-
"original": "(messageKey: string, dataState: DataState, dataUnit: DataUnit) => string",
|
|
256
|
-
"resolved": "(messageKey: string, dataState: DataState, dataUnit: DataUnit) => string",
|
|
257
|
-
"references": {
|
|
258
|
-
"DataState": {
|
|
259
|
-
"location": "local"
|
|
260
|
-
},
|
|
261
|
-
"DataUnit": {
|
|
262
|
-
"location": "import",
|
|
263
|
-
"path": "@sankhyalabs/core"
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
"required": false,
|
|
268
|
-
"optional": false,
|
|
269
|
-
"docs": {
|
|
270
|
-
"tags": [],
|
|
271
|
-
"text": ""
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
"beforeSave": {
|
|
275
|
-
"type": "unknown",
|
|
276
|
-
"mutable": false,
|
|
277
|
-
"complexType": {
|
|
278
|
-
"original": "(dataUnit: DataUnit) => boolean | Promise<boolean>",
|
|
279
|
-
"resolved": "(dataUnit: DataUnit) => boolean | Promise<boolean>",
|
|
280
|
-
"references": {
|
|
281
|
-
"DataUnit": {
|
|
282
|
-
"location": "import",
|
|
283
|
-
"path": "@sankhyalabs/core"
|
|
284
|
-
},
|
|
285
|
-
"Promise": {
|
|
286
|
-
"location": "global"
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
"required": false,
|
|
291
|
-
"optional": false,
|
|
292
|
-
"docs": {
|
|
293
|
-
"tags": [],
|
|
294
|
-
"text": ""
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
"afterSave": {
|
|
298
|
-
"type": "unknown",
|
|
299
|
-
"mutable": false,
|
|
300
|
-
"complexType": {
|
|
301
|
-
"original": "(dataUnit: DataUnit) => void",
|
|
302
|
-
"resolved": "(dataUnit: DataUnit) => void",
|
|
303
|
-
"references": {
|
|
304
|
-
"DataUnit": {
|
|
305
|
-
"location": "import",
|
|
306
|
-
"path": "@sankhyalabs/core"
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
"required": false,
|
|
311
|
-
"optional": false,
|
|
312
|
-
"docs": {
|
|
313
|
-
"tags": [],
|
|
314
|
-
"text": ""
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
"autoLoad": {
|
|
318
|
-
"type": "boolean",
|
|
319
|
-
"mutable": false,
|
|
320
|
-
"complexType": {
|
|
321
|
-
"original": "boolean",
|
|
322
|
-
"resolved": "boolean",
|
|
323
|
-
"references": {}
|
|
324
|
-
},
|
|
325
|
-
"required": false,
|
|
326
|
-
"optional": false,
|
|
327
|
-
"docs": {
|
|
328
|
-
"tags": [],
|
|
329
|
-
"text": ""
|
|
330
|
-
},
|
|
331
|
-
"attribute": "auto-load",
|
|
332
|
-
"reflect": false
|
|
333
|
-
}
|
|
334
|
-
}; }
|
|
335
|
-
static get events() { return [{
|
|
336
|
-
"method": "insertionMode",
|
|
337
|
-
"name": "insertionMode",
|
|
338
|
-
"bubbles": true,
|
|
339
|
-
"cancelable": true,
|
|
340
|
-
"composed": true,
|
|
341
|
-
"docs": {
|
|
342
|
-
"tags": [],
|
|
343
|
-
"text": ""
|
|
344
|
-
},
|
|
345
|
-
"complexType": {
|
|
346
|
-
"original": "void",
|
|
347
|
-
"resolved": "void",
|
|
348
|
-
"references": {}
|
|
349
|
-
}
|
|
350
|
-
}, {
|
|
351
|
-
"method": "dataStateChange",
|
|
352
|
-
"name": "dataStateChange",
|
|
353
|
-
"bubbles": true,
|
|
354
|
-
"cancelable": true,
|
|
355
|
-
"composed": true,
|
|
356
|
-
"docs": {
|
|
357
|
-
"tags": [],
|
|
358
|
-
"text": ""
|
|
359
|
-
},
|
|
360
|
-
"complexType": {
|
|
361
|
-
"original": "DataState",
|
|
362
|
-
"resolved": "DataState",
|
|
363
|
-
"references": {
|
|
364
|
-
"DataState": {
|
|
365
|
-
"location": "local"
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}, {
|
|
370
|
-
"method": "dataUnitReady",
|
|
371
|
-
"name": "dataUnitReady",
|
|
372
|
-
"bubbles": true,
|
|
373
|
-
"cancelable": true,
|
|
374
|
-
"composed": true,
|
|
375
|
-
"docs": {
|
|
376
|
-
"tags": [],
|
|
377
|
-
"text": ""
|
|
378
|
-
},
|
|
379
|
-
"complexType": {
|
|
380
|
-
"original": "DataUnit",
|
|
381
|
-
"resolved": "DataUnit",
|
|
382
|
-
"references": {
|
|
383
|
-
"DataUnit": {
|
|
384
|
-
"location": "import",
|
|
385
|
-
"path": "@sankhyalabs/core"
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}]; }
|
|
390
|
-
static get methods() { return {
|
|
391
|
-
"getDataUnit": {
|
|
392
|
-
"complexType": {
|
|
393
|
-
"signature": "() => Promise<DataUnit>",
|
|
394
|
-
"parameters": [],
|
|
395
|
-
"references": {
|
|
396
|
-
"Promise": {
|
|
397
|
-
"location": "global"
|
|
398
|
-
},
|
|
399
|
-
"DataUnit": {
|
|
400
|
-
"location": "import",
|
|
401
|
-
"path": "@sankhyalabs/core"
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
"return": "Promise<DataUnit>"
|
|
405
|
-
},
|
|
406
|
-
"docs": {
|
|
407
|
-
"text": "",
|
|
408
|
-
"tags": []
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}; }
|
|
412
|
-
static get elementRef() { return "element"; }
|
|
413
|
-
static get watchers() { return [{
|
|
414
|
-
"propName": "pageSize",
|
|
415
|
-
"methodName": "observePageSize"
|
|
416
|
-
}, {
|
|
417
|
-
"propName": "dataUnitName",
|
|
418
|
-
"methodName": "observeDataUnitName"
|
|
419
|
-
}, {
|
|
420
|
-
"propName": "entityName",
|
|
421
|
-
"methodName": "observeEntityName"
|
|
422
|
-
}, {
|
|
423
|
-
"propName": "dataState",
|
|
424
|
-
"methodName": "observeDataState"
|
|
425
|
-
}, {
|
|
426
|
-
"propName": "dataUnit",
|
|
427
|
-
"methodName": "observeDataUnit"
|
|
428
|
-
}]; }
|
|
429
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
-
import { Component, Element, Event, h, Prop, State } from '@stencil/core';
|
|
3
|
-
export class SnkForm {
|
|
4
|
-
getFormConfig() {
|
|
5
|
-
return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
|
|
6
|
-
}
|
|
7
|
-
getInsertionHiddenFields(formConfig) {
|
|
8
|
-
const hiddenFields = [];
|
|
9
|
-
formConfig === null || formConfig === void 0 ? void 0 : formConfig.forEach(cfg => {
|
|
10
|
-
const def = this._dataUnit.getField(cfg.name);
|
|
11
|
-
if (def === null || def === void 0 ? void 0 : def.readOnly) {
|
|
12
|
-
hiddenFields.push(cfg.name);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return hiddenFields;
|
|
16
|
-
}
|
|
17
|
-
exitForm() {
|
|
18
|
-
if (this._dataUnit.isDirty()) {
|
|
19
|
-
this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
this.exit.emit();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
getDisabledButtons() {
|
|
26
|
-
const disabled = [];
|
|
27
|
-
if (!this._dataState.hasPrevious) {
|
|
28
|
-
disabled.push("PREVIOUS");
|
|
29
|
-
}
|
|
30
|
-
if (!this._dataState.hasNext) {
|
|
31
|
-
disabled.push("NEXT");
|
|
32
|
-
}
|
|
33
|
-
return disabled;
|
|
34
|
-
}
|
|
35
|
-
componentWillLoad() {
|
|
36
|
-
let parent = this._element.parentElement;
|
|
37
|
-
while (parent) {
|
|
38
|
-
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
39
|
-
this._snkDataUnit = parent;
|
|
40
|
-
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
41
|
-
this._dataState = this._snkDataUnit.dataState;
|
|
42
|
-
if (!this._dataUnit) {
|
|
43
|
-
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
44
|
-
this._dataUnit = evt.detail;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
|
|
48
|
-
this._dataState = evt.detail;
|
|
49
|
-
});
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
parent = parent.parentElement;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
componentWillRender() {
|
|
56
|
-
if (this._dataUnit && !this._configLoaded) {
|
|
57
|
-
const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
58
|
-
if (snkApplication) {
|
|
59
|
-
snkApplication.loadFormConfig(this.configName).then(cfg => {
|
|
60
|
-
this._configLoaded = true;
|
|
61
|
-
this._editionFormConfig = cfg;
|
|
62
|
-
this._insertionFormConfig = cfg.filter(fieldCfg => {
|
|
63
|
-
const def = this._dataUnit.getField(fieldCfg.name);
|
|
64
|
-
if (def === null || def === void 0 ? void 0 : def.readOnly) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
render() {
|
|
74
|
-
if (!this._configLoaded || !this._dataUnit || !this._dataState) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
return (h("section", { class: "ez-padding--large" },
|
|
78
|
-
h("div", { class: "ez-row ez-padding-bottom--medium" },
|
|
79
|
-
h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" },
|
|
80
|
-
h("ez-button", { mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }),
|
|
81
|
-
h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.formTitle)),
|
|
82
|
-
h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" },
|
|
83
|
-
h("snk-taskbar", { key: "formTaskbar", buttons: this._dataState.isDirty ? "CANCEL,SAVE" : "PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,INSERT", primaryButton: this._dataState.isDirty ? "SAVE" : "INSERT", disabledButtons: this.getDisabledButtons(), actionsList: this.actionsList, dataUnit: this._dataUnit }))),
|
|
84
|
-
h("div", { class: "ez-padding--small" }),
|
|
85
|
-
h("section", null,
|
|
86
|
-
h("div", { class: "ez-row" },
|
|
87
|
-
h("div", { class: "ez-col ez-col--sd-12" },
|
|
88
|
-
h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig() }))))));
|
|
89
|
-
}
|
|
90
|
-
static get is() { return "snk-form"; }
|
|
91
|
-
static get encapsulation() { return "scoped"; }
|
|
92
|
-
static get originalStyleUrls() { return {
|
|
93
|
-
"$": ["snk-form.css"]
|
|
94
|
-
}; }
|
|
95
|
-
static get styleUrls() { return {
|
|
96
|
-
"$": ["snk-form.css"]
|
|
97
|
-
}; }
|
|
98
|
-
static get properties() { return {
|
|
99
|
-
"formTitle": {
|
|
100
|
-
"type": "string",
|
|
101
|
-
"mutable": false,
|
|
102
|
-
"complexType": {
|
|
103
|
-
"original": "string",
|
|
104
|
-
"resolved": "string",
|
|
105
|
-
"references": {}
|
|
106
|
-
},
|
|
107
|
-
"required": false,
|
|
108
|
-
"optional": false,
|
|
109
|
-
"docs": {
|
|
110
|
-
"tags": [],
|
|
111
|
-
"text": ""
|
|
112
|
-
},
|
|
113
|
-
"attribute": "form-title",
|
|
114
|
-
"reflect": false
|
|
115
|
-
},
|
|
116
|
-
"configName": {
|
|
117
|
-
"type": "string",
|
|
118
|
-
"mutable": false,
|
|
119
|
-
"complexType": {
|
|
120
|
-
"original": "string",
|
|
121
|
-
"resolved": "string",
|
|
122
|
-
"references": {}
|
|
123
|
-
},
|
|
124
|
-
"required": false,
|
|
125
|
-
"optional": false,
|
|
126
|
-
"docs": {
|
|
127
|
-
"tags": [],
|
|
128
|
-
"text": ""
|
|
129
|
-
},
|
|
130
|
-
"attribute": "config-name",
|
|
131
|
-
"reflect": false
|
|
132
|
-
},
|
|
133
|
-
"actionsList": {
|
|
134
|
-
"type": "unknown",
|
|
135
|
-
"mutable": false,
|
|
136
|
-
"complexType": {
|
|
137
|
-
"original": "Array<Action>",
|
|
138
|
-
"resolved": "Action[]",
|
|
139
|
-
"references": {
|
|
140
|
-
"Array": {
|
|
141
|
-
"location": "global"
|
|
142
|
-
},
|
|
143
|
-
"Action": {
|
|
144
|
-
"location": "import",
|
|
145
|
-
"path": "../snk-taskbar/snk-taskbar"
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
"required": false,
|
|
150
|
-
"optional": false,
|
|
151
|
-
"docs": {
|
|
152
|
-
"tags": [],
|
|
153
|
-
"text": ""
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}; }
|
|
157
|
-
static get states() { return {
|
|
158
|
-
"_dataUnit": {},
|
|
159
|
-
"_configLoaded": {},
|
|
160
|
-
"_dataState": {}
|
|
161
|
-
}; }
|
|
162
|
-
static get events() { return [{
|
|
163
|
-
"method": "exit",
|
|
164
|
-
"name": "exit",
|
|
165
|
-
"bubbles": true,
|
|
166
|
-
"cancelable": true,
|
|
167
|
-
"composed": true,
|
|
168
|
-
"docs": {
|
|
169
|
-
"tags": [],
|
|
170
|
-
"text": ""
|
|
171
|
-
},
|
|
172
|
-
"complexType": {
|
|
173
|
-
"original": "void",
|
|
174
|
-
"resolved": "void",
|
|
175
|
-
"references": {}
|
|
176
|
-
}
|
|
177
|
-
}, {
|
|
178
|
-
"method": "actionClick",
|
|
179
|
-
"name": "actionClick",
|
|
180
|
-
"bubbles": true,
|
|
181
|
-
"cancelable": true,
|
|
182
|
-
"composed": true,
|
|
183
|
-
"docs": {
|
|
184
|
-
"tags": [],
|
|
185
|
-
"text": ""
|
|
186
|
-
},
|
|
187
|
-
"complexType": {
|
|
188
|
-
"original": "string",
|
|
189
|
-
"resolved": "string",
|
|
190
|
-
"references": {}
|
|
191
|
-
}
|
|
192
|
-
}]; }
|
|
193
|
-
static get elementRef() { return "_element"; }
|
|
194
|
-
}
|