@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-55889.1 → 0.0.0-bugfix-dev-KB-72129.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/{IExporterProvider-9ac15aaf.js → ContinuousInsertUtils-b32220f0.js} +35 -2
- 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-004f781a.js} +10 -11
- 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-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +52 -12
- 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-crud.cjs.entry.js +43 -11
- 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 +8 -9
- package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
- package/dist/collection/components/snk-grid/snk-grid.js +66 -6
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +59 -8
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +1 -1
- 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} +39 -4
- 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 +9 -10
- package/dist/components/snk-detail-view2.js +8 -3
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-grid2.js +48 -6
- package/dist/components/snk-simple-crud2.js +39 -5
- package/dist/esm/{IExporterProvider-09df2e3e.js → ContinuousInsertUtils-aae77a37.js} +36 -4
- 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-a90ce6f2.js} +10 -11
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +47 -7
- 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-crud.entry.js +39 -7
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-3e3cc017.js +1 -0
- package/dist/sankhyablocks/{p-559bfb9b.entry.js → p-43a73838.entry.js} +1 -1
- package/dist/sankhyablocks/p-47a038a3.js +1 -0
- package/dist/sankhyablocks/p-50779ad3.entry.js +1 -0
- 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-439a50fb.entry.js → p-7f918d0b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9cbef862.js → p-9132a0a1.js} +1 -1
- package/dist/sankhyablocks/p-9bc1c239.entry.js +1 -0
- package/dist/sankhyablocks/{p-640140b3.entry.js → p-a42e7a1e.entry.js} +1 -1
- package/dist/sankhyablocks/p-b0ef9faa.entry.js +1 -0
- package/dist/sankhyablocks/{p-73185e58.entry.js → p-d836f72b.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 +0 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +12 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components.d.ts +32 -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-a31e761f.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-f8698ad3.js +0 -60
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { D as DataFetcher } from './DataFetcher.js';
|
|
2
2
|
import './pesquisa-fetcher.js';
|
|
3
|
-
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType, StringUtils } from '@sankhyalabs/core';
|
|
4
4
|
import './ISave.js';
|
|
5
5
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
6
6
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
@@ -124,12 +124,16 @@ class TaskbarProcessor {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
|
127
|
-
const defaults = this.
|
|
127
|
+
const defaults = this.getButtonsFromKey(taskbarId);
|
|
128
128
|
if (taskbarManager) {
|
|
129
129
|
return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
|
|
130
130
|
}
|
|
131
131
|
return defaults;
|
|
132
132
|
}
|
|
133
|
+
getButtonsFromKey(taskbarId) {
|
|
134
|
+
const btnsValue = this._defaultButtons[taskbarId];
|
|
135
|
+
return typeof btnsValue === 'function' ? btnsValue() : btnsValue;
|
|
136
|
+
}
|
|
133
137
|
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
|
134
138
|
const originalValue = disabled.includes(buttonName) ? false : true;
|
|
135
139
|
if (taskbarManager && taskbarManager.isEnabled) {
|
|
@@ -217,7 +221,7 @@ class RmPrecisionCustomValueFormatter {
|
|
|
217
221
|
this.refreshSelectedRows();
|
|
218
222
|
}
|
|
219
223
|
setDataState(dataState) {
|
|
220
|
-
if (ObjectUtils.
|
|
224
|
+
if (this._dataState && ObjectUtils.equals(dataState === null || dataState === void 0 ? void 0 : dataState.metadataByRow, this._dataState.metadataByRow)) {
|
|
221
225
|
return;
|
|
222
226
|
}
|
|
223
227
|
this._dataState = dataState;
|
|
@@ -295,4 +299,35 @@ class CommonsExporter {
|
|
|
295
299
|
}
|
|
296
300
|
}
|
|
297
301
|
|
|
298
|
-
|
|
302
|
+
class ContinuousInsertUtils {
|
|
303
|
+
constructor(snkApplication, resourceID, configName) {
|
|
304
|
+
this.snkApplication = snkApplication;
|
|
305
|
+
this.keyConfigEnableContinuousInsert = `${resourceID}enableContinuousInsert${configName ? configName : ''}`;
|
|
306
|
+
}
|
|
307
|
+
handleSaveConfig(enableContinuousInsert) {
|
|
308
|
+
return this.snkApplication.saveConfig(this.keyConfigEnableContinuousInsert, enableContinuousInsert);
|
|
309
|
+
}
|
|
310
|
+
getConfig() {
|
|
311
|
+
return this.snkApplication.getConfig(this.keyConfigEnableContinuousInsert).then(value => {
|
|
312
|
+
if (value) {
|
|
313
|
+
return value == "true" ? true : false;
|
|
314
|
+
}
|
|
315
|
+
return false;
|
|
316
|
+
}).catch(() => {
|
|
317
|
+
return false;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
actionContinuousInsert(enableContinuousInsert, handleEnableContinuousInsert) {
|
|
321
|
+
return {
|
|
322
|
+
value: StringUtils.generateUUID(),
|
|
323
|
+
label: enableContinuousInsert ? 'Desativar inclusão contínua' : 'Ativar inclusão contínua',
|
|
324
|
+
enabled: true,
|
|
325
|
+
itemBuilder: () => {
|
|
326
|
+
return (h("div", { class: "ez-dropdown__item-wrapper", onClick: () => handleEnableContinuousInsert() },
|
|
327
|
+
h("span", { class: "ez-dropdown__item-label" }, enableContinuousInsert ? 'Desativar inclusão contínua' : 'Ativar inclusão contínua')));
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export { CommonsExporter as C, RmPrecisionCustomValueFormatter as R, SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, CrudUtils as a, buildFieldSearch as b, ContinuousInsertUtils as c, openFieldSearch as o };
|
|
@@ -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:
|
|
@@ -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],
|
|
@@ -8,7 +8,7 @@ import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/u
|
|
|
8
8
|
import { d as defineCustomElement$3 } from './snk-config-options2.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './snk-field-config2.js';
|
|
10
10
|
|
|
11
|
-
const snkFormConfigCss = ".sc-snk-form-config-h{--snk-form-config--z-index:var(--more-visible, 2);--snk-form-config--background-color:var(--background--xlight, #fff);--snk-form-config__icon--color:var(--text--disable, #AFB6C0);--snk-form-config__label-counter--font-weight:var(--text-weight--extra-small, 200);--snk-form-config__add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__add-group-container--background-color:var(--background--medium, #d2dce9);--snk-form-config__add-group-container--padding:var(--space--small, 6px);--snk-form-config__add-group-content--border:2px dashed var(--color-strokes, #DCE0E8);--snk-form-config__add-group-content--border-radius:var(--border--radius-small, 6px);--snk-form-config__add-group-label--padding:var(--space--large, 24px);--snk-form-config__btn-add-group--padding:var(--space--large, 24px) var(--space--medium, 12px) 0;--snk-form-config__btn-add-group-container--padding:var(--space--medium, 12px);--snk-form-config__btn-add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__btn-add-group-container--border:2px solid var(--color-strokes, #DCE0E8);--snk-form-config__btn-add-group-container--background-color:var(--background--body, #fafcff);display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--snk-form-config--z-index);background-color:var(--snk-form-config--background-color)}.form-config__header-container.sc-snk-form-config{display:flex}.form-config__field-container.sc-snk-form-config{width:32%;padding:6px}.form-config__hide-content.sc-snk-form-config{display:none}ez-icon.sc-snk-form-config .left-icon.sc-snk-form-config{--ez-icon--color:var(--snk-form-config__icon--color)}.ez-box__label-counter.sc-snk-form-config{margin-top:-7px;font-weight:var(--snk-form-config__label-counter--font-weight)}.form-config__btn-options.sc-snk-form-config{--ez-button--min-width:300px;--ez-button--background-color:var(--snk-form-config--background-color)}[data-draggable-parent].sc-snk-form-config{position:relative}.form-config__field-config--selected.sc-snk-form-config{position:static}.form-config__field-config--dragged.sc-snk-form-config .draggable-mirror.sc-snk-form-config{z-index:var(--snk-form-config--z-index)}.form-config__config-options.sc-snk-form-config{position:relative;margin-top:-3px;min-width:100%;z-index:1}.form-config__tab-container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config{position:relative;height:100%;max-height:calc(100vh - 92px)}.form-config__tab-container.sc-snk-form-config .ez-box__container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config .ez-box__container.sc-snk-form-config{align-content:flex-start;height:100%}.form-config__fields-available.sc-snk-form-config [data-draggable-parent].sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:100%;max-height:calc(100% - 122px)}.form-config__tab-content.sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:auto;max-height:calc(100% - 128px)}[data-draggable-element].sc-snk-form-config{cursor:grab}.form-config__actions-button.sc-snk-form-config{--ez-actions-button__btn-action--min-width:235px}.form-config__add-group.sc-snk-form-config{position:relative;min-height:120px;margin-bottom:10px}.form-config__add-group-container.sc-snk-form-config{position:absolute;display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box;border-radius:var(--snk-form-config__add-group-container--border-radius);background-color:var(--snk-form-config__add-group-container--background-color);padding:var(--snk-form-config__add-group-container--padding)}.form-config__add-group-content.sc-snk-form-config{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;box-sizing:border-box;border:var(--snk-form-config__add-group-content--border);border-radius:var(--snk-form-config__add-group-content--border-radius)}.form-config__add-group-label.sc-snk-form-config{display:flex;justify-content:center;box-sizing:border-box;padding:var(--snk-form-config__add-group-label--padding)}.form-config__btn-add-group.sc-snk-form-config{position:relative;padding:var(--snk-form-config__btn-add-group--padding)}.form-config__btn-add-group-container.sc-snk-form-config{padding:var(--snk-form-config__btn-add-group-container--padding);border-radius:var(--snk-form-config__btn-add-group-container--border-radius);border:var(--snk-form-config__btn-add-group-container--border);background-color:var(--snk-form-config__btn-add-group-container--background-color)}ez-collapsible-box.draggable-mirror.sc-snk-form-config{display:table;background-color:var(--snk-form-config--background-color)}ez-collapsible-box.sc-snk-form-config{margin-bottom:10px}@media screen and (min-width: 480px){.form-config__field-config--selected.sc-snk-form-config .ez-flex.form-config__config-options.sc-snk-form-config{min-width:calc(300% + 12px)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+2) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -1)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+3) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -2)}}";
|
|
11
|
+
const snkFormConfigCss = ".sc-snk-form-config-h{--snk-form-config--z-index:var(--more-visible, 2);--snk-form-config--background-color:var(--background--xlight, #fff);--snk-form-config__icon--color:var(--text--disable, #AFB6C0);--snk-form-config__label-counter--font-weight:var(--text-weight--extra-small, 200);--snk-form-config__add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__add-group-container--background-color:var(--background--medium, #d2dce9);--snk-form-config__add-group-container--padding:var(--space--small, 6px);--snk-form-config__add-group-content--border:2px dashed var(--color-strokes, #DCE0E8);--snk-form-config__add-group-content--border-radius:var(--border--radius-small, 6px);--snk-form-config__add-group-label--padding:var(--space--large, 24px);--snk-form-config__btn-add-group--padding:var(--space--large, 24px) var(--space--medium, 12px) 0;--snk-form-config__btn-add-group-container--padding:var(--space--medium, 12px);--snk-form-config__btn-add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__btn-add-group-container--border:2px solid var(--color-strokes, #DCE0E8);--snk-form-config__btn-add-group-container--background-color:var(--background--body, #fafcff);display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--snk-form-config--z-index);background-color:var(--snk-form-config--background-color)}div.sc-snk-form-config:focus-visible,div.sc-snk-form-config:focus{outline:none}.form-config__header-container.sc-snk-form-config{display:flex}.form-config__field-container.sc-snk-form-config{width:32%;padding:6px}.form-config__hide-content.sc-snk-form-config{display:none}ez-icon.sc-snk-form-config .left-icon.sc-snk-form-config{--ez-icon--color:var(--snk-form-config__icon--color)}.ez-box__label-counter.sc-snk-form-config{margin-top:-7px;font-weight:var(--snk-form-config__label-counter--font-weight)}.form-config__btn-options.sc-snk-form-config{--ez-button--min-width:300px;--ez-button--background-color:var(--snk-form-config--background-color)}[data-draggable-parent].sc-snk-form-config{position:relative}.form-config__field-config--selected.sc-snk-form-config{position:static}.form-config__field-config--dragged.sc-snk-form-config .draggable-mirror.sc-snk-form-config{z-index:var(--snk-form-config--z-index)}.form-config__config-options.sc-snk-form-config{position:relative;margin-top:-3px;min-width:100%;z-index:1}.form-config__tab-container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config{position:relative;height:100%;max-height:calc(100vh - 92px)}.form-config__tab-container.sc-snk-form-config .ez-box__container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config .ez-box__container.sc-snk-form-config{align-content:flex-start;height:100%}.form-config__fields-available.sc-snk-form-config [data-draggable-parent].sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:100%;max-height:calc(100% - 122px)}.form-config__tab-content.sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:auto;max-height:calc(100% - 128px)}[data-draggable-element].sc-snk-form-config{cursor:grab}.form-config__actions-button.sc-snk-form-config{--ez-actions-button__btn-action--min-width:235px}.form-config__add-group.sc-snk-form-config{position:relative;min-height:120px;margin-bottom:10px}.form-config__add-group-container.sc-snk-form-config{position:absolute;display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box;border-radius:var(--snk-form-config__add-group-container--border-radius);background-color:var(--snk-form-config__add-group-container--background-color);padding:var(--snk-form-config__add-group-container--padding)}.form-config__add-group-content.sc-snk-form-config{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;box-sizing:border-box;border:var(--snk-form-config__add-group-content--border);border-radius:var(--snk-form-config__add-group-content--border-radius)}.form-config__add-group-label.sc-snk-form-config{display:flex;justify-content:center;box-sizing:border-box;padding:var(--snk-form-config__add-group-label--padding)}.form-config__btn-add-group.sc-snk-form-config{position:relative;padding:var(--snk-form-config__btn-add-group--padding)}.form-config__btn-add-group-container.sc-snk-form-config{padding:var(--snk-form-config__btn-add-group-container--padding);border-radius:var(--snk-form-config__btn-add-group-container--border-radius);border:var(--snk-form-config__btn-add-group-container--border);background-color:var(--snk-form-config__btn-add-group-container--background-color)}ez-collapsible-box.draggable-mirror.sc-snk-form-config{display:table;background-color:var(--snk-form-config--background-color)}ez-collapsible-box.sc-snk-form-config{margin-bottom:10px}@media screen and (min-width: 480px){.form-config__field-config--selected.sc-snk-form-config .ez-flex.form-config__config-options.sc-snk-form-config{min-width:calc(300% + 12px)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+2) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -1)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+3) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -2)}}";
|
|
12
12
|
|
|
13
13
|
const CONTAINER_ID = {
|
|
14
14
|
collapsibleBox: "EZ-COLLAPSIBLE-BOX",
|
|
@@ -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';
|
|
@@ -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,12 +498,21 @@ 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, this.handleEnableContinuousInsert));
|
|
503
|
+
}
|
|
504
|
+
if (this.isGridInsertActive())
|
|
505
|
+
return hardList;
|
|
478
506
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
|
479
507
|
const taskbarID = this.getTopTaskBarId();
|
|
480
508
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
|
481
509
|
}
|
|
482
510
|
return hardList.concat(this.actionsList);
|
|
483
511
|
}
|
|
512
|
+
handleEnableContinuousInsert() {
|
|
513
|
+
this._enableContinuousInsert = !this._enableContinuousInsert;
|
|
514
|
+
this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert);
|
|
515
|
+
}
|
|
484
516
|
handleFilterConfigUpdated(filterConfig) {
|
|
485
517
|
if (!filterConfig.length) {
|
|
486
518
|
this._showSnkFilterBar = false;
|
|
@@ -492,12 +524,20 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
492
524
|
}
|
|
493
525
|
this._showSnkFilterBar = true;
|
|
494
526
|
}
|
|
527
|
+
getGridHeaderButtons() {
|
|
528
|
+
if (this.isGridInsertActive())
|
|
529
|
+
return TaskbarElement.MORE_OPTIONS;
|
|
530
|
+
return this._headerTaskbarProcessor.buttons;
|
|
531
|
+
}
|
|
532
|
+
isGridInsertActive() {
|
|
533
|
+
return this.enableGridInsert && this._dataUnit.hasNewRecord();
|
|
534
|
+
}
|
|
495
535
|
render() {
|
|
496
536
|
if (!this._dataUnit) {
|
|
497
537
|
return undefined;
|
|
498
538
|
}
|
|
499
539
|
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--medium" }, this._showSnkFilterBar &&
|
|
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.
|
|
540
|
+
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
541
|
}
|
|
502
542
|
get _element() { return this; }
|
|
503
543
|
static get watchers() { return {
|
|
@@ -528,11 +568,13 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
528
568
|
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
529
569
|
"autoLoad": [4, "auto-load"],
|
|
530
570
|
"autoFocus": [4, "auto-focus"],
|
|
571
|
+
"enableGridInsert": [4, "enable-grid-insert"],
|
|
531
572
|
"_dataUnit": [32],
|
|
532
573
|
"_dataState": [32],
|
|
533
574
|
"_gridConfig": [32],
|
|
534
575
|
"_popUpGridConfig": [32],
|
|
535
576
|
"_showSnkFilterBar": [32],
|
|
577
|
+
"_enableContinuousInsert": [32],
|
|
536
578
|
"showConfig": [64],
|
|
537
579
|
"hideConfig": [64],
|
|
538
580
|
"setConfig": [64],
|