@sankhyalabs/sankhyablocks 8.8.0-rc.1 → 8.8.0-rc.11
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-a97ca159.js → ConfigStorage-c15716fd.js} +5 -2
- package/dist/cjs/{DataFetcher-2a99283c.js → DataFetcher-713f0749.js} +32 -32
- package/dist/cjs/PreloadManager-e26d237f.js +224 -0
- package/dist/cjs/{SnkFormConfigManager-f641f502.js → SnkFormConfigManager-29101e20.js} +2 -2
- package/dist/cjs/{SnkMultiSelectionListDataSource-56db34ee.js → SnkMultiSelectionListDataSource-d74d2336.js} +10 -6
- package/dist/cjs/{auth-fetcher-78231356.js → auth-fetcher-555ff856.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-4f7d4ee7.js → dataunit-fetcher-66c0b7af.js} +48 -248
- package/dist/cjs/{form-config-fetcher-a322a522.js → form-config-fetcher-17775a75.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-7ef61508.js → pesquisa-fetcher-34922b83.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +93 -86
- package/dist/cjs/snk-application.cjs.entry.js +16 -6
- package/dist/cjs/snk-attach.cjs.entry.js +4 -2
- package/dist/cjs/snk-crud.cjs.entry.js +7 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +24 -8
- package/dist/cjs/snk-filter-bar.cjs.entry.js +19 -4
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
- package/dist/cjs/snk-form.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +8 -7
- package/dist/cjs/{snk-guides-viewer-aab80f66.js → snk-guides-viewer-b173ce35.js} +78 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +8 -5
- package/dist/collection/components/snk-actions-button/actions/executor/java.executor.js +2 -2
- package/dist/collection/components/snk-actions-button/actions/executor/javascript.executor.js +2 -2
- package/dist/collection/components/snk-actions-button/actions/executor/procedure.executor.js +2 -2
- package/dist/collection/components/snk-actions-button/clientEvent/index.js +81 -76
- package/dist/collection/components/snk-application/snk-application.js +1 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +18 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +80 -8
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +17 -2
- package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +5 -5
- package/dist/collection/components/snk-grid/snk-grid.js +1 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +33 -34
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +7 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +25 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +25 -55
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +29 -8
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +3 -0
- package/dist/collection/lib/workspace/workspace.js +7 -0
- package/dist/components/ConfigStorage.js +3 -0
- package/dist/components/DataFetcher.js +32 -32
- package/dist/components/SnkMultiSelectionListDataSource.js +5 -5
- package/dist/components/dataunit-fetcher.js +87 -68
- package/dist/components/snk-actions-button2.js +87 -82
- package/dist/components/snk-application2.js +8 -0
- package/dist/components/snk-detail-view2.js +88 -2
- package/dist/components/snk-filter-bar2.js +17 -2
- package/dist/components/snk-grid2.js +1 -0
- package/dist/esm/{ConfigStorage-26f89143.js → ConfigStorage-79c81f36.js} +5 -2
- package/dist/esm/{DataFetcher-90e91631.js → DataFetcher-79f78222.js} +32 -32
- package/dist/esm/PreloadManager-8826b96a.js +222 -0
- package/dist/esm/{SnkFormConfigManager-18948123.js → SnkFormConfigManager-7723f3ec.js} +2 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-b9410c72.js → SnkMultiSelectionListDataSource-27572f47.js} +6 -6
- package/dist/esm/{auth-fetcher-a8c8ee7e.js → auth-fetcher-e260d0cd.js} +1 -1
- package/dist/esm/{dataunit-fetcher-1c2ccae2.js → dataunit-fetcher-831feb12.js} +41 -240
- package/dist/esm/{form-config-fetcher-7c3b6273.js → form-config-fetcher-e1603e66.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-90d6853b.js → pesquisa-fetcher-8e922c9d.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +93 -86
- package/dist/esm/snk-application.entry.js +16 -6
- package/dist/esm/snk-attach.entry.js +4 -2
- package/dist/esm/snk-crud.entry.js +7 -5
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +24 -8
- package/dist/esm/snk-filter-bar.entry.js +20 -5
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +2 -2
- package/dist/esm/snk-form.entry.js +4 -4
- package/dist/esm/snk-grid-config.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +8 -7
- package/dist/esm/{snk-guides-viewer-62b0fa69.js → snk-guides-viewer-e62e0edc.js} +79 -6
- package/dist/esm/snk-guides-viewer.entry.js +9 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +8 -5
- package/dist/sankhyablocks/{p-ebfa6460.entry.js → p-06e76ed2.entry.js} +1 -1
- package/dist/sankhyablocks/p-29176742.js +56 -0
- package/dist/sankhyablocks/p-2e6f1666.js +1 -0
- package/dist/sankhyablocks/{p-d563e451.entry.js → p-3bf4df20.entry.js} +1 -1
- package/dist/sankhyablocks/p-3c4f0354.js +1 -0
- package/dist/sankhyablocks/p-3ccb321d.entry.js +1 -0
- package/dist/sankhyablocks/{p-240f5892.js → p-41d156dd.js} +1 -1
- package/dist/sankhyablocks/{p-d47bbee3.js → p-4651b43f.js} +1 -1
- package/dist/sankhyablocks/{p-8652f90b.entry.js → p-47e4b6c9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-68fbd480.entry.js → p-4f5b995d.entry.js} +1 -1
- package/dist/sankhyablocks/p-5f6113c8.js +60 -0
- package/dist/sankhyablocks/p-72b32e25.entry.js +11 -0
- package/dist/sankhyablocks/{p-57550ddc.entry.js → p-747043a5.entry.js} +1 -1
- package/dist/sankhyablocks/p-77756526.js +1 -0
- package/dist/sankhyablocks/{p-e74e2153.entry.js → p-80692cbd.entry.js} +1 -1
- package/dist/sankhyablocks/p-848b2e3b.entry.js +1 -0
- package/dist/sankhyablocks/p-862e5bf6.entry.js +1 -0
- package/dist/sankhyablocks/p-95b05e58.entry.js +1 -0
- package/dist/sankhyablocks/p-a1cce4f5.entry.js +1 -0
- package/dist/sankhyablocks/{p-5d51bff4.js → p-c9399ce6.js} +1 -1
- package/dist/sankhyablocks/p-d0b36421.js +1 -0
- package/dist/sankhyablocks/p-d32fe25e.js +1 -0
- package/dist/sankhyablocks/p-eb1561bf.entry.js +1 -0
- package/dist/sankhyablocks/p-f1743d68.entry.js +1 -0
- package/dist/sankhyablocks/p-f2e798f1.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/clientEvent/index.d.ts +1 -1
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +3 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +22 -11
- package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +5 -2
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +3 -6
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +2 -0
- package/dist/types/lib/workspace/workspace.d.ts +1 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-193971ad.js +0 -1
- package/dist/sankhyablocks/p-19cbe6e2.entry.js +0 -11
- package/dist/sankhyablocks/p-2c7c1323.entry.js +0 -1
- package/dist/sankhyablocks/p-3253e7f2.entry.js +0 -1
- package/dist/sankhyablocks/p-5dd52ec5.entry.js +0 -1
- package/dist/sankhyablocks/p-6541f0df.js +0 -1
- package/dist/sankhyablocks/p-910af03c.js +0 -56
- package/dist/sankhyablocks/p-992a9d0f.js +0 -1
- package/dist/sankhyablocks/p-acb1374c.entry.js +0 -1
- package/dist/sankhyablocks/p-b36053da.entry.js +0 -1
- package/dist/sankhyablocks/p-b481e5ad.js +0 -1
- package/dist/sankhyablocks/p-d264da22.entry.js +0 -1
- package/dist/sankhyablocks/p-d56b65e3.entry.js +0 -1
- package/dist/sankhyablocks/p-e473ca13.entry.js +0 -1
- package/dist/sankhyablocks/p-e86d4a53.js +0 -59
@@ -1,9 +1,9 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, forceUpdate, Host } from '@stencil/core/internal/client';
|
2
|
+
import { Action, ElementIDUtils } from '@sankhyalabs/core';
|
2
3
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
|
3
4
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
4
5
|
import './DataFetcher.js';
|
5
6
|
import './dataunit-fetcher.js';
|
6
|
-
import { ElementIDUtils } from '@sankhyalabs/core';
|
7
7
|
import { P as PresentationMode } from './index2.js';
|
8
8
|
import { d as defineCustomElement$t } from './snk-actions-button2.js';
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -165,6 +165,12 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
165
165
|
this._breadcrumbItems = breadcrumbs;
|
166
166
|
});
|
167
167
|
});
|
168
|
+
this._guides = this._guides.map(guide => {
|
169
|
+
if (guide.id === guideItem.id) {
|
170
|
+
return Object.assign(Object.assign({}, guide), guideItem);
|
171
|
+
}
|
172
|
+
return guide;
|
173
|
+
});
|
168
174
|
}
|
169
175
|
}
|
170
176
|
loadTaskbarProcessor() {
|
@@ -292,6 +298,28 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
292
298
|
this._guideNavigator.getCurrentPath().then(breadcrumbs => {
|
293
299
|
this._breadcrumbItems = breadcrumbs;
|
294
300
|
});
|
301
|
+
this.resetGuideBadge(currentItem);
|
302
|
+
}
|
303
|
+
resetGuideBadge(selectedGuide) {
|
304
|
+
var _a;
|
305
|
+
this._guides = [...(_a = this._guides) === null || _a === void 0 ? void 0 : _a.map(guide => {
|
306
|
+
if (this.canClearGuideBadge(guide, selectedGuide.id)) {
|
307
|
+
return Object.assign(Object.assign({}, guide), { badge: null });
|
308
|
+
}
|
309
|
+
return guide;
|
310
|
+
})];
|
311
|
+
}
|
312
|
+
canClearGuideBadge(guide, idToCheck) {
|
313
|
+
return (guide.id === idToCheck) || this.isIncludedInChildrenList(guide, idToCheck);
|
314
|
+
}
|
315
|
+
isIncludedInChildrenList(guide, guideId) {
|
316
|
+
return this.hasChildren(guide) && this.getChildrenIdList(guide).includes(guideId);
|
317
|
+
}
|
318
|
+
hasChildren(guide) {
|
319
|
+
return guide.children && Array.isArray(guide.children);
|
320
|
+
}
|
321
|
+
getChildrenIdList(guide) {
|
322
|
+
return (guide.children).map(guideChild => guideChild.id);
|
295
323
|
}
|
296
324
|
getConfigViewMode() {
|
297
325
|
return VIEW_MODE.GRID;
|
@@ -341,6 +369,50 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
341
369
|
var _a;
|
342
370
|
return h("div", { class: `ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 ${this.presentationMode != PresentationMode.SECONDARY ? 'ez-align--right' : 'ez-padding-bottom--medium'}` }, h("snk-taskbar", { key: "guideViewerTaskbar", "data-element-id": "guideViewer", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, messagesBuilder: this.messagesBuilder, presentationMode: this.presentationMode, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-taskbar-owner": "master", dataUnit: this.dataUnit, resourceID: this.resourceID, customSlotId: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" })));
|
343
371
|
}
|
372
|
+
async dataUnitActionHandler(action) {
|
373
|
+
var _a;
|
374
|
+
if (action.type === Action.FIELD_INVALIDATED) {
|
375
|
+
const guideName = this.getGuideName((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fieldName);
|
376
|
+
await this.addErrorBadgeToGuide(guideName);
|
377
|
+
await this.openGuideNavigator(guideName);
|
378
|
+
}
|
379
|
+
}
|
380
|
+
async addErrorBadgeToGuide(guideName) {
|
381
|
+
var _a;
|
382
|
+
this._guides = [...(_a = this._guides) === null || _a === void 0 ? void 0 : _a.map(guide => {
|
383
|
+
return Object.assign(Object.assign({}, guide), { badge: this.getBadge(guide, guideName) });
|
384
|
+
})];
|
385
|
+
}
|
386
|
+
async openGuideNavigator(guideName) {
|
387
|
+
if (this.selectedGuide.id !== guideName) {
|
388
|
+
await this._guideNavigator.openGuideNavidator();
|
389
|
+
}
|
390
|
+
}
|
391
|
+
getBadge(guide, tabName) {
|
392
|
+
var _a;
|
393
|
+
if (this.selectedGuide.id === tabName) {
|
394
|
+
return null;
|
395
|
+
}
|
396
|
+
if (tabName === guide.id) {
|
397
|
+
return "error";
|
398
|
+
}
|
399
|
+
return (_a = guide.badge) !== null && _a !== void 0 ? _a : null;
|
400
|
+
}
|
401
|
+
getGuideName(fieldName) {
|
402
|
+
var _a;
|
403
|
+
for (const sheet of this._masterFormMetadata.getAllSheets()) {
|
404
|
+
const formFields = (_a = sheet[1]) === null || _a === void 0 ? void 0 : _a.fields;
|
405
|
+
for (const field of formFields) {
|
406
|
+
if (field.name === fieldName) {
|
407
|
+
return sheet[0];
|
408
|
+
}
|
409
|
+
}
|
410
|
+
}
|
411
|
+
return "";
|
412
|
+
}
|
413
|
+
componentDidLoad() {
|
414
|
+
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
415
|
+
}
|
344
416
|
render() {
|
345
417
|
var _a, _b;
|
346
418
|
if (this._formEditorConfigManager != undefined) {
|
@@ -615,6 +687,10 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
615
687
|
this.canEdit = true;
|
616
688
|
this.taskbarCustomContainerId = undefined;
|
617
689
|
}
|
690
|
+
observeDataUnit(newDataUnit, oldDataUnit) {
|
691
|
+
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
692
|
+
oldDataUnit === null || oldDataUnit === void 0 ? void 0 : oldDataUnit.unsubscribe(this.dataUnitActionHandler);
|
693
|
+
}
|
618
694
|
observerDataState(newValue, oldValue) {
|
619
695
|
const openInsertion = !(oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && (newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
|
620
696
|
const closeInsertion = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && !(newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
|
@@ -780,12 +856,22 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
780
856
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
781
857
|
}
|
782
858
|
}
|
859
|
+
async dataUnitActionHandler(action) {
|
860
|
+
if (action.type === Action.FIELD_INVALIDATED) {
|
861
|
+
this.addErrorBadgeToBranchGuide();
|
862
|
+
}
|
863
|
+
}
|
864
|
+
addErrorBadgeToBranchGuide() {
|
865
|
+
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
866
|
+
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
867
|
+
}
|
783
868
|
render() {
|
784
869
|
this.updateLabel();
|
785
870
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
786
871
|
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-flex 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 ez-size-height--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: PresentationMode.SECONDARY, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }))), 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(), label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems) }, 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: PresentationMode.SECONDARY, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }, 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) }))))));
|
787
872
|
}
|
788
873
|
static get watchers() { return {
|
874
|
+
"dataUnit": ["observeDataUnit"],
|
789
875
|
"dataState": ["observerDataState"]
|
790
876
|
}; }
|
791
877
|
static get style() { return snkDetailViewCss; }
|
@@ -800,7 +886,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
800
886
|
"selectedForm": [1025, "selected-form"],
|
801
887
|
"dataState": [1040],
|
802
888
|
"messagesBuilder": [1040],
|
803
|
-
"branchGuide": [
|
889
|
+
"branchGuide": [1040],
|
804
890
|
"canEdit": [4, "can-edit"],
|
805
891
|
"taskbarCustomContainerId": [1, "taskbar-custom-container-id"],
|
806
892
|
"_disabledButtons": [32],
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import { DataType, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
|
2
|
+
import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
|
3
3
|
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
5
5
|
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
@@ -107,8 +107,11 @@ function buildSearch(item) {
|
|
107
107
|
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
|
108
108
|
}
|
109
109
|
function buildText(item) {
|
110
|
-
|
110
|
+
let { id, value, props } = item;
|
111
111
|
const expression = props.expression;
|
112
|
+
if (!StringUtils.isEmpty(props.likeAs)) {
|
113
|
+
value = buildLikeValue(value, props.likeAs);
|
114
|
+
}
|
112
115
|
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
|
113
116
|
}
|
114
117
|
function buildNumber(item) {
|
@@ -116,6 +119,18 @@ function buildNumber(item) {
|
|
116
119
|
const expression = props.expression;
|
117
120
|
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
118
121
|
}
|
122
|
+
function buildLikeValue(valueAsString, likeAs) {
|
123
|
+
if (likeAs === "CONTANIS") {
|
124
|
+
return `%${valueAsString}%`;
|
125
|
+
}
|
126
|
+
else if (likeAs === "STARTS_WITH") {
|
127
|
+
return `${valueAsString}%`;
|
128
|
+
}
|
129
|
+
else if (likeAs === "ENDS_WITH") {
|
130
|
+
return `%${valueAsString}`;
|
131
|
+
}
|
132
|
+
return valueAsString;
|
133
|
+
}
|
119
134
|
function buildPersonalized(item) {
|
120
135
|
const { id, groupedItems = [] } = item;
|
121
136
|
const activeFilters = groupedItems.filter(groupItem => !!groupItem.visible);
|
@@ -116,6 +116,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
116
116
|
if (this._gridConfig && this._dataUnit) {
|
117
117
|
this._dataUnit.defaultSorting = this._gridConfig
|
118
118
|
.columns
|
119
|
+
.filter(col => col.ascending != undefined)
|
119
120
|
.sort((colA, colB) => colA.orderIndex - colB.orderIndex)
|
120
121
|
.map(({ name: field, ascending }) => {
|
121
122
|
const { dataType } = this._dataUnit.getField(field);
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-e1603e66.js';
|
2
2
|
import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
|
3
3
|
import { ObjectUtils } from '@sankhyalabs/core';
|
4
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
4
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-79f78222.js';
|
5
5
|
|
6
6
|
class GridConfigFetcher extends ResourceFetcher {
|
7
7
|
constructor() {
|
@@ -271,6 +271,9 @@ class PersonalizedFilterFetcher {
|
|
271
271
|
});
|
272
272
|
}
|
273
273
|
async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
274
|
+
if (!personalizedFilter || Object.keys(personalizedFilter).length == 0) {
|
275
|
+
return Promise.reject(new Error("personalizedFilter não pode ser vazio"));
|
276
|
+
}
|
274
277
|
let personalizedFilterParsed = JSON.parse(JSON.stringify(personalizedFilter));
|
275
278
|
personalizedFilterParsed.assistent = JSON.stringify(personalizedFilterParsed.assistent);
|
276
279
|
return new Promise((resolve, reject) => {
|
@@ -6616,16 +6616,16 @@ class DataFetcher {
|
|
6616
6616
|
if (this.ready) {
|
6617
6617
|
return new Promise(async (resolve, reject) => {
|
6618
6618
|
let query = this.getQueryTemplate(req);
|
6619
|
-
const res = await this.
|
6619
|
+
const res = await this.fecthGraphQL([{ document: query, variables: req.values }], quietMode);
|
6620
6620
|
if (res.errors.length > 0) {
|
6621
|
-
if (!this.proccesGraphQLClientEvents(res === null || res === void 0 ? void 0 : res.extensions, req, resolve, reject)) {
|
6621
|
+
if (!(await this.proccesGraphQLClientEvents(res === null || res === void 0 ? void 0 : res.extensions, req, resolve, reject))) {
|
6622
6622
|
const error = this.processGraphQlErrorInfo(res.errors);
|
6623
6623
|
reject(error);
|
6624
6624
|
}
|
6625
6625
|
}
|
6626
6626
|
else {
|
6627
6627
|
resolve(res.data[0][reqKey]);
|
6628
|
-
this.proccesGraphQLClientEvents(res === null || res === void 0 ? void 0 : res.extensions, req, resolve, reject);
|
6628
|
+
await this.proccesGraphQLClientEvents(res === null || res === void 0 ? void 0 : res.extensions, req, resolve, reject);
|
6629
6629
|
}
|
6630
6630
|
});
|
6631
6631
|
}
|
@@ -6639,7 +6639,7 @@ class DataFetcher {
|
|
6639
6639
|
resolveURL() {
|
6640
6640
|
return UrlUtils.getUrlBase();
|
6641
6641
|
}
|
6642
|
-
proccesGraphQLClientEvents(extensions, originalRequest, resolve, reject) {
|
6642
|
+
async proccesGraphQLClientEvents(extensions, originalRequest, resolve, reject) {
|
6643
6643
|
if (extensions == undefined) {
|
6644
6644
|
return false;
|
6645
6645
|
}
|
@@ -6654,8 +6654,8 @@ class DataFetcher {
|
|
6654
6654
|
throw new WarningException("ClientEvent não registrado", `Ocorreu o client event ${id} porém não há client event registrado na aplicação.`);
|
6655
6655
|
}
|
6656
6656
|
const handlers = DataFetcher.clientEventsByID.get(id);
|
6657
|
-
handlers.forEach(handler => {
|
6658
|
-
handler({ id, content: JSON.parse(clientEvents[id]) }, new GraphQLRecaller(originalRequest, resolve, reject));
|
6657
|
+
handlers.forEach(async (handler) => {
|
6658
|
+
await handler({ id, content: JSON.parse(clientEvents[id]) }, new GraphQLRecaller(originalRequest, resolve, reject));
|
6659
6659
|
});
|
6660
6660
|
}
|
6661
6661
|
return Object.keys(clientEvents).length > 0;
|
@@ -6729,9 +6729,9 @@ class DataFetcher {
|
|
6729
6729
|
const urlParams = UrlUtils.getQueryParams(location.search);
|
6730
6730
|
return {
|
6731
6731
|
baseUrl: `${this.resolveURL()}/${module}/service.sbr`,
|
6732
|
-
appName: "SankhyaBlocks",
|
6732
|
+
appName: window['APPLICATION_NAME'] || "SankhyaBlocks",
|
6733
6733
|
mgeSession: `${window['mgeSession'] || urlParams.get("mgeSession")}`,
|
6734
|
-
globalID:
|
6734
|
+
globalID: window['GLOBALID'] || StringUtils.generateUUID(),
|
6735
6735
|
resourceID: (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID))
|
6736
6736
|
};
|
6737
6737
|
}
|
@@ -6848,17 +6848,13 @@ class DataFetcher {
|
|
6848
6848
|
async executePendingRequest(watingRequestsById) {
|
6849
6849
|
const requestsBatch = [];
|
6850
6850
|
let quietMode = true;
|
6851
|
-
watingRequestsById.forEach(
|
6852
|
-
|
6851
|
+
watingRequestsById.forEach((waitingReq) => {
|
6852
|
+
const query = this.getQueryTemplate(waitingReq.request);
|
6853
6853
|
requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
|
6854
6854
|
quietMode = quietMode && waitingReq.quietMode;
|
6855
6855
|
});
|
6856
|
-
|
6857
|
-
|
6858
|
-
let errorsResponse = [];
|
6859
|
-
res = await this.fecthGrapql(requestsBatch, quietMode);
|
6860
|
-
dataResponse = res.data;
|
6861
|
-
errorsResponse = res.errors;
|
6856
|
+
const response = await this.fecthGraphQL(requestsBatch, quietMode);
|
6857
|
+
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
6862
6858
|
//Reject promises with errors from query
|
6863
6859
|
errorsResponse.forEach((errorResponse) => {
|
6864
6860
|
Object.entries(errorResponse).forEach(([_key, val]) => {
|
@@ -6868,29 +6864,33 @@ class DataFetcher {
|
|
6868
6864
|
});
|
6869
6865
|
//Resolve promises with data from query
|
6870
6866
|
dataResponse.forEach((data) => {
|
6871
|
-
Object.entries(data).forEach(([key, val]) => {
|
6872
|
-
|
6873
|
-
|
6867
|
+
Object.entries(data).forEach(async ([key, val]) => {
|
6868
|
+
const waitingRequest = watingRequestsById.get(key);
|
6869
|
+
await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
6870
|
+
((waitingRequest === null || waitingRequest === void 0 ? void 0 : waitingRequest.resolve) || Promise.resolve)(val);
|
6874
6871
|
});
|
6875
6872
|
});
|
6876
6873
|
}
|
6877
|
-
|
6878
|
-
let res = undefined;
|
6879
|
-
let dataResponse = [];
|
6880
|
-
let errorsResponse = [];
|
6881
|
-
let url = `${this.resolveURL() + DataFetcher.getGraphQLPath()}`;
|
6882
|
-
const responseExtensions = [];
|
6874
|
+
buildGraphQlURL(quietMode) {
|
6883
6875
|
const mgeSession = window["mgeSession"];
|
6884
|
-
|
6876
|
+
let url = `${this.resolveURL() + DataFetcher.getGraphQLPath()}`;
|
6877
|
+
if (mgeSession) {
|
6885
6878
|
url += `?mgeSession=${mgeSession}`;
|
6886
6879
|
}
|
6887
6880
|
if (quietMode) {
|
6888
6881
|
url += `${url.indexOf("?") > -1 ? "&" : "?"}quietMode=true`;
|
6889
6882
|
}
|
6890
|
-
|
6883
|
+
return url;
|
6884
|
+
}
|
6885
|
+
async fecthGraphQL(request, quietMode) {
|
6886
|
+
const dataResponse = [];
|
6887
|
+
const errorsResponse = [];
|
6888
|
+
const responseExtensions = [];
|
6889
|
+
const url = this.buildGraphQlURL(quietMode);
|
6890
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request }));
|
6891
6891
|
try {
|
6892
|
-
|
6893
|
-
|
6892
|
+
const response = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
|
6893
|
+
response.forEach((resItem, index) => {
|
6894
6894
|
var _a;
|
6895
6895
|
if (((_a = resItem === null || resItem === void 0 ? void 0 : resItem.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
6896
6896
|
errorsResponse.push(resItem.errors.map((item) => this.normalizeErrorResponse(item, request, index)));
|
@@ -6905,7 +6905,7 @@ class DataFetcher {
|
|
6905
6905
|
}
|
6906
6906
|
catch (err) {
|
6907
6907
|
if (!this.isHttpError(err)) {
|
6908
|
-
res = err.response;
|
6908
|
+
const res = err.response;
|
6909
6909
|
const req = err.request;
|
6910
6910
|
Object.entries(res).forEach(([key, val]) => {
|
6911
6911
|
if (val.errors) {
|
@@ -6921,11 +6921,11 @@ class DataFetcher {
|
|
6921
6921
|
});
|
6922
6922
|
}
|
6923
6923
|
else {
|
6924
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url
|
6924
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
|
6925
6925
|
throw new ErrorException("Falha de comunicação", err.message);
|
6926
6926
|
}
|
6927
6927
|
}
|
6928
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url
|
6928
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
|
6929
6929
|
return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
|
6930
6930
|
}
|
6931
6931
|
isHttpError(err) {
|
@@ -0,0 +1,222 @@
|
|
1
|
+
import { FieldComparator, SortMode, DataUnit } from '@sankhyalabs/core';
|
2
|
+
import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
3
|
+
|
4
|
+
class ArrayRepository {
|
5
|
+
constructor(equalsFunction) {
|
6
|
+
this._list = [];
|
7
|
+
this._equalsFunction = equalsFunction;
|
8
|
+
}
|
9
|
+
async load(filterFunction, sortingFunction, offset, limit) {
|
10
|
+
let result = [].concat(this._list);
|
11
|
+
if (filterFunction != undefined) {
|
12
|
+
result = this._list.filter(item => filterFunction(item));
|
13
|
+
}
|
14
|
+
if (sortingFunction != undefined) {
|
15
|
+
result = result.sort(sortingFunction);
|
16
|
+
}
|
17
|
+
const count = result.length;
|
18
|
+
if (limit != undefined) {
|
19
|
+
const start = offset || 0;
|
20
|
+
const end = limit ? start + limit : result.length;
|
21
|
+
result = result.slice(start, end);
|
22
|
+
}
|
23
|
+
return Promise.resolve({ result, count });
|
24
|
+
}
|
25
|
+
async distict(itemProcessor) {
|
26
|
+
const processedItems = [];
|
27
|
+
let hasEmpty = false;
|
28
|
+
for (const item of this._list) {
|
29
|
+
const processedItem = itemProcessor(item);
|
30
|
+
if (processedItem == undefined) {
|
31
|
+
continue;
|
32
|
+
}
|
33
|
+
if (processedItem.value == undefined) {
|
34
|
+
hasEmpty = true;
|
35
|
+
continue;
|
36
|
+
}
|
37
|
+
processedItems.push(processedItem);
|
38
|
+
}
|
39
|
+
if (hasEmpty) {
|
40
|
+
processedItems.push({ key: "", value: null });
|
41
|
+
}
|
42
|
+
return Promise.resolve(new Map(processedItems.map(item => [item.key, item.value])));
|
43
|
+
}
|
44
|
+
async push(items) {
|
45
|
+
this._list.push(...items);
|
46
|
+
}
|
47
|
+
async clear() {
|
48
|
+
this._list = [];
|
49
|
+
}
|
50
|
+
async delete(items) {
|
51
|
+
this._list = this._list.filter(item => {
|
52
|
+
for (const removed of items) {
|
53
|
+
if (this._equalsFunction(item, removed)) {
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return true;
|
58
|
+
});
|
59
|
+
}
|
60
|
+
async update(items) {
|
61
|
+
this._list = this._list.map(existingItem => {
|
62
|
+
const newItem = items.find(newItem => this._equalsFunction(existingItem, newItem));
|
63
|
+
return newItem == undefined ? existingItem : newItem;
|
64
|
+
});
|
65
|
+
}
|
66
|
+
async insert(itemReference, items) {
|
67
|
+
const itemPosition = this._list.indexOf(itemReference);
|
68
|
+
if (itemPosition == -1) {
|
69
|
+
this._list.push(...items);
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
this._list = this._list.slice(0, itemPosition).concat(items).concat(this._list.slice(itemPosition));
|
73
|
+
}
|
74
|
+
isOperating() {
|
75
|
+
return true;
|
76
|
+
}
|
77
|
+
async isEmpty() {
|
78
|
+
return Promise.resolve(this._list.length === 0);
|
79
|
+
}
|
80
|
+
async count() {
|
81
|
+
return Promise.resolve(this._list.length);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
class PreloadManager {
|
86
|
+
static setLoadingStatus(dataUnit, loadingInProgress) {
|
87
|
+
this._loadingStatus.set(dataUnit.name, loadingInProgress);
|
88
|
+
}
|
89
|
+
static isCacheEnabled(_dataUnit) {
|
90
|
+
return true;
|
91
|
+
}
|
92
|
+
static cacheRecords(dataUnit, records, resetDatabase, loadingInProgress) {
|
93
|
+
PreloadManager.setLoadingStatus(dataUnit, loadingInProgress);
|
94
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
95
|
+
this.getRepository(dataUnit).push(records);
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
if (resetDatabase) {
|
99
|
+
this._repositories.delete(dataUnit.name);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
static getSortingFunction(dataUnit, sorting) {
|
104
|
+
if (sorting == undefined || sorting.length == 0) {
|
105
|
+
return undefined;
|
106
|
+
}
|
107
|
+
return (recordA, recordB) => {
|
108
|
+
for (const sort of sorting) {
|
109
|
+
const result = FieldComparator.compare(dataUnit.getField(sort.field), recordA, recordB, sort.mode === SortMode.ASC);
|
110
|
+
if (result != 0) {
|
111
|
+
return result;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
};
|
115
|
+
}
|
116
|
+
static async getDistinct(dataUnit, fieldName) {
|
117
|
+
if (!PreloadManager.isCacheEnabled(dataUnit)) {
|
118
|
+
return Promise.resolve(ColumnFilterManager.compileDistinct(fieldName, dataUnit));
|
119
|
+
}
|
120
|
+
let filterFunction;
|
121
|
+
const request = dataUnit.getLastLoadRequest();
|
122
|
+
if (request != undefined) {
|
123
|
+
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters);
|
124
|
+
filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
125
|
+
}
|
126
|
+
return new Promise((accept, reject) => {
|
127
|
+
PreloadManager.getRepository(dataUnit).distict(record => {
|
128
|
+
if (filterFunction != undefined && !filterFunction(record)) {
|
129
|
+
return undefined;
|
130
|
+
}
|
131
|
+
const fieldValue = record[fieldName];
|
132
|
+
if (fieldValue == undefined) {
|
133
|
+
return { key: null, value: null };
|
134
|
+
}
|
135
|
+
const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
136
|
+
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
137
|
+
})
|
138
|
+
.then(result => {
|
139
|
+
if (result == undefined) {
|
140
|
+
accept(undefined);
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
accept(Array.from(result.entries()).map(([label, value]) => ({ label, value, check: true })));
|
144
|
+
})
|
145
|
+
.catch(reason => reject(reason));
|
146
|
+
});
|
147
|
+
}
|
148
|
+
static async loadData(dataUnit, request, loadFromServer) {
|
149
|
+
try {
|
150
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
151
|
+
let useCache = request.source === "EZ_GRID_LOADING_SOURCE" || request.source === DataUnit.CHANGING_PAGE_LOADING_SOURCE;
|
152
|
+
if (useCache) {
|
153
|
+
const isCacheEmpty = await PreloadManager.getRepository(dataUnit).isEmpty();
|
154
|
+
if (!isCacheEmpty) {
|
155
|
+
return PreloadManager.loadFromCache(dataUnit, request);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
//Como não vamos aproveitar o cache, ele precisa ser limpo.
|
159
|
+
PreloadManager.getRepository(dataUnit).clear().catch(() => { });
|
160
|
+
}
|
161
|
+
return loadFromServer(dataUnit, request);
|
162
|
+
}
|
163
|
+
catch (error) {
|
164
|
+
console.error(error);
|
165
|
+
return Promise.reject(error);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
static insertRecords(dataUnit, reference, records) {
|
169
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
170
|
+
PreloadManager.getRepository(dataUnit).insert(reference, records);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
static updateRecords(dataUnit, records) {
|
174
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
175
|
+
PreloadManager.getRepository(dataUnit).update(records);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
static removeRecords(dataUnit, records) {
|
179
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
180
|
+
PreloadManager.getRepository(dataUnit).delete(records);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
static async countRecords(dataUnit) {
|
184
|
+
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
185
|
+
return PreloadManager.getRepository(dataUnit).count();
|
186
|
+
}
|
187
|
+
return Promise.resolve(0);
|
188
|
+
}
|
189
|
+
static getRepository(dataUnit) {
|
190
|
+
const name = dataUnit.name;
|
191
|
+
if (!PreloadManager._repositories.has(name)) {
|
192
|
+
PreloadManager._repositories.set(name, new ArrayRepository((recordA, recordB) => recordA.__record__id__ === recordB.__record__id__));
|
193
|
+
}
|
194
|
+
return PreloadManager._repositories.get(name);
|
195
|
+
}
|
196
|
+
static async loadFromCache(dataUnit, request) {
|
197
|
+
return new Promise((accept, reject) => {
|
198
|
+
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters);
|
199
|
+
const { limit, offset, sort } = request;
|
200
|
+
PreloadManager.getRepository(dataUnit)
|
201
|
+
.load(ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values())), PreloadManager.getSortingFunction(dataUnit, sort), offset, limit)
|
202
|
+
.then(loadResult => {
|
203
|
+
const stillLoading = PreloadManager._loadingStatus.get(dataUnit.name);
|
204
|
+
const { count, result: records } = loadResult;
|
205
|
+
const firstRecord = count == 0 ? 0 : offset + 1;
|
206
|
+
const lastRecord = offset + Math.min(records.length, limit);
|
207
|
+
const currentPage = offset / limit;
|
208
|
+
const paginationInfo = {
|
209
|
+
count, currentPage, firstRecord, lastRecord,
|
210
|
+
hasMore: stillLoading || (lastRecord < count),
|
211
|
+
total: stillLoading ? undefined : count
|
212
|
+
};
|
213
|
+
accept({ records, paginationInfo });
|
214
|
+
})
|
215
|
+
.catch(reason => reject(reason));
|
216
|
+
});
|
217
|
+
}
|
218
|
+
}
|
219
|
+
PreloadManager._repositories = new Map();
|
220
|
+
PreloadManager._loadingStatus = new Map();
|
221
|
+
|
222
|
+
export { PreloadManager as P };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-79c81f36.js';
|
2
2
|
import { ObjectUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-e1603e66.js';
|
4
4
|
|
5
5
|
class SnkFormConfigManager {
|
6
6
|
constructor(configName, resourceID, onConfigChange) {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { UserInterface, DateUtils } from '@sankhyalabs/core';
|
2
|
-
import
|
2
|
+
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
3
|
+
import { P as PreloadManager } from './PreloadManager-8826b96a.js';
|
3
4
|
|
4
5
|
class SnkMultiSelectionListDataSource {
|
5
6
|
setDataUnit(dataUnit) {
|
@@ -19,11 +20,7 @@ class SnkMultiSelectionListDataSource {
|
|
19
20
|
if (fieldName == undefined) {
|
20
21
|
return Promise.resolve(undefined);
|
21
22
|
}
|
22
|
-
|
23
|
-
if (result == undefined) {
|
24
|
-
return Promise.resolve(undefined);
|
25
|
-
}
|
26
|
-
return Promise.resolve(Array.from(result.entries()).map(([label, value]) => ({ label: String(label), value, check: true })));
|
23
|
+
return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName));
|
27
24
|
}
|
28
25
|
fetchData(filterTerm, fieldName) {
|
29
26
|
return new Promise(resolve => {
|
@@ -38,6 +35,9 @@ class SnkMultiSelectionListDataSource {
|
|
38
35
|
});
|
39
36
|
});
|
40
37
|
}
|
38
|
+
sortItems(fieldName, items) {
|
39
|
+
return InMemoryFilterColumnDataSource.defaultSorterMultSelectionOption(this._dataUnit, fieldName, items);
|
40
|
+
}
|
41
41
|
}
|
42
42
|
|
43
43
|
export { SnkMultiSelectionListDataSource as S };
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ObjectUtils } from '@sankhyalabs/core';
|
2
|
-
import { R as ResourceFetcher } from './form-config-fetcher-
|
2
|
+
import { R as ResourceFetcher } from './form-config-fetcher-e1603e66.js';
|
3
3
|
|
4
4
|
class AuthFetcher extends ResourceFetcher {
|
5
5
|
getData(resourceID) {
|