@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-55889.1 → 0.0.0-bugfix-dev-KB-72883.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/{IExporterProvider-9ac15aaf.js → ContinuousInsertUtils-29b65619.js} +36 -3
- package/dist/cjs/{SnkMessageBuilder-cceebbae.js → SnkMessageBuilder-bae64d0d.js} +5 -1
- package/dist/cjs/{dataunit-fetcher-4b12f70c.js → dataunit-fetcher-f89461c1.js} +45 -17
- package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-attach.cjs.entry.js +2 -4
- package/dist/cjs/snk-crud.cjs.entry.js +5 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-ed17da6b.js → snk-data-unit-47202e42.js} +24 -18
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +19 -15
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +53 -14
- package/dist/cjs/{snk-guides-viewer-866447ab.js → snk-guides-viewer-68777d37.js} +8 -4
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +44 -13
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
- package/dist/collection/components/snk-crud/snk-crud.js +22 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +24 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +22 -16
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +44 -14
- package/dist/collection/components/snk-grid/snk-grid.css +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +66 -7
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +59 -9
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
- package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
- package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
- package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
- package/dist/components/SnkMessageBuilder.js +5 -1
- package/dist/components/dataunit-fetcher.js +45 -15
- package/dist/components/snk-attach2.js +2 -4
- package/dist/components/snk-crud.js +5 -1
- package/dist/components/snk-data-unit2.js +23 -17
- package/dist/components/snk-detail-view2.js +8 -3
- package/dist/components/snk-filter-bar2.js +20 -15
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-grid2.js +49 -8
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +40 -7
- package/dist/esm/{IExporterProvider-09df2e3e.js → ContinuousInsertUtils-30caa626.js} +37 -5
- package/dist/esm/{SnkMessageBuilder-ae87b754.js → SnkMessageBuilder-6fff4a4c.js} +5 -1
- package/dist/esm/{dataunit-fetcher-3aac1a53.js → dataunit-fetcher-c24c76c6.js} +45 -15
- package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-attach.entry.js +2 -4
- package/dist/esm/snk-crud.entry.js +5 -2
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-6888df8f.js → snk-data-unit-de45e0e1.js} +24 -18
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-filter-bar.entry.js +19 -15
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +48 -9
- package/dist/esm/{snk-guides-viewer-cb8a0b48.js → snk-guides-viewer-b5dd30e6.js} +8 -4
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +40 -9
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-2923c1b5.js +1 -0
- package/dist/sankhyablocks/p-3e3cc017.js +1 -0
- package/dist/sankhyablocks/p-50779ad3.entry.js +1 -0
- package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
- package/dist/sankhyablocks/{p-559bfb9b.entry.js → p-62e048c6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-16969508.entry.js → p-694e1c4a.entry.js} +1 -1
- package/dist/sankhyablocks/p-7ac7932c.js +60 -0
- package/dist/sankhyablocks/{p-bc4b94d2.entry.js → p-7eef0898.entry.js} +1 -1
- package/dist/sankhyablocks/p-9eaf913b.entry.js +1 -0
- package/dist/sankhyablocks/{p-640140b3.entry.js → p-a42e7a1e.entry.js} +1 -1
- package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
- package/dist/sankhyablocks/{p-9cbef862.js → p-bccfc262.js} +1 -1
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/p-d11f58d2.entry.js +1 -0
- package/dist/sankhyablocks/{p-439a50fb.entry.js → p-da34270e.entry.js} +1 -1
- package/dist/sankhyablocks/p-e16e87fc.entry.js +1 -0
- package/dist/sankhyablocks/{p-3d542b58.entry.js → p-eb9f0407.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +2 -2
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +11 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +9 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components.d.ts +40 -0
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
- package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0e9a872d.entry.js +0 -1
- package/dist/sankhyablocks/p-1ab19772.js +0 -1
- package/dist/sankhyablocks/p-1f47a0b2.entry.js +0 -1
- package/dist/sankhyablocks/p-3757394b.entry.js +0 -1
- package/dist/sankhyablocks/p-53c1d25d.entry.js +0 -1
- package/dist/sankhyablocks/p-7c4aabe2.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-a31e761f.js +0 -1
- package/dist/sankhyablocks/p-b2caaaf9.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-f8698ad3.js +0 -60
|
@@ -245,7 +245,11 @@ const snkConfiguratorMessages = {
|
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
const snkGridMessages = {
|
|
248
|
-
findColumn: "Busca de colunas"
|
|
248
|
+
findColumn: "Busca de colunas",
|
|
249
|
+
cancelConfirmation: {
|
|
250
|
+
title: "Aviso",
|
|
251
|
+
message: "As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?</b>",
|
|
252
|
+
}
|
|
249
253
|
};
|
|
250
254
|
const snkGridConfigMessages = {
|
|
251
255
|
gridConfiguration: "Configuração da Grade",
|
|
@@ -235,6 +235,21 @@ function applyFilter(records, dataUnit, filters) {
|
|
|
235
235
|
}
|
|
236
236
|
return records.filter(filterFunction);
|
|
237
237
|
}
|
|
238
|
+
function buildLoadDataResponse(recordsIn, dataUnit, request) {
|
|
239
|
+
let records = recordsIn ? [...recordsIn] : [];
|
|
240
|
+
records = applyFilter(records, dataUnit, request.filters);
|
|
241
|
+
records = applySorting(records, dataUnit, request.sort);
|
|
242
|
+
const { offset, limit } = request;
|
|
243
|
+
const paginationInfoBuilderParams = {
|
|
244
|
+
recordsLength: records.length,
|
|
245
|
+
offset,
|
|
246
|
+
recordsPerPage: limit,
|
|
247
|
+
};
|
|
248
|
+
return Promise.resolve({
|
|
249
|
+
records: getPagesByRecords(records, offset, limit),
|
|
250
|
+
paginationInfo: buildPaginationInfo(paginationInfoBuilderParams),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
238
253
|
function applySorting(records, dataUnit, sorting) {
|
|
239
254
|
if (sorting == undefined || sorting.length == 0) {
|
|
240
255
|
return records;
|
|
@@ -245,18 +260,28 @@ function applySorting(records, dataUnit, sorting) {
|
|
|
245
260
|
}
|
|
246
261
|
return records.sort(sortingFunction);
|
|
247
262
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
250
|
-
|
|
263
|
+
function hasValidLimitAndOffset(offset, limit) {
|
|
264
|
+
return offset >= 0 && limit >= 0;
|
|
265
|
+
}
|
|
266
|
+
function getPagesByRecords(records, offset = 0, limit = 0) {
|
|
267
|
+
if (!records || !records.length || !hasValidLimitAndOffset(offset, limit))
|
|
268
|
+
return [];
|
|
269
|
+
if (limit === 0 && offset === 0)
|
|
270
|
+
return records;
|
|
271
|
+
return records.slice(offset, offset + limit);
|
|
272
|
+
}
|
|
273
|
+
function buildPaginationInfo({ recordsLength = 0, offset = 0, recordsPerPage = 0 }) {
|
|
274
|
+
if (!recordsLength) {
|
|
275
|
+
return { currentPage: 0, firstRecord: 0, lastRecord: 0, total: 0, hasMore: false };
|
|
251
276
|
}
|
|
252
|
-
const
|
|
253
|
-
const lastRecord = Math.min(
|
|
277
|
+
const lastRecordIndex = offset + recordsPerPage;
|
|
278
|
+
const lastRecord = lastRecordIndex ? Math.min(lastRecordIndex, recordsLength) : recordsLength;
|
|
254
279
|
return {
|
|
255
|
-
currentPage:
|
|
256
|
-
firstRecord: offset,
|
|
280
|
+
currentPage: recordsPerPage === 0 ? 0 : Math.ceil(offset / recordsPerPage),
|
|
281
|
+
firstRecord: offset + 1,
|
|
257
282
|
lastRecord: lastRecord,
|
|
258
|
-
total:
|
|
259
|
-
hasMore:
|
|
283
|
+
total: recordsLength,
|
|
284
|
+
hasMore: lastRecord < recordsLength,
|
|
260
285
|
};
|
|
261
286
|
}
|
|
262
287
|
|
|
@@ -342,9 +367,7 @@ class InMemoryLoader {
|
|
|
342
367
|
return StringUtils.generateUUID();
|
|
343
368
|
}
|
|
344
369
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
|
345
|
-
|
|
346
|
-
records = applySorting(records, dataUnit, request.sort);
|
|
347
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
|
370
|
+
return buildLoadDataResponse(recordsIn, dataUnit, request);
|
|
348
371
|
}
|
|
349
372
|
metadaLoader() {
|
|
350
373
|
return Promise.resolve(this._metadata);
|
|
@@ -424,12 +447,19 @@ class DatasetStrategy {
|
|
|
424
447
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
|
425
448
|
const loadingInProgress = pagerId != undefined;
|
|
426
449
|
const count = loadingInfo.count + records.length;
|
|
450
|
+
const isInsertingNewRecord = dataUnit.hasNewRecord();
|
|
427
451
|
const needReload = !loadingInProgress && localSorting.length > 0;
|
|
452
|
+
/**
|
|
453
|
+
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
|
454
|
+
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
|
455
|
+
*/
|
|
456
|
+
if (needReload && isInsertingNewRecord) {
|
|
457
|
+
dataUnit.setWaitingToReload(true);
|
|
458
|
+
}
|
|
428
459
|
return Promise.resolve({
|
|
429
460
|
records,
|
|
430
461
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
431
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
432
|
-
needReload })
|
|
462
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord })
|
|
433
463
|
});
|
|
434
464
|
}
|
|
435
465
|
catch (error) {
|
|
@@ -1052,4 +1082,4 @@ class DataUnitFetcher {
|
|
|
1052
1082
|
}
|
|
1053
1083
|
}
|
|
1054
1084
|
|
|
1055
|
-
export { DataUnitFetcher as D, InMemoryLoader as I, PreloadManager as P,
|
|
1085
|
+
export { DataUnitFetcher as D, InMemoryLoader as I, PreloadManager as P, DatasetStrategy as a, buildLoadDataResponse as b, getRecordValue as g };
|
|
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataU
|
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher.js';
|
|
4
4
|
import './pesquisa-fetcher.js';
|
|
5
5
|
import { S as SaveErrorsEnum } from './ISave.js';
|
|
6
|
-
import { P as PreloadManager,
|
|
6
|
+
import { P as PreloadManager, b as buildLoadDataResponse, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher.js';
|
|
7
7
|
import './filter-item-type.enum.js';
|
|
8
8
|
import './form-config-fetcher.js';
|
|
9
9
|
import { V as VIEW_MODE } from './constants.js';
|
|
@@ -466,9 +466,7 @@ class AttachFetcherDataUnitFactory {
|
|
|
466
466
|
});
|
|
467
467
|
this._records = records;
|
|
468
468
|
}
|
|
469
|
-
|
|
470
|
-
records = applySorting(records, dataUnit, request.sort);
|
|
471
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
|
469
|
+
return buildLoadDataResponse(this._records, dataUnit, request);
|
|
472
470
|
}
|
|
473
471
|
saveLoader(changes, fetcher) {
|
|
474
472
|
return new Promise((resolve) => {
|
|
@@ -80,6 +80,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
80
80
|
this.disablePersonalizedFilter = undefined;
|
|
81
81
|
this.autoLoad = undefined;
|
|
82
82
|
this.autoFocus = true;
|
|
83
|
+
this.enableGridInsert = false;
|
|
83
84
|
this.domainMessagesBuilder = undefined;
|
|
84
85
|
this.setCustomFormTitle = undefined;
|
|
85
86
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
@@ -206,6 +207,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
206
207
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
207
208
|
}
|
|
208
209
|
insertionModeHandler() {
|
|
210
|
+
if (this.enableGridInsert)
|
|
211
|
+
return;
|
|
209
212
|
this.gridToForm();
|
|
210
213
|
}
|
|
211
214
|
cancelHandler() {
|
|
@@ -420,7 +423,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
420
423
|
return;
|
|
421
424
|
}
|
|
422
425
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
423
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, getCustomTitle: this.setCustomFormTitle }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
426
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
424
427
|
}
|
|
425
428
|
get _element() { return this; }
|
|
426
429
|
static get watchers() { return {
|
|
@@ -446,6 +449,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
446
449
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
447
450
|
"autoLoad": [4, "auto-load"],
|
|
448
451
|
"autoFocus": [4, "auto-focus"],
|
|
452
|
+
"enableGridInsert": [4, "enable-grid-insert"],
|
|
449
453
|
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
|
450
454
|
"setCustomFormTitle": [16],
|
|
451
455
|
"_dataUnit": [32],
|
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
|
2
2
|
import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
|
5
|
-
import { g as getRecordValue,
|
|
5
|
+
import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher.js';
|
|
6
6
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
7
7
|
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
|
8
8
|
|
|
@@ -485,7 +485,14 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
485
485
|
}
|
|
486
486
|
handleRecordsRemoved(action) {
|
|
487
487
|
var _a, _b;
|
|
488
|
-
|
|
488
|
+
const cachedRecords = action.payload.cachedRecords;
|
|
489
|
+
let removeFinishMsg;
|
|
490
|
+
if ((cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.length) > 1) {
|
|
491
|
+
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size: cachedRecords.length });
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
|
495
|
+
}
|
|
489
496
|
if (removeFinishMsg != undefined) {
|
|
490
497
|
this.showSuccessMessage(removeFinishMsg);
|
|
491
498
|
}
|
|
@@ -496,14 +503,6 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
496
503
|
this.dataUnit.gotoPage(page);
|
|
497
504
|
}
|
|
498
505
|
}
|
|
499
|
-
buildRemoveFinishMessage(action) {
|
|
500
|
-
const records = action.payload.records;
|
|
501
|
-
if (!records || !records.length)
|
|
502
|
-
return undefined;
|
|
503
|
-
if ((records === null || records === void 0 ? void 0 : records.length) > 1)
|
|
504
|
-
return this.getMessage('snkDataUnit.removeAllInfo', { size: records.length });
|
|
505
|
-
return this.getMessage('snkDataUnit.removeInfo', records);
|
|
506
|
-
}
|
|
507
506
|
/**
|
|
508
507
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
509
508
|
* através de um pequeno modulo na estrutura da aplicação:
|
|
@@ -547,19 +546,26 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
547
546
|
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
|
548
547
|
}
|
|
549
548
|
}
|
|
550
|
-
|
|
551
|
-
|
|
549
|
+
updateMetadataWithRMP() {
|
|
550
|
+
this.fillFieldsWithRmp(this.dataUnit.metadata);
|
|
551
|
+
this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
|
|
552
|
+
const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
|
|
553
|
+
this.dataUnit.metadata = dataUnitUpdatedMetadata;
|
|
554
|
+
}
|
|
555
|
+
async loadDataUnit() {
|
|
556
|
+
var _a, _b;
|
|
552
557
|
if (this.dataUnit == null && this._application && this.entityName) {
|
|
553
558
|
this.dataUnit = await this.getDataUnitParentOrChild();
|
|
554
559
|
}
|
|
555
560
|
if (this.dataUnit) {
|
|
556
561
|
this.dataUnit.pageSize = this.pageSize;
|
|
557
562
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
|
558
|
-
this.dataUnit.addInterceptor(this);
|
|
559
563
|
this.dataUnit.subscribe(this._dataUnitObserver);
|
|
560
|
-
if (
|
|
561
|
-
|
|
562
|
-
|
|
564
|
+
if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
|
|
565
|
+
this.updateMetadataWithRMP();
|
|
566
|
+
}
|
|
567
|
+
this.dataUnit.addInterceptor(this);
|
|
568
|
+
if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
|
|
563
569
|
const { records } = this.getMetadataByRow(this.dataUnit);
|
|
564
570
|
this.dataUnit.records = records;
|
|
565
571
|
}
|
|
@@ -647,7 +653,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
647
653
|
}
|
|
648
654
|
}
|
|
649
655
|
async componentDidLoad() {
|
|
650
|
-
await this.loadDataUnit(
|
|
656
|
+
await this.loadDataUnit();
|
|
651
657
|
this.handlerLinkFields();
|
|
652
658
|
}
|
|
653
659
|
render() {
|
|
@@ -12,7 +12,7 @@ import './filter-item-type.enum.js';
|
|
|
12
12
|
import './form-config-fetcher.js';
|
|
13
13
|
import { T as TaskbarElement, d as defineCustomElement$3 } from './snk-taskbar2.js';
|
|
14
14
|
import { V as VIEW_MODE } from './constants.js';
|
|
15
|
-
import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './
|
|
15
|
+
import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './ContinuousInsertUtils.js';
|
|
16
16
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
17
17
|
import { d as defineCustomElement$u } from './snk-actions-button2.js';
|
|
18
18
|
import { d as defineCustomElement$t } from './snk-attach2.js';
|
|
@@ -70,6 +70,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
70
70
|
this.resourceID = undefined;
|
|
71
71
|
this.detailTaskbarCustomContainerId = undefined;
|
|
72
72
|
this.formLegacyConfigName = undefined;
|
|
73
|
+
this.enableGridInsert = false;
|
|
73
74
|
this.getCustomTitle = undefined;
|
|
74
75
|
this._hasToCreateFieldSearch = true;
|
|
75
76
|
this._breadcrumbItems = [];
|
|
@@ -139,7 +140,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
139
140
|
this._container.focus();
|
|
140
141
|
}
|
|
141
142
|
exitViewer() {
|
|
142
|
-
if (this.dataUnit.isDirty()) {
|
|
143
|
+
if (!this.enableGridInsert && this.dataUnit.isDirty()) {
|
|
143
144
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
144
145
|
}
|
|
145
146
|
else {
|
|
@@ -248,10 +249,13 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
248
249
|
const invisibleButtons = this.getInvisibleButtons();
|
|
249
250
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
250
251
|
"snkGuideViewer.regular": btnsRegularMode,
|
|
251
|
-
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE"],
|
|
252
|
+
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE", this.handleAddGridMode()],
|
|
252
253
|
});
|
|
253
254
|
this._taskbarProcessor.process(taskbarId, this.taskbarManager, this.dataState, disabledButtons, invisibleButtons);
|
|
254
255
|
}
|
|
256
|
+
handleAddGridMode() {
|
|
257
|
+
return this.enableGridInsert ? TaskbarElement.GRID_MODE : "";
|
|
258
|
+
}
|
|
255
259
|
getInvisibleButtons() {
|
|
256
260
|
const invisibleButtons = [];
|
|
257
261
|
if (this.dataState && this.dataState.selectionInfo.mode === SelectionMode.ALL_RECORDS)
|
|
@@ -566,6 +570,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
566
570
|
"resourceID": [1, "resource-i-d"],
|
|
567
571
|
"detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
|
|
568
572
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
573
|
+
"enableGridInsert": [4, "enable-grid-insert"],
|
|
569
574
|
"getCustomTitle": [16],
|
|
570
575
|
"_hasToCreateFieldSearch": [32],
|
|
571
576
|
"_breadcrumbItems": [32],
|
|
@@ -253,7 +253,7 @@ class SnkFilterModalFactory {
|
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:8px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-
|
|
256
|
+
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:8px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-items:start}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
|
|
257
257
|
|
|
258
258
|
const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
259
259
|
constructor() {
|
|
@@ -279,6 +279,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
279
279
|
this._filtersComparator = (a, b) => {
|
|
280
280
|
return this._calculateSortIndex(b) - this._calculateSortIndex(a);
|
|
281
281
|
};
|
|
282
|
+
this.customFilterBarConfig = undefined;
|
|
282
283
|
this.dataUnit = undefined;
|
|
283
284
|
this.title = undefined;
|
|
284
285
|
this.configName = undefined;
|
|
@@ -588,20 +589,23 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
588
589
|
}
|
|
589
590
|
}
|
|
590
591
|
async loadConfigFromStorage(clearCache) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}
|
|
592
|
+
try {
|
|
593
|
+
if (clearCache) {
|
|
594
|
+
await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
|
|
595
|
+
}
|
|
596
|
+
let config;
|
|
597
|
+
if (this.customFilterBarConfig) {
|
|
598
|
+
config = await this.customFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
config = await ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
|
|
602
|
+
}
|
|
603
|
+
this.filterConfig = config.map(item => this.normalizeItem(item));
|
|
604
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
|
|
605
|
+
}
|
|
606
|
+
catch (e) {
|
|
607
|
+
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), e);
|
|
608
|
+
}
|
|
605
609
|
}
|
|
606
610
|
attachDataUnit() {
|
|
607
611
|
if (this.dataUnit == undefined) {
|
|
@@ -720,6 +724,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
720
724
|
}; }
|
|
721
725
|
static get style() { return snkFilterBarCss; }
|
|
722
726
|
}, [2, "snk-filter-bar", {
|
|
727
|
+
"customFilterBarConfig": [16],
|
|
723
728
|
"dataUnit": [1040],
|
|
724
729
|
"title": [1],
|
|
725
730
|
"configName": [1, "config-name"],
|
|
@@ -23,7 +23,7 @@ const SnkFilterCheckboxList$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
23
23
|
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
|
24
24
|
}
|
|
25
25
|
renderOptions() {
|
|
26
|
-
return this.optionsList.map(option => (h("ez-check", { label: option.label,
|
|
26
|
+
return this.optionsList.map(option => (h("ez-check", { label: option.label, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
|
|
27
27
|
}
|
|
28
28
|
isChecked(itemName) {
|
|
29
29
|
var _a;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
|
|
2
2
|
import { Action, ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
|
|
3
|
-
import {
|
|
3
|
+
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
5
5
|
import { P as PresentationMode } from './ISave.js';
|
|
6
|
-
import { C as CommonsExporter, T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, o as openFieldSearch, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as buildFieldSearch } from './
|
|
6
|
+
import { C as CommonsExporter, T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, o as openFieldSearch, a as CrudUtils, R as RmPrecisionCustomValueFormatter, c as ContinuousInsertUtils, b as buildFieldSearch } from './ContinuousInsertUtils.js';
|
|
7
7
|
import { s as store } from './index2.js';
|
|
8
8
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
9
9
|
import './DataFetcher.js';
|
|
@@ -86,7 +86,7 @@ class ServerSideExporterProvider extends CommonsExporter {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--
|
|
89
|
+
const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--small)}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%;padding:var(--snk-grid-padding)}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";
|
|
90
90
|
|
|
91
91
|
const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
92
92
|
constructor() {
|
|
@@ -100,7 +100,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
100
100
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
101
101
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
102
102
|
"snkGridTopTaskbar.regular.singleTaskbar": [],
|
|
103
|
-
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"],
|
|
103
|
+
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()],
|
|
104
104
|
"snkGridTopTaskbar.finish_edition.secondary": [],
|
|
105
105
|
"snkGridTopTaskbar.finish_edition.singleTaskbar": [],
|
|
106
106
|
});
|
|
@@ -113,7 +113,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
113
113
|
"snkGridHeaderTaskbar.singleTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
|
114
114
|
"snkGridHeaderTaskbar.singleTaskbar.detail.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "MORE_OPTIONS"],
|
|
115
115
|
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
|
116
|
-
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
116
|
+
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()]
|
|
117
117
|
});
|
|
118
118
|
this.dataUnitInterceptor = {
|
|
119
119
|
interceptAction: async (action) => {
|
|
@@ -128,6 +128,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
128
|
this._gridConfig = undefined;
|
|
129
129
|
this._popUpGridConfig = false;
|
|
130
130
|
this._showSnkFilterBar = true;
|
|
131
|
+
this._enableContinuousInsert = false;
|
|
131
132
|
this.columnFilterDataSource = new SnkMultiSelectionListDataSource();
|
|
132
133
|
this.configName = undefined;
|
|
133
134
|
this.filterBarTitle = undefined;
|
|
@@ -151,6 +152,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
151
152
|
this.filterBarLegacyConfigName = undefined;
|
|
152
153
|
this.autoLoad = undefined;
|
|
153
154
|
this.autoFocus = true;
|
|
155
|
+
this.enableGridInsert = false;
|
|
154
156
|
}
|
|
155
157
|
/**
|
|
156
158
|
* Exibe a janela de configurações da grade.
|
|
@@ -237,6 +239,16 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
237
239
|
async setFocus() {
|
|
238
240
|
this._grid.setFocus();
|
|
239
241
|
}
|
|
242
|
+
async handleClick(event) {
|
|
243
|
+
if (this.hasToBlockEvent(event)) {
|
|
244
|
+
event.preventDefault();
|
|
245
|
+
event.stopPropagation();
|
|
246
|
+
await this._dataUnit.cancelEdition();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
hasToBlockEvent(event) {
|
|
250
|
+
return this._snkFilterBar.contains(event.target) && this.enableGridInsert && this._dataUnit.hasNewRecord();
|
|
251
|
+
}
|
|
240
252
|
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
241
253
|
if (!newLegacyConfig) {
|
|
242
254
|
return;
|
|
@@ -247,6 +259,9 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
247
259
|
this.addGridLegacyConfigName();
|
|
248
260
|
this.loadConfig();
|
|
249
261
|
}
|
|
262
|
+
handleAddFormMode() {
|
|
263
|
+
return this.enableGridInsert ? TaskbarElement.FORM_MODE : "";
|
|
264
|
+
}
|
|
250
265
|
openGridConfig() {
|
|
251
266
|
this._grid.getColumnsState()
|
|
252
267
|
.then((gridColumns) => {
|
|
@@ -371,13 +386,21 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
371
386
|
}
|
|
372
387
|
parent = parent.parentElement;
|
|
373
388
|
}
|
|
389
|
+
if (this._snkFilterBar) {
|
|
390
|
+
this._snkFilterBar.addEventListener('click', this.handleClick);
|
|
391
|
+
}
|
|
374
392
|
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
|
375
393
|
this.addGridLegacyConfigName();
|
|
376
394
|
this.loadConfig();
|
|
395
|
+
this._continuousInsertUtils = new ContinuousInsertUtils(this._application, this.resourceID, this.configName);
|
|
396
|
+
if (this.enableGridInsert) {
|
|
397
|
+
this._continuousInsertUtils.getConfig().then(value => this._enableContinuousInsert = value);
|
|
398
|
+
}
|
|
377
399
|
}
|
|
378
400
|
componentDidRender() {
|
|
401
|
+
var _a, _b;
|
|
379
402
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
380
|
-
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
|
403
|
+
this.loadGridCustomFormatters((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields);
|
|
381
404
|
this.setCustomRenders();
|
|
382
405
|
this.setCustomEditors();
|
|
383
406
|
}
|
|
@@ -475,6 +498,14 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
475
498
|
eagerInitialize: true,
|
|
476
499
|
itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
|
|
477
500
|
}];
|
|
501
|
+
if (this.enableGridInsert) {
|
|
502
|
+
hardList.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert, () => {
|
|
503
|
+
this._enableContinuousInsert = !this._enableContinuousInsert;
|
|
504
|
+
this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert);
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
507
|
+
if (this.isGridInsertActive())
|
|
508
|
+
return hardList;
|
|
478
509
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
|
479
510
|
const taskbarID = this.getTopTaskBarId();
|
|
480
511
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
|
@@ -492,12 +523,20 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
492
523
|
}
|
|
493
524
|
this._showSnkFilterBar = true;
|
|
494
525
|
}
|
|
526
|
+
getGridHeaderButtons() {
|
|
527
|
+
if (this.isGridInsertActive())
|
|
528
|
+
return TaskbarElement.MORE_OPTIONS;
|
|
529
|
+
return this._headerTaskbarProcessor.buttons;
|
|
530
|
+
}
|
|
531
|
+
isGridInsertActive() {
|
|
532
|
+
return this.enableGridInsert && this._dataUnit.hasNewRecord();
|
|
533
|
+
}
|
|
495
534
|
render() {
|
|
496
535
|
if (!this._dataUnit) {
|
|
497
536
|
return undefined;
|
|
498
537
|
}
|
|
499
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto" }, h("div", { class: "snk-grid__header ez-margin-bottom--
|
|
500
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), 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, overflowStrategy: 'none' }, 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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.
|
|
538
|
+
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--extra-small" }, this._showSnkFilterBar &&
|
|
539
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), 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, overflowStrategy: 'none' }, 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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
501
540
|
}
|
|
502
541
|
get _element() { return this; }
|
|
503
542
|
static get watchers() { return {
|
|
@@ -528,11 +567,13 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
528
567
|
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
529
568
|
"autoLoad": [4, "auto-load"],
|
|
530
569
|
"autoFocus": [4, "auto-focus"],
|
|
570
|
+
"enableGridInsert": [4, "enable-grid-insert"],
|
|
531
571
|
"_dataUnit": [32],
|
|
532
572
|
"_dataState": [32],
|
|
533
573
|
"_gridConfig": [32],
|
|
534
574
|
"_popUpGridConfig": [32],
|
|
535
575
|
"_showSnkFilterBar": [32],
|
|
576
|
+
"_enableContinuousInsert": [32],
|
|
536
577
|
"showConfig": [64],
|
|
537
578
|
"hideConfig": [64],
|
|
538
579
|
"setConfig": [64],
|
|
@@ -33,7 +33,7 @@ const SnkSimpleBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
33
33
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
34
34
|
}
|
|
35
35
|
render() {
|
|
36
|
-
return (h("div", { class: "simple-bar__container ez-margin-vertical--
|
|
36
|
+
return (h("div", { class: "simple-bar__container ez-margin-vertical--small ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
|
|
37
37
|
}
|
|
38
38
|
get _element() { return this; }
|
|
39
39
|
static get style() { return snkSimpleBarCss; }
|