@sankhyalabs/sankhyablocks 1.3.31-beta.3 → 1.3.31-beta.4

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.
Files changed (39) hide show
  1. package/dist/cjs/{index-e42cb45d.js → index-ebe8245e.js} +5 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  4. package/dist/cjs/snk-application.cjs.entry.js +15 -11
  5. package/dist/cjs/snk-data-unit.cjs.entry.js +41 -11
  6. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  8. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
  10. package/dist/cjs/{taskbar-elements-bfa647c7.js → taskbar-elements-589a3744.js} +1 -1
  11. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  12. package/dist/collection/components/snk-data-unit/snk-data-unit.js +114 -10
  13. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +14 -10
  14. package/dist/components/snk-application2.js +14 -10
  15. package/dist/components/snk-data-unit.js +43 -10
  16. package/dist/esm/{index-02c04e0f.js → index-7565ae23.js} +5 -0
  17. package/dist/esm/loader.js +2 -2
  18. package/dist/esm/sankhyablocks.js +2 -2
  19. package/dist/esm/snk-application.entry.js +15 -11
  20. package/dist/esm/snk-data-unit.entry.js +41 -11
  21. package/dist/esm/snk-form.entry.js +1 -1
  22. package/dist/esm/snk-grid.entry.js +2 -2
  23. package/dist/esm/snk-pesquisa.entry.js +1 -1
  24. package/dist/esm/snk-taskbar.entry.js +2 -2
  25. package/dist/esm/{taskbar-elements-fe7cbf0e.js → taskbar-elements-b6822601.js} +1 -1
  26. package/dist/esm/teste-pesquisa.entry.js +1 -1
  27. package/dist/sankhyablocks/{p-09e48ff8.entry.js → p-306224bf.entry.js} +1 -1
  28. package/dist/sankhyablocks/{p-64e2471c.js → p-4ee1e12b.js} +1 -1
  29. package/dist/sankhyablocks/{p-e38386b1.entry.js → p-6d82d7fd.entry.js} +1 -1
  30. package/dist/sankhyablocks/p-88278b85.entry.js +1 -0
  31. package/dist/sankhyablocks/{p-db215c74.js → p-90b832f7.js} +1 -1
  32. package/dist/sankhyablocks/{p-b80352ac.entry.js → p-a4b2fa10.entry.js} +2 -2
  33. package/dist/sankhyablocks/{p-376004ef.entry.js → p-bb31ea2a.entry.js} +1 -1
  34. package/dist/sankhyablocks/{p-37b06977.entry.js → p-bb8d8fe7.entry.js} +1 -1
  35. package/dist/sankhyablocks/{p-c156b1da.entry.js → p-e7ade160.entry.js} +1 -1
  36. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  37. package/dist/types/components.d.ts +7 -0
  38. package/package.json +1 -1
  39. package/dist/sankhyablocks/p-cc9c348a.entry.js +0 -1
@@ -1166,6 +1166,11 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1166
1166
  const parsePropertyValue = (propValue, propType) => {
1167
1167
  // ensure this value is of the correct prop type
1168
1168
  if (propValue != null && !isComplexType(propValue)) {
1169
+ if (propType & 4 /* Boolean */) {
1170
+ // per the HTML spec, any string value means it is a boolean true value
1171
+ // but we'll cheat here and say that the string "false" is the boolean false
1172
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
1173
+ }
1169
1174
  if (propType & 2 /* Number */) {
1170
1175
  // force it to be a number
1171
1176
  return parseFloat(propValue);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
17
+ return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-e42cb45d.js');
3
+ const index = require('./index-ebe8245e.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
18
+ return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
19
19
  });
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
 
@@ -6815,9 +6815,19 @@ class DataUnitFetcher {
6815
6815
  })
6816
6816
  .then((resp) => {
6817
6817
  const { limit, offset, total, hasMore, records } = resp.data;
6818
- const firstRecord = offset + 1;
6819
- const lastRecord = offset + Math.min(records.length, limit);
6820
- const currentPage = offset / limit;
6818
+ let paginationInfo;
6819
+ if (limit) {
6820
+ const firstRecord = offset + 1;
6821
+ const lastRecord = offset + Math.min(records.length, limit);
6822
+ const currentPage = offset / limit;
6823
+ paginationInfo = {
6824
+ firstRecord,
6825
+ lastRecord,
6826
+ total,
6827
+ currentPage,
6828
+ hasMore
6829
+ };
6830
+ }
6821
6831
  const processedRecords = [];
6822
6832
  records.forEach((responseRecord) => {
6823
6833
  const duRecord = { __record__id__: responseRecord.id };
@@ -6827,13 +6837,7 @@ class DataUnitFetcher {
6827
6837
  processedRecords.push(duRecord);
6828
6838
  });
6829
6839
  resolve({
6830
- paginationInfo: {
6831
- firstRecord,
6832
- lastRecord,
6833
- total,
6834
- currentPage,
6835
- hasMore
6836
- },
6840
+ paginationInfo,
6837
6841
  records: processedRecords
6838
6842
  });
6839
6843
  })
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
 
@@ -11,6 +11,7 @@ const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;h
11
11
  const SnkDataUnit = class {
12
12
  constructor(hostRef) {
13
13
  index.registerInstance(this, hostRef);
14
+ this.insertionMode = index.createEvent(this, "insertionMode", 7);
14
15
  this.dataStateChange = index.createEvent(this, "dataStateChange", 7);
15
16
  this.dataUnitReady = index.createEvent(this, "dataUnitReady", 7);
16
17
  this._onDataUnitResolve = [];
@@ -19,6 +20,9 @@ const SnkDataUnit = class {
19
20
  if (msg) {
20
21
  utils.ApplicationUtils.info(msg);
21
22
  }
23
+ if (action.type === core.Action.RECORDS_ADDED || action.type === core.Action.RECORDS_COPIED) {
24
+ this.insertionMode.emit();
25
+ }
22
26
  const duState = {
23
27
  insertionMode: false,
24
28
  hasNext: this.dataUnit.hasNext(),
@@ -48,16 +52,39 @@ const SnkDataUnit = class {
48
52
  }
49
53
  async interceptAction(action) {
50
54
  return new Promise(resolve => {
51
- if (action.type === core.Action.EDITION_CANCELED) {
52
- utils.ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
53
- .then((result) => resolve(result ? action : undefined));
54
- }
55
- else if (action.type === core.Action.REMOVING_RECORDS) {
56
- utils.ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
57
- .then((result) => resolve(result ? action : undefined));
58
- }
59
- else {
60
- resolve(action);
55
+ switch (action.type) {
56
+ case core.Action.SAVING_DATA:
57
+ if (this.beforeSave) {
58
+ const continueAction = this.beforeSave(this.dataUnit);
59
+ if (continueAction instanceof Promise) {
60
+ continueAction.then(result => resolve(result ? action : undefined));
61
+ }
62
+ else {
63
+ resolve(continueAction ? action : undefined);
64
+ }
65
+ }
66
+ else {
67
+ resolve(action);
68
+ }
69
+ break;
70
+ case core.Action.DATA_SAVED:
71
+ if (this.afterSave) {
72
+ this.afterSave(this.dataUnit);
73
+ }
74
+ else {
75
+ resolve(action);
76
+ }
77
+ break;
78
+ case core.Action.EDITION_CANCELED:
79
+ utils.ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
80
+ .then((result) => resolve(result ? action : undefined));
81
+ break;
82
+ case core.Action.REMOVING_RECORDS:
83
+ utils.ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
84
+ .then((result) => resolve(result ? action : undefined));
85
+ break;
86
+ default:
87
+ resolve(action);
61
88
  }
62
89
  });
63
90
  }
@@ -111,6 +138,9 @@ const SnkDataUnit = class {
111
138
  while (resolver = this._onDataUnitResolve.pop()) {
112
139
  resolver(this.dataUnit);
113
140
  }
141
+ if (this.autoLoad) {
142
+ this.dataUnit.loadData();
143
+ }
114
144
  }
115
145
  }
116
146
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
 
8
8
  const snkFormCss = ".sc-snk-form-h{display:block}";
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const taskbarElements = require('./taskbar-elements-bfa647c7.js');
7
+ const taskbarElements = require('./taskbar-elements-589a3744.js');
8
8
 
9
9
  const snkGridCss = ".sc-snk-grid-h{display:flex;height:100%;width:100%}";
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
 
8
8
  const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--text--primary, #626e82);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-medium, 12px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px) display: block;max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input-close.sc-snk-pesquisa{cursor:pointer}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}";
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const taskbarElements = require('./taskbar-elements-bfa647c7.js');
7
+ const taskbarElements = require('./taskbar-elements-589a3744.js');
8
8
 
9
9
  const SnkPopupButton = ({ className, title, source, opened, setOpened, actionClick }) => {
10
10
  return (index.h("div", { class: "ez-flex " + className },
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-e42cb45d.js');
3
+ const index = require('./index-ebe8245e.js');
4
4
 
5
5
  exports.TaskbarElement = void 0;
6
6
  (function (TaskbarElement) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-ebe8245e.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
 
8
8
  const testePesquisaCss = ":host{display:block}";
@@ -9,6 +9,9 @@ export class SnkDataUnit {
9
9
  if (msg) {
10
10
  ApplicationUtils.info(msg);
11
11
  }
12
+ if (action.type === Action.RECORDS_ADDED || action.type === Action.RECORDS_COPIED) {
13
+ this.insertionMode.emit();
14
+ }
12
15
  const duState = {
13
16
  insertionMode: false,
14
17
  hasNext: this.dataUnit.hasNext(),
@@ -38,16 +41,39 @@ export class SnkDataUnit {
38
41
  }
39
42
  async interceptAction(action) {
40
43
  return new Promise(resolve => {
41
- if (action.type === Action.EDITION_CANCELED) {
42
- ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
43
- .then((result) => resolve(result ? action : undefined));
44
- }
45
- else if (action.type === Action.REMOVING_RECORDS) {
46
- ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
47
- .then((result) => resolve(result ? action : undefined));
48
- }
49
- else {
50
- resolve(action);
44
+ switch (action.type) {
45
+ case Action.SAVING_DATA:
46
+ if (this.beforeSave) {
47
+ const continueAction = this.beforeSave(this.dataUnit);
48
+ if (continueAction instanceof Promise) {
49
+ continueAction.then(result => resolve(result ? action : undefined));
50
+ }
51
+ else {
52
+ resolve(continueAction ? action : undefined);
53
+ }
54
+ }
55
+ else {
56
+ resolve(action);
57
+ }
58
+ break;
59
+ case Action.DATA_SAVED:
60
+ if (this.afterSave) {
61
+ this.afterSave(this.dataUnit);
62
+ }
63
+ else {
64
+ resolve(action);
65
+ }
66
+ break;
67
+ case Action.EDITION_CANCELED:
68
+ ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
69
+ .then((result) => resolve(result ? action : undefined));
70
+ break;
71
+ case Action.REMOVING_RECORDS:
72
+ ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
73
+ .then((result) => resolve(result ? action : undefined));
74
+ break;
75
+ default:
76
+ resolve(action);
51
77
  }
52
78
  });
53
79
  }
@@ -101,6 +127,9 @@ export class SnkDataUnit {
101
127
  while (resolver = this._onDataUnitResolve.pop()) {
102
128
  resolver(this.dataUnit);
103
129
  }
130
+ if (this.autoLoad) {
131
+ this.dataUnit.loadData();
132
+ }
104
133
  }
105
134
  }
106
135
  }
@@ -241,9 +270,84 @@ export class SnkDataUnit {
241
270
  "tags": [],
242
271
  "text": ""
243
272
  }
273
+ },
274
+ "beforeSave": {
275
+ "type": "unknown",
276
+ "mutable": false,
277
+ "complexType": {
278
+ "original": "(dataUnit: DataUnit) => boolean | Promise<boolean>",
279
+ "resolved": "(dataUnit: DataUnit) => boolean | Promise<boolean>",
280
+ "references": {
281
+ "DataUnit": {
282
+ "location": "import",
283
+ "path": "@sankhyalabs/core"
284
+ },
285
+ "Promise": {
286
+ "location": "global"
287
+ }
288
+ }
289
+ },
290
+ "required": false,
291
+ "optional": false,
292
+ "docs": {
293
+ "tags": [],
294
+ "text": ""
295
+ }
296
+ },
297
+ "afterSave": {
298
+ "type": "unknown",
299
+ "mutable": false,
300
+ "complexType": {
301
+ "original": "(dataUnit: DataUnit) => void",
302
+ "resolved": "(dataUnit: DataUnit) => void",
303
+ "references": {
304
+ "DataUnit": {
305
+ "location": "import",
306
+ "path": "@sankhyalabs/core"
307
+ }
308
+ }
309
+ },
310
+ "required": false,
311
+ "optional": false,
312
+ "docs": {
313
+ "tags": [],
314
+ "text": ""
315
+ }
316
+ },
317
+ "autoLoad": {
318
+ "type": "boolean",
319
+ "mutable": false,
320
+ "complexType": {
321
+ "original": "boolean",
322
+ "resolved": "boolean",
323
+ "references": {}
324
+ },
325
+ "required": false,
326
+ "optional": false,
327
+ "docs": {
328
+ "tags": [],
329
+ "text": ""
330
+ },
331
+ "attribute": "auto-load",
332
+ "reflect": false
244
333
  }
245
334
  }; }
246
335
  static get events() { return [{
336
+ "method": "insertionMode",
337
+ "name": "insertionMode",
338
+ "bubbles": true,
339
+ "cancelable": true,
340
+ "composed": true,
341
+ "docs": {
342
+ "tags": [],
343
+ "text": ""
344
+ },
345
+ "complexType": {
346
+ "original": "void",
347
+ "resolved": "void",
348
+ "references": {}
349
+ }
350
+ }, {
247
351
  "method": "dataStateChange",
248
352
  "name": "dataStateChange",
249
353
  "bubbles": true,
@@ -128,9 +128,19 @@ export default class DataUnitFetcher {
128
128
  })
129
129
  .then((resp) => {
130
130
  const { limit, offset, total, hasMore, records } = resp.data;
131
- const firstRecord = offset + 1;
132
- const lastRecord = offset + Math.min(records.length, limit);
133
- const currentPage = offset / limit;
131
+ let paginationInfo;
132
+ if (limit) {
133
+ const firstRecord = offset + 1;
134
+ const lastRecord = offset + Math.min(records.length, limit);
135
+ const currentPage = offset / limit;
136
+ paginationInfo = {
137
+ firstRecord,
138
+ lastRecord,
139
+ total,
140
+ currentPage,
141
+ hasMore
142
+ };
143
+ }
134
144
  const processedRecords = [];
135
145
  records.forEach((responseRecord) => {
136
146
  const duRecord = { __record__id__: responseRecord.id };
@@ -140,13 +150,7 @@ export default class DataUnitFetcher {
140
150
  processedRecords.push(duRecord);
141
151
  });
142
152
  resolve({
143
- paginationInfo: {
144
- firstRecord,
145
- lastRecord,
146
- total,
147
- currentPage,
148
- hasMore
149
- },
153
+ paginationInfo,
150
154
  records: processedRecords
151
155
  });
152
156
  })
@@ -6812,9 +6812,19 @@ class DataUnitFetcher {
6812
6812
  })
6813
6813
  .then((resp) => {
6814
6814
  const { limit, offset, total, hasMore, records } = resp.data;
6815
- const firstRecord = offset + 1;
6816
- const lastRecord = offset + Math.min(records.length, limit);
6817
- const currentPage = offset / limit;
6815
+ let paginationInfo;
6816
+ if (limit) {
6817
+ const firstRecord = offset + 1;
6818
+ const lastRecord = offset + Math.min(records.length, limit);
6819
+ const currentPage = offset / limit;
6820
+ paginationInfo = {
6821
+ firstRecord,
6822
+ lastRecord,
6823
+ total,
6824
+ currentPage,
6825
+ hasMore
6826
+ };
6827
+ }
6818
6828
  const processedRecords = [];
6819
6829
  records.forEach((responseRecord) => {
6820
6830
  const duRecord = { __record__id__: responseRecord.id };
@@ -6824,13 +6834,7 @@ class DataUnitFetcher {
6824
6834
  processedRecords.push(duRecord);
6825
6835
  });
6826
6836
  resolve({
6827
- paginationInfo: {
6828
- firstRecord,
6829
- lastRecord,
6830
- total,
6831
- currentPage,
6832
- hasMore
6833
- },
6837
+ paginationInfo,
6834
6838
  records: processedRecords
6835
6839
  });
6836
6840
  })
@@ -8,6 +8,7 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8
8
  constructor() {
9
9
  super();
10
10
  this.__registerHost();
11
+ this.insertionMode = createEvent(this, "insertionMode", 7);
11
12
  this.dataStateChange = createEvent(this, "dataStateChange", 7);
12
13
  this.dataUnitReady = createEvent(this, "dataUnitReady", 7);
13
14
  this._onDataUnitResolve = [];
@@ -16,6 +17,9 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
16
17
  if (msg) {
17
18
  ApplicationUtils.info(msg);
18
19
  }
20
+ if (action.type === Action.RECORDS_ADDED || action.type === Action.RECORDS_COPIED) {
21
+ this.insertionMode.emit();
22
+ }
19
23
  const duState = {
20
24
  insertionMode: false,
21
25
  hasNext: this.dataUnit.hasNext(),
@@ -45,16 +49,39 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
45
49
  }
46
50
  async interceptAction(action) {
47
51
  return new Promise(resolve => {
48
- if (action.type === Action.EDITION_CANCELED) {
49
- ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
50
- .then((result) => resolve(result ? action : undefined));
51
- }
52
- else if (action.type === Action.REMOVING_RECORDS) {
53
- ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
54
- .then((result) => resolve(result ? action : undefined));
55
- }
56
- else {
57
- resolve(action);
52
+ switch (action.type) {
53
+ case Action.SAVING_DATA:
54
+ if (this.beforeSave) {
55
+ const continueAction = this.beforeSave(this.dataUnit);
56
+ if (continueAction instanceof Promise) {
57
+ continueAction.then(result => resolve(result ? action : undefined));
58
+ }
59
+ else {
60
+ resolve(continueAction ? action : undefined);
61
+ }
62
+ }
63
+ else {
64
+ resolve(action);
65
+ }
66
+ break;
67
+ case Action.DATA_SAVED:
68
+ if (this.afterSave) {
69
+ this.afterSave(this.dataUnit);
70
+ }
71
+ else {
72
+ resolve(action);
73
+ }
74
+ break;
75
+ case Action.EDITION_CANCELED:
76
+ ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
77
+ .then((result) => resolve(result ? action : undefined));
78
+ break;
79
+ case Action.REMOVING_RECORDS:
80
+ ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
81
+ .then((result) => resolve(result ? action : undefined));
82
+ break;
83
+ default:
84
+ resolve(action);
58
85
  }
59
86
  });
60
87
  }
@@ -108,6 +135,9 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
108
135
  while (resolver = this._onDataUnitResolve.pop()) {
109
136
  resolver(this.dataUnit);
110
137
  }
138
+ if (this.autoLoad) {
139
+ this.dataUnit.loadData();
140
+ }
111
141
  }
112
142
  }
113
143
  }
@@ -143,6 +173,9 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
143
173
  "pageSize": [2, "page-size"],
144
174
  "dataUnit": [1040],
145
175
  "messageBuilder": [16],
176
+ "beforeSave": [16],
177
+ "afterSave": [16],
178
+ "autoLoad": [4, "auto-load"],
146
179
  "getDataUnit": [64]
147
180
  }]);
148
181
  function defineCustomElement$1() {
@@ -1144,6 +1144,11 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1144
1144
  const parsePropertyValue = (propValue, propType) => {
1145
1145
  // ensure this value is of the correct prop type
1146
1146
  if (propValue != null && !isComplexType(propValue)) {
1147
+ if (propType & 4 /* Boolean */) {
1148
+ // per the HTML spec, any string value means it is a boolean true value
1149
+ // but we'll cheat here and say that the string "false" is the boolean false
1150
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
1151
+ }
1147
1152
  if (propType & 2 /* Number */) {
1148
1153
  // force it to be a number
1149
1154
  return parseFloat(propValue);
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-02c04e0f.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-7565ae23.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
13
+ return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-02c04e0f.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-7565ae23.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
16
+ return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
17
17
  });