@sankhyalabs/sankhyablocks 1.3.31-beta.7 → 1.3.31-beta.9
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-532bcc28.js → index-c6671817.js} +0 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +67 -24
- package/dist/cjs/snk-crud.cjs.entry.js +64 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +14 -4
- package/dist/cjs/snk-form_2.cjs.entry.js +170 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-9d47b416.js → taskbar-elements-7f99f0c9.js} +2 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +2 -2
- package/dist/collection/components/snk-application/snk-application.js +71 -25
- package/dist/collection/components/snk-crud/snk-crud.css +5 -0
- package/dist/collection/components/snk-crud/snk-crud.js +149 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +27 -3
- package/dist/collection/components/snk-form/snk-form.js +59 -22
- package/dist/collection/components/snk-grid/snk-grid.js +33 -13
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +1 -1
- package/dist/components/snk-application2.js +66 -23
- package/dist/components/snk-crud.d.ts +11 -0
- package/dist/components/snk-crud.js +102 -0
- package/dist/components/snk-data-unit.js +13 -3
- package/dist/components/snk-form.js +1 -116
- package/dist/components/snk-form2.js +134 -0
- package/dist/components/snk-grid.js +1 -83
- package/dist/components/snk-grid2.js +91 -0
- package/dist/components/snk-taskbar2.js +1 -1
- package/dist/esm/{index-0b078db7.js → index-6a83ac96.js} +0 -3
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +67 -24
- package/dist/esm/snk-crud.entry.js +60 -0
- package/dist/esm/snk-data-unit.entry.js +14 -4
- package/dist/esm/snk-form_2.entry.js +165 -0
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-3ba30bf4.js → taskbar-elements-e0b8a285.js} +2 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-bc14f01e.entry.js → p-18fe0469.entry.js} +2 -2
- package/dist/sankhyablocks/p-4e2fcfe4.entry.js +1 -0
- package/dist/sankhyablocks/{p-1c19b89c.entry.js → p-5e2e9334.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8f7b9a85.entry.js → p-7fe9e5c2.entry.js} +1 -1
- package/dist/sankhyablocks/p-8650ae26.entry.js +1 -0
- package/dist/sankhyablocks/p-a5439706.js +1 -0
- package/dist/sankhyablocks/p-c3d20542.entry.js +1 -0
- package/dist/sankhyablocks/p-cd1dc099.js +2 -0
- package/dist/sankhyablocks/{p-a8305c35.entry.js → p-d25637c9.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +12 -3
- package/dist/types/components.d.ts +48 -5
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +0 -95
- package/dist/cjs/snk-grid.cjs.entry.js +0 -64
- package/dist/esm/snk-form.entry.js +0 -91
- package/dist/esm/snk-grid.entry.js +0 -60
- package/dist/sankhyablocks/p-21c2457b.entry.js +0 -1
- package/dist/sankhyablocks/p-560fdf54.entry.js +0 -1
- package/dist/sankhyablocks/p-574764bf.js +0 -1
- package/dist/sankhyablocks/p-9c225717.entry.js +0 -1
- package/dist/sankhyablocks/p-a45dba1a.js +0 -2
|
@@ -1040,9 +1040,6 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1040
1040
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1041
1041
|
const instance = hostRef.$lazyInstance$ ;
|
|
1042
1042
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1043
|
-
{
|
|
1044
|
-
safeCall(instance, 'componentDidRender');
|
|
1045
|
-
}
|
|
1046
1043
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1047
1044
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1048
1045
|
{
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["
|
|
17
|
+
return index.bootstrapLazy([["snk-crud.cjs",[[6,"snk-crud",{"configName":[1,"config-name"],"formTitle":[1,"form-title"],"actionsList":[16],"recordsValidator":[8,"records-validator"],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-form_2.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"recordsValidator":[8,"records-validator"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}],[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-c6671817.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["
|
|
18
|
+
return index.bootstrapLazy([["snk-crud.cjs",[[6,"snk-crud",{"configName":[1,"config-name"],"formTitle":[1,"form-title"],"actionsList":[16],"recordsValidator":[8,"records-validator"],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-form_2.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"recordsValidator":[8,"records-validator"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}],[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
|
|
@@ -7267,7 +7267,7 @@ class SnkErrorHandler {
|
|
|
7267
7267
|
}
|
|
7268
7268
|
else {
|
|
7269
7269
|
const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
|
|
7270
|
-
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${exception}"`;
|
|
7270
|
+
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${core.ObjectUtils.objectToString(exception)}"`;
|
|
7271
7271
|
this._app.error(title, message);
|
|
7272
7272
|
}
|
|
7273
7273
|
}
|
|
@@ -7285,7 +7285,9 @@ const SnkApplication = class {
|
|
|
7285
7285
|
index.registerInstance(this, hostRef);
|
|
7286
7286
|
this.applicationLoaded = index.createEvent(this, "applicationLoaded", 7);
|
|
7287
7287
|
this.applicationLoading = index.createEvent(this, "applicationLoading", 7);
|
|
7288
|
+
this._authPromises = [];
|
|
7288
7289
|
this._duCache = new Map();
|
|
7290
|
+
this._duPromises = new Map();
|
|
7289
7291
|
this._requestListener = new RequestListenerLoadingBar();
|
|
7290
7292
|
}
|
|
7291
7293
|
get parameters() {
|
|
@@ -7304,17 +7306,27 @@ const SnkApplication = class {
|
|
|
7304
7306
|
return this._resourceID;
|
|
7305
7307
|
}
|
|
7306
7308
|
get auth() {
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
this.
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7309
|
+
if (this._auth) {
|
|
7310
|
+
return Promise.resolve(this._auth);
|
|
7311
|
+
}
|
|
7312
|
+
else {
|
|
7313
|
+
return new Promise((resolve, reject) => {
|
|
7314
|
+
const waitingAuth = this._authPromises.length > 0;
|
|
7315
|
+
this._authPromises.push(new PendingPromise(resolve, reject));
|
|
7316
|
+
if (!waitingAuth) {
|
|
7317
|
+
this.authFetcher.getData(this._resourceID).then((authList) => {
|
|
7318
|
+
this._auth = authList;
|
|
7319
|
+
while (this._authPromises.length > 0) {
|
|
7320
|
+
this._authPromises.pop().resolve(this._auth);
|
|
7321
|
+
}
|
|
7322
|
+
}).catch(error => {
|
|
7323
|
+
while (this._authPromises.length > 0) {
|
|
7324
|
+
this._authPromises.pop().reject(error);
|
|
7325
|
+
}
|
|
7326
|
+
});
|
|
7327
|
+
}
|
|
7328
|
+
});
|
|
7329
|
+
}
|
|
7318
7330
|
}
|
|
7319
7331
|
/**
|
|
7320
7332
|
* Caso o usuário logado seja o SUP.
|
|
@@ -7482,17 +7494,45 @@ const SnkApplication = class {
|
|
|
7482
7494
|
async openApp(resourceId, pkObject) {
|
|
7483
7495
|
Workspace.openAppActivity(resourceId, pkObject);
|
|
7484
7496
|
}
|
|
7497
|
+
getDuPromissesStack(dataUnitName) {
|
|
7498
|
+
let stack;
|
|
7499
|
+
if (dataUnitName) {
|
|
7500
|
+
stack = this._duPromises.get(dataUnitName);
|
|
7501
|
+
if (!stack) {
|
|
7502
|
+
stack = [];
|
|
7503
|
+
this._duPromises.set(dataUnitName, stack);
|
|
7504
|
+
}
|
|
7505
|
+
}
|
|
7506
|
+
return stack || [];
|
|
7507
|
+
}
|
|
7485
7508
|
/**
|
|
7486
|
-
* Cria o DataUnit a partir do nome da entidade.
|
|
7509
|
+
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
|
7510
|
+
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado
|
|
7487
7511
|
*/
|
|
7488
|
-
async createDataunit(entityName) {
|
|
7489
|
-
return new Promise(resolve => {
|
|
7490
|
-
const
|
|
7491
|
-
|
|
7512
|
+
async createDataunit(entityName, dataUnitName) {
|
|
7513
|
+
return new Promise((resolve, reject) => {
|
|
7514
|
+
const duPromisses = this.getDuPromissesStack(dataUnitName);
|
|
7515
|
+
const waitingDu = duPromisses.length > 0;
|
|
7516
|
+
duPromisses.push(new PendingPromise(resolve, reject));
|
|
7517
|
+
if (!waitingDu) {
|
|
7518
|
+
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
|
|
7519
|
+
dataUnit.loadMetadata().then(() => {
|
|
7520
|
+
if (dataUnitName) {
|
|
7521
|
+
this._duCache.set(dataUnitName, dataUnit);
|
|
7522
|
+
}
|
|
7523
|
+
while (duPromisses.length > 0) {
|
|
7524
|
+
duPromisses.pop().resolve(dataUnit);
|
|
7525
|
+
}
|
|
7526
|
+
}).catch(reason => {
|
|
7527
|
+
while (duPromisses.length > 0) {
|
|
7528
|
+
duPromisses.pop().reject(reason);
|
|
7529
|
+
}
|
|
7530
|
+
});
|
|
7531
|
+
}
|
|
7492
7532
|
});
|
|
7493
7533
|
}
|
|
7494
7534
|
/**
|
|
7495
|
-
*
|
|
7535
|
+
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
|
7496
7536
|
*/
|
|
7497
7537
|
async getDataUnit(entityName, dataUnitName) {
|
|
7498
7538
|
return new Promise((resolve, reject) => {
|
|
@@ -7501,10 +7541,7 @@ const SnkApplication = class {
|
|
|
7501
7541
|
resolve(dataUnit);
|
|
7502
7542
|
}
|
|
7503
7543
|
else {
|
|
7504
|
-
this.createDataunit(entityName).then(dataUnit => {
|
|
7505
|
-
if (dataUnitName) {
|
|
7506
|
-
this._duCache.set(dataUnitName, dataUnit);
|
|
7507
|
-
}
|
|
7544
|
+
this.createDataunit(entityName, dataUnitName).then(dataUnit => {
|
|
7508
7545
|
resolve(dataUnit);
|
|
7509
7546
|
}).catch(reason => reject(reason));
|
|
7510
7547
|
}
|
|
@@ -7676,9 +7713,9 @@ const SnkApplication = class {
|
|
|
7676
7713
|
});
|
|
7677
7714
|
core.ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
|
7678
7715
|
core.ErrorTracking.init();
|
|
7679
|
-
core.ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
|
7680
7716
|
}
|
|
7681
7717
|
connectedCallback() {
|
|
7718
|
+
core.ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
|
7682
7719
|
DataFetcher.addRequestListener(this._requestListener);
|
|
7683
7720
|
}
|
|
7684
7721
|
disconnectedCallback() {
|
|
@@ -7717,6 +7754,12 @@ class RequestListenerLoadingBar {
|
|
|
7717
7754
|
}
|
|
7718
7755
|
;
|
|
7719
7756
|
}
|
|
7757
|
+
class PendingPromise {
|
|
7758
|
+
constructor(resolve, reject) {
|
|
7759
|
+
this.resolve = resolve;
|
|
7760
|
+
this.reject = reject;
|
|
7761
|
+
}
|
|
7762
|
+
}
|
|
7720
7763
|
SnkApplication.style = snkApplicationCss;
|
|
7721
7764
|
|
|
7722
7765
|
exports.snk_application = SnkApplication;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
|
+
|
|
7
|
+
const snkCrudCss = ".sc-snk-crud-h{display:flex;height:100%;width:100%}";
|
|
8
|
+
|
|
9
|
+
const GRID_MODE = 0;
|
|
10
|
+
const FORM_MODE = 1;
|
|
11
|
+
const SnkCrud = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
}
|
|
15
|
+
async gridToForm(keepFormMode = false) {
|
|
16
|
+
this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE;
|
|
17
|
+
this._viewStack.show(FORM_MODE);
|
|
18
|
+
}
|
|
19
|
+
async executeAction(act) {
|
|
20
|
+
if (act === "GRID_MODE") {
|
|
21
|
+
this._viewStack.show(GRID_MODE);
|
|
22
|
+
}
|
|
23
|
+
else if (act === "FORM_MODE" || act === "UPDATE") {
|
|
24
|
+
this.gridToForm(act !== "UPDATE");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
insertionModeHandler() {
|
|
28
|
+
this.gridToForm();
|
|
29
|
+
}
|
|
30
|
+
cancelHandler() {
|
|
31
|
+
if (this._backToGrid) {
|
|
32
|
+
this._viewStack.show(GRID_MODE);
|
|
33
|
+
}
|
|
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._snkDataUnit.addEventListener("insertionMode", () => this.insertionModeHandler());
|
|
41
|
+
this._snkDataUnit.addEventListener("cancelEdition", () => this.cancelHandler());
|
|
42
|
+
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
43
|
+
this._dataState = this._snkDataUnit.dataState;
|
|
44
|
+
if (!this._dataUnit) {
|
|
45
|
+
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
46
|
+
this._dataUnit = evt.detail;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
|
|
50
|
+
this._dataState = evt.detail;
|
|
51
|
+
});
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
parent = parent.parentElement;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, index.h("stack-item", null, index.h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList }, index.h("slot", null))), index.h("stack-item", null, index.h("snk-form", { formTitle: this.formTitle, configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE), recordsValidator: this.recordsValidator, onActionClick: evt => this.executeAction(evt.detail) }))));
|
|
59
|
+
}
|
|
60
|
+
get _element() { return index.getElement(this); }
|
|
61
|
+
};
|
|
62
|
+
SnkCrud.style = snkCrudCss;
|
|
63
|
+
|
|
64
|
+
exports.snk_crud = SnkCrud;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
|
|
@@ -14,6 +14,7 @@ const SnkDataUnit = class {
|
|
|
14
14
|
this.dataStateChange = index.createEvent(this, "dataStateChange", 7);
|
|
15
15
|
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 7);
|
|
16
16
|
this.insertionMode = index.createEvent(this, "insertionMode", 7);
|
|
17
|
+
this.cancelEdition = index.createEvent(this, "cancelEdition", 7);
|
|
17
18
|
this._onDataUnitResolve = [];
|
|
18
19
|
/**
|
|
19
20
|
* Determina quantas linhas são retornadas por página
|
|
@@ -34,12 +35,16 @@ const SnkDataUnit = class {
|
|
|
34
35
|
if (action.type === core.Action.RECORDS_ADDED || action.type === core.Action.RECORDS_COPIED) {
|
|
35
36
|
this.insertionMode.emit();
|
|
36
37
|
}
|
|
38
|
+
if (action.type === core.Action.EDITION_CANCELED) {
|
|
39
|
+
this.cancelEdition.emit();
|
|
40
|
+
}
|
|
37
41
|
const duState = {
|
|
38
42
|
insertionMode: false,
|
|
39
43
|
hasNext: this.dataUnit.hasNext(),
|
|
40
44
|
hasPrevious: this.dataUnit.hasPrevious(),
|
|
41
45
|
copyMode: false,
|
|
42
46
|
isDirty: this.dataUnit.isDirty(),
|
|
47
|
+
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
|
43
48
|
selectedRecords: this.dataUnit.getSelectedRecords()
|
|
44
49
|
};
|
|
45
50
|
this.dataUnit.records.forEach(r => {
|
|
@@ -119,8 +124,13 @@ const SnkDataUnit = class {
|
|
|
119
124
|
}
|
|
120
125
|
break;
|
|
121
126
|
case core.Action.EDITION_CANCELED:
|
|
122
|
-
|
|
123
|
-
.
|
|
127
|
+
if (this.dataState.hasDirtyRecords) {
|
|
128
|
+
utils.ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
129
|
+
.then((result) => resolve(result ? action : undefined));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
resolve(action);
|
|
133
|
+
}
|
|
124
134
|
break;
|
|
125
135
|
case core.Action.REMOVING_RECORDS:
|
|
126
136
|
let msg = undefined;
|
|
@@ -188,7 +198,7 @@ const SnkDataUnit = class {
|
|
|
188
198
|
//---------------------------------------------
|
|
189
199
|
// Lifecycle web component
|
|
190
200
|
//---------------------------------------------
|
|
191
|
-
|
|
201
|
+
componentWillLoad() {
|
|
192
202
|
this.loadDataUnit();
|
|
193
203
|
}
|
|
194
204
|
render() {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
const taskbarElements = require('./taskbar-elements-7f99f0c9.js');
|
|
8
|
+
|
|
9
|
+
const snkFormCss = ".sc-snk-form-h{display:block}";
|
|
10
|
+
|
|
11
|
+
const SnkForm = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.exit = index.createEvent(this, "exit", 7);
|
|
15
|
+
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
16
|
+
}
|
|
17
|
+
getFormConfig() {
|
|
18
|
+
return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
|
|
19
|
+
}
|
|
20
|
+
getInsertionHiddenFields(formConfig) {
|
|
21
|
+
const hiddenFields = [];
|
|
22
|
+
formConfig === null || formConfig === void 0 ? void 0 : formConfig.forEach(cfg => {
|
|
23
|
+
const def = this._dataUnit.getField(cfg.name);
|
|
24
|
+
if (def === null || def === void 0 ? void 0 : def.readOnly) {
|
|
25
|
+
hiddenFields.push(cfg.name);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return hiddenFields;
|
|
29
|
+
}
|
|
30
|
+
exitForm() {
|
|
31
|
+
if (this._dataUnit.isDirty()) {
|
|
32
|
+
this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.exit.emit();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
getDisabledButtons() {
|
|
39
|
+
const disabled = [];
|
|
40
|
+
if (!this._dataState.hasPrevious) {
|
|
41
|
+
disabled.push("PREVIOUS");
|
|
42
|
+
}
|
|
43
|
+
if (!this._dataState.hasNext) {
|
|
44
|
+
disabled.push("NEXT");
|
|
45
|
+
}
|
|
46
|
+
return disabled;
|
|
47
|
+
}
|
|
48
|
+
loadInsertionConfig() {
|
|
49
|
+
if (this._dataUnit && this._configLoaded) {
|
|
50
|
+
this._insertionFormConfig = this._editionFormConfig.filter(fieldCfg => {
|
|
51
|
+
const def = this._dataUnit.getField(fieldCfg.name);
|
|
52
|
+
if (def === null || def === void 0 ? void 0 : def.readOnly) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
i18n(key) {
|
|
60
|
+
const pt_br = {
|
|
61
|
+
"components.back": "Voltar"
|
|
62
|
+
};
|
|
63
|
+
return pt_br[key];
|
|
64
|
+
}
|
|
65
|
+
componentWillLoad() {
|
|
66
|
+
const snkApplication = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
67
|
+
if (snkApplication) {
|
|
68
|
+
snkApplication.loadFormConfig(this.configName).then(cfg => {
|
|
69
|
+
this._configLoaded = true;
|
|
70
|
+
this._editionFormConfig = cfg;
|
|
71
|
+
this.loadInsertionConfig();
|
|
72
|
+
});
|
|
73
|
+
//Forçamos a carga dos acessos pra aproveitar a request inicial.
|
|
74
|
+
snkApplication.getAllAccess();
|
|
75
|
+
}
|
|
76
|
+
let parent = this._element.parentElement;
|
|
77
|
+
while (parent) {
|
|
78
|
+
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
79
|
+
this._snkDataUnit = parent;
|
|
80
|
+
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
81
|
+
this._dataState = this._snkDataUnit.dataState;
|
|
82
|
+
if (this._dataUnit) {
|
|
83
|
+
this.loadInsertionConfig();
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
87
|
+
this._dataUnit = evt.detail;
|
|
88
|
+
this.loadInsertionConfig();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
|
|
92
|
+
this._dataState = evt.detail;
|
|
93
|
+
});
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
parent = parent.parentElement;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
if (!this._configLoaded || !this._dataUnit || !this._dataState) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return (index.h("section", { class: "ez-padding--large" }, index.h("div", { class: "ez-row ez-padding-bottom--medium" }, index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, index.h("ez-button", { title: this.i18n("components.back"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), index.h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.formTitle)), index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, index.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 }))), index.h("div", { class: "ez-padding--small" }), index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
|
|
104
|
+
}
|
|
105
|
+
get _element() { return index.getElement(this); }
|
|
106
|
+
};
|
|
107
|
+
SnkForm.style = snkFormCss;
|
|
108
|
+
|
|
109
|
+
const snkGridCss = ".sc-snk-grid-h{display:flex;height:100%;width:100%}";
|
|
110
|
+
|
|
111
|
+
const SnkGrid = class {
|
|
112
|
+
constructor(hostRef) {
|
|
113
|
+
index.registerInstance(this, hostRef);
|
|
114
|
+
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
115
|
+
this.gridDoubleClick = index.createEvent(this, "gridDoubleClick", 7);
|
|
116
|
+
}
|
|
117
|
+
getHeaderButtons() {
|
|
118
|
+
return this._dataState && this._dataState.selectedRecords.length > 0 ? "UPDATE,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,REFRESH" : "REFRESH";
|
|
119
|
+
}
|
|
120
|
+
actionClickHandler(evt) {
|
|
121
|
+
if (evt.detail === taskbarElements.TaskbarElement.CONFIG_GRID && this._grid) {
|
|
122
|
+
this._grid.openGridConfig();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
saveConfig(config) {
|
|
126
|
+
const snkApplication = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
127
|
+
if (snkApplication) {
|
|
128
|
+
snkApplication.saveGridConfig(config);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
componentWillLoad() {
|
|
132
|
+
const snkApplication = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
133
|
+
if (snkApplication) {
|
|
134
|
+
snkApplication.loadGridConfig(this.configName).then(cfg => {
|
|
135
|
+
this._gridConfig = cfg;
|
|
136
|
+
this._configLoaded = true;
|
|
137
|
+
});
|
|
138
|
+
//Forçamos a carga dos acessos pra aproveitar a request inicial.
|
|
139
|
+
snkApplication.getAllAccess();
|
|
140
|
+
}
|
|
141
|
+
let parent = this._element.parentElement;
|
|
142
|
+
while (parent) {
|
|
143
|
+
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
144
|
+
this._snkDataUnit = parent;
|
|
145
|
+
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
146
|
+
if (!this._dataUnit) {
|
|
147
|
+
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
148
|
+
this._dataUnit = evt.detail;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
|
|
152
|
+
this._dataState = evt.detail;
|
|
153
|
+
});
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
parent = parent.parentElement;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
if (!this._configLoaded || !this._dataUnit) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
return (index.h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "ez-row ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("div", { class: "ez-col ez-col--sd-9 ez-col--tb-9 ez-align--bottom" }, index.h("slot", null)), index.h("div", { class: "ez-col ez-col--sd-3 ez-col--tb-3 ez-align--right" }, index.h("snk-taskbar", { onActionClick: evt => this.actionClickHandler(evt), key: "topTaskbar", dataUnit: this._dataUnit, buttons: "FORM_MODE,CONFIG_GRID,INSERT", primaryButton: "INSERT" }))), index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: evt => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit() }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this.getHeaderButtons(), slot: "leftButtons", actionsList: this.actionsList }))));
|
|
164
|
+
}
|
|
165
|
+
get _element() { return index.getElement(this); }
|
|
166
|
+
};
|
|
167
|
+
SnkGrid.style = snkGridCss;
|
|
168
|
+
|
|
169
|
+
exports.snk_form = SnkForm;
|
|
170
|
+
exports.snk_grid = SnkGrid;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
|
|
8
8
|
const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--title--primary, #2B3A54);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const taskbarElements = require('./taskbar-elements-
|
|
7
|
+
const taskbarElements = require('./taskbar-elements-7f99f0c9.js');
|
|
8
8
|
|
|
9
9
|
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-c6671817.js');
|
|
4
4
|
|
|
5
5
|
exports.TaskbarElement = void 0;
|
|
6
6
|
(function (TaskbarElement) {
|
|
@@ -54,7 +54,7 @@ const buildElem = (element, className, getTitle, action, isEnabled, actions) =>
|
|
|
54
54
|
case exports.TaskbarElement.CONFIG_GRID:
|
|
55
55
|
return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
|
|
56
56
|
case exports.TaskbarElement.MORE_OPTIONS:
|
|
57
|
-
return index.h("ez-actions-button", { size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions });
|
|
57
|
+
return actions && actions.length > 0 ? index.h("ez-actions-button", { title: getTitle(element), size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions }) : undefined;
|
|
58
58
|
case exports.TaskbarElement.DIVIDER:
|
|
59
59
|
return index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
|
|
60
60
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"./components/snk-application/snk-application.js",
|
|
4
4
|
"./components/snk-data-unit/snk-data-unit.js",
|
|
5
5
|
"./components/snk-taskbar/snk-taskbar.js",
|
|
6
|
+
"./components/snk-crud/snk-crud.js",
|
|
6
7
|
"./components/snk-form/snk-form.js",
|
|
7
8
|
"./components/snk-grid/snk-grid.js",
|
|
8
9
|
"./components/snk-pesquisa/snk-pesquisa.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WarningException, WaitingChangeException, ErrorException } from "@sankhyalabs/core";
|
|
1
|
+
import { WarningException, WaitingChangeException, ErrorException, ObjectUtils } from "@sankhyalabs/core";
|
|
2
2
|
export class SnkErrorHandler {
|
|
3
3
|
constructor(app) {
|
|
4
4
|
this._app = app;
|
|
@@ -43,7 +43,7 @@ export class SnkErrorHandler {
|
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
|
|
46
|
-
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${exception}"`;
|
|
46
|
+
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${ObjectUtils.objectToString(exception)}"`;
|
|
47
47
|
this._app.error(title, message);
|
|
48
48
|
}
|
|
49
49
|
}
|