@sankhyalabs/sankhyablocks 1.4.0-beta.3 → 1.4.0-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 (47) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  3. package/dist/cjs/snk-application.cjs.entry.js +3 -3
  4. package/dist/cjs/snk-crud.cjs.entry.js +6 -0
  5. package/dist/cjs/snk-filter-bar_5.cjs.entry.js +7 -26
  6. package/dist/cjs/snk-filter-detail.cjs.entry.js +30 -19
  7. package/dist/cjs/snk-filter-personalized.cjs.entry.js +0 -9
  8. package/dist/cjs/snk-filter-search.cjs.entry.js +0 -9
  9. package/dist/collection/components/snk-crud/snk-crud.js +29 -0
  10. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +0 -39
  11. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +0 -39
  12. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +30 -36
  13. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -14
  14. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +4 -12
  15. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
  16. package/dist/components/snk-application2.js +3 -3
  17. package/dist/components/snk-crud.js +8 -1
  18. package/dist/components/snk-filter-detail2.js +30 -20
  19. package/dist/components/snk-filter-item2.js +3 -14
  20. package/dist/components/snk-filter-list2.js +4 -12
  21. package/dist/components/snk-filter-personalized.js +1 -12
  22. package/dist/components/snk-filter-search.js +1 -12
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/sankhyablocks.js +1 -1
  25. package/dist/esm/snk-application.entry.js +3 -3
  26. package/dist/esm/snk-crud.entry.js +6 -0
  27. package/dist/esm/snk-filter-bar_5.entry.js +7 -26
  28. package/dist/esm/snk-filter-detail.entry.js +30 -19
  29. package/dist/esm/snk-filter-personalized.entry.js +0 -9
  30. package/dist/esm/snk-filter-search.entry.js +0 -9
  31. package/dist/sankhyablocks/p-01823784.entry.js +1 -0
  32. package/dist/sankhyablocks/{p-dc482a42.entry.js → p-6f8303f3.entry.js} +1 -1
  33. package/dist/sankhyablocks/p-746fc78b.entry.js +1 -0
  34. package/dist/sankhyablocks/p-77216252.entry.js +1 -0
  35. package/dist/sankhyablocks/{p-9be74b46.entry.js → p-8bbc0cbb.entry.js} +1 -1
  36. package/dist/sankhyablocks/p-eea6444c.entry.js +1 -0
  37. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  38. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +0 -2
  39. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -2
  40. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -1
  41. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +1 -1
  42. package/dist/types/components.d.ts +4 -10
  43. package/package.json +1 -1
  44. package/dist/sankhyablocks/p-322c0df2.entry.js +0 -1
  45. package/dist/sankhyablocks/p-473cedf9.entry.js +0 -1
  46. package/dist/sankhyablocks/p-a8b59c61.entry.js +0 -1
  47. package/dist/sankhyablocks/p-c78cb79a.entry.js +0 -1
@@ -19,6 +19,12 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
19
19
  this.__registerHost();
20
20
  this.actionClick = createEvent(this, "actionClick", 7);
21
21
  }
22
+ /**
23
+ * Usado para alternar a visão entre GRID e FORM externamente.
24
+ */
25
+ async goToView(mode) {
26
+ this.executeAction(mode);
27
+ }
22
28
  async gridToForm(keepFormMode = false) {
23
29
  this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE;
24
30
  this._viewStack.show(FORM_MODE);
@@ -77,7 +83,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
77
83
  "recordsValidator": [16],
78
84
  "statusResolver": [16],
79
85
  "_dataUnit": [32],
80
- "_dataState": [32]
86
+ "_dataState": [32],
87
+ "goToView": [64]
81
88
  }]);
82
89
  function defineCustomElement$1() {
83
90
  if (typeof customElements === "undefined") {
@@ -42,43 +42,53 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
42
42
  }
43
43
  apply() {
44
44
  var _a;
45
+ let value = this._editor["value"];
45
46
  let isValid = true;
46
- const value = this._editor["value"];
47
- /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
48
- if (value != undefined && this.config.type === FilterItemType.PERSONALIZED) {
47
+ if (this.config.type === FilterItemType.PERSONALIZED) {
49
48
  const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
50
- if (params.length > 1) {
51
- if (params.length > value.length) {
52
- isValid = false;
53
- }
54
- else {
55
- value.forEach(item => {
56
- if (item == undefined) {
57
- isValid = false;
58
- }
59
- });
60
- }
49
+ const paramsCount = params.length;
50
+ if (paramsCount === 0) {
51
+ //Valor do filtro personalizado sem parametros deve ser um array vazio
52
+ value = [];
61
53
  }
62
- if (!isValid) {
63
- this.keepOpened = true;
64
- ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.").then(() => setTimeout(() => this.keepOpened = false, 1));
54
+ else {
55
+ isValid = this.validateAllFilled(paramsCount, value);
65
56
  }
66
57
  }
67
- /* WARNING: Temporário.*/
68
58
  if (isValid) {
69
59
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
70
60
  }
71
61
  }
62
+ /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
63
+ validateAllFilled(paramsCount, value) {
64
+ let isValid = true;
65
+ if (value != undefined && paramsCount > 1) {
66
+ if (paramsCount > value.length) {
67
+ isValid = false;
68
+ }
69
+ else {
70
+ value.forEach(item => {
71
+ if (item == undefined) {
72
+ isValid = false;
73
+ }
74
+ });
75
+ }
76
+ }
77
+ if (!isValid) {
78
+ ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.");
79
+ }
80
+ return isValid;
81
+ }
82
+ /* WARNING: Temporário.*/
72
83
  clear() {
73
84
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
74
85
  }
75
86
  render() {
76
87
  const ContentEditor = this.getContentEditor();
77
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
88
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
78
89
  }
79
90
  }, [0, "snk-filter-detail", {
80
91
  "config": [1040],
81
- "keepOpened": [1028, "keep-opened"],
82
92
  "getMessage": [16]
83
93
  }]);
84
94
  function defineCustomElement() {
@@ -8,21 +8,10 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8
8
  super();
9
9
  this.__registerHost();
10
10
  this.filterChange = createEvent(this, "filterChange", 7);
11
- this.innerClickCheck = (floatingContainer, node) => {
12
- if (this._popover.keepOpened) {
11
+ this.innerClickCheck = (_floatingContainer, node) => {
12
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
13
13
  return true;
14
14
  }
15
- if (node && floatingContainer) {
16
- if (!node.offsetParent) {
17
- return true;
18
- }
19
- let current = node;
20
- do {
21
- if (current === floatingContainer) {
22
- return true;
23
- }
24
- } while ((current = current.offsetParent) != null);
25
- }
26
15
  this.detailIsVisible = false;
27
16
  this.executeCloseCallback();
28
17
  return false;
@@ -40,7 +29,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
40
29
  });
41
30
  }
42
31
  showDetail() {
43
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
32
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset(), useOverlay: true });
44
33
  this.detailIsVisible = true;
45
34
  }
46
35
  getScrollOffset() {
@@ -8,24 +8,16 @@ const SnkFilterList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8
8
  super();
9
9
  this.__registerHost();
10
10
  this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
11
- this.innerClickCheck = (floatingContainer, node) => {
12
- if (node && floatingContainer) {
13
- if (!node.offsetParent) {
14
- return true;
15
- }
16
- let current = node;
17
- do {
18
- if (current === floatingContainer || current === this._element) {
19
- return true;
20
- }
21
- } while ((current = current.offsetParent) != null);
11
+ this.innerClickCheck = (_floatingContainer, node) => {
12
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
13
+ return true;
22
14
  }
23
15
  this._detailIsVisible = false;
24
16
  return false;
25
17
  };
26
18
  }
27
19
  showList() {
28
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck });
20
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, useOverlay: true });
29
21
  this._detailIsVisible = true;
30
22
  this._showAll = false;
31
23
  this._filterArgument = "";
@@ -32,21 +32,12 @@ const SnkFilterPersonalized$1 = /*@__PURE__*/ proxyCustomElement(class extends H
32
32
  }
33
33
  doSearch(mode, argument, param) {
34
34
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
35
- if (this.fix) {
36
- this.fix();
37
- }
38
35
  return new Promise((resolve, reject) => {
39
36
  application.executePreparedSearch(mode, argument, param.searchContext)
40
37
  .then(result => {
41
38
  resolve(result);
42
- if (this.unfix) {
43
- this.unfix();
44
- }
45
39
  }).catch(reason => {
46
40
  reject(reason);
47
- if (this.unfix) {
48
- this.unfix();
49
- }
50
41
  });
51
42
  });
52
43
  }
@@ -84,9 +75,7 @@ const SnkFilterPersonalized$1 = /*@__PURE__*/ proxyCustomElement(class extends H
84
75
  }
85
76
  }, [0, "snk-filter-personalized", {
86
77
  "config": [16],
87
- "value": [1040],
88
- "fix": [16],
89
- "unfix": [16]
78
+ "value": [1040]
90
79
  }]);
91
80
  function defineCustomElement$1() {
92
81
  if (typeof customElements === "undefined") {
@@ -12,21 +12,12 @@ const SnkFilterSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
12
12
  }
13
13
  doSearch(mode, argument) {
14
14
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
15
- if (this.fix) {
16
- this.fix();
17
- }
18
15
  return new Promise((resolve, reject) => {
19
16
  application.executePreparedSearch(mode, argument, this.config.props.searchContext)
20
17
  .then(result => {
21
18
  resolve(result);
22
- if (this.unfix) {
23
- this.unfix();
24
- }
25
19
  }).catch(reason => {
26
20
  reject(reason);
27
- if (this.unfix) {
28
- this.unfix();
29
- }
30
21
  });
31
22
  });
32
23
  }
@@ -38,9 +29,7 @@ const SnkFilterSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
38
29
  }
39
30
  }, [0, "snk-filter-search", {
40
31
  "config": [16],
41
- "value": [16],
42
- "fix": [16],
43
- "unfix": [16]
32
+ "value": [16]
44
33
  }, [[0, "ezChange", "ezChangeListener"]]]);
45
34
  function defineCustomElement$1() {
46
35
  if (typeof customElements === "undefined") {
@@ -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([["snk-crud",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number",[[0,"snk-filter-number",{"config":[16],"value":[2]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period",[[0,"snk-filter-period",{"config":[16],"value":[8]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16]}]]],["snk-filter-search",[[0,"snk-filter-search",{"config":[16],"value":[16],"fix":[16],"unfix":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]],["snk-filter-detail",[[0,"snk-filter-detail",{"config":[1040],"keepOpened":[1028,"keep-opened"],"getMessage":[16]}]]],["snk-filter-bar_5",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32]}],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[6,"snk-taskbar",{"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]],["snk-form_2",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}],[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}]]]], options);
13
+ return bootstrapLazy([["snk-crud",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number",[[0,"snk-filter-number",{"config":[16],"value":[2]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period",[[0,"snk-filter-period",{"config":[16],"value":[8]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized",[[0,"snk-filter-personalized",{"config":[16],"value":[1040]}]]],["snk-filter-search",[[0,"snk-filter-search",{"config":[16],"value":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]],["snk-filter-detail",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16]}]]],["snk-filter-bar_5",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32]}],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[6,"snk-taskbar",{"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]],["snk-form_2",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}],[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["snk-crud",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number",[[0,"snk-filter-number",{"config":[16],"value":[2]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period",[[0,"snk-filter-period",{"config":[16],"value":[8]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16]}]]],["snk-filter-search",[[0,"snk-filter-search",{"config":[16],"value":[16],"fix":[16],"unfix":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]],["snk-filter-detail",[[0,"snk-filter-detail",{"config":[1040],"keepOpened":[1028,"keep-opened"],"getMessage":[16]}]]],["snk-filter-bar_5",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32]}],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[6,"snk-taskbar",{"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]],["snk-form_2",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}],[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}]]]], options);
16
+ return bootstrapLazy([["snk-crud",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number",[[0,"snk-filter-number",{"config":[16],"value":[2]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period",[[0,"snk-filter-period",{"config":[16],"value":[8]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized",[[0,"snk-filter-personalized",{"config":[16],"value":[1040]}]]],["snk-filter-search",[[0,"snk-filter-search",{"config":[16],"value":[16]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]],["snk-filter-detail",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16]}]]],["snk-filter-bar_5",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32]}],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[6,"snk-taskbar",{"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]],["snk-form_2",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}],[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}]]]], options);
17
17
  });
@@ -6534,14 +6534,14 @@ class DataFetcher {
6534
6534
  return UrlUtils.getUrlBase();
6535
6535
  }
6536
6536
  getContext(module) {
6537
+ var _a;
6537
6538
  const urlParams = UrlUtils.getQueryParams(location.search);
6538
6539
  return {
6539
6540
  baseUrl: `${this.resolveURL()}/${module}/service.sbr`,
6540
6541
  appName: "SankhyaBlocks",
6541
- mgeSession: `${window['skw_session'] || urlParams.mgeSession}`,
6542
+ mgeSession: `${window['skw_session'] || urlParams.get("mgeSession")}`,
6542
6543
  globalID: "85C0093DFA240EAB699B4E47A10215BD",
6543
- //FIXME: Precisamos ajustar para buscar o resourceId pela aplicação
6544
- resourceID: "br.com.sankhya.mov.bancaria"
6544
+ resourceID: (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID))
6545
6545
  };
6546
6546
  }
6547
6547
  async callServiceBroker(serviceName, payload) {
@@ -10,6 +10,12 @@ const SnkCrud = class {
10
10
  registerInstance(this, hostRef);
11
11
  this.actionClick = createEvent(this, "actionClick", 7);
12
12
  }
13
+ /**
14
+ * Usado para alternar a visão entre GRID e FORM externamente.
15
+ */
16
+ async goToView(mode) {
17
+ this.executeAction(mode);
18
+ }
13
19
  async gridToForm(keepFormMode = false) {
14
20
  this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE;
15
21
  this._viewStack.show(FORM_MODE);
@@ -465,21 +465,10 @@ const SnkFilterItem = class {
465
465
  constructor(hostRef) {
466
466
  registerInstance(this, hostRef);
467
467
  this.filterChange = createEvent(this, "filterChange", 7);
468
- this.innerClickCheck = (floatingContainer, node) => {
469
- if (this._popover.keepOpened) {
468
+ this.innerClickCheck = (_floatingContainer, node) => {
469
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
470
470
  return true;
471
471
  }
472
- if (node && floatingContainer) {
473
- if (!node.offsetParent) {
474
- return true;
475
- }
476
- let current = node;
477
- do {
478
- if (current === floatingContainer) {
479
- return true;
480
- }
481
- } while ((current = current.offsetParent) != null);
482
- }
483
472
  this.detailIsVisible = false;
484
473
  this.executeCloseCallback();
485
474
  return false;
@@ -497,7 +486,7 @@ const SnkFilterItem = class {
497
486
  });
498
487
  }
499
488
  showDetail() {
500
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
489
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset(), useOverlay: true });
501
490
  this.detailIsVisible = true;
502
491
  }
503
492
  getScrollOffset() {
@@ -635,24 +624,16 @@ const SnkFilterList = class {
635
624
  constructor(hostRef) {
636
625
  registerInstance(this, hostRef);
637
626
  this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
638
- this.innerClickCheck = (floatingContainer, node) => {
639
- if (node && floatingContainer) {
640
- if (!node.offsetParent) {
641
- return true;
642
- }
643
- let current = node;
644
- do {
645
- if (current === floatingContainer || current === this._element) {
646
- return true;
647
- }
648
- } while ((current = current.offsetParent) != null);
627
+ this.innerClickCheck = (_floatingContainer, node) => {
628
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
629
+ return true;
649
630
  }
650
631
  this._detailIsVisible = false;
651
632
  return false;
652
633
  };
653
634
  }
654
635
  showList() {
655
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck });
636
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, useOverlay: true });
656
637
  this._detailIsVisible = true;
657
638
  this._showAll = false;
658
639
  this._filterArgument = "";
@@ -41,39 +41,50 @@ const SnkFilterDetail = class {
41
41
  }
42
42
  apply() {
43
43
  var _a;
44
+ let value = this._editor["value"];
44
45
  let isValid = true;
45
- const value = this._editor["value"];
46
- /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
47
- if (value != undefined && this.config.type === FilterItemType.PERSONALIZED) {
46
+ if (this.config.type === FilterItemType.PERSONALIZED) {
48
47
  const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
49
- if (params.length > 1) {
50
- if (params.length > value.length) {
51
- isValid = false;
52
- }
53
- else {
54
- value.forEach(item => {
55
- if (item == undefined) {
56
- isValid = false;
57
- }
58
- });
59
- }
48
+ const paramsCount = params.length;
49
+ if (paramsCount === 0) {
50
+ //Valor do filtro personalizado sem parametros deve ser um array vazio
51
+ value = [];
60
52
  }
61
- if (!isValid) {
62
- this.keepOpened = true;
63
- ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.").then(() => setTimeout(() => this.keepOpened = false, 1));
53
+ else {
54
+ isValid = this.validateAllFilled(paramsCount, value);
64
55
  }
65
56
  }
66
- /* WARNING: Temporário.*/
67
57
  if (isValid) {
68
58
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
69
59
  }
70
60
  }
61
+ /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
62
+ validateAllFilled(paramsCount, value) {
63
+ let isValid = true;
64
+ if (value != undefined && paramsCount > 1) {
65
+ if (paramsCount > value.length) {
66
+ isValid = false;
67
+ }
68
+ else {
69
+ value.forEach(item => {
70
+ if (item == undefined) {
71
+ isValid = false;
72
+ }
73
+ });
74
+ }
75
+ }
76
+ if (!isValid) {
77
+ ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.");
78
+ }
79
+ return isValid;
80
+ }
81
+ /* WARNING: Temporário.*/
71
82
  clear() {
72
83
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
73
84
  }
74
85
  render() {
75
86
  const ContentEditor = this.getContentEditor();
76
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
87
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
77
88
  }
78
89
  };
79
90
 
@@ -31,21 +31,12 @@ const SnkFilterPersonalized = class {
31
31
  }
32
32
  doSearch(mode, argument, param) {
33
33
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
34
- if (this.fix) {
35
- this.fix();
36
- }
37
34
  return new Promise((resolve, reject) => {
38
35
  application.executePreparedSearch(mode, argument, param.searchContext)
39
36
  .then(result => {
40
37
  resolve(result);
41
- if (this.unfix) {
42
- this.unfix();
43
- }
44
38
  }).catch(reason => {
45
39
  reject(reason);
46
- if (this.unfix) {
47
- this.unfix();
48
- }
49
40
  });
50
41
  });
51
42
  }
@@ -11,21 +11,12 @@ const SnkFilterSearch = class {
11
11
  }
12
12
  doSearch(mode, argument) {
13
13
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
14
- if (this.fix) {
15
- this.fix();
16
- }
17
14
  return new Promise((resolve, reject) => {
18
15
  application.executePreparedSearch(mode, argument, this.config.props.searchContext)
19
16
  .then(result => {
20
17
  resolve(result);
21
- if (this.unfix) {
22
- this.unfix();
23
- }
24
18
  }).catch(reason => {
25
19
  reject(reason);
26
- if (this.unfix) {
27
- this.unfix();
28
- }
29
20
  });
30
21
  });
31
22
  }
@@ -0,0 +1 @@
1
+ import{r as s,h as r}from"./p-fac2b6a9.js";import{ApplicationContext as t}from"@sankhyalabs/core";import{F as e}from"./p-9dd2b8cb.js";const i=class{constructor(r){s(this,r)}ezChangeListener(s){this.value=this._searchInput.value}doSearch(s,r){const e=t.getContextValue("__SNK__APPLICATION__");return new Promise(((t,i)=>{e.executePreparedSearch(s,r,this.config.props.searchContext).then((s=>{t(s)})).catch((s=>{i(s)}))}))}render(){if(this.config&&this.config.type===e.SEARCH)return r("ez-search",{suppressEmptyOption:!0,value:this.config.value,label:this.config.label,ref:s=>this._searchInput=s,optionLoader:({mode:s,argument:r})=>this.doSearch(s,r)})}};export{i as snk_filter_search}