@sankhyalabs/sankhyablocks 5.4.2 → 5.5.0
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/{SnkMessageBuilder-115e8a80.js → SnkMessageBuilder-26da04f7.js} +35 -1
- package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
- package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +3 -315
- package/dist/cjs/snk-attach.cjs.entry.js +449 -0
- package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +22 -13
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-c43df27b.js} +4 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -5
- package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +11 -4
- package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-e6a65393.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
- package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
- package/dist/cjs/{snk-simple-crud.cjs.entry.js → snk-simple-bar_2.cjs.entry.js} +47 -5
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +5 -4
- package/dist/cjs/taskbar-elements-80285601.js +313 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/snk-attach/interfaces/index.js +1 -0
- package/dist/collection/components/snk-attach/snk-attach.css +8 -0
- package/dist/collection/components/snk-attach/snk-attach.js +202 -0
- package/dist/collection/components/snk-attach/structure/crud-config-builder.js +37 -0
- package/dist/collection/components/snk-attach/structure/data-unit-builder.js +106 -0
- package/dist/collection/components/snk-attach/structure/index.js +3 -0
- package/dist/collection/components/snk-attach/structure/taskbar-builder.js +47 -0
- package/dist/collection/components/snk-configurator/snk-configurator.js +3 -3
- package/dist/collection/components/snk-crud/snk-crud.js +22 -11
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +11 -3
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +37 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +65 -2
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +4 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/attach-fetcher.js +136 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.js +6 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.js +3 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +5 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -0
- package/dist/collection/lib/message/resources/snk-simple-bar.msg.js +3 -0
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
- package/dist/collection/lib/utils/constants.js +1 -0
- package/dist/components/SnkMessageBuilder.js +35 -1
- package/dist/components/constants.js +1 -0
- package/dist/components/dataunit-fetcher.js +317 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-application2.js +2 -314
- package/dist/components/snk-attach.d.ts +11 -0
- package/dist/components/snk-attach.js +6 -0
- package/dist/components/snk-attach2.js +498 -0
- package/dist/components/snk-crud.js +77 -48
- package/dist/components/snk-data-unit2.js +4 -0
- package/dist/components/snk-filter-bar2.js +1 -1
- package/dist/components/snk-grid2.js +11 -4
- package/dist/components/snk-simple-bar.js +1 -41
- package/dist/components/snk-simple-bar2.js +59 -0
- package/dist/components/snk-simple-crud.js +1 -328
- package/dist/{esm/snk-simple-crud.entry.js → components/snk-simple-crud2.js} +73 -18
- package/dist/components/snk-taskbar2.js +7 -2
- package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-7a9392e6.js} +35 -1
- package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
- package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +3 -315
- package/dist/esm/snk-attach.entry.js +445 -0
- package/dist/esm/snk-config-options.entry.js +1 -1
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +23 -14
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-f9e4c694.js} +4 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -5
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-grid-config.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +11 -4
- package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-62a9f74d.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -4
- package/dist/esm/snk-select-box.entry.js +1 -1
- package/dist/esm/snk-simple-bar_2.entry.js +324 -0
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +5 -4
- package/dist/esm/taskbar-elements-055ba1ad.js +309 -0
- package/dist/sankhyablocks/p-17375123.js +1 -0
- package/dist/sankhyablocks/{p-b80cf644.entry.js → p-1c0ee011.entry.js} +1 -1
- package/dist/sankhyablocks/p-4512cc6c.entry.js +1 -0
- package/dist/sankhyablocks/p-5cbbe1f7.entry.js +1 -0
- package/dist/sankhyablocks/p-63d01871.entry.js +1 -0
- package/dist/sankhyablocks/{p-0a1e7f75.entry.js → p-6ac29569.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f4d36823.entry.js → p-6f0b3cc0.entry.js} +1 -1
- package/dist/sankhyablocks/p-741b00ef.entry.js +1 -0
- package/dist/sankhyablocks/{p-6516f35a.entry.js → p-86f75e7a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-32599159.entry.js → p-8b02b276.entry.js} +1 -1
- package/dist/sankhyablocks/p-92a0fca4.js +1 -0
- package/dist/sankhyablocks/p-999d1953.entry.js +1 -0
- package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-a412992c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-703dddb9.js → p-aeffd219.js} +1 -1
- package/dist/sankhyablocks/p-b2523981.entry.js +11 -0
- package/dist/sankhyablocks/p-c3efd4eb.entry.js +1 -0
- package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
- package/dist/sankhyablocks/p-ebe876f5.entry.js +1 -0
- package/dist/sankhyablocks/p-ed438690.js +1 -0
- package/dist/sankhyablocks/p-f2223502.js +1 -0
- package/dist/sankhyablocks/p-f3d0c744.entry.js +1 -0
- package/dist/sankhyablocks/p-f821768b.js +74 -0
- package/dist/sankhyablocks/{p-f29caa0a.entry.js → p-f8c66aa3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-adf50831.entry.js → p-fac37198.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/interfaces/index.d.ts +10 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +45 -0
- package/dist/types/components/snk-attach/structure/crud-config-builder.d.ts +7 -0
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +16 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +3 -0
- package/dist/types/components/snk-attach/structure/taskbar-builder.d.ts +8 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
- package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +14 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
- package/dist/types/components.d.ts +67 -0
- package/dist/types/global.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -2
- package/dist/types/lib/http/data-fetcher/fetchers/attach-fetcher.d.ts +14 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.d.ts +13 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.d.ts +26 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.d.ts +3 -0
- package/dist/types/lib/message/resources/snk-attach.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
- package/dist/types/lib/utils/constants.d.ts +2 -1
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/index-fc7ca86c.js +0 -200
- package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -30
- package/dist/cjs/taskbar-elements-5e87cf44.js +0 -115
- package/dist/esm/index-e467ade5.js +0 -198
- package/dist/esm/snk-simple-bar.entry.js +0 -26
- package/dist/esm/taskbar-elements-10d80c79.js +0 -112
- package/dist/sankhyablocks/p-1393dc00.entry.js +0 -1
- package/dist/sankhyablocks/p-1c17eecf.entry.js +0 -1
- package/dist/sankhyablocks/p-2ecf14ff.js +0 -1
- package/dist/sankhyablocks/p-340d6fb0.entry.js +0 -84
- package/dist/sankhyablocks/p-74724fa7.js +0 -1
- package/dist/sankhyablocks/p-79f01b63.entry.js +0 -1
- package/dist/sankhyablocks/p-81e85890.entry.js +0 -1
- package/dist/sankhyablocks/p-94e6fc90.entry.js +0 -1
- package/dist/sankhyablocks/p-98f7f796.js +0 -1
- package/dist/sankhyablocks/p-b3e71248.entry.js +0 -1
- package/dist/sankhyablocks/p-bc281de0.js +0 -1
- package/dist/sankhyablocks/p-d61759a5.entry.js +0 -1
- package/dist/sankhyablocks/p-d65809d5.entry.js +0 -1
- package/dist/sankhyablocks/p-f587a454.js +0 -1
- package/dist/types/components/snk-application/snk-application.d.ts +0 -259
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -73
- package/dist/types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.d.ts +0 -40
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +0 -27
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +0 -23
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +0 -23
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +0 -29
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -25
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +0 -19
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -38
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +0 -74
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +0 -53
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -95
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -59
@@ -1,11 +1,12 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
|
2
|
-
import { WaitingChangeException, WarningException, ErrorException, ObjectUtils,
|
2
|
+
import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DateUtils, StringUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking, DataType } from '@sankhyalabs/core';
|
3
3
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-b3d8b2d5.js';
|
4
4
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
5
|
import { P as PesquisaFetcher } from './pesquisa-fetcher-bd6af0e3.js';
|
6
6
|
import { G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage-ac77ff39.js';
|
7
|
+
import { D as DataUnitFetcher } from './dataunit-fetcher-d32c6a47.js';
|
7
8
|
import { R as ResourceFetcher } from './form-config-fetcher-018e7e73.js';
|
8
|
-
import { S as SnkMessageBuilder } from './SnkMessageBuilder-
|
9
|
+
import { S as SnkMessageBuilder } from './SnkMessageBuilder-7a9392e6.js';
|
9
10
|
import './_commonjsHelpers-9943807e.js';
|
10
11
|
|
11
12
|
class SnkErrorHandler {
|
@@ -116,319 +117,6 @@ class TotalsFetcher {
|
|
116
117
|
}
|
117
118
|
}
|
118
119
|
|
119
|
-
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
120
|
-
var t = {};
|
121
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
122
|
-
t[p] = s[p];
|
123
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
124
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
125
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
126
|
-
t[p[i]] = s[p[i]];
|
127
|
-
}
|
128
|
-
return t;
|
129
|
-
};
|
130
|
-
class DataUnitFetcher {
|
131
|
-
constructor() {
|
132
|
-
this.templateByQuery = new Map();
|
133
|
-
this._loadDataTimeout = {};
|
134
|
-
this.buldTemplates();
|
135
|
-
}
|
136
|
-
buldTemplates() {
|
137
|
-
this.templateByQuery.set("fetchDataUnit", dist.gql `query($name: String!) {
|
138
|
-
$queryAlias$: fetchDataUnit(name: $name){
|
139
|
-
name
|
140
|
-
fields{
|
141
|
-
name
|
142
|
-
defaultValue
|
143
|
-
label
|
144
|
-
visible
|
145
|
-
readOnly
|
146
|
-
required
|
147
|
-
dataType
|
148
|
-
userInterface
|
149
|
-
calculated
|
150
|
-
group
|
151
|
-
order
|
152
|
-
properties{
|
153
|
-
name
|
154
|
-
value
|
155
|
-
}
|
156
|
-
dependencies{
|
157
|
-
masterFields
|
158
|
-
type
|
159
|
-
expression
|
160
|
-
}
|
161
|
-
}
|
162
|
-
children{
|
163
|
-
name
|
164
|
-
label
|
165
|
-
links{
|
166
|
-
source
|
167
|
-
target
|
168
|
-
}
|
169
|
-
}
|
170
|
-
}
|
171
|
-
}`);
|
172
|
-
this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!] $parentRecordId: String) {
|
173
|
-
$queryAlias$: fetchDataUnit(name: $dataunit){
|
174
|
-
data(limit: $limit offset: $offset filters: $filters sort: $sort parentRecordId: $parentRecordId){
|
175
|
-
limit
|
176
|
-
offset
|
177
|
-
total
|
178
|
-
hasMore
|
179
|
-
records{
|
180
|
-
id
|
181
|
-
label
|
182
|
-
fields {
|
183
|
-
name
|
184
|
-
value
|
185
|
-
}
|
186
|
-
}
|
187
|
-
}
|
188
|
-
}
|
189
|
-
}`);
|
190
|
-
this.templateByQuery.set("saveData", dist.gql `mutation($changes: [InputBatchChange!]!) {
|
191
|
-
$queryAlias$: batchOperationDataUnit(changes: $changes){
|
192
|
-
oldId
|
193
|
-
id
|
194
|
-
label
|
195
|
-
ownerDataUnitName
|
196
|
-
fields {
|
197
|
-
name
|
198
|
-
value
|
199
|
-
}
|
200
|
-
}
|
201
|
-
}`);
|
202
|
-
this.templateByQuery.set("fetchDataRecord", dist.gql `query($dataunit: String! $recordID: [String!]) {
|
203
|
-
$queryAlias$: fetchDataUnit(name: $dataunit){
|
204
|
-
record(id: $recordID){
|
205
|
-
id
|
206
|
-
label
|
207
|
-
fields {
|
208
|
-
name
|
209
|
-
value
|
210
|
-
}
|
211
|
-
}
|
212
|
-
}
|
213
|
-
}`);
|
214
|
-
}
|
215
|
-
getDataUnit(entityName, resourceID, parentDataUnit) {
|
216
|
-
const dataUnit = parentDataUnit != undefined ? parentDataUnit.getChildDataunit(`dd://${entityName}/${resourceID}`) : new DataUnit(`dd://${entityName}/${resourceID}`);
|
217
|
-
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
218
|
-
dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
|
219
|
-
dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
|
220
|
-
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
221
|
-
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
222
|
-
return dataUnit;
|
223
|
-
}
|
224
|
-
loadMetadata(dataUnit) {
|
225
|
-
return new Promise((resolve, reject) => {
|
226
|
-
DataFetcher.get()
|
227
|
-
.callGraphQL({
|
228
|
-
values: { name: dataUnit.name },
|
229
|
-
query: this.templateByQuery.get("fetchDataUnit"),
|
230
|
-
})
|
231
|
-
.then((resp) => {
|
232
|
-
var _a;
|
233
|
-
const metadata = {
|
234
|
-
name: resp.name,
|
235
|
-
label: resp.name,
|
236
|
-
children: [...resp.children],
|
237
|
-
fields: []
|
238
|
-
};
|
239
|
-
(_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
|
240
|
-
let properties = undefined;
|
241
|
-
if (Array.isArray(source.properties)) {
|
242
|
-
properties = {};
|
243
|
-
if (source.calculated) {
|
244
|
-
properties.gridHeaderTooltip = "Campos calculados não podem ser ordenados";
|
245
|
-
}
|
246
|
-
source.properties.forEach((prop) => (properties[prop.name] = prop.value));
|
247
|
-
}
|
248
|
-
metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
|
249
|
-
});
|
250
|
-
metadata.fields.sort((a, b) => a.order - b.order);
|
251
|
-
resolve(metadata);
|
252
|
-
})
|
253
|
-
.catch((error) => {
|
254
|
-
reject(error);
|
255
|
-
});
|
256
|
-
});
|
257
|
-
}
|
258
|
-
loadData(dataUnit, request) {
|
259
|
-
const duName = dataUnit.name;
|
260
|
-
if (this._loadDataTimeout[duName]) {
|
261
|
-
clearTimeout(this._loadDataTimeout[duName]);
|
262
|
-
delete this._loadDataTimeout[duName];
|
263
|
-
}
|
264
|
-
return new Promise((resolve, reject) => {
|
265
|
-
this._loadDataTimeout[duName] = setTimeout(() => {
|
266
|
-
delete this._loadDataTimeout[duName];
|
267
|
-
this.doLoadData(dataUnit, request)
|
268
|
-
.then(result => resolve(result))
|
269
|
-
.catch(reason => reject(reason));
|
270
|
-
}, 200);
|
271
|
-
});
|
272
|
-
}
|
273
|
-
doLoadData(dataUnit, request) {
|
274
|
-
return new Promise((resolve, reject) => {
|
275
|
-
var _a;
|
276
|
-
const { sort, filters, limit, offset, quickFilter } = request;
|
277
|
-
const variables = { dataunit: dataUnit.name, sort, filters };
|
278
|
-
variables.limit = limit;
|
279
|
-
variables.offset = offset;
|
280
|
-
variables.parentRecordId = request.parentRecordId;
|
281
|
-
if (!StringUtils.isEmpty(quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.term)) {
|
282
|
-
if (variables.filter === undefined) {
|
283
|
-
variables.filter = [];
|
284
|
-
}
|
285
|
-
const quickFilterCriteria = {
|
286
|
-
name: "__QUICK_FILTER__",
|
287
|
-
expression: "__QUICK_FILTER__",
|
288
|
-
params: [{ name: "term", dataType: DataType.TEXT, value: quickFilter.term }]
|
289
|
-
};
|
290
|
-
if (((_a = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
291
|
-
quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: quickFilter.fields });
|
292
|
-
}
|
293
|
-
variables.filter.push(quickFilterCriteria);
|
294
|
-
}
|
295
|
-
DataFetcher.get()
|
296
|
-
.callGraphQL({
|
297
|
-
values: variables,
|
298
|
-
query: this.templateByQuery.get("fetchData"),
|
299
|
-
})
|
300
|
-
.then((resp) => {
|
301
|
-
const { limit, offset, total, hasMore, records } = resp.data;
|
302
|
-
let paginationInfo;
|
303
|
-
if (limit) {
|
304
|
-
const firstRecord = total == 0 ? 0 : offset + 1;
|
305
|
-
const lastRecord = offset + Math.min(records.length, limit);
|
306
|
-
const currentPage = offset / limit;
|
307
|
-
paginationInfo = {
|
308
|
-
firstRecord,
|
309
|
-
lastRecord,
|
310
|
-
total,
|
311
|
-
currentPage,
|
312
|
-
hasMore
|
313
|
-
};
|
314
|
-
}
|
315
|
-
const processedRecords = [];
|
316
|
-
records.forEach((responseRecord) => {
|
317
|
-
const duRecord = { __record__id__: responseRecord.id, __record__label__: responseRecord.label };
|
318
|
-
responseRecord.fields.forEach(({ name, value }) => {
|
319
|
-
duRecord[name] = dataUnit.valueFromString(name, value);
|
320
|
-
});
|
321
|
-
processedRecords.push(duRecord);
|
322
|
-
});
|
323
|
-
resolve({
|
324
|
-
paginationInfo,
|
325
|
-
records: processedRecords
|
326
|
-
});
|
327
|
-
})
|
328
|
-
.catch((error) => {
|
329
|
-
reject(error);
|
330
|
-
});
|
331
|
-
});
|
332
|
-
}
|
333
|
-
saveData(dataUnit, duChanges) {
|
334
|
-
const changes = duChanges.map((change) => {
|
335
|
-
const { dataUnit: changeDU, record, updatingFields, operation } = change;
|
336
|
-
const dataUnitInstance = DataUnitStorage.get(changeDU);
|
337
|
-
let parsedUpdatingFields;
|
338
|
-
if (updatingFields) {
|
339
|
-
parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
340
|
-
const descriptor = dataUnitInstance.getField(fieldName);
|
341
|
-
const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
|
342
|
-
return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
|
343
|
-
});
|
344
|
-
}
|
345
|
-
const reqChange = { dataUnit: changeDU, fields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
|
346
|
-
if (change.sourceId) {
|
347
|
-
reqChange.sourceId = change.sourceId;
|
348
|
-
}
|
349
|
-
if (record.__parent__record__id__) {
|
350
|
-
reqChange.parentRecordId = record.__parent__record__id__;
|
351
|
-
}
|
352
|
-
return reqChange;
|
353
|
-
});
|
354
|
-
return new Promise((resolve, reject) => {
|
355
|
-
const changesFormatted = changes.map((_a) => {
|
356
|
-
var rest = __rest(_a, []);
|
357
|
-
return rest;
|
358
|
-
});
|
359
|
-
DataFetcher.get()
|
360
|
-
.callGraphQL({
|
361
|
-
values: { changes: changesFormatted },
|
362
|
-
query: this.templateByQuery.get("saveData"),
|
363
|
-
})
|
364
|
-
.then((resp) => {
|
365
|
-
const dataUnitRecords = [];
|
366
|
-
resp === null || resp === void 0 ? void 0 : resp.forEach((responseRecord) => {
|
367
|
-
const duRecord = {
|
368
|
-
__record__id__: responseRecord.id,
|
369
|
-
__record__label__: responseRecord.label,
|
370
|
-
__owner__dataunit__name__: responseRecord.ownerDataUnitName,
|
371
|
-
};
|
372
|
-
const dataUnitInstance = DataUnitStorage.get(duRecord.__owner__dataunit__name__) || dataUnit;
|
373
|
-
if (responseRecord.oldId) {
|
374
|
-
duRecord.__old__id__ = responseRecord.oldId;
|
375
|
-
}
|
376
|
-
responseRecord.fields.forEach(({ name, value }) => {
|
377
|
-
var _a;
|
378
|
-
duRecord[name] = ((_a = dataUnitInstance === null || dataUnitInstance === void 0 ? void 0 : dataUnitInstance.valueFromString) === null || _a === void 0 ? void 0 : _a.call(dataUnitInstance, name, value)) || value;
|
379
|
-
});
|
380
|
-
dataUnitRecords.push(duRecord);
|
381
|
-
});
|
382
|
-
resolve(dataUnitRecords);
|
383
|
-
})
|
384
|
-
.catch((error) => {
|
385
|
-
reject(error);
|
386
|
-
});
|
387
|
-
});
|
388
|
-
}
|
389
|
-
removeRecords(dataUnit, recordIds) {
|
390
|
-
const changes = recordIds.map((recordId) => {
|
391
|
-
return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
|
392
|
-
});
|
393
|
-
return new Promise((resolve, reject) => {
|
394
|
-
DataFetcher.get()
|
395
|
-
.callGraphQL({
|
396
|
-
values: { changes: changes },
|
397
|
-
query: this.templateByQuery.get("saveData"),
|
398
|
-
})
|
399
|
-
.then((_resp) => {
|
400
|
-
resolve(recordIds);
|
401
|
-
})
|
402
|
-
.catch((error) => {
|
403
|
-
reject(error);
|
404
|
-
});
|
405
|
-
});
|
406
|
-
}
|
407
|
-
loadRecord(dataUnit, recordIds) {
|
408
|
-
return new Promise((resolve, reject) => {
|
409
|
-
DataFetcher.get()
|
410
|
-
.callGraphQL({
|
411
|
-
values: { recordID: recordIds, dataunit: dataUnit.name },
|
412
|
-
query: this.templateByQuery.get("fetchDataRecord"),
|
413
|
-
})
|
414
|
-
.then((response) => {
|
415
|
-
const dataUnitRecords = [];
|
416
|
-
response.record.forEach(responseRecord => {
|
417
|
-
const duRecord = { __record__id__: responseRecord.id, __record__label__: responseRecord.label };
|
418
|
-
responseRecord.fields.forEach(({ name, value }) => {
|
419
|
-
duRecord[name] = dataUnit.valueFromString(name, value);
|
420
|
-
});
|
421
|
-
dataUnitRecords.push(duRecord);
|
422
|
-
});
|
423
|
-
resolve(dataUnitRecords);
|
424
|
-
})
|
425
|
-
.catch((error) => {
|
426
|
-
reject(error);
|
427
|
-
});
|
428
|
-
});
|
429
|
-
}
|
430
|
-
}
|
431
|
-
|
432
120
|
var _a;
|
433
121
|
class Workspace {
|
434
122
|
static openAppActivity(resourceId, pkObject) {
|