@sankhyalabs/sankhyablocks 1.3.31-beta.5 → 1.3.31-beta.6
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-532bcc28.js} +0 -34
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +97 -5
- package/dist/cjs/snk-data-unit.cjs.entry.js +49 -34
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +15 -34
- package/dist/cjs/{taskbar-elements-589a3744.js → taskbar-elements-9d47b416.js} +4 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +107 -31
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +82 -62
- package/dist/collection/components/snk-form/snk-form.js +5 -5
- package/dist/collection/components/snk-grid/snk-grid.js +3 -3
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +17 -33
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +16 -0
- package/dist/components/snk-application2.js +97 -5
- package/dist/components/snk-data-unit.js +48 -33
- package/dist/components/snk-taskbar2.js +14 -32
- package/dist/esm/{index-7565ae23.js → index-0b078db7.js} +0 -34
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +97 -5
- package/dist/esm/snk-data-unit.entry.js +49 -34
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +13 -32
- package/dist/esm/{taskbar-elements-b6822601.js → taskbar-elements-3ba30bf4.js} +4 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-a4b2fa10.entry.js → p-3cb106f7.entry.js} +3 -3
- package/dist/sankhyablocks/p-3fce3190.entry.js +1 -0
- package/dist/sankhyablocks/{p-bb8d8fe7.entry.js → p-560fdf54.entry.js} +1 -1
- package/dist/sankhyablocks/p-574764bf.js +1 -0
- package/dist/sankhyablocks/p-8f7b9a85.entry.js +1 -0
- package/dist/sankhyablocks/{p-e7ade160.entry.js → p-9c225717.entry.js} +1 -1
- package/dist/sankhyablocks/p-a45dba1a.js +2 -0
- package/dist/sankhyablocks/{p-6d82d7fd.entry.js → p-a670853c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bb31ea2a.entry.js → p-a8305c35.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +85 -9
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +20 -3
- package/dist/types/components.d.ts +216 -2
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
- package/package.json +1 -1
- package/dist/collection/components/snk-taskbar/component/snk-popup-button.js +0 -7
- 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/types/components/snk-taskbar/component/snk-popup-button.d.ts +0 -12
|
@@ -108,7 +108,7 @@ export class SnkForm {
|
|
|
108
108
|
"optional": false,
|
|
109
109
|
"docs": {
|
|
110
110
|
"tags": [],
|
|
111
|
-
"text": ""
|
|
111
|
+
"text": "Texto que aparece de forma descritiva no cabe\u00E7alho do form"
|
|
112
112
|
},
|
|
113
113
|
"attribute": "form-title",
|
|
114
114
|
"reflect": false
|
|
@@ -125,7 +125,7 @@ export class SnkForm {
|
|
|
125
125
|
"optional": false,
|
|
126
126
|
"docs": {
|
|
127
127
|
"tags": [],
|
|
128
|
-
"text": ""
|
|
128
|
+
"text": "Nome usado para guardar/recuperar as configura\u00E7\u00F5es do formul\u00E1rio"
|
|
129
129
|
},
|
|
130
130
|
"attribute": "config-name",
|
|
131
131
|
"reflect": false
|
|
@@ -150,7 +150,7 @@ export class SnkForm {
|
|
|
150
150
|
"optional": false,
|
|
151
151
|
"docs": {
|
|
152
152
|
"tags": [],
|
|
153
|
-
"text": ""
|
|
153
|
+
"text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\""
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}; }
|
|
@@ -167,7 +167,7 @@ export class SnkForm {
|
|
|
167
167
|
"composed": true,
|
|
168
168
|
"docs": {
|
|
169
169
|
"tags": [],
|
|
170
|
-
"text": ""
|
|
170
|
+
"text": "Emitido quando o bot\u00E3o de voltar \u00E9 acionado"
|
|
171
171
|
},
|
|
172
172
|
"complexType": {
|
|
173
173
|
"original": "void",
|
|
@@ -182,7 +182,7 @@ export class SnkForm {
|
|
|
182
182
|
"composed": true,
|
|
183
183
|
"docs": {
|
|
184
184
|
"tags": [],
|
|
185
|
-
"text": ""
|
|
185
|
+
"text": "Emitido sempre que houver click de bot\u00E3o ou a\u00E7\u00E3o"
|
|
186
186
|
},
|
|
187
187
|
"complexType": {
|
|
188
188
|
"original": "string",
|
|
@@ -74,7 +74,7 @@ export class SnkGrid {
|
|
|
74
74
|
"optional": false,
|
|
75
75
|
"docs": {
|
|
76
76
|
"tags": [],
|
|
77
|
-
"text": ""
|
|
77
|
+
"text": "Nome usado para salvar/recuperar a configura\u00E7\u00E3o"
|
|
78
78
|
},
|
|
79
79
|
"attribute": "config-name",
|
|
80
80
|
"reflect": false
|
|
@@ -99,7 +99,7 @@ export class SnkGrid {
|
|
|
99
99
|
"optional": false,
|
|
100
100
|
"docs": {
|
|
101
101
|
"tags": [],
|
|
102
|
-
"text": ""
|
|
102
|
+
"text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\""
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}; }
|
|
@@ -116,7 +116,7 @@ export class SnkGrid {
|
|
|
116
116
|
"composed": true,
|
|
117
117
|
"docs": {
|
|
118
118
|
"tags": [],
|
|
119
|
-
"text": ""
|
|
119
|
+
"text": "Emitido sempre que houver click de bot\u00E3o ou a\u00E7\u00E3o"
|
|
120
120
|
},
|
|
121
121
|
"complexType": {
|
|
122
122
|
"original": "string",
|
|
@@ -24,7 +24,7 @@ export var AuthorizationElements;
|
|
|
24
24
|
AuthorizationElements["INSERT"] = "INSERT";
|
|
25
25
|
AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
|
|
26
26
|
})(AuthorizationElements || (AuthorizationElements = {}));
|
|
27
|
-
export const buildElem = (element, className, getTitle, action, isEnabled) => {
|
|
27
|
+
export const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
28
28
|
switch (element) {
|
|
29
29
|
case TaskbarElement.PREVIOUS:
|
|
30
30
|
return iconButton("chevron-left", element, className, getTitle, action, isEnabled);
|
|
@@ -50,6 +50,8 @@ export const buildElem = (element, className, getTitle, action, isEnabled) => {
|
|
|
50
50
|
return iconButton("list", element, className, getTitle, action, isEnabled);
|
|
51
51
|
case TaskbarElement.CONFIG_GRID:
|
|
52
52
|
return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
|
|
53
|
+
case TaskbarElement.MORE_OPTIONS:
|
|
54
|
+
return h("ez-actions-button", { size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions });
|
|
53
55
|
case TaskbarElement.DIVIDER:
|
|
54
56
|
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
|
|
55
57
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
2
|
import { Component, Event, h, Host, Prop, State, Watch } from '@stencil/core';
|
|
3
|
-
import { SnkPopupButton } from './component/snk-popup-button';
|
|
4
3
|
import { TaskbarElement, buildElem, AuthorizationElements } from './elements/taskbar-elements';
|
|
5
4
|
export class SnkTaskbar {
|
|
6
|
-
constructor() {
|
|
7
|
-
this._moreOptionsOpened = false;
|
|
8
|
-
}
|
|
9
5
|
observeButtons() {
|
|
10
6
|
this._definitions = undefined;
|
|
11
7
|
}
|
|
@@ -77,10 +73,6 @@ export class SnkTaskbar {
|
|
|
77
73
|
}
|
|
78
74
|
this.actionClick.emit(elem);
|
|
79
75
|
}
|
|
80
|
-
actionClickHandler(act) {
|
|
81
|
-
this._moreOptionsOpened = false;
|
|
82
|
-
this.actionClick.emit(act.key);
|
|
83
|
-
}
|
|
84
76
|
isEnabled(elem) {
|
|
85
77
|
return !(this.disabledButtons && this.disabledButtons.includes(elem));
|
|
86
78
|
}
|
|
@@ -90,29 +82,22 @@ export class SnkTaskbar {
|
|
|
90
82
|
if (index > 1) {
|
|
91
83
|
className += "ez-padding-left--medium";
|
|
92
84
|
}
|
|
93
|
-
|
|
94
|
-
element = this.actionsList ? h(SnkPopupButton, { className: className, title: this.getTitle(def), source: this.actionsList, opened: this._moreOptionsOpened, setOpened: opened => this._moreOptionsOpened = opened, actionClick: act => this.actionClickHandler(act) }) : undefined;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
98
|
-
}
|
|
85
|
+
element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
99
86
|
return element;
|
|
100
87
|
}
|
|
101
88
|
// Lifecycle
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
snkApplication.getAllAccess().then(access => this._permissions = access);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
this._permissions = {};
|
|
110
|
-
}
|
|
89
|
+
componentWillLoad() {
|
|
90
|
+
const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
91
|
+
if (snkApplication) {
|
|
92
|
+
snkApplication.getAllAccess().then(access => this._permissions = access);
|
|
111
93
|
}
|
|
112
94
|
else {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
95
|
+
this._permissions = {};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
componentWillRender() {
|
|
99
|
+
if (this._definitions == undefined && this._permissions) {
|
|
100
|
+
this._definitions = this.elementsFromString(this.buttons);
|
|
116
101
|
}
|
|
117
102
|
}
|
|
118
103
|
render() {
|
|
@@ -157,7 +142,7 @@ export class SnkTaskbar {
|
|
|
157
142
|
"optional": false,
|
|
158
143
|
"docs": {
|
|
159
144
|
"tags": [],
|
|
160
|
-
"text": ""
|
|
145
|
+
"text": "Lista separada por virgula, contendo todos os elementos a serem criados"
|
|
161
146
|
},
|
|
162
147
|
"attribute": "buttons",
|
|
163
148
|
"reflect": false
|
|
@@ -181,7 +166,7 @@ export class SnkTaskbar {
|
|
|
181
166
|
"optional": false,
|
|
182
167
|
"docs": {
|
|
183
168
|
"tags": [],
|
|
184
|
-
"text": ""
|
|
169
|
+
"text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\""
|
|
185
170
|
}
|
|
186
171
|
},
|
|
187
172
|
"primaryButton": {
|
|
@@ -196,7 +181,7 @@ export class SnkTaskbar {
|
|
|
196
181
|
"optional": false,
|
|
197
182
|
"docs": {
|
|
198
183
|
"tags": [],
|
|
199
|
-
"text": ""
|
|
184
|
+
"text": "Qual bot\u00E3o deve ter apar\u00EAncia prim\u00E1ria"
|
|
200
185
|
},
|
|
201
186
|
"attribute": "primary-button",
|
|
202
187
|
"reflect": false
|
|
@@ -217,7 +202,7 @@ export class SnkTaskbar {
|
|
|
217
202
|
"optional": false,
|
|
218
203
|
"docs": {
|
|
219
204
|
"tags": [],
|
|
220
|
-
"text": ""
|
|
205
|
+
"text": "Array contendo todos os bot\u00F5es a serem desabilitados"
|
|
221
206
|
}
|
|
222
207
|
},
|
|
223
208
|
"dataUnit": {
|
|
@@ -237,12 +222,11 @@ export class SnkTaskbar {
|
|
|
237
222
|
"optional": false,
|
|
238
223
|
"docs": {
|
|
239
224
|
"tags": [],
|
|
240
|
-
"text": ""
|
|
225
|
+
"text": "Inst\u00E2ncia do DataUnit"
|
|
241
226
|
}
|
|
242
227
|
}
|
|
243
228
|
}; }
|
|
244
229
|
static get states() { return {
|
|
245
|
-
"_moreOptionsOpened": {},
|
|
246
230
|
"_permissions": {}
|
|
247
231
|
}; }
|
|
248
232
|
static get events() { return [{
|
|
@@ -253,7 +237,7 @@ export class SnkTaskbar {
|
|
|
253
237
|
"composed": true,
|
|
254
238
|
"docs": {
|
|
255
239
|
"tags": [],
|
|
256
|
-
"text": ""
|
|
240
|
+
"text": "Emitido sempre que houver click de bot\u00E3o ou a\u00E7\u00E3o"
|
|
257
241
|
},
|
|
258
242
|
"complexType": {
|
|
259
243
|
"original": "string",
|
|
@@ -4,6 +4,7 @@ import { DataFetcher } from "../DataFetcher";
|
|
|
4
4
|
export default class DataUnitFetcher {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.templateByQuery = new Map();
|
|
7
|
+
this._loadDataTimeout = {};
|
|
7
8
|
this.buldTemplates();
|
|
8
9
|
}
|
|
9
10
|
buldTemplates() {
|
|
@@ -101,6 +102,21 @@ export default class DataUnitFetcher {
|
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
loadData(dataUnit, request) {
|
|
105
|
+
const duName = dataUnit.name;
|
|
106
|
+
if (this._loadDataTimeout[duName]) {
|
|
107
|
+
clearTimeout(this._loadDataTimeout[duName]);
|
|
108
|
+
delete this._loadDataTimeout[duName];
|
|
109
|
+
}
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
this._loadDataTimeout[duName] = setTimeout(() => {
|
|
112
|
+
delete this._loadDataTimeout[duName];
|
|
113
|
+
this.doLoadData(dataUnit, request)
|
|
114
|
+
.then(result => resolve(result))
|
|
115
|
+
.catch(reason => reject(reason));
|
|
116
|
+
}, 200);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
doLoadData(dataUnit, request) {
|
|
104
120
|
return new Promise((resolve, reject) => {
|
|
105
121
|
var _a;
|
|
106
122
|
const { sort, filters, limit, offset, quickFilter } = request;
|
|
@@ -6688,6 +6688,7 @@ class WaitingRequest {
|
|
|
6688
6688
|
class DataUnitFetcher {
|
|
6689
6689
|
constructor() {
|
|
6690
6690
|
this.templateByQuery = new Map();
|
|
6691
|
+
this._loadDataTimeout = {};
|
|
6691
6692
|
this.buldTemplates();
|
|
6692
6693
|
}
|
|
6693
6694
|
buldTemplates() {
|
|
@@ -6785,6 +6786,21 @@ class DataUnitFetcher {
|
|
|
6785
6786
|
});
|
|
6786
6787
|
}
|
|
6787
6788
|
loadData(dataUnit, request) {
|
|
6789
|
+
const duName = dataUnit.name;
|
|
6790
|
+
if (this._loadDataTimeout[duName]) {
|
|
6791
|
+
clearTimeout(this._loadDataTimeout[duName]);
|
|
6792
|
+
delete this._loadDataTimeout[duName];
|
|
6793
|
+
}
|
|
6794
|
+
return new Promise((resolve, reject) => {
|
|
6795
|
+
this._loadDataTimeout[duName] = setTimeout(() => {
|
|
6796
|
+
delete this._loadDataTimeout[duName];
|
|
6797
|
+
this.doLoadData(dataUnit, request)
|
|
6798
|
+
.then(result => resolve(result))
|
|
6799
|
+
.catch(reason => reject(reason));
|
|
6800
|
+
}, 200);
|
|
6801
|
+
});
|
|
6802
|
+
}
|
|
6803
|
+
doLoadData(dataUnit, request) {
|
|
6788
6804
|
return new Promise((resolve, reject) => {
|
|
6789
6805
|
var _a;
|
|
6790
6806
|
const { sort, filters, limit, offset, quickFilter } = request;
|
|
@@ -7296,6 +7312,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7296
7312
|
}
|
|
7297
7313
|
});
|
|
7298
7314
|
}
|
|
7315
|
+
/**
|
|
7316
|
+
* Caso o usuário logado seja o SUP.
|
|
7317
|
+
*/
|
|
7299
7318
|
async isUserSup() {
|
|
7300
7319
|
return new Promise((resolve, reject) => {
|
|
7301
7320
|
this.auth.then((authorization) => {
|
|
@@ -7305,6 +7324,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7305
7324
|
});
|
|
7306
7325
|
});
|
|
7307
7326
|
}
|
|
7327
|
+
/**
|
|
7328
|
+
* Se o usuário logado tem permissão pra determinada ação.
|
|
7329
|
+
*/
|
|
7308
7330
|
async hasAccess(access) {
|
|
7309
7331
|
return new Promise((resolve, reject) => {
|
|
7310
7332
|
this.auth.then((authorization) => {
|
|
@@ -7314,6 +7336,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7314
7336
|
});
|
|
7315
7337
|
});
|
|
7316
7338
|
}
|
|
7339
|
+
/**
|
|
7340
|
+
* Retorna todos os acessos do usuário logado.
|
|
7341
|
+
*/
|
|
7317
7342
|
async getAllAccess() {
|
|
7318
7343
|
return new Promise((resolve, reject) => {
|
|
7319
7344
|
this.auth.then((authorization) => {
|
|
@@ -7328,34 +7353,55 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7328
7353
|
});
|
|
7329
7354
|
});
|
|
7330
7355
|
}
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7356
|
+
/**
|
|
7357
|
+
* Retorna o valor de um parâmetro do tipo string.
|
|
7358
|
+
*/
|
|
7334
7359
|
async getStringParam(name) {
|
|
7335
7360
|
return this.parameters.asString(name, this.resourceID);
|
|
7336
7361
|
}
|
|
7362
|
+
/**
|
|
7363
|
+
* Retorna o valor de um parâmetro do tipo Inteiro.
|
|
7364
|
+
*/
|
|
7337
7365
|
async getIntParam(name) {
|
|
7338
7366
|
return this.parameters.asInteger(name, this.resourceID);
|
|
7339
7367
|
}
|
|
7368
|
+
/**
|
|
7369
|
+
* Retorna o valor de um parâmetro do tipo Decimal.
|
|
7370
|
+
*/
|
|
7340
7371
|
async getFloatParam(name) {
|
|
7341
7372
|
return this.parameters.asFloat(name, this.resourceID);
|
|
7342
7373
|
}
|
|
7374
|
+
/**
|
|
7375
|
+
* Retorna o valor de um parâmetro do tipo booleano.
|
|
7376
|
+
*/
|
|
7343
7377
|
async getBooleanParam(name) {
|
|
7344
7378
|
return this.parameters.asBoolean(name, this.resourceID);
|
|
7345
7379
|
}
|
|
7380
|
+
/**
|
|
7381
|
+
* Retorna o valor de um parâmetro do tipo data.
|
|
7382
|
+
*/
|
|
7346
7383
|
async getDateParam(name) {
|
|
7347
7384
|
return this.parameters.asDate(name, this.resourceID);
|
|
7348
7385
|
}
|
|
7386
|
+
/**
|
|
7387
|
+
* Mostra o conteúdo passado em um Popup
|
|
7388
|
+
*/
|
|
7349
7389
|
async showPopUp(content) {
|
|
7350
7390
|
this._popUp.appendChild(content);
|
|
7351
7391
|
this._popUp["opened"] = true;
|
|
7352
7392
|
}
|
|
7393
|
+
/**
|
|
7394
|
+
* Fecha o popup, liberando o conteúdo.
|
|
7395
|
+
*/
|
|
7353
7396
|
async closePopUp() {
|
|
7354
7397
|
Array.from(this._popUp.children).forEach(c => {
|
|
7355
7398
|
this._popUp.removeChild(c);
|
|
7356
7399
|
});
|
|
7357
7400
|
this._popUp["opened"] = false;
|
|
7358
7401
|
}
|
|
7402
|
+
/**
|
|
7403
|
+
* Verifica se a licença do cliente tem determinado opcional (produto)
|
|
7404
|
+
*/
|
|
7359
7405
|
async temOpcional(opcional) {
|
|
7360
7406
|
const opts = opcional.split(",");
|
|
7361
7407
|
return new Promise((resolve, reject) => {
|
|
@@ -7379,6 +7425,10 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7379
7425
|
});
|
|
7380
7426
|
});
|
|
7381
7427
|
}
|
|
7428
|
+
/**
|
|
7429
|
+
* Retorna a configuração de um recurso por service broker
|
|
7430
|
+
* Veja também o método "loadConfig"
|
|
7431
|
+
*/
|
|
7382
7432
|
async getConfig(key) {
|
|
7383
7433
|
let payload = {
|
|
7384
7434
|
"serviceName": "SystemUtilsSP.getConf",
|
|
@@ -7396,6 +7446,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7396
7446
|
.catch(error => reject(error));
|
|
7397
7447
|
});
|
|
7398
7448
|
}
|
|
7449
|
+
/**
|
|
7450
|
+
* Salva a configuração de determinado recurso.
|
|
7451
|
+
*/
|
|
7399
7452
|
async saveConfig(key, data) {
|
|
7400
7453
|
let payload = {
|
|
7401
7454
|
"serviceName": "SystemUtilsSP.saveConf",
|
|
@@ -7414,19 +7467,31 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7414
7467
|
.catch(error => reject(error));
|
|
7415
7468
|
});
|
|
7416
7469
|
}
|
|
7470
|
+
/**
|
|
7471
|
+
* Acessa informações de contexto "empurrados" na abertura da tela
|
|
7472
|
+
*/
|
|
7417
7473
|
async getAttributeFromHTMLWrapper(attribName) {
|
|
7418
7474
|
return Promise.resolve(window[attribName]);
|
|
7419
7475
|
}
|
|
7476
|
+
/**
|
|
7477
|
+
* Abre determinada tela, repassando pkObject
|
|
7478
|
+
*/
|
|
7420
7479
|
async openApp(resourceId, pkObject) {
|
|
7421
7480
|
Workspace.openAppActivity(resourceId, pkObject);
|
|
7422
7481
|
}
|
|
7482
|
+
/**
|
|
7483
|
+
* Cria o DataUnit a partir do nome da entidade.
|
|
7484
|
+
*/
|
|
7423
7485
|
async createDataunit(entityName) {
|
|
7424
7486
|
return new Promise(resolve => {
|
|
7425
7487
|
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
|
|
7426
7488
|
dataUnit.loadMetadata().then(() => resolve(dataUnit));
|
|
7427
7489
|
});
|
|
7428
7490
|
}
|
|
7429
|
-
|
|
7491
|
+
/**
|
|
7492
|
+
* Cria e armazena o DataUnit em um cache
|
|
7493
|
+
*/
|
|
7494
|
+
async getDataUnit(entityName, dataUnitName) {
|
|
7430
7495
|
return new Promise((resolve, reject) => {
|
|
7431
7496
|
const dataUnit = this._duCache.get(dataUnitName);
|
|
7432
7497
|
if (dataUnit) {
|
|
@@ -7442,30 +7507,57 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7442
7507
|
}
|
|
7443
7508
|
});
|
|
7444
7509
|
}
|
|
7510
|
+
/**
|
|
7511
|
+
* Retorna o resourceID da tela em questão.
|
|
7512
|
+
*/
|
|
7445
7513
|
async getResourceID() {
|
|
7446
7514
|
return Promise.resolve(this.resourceID);
|
|
7447
7515
|
}
|
|
7516
|
+
/**
|
|
7517
|
+
* Mostra o diálogo de alerta de acordo com os parâmetros passados.
|
|
7518
|
+
*/
|
|
7448
7519
|
async alert(title, message, icon, options) {
|
|
7449
7520
|
return ApplicationUtils.alert(title, message, icon, options);
|
|
7450
7521
|
}
|
|
7522
|
+
/**
|
|
7523
|
+
* Mostra o diálogo de erro de acordo com os parâmetros passados.
|
|
7524
|
+
*/
|
|
7451
7525
|
async error(title, message, icon, options) {
|
|
7452
7526
|
return ApplicationUtils.error(title, message, icon, options);
|
|
7453
7527
|
}
|
|
7528
|
+
/**
|
|
7529
|
+
* Exibe um diálogo de confirmação
|
|
7530
|
+
*/
|
|
7454
7531
|
async confirm(title, message, icon, critical, options) {
|
|
7455
7532
|
return ApplicationUtils.confirm(title, message, icon, critical, options);
|
|
7456
7533
|
}
|
|
7534
|
+
/**
|
|
7535
|
+
* Mostra uma informação efêmera (de segundo plano).
|
|
7536
|
+
*/
|
|
7457
7537
|
async info(message, options) {
|
|
7458
7538
|
return ApplicationUtils.info(message, options);
|
|
7459
7539
|
}
|
|
7540
|
+
/**
|
|
7541
|
+
* Busca a configuração de formulário.
|
|
7542
|
+
*/
|
|
7460
7543
|
async loadFormConfig(name) {
|
|
7461
7544
|
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7462
7545
|
}
|
|
7546
|
+
/**
|
|
7547
|
+
* Busca a configuração de grade.
|
|
7548
|
+
*/
|
|
7463
7549
|
async loadGridConfig(name) {
|
|
7464
7550
|
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
|
7465
7551
|
}
|
|
7552
|
+
/**
|
|
7553
|
+
* Salva a configuração de grade.
|
|
7554
|
+
*/
|
|
7466
7555
|
async saveGridConfig(config) {
|
|
7467
7556
|
return this.gridConfigFetcher.saveConfig(config, this.resourceID);
|
|
7468
7557
|
}
|
|
7558
|
+
async getAuthList(_auth) {
|
|
7559
|
+
return await (new MGEAuthorization()).parseFromJSON(_auth);
|
|
7560
|
+
}
|
|
7469
7561
|
get urlParams() {
|
|
7470
7562
|
if (!this._urlParams) {
|
|
7471
7563
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -7609,7 +7701,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7609
7701
|
"getAttributeFromHTMLWrapper": [64],
|
|
7610
7702
|
"openApp": [64],
|
|
7611
7703
|
"createDataunit": [64],
|
|
7612
|
-
"
|
|
7704
|
+
"getDataUnit": [64],
|
|
7613
7705
|
"getResourceID": [64],
|
|
7614
7706
|
"alert": [64],
|
|
7615
7707
|
"error": [64],
|
|
@@ -8,10 +8,18 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
10
10
|
this.__registerHost();
|
|
11
|
-
this.insertionMode = createEvent(this, "insertionMode", 7);
|
|
12
11
|
this.dataStateChange = createEvent(this, "dataStateChange", 7);
|
|
13
12
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 7);
|
|
13
|
+
this.insertionMode = createEvent(this, "insertionMode", 7);
|
|
14
14
|
this._onDataUnitResolve = [];
|
|
15
|
+
/**
|
|
16
|
+
* Determina quantas linhas são retornadas por página
|
|
17
|
+
*/
|
|
18
|
+
this.pageSize = 150;
|
|
19
|
+
/**
|
|
20
|
+
* Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit
|
|
21
|
+
*/
|
|
22
|
+
this.autoLoad = true;
|
|
15
23
|
this._dataUnitObserver = (action) => {
|
|
16
24
|
let msg = this.getActionInfo(action.type);
|
|
17
25
|
if (msg) {
|
|
@@ -37,6 +45,38 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
37
45
|
this.dataState = duState;
|
|
38
46
|
};
|
|
39
47
|
}
|
|
48
|
+
observePageSize() {
|
|
49
|
+
if (this.dataUnit) {
|
|
50
|
+
this.dataUnit.pageSize = this.pageSize;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
observeDataUnitName(newValue, oldValue) {
|
|
54
|
+
if (oldValue != newValue) {
|
|
55
|
+
this.dataUnit = undefined;
|
|
56
|
+
this.dataUnitName = newValue;
|
|
57
|
+
this.loadDataUnit();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
observeEntityName(newValue, oldValue) {
|
|
61
|
+
if (oldValue != newValue) {
|
|
62
|
+
this.dataUnit = undefined;
|
|
63
|
+
this.entityName = newValue;
|
|
64
|
+
this.loadDataUnit();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
observeDataState(newValue, oldValue) {
|
|
68
|
+
if (oldValue != newValue) {
|
|
69
|
+
this.dataStateChange.emit(newValue);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
observeDataUnit() {
|
|
73
|
+
this.dataUnitReady.emit(this.dataUnit);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Pode-se obter o dataUnit através desse método. Outra forma, é ouvir o evento de
|
|
77
|
+
*
|
|
78
|
+
* @returns dataUnit
|
|
79
|
+
*/
|
|
40
80
|
async getDataUnit() {
|
|
41
81
|
return new Promise((resolve) => {
|
|
42
82
|
if (this.dataUnit) {
|
|
@@ -89,44 +129,16 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
89
129
|
if (this.messageBuilder) {
|
|
90
130
|
return this.messageBuilder(action, this.dataState, this.dataUnit);
|
|
91
131
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return this.i18n("components.editionCanceled");
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
observePageSize() {
|
|
99
|
-
if (this.dataUnit) {
|
|
100
|
-
this.dataUnit.pageSize = this.pageSize;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
observeDataUnitName(newValue, oldValue) {
|
|
104
|
-
if (oldValue != newValue) {
|
|
105
|
-
this.dataUnit = undefined;
|
|
106
|
-
this.dataUnitName = newValue;
|
|
107
|
-
this.loadDataUnit();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
observeEntityName(newValue, oldValue) {
|
|
111
|
-
if (oldValue != newValue) {
|
|
112
|
-
this.dataUnit = undefined;
|
|
113
|
-
this.entityName = newValue;
|
|
114
|
-
this.loadDataUnit();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
observeDataState(newValue, oldValue) {
|
|
118
|
-
if (oldValue != newValue) {
|
|
119
|
-
this.dataStateChange.emit(newValue);
|
|
132
|
+
if (action === Action.EDITION_CANCELED) {
|
|
133
|
+
return this.i18n("components.editionCanceled");
|
|
120
134
|
}
|
|
121
135
|
}
|
|
122
|
-
observeDataUnit() {
|
|
123
|
-
this.dataUnitReady.emit(this.dataUnit);
|
|
124
|
-
}
|
|
125
136
|
async loadDataUnit() {
|
|
126
137
|
if (!this.dataUnit) {
|
|
127
138
|
const app = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
128
139
|
if (app && this.entityName) {
|
|
129
|
-
this.
|
|
140
|
+
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
|
141
|
+
this.dataUnit = await app.getDataUnit(this.entityName, cacheName);
|
|
130
142
|
this.dataUnit.pageSize = this.pageSize;
|
|
131
143
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
|
132
144
|
this.dataUnit.addInterceptor(this);
|
|
@@ -151,6 +163,9 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
151
163
|
};
|
|
152
164
|
return pt_br[key];
|
|
153
165
|
}
|
|
166
|
+
//---------------------------------------------
|
|
167
|
+
// Lifecycle web component
|
|
168
|
+
//---------------------------------------------
|
|
154
169
|
componentDidRender() {
|
|
155
170
|
this.loadDataUnit();
|
|
156
171
|
}
|