@sankhyalabs/sankhyablocks 10.1.0-dev.23 → 10.1.0-dev.25
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-a4e1e518.js → ConfigStorage-d9d24844.js} +2 -2
- package/dist/cjs/{DataFetcher-0b6aa084.js → DataFetcher-3a8ea521.js} +2 -2743
- package/dist/cjs/{ISave-2c455a77.js → ISave-a66bb65e.js} +1 -1
- package/dist/cjs/ImageUtils-5e3f406b.js +142 -0
- package/dist/cjs/{SnkFormConfigManager-b8c81493.js → SnkFormConfigManager-c88cf1e9.js} +2 -2
- package/dist/cjs/SnkMessageBuilder-d9558dba.js +2809 -0
- package/dist/cjs/{SnkMultiSelectionListDataSource-03b58f5a.js → SnkMultiSelectionListDataSource-a891430e.js} +4 -4
- package/dist/cjs/{auth-fetcher-7e7796c9.js → auth-fetcher-faa61f64.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-8dffbcdf.js → dataunit-fetcher-4320f7ec.js} +3 -2
- package/dist/cjs/{form-config-fetcher-5516d68a.js → form-config-fetcher-72cf0e3d.js} +1 -1
- package/dist/cjs/index-1894343a.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +5 -4
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button_9.cjs.entry.js → snk-actions-button_8.cjs.entry.js} +7 -56
- package/dist/cjs/snk-application.cjs.entry.js +8 -7
- package/dist/cjs/snk-attach.cjs.entry.js +7 -6
- package/dist/cjs/snk-crud.cjs.entry.js +7 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -5
- package/dist/cjs/{snk-data-unit-036ce58c.js → snk-data-unit-b54fdf9a.js} +11 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +15 -11
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +4 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +4 -3
- package/dist/cjs/snk-form-view.cjs.entry.js +72 -7
- package/dist/cjs/snk-form_2.cjs.entry.js +5 -4
- package/dist/cjs/snk-grid.cjs.entry.js +10 -7
- package/dist/cjs/{snk-guides-viewer-164c063e.js → snk-guides-viewer-4bbd697f.js} +10 -9
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -7
- package/dist/cjs/snk-image-input.cjs.entry.js +148 -0
- package/dist/cjs/snk-layout-form-config.cjs.entry.js +72 -0
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +4 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -4
- package/dist/cjs/snk-simple-crud.cjs.entry.js +8 -7
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/snk-application/snk-application.js +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/GuideBuilder.js +1 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +4 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +93 -8
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +5 -4
- package/dist/collection/components/snk-grid/snk-grid.js +3 -1
- package/dist/collection/components/snk-image-input/snk-image-input.css +3 -0
- package/dist/collection/components/snk-image-input/snk-image-input.js +326 -0
- package/dist/collection/components/snk-image-input/utils/ImageUtils.js +133 -0
- package/dist/collection/components/snk-layout-form-config/snk-layout-form-config.js +1 -1
- package/dist/collection/components/snk-layout-form-config/snk-view-representation/snk-view-representation.js +1 -1
- package/dist/collection/lib/message/messageResourceEnUSUtils.js +2 -0
- package/dist/collection/lib/message/messageResourceEsESUtils.js +2 -0
- package/dist/collection/lib/message/messageResourcePtBRUtils.js +2 -0
- package/dist/collection/lib/message/resources/en-us/snk-crud.msg.js +1 -1
- package/dist/collection/lib/message/resources/en-us/snk-image-input.msg.js +11 -0
- package/dist/collection/lib/message/resources/en-us/snk-layout-form-config.msg.js +10 -2
- package/dist/collection/lib/message/resources/es-es/snk-crud.msg.js +1 -1
- package/dist/collection/lib/message/resources/es-es/snk-image-input.msg.js +11 -0
- package/dist/collection/lib/message/resources/es-es/snk-layout-form-config.msg.js +8 -0
- package/dist/collection/lib/message/resources/pt-br/snk-configurator.msg.js +1 -1
- package/dist/collection/lib/message/resources/pt-br/snk-crud.msg.js +1 -1
- package/dist/collection/lib/message/resources/pt-br/snk-image-input.msg.js +11 -0
- package/dist/collection/lib/message/resources/pt-br/snk-layout-form-config.msg.js +10 -2
- package/dist/components/DataFetcher.js +3 -2743
- package/dist/components/SnkMessageBuilder.js +2807 -0
- package/dist/components/dataunit-fetcher.js +2 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-application2.js +2 -1
- package/dist/components/snk-attach2.js +2 -1
- package/dist/components/snk-crud.js +70 -64
- package/dist/components/snk-data-unit2.js +1 -1
- package/dist/components/snk-detail-view2.js +105 -89
- package/dist/components/snk-form-view2.js +82 -10
- package/dist/components/snk-grid2.js +3 -1
- package/dist/components/snk-image-input.d.ts +11 -0
- package/dist/components/snk-image-input.js +6 -0
- package/dist/components/snk-image-input2.js +302 -0
- package/dist/components/snk-layout-form-config2.js +1 -1
- package/dist/components/snk-view-representation2.js +1 -1
- package/dist/esm/{ConfigStorage-39ac8fef.js → ConfigStorage-d15d2014.js} +2 -2
- package/dist/esm/{DataFetcher-0b9da57d.js → DataFetcher-1dd7e8c0.js} +3 -2743
- package/dist/esm/{ISave-f1c9269b.js → ISave-498c4831.js} +1 -1
- package/dist/esm/ImageUtils-8fc8d905.js +136 -0
- package/dist/esm/{SnkFormConfigManager-a87566c8.js → SnkFormConfigManager-86befa68.js} +2 -2
- package/dist/esm/SnkMessageBuilder-c0bc4424.js +2807 -0
- package/dist/esm/{SnkMultiSelectionListDataSource-01b3744b.js → SnkMultiSelectionListDataSource-14633bf6.js} +4 -4
- package/dist/esm/{auth-fetcher-acdc1cb4.js → auth-fetcher-69cbda8d.js} +1 -1
- package/dist/esm/{dataunit-fetcher-4c312b43.js → dataunit-fetcher-3d5c4ae4.js} +2 -1
- package/dist/esm/{form-config-fetcher-7cda6254.js → form-config-fetcher-fcc7b62f.js} +1 -1
- package/dist/esm/index-04f73a26.js +10 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +5 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button_9.entry.js → snk-actions-button_8.entry.js} +8 -56
- package/dist/esm/snk-application.entry.js +7 -6
- package/dist/esm/snk-attach.entry.js +6 -5
- package/dist/esm/snk-crud.entry.js +7 -6
- package/dist/esm/snk-data-exporter.entry.js +6 -5
- package/dist/esm/{snk-data-unit-130021b3.js → snk-data-unit-363c3551.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +4 -3
- package/dist/esm/snk-detail-view.entry.js +13 -9
- package/dist/esm/snk-filter-bar_4.entry.js +4 -3
- package/dist/esm/snk-filter-modal-item.entry.js +4 -3
- package/dist/esm/snk-form-view.entry.js +73 -8
- package/dist/esm/snk-form_2.entry.js +5 -4
- package/dist/esm/snk-grid.entry.js +10 -7
- package/dist/esm/{snk-guides-viewer-3fd18298.js → snk-guides-viewer-97708c80.js} +10 -9
- package/dist/esm/snk-guides-viewer.entry.js +8 -7
- package/dist/esm/snk-image-input.entry.js +144 -0
- package/dist/esm/snk-layout-form-config.entry.js +68 -0
- package/dist/esm/snk-personalized-filter.entry.js +4 -3
- package/dist/esm/snk-pesquisa.entry.js +5 -4
- package/dist/esm/snk-simple-crud.entry.js +8 -7
- package/dist/sankhyablocks/p-10cad767.entry.js +1 -0
- package/dist/sankhyablocks/p-18cc9111.entry.js +1 -0
- package/dist/sankhyablocks/{p-5e2dffc1.entry.js → p-1df34264.entry.js} +2 -2
- package/dist/sankhyablocks/p-27d6590e.js +1 -0
- package/dist/sankhyablocks/p-2a356340.entry.js +1 -0
- package/dist/sankhyablocks/{p-998a9d6f.js → p-2ccbbeec.js} +1 -1
- package/dist/sankhyablocks/p-30641d55.entry.js +1 -0
- package/dist/sankhyablocks/{p-48a5c311.js → p-32ad76cc.js} +2 -2
- package/dist/sankhyablocks/p-3b07c117.entry.js +1 -0
- package/dist/sankhyablocks/p-43d84207.entry.js +1 -0
- package/dist/sankhyablocks/p-48c580b9.entry.js +1 -0
- package/dist/sankhyablocks/p-4ff3b494.js +1 -0
- package/dist/sankhyablocks/p-685bc841.js +60 -0
- package/dist/sankhyablocks/{p-d714b6ca.js → p-7c4f4851.js} +1 -1
- package/dist/sankhyablocks/{p-2ac55a5d.js → p-7e9f8fa4.js} +1 -1
- package/dist/sankhyablocks/{p-1f310bc6.js → p-9114e869.js} +1 -1
- package/dist/sankhyablocks/p-a65559fe.entry.js +1 -0
- package/dist/sankhyablocks/{p-7ee6b1bf.js → p-a9839628.js} +1 -1
- package/dist/sankhyablocks/p-b2b56f04.js +1 -0
- package/dist/sankhyablocks/p-bb81a356.entry.js +1 -0
- package/dist/sankhyablocks/p-bdf0077f.js +1 -0
- package/dist/sankhyablocks/p-bf65dcc1.entry.js +1 -0
- package/dist/sankhyablocks/p-c6a97fda.entry.js +1 -0
- package/dist/sankhyablocks/p-c860552e.entry.js +1 -0
- package/dist/sankhyablocks/p-c9316c5d.entry.js +1 -0
- package/dist/sankhyablocks/p-e0a6818c.js +1 -0
- package/dist/sankhyablocks/p-e0e3914e.entry.js +1 -0
- package/dist/sankhyablocks/p-e973a5d4.entry.js +1 -0
- package/dist/sankhyablocks/p-ebce5394.entry.js +1 -0
- package/dist/sankhyablocks/p-fc5e95f4.entry.js +1 -0
- package/dist/sankhyablocks/p-fce86770.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -1
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +12 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +1 -0
- package/dist/types/components/snk-image-input/snk-image-input.d.ts +56 -0
- package/dist/types/components/snk-image-input/utils/ImageUtils.d.ts +15 -0
- package/dist/types/components.d.ts +89 -0
- package/dist/types/lib/message/resources/en-us/snk-image-input.msg.d.ts +1 -0
- package/dist/types/lib/message/resources/es-es/snk-image-input.msg.d.ts +1 -0
- package/dist/types/lib/message/resources/pt-br/snk-image-input.msg.d.ts +1 -0
- 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/sankhyablocks/p-12f595a6.entry.js +0 -1
- package/dist/sankhyablocks/p-18d66638.entry.js +0 -1
- package/dist/sankhyablocks/p-2a33d4cf.entry.js +0 -1
- package/dist/sankhyablocks/p-2c6be187.entry.js +0 -1
- package/dist/sankhyablocks/p-3a443150.entry.js +0 -1
- package/dist/sankhyablocks/p-3b6d8d33.entry.js +0 -1
- package/dist/sankhyablocks/p-3db72758.entry.js +0 -1
- package/dist/sankhyablocks/p-52691b42.js +0 -1
- package/dist/sankhyablocks/p-6768f176.js +0 -1
- package/dist/sankhyablocks/p-6d322b0a.js +0 -1
- package/dist/sankhyablocks/p-877d9614.entry.js +0 -1
- package/dist/sankhyablocks/p-94267a30.entry.js +0 -1
- package/dist/sankhyablocks/p-9e4555ab.js +0 -60
- package/dist/sankhyablocks/p-acd2ba28.entry.js +0 -1
- package/dist/sankhyablocks/p-b533edab.entry.js +0 -1
- package/dist/sankhyablocks/p-c2d33fc8.entry.js +0 -1
- package/dist/sankhyablocks/p-cd40c8cf.entry.js +0 -1
- package/dist/sankhyablocks/p-cd412add.entry.js +0 -1
- package/dist/sankhyablocks/p-d6dad5e4.entry.js +0 -1
- package/dist/sankhyablocks/p-f8c5395a.entry.js +0 -1
|
@@ -2,27 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-4bbd697f.js');
|
|
6
6
|
require('./index-1894343a.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
9
9
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
|
10
10
|
require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
11
|
-
require('./DataFetcher-
|
|
11
|
+
require('./DataFetcher-3a8ea521.js');
|
|
12
12
|
require('./PrintUtils-bcaeb82f.js');
|
|
13
|
+
require('./SnkMessageBuilder-d9558dba.js');
|
|
13
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
14
|
-
require('./ISave-
|
|
15
|
+
require('./ISave-a66bb65e.js');
|
|
15
16
|
require('./index-e3e39724.js');
|
|
16
17
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
17
|
-
require('./dataunit-fetcher-
|
|
18
|
+
require('./dataunit-fetcher-4320f7ec.js');
|
|
18
19
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
19
20
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
20
21
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
21
22
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
22
|
-
require('./form-config-fetcher-
|
|
23
|
+
require('./form-config-fetcher-72cf0e3d.js');
|
|
23
24
|
require('./constants-6d82e405.js');
|
|
24
|
-
require('./SnkFormConfigManager-
|
|
25
|
-
require('./ConfigStorage-
|
|
25
|
+
require('./SnkFormConfigManager-c88cf1e9.js');
|
|
26
|
+
require('./ConfigStorage-d9d24844.js');
|
|
26
27
|
require('./taskbar-elements-8a80420e.js');
|
|
27
28
|
require('./index-f0fe7e6e.js');
|
|
28
29
|
require('./taskbar-processor-2fba34a8.js');
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-1894343a.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-d9558dba.js');
|
|
8
|
+
const ImageUtils = require('./ImageUtils-5e3f406b.js');
|
|
9
|
+
|
|
10
|
+
const snkImageInputCss = ":host{display:block}";
|
|
11
|
+
|
|
12
|
+
const SnkImageInput = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.imageError = index.createEvent(this, "imageError", 7);
|
|
16
|
+
this.dataUnitObserver = async (action) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const actionsMoveSelection = [core.Action.NEXT_SELECTED, core.Action.PREVIOUS_SELECTED];
|
|
19
|
+
if (actionsMoveSelection.includes(action.type)) {
|
|
20
|
+
await this.loadImage();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const selection = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.selection) || [];
|
|
24
|
+
if (action.type === core.Action.SELECTION_CHANGED && selection.length > 0) {
|
|
25
|
+
await this.loadImage();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (action.type === core.Action.RECORDS_ADDED) {
|
|
29
|
+
await this.clearImage();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this.dataUnit = undefined;
|
|
34
|
+
this.fieldName = undefined;
|
|
35
|
+
this.entityName = undefined;
|
|
36
|
+
this.enabled = true;
|
|
37
|
+
this.acceptType = undefined;
|
|
38
|
+
this.maxSize = undefined;
|
|
39
|
+
this.label = undefined;
|
|
40
|
+
this.imageValue = undefined;
|
|
41
|
+
this.loading = true;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Força o reload da imagem
|
|
45
|
+
*/
|
|
46
|
+
async reloadImage(pks) {
|
|
47
|
+
await this.loadImage(pks);
|
|
48
|
+
}
|
|
49
|
+
getMessage(key, params) {
|
|
50
|
+
if (!this.messagesBuilder) {
|
|
51
|
+
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder();
|
|
52
|
+
}
|
|
53
|
+
return this.messagesBuilder.getMessage(key, params);
|
|
54
|
+
}
|
|
55
|
+
async clearImage() {
|
|
56
|
+
this.imageValue = undefined;
|
|
57
|
+
}
|
|
58
|
+
async handleImageChange(event) {
|
|
59
|
+
const base64 = event.detail;
|
|
60
|
+
if (!base64) {
|
|
61
|
+
await this.clearImage();
|
|
62
|
+
await this.updatedataUnitField(true);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const blob = await ImageUtils.base64ToBlob(base64);
|
|
66
|
+
if (this.maxSize && blob.size > this.maxSize * 1024) {
|
|
67
|
+
const errorMsg = this.getMessage('snkImageInput.errorImageSize') + this.maxSize + '(KB)';
|
|
68
|
+
this.imageError.emit(errorMsg);
|
|
69
|
+
if (this.application) {
|
|
70
|
+
await this.application.error(this.getMessage('snkImageInput.errorTitle'), errorMsg);
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.imageValue = base64;
|
|
75
|
+
await ImageUtils.sessionFileUpload(blob, this.entityName, this.fieldName);
|
|
76
|
+
await this.updatedataUnitField();
|
|
77
|
+
}
|
|
78
|
+
async updatedataUnitField(deleted = false) {
|
|
79
|
+
if (!this.dataUnit || !this.dataUnit.getSelectedRecord()) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (deleted) {
|
|
83
|
+
await this.dataUnit.setFieldValue(this.fieldName, 'deletado');
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
await this.dataUnit.setFieldValue(this.fieldName, `$file.session.key{${ImageUtils.buildFileKey(this.entityName, this.fieldName)}}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async handleImageError(event) {
|
|
90
|
+
this.imageError.emit(event.detail);
|
|
91
|
+
if (this.application) {
|
|
92
|
+
await this.application.error(this.getMessage('snkImageInput.errorTitle'), event.detail);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
getPksFromDataUnit() {
|
|
96
|
+
if (!this.dataUnit) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const selectedRecord = this.dataUnit.getSelectedRecord();
|
|
100
|
+
if (!selectedRecord) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const fieldValue = selectedRecord[this.fieldName];
|
|
104
|
+
if (!fieldValue) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const pk = JSON.parse(fieldValue);
|
|
109
|
+
return pk;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.error('Error parsing PK from data unit field:', error);
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async loadImage(pks) {
|
|
117
|
+
var _a;
|
|
118
|
+
this.loading = true;
|
|
119
|
+
if (this.dataUnit && this.entityName) {
|
|
120
|
+
pks = (_a = pks !== null && pks !== void 0 ? pks : this.getPksFromDataUnit()) !== null && _a !== void 0 ? _a : ImageUtils.getPKs(this.dataUnit);
|
|
121
|
+
this.imageValue = await ImageUtils.downloadImage(pks, this.fieldName, this.entityName);
|
|
122
|
+
}
|
|
123
|
+
this.loading = false;
|
|
124
|
+
}
|
|
125
|
+
async componentWillLoad() {
|
|
126
|
+
this.application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
127
|
+
if (!this.messagesBuilder) {
|
|
128
|
+
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder();
|
|
129
|
+
}
|
|
130
|
+
if (this.dataUnit) {
|
|
131
|
+
this.dataUnit.subscribe(this.dataUnitObserver);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
disconnectedCallback() {
|
|
135
|
+
if (this.dataUnit) {
|
|
136
|
+
this.dataUnit.unsubscribe(this.dataUnitObserver);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async componentDidLoad() {
|
|
140
|
+
await this.loadImage();
|
|
141
|
+
}
|
|
142
|
+
render() {
|
|
143
|
+
return (index.h(index.Host, null, index.h("ez-image-input", { enabled: this.enabled, label: this.label, name: this.fieldName, value: this.imageValue, maxFileSize: this.maxSize ? this.maxSize * 1024 : undefined, accept: this.acceptType || 'image/png,image/jpeg,image/gif', onEzChange: (e) => this.handleImageChange(e), onEzError: (e) => this.handleImageError(e), loading: this.loading })));
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
SnkImageInput.style = snkImageInputCss;
|
|
147
|
+
|
|
148
|
+
exports.snk_image_input = SnkImageInput;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-1894343a.js');
|
|
6
|
+
require('./DataFetcher-3a8ea521.js');
|
|
7
|
+
require('./ISave-a66bb65e.js');
|
|
8
|
+
const core = require('@sankhyalabs/core');
|
|
9
|
+
require('./index-e3e39724.js');
|
|
10
|
+
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
11
|
+
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
12
|
+
require('./dataunit-fetcher-4320f7ec.js');
|
|
13
|
+
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
14
|
+
const formConfigFetcher = require('./form-config-fetcher-72cf0e3d.js');
|
|
15
|
+
require('./constants-6d82e405.js');
|
|
16
|
+
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
17
|
+
require('./PrintUtils-bcaeb82f.js');
|
|
18
|
+
require('./SnkMessageBuilder-d9558dba.js');
|
|
19
|
+
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
20
|
+
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
21
|
+
require('./ResourceIDUtils-5ff86aa7.js');
|
|
22
|
+
|
|
23
|
+
const snkLayoutFormConfigCss = ".sc-snk-layout-form-config-h{display:block}";
|
|
24
|
+
|
|
25
|
+
const FORM_COL_CONFIG_PREFIX = 'formColCfg.';
|
|
26
|
+
const SnkLayoutFormConfig = class {
|
|
27
|
+
constructor(hostRef) {
|
|
28
|
+
index.registerInstance(this, hostRef);
|
|
29
|
+
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
|
30
|
+
this.messagesBuilder = undefined;
|
|
31
|
+
this.layoutType = utils.FormLayout.SIDE_BY_SIDE;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Salva o tipo de layout escolhido. Sem retorno.
|
|
35
|
+
*/
|
|
36
|
+
async save() {
|
|
37
|
+
this._LayoutFormConfigSingleton.setConfig(this.layoutType);
|
|
38
|
+
this._formConfigFetcher.saveLayoutFormConfig(FORM_COL_CONFIG_PREFIX + this._resourceID, { config: this.layoutType, newConfig: true });
|
|
39
|
+
}
|
|
40
|
+
async componentWillLoad() {
|
|
41
|
+
const _application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
42
|
+
this._LayoutFormConfigSingleton = await (_application === null || _application === void 0 ? void 0 : _application.getLayoutFormConfig());
|
|
43
|
+
this._resourceID = await (_application === null || _application === void 0 ? void 0 : _application.getResourceID());
|
|
44
|
+
this.setLayoutInit();
|
|
45
|
+
}
|
|
46
|
+
setLayoutInit() {
|
|
47
|
+
if (!this._LayoutFormConfigSingleton)
|
|
48
|
+
return;
|
|
49
|
+
const { config } = this._LayoutFormConfigSingleton;
|
|
50
|
+
if (config == null) {
|
|
51
|
+
this.layoutType = utils.FormLayout.SIDE_BY_SIDE;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const configAsNumber = Number(config);
|
|
55
|
+
this.layoutType = Object.values(utils.FormLayout).includes(configAsNumber)
|
|
56
|
+
? configAsNumber
|
|
57
|
+
: utils.FormLayout.SIDE_BY_SIDE;
|
|
58
|
+
}
|
|
59
|
+
toggleLayout(key) {
|
|
60
|
+
this.layoutType = key;
|
|
61
|
+
}
|
|
62
|
+
getMessage(key, params) {
|
|
63
|
+
var _a;
|
|
64
|
+
return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
return (index.h("div", { class: "ez-flex ez-flex--column" }, index.h("div", { class: "ez-margin-bottom--small" }, index.h("ez-check", { label: this.getMessage('snkLayoutFormConfig.cascadeLayout.label'), class: "ez-margin-bottom--small", onEzChange: () => this.toggleLayout(utils.FormLayout.CASCADE), value: this.layoutType === utils.FormLayout.CASCADE }), index.h("snk-view-representation", { mode: utils.FormLayout.CASCADE }), index.h("label", { class: "ez-label ez-margin--small ez-flex ez-text--medium" }, this.getMessage('snkLayoutFormConfig.cascadeLayout.description'))), index.h("div", { class: "ez-margin-bottom--small" }, index.h("ez-check", { label: this.getMessage('snkLayoutFormConfig.classicCascadeLayout.label'), class: "ez-margin-bottom--small", onEzChange: () => this.toggleLayout(utils.FormLayout.CLASSIC_CASCADE), value: this.layoutType === utils.FormLayout.CLASSIC_CASCADE }), index.h("snk-view-representation", { mode: utils.FormLayout.CLASSIC_CASCADE }), index.h("label", { class: "ez-label ez-margin--small ez-flex ez-text--medium" }, this.getMessage('snkLayoutFormConfig.classicCascadeLayout.description'))), index.h("div", { class: "ez-margin-bottom--small" }, index.h("ez-check", { label: this.getMessage('snkLayoutFormConfig.sideBySideLayout.label'), class: "ez-margin-bottom--small", onEzChange: () => this.toggleLayout(utils.FormLayout.SIDE_BY_SIDE), value: this.layoutType === utils.FormLayout.SIDE_BY_SIDE }), index.h("snk-view-representation", { mode: utils.FormLayout.SIDE_BY_SIDE }), index.h("label", { class: "ez-label ez-margin--small ez-flex ez-text--medium" }, this.getMessage('snkLayoutFormConfig.sideBySideLayout.description'))), index.h("div", null, index.h("ez-check", { label: this.getMessage('snkLayoutFormConfig.classicSideBySideLayout.label'), class: "ez-margin-bottom--small", onEzChange: () => this.toggleLayout(utils.FormLayout.CLASSIC_SIDE_BY_SIDE), value: this.layoutType === utils.FormLayout.CLASSIC_SIDE_BY_SIDE }), index.h("snk-view-representation", { mode: utils.FormLayout.CLASSIC_SIDE_BY_SIDE }), index.h("label", { class: "ez-label ez-margin--small ez-flex ez-text--medium" }, this.getMessage('snkLayoutFormConfig.classicSideBySideLayout.description')))));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
SnkLayoutFormConfig.style = snkLayoutFormConfigCss;
|
|
71
|
+
|
|
72
|
+
exports.snk_layout_form_config = SnkLayoutFormConfig;
|
|
@@ -5,14 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-1894343a.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-eccb267a.js');
|
|
8
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
8
|
+
const ConfigStorage = require('./ConfigStorage-d9d24844.js');
|
|
9
9
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
10
10
|
const index$1 = require('./index-62760a9c.js');
|
|
11
11
|
const index$2 = require('./index-f0fe7e6e.js');
|
|
12
12
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
13
|
-
require('./form-config-fetcher-
|
|
14
|
-
require('./DataFetcher-
|
|
13
|
+
require('./form-config-fetcher-72cf0e3d.js');
|
|
14
|
+
require('./DataFetcher-3a8ea521.js');
|
|
15
15
|
require('./PrintUtils-bcaeb82f.js');
|
|
16
|
+
require('./SnkMessageBuilder-d9558dba.js');
|
|
16
17
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
17
18
|
|
|
18
19
|
const snkPersonalizedFilterCss = ".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";
|
|
@@ -4,16 +4,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1894343a.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const ISave = require('./ISave-
|
|
8
|
-
require('./DataFetcher-
|
|
7
|
+
const ISave = require('./ISave-a66bb65e.js');
|
|
8
|
+
require('./DataFetcher-3a8ea521.js');
|
|
9
9
|
require('./index-e3e39724.js');
|
|
10
10
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
11
11
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
12
|
-
require('./dataunit-fetcher-
|
|
12
|
+
require('./dataunit-fetcher-4320f7ec.js');
|
|
13
13
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
14
|
-
require('./form-config-fetcher-
|
|
14
|
+
require('./form-config-fetcher-72cf0e3d.js');
|
|
15
15
|
require('./constants-6d82e405.js');
|
|
16
16
|
require('./PrintUtils-bcaeb82f.js');
|
|
17
|
+
require('./SnkMessageBuilder-d9558dba.js');
|
|
17
18
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
18
19
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
19
20
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
@@ -7,20 +7,21 @@ const core = require('@sankhyalabs/core');
|
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const constants = require('./constants-6d82e405.js');
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-8a80420e.js');
|
|
10
|
-
require('./DataFetcher-
|
|
11
|
-
require('./ISave-
|
|
12
|
-
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-
|
|
10
|
+
require('./DataFetcher-3a8ea521.js');
|
|
11
|
+
require('./ISave-a66bb65e.js');
|
|
12
|
+
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-a891430e.js');
|
|
13
13
|
const index$1 = require('./index-e3e39724.js');
|
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
16
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
16
|
+
const dataunitFetcher = require('./dataunit-fetcher-4320f7ec.js');
|
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
|
-
const formConfigFetcher = require('./form-config-fetcher-
|
|
18
|
+
const formConfigFetcher = require('./form-config-fetcher-72cf0e3d.js');
|
|
19
19
|
const taskbarProcessor = require('./taskbar-processor-2fba34a8.js');
|
|
20
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
21
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
20
|
+
const ConfigStorage = require('./ConfigStorage-d9d24844.js');
|
|
21
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-c88cf1e9.js');
|
|
22
22
|
const index$2 = require('./index-f0fe7e6e.js');
|
|
23
23
|
require('./PrintUtils-bcaeb82f.js');
|
|
24
|
+
require('./SnkMessageBuilder-d9558dba.js');
|
|
24
25
|
require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
|
25
26
|
require('./IFetchDataExporterParams-e78ec415.js');
|
|
26
27
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"./components/snk-grid/snk-grid.js",
|
|
48
48
|
"./components/snk-grid-config/snk-grid-config.js",
|
|
49
49
|
"./components/snk-grid-config/snk-select-box/snk-select-box.js",
|
|
50
|
+
"./components/snk-image-input/snk-image-input.js",
|
|
50
51
|
"./components/snk-layout-form-config/snk-layout-form-config.js",
|
|
51
52
|
"./components/snk-layout-form-config/snk-view-representation/snk-view-representation.js",
|
|
52
53
|
"./components/snk-numbering-config/snk-numbering-config.js",
|
|
@@ -108,6 +109,11 @@
|
|
|
108
109
|
"snk-guides-viewer"
|
|
109
110
|
]
|
|
110
111
|
},
|
|
112
|
+
{
|
|
113
|
+
"components": [
|
|
114
|
+
"snk-layout-form-config"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
111
117
|
{
|
|
112
118
|
"components": [
|
|
113
119
|
"snk-data-exporter"
|
|
@@ -1557,7 +1557,7 @@ export class SnkApplication {
|
|
|
1557
1557
|
"mutable": false,
|
|
1558
1558
|
"complexType": {
|
|
1559
1559
|
"original": "LoadByPkHandler",
|
|
1560
|
-
"resolved": "(objPK: { pk: any
|
|
1560
|
+
"resolved": "(objPK: { pk: Record<string, any>; }, redirectFrom?: string) => void",
|
|
1561
1561
|
"references": {
|
|
1562
1562
|
"LoadByPkHandler": {
|
|
1563
1563
|
"location": "global"
|
|
@@ -71,7 +71,7 @@ export class SnkCrud {
|
|
|
71
71
|
this.configName = undefined;
|
|
72
72
|
this.filterBarTitle = undefined;
|
|
73
73
|
this.selectionToastConfig = undefined;
|
|
74
|
-
this.showActionButtons =
|
|
74
|
+
this.showActionButtons = true;
|
|
75
75
|
this.actionsList = undefined;
|
|
76
76
|
this.taskbarManager = undefined;
|
|
77
77
|
this.recordsValidator = undefined;
|
|
@@ -679,7 +679,7 @@ export class SnkCrud {
|
|
|
679
679
|
},
|
|
680
680
|
"attribute": "show-action-buttons",
|
|
681
681
|
"reflect": false,
|
|
682
|
-
"defaultValue": "
|
|
682
|
+
"defaultValue": "true"
|
|
683
683
|
},
|
|
684
684
|
"actionsList": {
|
|
685
685
|
"type": "unknown",
|
|
@@ -43,7 +43,7 @@ export class GuideBuilder {
|
|
|
43
43
|
};
|
|
44
44
|
});
|
|
45
45
|
const newGuideItem = children.shift();
|
|
46
|
-
newGuideItem.label = isNewRecord ? this.getMessage("snkCrud.
|
|
46
|
+
newGuideItem.label = isNewRecord ? this.getMessage("snkCrud.newRecord") : currentRecord.__record__label__;
|
|
47
47
|
newGuideItem.children = children;
|
|
48
48
|
item.children = [newGuideItem];
|
|
49
49
|
return item;
|
package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js
CHANGED
|
@@ -245,6 +245,9 @@ export class SnkDetailView {
|
|
|
245
245
|
if (action.type === DUAction.FIELD_INVALIDATED) {
|
|
246
246
|
this.addErrorBadgeToBranchGuide();
|
|
247
247
|
}
|
|
248
|
+
else if (action.type === DUAction.DATA_LOADED) {
|
|
249
|
+
this.dataUnit.selectFirst();
|
|
250
|
+
}
|
|
248
251
|
}
|
|
249
252
|
addErrorBadgeToBranchGuide() {
|
|
250
253
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
|
@@ -299,7 +302,7 @@ export class SnkDetailView {
|
|
|
299
302
|
render() {
|
|
300
303
|
this.updateLabel();
|
|
301
304
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
302
|
-
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
|
305
|
+
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
|
303
306
|
}
|
|
304
307
|
static get is() { return "snk-detail-view"; }
|
|
305
308
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,12 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { Action, ApplicationContext, ElementIDUtils, UserInterface } from "@sankhyalabs/core";
|
|
2
14
|
import { Host, h } from "@stencil/core";
|
|
3
15
|
import { DataBinder } from "@sankhyalabs/ezui/dist/collection/utils/form";
|
|
4
16
|
import { focusOnFieldSerch, SEARCH_FIELD_FULL_WIDTH, FormLayout } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
17
|
+
import { getPKs } from "../../snk-image-input/utils/ImageUtils";
|
|
5
18
|
export class SnkFormView {
|
|
6
19
|
constructor() {
|
|
7
20
|
this._customEditors = new Map();
|
|
8
21
|
this._fieldProps = new Map();
|
|
22
|
+
this.dataUnitObserver = async (action) => {
|
|
23
|
+
if (action.type === Action.RECORDS_COPIED) {
|
|
24
|
+
const sourcePK = this.buildSourceRecordPK(action);
|
|
25
|
+
this.getImageField().forEach(async (field) => {
|
|
26
|
+
this.dataUnit.setFieldValue(field.name, JSON.stringify(sourcePK));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
this.customUiBuilders = new Map([
|
|
31
|
+
[UserInterface.IMAGE, (_a) => {
|
|
32
|
+
var { name } = _a, props = __rest(_a, ["name"]);
|
|
33
|
+
return h("snk-image-input", Object.assign({ dataUnit: this.dataUnit, maxSize: Infinity, fieldName: name, entityName: this.entityPath }, props));
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
]);
|
|
9
37
|
this._singleColumn = false;
|
|
38
|
+
this._currentFormLayout = undefined;
|
|
10
39
|
this.levelPath = undefined;
|
|
11
40
|
this.fieldSearch = undefined;
|
|
12
41
|
this.label = undefined;
|
|
@@ -23,6 +52,7 @@ export class SnkFormView {
|
|
|
23
52
|
this.fieldToFocus = undefined;
|
|
24
53
|
this.customEditors = undefined;
|
|
25
54
|
this.fieldsProps = undefined;
|
|
55
|
+
this.entityPath = undefined;
|
|
26
56
|
}
|
|
27
57
|
async showUp() {
|
|
28
58
|
if (this._formView) {
|
|
@@ -72,6 +102,11 @@ export class SnkFormView {
|
|
|
72
102
|
}
|
|
73
103
|
}
|
|
74
104
|
}
|
|
105
|
+
async observeDataUnit(newValue, oldValue) {
|
|
106
|
+
if (newValue !== oldValue && newValue) {
|
|
107
|
+
newValue.subscribe(this.dataUnitObserver);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
75
110
|
changeFix() {
|
|
76
111
|
this.fixed = !this.fixed;
|
|
77
112
|
this.emitEvent("fixed");
|
|
@@ -129,28 +164,41 @@ export class SnkFormView {
|
|
|
129
164
|
if (this._dataBinder != undefined) {
|
|
130
165
|
this._dataBinder.onDisconnectedCallback();
|
|
131
166
|
}
|
|
167
|
+
if (this.dataUnit) {
|
|
168
|
+
this.dataUnit.unsubscribe(this.dataUnitObserver);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async componentWillLoad() {
|
|
172
|
+
await this.initLayoutFormConfig();
|
|
173
|
+
}
|
|
174
|
+
async componentWillLoad() {
|
|
175
|
+
await this.initLayoutFormConfig();
|
|
132
176
|
}
|
|
133
177
|
componentDidLoad() {
|
|
134
178
|
this.observePropsCustomEditor(this.customEditors);
|
|
135
179
|
this.observeFieldsProps(this.fieldsProps);
|
|
136
|
-
this.initLayoutFormConfig();
|
|
137
180
|
}
|
|
138
181
|
async initLayoutFormConfig() {
|
|
139
|
-
|
|
140
|
-
|
|
182
|
+
var _a;
|
|
183
|
+
if (!this._application) {
|
|
184
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
185
|
+
}
|
|
186
|
+
const layoutFormConfig = await ((_a = this._application) === null || _a === void 0 ? void 0 : _a.getLayoutFormConfig());
|
|
141
187
|
if (layoutFormConfig) {
|
|
142
188
|
this.setSingleColumn(layoutFormConfig);
|
|
143
189
|
this.registerNotifyListeners(layoutFormConfig);
|
|
144
190
|
}
|
|
145
191
|
}
|
|
146
192
|
setSingleColumn(layoutFormConfig) {
|
|
147
|
-
this._singleColumn = (layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config) === FormLayout.CASCADE;
|
|
193
|
+
this._singleColumn = (layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config) === FormLayout.CASCADE || (layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config) === FormLayout.CLASSIC_CASCADE;
|
|
194
|
+
this._currentFormLayout = layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config;
|
|
148
195
|
}
|
|
149
196
|
registerNotifyListeners(layoutFormConfig) {
|
|
150
197
|
if (!layoutFormConfig)
|
|
151
198
|
return;
|
|
152
199
|
layoutFormConfig.onConfigChange((config) => {
|
|
153
|
-
this._singleColumn = (config === FormLayout.CASCADE);
|
|
200
|
+
this._singleColumn = (config === FormLayout.CASCADE || config === FormLayout.CLASSIC_CASCADE);
|
|
201
|
+
this._currentFormLayout = config;
|
|
154
202
|
});
|
|
155
203
|
}
|
|
156
204
|
componentDidRender() {
|
|
@@ -187,6 +235,22 @@ export class SnkFormView {
|
|
|
187
235
|
});
|
|
188
236
|
}
|
|
189
237
|
}
|
|
238
|
+
buildSourceRecordPK(action) {
|
|
239
|
+
var _a, _b;
|
|
240
|
+
const currentRecord = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
|
241
|
+
const sourceBase64 = currentRecord["__record__source__id__"];
|
|
242
|
+
const sourceRecord = JSON.parse(atob(sourceBase64 || ''));
|
|
243
|
+
delete sourceRecord["__DATA_UNIT_NAME__"];
|
|
244
|
+
const pkFields = Object.keys(getPKs(this.dataUnit));
|
|
245
|
+
const filteredSourceRecord = {};
|
|
246
|
+
for (const pkField of pkFields) {
|
|
247
|
+
filteredSourceRecord[pkField] = (_b = sourceRecord[pkField]) === null || _b === void 0 ? void 0 : _b.value;
|
|
248
|
+
}
|
|
249
|
+
return filteredSourceRecord;
|
|
250
|
+
}
|
|
251
|
+
getImageField() {
|
|
252
|
+
return this.dataUnit.metadata.fields.filter(field => field.userInterface === UserInterface.IMAGE);
|
|
253
|
+
}
|
|
190
254
|
render() {
|
|
191
255
|
return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full", ref: ref => this._headerContainer = ref }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
|
|
192
256
|
h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
|
|
@@ -194,7 +258,7 @@ export class SnkFormView {
|
|
|
194
258
|
?
|
|
195
259
|
h("snk-form-summary", { summary: this.getCardSummary() })
|
|
196
260
|
:
|
|
197
|
-
h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event), singleColumn: this._singleColumn }), this.fieldSearch && h("ez-popover", { ref: elem => (this._ezPopoverFieldColumn = elem), overlayType: "none" }, this.fieldSearch)));
|
|
261
|
+
h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event), singleColumn: this._singleColumn, customUiBuilders: this.customUiBuilders, formLayout: this._currentFormLayout }), this.fieldSearch && h("ez-popover", { ref: elem => (this._ezPopoverFieldColumn = elem), overlayType: "none" }, this.fieldSearch)));
|
|
198
262
|
}
|
|
199
263
|
static get is() { return "snk-form-view"; }
|
|
200
264
|
static get encapsulation() { return "scoped"; }
|
|
@@ -510,12 +574,30 @@ export class SnkFormView {
|
|
|
510
574
|
"tags": [],
|
|
511
575
|
"text": "Lista de propriedades que ser\u00E3o alteradas/adicionadas por coluna."
|
|
512
576
|
}
|
|
577
|
+
},
|
|
578
|
+
"entityPath": {
|
|
579
|
+
"type": "string",
|
|
580
|
+
"mutable": false,
|
|
581
|
+
"complexType": {
|
|
582
|
+
"original": "string",
|
|
583
|
+
"resolved": "string",
|
|
584
|
+
"references": {}
|
|
585
|
+
},
|
|
586
|
+
"required": false,
|
|
587
|
+
"optional": false,
|
|
588
|
+
"docs": {
|
|
589
|
+
"tags": [],
|
|
590
|
+
"text": "Determina todo o caminho de entidades."
|
|
591
|
+
},
|
|
592
|
+
"attribute": "entity-path",
|
|
593
|
+
"reflect": false
|
|
513
594
|
}
|
|
514
595
|
};
|
|
515
596
|
}
|
|
516
597
|
static get states() {
|
|
517
598
|
return {
|
|
518
|
-
"_singleColumn": {}
|
|
599
|
+
"_singleColumn": {},
|
|
600
|
+
"_currentFormLayout": {}
|
|
519
601
|
};
|
|
520
602
|
}
|
|
521
603
|
static get events() {
|
|
@@ -675,6 +757,9 @@ export class SnkFormView {
|
|
|
675
757
|
}, {
|
|
676
758
|
"propName": "fieldsProps",
|
|
677
759
|
"methodName": "observeFieldsProps"
|
|
760
|
+
}, {
|
|
761
|
+
"propName": "dataUnit",
|
|
762
|
+
"methodName": "observeDataUnit"
|
|
678
763
|
}];
|
|
679
764
|
}
|
|
680
765
|
}
|
|
@@ -283,7 +283,7 @@ export class SnkGuidesViewer {
|
|
|
283
283
|
if (sheet == undefined) {
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
|
-
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps });
|
|
286
|
+
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps, entityPath: params.entityPath });
|
|
287
287
|
})));
|
|
288
288
|
}
|
|
289
289
|
wrapDetail(levels, content) {
|
|
@@ -328,7 +328,7 @@ export class SnkGuidesViewer {
|
|
|
328
328
|
if (!sheet)
|
|
329
329
|
return;
|
|
330
330
|
const cardConfig = (_b = (_a = this.masterFormConfig) === null || _a === void 0 ? void 0 : _a.cardsState) === null || _b === void 0 ? void 0 : _b.get(cardId);
|
|
331
|
-
return (h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_d = (_c = this.masterFormConfig) === null || _c === void 0 ? void 0 : _c.summary) === null || _d === void 0 ? void 0 : _d.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: cardId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar()));
|
|
331
|
+
return (h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_d = (_c = this.masterFormConfig) === null || _c === void 0 ? void 0 : _c.summary) === null || _d === void 0 ? void 0 : _d.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: cardId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch, entityPath: this.entityPath }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar()));
|
|
332
332
|
}
|
|
333
333
|
isDetailGuide(childEntityName, levels) {
|
|
334
334
|
return childEntityName || levels.length > 0;
|
|
@@ -600,8 +600,9 @@ export class SnkGuidesViewer {
|
|
|
600
600
|
fieldToFocus: this._fieldToGetFocus,
|
|
601
601
|
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
|
602
602
|
propsCustomEditor: this._customEditors,
|
|
603
|
-
fieldsProps: this._fieldsProps
|
|
604
|
-
|
|
603
|
+
fieldsProps: this._fieldsProps,
|
|
604
|
+
entityPath: this.entityPath
|
|
605
|
+
}), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID, layoutFormConfig: false, disableNumberingConfig: true })));
|
|
605
606
|
}
|
|
606
607
|
render() {
|
|
607
608
|
if (!this.dataUnit || !this._configManager.isLoaded) {
|