@sankhyalabs/sankhyablocks 8.6.0 → 8.8.0-dev.1
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-bbffce76.js → ConfigStorage-a97ca159.js} +2 -2
- package/dist/cjs/{DataFetcher-0cc561bc.js → DataFetcher-2a99283c.js} +25 -10
- package/dist/cjs/{SnkFormConfigManager-c49af777.js → SnkFormConfigManager-f641f502.js} +2 -2
- package/dist/cjs/{SnkMultiSelectionListDataSource-804ff4c7.js → SnkMultiSelectionListDataSource-56db34ee.js} +11 -0
- package/dist/cjs/{auth-fetcher-fff2319e.js → auth-fetcher-78231356.js} +1 -1
- package/dist/cjs/dataunit-fetcher-4f7d4ee7.js +878 -0
- package/dist/cjs/{form-config-fetcher-35752aad.js → form-config-fetcher-a322a522.js} +1 -1
- package/dist/cjs/{pesquisa-fetcher-415eab63.js → pesquisa-fetcher-7ef61508.js} +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +4 -3
- package/dist/cjs/snk-application.cjs.entry.js +17 -8
- package/dist/cjs/snk-attach.cjs.entry.js +16 -3
- package/dist/cjs/snk-crud.cjs.entry.js +6 -4
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -6
- package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -3
- 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 +25 -14
- package/dist/cjs/{snk-guides-viewer-36b39c9c.js → snk-guides-viewer-aab80f66.js} +5 -4
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +19 -9
- package/dist/cjs/snk-simple-crud.cjs.entry.js +8 -92
- package/dist/collection/components/snk-application/snk-application.js +11 -3
- package/dist/collection/components/snk-attach/snk-attach.js +14 -2
- package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +11 -0
- package/dist/collection/components/snk-grid/snk-grid.js +24 -14
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +16 -6
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +23 -2
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +25 -10
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +113 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +59 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +169 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/{dataunit-fetcher.js → data-unit/dataunit-fetcher.js} +48 -100
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataResult.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataStrategy.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRecordField.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IResponseRecord.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DataUnitStrategy.js +68 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +131 -0
- package/dist/collection/lib/index.js +1 -1
- package/dist/components/DataFetcher.js +26 -11
- package/dist/components/SnkMultiSelectionListDataSource.js +11 -0
- package/dist/components/dataunit-fetcher.js +781 -100
- package/dist/components/snk-actions-button2.js +1 -1
- package/dist/components/snk-application2.js +11 -4
- package/dist/components/snk-attach2.js +13 -1
- package/dist/components/snk-crud.js +1 -1
- package/dist/components/snk-detail-view2.js +1 -1
- package/dist/components/snk-grid2.js +19 -11
- package/dist/components/snk-personalized-filter2.js +16 -6
- package/dist/components/snk-simple-crud2.js +2 -88
- package/dist/esm/{ConfigStorage-80ca14d5.js → ConfigStorage-26f89143.js} +2 -2
- package/dist/esm/{DataFetcher-044e3988.js → DataFetcher-90e91631.js} +26 -11
- package/dist/esm/{SnkFormConfigManager-1a8b3a44.js → SnkFormConfigManager-18948123.js} +2 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-892f37f9.js → SnkMultiSelectionListDataSource-b9410c72.js} +11 -0
- package/dist/esm/{auth-fetcher-1b378f8e.js → auth-fetcher-a8c8ee7e.js} +1 -1
- package/dist/esm/dataunit-fetcher-1c2ccae2.js +874 -0
- package/dist/esm/{form-config-fetcher-c702e9e3.js → form-config-fetcher-7c3b6273.js} +1 -1
- package/dist/{components/pesquisa-fetcher.js → esm/pesquisa-fetcher-90d6853b.js} +1 -1
- package/dist/esm/snk-actions-button.entry.js +4 -3
- package/dist/esm/snk-application.entry.js +17 -8
- package/dist/esm/snk-attach.entry.js +16 -3
- package/dist/esm/snk-crud.entry.js +6 -4
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +8 -6
- package/dist/esm/snk-filter-bar.entry.js +3 -3
- 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 +26 -15
- package/dist/esm/{snk-guides-viewer-767ad354.js → snk-guides-viewer-62b0fa69.js} +5 -4
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-personalized-filter.entry.js +19 -9
- package/dist/esm/snk-simple-crud.entry.js +7 -91
- package/dist/sankhyablocks/p-193971ad.js +1 -0
- package/dist/sankhyablocks/{p-dacb4c4c.entry.js → p-19cbe6e2.entry.js} +3 -3
- package/dist/sankhyablocks/{p-76926391.js → p-240f5892.js} +2 -2
- package/dist/sankhyablocks/p-2c7c1323.entry.js +1 -0
- package/dist/sankhyablocks/p-3253e7f2.entry.js +1 -0
- package/dist/sankhyablocks/{p-d1cc9007.entry.js → p-57550ddc.entry.js} +1 -1
- package/dist/sankhyablocks/p-5d51bff4.js +1 -0
- package/dist/sankhyablocks/{p-727b8cbe.entry.js → p-5dd52ec5.entry.js} +1 -1
- package/dist/sankhyablocks/p-6541f0df.js +1 -0
- package/dist/sankhyablocks/p-68fbd480.entry.js +1 -0
- package/dist/sankhyablocks/{p-845c7480.entry.js → p-8652f90b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a2c7c45f.js → p-910af03c.js} +1 -1
- package/dist/sankhyablocks/p-992a9d0f.js +1 -0
- package/dist/sankhyablocks/p-acb1374c.entry.js +1 -0
- package/dist/sankhyablocks/p-b36053da.entry.js +1 -0
- package/dist/sankhyablocks/p-b481e5ad.js +1 -0
- package/dist/sankhyablocks/p-d264da22.entry.js +1 -0
- package/dist/sankhyablocks/{p-af86752b.js → p-d47bbee3.js} +1 -1
- package/dist/sankhyablocks/{p-e46dd27b.entry.js → p-d563e451.entry.js} +1 -1
- package/dist/sankhyablocks/p-d56b65e3.entry.js +1 -0
- package/dist/sankhyablocks/p-e473ca13.entry.js +1 -0
- package/dist/sankhyablocks/{p-3ef37b31.entry.js → p-e74e2153.entry.js} +1 -1
- package/dist/sankhyablocks/p-e86d4a53.js +59 -0
- package/dist/sankhyablocks/{p-90c07587.entry.js → p-ebfa6460.entry.js} +1 -1
- 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-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +1 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +3 -4
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +3 -1
- package/dist/types/components.d.ts +3 -2
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +13 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +19 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +25 -0
- package/dist/types/lib/http/data-fetcher/fetchers/{dataunit-fetcher.d.ts → data-unit/dataunit-fetcher.d.ts} +5 -3
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataResult.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataStrategy.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +8 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRecordField.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IResponseRecord.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DataUnitStrategy.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +15 -0
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +1 -1
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cjs/dataunit-fetcher-16b32d96.js +0 -356
- package/dist/esm/dataunit-fetcher-e0361781.js +0 -354
- package/dist/esm/pesquisa-fetcher-d1b4e5a2.js +0 -165
- package/dist/sankhyablocks/p-15578509.entry.js +0 -1
- package/dist/sankhyablocks/p-1f32ad9c.entry.js +0 -1
- package/dist/sankhyablocks/p-2043a64f.js +0 -1
- package/dist/sankhyablocks/p-251985c1.entry.js +0 -1
- package/dist/sankhyablocks/p-3c1759ba.entry.js +0 -1
- package/dist/sankhyablocks/p-473c7df4.js +0 -1
- package/dist/sankhyablocks/p-77aebc26.js +0 -1
- package/dist/sankhyablocks/p-867e9b79.js +0 -1
- package/dist/sankhyablocks/p-8d1602f2.entry.js +0 -1
- package/dist/sankhyablocks/p-98ae8ddc.entry.js +0 -1
- package/dist/sankhyablocks/p-9de24cf3.entry.js +0 -1
- package/dist/sankhyablocks/p-b6d54b6c.entry.js +0 -1
- package/dist/sankhyablocks/p-d5b11196.js +0 -76
- package/dist/sankhyablocks/p-fa9d3f73.js +0 -1
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
|
|
2
2
|
import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { D as DataFetcher } from './DataFetcher.js';
|
4
4
|
import { P as ParamType } from './ParamType.js';
|
5
|
-
import './
|
5
|
+
import './dataunit-fetcher.js';
|
6
6
|
import './index2.js';
|
7
7
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
8
8
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -4,8 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
|
7
|
-
import { D as DataUnitFetcher } from './dataunit-fetcher.js';
|
8
|
-
import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
|
7
|
+
import { D as DataUnitFetcher, P as PesquisaFetcher } from './dataunit-fetcher.js';
|
9
8
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
10
9
|
import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
|
11
10
|
|
@@ -1152,8 +1151,16 @@ class RequestListenerLoadingBar {
|
|
1152
1151
|
}
|
1153
1152
|
;
|
1154
1153
|
isIgnoreLoadingOnRequest(param) {
|
1155
|
-
|
1156
|
-
|
1154
|
+
if (param == undefined) {
|
1155
|
+
return false;
|
1156
|
+
}
|
1157
|
+
if (param.url.includes("quietMode=true")) {
|
1158
|
+
return true;
|
1159
|
+
}
|
1160
|
+
if (param.requestBody == undefined) {
|
1161
|
+
return false;
|
1162
|
+
}
|
1163
|
+
if (param.requestBody.length == 1) {
|
1157
1164
|
const { name } = param.requestBody[0].variables;
|
1158
1165
|
if (name) {
|
1159
1166
|
const nameParts = name.split(":");
|
@@ -417,13 +417,25 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
417
417
|
dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
|
418
418
|
dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
|
419
419
|
this.dataUnit = dataUnit;
|
420
|
-
this.dataUnit.loadData()
|
420
|
+
this.dataUnit.loadData().then(() => {
|
421
|
+
this.disableEditFieldsNotInForm();
|
422
|
+
});
|
421
423
|
return this.dataUnit;
|
422
424
|
}
|
423
425
|
catch (error) {
|
424
426
|
throw new Error('There was an error while creating the data unit');
|
425
427
|
}
|
426
428
|
}
|
429
|
+
disableEditFieldsNotInForm() {
|
430
|
+
var _a;
|
431
|
+
(_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
|
432
|
+
var _a;
|
433
|
+
const fieldName = column.name;
|
434
|
+
if (!((_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form.fields.some(field => field.name === fieldName))) {
|
435
|
+
this.dataUnit.disableField(fieldName);
|
436
|
+
}
|
437
|
+
});
|
438
|
+
}
|
427
439
|
componentWillLoad() {
|
428
440
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
429
441
|
this.loadAttachmentDataUnit();
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
2
2
|
import { StringUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
3
3
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
4
4
|
import './DataFetcher.js';
|
5
|
-
import './
|
5
|
+
import './dataunit-fetcher.js';
|
6
6
|
import { P as PresentationMode } from './index2.js';
|
7
7
|
import { d as defineCustomElement$v } from './snk-actions-button2.js';
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, forceUpdate,
|
|
2
2
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
|
3
3
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
4
4
|
import './DataFetcher.js';
|
5
|
-
import './
|
5
|
+
import './dataunit-fetcher.js';
|
6
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';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
2
|
-
import { ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
2
|
+
import { SortMode, ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
3
3
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
import { d as defineCustomElement$1, T as TaskbarElement } from './snk-taskbar2.js';
|
5
5
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
@@ -110,6 +110,18 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
110
110
|
}
|
111
111
|
setGridConfig(config) {
|
112
112
|
this._gridConfig = config;
|
113
|
+
this.assertDefaultSorting();
|
114
|
+
}
|
115
|
+
assertDefaultSorting() {
|
116
|
+
if (this._gridConfig && this._dataUnit) {
|
117
|
+
this._dataUnit.defaultSorting = this._gridConfig
|
118
|
+
.columns
|
119
|
+
.sort((colA, colB) => colA.orderIndex - colB.orderIndex)
|
120
|
+
.map(({ name: field, ascending }) => {
|
121
|
+
const { dataType } = this._dataUnit.getField(field);
|
122
|
+
return { field, dataType, mode: ascending ? SortMode.ASC : SortMode.DESC };
|
123
|
+
});
|
124
|
+
}
|
113
125
|
}
|
114
126
|
loadConfig() {
|
115
127
|
ConfigStorage.loadGridConfig(this.configName, this.resourceID)
|
@@ -235,11 +247,12 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
235
247
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
236
248
|
}
|
237
249
|
finshLoading() {
|
238
|
-
|
239
|
-
this._dataUnitLoadLockerResolver = this._dataUnit.addLoadingLocker();
|
250
|
+
this.assertDefaultSorting();
|
240
251
|
this.addElementID();
|
241
|
-
(
|
242
|
-
|
252
|
+
if (this.columnFilterDataSource != undefined) {
|
253
|
+
this.columnFilterDataSource.setApplication(this._application);
|
254
|
+
this.columnFilterDataSource.setDataUnit(this._dataUnit);
|
255
|
+
}
|
243
256
|
}
|
244
257
|
componentWillLoad() {
|
245
258
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
@@ -320,18 +333,13 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
320
333
|
getPrimaryButton() {
|
321
334
|
return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
|
322
335
|
}
|
323
|
-
onEzGridReady() {
|
324
|
-
var _a;
|
325
|
-
(_a = this._dataUnitLoadLockerResolver) === null || _a === void 0 ? void 0 : _a.call(this);
|
326
|
-
this._dataUnitLoadLockerResolver = undefined;
|
327
|
-
}
|
328
336
|
render() {
|
329
337
|
var _a, _b;
|
330
338
|
if (!this._dataUnit) {
|
331
339
|
return undefined;
|
332
340
|
}
|
333
341
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
334
|
-
h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection,
|
342
|
+
h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
335
343
|
}
|
336
344
|
get _element() { return this; }
|
337
345
|
static get style() { return snkGridCss; }
|
@@ -83,7 +83,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
83
83
|
}
|
84
84
|
ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
|
85
85
|
.then((resp) => {
|
86
|
-
const personalizedFilter = this.
|
86
|
+
const personalizedFilter = this.applyDefaultValues(resp);
|
87
87
|
this._filterAssistent = personalizedFilter;
|
88
88
|
this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
|
89
89
|
this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
|
@@ -194,20 +194,30 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
194
194
|
this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { name });
|
195
195
|
this._elButtonSave.enabled = !this.hasChangesToSave();
|
196
196
|
}
|
197
|
-
|
197
|
+
applyDefaultValues(personalizedFilter) {
|
198
|
+
this.addLabelToItems(personalizedFilter);
|
199
|
+
this.addFilterGroupCondition(personalizedFilter);
|
200
|
+
return personalizedFilter;
|
201
|
+
}
|
202
|
+
addFilterGroupCondition(personalizedFilter) {
|
203
|
+
if (!personalizedFilter.assistent.operand) {
|
204
|
+
personalizedFilter.assistent.operand = FilterGroupCondition.AND;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
;
|
208
|
+
addLabelToItems(personalizedFilter) {
|
198
209
|
//Workaround: Alguns filtros foram salvos sem o fieldLabel. Para evitar transtornos
|
199
210
|
//tentamos usar o fieldLabel que pode estar informado no parametro.
|
200
|
-
if (
|
201
|
-
|
211
|
+
if (personalizedFilter.assistent && personalizedFilter.assistent.items && personalizedFilter.assistent.items.length > 0) {
|
212
|
+
personalizedFilter.assistent.items.forEach(item => {
|
202
213
|
if (item.fieldLabel == undefined) {
|
203
|
-
const param = (
|
214
|
+
const param = (personalizedFilter.parameters || []).find(param => param.fieldName === item.fieldName);
|
204
215
|
if (param) {
|
205
216
|
item.fieldLabel = param.label;
|
206
217
|
}
|
207
218
|
}
|
208
219
|
});
|
209
220
|
}
|
210
|
-
return resp;
|
211
221
|
}
|
212
222
|
handleExpressionChangeAdvancedMode(expression) {
|
213
223
|
this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
2
|
-
import {
|
2
|
+
import { ObjectUtils, ApplicationContext, DataType, UserInterface } from '@sankhyalabs/core';
|
3
3
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
|
4
4
|
import { T as TaskbarElement, d as defineCustomElement$1 } from './snk-taskbar2.js';
|
5
5
|
import './DataFetcher.js';
|
6
|
-
import './
|
6
|
+
import { I as InMemoryLoader } from './dataunit-fetcher.js';
|
7
7
|
import { P as PresentationMode } from './index2.js';
|
8
8
|
import { d as defineCustomElement$5 } from './snk-actions-button2.js';
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -15,92 +15,6 @@ import { d as defineCustomElement$4 } from './snk-data-exporter2.js';
|
|
15
15
|
import { d as defineCustomElement$3 } from './snk-data-unit2.js';
|
16
16
|
import { d as defineCustomElement$2 } from './snk-exporter-email-sender2.js';
|
17
17
|
|
18
|
-
class InMemoryLoader {
|
19
|
-
constructor(metadata, records) {
|
20
|
-
this.records = records;
|
21
|
-
this.metadata = metadata;
|
22
|
-
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
23
|
-
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
24
|
-
this._dataUnit.dataLoader = (dataUnit, request) => defaultDataLoader(dataUnit, request, this.getRecordsToLoad());
|
25
|
-
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
26
|
-
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
27
|
-
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
28
|
-
}
|
29
|
-
getRecordsToLoad() {
|
30
|
-
if (this._initialRecords) {
|
31
|
-
try {
|
32
|
-
return this._initialRecords;
|
33
|
-
}
|
34
|
-
finally {
|
35
|
-
this._initialRecords = undefined;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
return this.dataUnit.records;
|
39
|
-
}
|
40
|
-
get dataUnit() {
|
41
|
-
return this._dataUnit;
|
42
|
-
}
|
43
|
-
get records() {
|
44
|
-
return this.dataUnit.records;
|
45
|
-
}
|
46
|
-
set records(records) {
|
47
|
-
const newRecords = records === null || records === void 0 ? void 0 : records.map(record => {
|
48
|
-
if (!record["__record__id__"]) {
|
49
|
-
record["__record__id__"] = this.generateUniqueId();
|
50
|
-
}
|
51
|
-
return record;
|
52
|
-
});
|
53
|
-
if (this._dataUnit) {
|
54
|
-
this._dataUnit.records = newRecords;
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
this._initialRecords = newRecords;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
get metadata() {
|
61
|
-
return this._metadata;
|
62
|
-
}
|
63
|
-
set metadata(metadata) {
|
64
|
-
this._metadata = metadata;
|
65
|
-
if (this._dataUnit) {
|
66
|
-
this._dataUnit.metadata = this._metadata;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
generateUniqueId() {
|
70
|
-
return StringUtils.generateUUID();
|
71
|
-
}
|
72
|
-
metadaLoader() {
|
73
|
-
return Promise.resolve(this._metadata);
|
74
|
-
}
|
75
|
-
saveLoader(_dataUnit, changes) {
|
76
|
-
return new Promise((resolve) => {
|
77
|
-
let dataUnitRecords = [];
|
78
|
-
changes.forEach(change => {
|
79
|
-
let { record, updatingFields, operation } = change;
|
80
|
-
const changedRecord = Object.assign(Object.assign({}, record), updatingFields);
|
81
|
-
if (operation === ChangeOperation.INSERT ||
|
82
|
-
operation === ChangeOperation.COPY) {
|
83
|
-
changedRecord["__old__id__"] = record["__record__id__"];
|
84
|
-
changedRecord["__record__id__"] = this.generateUniqueId();
|
85
|
-
this.records.push(changedRecord);
|
86
|
-
}
|
87
|
-
else {
|
88
|
-
const recordIndex = this.records.findIndex(r => r["__record__id__"] == changedRecord["__record__id__"]);
|
89
|
-
this.records[recordIndex] = changedRecord;
|
90
|
-
}
|
91
|
-
dataUnitRecords.push(changedRecord);
|
92
|
-
});
|
93
|
-
resolve(dataUnitRecords);
|
94
|
-
});
|
95
|
-
}
|
96
|
-
removeLoader(_dataUnit, recordIds) {
|
97
|
-
return new Promise((resolve) => {
|
98
|
-
resolve(recordIds);
|
99
|
-
});
|
100
|
-
}
|
101
|
-
}
|
102
|
-
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
103
|
-
|
104
18
|
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:max-content;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;min-height:300px}ez-form.sc-snk-simple-crud{min-height:300px}";
|
105
19
|
|
106
20
|
const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
@@ -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-7c3b6273.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-90e91631.js';
|
5
5
|
|
6
6
|
class GridConfigFetcher extends ResourceFetcher {
|
7
7
|
constructor() {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType, ApplicationContext, ErrorException, WarningException, ObjectUtils
|
1
|
+
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
|
2
2
|
import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-9943807e.js';
|
3
3
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
import { P as PrintUtils } from './PrintUtils-3e4ff0f5.js';
|
@@ -6541,9 +6541,14 @@ class DataFetcher {
|
|
6541
6541
|
}
|
6542
6542
|
}
|
6543
6543
|
this.instance.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
6544
|
-
this.instance.graphqlPath = `/${this.instance.application.getModuleName()}/graphql`;
|
6545
6544
|
return this.instance;
|
6546
6545
|
}
|
6546
|
+
static getGraphQLPath() {
|
6547
|
+
if (StringUtils.isEmpty(this.instance.graphqlPath) && this.instance.application != undefined) {
|
6548
|
+
this.instance.graphqlPath = `/${this.instance.application.getModuleName()}/graphql`;
|
6549
|
+
}
|
6550
|
+
return this.instance.graphqlPath;
|
6551
|
+
}
|
6547
6552
|
static addRequestListener(listener) {
|
6548
6553
|
const index = DataFetcher.requestListener.indexOf(listener);
|
6549
6554
|
if (index < 0) {
|
@@ -6593,7 +6598,7 @@ class DataFetcher {
|
|
6593
6598
|
}
|
6594
6599
|
return new ErrorException(title, statusMessage, tsErrorCode);
|
6595
6600
|
}
|
6596
|
-
async callGraphQL(req) {
|
6601
|
+
async callGraphQL(req, quietMode = false) {
|
6597
6602
|
var _a;
|
6598
6603
|
if (this.ready) {
|
6599
6604
|
this.pause();
|
@@ -6611,7 +6616,7 @@ class DataFetcher {
|
|
6611
6616
|
if (this.ready) {
|
6612
6617
|
return new Promise(async (resolve, reject) => {
|
6613
6618
|
let query = this.getQueryTemplate(req);
|
6614
|
-
const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
|
6619
|
+
const res = await this.fecthGrapql([{ document: query, variables: req.values }], quietMode);
|
6615
6620
|
if (res.errors.length > 0) {
|
6616
6621
|
if (!this.proccesGraphQLClientEvents(res === null || res === void 0 ? void 0 : res.extensions, req, resolve, reject)) {
|
6617
6622
|
const error = this.processGraphQlErrorInfo(res.errors);
|
@@ -6626,7 +6631,7 @@ class DataFetcher {
|
|
6626
6631
|
}
|
6627
6632
|
else {
|
6628
6633
|
if (!this.watingRequestsById.has(reqKey)) {
|
6629
|
-
this.watingRequestsById.set(reqKey, new WaitingRequest(req));
|
6634
|
+
this.watingRequestsById.set(reqKey, new WaitingRequest(req, quietMode));
|
6630
6635
|
}
|
6631
6636
|
return (_a = this.watingRequestsById.get(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
|
6632
6637
|
}
|
@@ -6842,14 +6847,16 @@ class DataFetcher {
|
|
6842
6847
|
}
|
6843
6848
|
async executePendingRequest(watingRequestsById) {
|
6844
6849
|
const requestsBatch = [];
|
6850
|
+
let quietMode = true;
|
6845
6851
|
watingRequestsById.forEach(async (waitingReq) => {
|
6846
6852
|
let query = this.getQueryTemplate(waitingReq.request);
|
6847
6853
|
requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
|
6854
|
+
quietMode = quietMode && waitingReq.quietMode;
|
6848
6855
|
});
|
6849
6856
|
let res = undefined;
|
6850
6857
|
let dataResponse = [];
|
6851
6858
|
let errorsResponse = [];
|
6852
|
-
res = await this.fecthGrapql(requestsBatch);
|
6859
|
+
res = await this.fecthGrapql(requestsBatch, quietMode);
|
6853
6860
|
dataResponse = res.data;
|
6854
6861
|
errorsResponse = res.errors;
|
6855
6862
|
//Reject promises with errors from query
|
@@ -6867,14 +6874,18 @@ class DataFetcher {
|
|
6867
6874
|
});
|
6868
6875
|
});
|
6869
6876
|
}
|
6870
|
-
async fecthGrapql(request) {
|
6877
|
+
async fecthGrapql(request, quietMode) {
|
6871
6878
|
let res = undefined;
|
6872
6879
|
let dataResponse = [];
|
6873
6880
|
let errorsResponse = [];
|
6874
|
-
let url = `${this.resolveURL() +
|
6881
|
+
let url = `${this.resolveURL() + DataFetcher.getGraphQLPath()}`;
|
6875
6882
|
const responseExtensions = [];
|
6876
|
-
|
6877
|
-
|
6883
|
+
const mgeSession = window["mgeSession"];
|
6884
|
+
if (mgeSession != undefined) {
|
6885
|
+
url += `?mgeSession=${mgeSession}`;
|
6886
|
+
}
|
6887
|
+
if (quietMode) {
|
6888
|
+
url += `${url.indexOf("?") > -1 ? "&" : "?"}quietMode=true`;
|
6878
6889
|
}
|
6879
6890
|
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: request }));
|
6880
6891
|
try {
|
@@ -6960,7 +6971,7 @@ DataFetcher.SERVICE_BROKER_STATUS = {
|
|
6960
6971
|
};
|
6961
6972
|
DataFetcher.clientEventsByID = new Map();
|
6962
6973
|
class WaitingRequest {
|
6963
|
-
constructor(req) {
|
6974
|
+
constructor(req, quietMode) {
|
6964
6975
|
this._resolve = () => { };
|
6965
6976
|
this._reject = () => { };
|
6966
6977
|
this._request = undefined;
|
@@ -6969,6 +6980,7 @@ class WaitingRequest {
|
|
6969
6980
|
this._resolve = resolve;
|
6970
6981
|
this._reject = reject;
|
6971
6982
|
});
|
6983
|
+
this._quietMode = quietMode;
|
6972
6984
|
}
|
6973
6985
|
get resolve() {
|
6974
6986
|
return this._resolve;
|
@@ -6982,6 +6994,9 @@ class WaitingRequest {
|
|
6982
6994
|
get request() {
|
6983
6995
|
return this._request;
|
6984
6996
|
}
|
6997
|
+
get quietMode() {
|
6998
|
+
return this._quietMode;
|
6999
|
+
}
|
6985
7000
|
}
|
6986
7001
|
|
6987
7002
|
export { DataFetcher as D, UrlUtils as U, dist as d };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-26f89143.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-7c3b6273.js';
|
4
4
|
|
5
5
|
class SnkFormConfigManager {
|
6
6
|
constructor(configName, resourceID, onConfigChange) {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { UserInterface, DateUtils } from '@sankhyalabs/core';
|
2
|
+
import { P as PreloadManager } from './dataunit-fetcher-1c2ccae2.js';
|
2
3
|
|
3
4
|
class SnkMultiSelectionListDataSource {
|
4
5
|
setDataUnit(dataUnit) {
|
@@ -14,6 +15,16 @@ class SnkMultiSelectionListDataSource {
|
|
14
15
|
}
|
15
16
|
return String(this._dataUnit.getFormattedValue(fieldName, value));
|
16
17
|
}
|
18
|
+
async getStaticOptions(fieldName) {
|
19
|
+
if (fieldName == undefined) {
|
20
|
+
return Promise.resolve(undefined);
|
21
|
+
}
|
22
|
+
const result = await PreloadManager.getDistinct(this._dataUnit, fieldName);
|
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 })));
|
27
|
+
}
|
17
28
|
fetchData(filterTerm, fieldName) {
|
18
29
|
return new Promise(resolve => {
|
19
30
|
this._application.executeSelectDistinct(this._dataUnit, fieldName, filterTerm).then(result => {
|
@@ -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-7c3b6273.js';
|
3
3
|
|
4
4
|
class AuthFetcher extends ResourceFetcher {
|
5
5
|
getData(resourceID) {
|