@sankhyalabs/sankhyablocks 1.3.31-beta.4 → 1.3.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-ebe8245e.js → index-1133bc2a.js} +9 -453
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +95 -118
- package/dist/cjs/snk-pesquisa.cjs.entry.js +2 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +0 -4
- package/dist/collection/components/snk-application/snk-application.js +20 -61
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +21 -36
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +3 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -0
- package/dist/components/snk-application2.js +94 -118
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/esm/{index-7565ae23.js → index-ffda6382.js} +10 -453
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +95 -118
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-bb31ea2a.entry.js → p-2a7b4cb3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6d82d7fd.entry.js → p-49fdec1f.entry.js} +1 -1
- package/dist/sankhyablocks/p-9bc9abe0.entry.js +69 -0
- package/dist/sankhyablocks/p-edcb9d8e.js +2 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +5 -6
- package/dist/types/components.d.ts +1 -119
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
- package/package.json +5 -5
- package/react/components.d.ts +0 -4
- package/react/components.js +0 -4
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +0 -174
- package/dist/cjs/snk-form.cjs.entry.js +0 -95
- package/dist/cjs/snk-grid.cjs.entry.js +0 -64
- package/dist/cjs/snk-taskbar.cjs.entry.js +0 -159
- package/dist/cjs/taskbar-elements-589a3744.js +0 -68
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +0 -6
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -429
- package/dist/collection/components/snk-form/snk-form.css +0 -3
- package/dist/collection/components/snk-form/snk-form.js +0 -194
- package/dist/collection/components/snk-grid/snk-grid.css +0 -5
- package/dist/collection/components/snk-grid/snk-grid.js +0 -128
- package/dist/collection/components/snk-taskbar/component/snk-popup-button.js +0 -7
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +0 -63
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +0 -3
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +0 -268
- package/dist/components/snk-data-unit.d.ts +0 -11
- package/dist/components/snk-data-unit.js +0 -198
- package/dist/components/snk-form.d.ts +0 -11
- package/dist/components/snk-form.js +0 -121
- package/dist/components/snk-grid.d.ts +0 -11
- package/dist/components/snk-grid.js +0 -88
- package/dist/components/snk-taskbar.d.ts +0 -11
- package/dist/components/snk-taskbar.js +0 -6
- package/dist/components/snk-taskbar2.js +0 -239
- package/dist/esm/snk-data-unit.entry.js +0 -170
- package/dist/esm/snk-form.entry.js +0 -91
- package/dist/esm/snk-grid.entry.js +0 -60
- package/dist/esm/snk-taskbar.entry.js +0 -155
- package/dist/esm/taskbar-elements-b6822601.js +0 -66
- package/dist/sankhyablocks/p-306224bf.entry.js +0 -1
- package/dist/sankhyablocks/p-4ee1e12b.js +0 -1
- package/dist/sankhyablocks/p-88278b85.entry.js +0 -1
- package/dist/sankhyablocks/p-90b832f7.js +0 -2
- package/dist/sankhyablocks/p-a4b2fa10.entry.js +0 -69
- package/dist/sankhyablocks/p-bb8d8fe7.entry.js +0 -1
- package/dist/sankhyablocks/p-e7ade160.entry.js +0 -1
- package/dist/types/components/snk-taskbar/component/snk-popup-button.d.ts +0 -12
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +0 -24
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -28
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component, h, Method, Event } from "@stencil/core";
|
|
2
2
|
import { DataType, ErrorTracking } from "@sankhyalabs/core";
|
|
3
|
-
import { DependencyType } from "@sankhyalabs/core";
|
|
4
3
|
import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
|
|
5
4
|
import { DataFetcher } from "../../lib/http/data-fetcher/DataFetcher";
|
|
6
5
|
import UrlUtils from "../../lib/utils/urlutils";
|
|
@@ -11,13 +10,13 @@ import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-con
|
|
|
11
10
|
import { ApplicationContext } from "@sankhyalabs/core";
|
|
12
11
|
import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
|
|
13
12
|
import { PesquisaFetcher } from "../../lib/http/data-fetcher/fetchers/pesquisa-fetcher";
|
|
13
|
+
import { DependencyType } from "@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";
|
|
14
14
|
import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
|
|
15
15
|
import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
|
|
16
16
|
import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
|
|
17
17
|
import { agGridLicense } from '../../lib/licenses/sankhyalicense.module';
|
|
18
18
|
export class SnkApplication {
|
|
19
19
|
constructor() {
|
|
20
|
-
this._duCache = new Map();
|
|
21
20
|
this._requestListener = new RequestListenerLoadingBar();
|
|
22
21
|
}
|
|
23
22
|
get parameters() {
|
|
@@ -99,14 +98,13 @@ export class SnkApplication {
|
|
|
99
98
|
return this.parameters.asDate(name, this.resourceID);
|
|
100
99
|
}
|
|
101
100
|
async showPopUp(content) {
|
|
101
|
+
this.clearPopUpContent();
|
|
102
102
|
this._popUp.appendChild(content);
|
|
103
|
-
this._popUp
|
|
103
|
+
this._popUp.opened = true;
|
|
104
104
|
}
|
|
105
105
|
async closePopUp() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
this._popUp["opened"] = false;
|
|
106
|
+
this.clearPopUpContent();
|
|
107
|
+
this._popUp.opened = false;
|
|
110
108
|
}
|
|
111
109
|
async temOpcional(opcional) {
|
|
112
110
|
const opts = opcional.split(",");
|
|
@@ -178,22 +176,6 @@ export class SnkApplication {
|
|
|
178
176
|
dataUnit.loadMetadata().then(() => resolve(dataUnit));
|
|
179
177
|
});
|
|
180
178
|
}
|
|
181
|
-
async getOrCreateDataUnit(entityName, dataUnitName) {
|
|
182
|
-
return new Promise((resolve, reject) => {
|
|
183
|
-
const dataUnit = this._duCache.get(dataUnitName);
|
|
184
|
-
if (dataUnit) {
|
|
185
|
-
resolve(dataUnit);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
this.createDataunit(entityName).then(dataUnit => {
|
|
189
|
-
if (dataUnitName) {
|
|
190
|
-
this._duCache.set(dataUnitName, dataUnit);
|
|
191
|
-
}
|
|
192
|
-
resolve(dataUnit);
|
|
193
|
-
}).catch(reason => reject(reason));
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
179
|
async getResourceID() {
|
|
198
180
|
return Promise.resolve(this.resourceID);
|
|
199
181
|
}
|
|
@@ -212,8 +194,8 @@ export class SnkApplication {
|
|
|
212
194
|
async loadFormConfig(name) {
|
|
213
195
|
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
214
196
|
}
|
|
215
|
-
async loadGridConfig(
|
|
216
|
-
return this.gridConfigFetcher.getConfig(
|
|
197
|
+
async loadGridConfig() {
|
|
198
|
+
return this.gridConfigFetcher.getConfig(this.resourceID);
|
|
217
199
|
}
|
|
218
200
|
async saveGridConfig(config) {
|
|
219
201
|
return this.gridConfigFetcher.saveConfig(config, this.resourceID);
|
|
@@ -297,7 +279,7 @@ export class SnkApplication {
|
|
|
297
279
|
pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
|
|
298
280
|
pesquisaContent.selectItem = (option) => {
|
|
299
281
|
accept(option);
|
|
300
|
-
this.
|
|
282
|
+
this.clearPopUpTitle();
|
|
301
283
|
this.closePopUp();
|
|
302
284
|
};
|
|
303
285
|
this.setPopUpTitle(DESCRIPTIONENTITY);
|
|
@@ -314,11 +296,18 @@ export class SnkApplication {
|
|
|
314
296
|
accept(window['isDebugMode']);
|
|
315
297
|
});
|
|
316
298
|
}
|
|
317
|
-
|
|
318
|
-
this._popUp
|
|
299
|
+
clearPopUpContent() {
|
|
300
|
+
if (this._popUp) {
|
|
301
|
+
Array.from(this._popUp.children).forEach(c => {
|
|
302
|
+
this._popUp.removeChild(c);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
clearPopUpTitle() {
|
|
307
|
+
this._popUp.ezTitle = "";
|
|
319
308
|
}
|
|
320
309
|
setPopUpTitle(title) {
|
|
321
|
-
this._popUp
|
|
310
|
+
this._popUp.ezTitle = title;
|
|
322
311
|
}
|
|
323
312
|
componentWillLoad() {
|
|
324
313
|
this._errorHandler = new SnkErrorHandler(this);
|
|
@@ -328,7 +317,6 @@ export class SnkApplication {
|
|
|
328
317
|
});
|
|
329
318
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
|
330
319
|
ErrorTracking.init();
|
|
331
|
-
ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
|
332
320
|
}
|
|
333
321
|
connectedCallback() {
|
|
334
322
|
DataFetcher.addRequestListener(this._requestListener);
|
|
@@ -708,32 +696,6 @@ export class SnkApplication {
|
|
|
708
696
|
"tags": []
|
|
709
697
|
}
|
|
710
698
|
},
|
|
711
|
-
"getOrCreateDataUnit": {
|
|
712
|
-
"complexType": {
|
|
713
|
-
"signature": "(entityName: string, dataUnitName: string) => Promise<DataUnit>",
|
|
714
|
-
"parameters": [{
|
|
715
|
-
"tags": [],
|
|
716
|
-
"text": ""
|
|
717
|
-
}, {
|
|
718
|
-
"tags": [],
|
|
719
|
-
"text": ""
|
|
720
|
-
}],
|
|
721
|
-
"references": {
|
|
722
|
-
"Promise": {
|
|
723
|
-
"location": "global"
|
|
724
|
-
},
|
|
725
|
-
"DataUnit": {
|
|
726
|
-
"location": "import",
|
|
727
|
-
"path": "@sankhyalabs/core"
|
|
728
|
-
}
|
|
729
|
-
},
|
|
730
|
-
"return": "Promise<DataUnit>"
|
|
731
|
-
},
|
|
732
|
-
"docs": {
|
|
733
|
-
"text": "",
|
|
734
|
-
"tags": []
|
|
735
|
-
}
|
|
736
|
-
},
|
|
737
699
|
"getResourceID": {
|
|
738
700
|
"complexType": {
|
|
739
701
|
"signature": "() => Promise<string>",
|
|
@@ -903,11 +865,8 @@ export class SnkApplication {
|
|
|
903
865
|
},
|
|
904
866
|
"loadGridConfig": {
|
|
905
867
|
"complexType": {
|
|
906
|
-
"signature": "(
|
|
907
|
-
"parameters": [
|
|
908
|
-
"tags": [],
|
|
909
|
-
"text": ""
|
|
910
|
-
}],
|
|
868
|
+
"signature": "() => Promise<EzGridConfig>",
|
|
869
|
+
"parameters": [],
|
|
911
870
|
"references": {
|
|
912
871
|
"Promise": {
|
|
913
872
|
"location": "global"
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
--snk-pesquisa__content-scrollbar--background-color: var(--text--primary, #626e82);
|
|
22
22
|
|
|
23
23
|
/*@doc Define o raio da borda da barra de rolagem do componente.*/
|
|
24
|
-
--snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-
|
|
24
|
+
--snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-small, 6px);
|
|
25
25
|
|
|
26
26
|
/*@doc Define a largura da barra de rolagem do componente.*/
|
|
27
|
-
--snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px)
|
|
27
|
+
--snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px);
|
|
28
28
|
|
|
29
29
|
max-height: 100%;
|
|
30
30
|
height: 100%;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChangeOperation,
|
|
2
|
-
import { gql } from "graphql-request";
|
|
1
|
+
import { DataUnit, ChangeOperation, StringUtils, DataType, } from "@sankhyalabs/core";
|
|
3
2
|
import { DataFetcher } from "../DataFetcher";
|
|
3
|
+
import { gql } from "graphql-request";
|
|
4
4
|
export default class DataUnitFetcher {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.templateByQuery = new Map();
|
|
@@ -32,9 +32,9 @@ export default class DataUnitFetcher {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}`);
|
|
35
|
-
this.templateByQuery.set("fetchData", gql `query($dataunit: String! $limit: Int $offset:Int $
|
|
35
|
+
this.templateByQuery.set("fetchData", gql `query($dataunit: String! $limit: Int $offset:Int $filter: [InputFilter!] $sort: [InputSort!]) {
|
|
36
36
|
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
37
|
-
data(limit: $limit offset: $offset filters: $
|
|
37
|
+
data(limit: $limit offset: $offset filters: $filter sort: $sort){
|
|
38
38
|
limit
|
|
39
39
|
offset
|
|
40
40
|
total
|
|
@@ -63,7 +63,7 @@ export default class DataUnitFetcher {
|
|
|
63
63
|
getDataUnit(entityName, resourceID) {
|
|
64
64
|
const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
|
|
65
65
|
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
|
66
|
-
dataUnit.dataLoader = (dataUnit,
|
|
66
|
+
dataUnit.dataLoader = (dataUnit, page, sort, filters) => this.loadData(dataUnit, page, sort, filters);
|
|
67
67
|
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
68
68
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
69
69
|
return dataUnit;
|
|
@@ -100,24 +100,25 @@ export default class DataUnitFetcher {
|
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
loadData(dataUnit,
|
|
103
|
+
loadData(dataUnit, page, sort, filter) {
|
|
104
104
|
return new Promise((resolve, reject) => {
|
|
105
|
-
var _a;
|
|
106
|
-
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
var _a, _b, _c;
|
|
106
|
+
const variables = { dataunit: dataUnit.name, sort, filter };
|
|
107
|
+
if (page) {
|
|
108
|
+
variables.limit = page.limit;
|
|
109
|
+
variables.offset = page.offset;
|
|
110
|
+
}
|
|
111
|
+
if (!StringUtils.isEmpty((_a = page === null || page === void 0 ? void 0 : page.quickFilter) === null || _a === void 0 ? void 0 : _a.term)) {
|
|
111
112
|
if (variables.filter === undefined) {
|
|
112
113
|
variables.filter = [];
|
|
113
114
|
}
|
|
114
115
|
const quickFilterCriteria = {
|
|
115
116
|
name: "__QUICK_FILTER__",
|
|
116
117
|
expression: "__QUICK_FILTER__",
|
|
117
|
-
params: [{ name: "term", dataType: DataType.TEXT, value: quickFilter.term }]
|
|
118
|
+
params: [{ name: "term", dataType: DataType.TEXT, value: page.quickFilter.term }]
|
|
118
119
|
};
|
|
119
|
-
if (((
|
|
120
|
-
quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: quickFilter.fields });
|
|
120
|
+
if (((_c = (_b = page.quickFilter) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
121
|
+
quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: page.quickFilter.fields });
|
|
121
122
|
}
|
|
122
123
|
variables.filter.push(quickFilterCriteria);
|
|
123
124
|
}
|
|
@@ -127,32 +128,16 @@ export default class DataUnitFetcher {
|
|
|
127
128
|
query: this.templateByQuery.get("fetchData"),
|
|
128
129
|
})
|
|
129
130
|
.then((resp) => {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const firstRecord = offset + 1;
|
|
134
|
-
const lastRecord = offset + Math.min(records.length, limit);
|
|
135
|
-
const currentPage = offset / limit;
|
|
136
|
-
paginationInfo = {
|
|
137
|
-
firstRecord,
|
|
138
|
-
lastRecord,
|
|
139
|
-
total,
|
|
140
|
-
currentPage,
|
|
141
|
-
hasMore
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
const processedRecords = [];
|
|
145
|
-
records.forEach((responseRecord) => {
|
|
131
|
+
const pageResult = resp.data;
|
|
132
|
+
const records = [];
|
|
133
|
+
pageResult.records.forEach((responseRecord) => {
|
|
146
134
|
const duRecord = { __record__id__: responseRecord.id };
|
|
147
135
|
responseRecord.fields.forEach(({ name, value }) => {
|
|
148
136
|
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
149
137
|
});
|
|
150
|
-
|
|
151
|
-
});
|
|
152
|
-
resolve({
|
|
153
|
-
paginationInfo,
|
|
154
|
-
records: processedRecords
|
|
138
|
+
records.push(duRecord);
|
|
155
139
|
});
|
|
140
|
+
resolve(Object.assign(Object.assign({}, pageResult), { records }));
|
|
156
141
|
})
|
|
157
142
|
.catch((error) => {
|
|
158
143
|
reject(error);
|
|
@@ -4,16 +4,15 @@ export default class GridConfigFetcher extends ResourceFetcher {
|
|
|
4
4
|
super(...arguments);
|
|
5
5
|
this.GRID_CONFIG_VERSION = "V3:";
|
|
6
6
|
}
|
|
7
|
-
getConfig(
|
|
7
|
+
getConfig(resourceID) {
|
|
8
8
|
const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
this.loadResource(completePath)
|
|
11
11
|
.then(loadedResource => {
|
|
12
|
-
let config = undefined;
|
|
13
12
|
if (loadedResource) {
|
|
14
|
-
config = JSON.parse(loadedResource);
|
|
13
|
+
let config = JSON.parse(loadedResource);
|
|
14
|
+
resolve(config);
|
|
15
15
|
}
|
|
16
|
-
resolve(config);
|
|
17
16
|
}).catch((error) => {
|
|
18
17
|
reject(error);
|
|
19
18
|
});
|
|
@@ -16,6 +16,7 @@ export class PesquisaFetcher {
|
|
|
16
16
|
}`);
|
|
17
17
|
}
|
|
18
18
|
loadSearchOptions(entityName, argument, criteria, options) {
|
|
19
|
+
argument = (argument === null || argument === void 0 ? void 0 : argument.trim()) ? `%${argument}` : argument === null || argument === void 0 ? void 0 : argument.trim();
|
|
19
20
|
return new Promise((resolve, reject) => {
|
|
20
21
|
DataFetcher.get()
|
|
21
22
|
.callGraphQL({
|