@sankhyalabs/sankhyablocks 8.16.0-dev.21 → 8.16.0-dev.23
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-e8d801ee.js} +35 -2
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/{SnkMessageBuilder-cceebbae.js → SnkMessageBuilder-bae64d0d.js} +5 -1
- package/dist/cjs/{dataunit-fetcher-4b12f70c.js → dataunit-fetcher-c1119754.js} +9 -2
- 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 +13 -10
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +5 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -4
- package/dist/cjs/{snk-data-unit-c095fb1a.js → snk-data-unit-3f5acfd1.js} +4 -4
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid.cjs.entry.js +54 -14
- package/dist/cjs/{snk-guides-viewer-866447ab.js → snk-guides-viewer-c29b6316.js} +8 -4
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +45 -13
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- 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-exporter/providers/ClientSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +2 -2
- 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/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/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +39 -4
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/SnkMessageBuilder.js +5 -1
- package/dist/components/dataunit-fetcher.js +9 -2
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-crud.js +5 -1
- package/dist/components/snk-data-unit2.js +4 -41
- package/dist/components/snk-detail-view2.js +8 -3
- package/dist/components/snk-grid2.js +50 -8
- package/dist/components/snk-simple-crud2.js +42 -7
- package/dist/esm/{IExporterProvider-09df2e3e.js → ContinuousInsertUtils-042cdd90.js} +36 -4
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/{SnkMessageBuilder-ae87b754.js → SnkMessageBuilder-6fff4a4c.js} +5 -1
- package/dist/esm/{dataunit-fetcher-3aac1a53.js → dataunit-fetcher-f80e80a6.js} +9 -2
- 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 +13 -10
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +5 -2
- package/dist/esm/snk-data-exporter.entry.js +4 -4
- package/dist/esm/{snk-data-unit-75fc8910.js → snk-data-unit-cc1d8b4e.js} +4 -4
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-grid.entry.js +49 -9
- package/dist/esm/{snk-guides-viewer-cb8a0b48.js → snk-guides-viewer-292473eb.js} +8 -4
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +41 -9
- package/dist/sankhyablocks/p-031721d6.js +1 -0
- package/dist/sankhyablocks/{p-640140b3.entry.js → p-05af89d0.entry.js} +1 -1
- package/dist/sankhyablocks/p-12e2c750.js +1 -0
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/{p-f8698ad3.js → p-219452ed.js} +1 -1
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-39edee2a.js +1 -0
- package/dist/sankhyablocks/{p-16969508.entry.js → p-4fbd8c74.entry.js} +1 -1
- package/dist/sankhyablocks/p-656fbc8b.entry.js +1 -0
- package/dist/sankhyablocks/p-6bd7e6e4.entry.js +1 -0
- package/dist/sankhyablocks/{p-41556e8a.entry.js → p-6e89e14b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bc4b94d2.entry.js → p-7a9df88b.entry.js} +1 -1
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-3757394b.entry.js → p-9fd54396.entry.js} +1 -1
- package/dist/sankhyablocks/p-b364a0b7.entry.js +1 -0
- package/dist/sankhyablocks/{p-e2a1273a.entry.js → p-d7837f33.entry.js} +1 -1
- package/dist/sankhyablocks/p-f5f5c94a.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
- 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-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/utils/ContinuousInsertUtils.d.ts +10 -0
- package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-17aba142.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-7c4aabe2.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-a31e761f.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-d137ae48.entry.js +0 -1
- package/dist/sankhyablocks/p-df8f4c4f.js +0 -1
- package/dist/sankhyablocks/p-fb0313db.entry.js +0 -1
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -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 };
|
@@ -1,30 +1,30 @@
|
|
1
1
|
import { JSUtils, DataType } from '@sankhyalabs/core';
|
2
2
|
|
3
|
-
|
4
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
3
|
+
function getSelectedRecordsIDsInfo(dataUnit) {
|
4
|
+
const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
|
5
5
|
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
6
6
|
return [];
|
7
7
|
}
|
8
8
|
const selectedRecordsIDsInfo = [];
|
9
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.
|
9
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
10
10
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
11
|
-
selectedRecords.forEach(
|
12
|
-
if (!dataUnit.isNewRecord(
|
11
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
12
|
+
if (!dataUnit.isNewRecord(__record__id__)) {
|
13
13
|
/*
|
14
14
|
Esse if foi necessário para tratar corretamente o ID
|
15
15
|
do record quando está sendo utilizado no modo standAlone
|
16
16
|
isso não faz a exportação da grid funcionar no modo standAlone
|
17
17
|
mas deixa de causar erro nas oprações de CRUD.
|
18
18
|
*/
|
19
|
-
if (!JSUtils.isBase64(
|
19
|
+
if (!JSUtils.isBase64(__record__id__)) {
|
20
20
|
selectedRecordsIDsInfo.push({
|
21
21
|
name: "__record__id__",
|
22
22
|
type: DataType.TEXT,
|
23
|
-
value:
|
23
|
+
value: __record__id__
|
24
24
|
});
|
25
25
|
return;
|
26
26
|
}
|
27
|
-
const revertBase64ToObject = JSON.parse(window.atob(
|
27
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
28
28
|
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
29
29
|
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
30
30
|
if (metadataField == undefined) {
|
@@ -36,6 +36,6 @@ const getSelectedIDs = (dataUnit) => {
|
|
36
36
|
});
|
37
37
|
}
|
38
38
|
return selectedRecordsIDsInfo;
|
39
|
-
}
|
39
|
+
}
|
40
40
|
|
41
|
-
export {
|
41
|
+
export { getSelectedRecordsIDsInfo as g };
|
@@ -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",
|
@@ -424,12 +424,19 @@ class DatasetStrategy {
|
|
424
424
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
425
425
|
const loadingInProgress = pagerId != undefined;
|
426
426
|
const count = loadingInfo.count + records.length;
|
427
|
+
const isInsertingNewRecord = dataUnit.hasNewRecord();
|
427
428
|
const needReload = !loadingInProgress && localSorting.length > 0;
|
429
|
+
/**
|
430
|
+
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
431
|
+
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
432
|
+
*/
|
433
|
+
if (needReload && isInsertingNewRecord) {
|
434
|
+
dataUnit.setWaitingToReload(true);
|
435
|
+
}
|
428
436
|
return Promise.resolve({
|
429
437
|
records,
|
430
438
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
431
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
432
|
-
needReload })
|
439
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord })
|
433
440
|
});
|
434
441
|
}
|
435
442
|
catch (error) {
|
@@ -9,6 +9,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
9
9
|
import './dataunit-fetcher.js';
|
10
10
|
import './filter-item-type.enum.js';
|
11
11
|
import './form-config-fetcher.js';
|
12
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
12
13
|
import { R as ResourceIDUtils } from './ResourceIDUtils.js';
|
13
14
|
|
14
15
|
const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
|
@@ -161,7 +162,6 @@ var RefreshType;
|
|
161
162
|
|
162
163
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
163
164
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
164
|
-
const NUFIN_COLUMN = 'NUFIN';
|
165
165
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
166
166
|
class Actions {
|
167
167
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
@@ -173,6 +173,10 @@ class Actions {
|
|
173
173
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
174
174
|
this._appResourceId = appResourceId;
|
175
175
|
}
|
176
|
+
getPrimaryKeys() {
|
177
|
+
const ids = getSelectedRecordsIDsInfo(this._dataUnit);
|
178
|
+
return ids.map(({ name }) => name);
|
179
|
+
}
|
176
180
|
apply(action, hasParamsToSave) {
|
177
181
|
this._application.closePopUp();
|
178
182
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
@@ -441,6 +445,7 @@ class Actions {
|
|
441
445
|
executeAction(execSource);
|
442
446
|
}
|
443
447
|
addRows(execSource) {
|
448
|
+
const primaryKeys = this.getPrimaryKeys();
|
444
449
|
const rows = {
|
445
450
|
row: []
|
446
451
|
};
|
@@ -454,15 +459,13 @@ class Actions {
|
|
454
459
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
455
460
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
456
461
|
}
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
row.field = [];
|
462
|
-
}
|
462
|
+
if (!row.field) {
|
463
|
+
row.field = [];
|
464
|
+
}
|
465
|
+
for (const primaryKey of primaryKeys) {
|
463
466
|
row.field.push({
|
464
|
-
fieldName:
|
465
|
-
$: sourceRow[
|
467
|
+
fieldName: primaryKey,
|
468
|
+
$: sourceRow[primaryKey]
|
466
469
|
});
|
467
470
|
}
|
468
471
|
rows.row.push(row);
|
@@ -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],
|
@@ -1,47 +1,10 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import {
|
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
5
|
import { g as getRecordValue, d as DatasetStrategy } from './dataunit-fetcher.js';
|
6
6
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
7
|
-
|
8
|
-
const getSelectedIDs = (dataUnit) => {
|
9
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
10
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
11
|
-
return [];
|
12
|
-
}
|
13
|
-
const selectedRecordsIDsInfo = [];
|
14
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
|
15
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
16
|
-
selectedRecords.forEach(recordId => {
|
17
|
-
if (!dataUnit.isNewRecord(recordId)) {
|
18
|
-
/*
|
19
|
-
Esse if foi necessário para tratar corretamente o ID
|
20
|
-
do record quando está sendo utilizado no modo standAlone
|
21
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
22
|
-
mas deixa de causar erro nas oprações de CRUD.
|
23
|
-
*/
|
24
|
-
if (!JSUtils.isBase64(recordId)) {
|
25
|
-
selectedRecordsIDsInfo.push({
|
26
|
-
name: "__record__id__",
|
27
|
-
type: DataType.TEXT,
|
28
|
-
value: recordId
|
29
|
-
});
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
const revertBase64ToObject = JSON.parse(window.atob(recordId));
|
33
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
34
|
-
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
35
|
-
if (metadataField == undefined) {
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
39
|
-
});
|
40
|
-
}
|
41
|
-
});
|
42
|
-
}
|
43
|
-
return selectedRecordsIDsInfo;
|
44
|
-
};
|
7
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
45
8
|
|
46
9
|
const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
47
10
|
constructor() {
|
@@ -153,7 +116,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
153
116
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
154
117
|
*/
|
155
118
|
async getSelectedRecordsIDsInfo() {
|
156
|
-
return
|
119
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
157
120
|
}
|
158
121
|
/**
|
159
122
|
* Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
|
@@ -757,4 +720,4 @@ function defineCustomElement() {
|
|
757
720
|
} });
|
758
721
|
}
|
759
722
|
|
760
|
-
export { SnkDataUnit as S, defineCustomElement as d
|
723
|
+
export { SnkDataUnit as S, defineCustomElement as d };
|
@@ -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],
|
@@ -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';
|
@@ -13,7 +13,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
13
13
|
import './dataunit-fetcher.js';
|
14
14
|
import './filter-item-type.enum.js';
|
15
15
|
import './form-config-fetcher.js';
|
16
|
-
import { g as
|
16
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
17
17
|
import { d as defineCustomElement$i } from './snk-actions-button2.js';
|
18
18
|
import { d as defineCustomElement$h } from './snk-data-exporter2.js';
|
19
19
|
import { d as defineCustomElement$g } from './snk-exporter-email-sender2.js';
|
@@ -54,7 +54,7 @@ class ServerSideExporterProvider extends CommonsExporter {
|
|
54
54
|
return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
55
55
|
}
|
56
56
|
getSelectedIDs() {
|
57
|
-
return
|
57
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
58
58
|
}
|
59
59
|
getOffset() {
|
60
60
|
return this.getExporterOffset(this.getPaginationInfo());
|
@@ -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],
|