@sankhyalabs/sankhyablocks 8.3.2 → 8.4.0-dev.2
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/{ConfigStorage-4dd5e72c.js → ConfigStorage-0e4275f5.js} +163 -51
- package/dist/cjs/{DataFetcher-65199c00.js → DataFetcher-bd3d53a8.js} +78 -234
- package/dist/cjs/ISave-d68ce3cd.js +8 -0
- package/dist/cjs/PrintUtils-bcaeb82f.js +215 -0
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
- package/dist/cjs/{SnkFormConfigManager-44717597.js → SnkFormConfigManager-5b485cd4.js} +19 -21
- package/dist/cjs/{auth-fetcher-7ed6d3e3.js → auth-fetcher-1583fe43.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-102030d8.js → dataunit-fetcher-910be4ce.js} +1 -1
- package/dist/cjs/{form-config-fetcher-49993843.js → form-config-fetcher-f6cb55e6.js} +66 -3
- package/dist/cjs/index-f9e81701.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-23adae20.js → pesquisa-fetcher-3356b3df.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +19 -11
- package/dist/cjs/snk-application.cjs.entry.js +60 -44
- package/dist/cjs/snk-attach.cjs.entry.js +9 -14
- package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
- package/dist/cjs/snk-crud.cjs.entry.js +28 -11
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -2
- package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-7cc1846d.js} +5 -5
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +17 -13
- package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -17
- package/dist/cjs/snk-filter-detail.cjs.entry.js +7 -16
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +6 -19
- package/dist/cjs/snk-form-config.cjs.entry.js +7 -17
- package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
- package/dist/cjs/snk-form.cjs.entry.js +13 -8
- package/dist/cjs/snk-grid-config.cjs.entry.js +6 -6
- package/dist/cjs/snk-grid.cjs.entry.js +23 -22
- package/dist/cjs/{snk-guides-viewer-83cd2f15.js → snk-guides-viewer-5e22097d.js} +19 -8
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -16
- package/dist/cjs/snk-print-selector.cjs.entry.js +2 -4
- package/dist/cjs/snk-simple-crud.cjs.entry.js +43 -85
- package/dist/cjs/snk-taskbar-custom-elements.cjs.entry.js +20 -0
- package/dist/cjs/snk-taskbar.cjs.entry.js +71 -5
- package/dist/cjs/{taskbar-elements-b98dd6e9.js → taskbar-elements-39949c7a.js} +4 -4
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
- package/dist/collection/components/snk-application/snk-application.js +120 -65
- package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
- package/dist/collection/components/snk-crud/snk-crud.js +44 -8
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +60 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +65 -28
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +22 -6
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +8 -13
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
- package/dist/collection/components/snk-form/snk-form.js +46 -2
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
- package/dist/collection/components/snk-grid/snk-grid.js +108 -16
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +23 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +4 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar-custom-elements.js +43 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +4 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +126 -5
- package/dist/collection/lib/configs/ConfigStorage.js +33 -44
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +23 -71
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +47 -32
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
- package/dist/collection/lib/index.js +10 -0
- package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
- package/dist/collection/lib/utils/PrintUtils.js +18 -9
- package/dist/collection/lib/utils/urlutils.js +29 -0
- package/dist/components/ConfigStorage.js +161 -48
- package/dist/components/DataFetcher.js +79 -234
- package/dist/components/PrintUtils.js +213 -0
- package/dist/components/ResourceIDUtils.js +10 -0
- package/dist/components/SnkFormConfigManager.js +17 -19
- package/dist/components/auth-fetcher.js +1 -1
- package/dist/components/form-config-fetcher.js +64 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-actions-button2.js +23 -9
- package/dist/components/snk-application2.js +145 -129
- package/dist/components/snk-attach2.js +1 -8
- package/dist/components/snk-configurator2.js +3 -1
- package/dist/components/snk-crud.js +27 -8
- package/dist/components/snk-data-unit2.js +6 -5
- package/dist/components/snk-detail-view2.js +26 -10
- package/dist/components/snk-entity-list.js +0 -4
- package/dist/components/snk-filter-bar2.js +12 -12
- package/dist/components/snk-filter-detail2.js +8 -13
- package/dist/components/snk-filter-modal-item2.js +5 -16
- package/dist/components/snk-form-config2.js +5 -15
- package/dist/components/snk-form-view2.js +6 -1
- package/dist/components/snk-form.js +9 -2
- package/dist/components/snk-grid-config2.js +4 -2
- package/dist/components/snk-grid2.js +24 -17
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-print-selector.js +1 -1
- package/dist/components/snk-simple-crud2.js +30 -73
- package/dist/components/snk-taskbar-custom-elements.d.ts +11 -0
- package/dist/components/snk-taskbar-custom-elements.js +35 -0
- package/dist/components/snk-taskbar2.js +81 -9
- package/dist/esm/{ConfigStorage-d0e26692.js → ConfigStorage-f359573c.js} +162 -49
- package/dist/esm/{DataFetcher-4f5ad71c.js → DataFetcher-8daff9ad.js} +79 -234
- package/dist/esm/ISave-4412b20c.js +8 -0
- package/dist/esm/PrintUtils-3e4ff0f5.js +213 -0
- package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
- package/dist/esm/{SnkFormConfigManager-457554ca.js → SnkFormConfigManager-35876bad.js} +19 -21
- package/dist/esm/{auth-fetcher-852e26c9.js → auth-fetcher-299fed55.js} +1 -1
- package/dist/esm/{dataunit-fetcher-97dd5148.js → dataunit-fetcher-bd8f9572.js} +1 -1
- package/dist/esm/{form-config-fetcher-ff72a867.js → form-config-fetcher-8ef7be16.js} +65 -3
- package/dist/esm/index-a7d3d3f1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-d82df64b.js → pesquisa-fetcher-27819123.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +19 -11
- package/dist/esm/snk-application.entry.js +60 -44
- package/dist/esm/snk-attach.entry.js +5 -10
- package/dist/esm/snk-configurator.entry.js +2 -1
- package/dist/esm/snk-crud.entry.js +30 -13
- package/dist/esm/snk-data-exporter.entry.js +3 -2
- package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-1715d2f1.js} +5 -5
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +17 -13
- package/dist/esm/snk-entity-list.entry.js +0 -4
- package/dist/esm/snk-filter-bar.entry.js +15 -17
- package/dist/esm/snk-filter-detail.entry.js +8 -17
- package/dist/esm/snk-filter-modal-item.entry.js +7 -20
- package/dist/esm/snk-form-config.entry.js +8 -18
- package/dist/esm/snk-form-view.entry.js +6 -1
- package/dist/esm/snk-form.entry.js +13 -8
- package/dist/esm/snk-grid-config.entry.js +6 -6
- package/dist/esm/snk-grid.entry.js +23 -22
- package/dist/esm/{snk-guides-viewer-202c3c4d.js → snk-guides-viewer-b0e32a7d.js} +19 -8
- package/dist/esm/snk-guides-viewer.entry.js +10 -9
- package/dist/esm/snk-personalized-filter.entry.js +14 -16
- package/dist/esm/snk-print-selector.entry.js +1 -3
- package/dist/esm/snk-simple-crud.entry.js +34 -76
- package/dist/esm/snk-taskbar-custom-elements.entry.js +16 -0
- package/dist/esm/snk-taskbar.entry.js +71 -5
- package/dist/esm/{taskbar-elements-2c761819.js → taskbar-elements-0a6b8b95.js} +4 -4
- package/dist/sankhyablocks/p-0df2ead8.entry.js +11 -0
- package/dist/sankhyablocks/p-324ce41e.entry.js +1 -0
- package/dist/sankhyablocks/p-34604220.entry.js +1 -0
- package/dist/sankhyablocks/p-648a7c72.entry.js +1 -0
- package/dist/sankhyablocks/p-688dcb4c.js +1 -0
- package/dist/sankhyablocks/p-6a38bda5.entry.js +1 -0
- package/dist/sankhyablocks/p-72fc257b.entry.js +1 -0
- package/dist/sankhyablocks/p-7bcd2f89.js +56 -0
- package/dist/sankhyablocks/p-7bd5aea7.js +1 -0
- package/dist/sankhyablocks/p-8014cc25.entry.js +1 -0
- package/dist/sankhyablocks/p-8d884fab.js +1 -0
- package/dist/sankhyablocks/p-928efcaa.entry.js +1 -0
- package/dist/sankhyablocks/p-989937ee.entry.js +1 -0
- package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
- package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
- package/dist/sankhyablocks/p-a7ee0e6f.entry.js +1 -0
- package/dist/sankhyablocks/p-ac0556a3.js +1 -0
- package/dist/sankhyablocks/p-af2d9aea.entry.js +1 -0
- package/dist/sankhyablocks/{p-435259af.js → p-b13cb8b5.js} +2 -2
- package/dist/sankhyablocks/p-b244640b.js +1 -0
- package/dist/sankhyablocks/p-bba91710.entry.js +1 -0
- package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
- package/dist/sankhyablocks/p-c870b530.js +26 -0
- package/dist/sankhyablocks/{p-a2493d11.js → p-c9841939.js} +1 -1
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
- package/dist/sankhyablocks/p-d708b4ab.entry.js +1 -0
- package/dist/sankhyablocks/p-d84bc5c1.js +1 -0
- package/dist/sankhyablocks/{p-7d9302e2.js → p-de76b8a8.js} +1 -1
- package/dist/sankhyablocks/p-e19014a9.entry.js +1 -0
- package/dist/sankhyablocks/p-e1cb1f0b.js +1 -0
- package/dist/sankhyablocks/p-e9b53a9a.entry.js +1 -0
- package/dist/sankhyablocks/p-ebf8c5df.entry.js +1 -0
- package/dist/sankhyablocks/p-ed5f1204.entry.js +1 -0
- package/dist/sankhyablocks/p-f94b999e.entry.js +1 -0
- package/dist/sankhyablocks/p-fb1ecd0b.entry.js +1 -0
- package/dist/sankhyablocks/p-fd15aaac.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
- package/dist/types/components/snk-application/snk-application.d.ts +9 -22
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +12 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -2
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
- package/dist/types/components/snk-form/snk-form.d.ts +9 -1
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +17 -1
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +2 -2
- package/dist/types/components/snk-taskbar/snk-taskbar-custom-elements.d.ts +7 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +27 -0
- package/dist/types/components.d.ts +203 -22
- package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -8
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
- package/dist/types/lib/index.d.ts +11 -0
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
- package/dist/types/lib/utils/PrintUtils.d.ts +1 -0
- package/dist/types/lib/utils/urlutils.d.ts +14 -0
- package/package.json +2 -2
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/filter-bar-config-fetcher-2ab64f92.js +0 -155
- package/dist/cjs/resource-fetcher-8d12fee7.js +0 -68
- package/dist/components/filter-bar-config-fetcher.js +0 -153
- package/dist/components/resource-fetcher.js +0 -66
- package/dist/esm/filter-bar-config-fetcher-1093db95.js +0 -153
- package/dist/esm/resource-fetcher-be4d1ba4.js +0 -66
- package/dist/sankhyablocks/p-030a2da4.entry.js +0 -1
- package/dist/sankhyablocks/p-1208becf.entry.js +0 -1
- package/dist/sankhyablocks/p-17724bee.entry.js +0 -1
- package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
- package/dist/sankhyablocks/p-37b17041.js +0 -1
- package/dist/sankhyablocks/p-3916c825.entry.js +0 -1
- package/dist/sankhyablocks/p-3ffad8ca.entry.js +0 -1
- package/dist/sankhyablocks/p-44fe945a.entry.js +0 -1
- package/dist/sankhyablocks/p-4fc5a0db.entry.js +0 -1
- package/dist/sankhyablocks/p-564efc43.js +0 -1
- package/dist/sankhyablocks/p-5add4151.entry.js +0 -1
- package/dist/sankhyablocks/p-5de83141.entry.js +0 -1
- package/dist/sankhyablocks/p-6be9191f.entry.js +0 -1
- package/dist/sankhyablocks/p-6ee5d42c.js +0 -1
- package/dist/sankhyablocks/p-72d7f00c.js +0 -56
- package/dist/sankhyablocks/p-7352acf8.entry.js +0 -1
- package/dist/sankhyablocks/p-8115f7a2.js +0 -1
- package/dist/sankhyablocks/p-8903ffc6.js +0 -1
- package/dist/sankhyablocks/p-8dbb4c6c.entry.js +0 -11
- package/dist/sankhyablocks/p-935bfc1c.entry.js +0 -1
- package/dist/sankhyablocks/p-9395cf73.entry.js +0 -1
- package/dist/sankhyablocks/p-9d36d914.js +0 -17
- package/dist/sankhyablocks/p-aa6f27bd.entry.js +0 -1
- package/dist/sankhyablocks/p-aeaa5253.js +0 -10
- package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
- package/dist/sankhyablocks/p-c1273e40.js +0 -1
- package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
- package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
- package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
- package/dist/sankhyablocks/p-f5c33da3.entry.js +0 -1
- package/dist/sankhyablocks/p-f847d53a.entry.js +0 -1
@@ -48,6 +48,7 @@
|
|
48
48
|
"./components/snk-print-selector/snk-print-selector.js",
|
49
49
|
"./components/snk-simple-bar/snk-simple-bar.js",
|
50
50
|
"./components/snk-simple-crud/snk-simple-crud.js",
|
51
|
+
"./components/snk-taskbar/snk-taskbar-custom-elements.js",
|
51
52
|
"./components/teste-pesquisa/teste-pesquisa.js"
|
52
53
|
],
|
53
54
|
"compiler": {
|
@@ -8,13 +8,14 @@ const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
|
8
8
|
const NUFIN_COLUMN = 'NUFIN';
|
9
9
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
10
10
|
export default class Actions {
|
11
|
-
constructor(actionsExecuteInterface, dataUnit) {
|
11
|
+
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
12
12
|
var _a;
|
13
13
|
this._lastValuesCache = {};
|
14
14
|
this._actionsExecuteInterface = actionsExecuteInterface;
|
15
15
|
this._dataUnit = dataUnit;
|
16
16
|
this._selectedRows = ((_a = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo()) === null || _a === void 0 ? void 0 : _a.isAllRecords()) ? [] : dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo().records;
|
17
17
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
18
|
+
this._appResourceId = appResourceId;
|
18
19
|
}
|
19
20
|
apply(action, hasParamsToSave) {
|
20
21
|
this._application.closePopUp();
|
@@ -277,9 +278,7 @@ export default class Actions {
|
|
277
278
|
}
|
278
279
|
}
|
279
280
|
async buildResourceId(actionId) {
|
280
|
-
|
281
|
-
appResId = await this._application.getResourceID();
|
282
|
-
return appResId + '.actionconfig.' + actionId;
|
281
|
+
return this._appResourceId + '.actionconfig.' + actionId;
|
283
282
|
}
|
284
283
|
prepareAndExecute(execSource, executeAction) {
|
285
284
|
this.addRows(execSource);
|
@@ -4,13 +4,14 @@ import { DataFetcher } from '../../lib/http/data-fetcher/DataFetcher';
|
|
4
4
|
import ExecutorFactory from './actions/factory/executor.factory';
|
5
5
|
import Actions from './actions';
|
6
6
|
import ClientEventConfirm from './clientEvent';
|
7
|
+
import ResourceIDUtils from '../../lib/resourceid/ResourceIDUtils';
|
7
8
|
export class SnkActionsButton {
|
8
9
|
constructor() {
|
9
10
|
this.CLIENT_EVENT_CONFIRM_NAME = "br.com.sankhya.actionbutton.clientconfirm";
|
10
11
|
this.handleClick = (evt) => {
|
11
12
|
const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
|
12
13
|
const executor = new ExecutorFactory(selectedAction.type).executor;
|
13
|
-
const action = new Actions(executor, this._dataUnit);
|
14
|
+
const action = new Actions(executor, this._dataUnit, this._resourceID);
|
14
15
|
action.execute(Object.assign({}, selectedAction));
|
15
16
|
this._showDropdown = false;
|
16
17
|
};
|
@@ -68,12 +69,15 @@ export class SnkActionsButton {
|
|
68
69
|
document.addEventListener("scroll", this.positionDropdown.bind(this));
|
69
70
|
}
|
70
71
|
async componentWillLoad() {
|
71
|
-
var _a;
|
72
72
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
73
|
-
this._resourceID = await this._application.getResourceID();
|
74
73
|
this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
|
75
|
-
|
74
|
+
const snkDataUnit = this._element.parentElement;
|
75
|
+
this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
|
76
|
+
this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
|
76
77
|
this._entityName = this._dataUnit.name.split('/')[2];
|
78
|
+
if (this._resourceID == undefined) {
|
79
|
+
this._resourceID = await ResourceIDUtils.getResourceID();
|
80
|
+
}
|
77
81
|
this.setEvents();
|
78
82
|
this.getActions().then(() => {
|
79
83
|
this.loadItems();
|
@@ -13,7 +13,6 @@ import Workspace from "../../lib/workspace/workspace";
|
|
13
13
|
import AppletCaller from "../../lib/applet-caller/applet-caller";
|
14
14
|
import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
|
15
15
|
import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
|
16
|
-
import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
|
17
16
|
import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
|
18
17
|
import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
|
19
18
|
/**
|
@@ -36,16 +35,21 @@ export class SnkApplication {
|
|
36
35
|
}
|
37
36
|
return this._parameters;
|
38
37
|
}
|
39
|
-
|
40
|
-
if (
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
async getAuth(resourceID) {
|
39
|
+
if (resourceID == undefined) {
|
40
|
+
return this.getApplicationAuth();
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
return new Promise((resolve, reject) => {
|
44
|
+
this.authFetcher.getData(resourceID).then((authList) => {
|
45
|
+
resolve(authList);
|
46
|
+
}).catch(error => {
|
47
|
+
reject(error);
|
48
|
+
});
|
49
|
+
});
|
45
50
|
}
|
46
|
-
return this._resourceID;
|
47
51
|
}
|
48
|
-
|
52
|
+
async getApplicationAuth() {
|
49
53
|
if (this._auth) {
|
50
54
|
return Promise.resolve(this._auth);
|
51
55
|
}
|
@@ -54,7 +58,7 @@ export class SnkApplication {
|
|
54
58
|
const waitingAuth = this._authPromises.length > 0;
|
55
59
|
this._authPromises.push(new PendingPromise(resolve, reject));
|
56
60
|
if (!waitingAuth) {
|
57
|
-
this.authFetcher.getData(this.
|
61
|
+
this.authFetcher.getData(this.applicationResourceID).then((authList) => {
|
58
62
|
this._auth = authList;
|
59
63
|
while (this._authPromises.length > 0) {
|
60
64
|
this._authPromises.pop().resolve(this._auth);
|
@@ -73,13 +77,23 @@ export class SnkApplication {
|
|
73
77
|
*/
|
74
78
|
async isUserSup() {
|
75
79
|
return new Promise((resolve, reject) => {
|
76
|
-
this.
|
80
|
+
this.getAuth().then((authorization) => {
|
77
81
|
this.getAuthList(authorization).then((auths) => {
|
78
82
|
resolve(auths.isSup);
|
79
83
|
}).catch(error => reject(error));
|
80
84
|
});
|
81
85
|
});
|
82
86
|
}
|
87
|
+
/**
|
88
|
+
* Realiza a chamada ao Service Broker conforme o nome do serviço.
|
89
|
+
*
|
90
|
+
* @param serviceName - Nome do serviço
|
91
|
+
* @param payload - Dados que serão processados na ação
|
92
|
+
* @param options - Parâmetros de URL
|
93
|
+
*/
|
94
|
+
async callServiceBroker(serviceName, payload, options) {
|
95
|
+
return DataFetcher.get().callServiceBroker(serviceName, payload, options);
|
96
|
+
}
|
83
97
|
initOnboarding(onboardingKey) {
|
84
98
|
OnboardingUtils.getInstance().init(onboardingKey, window.envContext);
|
85
99
|
return Promise.resolve();
|
@@ -87,9 +101,9 @@ export class SnkApplication {
|
|
87
101
|
/**
|
88
102
|
* Obtém `true` caso o usuário logado tem permissão pra determinada ação.
|
89
103
|
*/
|
90
|
-
async hasAccess(access) {
|
104
|
+
async hasAccess(access, resourceID) {
|
91
105
|
return new Promise((resolve, reject) => {
|
92
|
-
this.
|
106
|
+
this.getAuth(resourceID).then((authorization) => {
|
93
107
|
this.getAuthList(authorization).then((auths) => {
|
94
108
|
resolve(auths.isSup || auths.actions[access]);
|
95
109
|
}).catch(error => reject(error));
|
@@ -99,9 +113,9 @@ export class SnkApplication {
|
|
99
113
|
/**
|
100
114
|
* Obtém todos os acessos do usuário logado.
|
101
115
|
*/
|
102
|
-
async getAllAccess() {
|
116
|
+
async getAllAccess(resourceID) {
|
103
117
|
return new Promise((resolve, reject) => {
|
104
|
-
this.
|
118
|
+
this.getAuth(resourceID).then((authorization) => {
|
105
119
|
this.getAuthList(authorization).then((auths) => {
|
106
120
|
const allAccess = {};
|
107
121
|
allAccess['isSup'] = auths.isSup;
|
@@ -285,13 +299,16 @@ export class SnkApplication {
|
|
285
299
|
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
286
300
|
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
|
287
301
|
*/
|
288
|
-
async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
|
302
|
+
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
303
|
+
if (resourceID == undefined) {
|
304
|
+
resourceID = this.applicationResourceID;
|
305
|
+
}
|
289
306
|
return new Promise((resolve, reject) => {
|
290
307
|
const duPromisses = this.getDuPromissesStack(dataUnitName);
|
291
308
|
const waitingDu = duPromisses.length > 0;
|
292
309
|
duPromisses.push(new PendingPromise(resolve, reject));
|
293
310
|
if (!waitingDu) {
|
294
|
-
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName,
|
311
|
+
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
|
295
312
|
dataUnit.loadMetadata().then(() => {
|
296
313
|
if (dataUnitName) {
|
297
314
|
this.updateDataunitCache(undefined, dataUnitName, dataUnit);
|
@@ -322,14 +339,14 @@ export class SnkApplication {
|
|
322
339
|
/**
|
323
340
|
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
324
341
|
*/
|
325
|
-
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
|
342
|
+
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
326
343
|
return new Promise((resolve, reject) => {
|
327
344
|
const dataUnit = this._duCache.get(dataUnitName);
|
328
345
|
if (dataUnit) {
|
329
346
|
resolve(dataUnit);
|
330
347
|
}
|
331
348
|
else {
|
332
|
-
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
|
349
|
+
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
|
333
350
|
resolve(dataUnit);
|
334
351
|
}).catch(reason => reject(reason));
|
335
352
|
}
|
@@ -378,11 +395,20 @@ export class SnkApplication {
|
|
378
395
|
async callServiceBroker(serviceName, payload, options) {
|
379
396
|
return DataFetcher.get().callServiceBroker(serviceName, payload, options);
|
380
397
|
}
|
398
|
+
get applicationResourceID() {
|
399
|
+
if (!this._applicationResourceID) {
|
400
|
+
this._applicationResourceID = this.urlParams.get("workspaceResourceID") ||
|
401
|
+
this.urlParams.get("resourceID") ||
|
402
|
+
Workspace.resourceID ||
|
403
|
+
"unknown.resource.id";
|
404
|
+
}
|
405
|
+
return this._applicationResourceID;
|
406
|
+
}
|
381
407
|
/**
|
382
408
|
* Obtém o resourceID da tela em questão.
|
383
409
|
*/
|
384
410
|
async getResourceID() {
|
385
|
-
return Promise.resolve(this.
|
411
|
+
return Promise.resolve(this.applicationResourceID);
|
386
412
|
}
|
387
413
|
/**
|
388
414
|
* Obtém o UserId da tela em questão.
|
@@ -426,20 +452,14 @@ export class SnkApplication {
|
|
426
452
|
async info(message, options) {
|
427
453
|
return ApplicationUtils.info(message, options);
|
428
454
|
}
|
429
|
-
/**
|
430
|
-
* Obtém a configuração de grade.
|
431
|
-
*/
|
432
|
-
async loadGridConfig(name) {
|
433
|
-
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
434
|
-
}
|
435
455
|
/**
|
436
456
|
* Obtém os totalizadores da grade.
|
437
457
|
*/
|
438
458
|
async loadTotals(name, resourceID, filters) {
|
439
459
|
return this.totalsFetcher.fetchTotals(name, resourceID, filters);
|
440
460
|
}
|
441
|
-
async getAuthList(
|
442
|
-
return await (new MGEAuthorization()).parseFromJSON(
|
461
|
+
async getAuthList(auth) {
|
462
|
+
return await (new MGEAuthorization()).parseFromJSON(auth);
|
443
463
|
}
|
444
464
|
get urlParams() {
|
445
465
|
if (!this._urlParams) {
|
@@ -453,12 +473,6 @@ export class SnkApplication {
|
|
453
473
|
}
|
454
474
|
return this._dataUnitFetcher;
|
455
475
|
}
|
456
|
-
get gridConfigFetcher() {
|
457
|
-
if (!this._gridConfigFetcher) {
|
458
|
-
this._gridConfigFetcher = new GridConfigFetcher();
|
459
|
-
}
|
460
|
-
return this._gridConfigFetcher;
|
461
|
-
}
|
462
476
|
get totalsFetcher() {
|
463
477
|
if (!this._totalsFetcher) {
|
464
478
|
this._totalsFetcher = new TotalsFetcher();
|
@@ -558,7 +572,7 @@ export class SnkApplication {
|
|
558
572
|
* Obtém o nome das telas da aplicação
|
559
573
|
*/
|
560
574
|
async getAppLabel() {
|
561
|
-
return Workspace.getAppLabel(this.
|
575
|
+
return Workspace.getAppLabel(this.applicationResourceID);
|
562
576
|
}
|
563
577
|
/**
|
564
578
|
* Adiciona um listener no fetcher de Pesquisa
|
@@ -630,6 +644,7 @@ export class SnkApplication {
|
|
630
644
|
this._popUp.ezTitle = title;
|
631
645
|
}
|
632
646
|
componentWillLoad() {
|
647
|
+
ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
|
633
648
|
this._errorHandler = new SnkErrorHandler(this);
|
634
649
|
this.messagesBuilder = new SnkMessageBuilder();
|
635
650
|
ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
|
@@ -638,7 +653,7 @@ export class SnkApplication {
|
|
638
653
|
});
|
639
654
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
640
655
|
ErrorTracking.init();
|
641
|
-
ConfigStorage.
|
656
|
+
ConfigStorage.preload(this.applicationResourceID, this.configName);
|
642
657
|
}
|
643
658
|
connectedCallback() {
|
644
659
|
ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
@@ -650,9 +665,10 @@ export class SnkApplication {
|
|
650
665
|
componentDidLoad() {
|
651
666
|
this.applicationLoading.emit(true);
|
652
667
|
window.requestAnimationFrame(() => {
|
668
|
+
ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", false);
|
653
669
|
this.applicationLoaded.emit(true);
|
654
670
|
});
|
655
|
-
ElementIDUtils.addIDInfo(this._element, `resource_${this.
|
671
|
+
ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
|
656
672
|
}
|
657
673
|
render() {
|
658
674
|
return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
|
@@ -761,6 +777,56 @@ export class SnkApplication {
|
|
761
777
|
"tags": []
|
762
778
|
}
|
763
779
|
},
|
780
|
+
"callServiceBroker": {
|
781
|
+
"complexType": {
|
782
|
+
"signature": "(serviceName: string, payload: string | Object, options?: Options) => Promise<any>",
|
783
|
+
"parameters": [{
|
784
|
+
"tags": [{
|
785
|
+
"name": "param",
|
786
|
+
"text": "serviceName - Nome do servi\u00E7o"
|
787
|
+
}],
|
788
|
+
"text": "- Nome do servi\u00E7o"
|
789
|
+
}, {
|
790
|
+
"tags": [{
|
791
|
+
"name": "param",
|
792
|
+
"text": "payload - Dados que ser\u00E3o processados na a\u00E7\u00E3o"
|
793
|
+
}],
|
794
|
+
"text": "- Dados que ser\u00E3o processados na a\u00E7\u00E3o"
|
795
|
+
}, {
|
796
|
+
"tags": [{
|
797
|
+
"name": "param",
|
798
|
+
"text": "options - Par\u00E2metros de URL"
|
799
|
+
}],
|
800
|
+
"text": "- Par\u00E2metros de URL"
|
801
|
+
}],
|
802
|
+
"references": {
|
803
|
+
"Promise": {
|
804
|
+
"location": "global"
|
805
|
+
},
|
806
|
+
"Object": {
|
807
|
+
"location": "global"
|
808
|
+
},
|
809
|
+
"Options": {
|
810
|
+
"location": "import",
|
811
|
+
"path": "../../lib/http/data-fetcher/DataFetcher"
|
812
|
+
}
|
813
|
+
},
|
814
|
+
"return": "Promise<any>"
|
815
|
+
},
|
816
|
+
"docs": {
|
817
|
+
"text": "Realiza a chamada ao Service Broker conforme o nome do servi\u00E7o.",
|
818
|
+
"tags": [{
|
819
|
+
"name": "param",
|
820
|
+
"text": "serviceName - Nome do servi\u00E7o"
|
821
|
+
}, {
|
822
|
+
"name": "param",
|
823
|
+
"text": "payload - Dados que ser\u00E3o processados na a\u00E7\u00E3o"
|
824
|
+
}, {
|
825
|
+
"name": "param",
|
826
|
+
"text": "options - Par\u00E2metros de URL"
|
827
|
+
}]
|
828
|
+
}
|
829
|
+
},
|
764
830
|
"initOnboarding": {
|
765
831
|
"complexType": {
|
766
832
|
"signature": "(onboardingKey: string) => Promise<void>",
|
@@ -782,10 +848,13 @@ export class SnkApplication {
|
|
782
848
|
},
|
783
849
|
"hasAccess": {
|
784
850
|
"complexType": {
|
785
|
-
"signature": "(access: AutorizationType) => Promise<boolean>",
|
851
|
+
"signature": "(access: AutorizationType, resourceID?: string) => Promise<boolean>",
|
786
852
|
"parameters": [{
|
787
853
|
"tags": [],
|
788
854
|
"text": ""
|
855
|
+
}, {
|
856
|
+
"tags": [],
|
857
|
+
"text": ""
|
789
858
|
}],
|
790
859
|
"references": {
|
791
860
|
"Promise": {
|
@@ -805,8 +874,11 @@ export class SnkApplication {
|
|
805
874
|
},
|
806
875
|
"getAllAccess": {
|
807
876
|
"complexType": {
|
808
|
-
"signature": "() => Promise<any>",
|
809
|
-
"parameters": [
|
877
|
+
"signature": "(resourceID?: string) => Promise<any>",
|
878
|
+
"parameters": [{
|
879
|
+
"tags": [],
|
880
|
+
"text": ""
|
881
|
+
}],
|
810
882
|
"references": {
|
811
883
|
"Promise": {
|
812
884
|
"location": "global"
|
@@ -1155,7 +1227,7 @@ export class SnkApplication {
|
|
1155
1227
|
},
|
1156
1228
|
"createDataunit": {
|
1157
1229
|
"complexType": {
|
1158
|
-
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string) => Promise<DataUnit>",
|
1230
|
+
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
1159
1231
|
"parameters": [{
|
1160
1232
|
"tags": [],
|
1161
1233
|
"text": ""
|
@@ -1168,6 +1240,9 @@ export class SnkApplication {
|
|
1168
1240
|
}, {
|
1169
1241
|
"tags": [],
|
1170
1242
|
"text": ""
|
1243
|
+
}, {
|
1244
|
+
"tags": [],
|
1245
|
+
"text": ""
|
1171
1246
|
}],
|
1172
1247
|
"references": {
|
1173
1248
|
"Promise": {
|
@@ -1234,7 +1309,7 @@ export class SnkApplication {
|
|
1234
1309
|
},
|
1235
1310
|
"getDataUnit": {
|
1236
1311
|
"complexType": {
|
1237
|
-
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string) => Promise<DataUnit>",
|
1312
|
+
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
1238
1313
|
"parameters": [{
|
1239
1314
|
"tags": [],
|
1240
1315
|
"text": ""
|
@@ -1247,6 +1322,9 @@ export class SnkApplication {
|
|
1247
1322
|
}, {
|
1248
1323
|
"tags": [],
|
1249
1324
|
"text": ""
|
1325
|
+
}, {
|
1326
|
+
"tags": [],
|
1327
|
+
"text": ""
|
1250
1328
|
}],
|
1251
1329
|
"references": {
|
1252
1330
|
"Promise": {
|
@@ -1640,29 +1718,6 @@ export class SnkApplication {
|
|
1640
1718
|
"tags": []
|
1641
1719
|
}
|
1642
1720
|
},
|
1643
|
-
"loadGridConfig": {
|
1644
|
-
"complexType": {
|
1645
|
-
"signature": "(name: string) => Promise<IGridConfig>",
|
1646
|
-
"parameters": [{
|
1647
|
-
"tags": [],
|
1648
|
-
"text": ""
|
1649
|
-
}],
|
1650
|
-
"references": {
|
1651
|
-
"Promise": {
|
1652
|
-
"location": "global"
|
1653
|
-
},
|
1654
|
-
"IGridConfig": {
|
1655
|
-
"location": "import",
|
1656
|
-
"path": "@sankhyalabs/ezui/dist/types/components/ez-grid/controller/EzGridController"
|
1657
|
-
}
|
1658
|
-
},
|
1659
|
-
"return": "Promise<IGridConfig>"
|
1660
|
-
},
|
1661
|
-
"docs": {
|
1662
|
-
"text": "Obt\u00E9m a configura\u00E7\u00E3o de grade.",
|
1663
|
-
"tags": []
|
1664
|
-
}
|
1665
|
-
},
|
1666
1721
|
"loadTotals": {
|
1667
1722
|
"complexType": {
|
1668
1723
|
"signature": "(name: string, resourceID: string, filters: Array<Filter>) => Promise<Map<string, number>>",
|
@@ -8,6 +8,7 @@ export class SnkConfigurator {
|
|
8
8
|
this._permissions = undefined;
|
9
9
|
this.showActionButtons = false;
|
10
10
|
this.configName = undefined;
|
11
|
+
this.resourceID = undefined;
|
11
12
|
this.viewMode = VIEW_MODE.GRID;
|
12
13
|
this.messagesBuilder = undefined;
|
13
14
|
}
|
@@ -72,7 +73,7 @@ export class SnkConfigurator {
|
|
72
73
|
componentWillLoad() {
|
73
74
|
this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
74
75
|
if (this._application) {
|
75
|
-
this._application.getAllAccess().then(access => (this._permissions = access));
|
76
|
+
this._application.getAllAccess(this.resourceID).then(access => (this._permissions = access));
|
76
77
|
}
|
77
78
|
else {
|
78
79
|
this._permissions = {};
|
@@ -130,6 +131,23 @@ export class SnkConfigurator {
|
|
130
131
|
"attribute": "config-name",
|
131
132
|
"reflect": false
|
132
133
|
},
|
134
|
+
"resourceID": {
|
135
|
+
"type": "string",
|
136
|
+
"mutable": false,
|
137
|
+
"complexType": {
|
138
|
+
"original": "string",
|
139
|
+
"resolved": "string",
|
140
|
+
"references": {}
|
141
|
+
},
|
142
|
+
"required": false,
|
143
|
+
"optional": false,
|
144
|
+
"docs": {
|
145
|
+
"tags": [],
|
146
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
147
|
+
},
|
148
|
+
"attribute": "resource-i-d",
|
149
|
+
"reflect": false
|
150
|
+
},
|
133
151
|
"viewMode": {
|
134
152
|
"type": "number",
|
135
153
|
"mutable": false,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { h } from '@stencil/core';
|
2
|
-
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
1
|
+
import { h, Host } from '@stencil/core';
|
2
|
+
import { ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
3
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
4
4
|
import { PresentationMode } from '../../lib';
|
5
5
|
import { VIEW_MODE } from '../../lib/utils/constants';
|
@@ -17,6 +17,7 @@ export class SnkCrud {
|
|
17
17
|
this.attachmentRegisterKey = undefined;
|
18
18
|
this._currentViewMode = VIEW_MODE.GRID;
|
19
19
|
this._canEdit = undefined;
|
20
|
+
this._resourceID = undefined;
|
20
21
|
this.configName = undefined;
|
21
22
|
this.selectionToastConfig = undefined;
|
22
23
|
this.showActionButtons = false;
|
@@ -28,6 +29,7 @@ export class SnkCrud {
|
|
28
29
|
this.presentationMode = PresentationMode.PRIMARY;
|
29
30
|
this.messagesBuilder = undefined;
|
30
31
|
this.useEnterLikeTab = false;
|
32
|
+
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
31
33
|
}
|
32
34
|
/**
|
33
35
|
* Usado para alternar a visão entre GRID e FORM externamente.
|
@@ -111,7 +113,7 @@ export class SnkCrud {
|
|
111
113
|
}
|
112
114
|
componentWillLoad() {
|
113
115
|
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
114
|
-
application.hasAccess(AutorizationType.UPDATE).then(canEdit => this._canEdit = canEdit);
|
116
|
+
application.hasAccess(AutorizationType.UPDATE, this._resourceID).then(canEdit => this._canEdit = canEdit);
|
115
117
|
let parent = this._element.parentElement;
|
116
118
|
while (parent) {
|
117
119
|
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
@@ -123,11 +125,11 @@ export class SnkCrud {
|
|
123
125
|
if (!this._dataUnit) {
|
124
126
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
125
127
|
this._dataUnit = evt.detail;
|
126
|
-
this.initDataUnit();
|
128
|
+
this.initDataUnit(application);
|
127
129
|
});
|
128
130
|
}
|
129
131
|
else {
|
130
|
-
this.initDataUnit();
|
132
|
+
this.initDataUnit(application);
|
131
133
|
}
|
132
134
|
this._snkDataUnit.addEventListener("dataStateChange", async ({ detail: dataState }) => {
|
133
135
|
this._dataState = dataState;
|
@@ -143,11 +145,18 @@ export class SnkCrud {
|
|
143
145
|
this.configName = application.configName;
|
144
146
|
}
|
145
147
|
}
|
146
|
-
initDataUnit() {
|
148
|
+
async initDataUnit(application) {
|
147
149
|
this.addDataElementID();
|
148
150
|
if (!this.messagesBuilder) {
|
149
151
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
150
152
|
}
|
153
|
+
if (this._resourceID == undefined) {
|
154
|
+
//Tenta pegar o resourceID do snkDataUnit;
|
155
|
+
this._resourceID = this._snkDataUnit.resourceID;
|
156
|
+
if (this._resourceID == undefined) {
|
157
|
+
this._resourceID = await application.getResourceID();
|
158
|
+
}
|
159
|
+
}
|
151
160
|
}
|
152
161
|
handleConfiguratorEvent(evt, type) {
|
153
162
|
evt.stopImmediatePropagation();
|
@@ -158,8 +167,11 @@ export class SnkCrud {
|
|
158
167
|
this.configuratorCancel.emit();
|
159
168
|
}
|
160
169
|
render() {
|
170
|
+
if (this._resourceID == undefined) {
|
171
|
+
return;
|
172
|
+
}
|
161
173
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
162
|
-
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL') }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
|
174
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
163
175
|
}
|
164
176
|
static get is() { return "snk-crud"; }
|
165
177
|
static get encapsulation() { return "scoped"; }
|
@@ -404,7 +416,9 @@ export class SnkCrud {
|
|
404
416
|
"_dataState": {},
|
405
417
|
"attachmentRegisterKey": {},
|
406
418
|
"_currentViewMode": {},
|
407
|
-
"_canEdit": {}
|
419
|
+
"_canEdit": {},
|
420
|
+
"_resourceID": {},
|
421
|
+
"customContainerId": {}
|
408
422
|
};
|
409
423
|
}
|
410
424
|
static get events() {
|
@@ -453,6 +467,28 @@ export class SnkCrud {
|
|
453
467
|
"resolved": "any",
|
454
468
|
"references": {}
|
455
469
|
}
|
470
|
+
}, {
|
471
|
+
"method": "formItemsReady",
|
472
|
+
"name": "formItemsReady",
|
473
|
+
"bubbles": true,
|
474
|
+
"cancelable": true,
|
475
|
+
"composed": true,
|
476
|
+
"docs": {
|
477
|
+
"tags": [],
|
478
|
+
"text": "Respons\u00E1vel por notificar quando ocorrer a renderiza\u00E7\u00E3o de itens do formul\u00E1rio."
|
479
|
+
},
|
480
|
+
"complexType": {
|
481
|
+
"original": "Array<HTMLElement>",
|
482
|
+
"resolved": "HTMLElement[]",
|
483
|
+
"references": {
|
484
|
+
"Array": {
|
485
|
+
"location": "global"
|
486
|
+
},
|
487
|
+
"HTMLElement": {
|
488
|
+
"location": "global"
|
489
|
+
}
|
490
|
+
}
|
491
|
+
}
|
456
492
|
}];
|
457
493
|
}
|
458
494
|
static get methods() {
|