@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-63774.0 → 0.0.0-bugfix-dev-KB-55889.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/{ContinuousInsertUtils-807730a8.js → IExporterProvider-9ac15aaf.js} +3 -36
- package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-cceebbae.js} +1 -5
- package/dist/cjs/{dataunit-fetcher-f89461c1.js → dataunit-fetcher-4b12f70c.js} +17 -45
- package/dist/cjs/{field-search-68e34bf4.js → field-search-f56aa7d6.js} +1 -5
- 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 +4 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-47202e42.js → snk-data-unit-ed17da6b.js} +18 -24
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -19
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +14 -54
- package/dist/cjs/{snk-guides-viewer-68777d37.js → snk-guides-viewer-866447ab.js} +4 -8
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +13 -45
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +4 -2
- package/dist/collection/components/snk-crud/snk-crud.js +1 -22
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +2 -24
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +16 -22
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +14 -44
- package/dist/collection/components/snk-grid/snk-grid.css +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +7 -67
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +1 -0
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +9 -60
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +1 -5
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +4 -2
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +9 -34
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +2 -9
- package/dist/collection/lib/message/resources/snk-grid.msg.js +1 -5
- package/dist/components/{ContinuousInsertUtils.js → IExporterProvider.js} +5 -40
- package/dist/components/SnkMessageBuilder.js +1 -5
- package/dist/components/dataunit-fetcher.js +15 -45
- package/dist/components/snk-attach2.js +4 -2
- package/dist/components/snk-crud.js +1 -5
- package/dist/components/snk-data-unit2.js +17 -23
- package/dist/components/snk-detail-view2.js +3 -8
- package/dist/components/snk-filter-bar2.js +15 -20
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-grid2.js +8 -50
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +7 -41
- package/dist/esm/{ContinuousInsertUtils-1a82a768.js → IExporterProvider-09df2e3e.js} +5 -37
- package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-ae87b754.js} +1 -5
- package/dist/esm/{dataunit-fetcher-c24c76c6.js → dataunit-fetcher-3aac1a53.js} +15 -45
- package/dist/esm/{field-search-f8b1d91e.js → field-search-efbe307f.js} +1 -5
- 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 +4 -2
- package/dist/esm/snk-crud.entry.js +2 -5
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-de45e0e1.js → snk-data-unit-6888df8f.js} +18 -24
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-filter-bar.entry.js +15 -19
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +9 -49
- package/dist/esm/{snk-guides-viewer-b5dd30e6.js → snk-guides-viewer-cb8a0b48.js} +4 -8
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +9 -41
- package/dist/sankhyablocks/p-0e9a872d.entry.js +1 -0
- package/dist/sankhyablocks/{p-694e1c4a.entry.js → p-16969508.entry.js} +1 -1
- package/dist/sankhyablocks/p-1ab19772.js +1 -0
- package/dist/sankhyablocks/p-1f47a0b2.entry.js +1 -0
- package/dist/sankhyablocks/p-3757394b.entry.js +1 -0
- package/dist/sankhyablocks/{p-eb9f0407.entry.js → p-3d542b58.entry.js} +1 -1
- package/dist/sankhyablocks/{p-da34270e.entry.js → p-439a50fb.entry.js} +1 -1
- package/dist/sankhyablocks/p-53c1d25d.entry.js +1 -0
- package/dist/sankhyablocks/{p-62e048c6.entry.js → p-559bfb9b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a42e7a1e.entry.js → p-640140b3.entry.js} +1 -1
- package/dist/sankhyablocks/p-7c4aabe2.js +1 -0
- package/dist/sankhyablocks/p-88aa931b.entry.js +1 -0
- package/dist/sankhyablocks/{p-bccfc262.js → p-9cbef862.js} +1 -1
- package/dist/sankhyablocks/p-a31e761f.js +1 -0
- package/dist/sankhyablocks/{p-5f157b09.entry.js → p-aaa3ee68.entry.js} +1 -1
- package/dist/sankhyablocks/p-b2caaaf9.entry.js +1 -0
- package/dist/sankhyablocks/{p-7eef0898.entry.js → p-bc4b94d2.entry.js} +1 -1
- package/dist/sankhyablocks/p-c2495304.js +1 -0
- package/dist/sankhyablocks/p-f8698ad3.js +60 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +0 -5
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +2 -2
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -12
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -10
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +0 -1
- package/dist/types/components.d.ts +0 -40
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +2 -12
- package/package.json +1 -1
- package/dist/collection/lib/utils/ContinuousInsertUtils.js +0 -31
- package/dist/sankhyablocks/p-0035ad6e.entry.js +0 -1
- package/dist/sankhyablocks/p-0911e61a.entry.js +0 -1
- package/dist/sankhyablocks/p-17425c72.js +0 -1
- package/dist/sankhyablocks/p-23736d75.js +0 -1
- package/dist/sankhyablocks/p-3ae9d08a.js +0 -1
- package/dist/sankhyablocks/p-3e3cc017.js +0 -1
- package/dist/sankhyablocks/p-50779ad3.entry.js +0 -1
- package/dist/sankhyablocks/p-7ac7932c.js +0 -60
- package/dist/sankhyablocks/p-b9679243.entry.js +0 -1
- package/dist/sankhyablocks/p-c2e468c9.entry.js +0 -1
- package/dist/sankhyablocks/p-e16e87fc.entry.js +0 -1
- package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Fragment
|
|
1
|
+
import { h, Fragment } from '@stencil/core';
|
|
2
2
|
import { Action as DUAction, ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
|
4
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
@@ -11,7 +11,6 @@ import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/
|
|
|
11
11
|
import { CrudUtils } from '../../lib';
|
|
12
12
|
import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
|
|
13
13
|
import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
|
|
14
|
-
import { ContinuousInsertUtils } from '../../lib/utils/ContinuousInsertUtils';
|
|
15
14
|
export class SnkGrid {
|
|
16
15
|
constructor() {
|
|
17
16
|
this._customEditors = new Map();
|
|
@@ -20,7 +19,7 @@ export class SnkGrid {
|
|
|
20
19
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
21
20
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
22
21
|
"snkGridTopTaskbar.regular.singleTaskbar": [],
|
|
23
|
-
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"
|
|
22
|
+
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"],
|
|
24
23
|
"snkGridTopTaskbar.finish_edition.secondary": [],
|
|
25
24
|
"snkGridTopTaskbar.finish_edition.singleTaskbar": [],
|
|
26
25
|
});
|
|
@@ -33,7 +32,7 @@ export class SnkGrid {
|
|
|
33
32
|
"snkGridHeaderTaskbar.singleTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
|
34
33
|
"snkGridHeaderTaskbar.singleTaskbar.detail.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "MORE_OPTIONS"],
|
|
35
34
|
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
|
36
|
-
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"
|
|
35
|
+
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
37
36
|
});
|
|
38
37
|
this.dataUnitInterceptor = {
|
|
39
38
|
interceptAction: async (action) => {
|
|
@@ -48,7 +47,6 @@ export class SnkGrid {
|
|
|
48
47
|
this._gridConfig = undefined;
|
|
49
48
|
this._popUpGridConfig = false;
|
|
50
49
|
this._showSnkFilterBar = true;
|
|
51
|
-
this._enableContinuousInsert = false;
|
|
52
50
|
this.columnFilterDataSource = new SnkMultiSelectionListDataSource();
|
|
53
51
|
this.configName = undefined;
|
|
54
52
|
this.filterBarTitle = undefined;
|
|
@@ -72,7 +70,6 @@ export class SnkGrid {
|
|
|
72
70
|
this.filterBarLegacyConfigName = undefined;
|
|
73
71
|
this.autoLoad = undefined;
|
|
74
72
|
this.autoFocus = true;
|
|
75
|
-
this.enableGridInsert = false;
|
|
76
73
|
}
|
|
77
74
|
/**
|
|
78
75
|
* Exibe a janela de configurações da grade.
|
|
@@ -159,16 +156,6 @@ export class SnkGrid {
|
|
|
159
156
|
async setFocus() {
|
|
160
157
|
this._grid.setFocus();
|
|
161
158
|
}
|
|
162
|
-
async handleClick(event) {
|
|
163
|
-
if (this.hasToBlockEvent(event)) {
|
|
164
|
-
event.preventDefault();
|
|
165
|
-
event.stopPropagation();
|
|
166
|
-
await this._dataUnit.cancelEdition();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
hasToBlockEvent(event) {
|
|
170
|
-
return this._snkFilterBar.contains(event.target) && this.enableGridInsert && this._dataUnit.hasNewRecord();
|
|
171
|
-
}
|
|
172
159
|
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
173
160
|
if (!newLegacyConfig) {
|
|
174
161
|
return;
|
|
@@ -179,9 +166,6 @@ export class SnkGrid {
|
|
|
179
166
|
this.addGridLegacyConfigName();
|
|
180
167
|
this.loadConfig();
|
|
181
168
|
}
|
|
182
|
-
handleAddFormMode() {
|
|
183
|
-
return this.enableGridInsert ? TaskbarElement.FORM_MODE : "";
|
|
184
|
-
}
|
|
185
169
|
openGridConfig() {
|
|
186
170
|
this._grid.getColumnsState()
|
|
187
171
|
.then((gridColumns) => {
|
|
@@ -306,21 +290,13 @@ export class SnkGrid {
|
|
|
306
290
|
}
|
|
307
291
|
parent = parent.parentElement;
|
|
308
292
|
}
|
|
309
|
-
if (this._snkFilterBar) {
|
|
310
|
-
this._snkFilterBar.addEventListener('click', this.handleClick);
|
|
311
|
-
}
|
|
312
293
|
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
|
313
294
|
this.addGridLegacyConfigName();
|
|
314
295
|
this.loadConfig();
|
|
315
|
-
this._continuousInsertUtils = new ContinuousInsertUtils(this._application, this.resourceID, this.configName);
|
|
316
|
-
if (this.enableGridInsert) {
|
|
317
|
-
this._continuousInsertUtils.getConfig().then(value => this._enableContinuousInsert = value);
|
|
318
|
-
}
|
|
319
296
|
}
|
|
320
297
|
componentDidRender() {
|
|
321
|
-
var _a, _b;
|
|
322
298
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
323
|
-
this.loadGridCustomFormatters(
|
|
299
|
+
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
|
324
300
|
this.setCustomRenders();
|
|
325
301
|
this.setCustomEditors();
|
|
326
302
|
}
|
|
@@ -418,21 +394,12 @@ export class SnkGrid {
|
|
|
418
394
|
eagerInitialize: true,
|
|
419
395
|
itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
|
|
420
396
|
}];
|
|
421
|
-
if (this.enableGridInsert) {
|
|
422
|
-
hardList.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert, this.handleEnableContinuousInsert));
|
|
423
|
-
}
|
|
424
|
-
if (this.isGridInsertActive())
|
|
425
|
-
return hardList;
|
|
426
397
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
|
427
398
|
const taskbarID = this.getTopTaskBarId();
|
|
428
399
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
|
429
400
|
}
|
|
430
401
|
return hardList.concat(this.actionsList);
|
|
431
402
|
}
|
|
432
|
-
handleEnableContinuousInsert() {
|
|
433
|
-
this._enableContinuousInsert = !this._enableContinuousInsert;
|
|
434
|
-
this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert);
|
|
435
|
-
}
|
|
436
403
|
handleFilterConfigUpdated(filterConfig) {
|
|
437
404
|
if (!filterConfig.length) {
|
|
438
405
|
this._showSnkFilterBar = false;
|
|
@@ -444,20 +411,12 @@ export class SnkGrid {
|
|
|
444
411
|
}
|
|
445
412
|
this._showSnkFilterBar = true;
|
|
446
413
|
}
|
|
447
|
-
getGridHeaderButtons() {
|
|
448
|
-
if (this.isGridInsertActive())
|
|
449
|
-
return TaskbarElement.MORE_OPTIONS;
|
|
450
|
-
return this._headerTaskbarProcessor.buttons;
|
|
451
|
-
}
|
|
452
|
-
isGridInsertActive() {
|
|
453
|
-
return this.enableGridInsert && this._dataUnit.hasNewRecord();
|
|
454
|
-
}
|
|
455
414
|
render() {
|
|
456
415
|
if (!this._dataUnit) {
|
|
457
416
|
return undefined;
|
|
458
417
|
}
|
|
459
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto
|
|
460
|
-
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
|
|
418
|
+
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 &&
|
|
419
|
+
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._headerTaskbarProcessor.buttons, 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 }))));
|
|
461
420
|
}
|
|
462
421
|
static get is() { return "snk-grid"; }
|
|
463
422
|
static get encapsulation() { return "scoped"; }
|
|
@@ -903,24 +862,6 @@ export class SnkGrid {
|
|
|
903
862
|
"attribute": "auto-focus",
|
|
904
863
|
"reflect": false,
|
|
905
864
|
"defaultValue": "true"
|
|
906
|
-
},
|
|
907
|
-
"enableGridInsert": {
|
|
908
|
-
"type": "boolean",
|
|
909
|
-
"mutable": false,
|
|
910
|
-
"complexType": {
|
|
911
|
-
"original": "boolean",
|
|
912
|
-
"resolved": "boolean",
|
|
913
|
-
"references": {}
|
|
914
|
-
},
|
|
915
|
-
"required": false,
|
|
916
|
-
"optional": true,
|
|
917
|
-
"docs": {
|
|
918
|
-
"tags": [],
|
|
919
|
-
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
920
|
-
},
|
|
921
|
-
"attribute": "enable-grid-insert",
|
|
922
|
-
"reflect": false,
|
|
923
|
-
"defaultValue": "false"
|
|
924
865
|
}
|
|
925
866
|
};
|
|
926
867
|
}
|
|
@@ -930,8 +871,7 @@ export class SnkGrid {
|
|
|
930
871
|
"_dataState": {},
|
|
931
872
|
"_gridConfig": {},
|
|
932
873
|
"_popUpGridConfig": {},
|
|
933
|
-
"_showSnkFilterBar": {}
|
|
934
|
-
"_enableContinuousInsert": {}
|
|
874
|
+
"_showSnkFilterBar": {}
|
|
935
875
|
};
|
|
936
876
|
}
|
|
937
877
|
static get events() {
|
|
@@ -26,7 +26,7 @@ export class SnkSimpleBar {
|
|
|
26
26
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
27
27
|
}
|
|
28
28
|
render() {
|
|
29
|
-
return (h("div", { class: "simple-bar__container ez-margin-vertical--
|
|
29
|
+
return (h("div", { class: "simple-bar__container ez-margin-vertical--medium ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
|
|
30
30
|
}
|
|
31
31
|
static get is() { return "snk-simple-bar"; }
|
|
32
32
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils, ObjectUtils, StringUtils, UserInterface, } from '@sankhyalabs/core';
|
|
2
|
-
import { CSSVarsUtils } from
|
|
2
|
+
import { CSSVarsUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
3
3
|
import { h } from '@stencil/core';
|
|
4
4
|
import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
|
|
5
5
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
|
@@ -13,8 +13,7 @@ import { SnkFormConfigManager } from '../snk-form-config/SnkFormConfigManager';
|
|
|
13
13
|
import { REGULAR_DEFAULT_BTNS, REGULAR_SELECTED_BTNS } from './regular-buttons';
|
|
14
14
|
import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
|
|
15
15
|
import ClientSideExporterProvider from '../snk-data-exporter/providers/ClientSideExporterProvider';
|
|
16
|
-
import store from
|
|
17
|
-
import { ContinuousInsertUtils } from '../../lib/utils/ContinuousInsertUtils';
|
|
16
|
+
import store from "../../lib/store";
|
|
18
17
|
export class SnkSimpleCrud {
|
|
19
18
|
constructor() {
|
|
20
19
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
|
@@ -27,7 +26,7 @@ export class SnkSimpleCrud {
|
|
|
27
26
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
28
27
|
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
|
|
29
28
|
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
30
|
-
"snkSimpleCrudTaskbar.finish_edition":
|
|
29
|
+
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
31
30
|
});
|
|
32
31
|
this._showPopUpGridConfig = false;
|
|
33
32
|
this._showFormConfig = false;
|
|
@@ -43,12 +42,10 @@ export class SnkSimpleCrud {
|
|
|
43
42
|
this.formConfig = undefined;
|
|
44
43
|
this._formFields = [];
|
|
45
44
|
this._fieldsProps = new Map();
|
|
46
|
-
this._enableContinuousInsert = true;
|
|
47
45
|
this.multipleSelection = undefined;
|
|
48
46
|
this.useCancelConfirm = true;
|
|
49
47
|
this.pageSize = 150;
|
|
50
48
|
this.resourceID = undefined;
|
|
51
|
-
this.enableGridInsert = false;
|
|
52
49
|
this.taskbarManager = undefined;
|
|
53
50
|
this.messagesBuilder = undefined;
|
|
54
51
|
this.useEnterLikeTab = false;
|
|
@@ -118,13 +115,6 @@ export class SnkSimpleCrud {
|
|
|
118
115
|
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
|
119
116
|
this._fieldsProps = newCustomFieldProps;
|
|
120
117
|
}
|
|
121
|
-
getFinishEditionButtonsCallback() {
|
|
122
|
-
const btns = ["CANCEL", "SAVE"];
|
|
123
|
-
if (this.enableGridInsert && this._currentViewMode !== VIEW_MODE.ATTACHMENT) {
|
|
124
|
-
btns.push(this._currentViewMode === VIEW_MODE.GRID ? TaskbarElement.FORM_MODE : TaskbarElement.GRID_MODE);
|
|
125
|
-
}
|
|
126
|
-
return btns;
|
|
127
|
-
}
|
|
128
118
|
getButtons(selected, extraButtons) {
|
|
129
119
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
130
120
|
.concat(extraButtons));
|
|
@@ -207,6 +197,7 @@ export class SnkSimpleCrud {
|
|
|
207
197
|
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
208
198
|
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
209
199
|
}
|
|
200
|
+
;
|
|
210
201
|
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
|
211
202
|
}
|
|
212
203
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
@@ -329,10 +320,6 @@ export class SnkSimpleCrud {
|
|
|
329
320
|
this.onModeChange();
|
|
330
321
|
this.configDatasource();
|
|
331
322
|
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
|
332
|
-
this._continuousInsertUtils = new ContinuousInsertUtils(this.application, this.resolveResourceID(), this.configName);
|
|
333
|
-
if (this.enableGridInsert) {
|
|
334
|
-
this._continuousInsertUtils.getConfig().then(value => this._enableContinuousInsert = value);
|
|
335
|
-
}
|
|
336
323
|
}
|
|
337
324
|
componentDidLoad() {
|
|
338
325
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
@@ -567,9 +554,6 @@ export class SnkSimpleCrud {
|
|
|
567
554
|
const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
|
|
568
555
|
return Promise.resolve(options);
|
|
569
556
|
}
|
|
570
|
-
isGridInsertActive() {
|
|
571
|
-
return this.enableGridInsert && this.dataUnit.hasNewRecord();
|
|
572
|
-
}
|
|
573
557
|
getActionsList() {
|
|
574
558
|
var _a, _b;
|
|
575
559
|
const hardList = [{
|
|
@@ -581,22 +565,11 @@ export class SnkSimpleCrud {
|
|
|
581
565
|
? this.getColumnSearch(actionButton, item)
|
|
582
566
|
: this.getFieldSearch(actionButton, item)
|
|
583
567
|
}];
|
|
584
|
-
if (this.enableGridInsert) {
|
|
585
|
-
hardList.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert, this.handleEnableContinuousInsert));
|
|
586
|
-
}
|
|
587
|
-
if (this.isGridInsertActive())
|
|
588
|
-
return hardList;
|
|
589
568
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
|
590
569
|
const taskbarID = this.getTopTaskBarId();
|
|
591
570
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
|
|
592
571
|
}
|
|
593
|
-
|
|
594
|
-
return hardList.concat(this.actionsList);
|
|
595
|
-
return hardList;
|
|
596
|
-
}
|
|
597
|
-
handleEnableContinuousInsert() {
|
|
598
|
-
this._enableContinuousInsert = !this._enableContinuousInsert;
|
|
599
|
-
this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert);
|
|
572
|
+
return hardList.concat(this.actionsList);
|
|
600
573
|
}
|
|
601
574
|
getTopTaskBarId() {
|
|
602
575
|
var _a;
|
|
@@ -715,21 +688,16 @@ export class SnkSimpleCrud {
|
|
|
715
688
|
}
|
|
716
689
|
this._formConfigManager.setConfig(this.formConfig);
|
|
717
690
|
}
|
|
718
|
-
handleDataUnitOnInsertionMode() {
|
|
719
|
-
if (this.enableGridInsert)
|
|
720
|
-
return;
|
|
721
|
-
this.goToView(VIEW_MODE.FORM);
|
|
722
|
-
}
|
|
723
691
|
/* istanbul ignore next */
|
|
724
692
|
render() {
|
|
725
693
|
var _a;
|
|
726
694
|
if (this.dataUnit == undefined) {
|
|
727
695
|
return;
|
|
728
696
|
}
|
|
729
|
-
const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--
|
|
730
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.
|
|
697
|
+
const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
|
698
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === VIEW_MODE.FORM && taskbarContent, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
731
699
|
? undefined
|
|
732
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus
|
|
700
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, this._currentViewMode === VIEW_MODE.GRID && taskbarContent, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, 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.resolveResourceID() }))));
|
|
733
701
|
}
|
|
734
702
|
static get is() { return "snk-simple-crud"; }
|
|
735
703
|
static get encapsulation() { return "scoped"; }
|
|
@@ -935,24 +903,6 @@ export class SnkSimpleCrud {
|
|
|
935
903
|
"attribute": "resource-i-d",
|
|
936
904
|
"reflect": false
|
|
937
905
|
},
|
|
938
|
-
"enableGridInsert": {
|
|
939
|
-
"type": "boolean",
|
|
940
|
-
"mutable": false,
|
|
941
|
-
"complexType": {
|
|
942
|
-
"original": "boolean",
|
|
943
|
-
"resolved": "boolean",
|
|
944
|
-
"references": {}
|
|
945
|
-
},
|
|
946
|
-
"required": false,
|
|
947
|
-
"optional": true,
|
|
948
|
-
"docs": {
|
|
949
|
-
"tags": [],
|
|
950
|
-
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
951
|
-
},
|
|
952
|
-
"attribute": "enable-grid-insert",
|
|
953
|
-
"reflect": false,
|
|
954
|
-
"defaultValue": "false"
|
|
955
|
-
},
|
|
956
906
|
"taskbarManager": {
|
|
957
907
|
"type": "unknown",
|
|
958
908
|
"mutable": false,
|
|
@@ -1183,8 +1133,7 @@ export class SnkSimpleCrud {
|
|
|
1183
1133
|
"_fieldToGetFocus": {},
|
|
1184
1134
|
"_customContainerId": {},
|
|
1185
1135
|
"_formFields": {},
|
|
1186
|
-
"_fieldsProps": {}
|
|
1187
|
-
"_enableContinuousInsert": {}
|
|
1136
|
+
"_fieldsProps": {}
|
|
1188
1137
|
};
|
|
1189
1138
|
}
|
|
1190
1139
|
static get events() {
|
|
@@ -29,16 +29,12 @@ export default class TaskbarProcessor {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
|
32
|
-
const defaults = this.
|
|
32
|
+
const defaults = this._defaultButtons[taskbarId];
|
|
33
33
|
if (taskbarManager) {
|
|
34
34
|
return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
|
|
35
35
|
}
|
|
36
36
|
return defaults;
|
|
37
37
|
}
|
|
38
|
-
getButtonsFromKey(taskbarId) {
|
|
39
|
-
const btnsValue = this._defaultButtons[taskbarId];
|
|
40
|
-
return typeof btnsValue === 'function' ? btnsValue() : btnsValue;
|
|
41
|
-
}
|
|
42
38
|
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
|
43
39
|
const originalValue = disabled.includes(buttonName) ? false : true;
|
|
44
40
|
if (taskbarManager && taskbarManager.isEnabled) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NumberUtils, ObjectUtils
|
|
1
|
+
import { NumberUtils, ObjectUtils } from "@sankhyalabs/core";
|
|
2
2
|
export default class RmPrecisionCustomValueFormatter {
|
|
3
3
|
setGrid(grid) {
|
|
4
4
|
if (this._grid) {
|
|
@@ -8,7 +8,7 @@ export default class RmPrecisionCustomValueFormatter {
|
|
|
8
8
|
this.refreshSelectedRows();
|
|
9
9
|
}
|
|
10
10
|
setDataState(dataState) {
|
|
11
|
-
if (
|
|
11
|
+
if (ObjectUtils.objectToString(dataState) === ObjectUtils.objectToString(this._dataState)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
this._dataState = dataState;
|
|
@@ -16,7 +16,7 @@ export default class RmPrecisionCustomValueFormatter {
|
|
|
16
16
|
}
|
|
17
17
|
format(currentValue, column, recordId) {
|
|
18
18
|
var _a;
|
|
19
|
-
if (
|
|
19
|
+
if (!currentValue) {
|
|
20
20
|
return currentValue;
|
|
21
21
|
}
|
|
22
22
|
const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChangeOperation, DataType, DataUnit, DateUtils, StringUtils, } from '@sankhyalabs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { applyFilter, applySorting, buildPaginationInfo } from './dataUnitInMemoryUtils';
|
|
3
3
|
export default class InMemoryLoader {
|
|
4
4
|
constructor(metadata, records, config) {
|
|
5
5
|
this.metadata = metadata;
|
|
@@ -82,7 +82,9 @@ export default class InMemoryLoader {
|
|
|
82
82
|
return StringUtils.generateUUID();
|
|
83
83
|
}
|
|
84
84
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
|
85
|
-
|
|
85
|
+
let records = applyFilter(recordsIn, dataUnit, request.filters);
|
|
86
|
+
records = applySorting(records, dataUnit, request.sort);
|
|
87
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
|
86
88
|
}
|
|
87
89
|
metadaLoader() {
|
|
88
90
|
return Promise.resolve(this._metadata);
|
|
@@ -11,21 +11,6 @@ export function applyFilter(records, dataUnit, filters) {
|
|
|
11
11
|
}
|
|
12
12
|
return records.filter(filterFunction);
|
|
13
13
|
}
|
|
14
|
-
export function buildLoadDataResponse(recordsIn, dataUnit, request) {
|
|
15
|
-
let records = recordsIn ? [...recordsIn] : [];
|
|
16
|
-
records = applyFilter(records, dataUnit, request.filters);
|
|
17
|
-
records = applySorting(records, dataUnit, request.sort);
|
|
18
|
-
const { offset, limit } = request;
|
|
19
|
-
const paginationInfoBuilderParams = {
|
|
20
|
-
recordsLength: records.length,
|
|
21
|
-
offset,
|
|
22
|
-
recordsPerPage: limit,
|
|
23
|
-
};
|
|
24
|
-
return Promise.resolve({
|
|
25
|
-
records: getPagesByRecords(records, offset, limit),
|
|
26
|
-
paginationInfo: buildPaginationInfo(paginationInfoBuilderParams),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
14
|
export function applySorting(records, dataUnit, sorting) {
|
|
30
15
|
if (sorting == undefined || sorting.length == 0) {
|
|
31
16
|
return records;
|
|
@@ -36,27 +21,17 @@ export function applySorting(records, dataUnit, sorting) {
|
|
|
36
21
|
}
|
|
37
22
|
return records.sort(sortingFunction);
|
|
38
23
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export function getPagesByRecords(records, offset = 0, limit = 0) {
|
|
43
|
-
if (!records || !records.length || !hasValidLimitAndOffset(offset, limit))
|
|
44
|
-
return [];
|
|
45
|
-
if (limit === 0 && offset === 0)
|
|
46
|
-
return records;
|
|
47
|
-
return records.slice(offset, offset + limit);
|
|
48
|
-
}
|
|
49
|
-
export function buildPaginationInfo({ recordsLength = 0, offset = 0, recordsPerPage = 0 }) {
|
|
50
|
-
if (!recordsLength) {
|
|
51
|
-
return { currentPage: 0, firstRecord: 0, lastRecord: 0, total: 0, hasMore: false };
|
|
24
|
+
export function buildPaginationInfo(records, offset = 0, limit = 0) {
|
|
25
|
+
if (records === undefined) {
|
|
26
|
+
return undefined;
|
|
52
27
|
}
|
|
53
|
-
const
|
|
54
|
-
const lastRecord =
|
|
28
|
+
const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
|
|
29
|
+
const lastRecord = Math.min(offset + limit, total);
|
|
55
30
|
return {
|
|
56
|
-
currentPage:
|
|
57
|
-
firstRecord: offset
|
|
31
|
+
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
|
32
|
+
firstRecord: offset,
|
|
58
33
|
lastRecord: lastRecord,
|
|
59
|
-
total:
|
|
60
|
-
hasMore:
|
|
34
|
+
total: total,
|
|
35
|
+
hasMore: !!(total - lastRecord),
|
|
61
36
|
};
|
|
62
37
|
}
|
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
|
@@ -44,19 +44,12 @@ export class DatasetStrategy {
|
|
|
44
44
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
|
45
45
|
const loadingInProgress = pagerId != undefined;
|
|
46
46
|
const count = loadingInfo.count + records.length;
|
|
47
|
-
const isInsertingNewRecord = dataUnit.hasNewRecord();
|
|
48
47
|
const needReload = !loadingInProgress && localSorting.length > 0;
|
|
49
|
-
/**
|
|
50
|
-
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
|
51
|
-
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
|
52
|
-
*/
|
|
53
|
-
if (needReload && isInsertingNewRecord) {
|
|
54
|
-
dataUnit.setWaitingToReload(true);
|
|
55
|
-
}
|
|
56
48
|
return Promise.resolve({
|
|
57
49
|
records,
|
|
58
50
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
59
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
51
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
52
|
+
needReload })
|
|
60
53
|
});
|
|
61
54
|
}
|
|
62
55
|
catch (error) {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export const snkGridMessages = {
|
|
2
|
-
findColumn: "Busca de colunas"
|
|
3
|
-
cancelConfirmation: {
|
|
4
|
-
title: "Aviso",
|
|
5
|
-
message: "As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?</b>",
|
|
6
|
-
}
|
|
2
|
+
findColumn: "Busca de colunas"
|
|
7
3
|
};
|
|
8
4
|
export const snkGridConfigMessages = {
|
|
9
5
|
gridConfiguration: "Configuração da Grade",
|
|
@@ -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,
|
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } 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,16 +124,12 @@ class TaskbarProcessor {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
|
127
|
-
const defaults = this.
|
|
127
|
+
const defaults = this._defaultButtons[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
|
-
}
|
|
137
133
|
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
|
138
134
|
const originalValue = disabled.includes(buttonName) ? false : true;
|
|
139
135
|
if (taskbarManager && taskbarManager.isEnabled) {
|
|
@@ -221,7 +217,7 @@ class RmPrecisionCustomValueFormatter {
|
|
|
221
217
|
this.refreshSelectedRows();
|
|
222
218
|
}
|
|
223
219
|
setDataState(dataState) {
|
|
224
|
-
if (
|
|
220
|
+
if (ObjectUtils.objectToString(dataState) === ObjectUtils.objectToString(this._dataState)) {
|
|
225
221
|
return;
|
|
226
222
|
}
|
|
227
223
|
this._dataState = dataState;
|
|
@@ -229,7 +225,7 @@ class RmPrecisionCustomValueFormatter {
|
|
|
229
225
|
}
|
|
230
226
|
format(currentValue, column, recordId) {
|
|
231
227
|
var _a;
|
|
232
|
-
if (
|
|
228
|
+
if (!currentValue) {
|
|
233
229
|
return currentValue;
|
|
234
230
|
}
|
|
235
231
|
const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
|
|
@@ -299,35 +295,4 @@ class CommonsExporter {
|
|
|
299
295
|
}
|
|
300
296
|
}
|
|
301
297
|
|
|
302
|
-
|
|
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 };
|
|
298
|
+
export { CommonsExporter as C, RmPrecisionCustomValueFormatter as R, SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, CrudUtils as a, buildFieldSearch as b, openFieldSearch as o };
|
|
@@ -245,11 +245,7 @@ const snkConfiguratorMessages = {
|
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
const snkGridMessages = {
|
|
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
|
-
}
|
|
248
|
+
findColumn: "Busca de colunas"
|
|
253
249
|
};
|
|
254
250
|
const snkGridConfigMessages = {
|
|
255
251
|
gridConfiguration: "Configuração da Grade",
|