@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-78242.2 → 0.0.0-bugfix-dev-KB-80932.0
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/{ConfigStorage-f079f5fd.js → ConfigStorage-d024aec8.js} +2 -2
- package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-54d44192.js} +5 -5
- package/dist/cjs/{DataFetcher-e059eb72.js → DataFetcher-65879b2c.js} +188 -56
- package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-ae3185b2.js} +2 -2
- package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-8480751c.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-228016f4.js → dataunit-fetcher-8ea97d88.js} +2 -2
- package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-90126e4c.js} +38 -1
- package/dist/cjs/index-f9e81701.js +8 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-f3454c23.js} +179 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +133 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button_4.cjs.entry.js → snk-actions-button_5.cjs.entry.js} +99 -9
- package/dist/cjs/snk-application.cjs.entry.js +144 -21
- package/dist/cjs/snk-attach.cjs.entry.js +13 -9
- package/dist/cjs/snk-config-options_3.cjs.entry.js +4 -4
- package/dist/cjs/snk-crud.cjs.entry.js +8 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +29 -18
- package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-72ef8777.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +27 -11
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +9 -8
- package/dist/cjs/{snk-guides-viewer-2139481c.js → snk-guides-viewer-ea5d0907.js} +5 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +105 -31
- package/dist/cjs/snk-simple-crud.cjs.entry.js +27 -29
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-actions-button/actions/index.js +4 -4
- package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +4 -3
- package/dist/collection/components/snk-application/snk-application.css +34 -0
- package/dist/collection/components/snk-application/snk-application.js +197 -14
- package/dist/collection/components/snk-attach/structure/builder/taskbar-builder.js +8 -4
- package/dist/collection/components/snk-crud/snk-crud.js +39 -20
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +11 -5
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +11 -4
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -3
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +3 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +40 -8
- package/dist/collection/components/snk-grid/snk-grid.js +39 -20
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +10 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +190 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +25 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +179 -0
- package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +89 -0
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +24 -5
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +168 -32
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +56 -41
- package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.css +22 -0
- package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.js +181 -0
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +41 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +92 -3
- package/dist/components/ContinuousInsertUtils.js +2 -3
- package/dist/components/DataFetcher.js +188 -56
- package/dist/components/ISave.js +346 -1
- package/dist/components/dataunit-fetcher.js +1 -1
- package/dist/components/form-config-fetcher.js +37 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/pesquisa-grid.d.ts +11 -0
- package/dist/components/pesquisa-grid.js +6 -0
- package/dist/components/pesquisa-grid2.js +86 -0
- package/dist/components/pesquisa-tree.d.ts +11 -0
- package/dist/components/pesquisa-tree.js +6 -0
- package/dist/components/pesquisa-tree2.js +82 -0
- package/dist/components/snk-actions-button2.js +4 -5
- package/dist/components/snk-application2.js +159 -20
- package/dist/components/snk-attach2.js +20 -35
- package/dist/components/snk-crud.js +66 -59
- package/dist/components/snk-data-exporter2.js +25 -15
- package/dist/components/snk-detail-view2.js +84 -94
- package/dist/components/snk-filter-bar2.js +23 -8
- package/dist/components/snk-filter-modal.js +3 -1
- package/dist/components/snk-grid2.js +5 -4
- package/dist/components/snk-pesquisa2.js +118 -33
- package/dist/components/snk-simple-crud2.js +35 -56
- package/dist/components/snk-simple-form-config.d.ts +11 -0
- package/dist/components/snk-simple-form-config.js +6 -0
- package/dist/components/snk-simple-form-config2.js +120 -0
- package/dist/components/teste-pesquisa.js +13 -1
- package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-373bb440.js} +2 -2
- package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-25e7bd9a.js} +5 -5
- package/dist/esm/{DataFetcher-5034df59.js → DataFetcher-5221b992.js} +188 -56
- package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-b65e6db0.js} +2 -2
- package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-e32fe8a4.js} +1 -1
- package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-8dd93d8b.js} +2 -2
- package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-126e2471.js} +38 -1
- package/dist/esm/index-a7d3d3f1.js +8 -4
- package/dist/esm/loader.js +1 -1
- package/dist/{components/pesquisa-fetcher.js → esm/pesquisa-fetcher-0af41f09.js} +180 -3
- package/dist/esm/pesquisa-grid_2.entry.js +128 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button_4.entry.js → snk-actions-button_5.entry.js} +99 -10
- package/dist/esm/snk-application.entry.js +146 -23
- package/dist/esm/snk-attach.entry.js +13 -9
- package/dist/esm/snk-config-options_3.entry.js +4 -4
- package/dist/esm/snk-crud.entry.js +8 -7
- package/dist/esm/snk-data-exporter.entry.js +29 -18
- package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-11a49fc3.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +7 -7
- package/dist/esm/snk-filter-bar_4.entry.js +28 -12
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +9 -8
- package/dist/esm/{snk-guides-viewer-b7ed39eb.js → snk-guides-viewer-830f5fb9.js} +5 -5
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +105 -31
- package/dist/esm/snk-simple-crud.entry.js +27 -29
- package/dist/sankhyablocks/{p-0e206e62.js → p-05b6ff91.js} +1 -1
- package/dist/sankhyablocks/p-09067bee.entry.js +1 -0
- package/dist/sankhyablocks/p-0cda2226.entry.js +11 -0
- package/dist/sankhyablocks/p-1435701f.js +26 -0
- package/dist/sankhyablocks/{p-e97be1c8.js → p-171b7623.js} +1 -1
- package/dist/sankhyablocks/{p-9ffd9fc7.js → p-19dc71e9.js} +1 -1
- package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-1a91d1f3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-1cf39cfd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bb8ef149.entry.js → p-254c59d2.entry.js} +1 -1
- package/dist/sankhyablocks/p-422eb699.entry.js +1 -0
- package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-469384a2.entry.js} +1 -1
- package/dist/sankhyablocks/p-54f5354a.entry.js +1 -0
- package/dist/sankhyablocks/{p-342eeb3b.js → p-60e4db34.js} +1 -1
- package/dist/sankhyablocks/p-618a29ed.entry.js +1 -0
- package/dist/sankhyablocks/p-798386c7.js +6 -0
- package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-82ee6dc3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e4391e16.js → p-8a1ee5b5.js} +1 -1
- package/dist/sankhyablocks/p-8bd86610.entry.js +1 -0
- package/dist/sankhyablocks/p-b50a0753.entry.js +1 -0
- package/dist/sankhyablocks/p-d62228fb.js +1 -0
- package/dist/sankhyablocks/p-d92d4f91.entry.js +1 -0
- package/dist/sankhyablocks/{p-47d24ac8.js → p-ddefbbc7.js} +1 -1
- package/dist/sankhyablocks/p-e5430b29.entry.js +1 -0
- package/dist/sankhyablocks/p-f0b9303b.js +1 -0
- package/dist/sankhyablocks/p-f258690a.entry.js +1 -0
- package/dist/sankhyablocks/{p-ec43fcc8.entry.js → p-f975370f.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +22 -4
- package/dist/types/components/snk-crud/snk-crud.d.ts +8 -4
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +6 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +8 -4
- package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +38 -0
- package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +29 -0
- package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +19 -0
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +35 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -4
- package/dist/types/components/snk-simple-form-config/snk-simple-form-config.d.ts +34 -0
- package/dist/types/components.d.ts +244 -23
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +8 -2
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +10 -1
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/esm/pesquisa-fetcher-6bc2e41a.js +0 -169
- package/dist/sankhyablocks/p-00278e07.js +0 -1
- package/dist/sankhyablocks/p-0387d9d7.entry.js +0 -1
- package/dist/sankhyablocks/p-126c58ea.js +0 -26
- package/dist/sankhyablocks/p-1d3ce0d9.entry.js +0 -1
- package/dist/sankhyablocks/p-341465ce.js +0 -6
- package/dist/sankhyablocks/p-3728d2aa.entry.js +0 -11
- package/dist/sankhyablocks/p-4138da61.entry.js +0 -1
- package/dist/sankhyablocks/p-5d9788b3.entry.js +0 -1
- package/dist/sankhyablocks/p-7075b789.entry.js +0 -1
- package/dist/sankhyablocks/p-aaf94476.js +0 -1
- package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
- package/dist/sankhyablocks/p-d1791da2.entry.js +0 -1
- package/dist/sankhyablocks/p-eb7c9cf4.entry.js +0 -1
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { ObjectUtils, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { a as PesquisaFetcher, d as buildGridMetadata } from './ISave.js';
|
|
4
|
+
import './DataFetcher.js';
|
|
5
|
+
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
6
|
+
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
7
|
+
import './dataunit-fetcher.js';
|
|
8
|
+
import './filter-item-type.enum.js';
|
|
9
|
+
import './form-config-fetcher.js';
|
|
10
|
+
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
|
11
|
+
import { d as defineCustomElement$2 } from './pesquisa-grid2.js';
|
|
12
|
+
import { d as defineCustomElement$1 } from './pesquisa-tree2.js';
|
|
3
13
|
|
|
4
|
-
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__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--medium, 12px);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.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;overflow-y:
|
|
14
|
+
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--color-secondary:var(--text--secondary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--medium, 12px);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.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__scrollbar--color-background);width:var(--snk-pesquisa__scrollbar--width);max-width:var(--snk-pesquisa__scrollbar--width);min-width:var(--snk-pesquisa__scrollbar--width)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__scrollbar--color-background);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__scrollbar--color-default);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:hover,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-pesquisa__scrollbar--color-hover)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:active,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-pesquisa__scrollbar--color-clicked)}.snk-pesquisa__records-label.sc-snk-pesquisa{display:flex;flex-direction:row;justify-content:space-between;font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__records.sc-snk-pesquisa{color:var(--snk-pesquisa__records--color)}.snk-pesquisa__records-limit.sc-snk-pesquisa{color:var(--snk-pesquisa__records--color-secondary)}.snk-pesquisa__records-limit.hidden.sc-snk-pesquisa,.snk-pesquisa__records.hidden.sc-snk-pesquisa{visibility:hidden}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
|
|
5
15
|
|
|
6
16
|
const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
17
|
constructor() {
|
|
@@ -16,11 +26,18 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
16
26
|
this._changeDeboucingTimeout = null;
|
|
17
27
|
this._limitCharsToSearch = 3;
|
|
18
28
|
this._deboucingTime = 450;
|
|
29
|
+
this._gridDataSource = [];
|
|
30
|
+
this.pesquisaFetcher = new PesquisaFetcher();
|
|
19
31
|
this._itemList = undefined;
|
|
20
32
|
this._startLoading = false;
|
|
33
|
+
this._presentationMode = "list";
|
|
21
34
|
this.searchLoader = undefined;
|
|
35
|
+
this.treeLoader = undefined;
|
|
22
36
|
this.selectItem = undefined;
|
|
37
|
+
this.entityName = undefined;
|
|
23
38
|
this.argument = undefined;
|
|
39
|
+
this.isHierarchyEntity = false;
|
|
40
|
+
this.allowsNonAnalytic = false;
|
|
24
41
|
}
|
|
25
42
|
observeArgument() {
|
|
26
43
|
if (this._textInput) {
|
|
@@ -58,36 +75,42 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
58
75
|
this._startLoading = true;
|
|
59
76
|
this.searchLoader(argument)
|
|
60
77
|
.then((resp) => {
|
|
78
|
+
if (!resp)
|
|
79
|
+
return;
|
|
80
|
+
this.processSearchResponse(resp);
|
|
81
|
+
}).finally(() => {
|
|
61
82
|
this._startLoading = false;
|
|
62
|
-
if (resp) {
|
|
63
|
-
resp = ObjectUtils.stringToObject(resp.json.$);
|
|
64
|
-
let descriptionField = resp.descriptionField;
|
|
65
|
-
let pkField = resp.pkField;
|
|
66
|
-
if (pkField) {
|
|
67
|
-
let newItemList = [];
|
|
68
|
-
resp.data.forEach((item) => {
|
|
69
|
-
var _a;
|
|
70
|
-
let fieldsMetadata = this.filterFieldsMetadata(resp, item);
|
|
71
|
-
let fields = this.buildFirstFields(item['__matchFields'], fieldsMetadata);
|
|
72
|
-
let exibitionItem = {
|
|
73
|
-
key: this.highlightValue(item['__matchFields'], (_a = item[pkField]) === null || _a === void 0 ? void 0 : _a.toString(), fields, true),
|
|
74
|
-
title: descriptionField ? this.highlightValue(item['__matchFields'], item[descriptionField], fields, true) : "",
|
|
75
|
-
details: this.buildDetails(fields, item)
|
|
76
|
-
};
|
|
77
|
-
newItemList.push(exibitionItem);
|
|
78
|
-
});
|
|
79
|
-
this._itemList = newItemList;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}).catch((error) => {
|
|
83
|
-
this._startLoading = false;
|
|
84
|
-
this._itemList = [];
|
|
85
|
-
console.warn(error);
|
|
86
83
|
});
|
|
87
84
|
}
|
|
88
85
|
}
|
|
86
|
+
processSearchResponse(resp) {
|
|
87
|
+
resp = ObjectUtils.stringToObject(resp.json.$);
|
|
88
|
+
let descriptionField = resp.descriptionField;
|
|
89
|
+
let pkField = resp.pkField;
|
|
90
|
+
if (!pkField)
|
|
91
|
+
return;
|
|
92
|
+
this._gridMetadata = buildGridMetadata(resp);
|
|
93
|
+
this._gridDataSource = [...resp.data];
|
|
94
|
+
this._pkField = pkField;
|
|
95
|
+
this._descriptionField = descriptionField;
|
|
96
|
+
this._itemList = this.buildCardItemList(resp, pkField, descriptionField);
|
|
97
|
+
}
|
|
98
|
+
buildCardItemList(resp, pkField, descriptionField) {
|
|
99
|
+
var _a;
|
|
100
|
+
let newItemList = (_a = resp.data) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
101
|
+
var _a;
|
|
102
|
+
let fieldsMetadata = this.filterFieldsMetadata(resp, item);
|
|
103
|
+
let fields = this.buildFirstFields(item['__matchFields'], fieldsMetadata);
|
|
104
|
+
return {
|
|
105
|
+
key: this.highlightValue(item['__matchFields'], (_a = item[pkField]) === null || _a === void 0 ? void 0 : _a.toString(), fields, true),
|
|
106
|
+
title: descriptionField ? this.highlightValue(item['__matchFields'], item[descriptionField], fields, true) : '',
|
|
107
|
+
details: this.buildDetails(fields, item),
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
return newItemList;
|
|
111
|
+
}
|
|
89
112
|
filterFieldsMetadata(resp, item) {
|
|
90
|
-
|
|
113
|
+
return resp.fieldsMetadata.filter((field) => {
|
|
91
114
|
let accept = !StringUtils.isEmpty(item[field.fieldName]) &&
|
|
92
115
|
field.visible !== false &&
|
|
93
116
|
field.type !== 'B' &&
|
|
@@ -104,7 +127,6 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
104
127
|
}
|
|
105
128
|
return accept;
|
|
106
129
|
});
|
|
107
|
-
return fieldsMetadata;
|
|
108
130
|
}
|
|
109
131
|
removeAtIndex(array, index) {
|
|
110
132
|
if (index >= 0 && index < array.length) {
|
|
@@ -262,6 +284,7 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
262
284
|
this.selectItem(option);
|
|
263
285
|
}
|
|
264
286
|
onChangeValue(event) {
|
|
287
|
+
var _a;
|
|
265
288
|
this.clearDeboucingTimeout();
|
|
266
289
|
if (this._startLoading) {
|
|
267
290
|
this._changeDeboucingTimeout = setTimeout(() => {
|
|
@@ -270,6 +293,10 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
270
293
|
return;
|
|
271
294
|
}
|
|
272
295
|
this.argument = (event.detail || "").trim();
|
|
296
|
+
if (this.isHierarchyEntity && this._presentationMode === 'list') {
|
|
297
|
+
(_a = this._pesquisaTree) === null || _a === void 0 ? void 0 : _a.applyFilter();
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
273
300
|
const argumentNumber = this.getArgumentNumber();
|
|
274
301
|
if (this.argument && (!isNaN(argumentNumber) || this.argument.length >= this._limitCharsToSearch)) {
|
|
275
302
|
this._changeDeboucingTimeout = setTimeout(() => {
|
|
@@ -300,16 +327,59 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
300
327
|
: 'Nenhum registro encontrado'
|
|
301
328
|
: 'Os resultados de sua pesquisa aparecerão aqui...';
|
|
302
329
|
}
|
|
303
|
-
|
|
330
|
+
async componentWillLoad() {
|
|
331
|
+
const mode = await this.pesquisaFetcher.loadPresentationConfig(this.entityName);
|
|
332
|
+
this._presentationMode = mode === 'list' ? 'list' : 'table';
|
|
333
|
+
}
|
|
334
|
+
async componentDidLoad() {
|
|
304
335
|
ElementIDUtils.addIDInfo(this._element);
|
|
305
336
|
}
|
|
337
|
+
async onClickList() {
|
|
338
|
+
this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
|
|
339
|
+
await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
|
|
340
|
+
}
|
|
341
|
+
enableListButton() {
|
|
342
|
+
var _a;
|
|
343
|
+
return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
344
|
+
}
|
|
345
|
+
//Os limites de exibição são diferentes para lista e grade
|
|
346
|
+
hideLimitMessage() {
|
|
347
|
+
if (!this._itemList)
|
|
348
|
+
return true;
|
|
349
|
+
if (this._presentationMode === "list") {
|
|
350
|
+
if (this.isHierarchyEntity)
|
|
351
|
+
return true;
|
|
352
|
+
return this._itemList.length <= 100;
|
|
353
|
+
}
|
|
354
|
+
return this._itemList.length <= 150;
|
|
355
|
+
}
|
|
356
|
+
hideRecordsMessage() {
|
|
357
|
+
return (this._presentationMode === "list" && this.isHierarchyEntity);
|
|
358
|
+
}
|
|
359
|
+
renderContent() {
|
|
360
|
+
if (!this._itemList)
|
|
361
|
+
return;
|
|
362
|
+
if (this._presentationMode === 'list') {
|
|
363
|
+
return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
|
|
364
|
+
}
|
|
365
|
+
return this.renderPesquisaGrid();
|
|
366
|
+
}
|
|
367
|
+
renderTree() {
|
|
368
|
+
return h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) }));
|
|
369
|
+
}
|
|
370
|
+
renderCards() {
|
|
371
|
+
return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
|
|
372
|
+
return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
373
|
+
}))));
|
|
374
|
+
}
|
|
375
|
+
renderPesquisaGrid() {
|
|
376
|
+
return h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
|
|
377
|
+
}
|
|
306
378
|
render() {
|
|
307
379
|
var _a;
|
|
308
380
|
return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument, "data-element-id": "searchInput" }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
|
|
309
381
|
? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
310
|
-
: undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })
|
|
311
|
-
return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
312
|
-
})))));
|
|
382
|
+
: undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this._presentationMode === 'list' ? 'table' : 'list', title: this._presentationMode === 'list' ? 'Modo grade' : 'Modo lista', onClick: async () => await this.onClickList(), enabled: this.enableListButton() })), h("div", { class: "snk-pesquisa__records-label" }, h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), h("div", { class: "snk-pesquisa__content" }, this.renderContent()))));
|
|
313
383
|
}
|
|
314
384
|
get _element() { return this; }
|
|
315
385
|
static get watchers() { return {
|
|
@@ -318,22 +388,37 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
318
388
|
static get style() { return snkPesquisaCss; }
|
|
319
389
|
}, [2, "snk-pesquisa", {
|
|
320
390
|
"searchLoader": [16],
|
|
391
|
+
"treeLoader": [16],
|
|
321
392
|
"selectItem": [16],
|
|
393
|
+
"entityName": [1, "entity-name"],
|
|
322
394
|
"argument": [1025],
|
|
395
|
+
"isHierarchyEntity": [4, "is-hierarchy-entity"],
|
|
396
|
+
"allowsNonAnalytic": [4, "allows-non-analytic"],
|
|
323
397
|
"_itemList": [32],
|
|
324
|
-
"_startLoading": [32]
|
|
398
|
+
"_startLoading": [32],
|
|
399
|
+
"_presentationMode": [32]
|
|
325
400
|
}]);
|
|
326
401
|
function defineCustomElement() {
|
|
327
402
|
if (typeof customElements === "undefined") {
|
|
328
403
|
return;
|
|
329
404
|
}
|
|
330
|
-
const components = ["snk-pesquisa"];
|
|
405
|
+
const components = ["snk-pesquisa", "pesquisa-grid", "pesquisa-tree"];
|
|
331
406
|
components.forEach(tagName => { switch (tagName) {
|
|
332
407
|
case "snk-pesquisa":
|
|
333
408
|
if (!customElements.get(tagName)) {
|
|
334
409
|
customElements.define(tagName, SnkPesquisa);
|
|
335
410
|
}
|
|
336
411
|
break;
|
|
412
|
+
case "pesquisa-grid":
|
|
413
|
+
if (!customElements.get(tagName)) {
|
|
414
|
+
defineCustomElement$2();
|
|
415
|
+
}
|
|
416
|
+
break;
|
|
417
|
+
case "pesquisa-tree":
|
|
418
|
+
if (!customElements.get(tagName)) {
|
|
419
|
+
defineCustomElement$1();
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
337
422
|
} });
|
|
338
423
|
}
|
|
339
424
|
|
|
@@ -4,9 +4,8 @@ import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
|
4
4
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
|
|
5
5
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
6
6
|
import './DataFetcher.js';
|
|
7
|
-
import './pesquisa-fetcher.js';
|
|
8
|
-
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, c as ContinuousInsertUtils, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './ContinuousInsertUtils.js';
|
|
9
7
|
import { D as DataExporterOption, P as PresentationMode } from './ISave.js';
|
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, c as ContinuousInsertUtils, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './ContinuousInsertUtils.js';
|
|
10
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
11
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
12
11
|
import { I as InMemoryLoader } from './dataunit-fetcher.js';
|
|
@@ -16,17 +15,14 @@ import { C as ConfigStorage } from './ConfigStorage.js';
|
|
|
16
15
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
|
|
17
16
|
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
|
18
17
|
import { s as store } from './index2.js';
|
|
19
|
-
import { d as defineCustomElement$
|
|
20
|
-
import { d as defineCustomElement$
|
|
21
|
-
import { d as defineCustomElement$
|
|
22
|
-
import { d as defineCustomElement$
|
|
23
|
-
import { d as defineCustomElement$
|
|
24
|
-
import { d as defineCustomElement$8 } from './snk-exporter-email-sender2.js';
|
|
25
|
-
import { d as defineCustomElement$7 } from './snk-field-config2.js';
|
|
26
|
-
import { d as defineCustomElement$6 } from './snk-form-config2.js';
|
|
18
|
+
import { d as defineCustomElement$a } from './snk-actions-button2.js';
|
|
19
|
+
import { d as defineCustomElement$9 } from './snk-configurator2.js';
|
|
20
|
+
import { d as defineCustomElement$8 } from './snk-data-exporter2.js';
|
|
21
|
+
import { d as defineCustomElement$7 } from './snk-data-unit2.js';
|
|
22
|
+
import { d as defineCustomElement$6 } from './snk-exporter-email-sender2.js';
|
|
27
23
|
import { d as defineCustomElement$5 } from './snk-grid-config2.js';
|
|
28
24
|
import { d as defineCustomElement$4 } from './snk-select-box2.js';
|
|
29
|
-
import { d as defineCustomElement$3 } from './snk-
|
|
25
|
+
import { d as defineCustomElement$3 } from './snk-simple-form-config2.js';
|
|
30
26
|
import { d as defineCustomElement$1 } from './taskbar-actions-button2.js';
|
|
31
27
|
|
|
32
28
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
@@ -112,18 +108,18 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
112
108
|
"snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this)
|
|
113
109
|
});
|
|
114
110
|
this._showPopUpGridConfig = false;
|
|
115
|
-
this._showFormConfig = false;
|
|
116
111
|
this._currentViewMode = VIEW_MODE.GRID;
|
|
117
112
|
this._config = undefined;
|
|
118
113
|
this._fieldToGetFocus = undefined;
|
|
119
114
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
115
|
+
this.enableLockManagerLoadingComp = false;
|
|
116
|
+
this.enableLockManagerTaskbarClick = false;
|
|
120
117
|
this.dataState = undefined;
|
|
121
118
|
this.dataUnit = undefined;
|
|
122
119
|
this.entityName = undefined;
|
|
123
120
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
|
124
121
|
this.gridConfig = undefined;
|
|
125
122
|
this.formConfig = undefined;
|
|
126
|
-
this.enableLockManger = false;
|
|
127
123
|
this._formFields = [];
|
|
128
124
|
this._fieldsProps = new Map();
|
|
129
125
|
this._enableContinuousInsert = true;
|
|
@@ -333,15 +329,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
333
329
|
});
|
|
334
330
|
}
|
|
335
331
|
async openFormConfig() {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (this.formLegacyConfigName) {
|
|
339
|
-
const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
|
|
340
|
-
const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
|
|
341
|
-
await this.application.alert(title, message);
|
|
342
|
-
return;
|
|
332
|
+
if (this.formLegacyConfigName || this.configName) {
|
|
333
|
+
await this._snkSimpleFormConfig.show();
|
|
343
334
|
}
|
|
344
|
-
this._showFormConfig = true;
|
|
345
335
|
}
|
|
346
336
|
addGridLegacyConfigName() {
|
|
347
337
|
if (this.gridLegacyConfigName && this.configName) {
|
|
@@ -371,7 +361,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
371
361
|
formConfigIsLoaded() {
|
|
372
362
|
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
|
373
363
|
}
|
|
374
|
-
async loadFormConfig(forceLoad = false) {
|
|
364
|
+
async loadFormConfig(forceLoad = false, forceSetNewConfig = false) {
|
|
375
365
|
if (this.configName === undefined) {
|
|
376
366
|
return;
|
|
377
367
|
}
|
|
@@ -386,7 +376,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
386
376
|
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
|
387
377
|
if (loadedLegacyConfig != undefined) {
|
|
388
378
|
this._formConfigManager.setConfig(loadedLegacyConfig);
|
|
389
|
-
this.setFormConfig(loadedLegacyConfig);
|
|
379
|
+
this.setFormConfig(loadedLegacyConfig, forceSetNewConfig);
|
|
390
380
|
return;
|
|
391
381
|
}
|
|
392
382
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
@@ -770,9 +760,6 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
770
760
|
closeGridConfig() {
|
|
771
761
|
this._showPopUpGridConfig = false;
|
|
772
762
|
}
|
|
773
|
-
closeFormConfig() {
|
|
774
|
-
this._showFormConfig = false;
|
|
775
|
-
}
|
|
776
763
|
getPageSize() {
|
|
777
764
|
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
|
778
765
|
return 0;
|
|
@@ -782,10 +769,6 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
782
769
|
}
|
|
783
770
|
return this.pageSize;
|
|
784
771
|
}
|
|
785
|
-
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
|
786
|
-
handleShowFormConfig() {
|
|
787
|
-
return this._showFormConfig && !this.formLegacyConfigName;
|
|
788
|
-
}
|
|
789
772
|
resolveResourceID() {
|
|
790
773
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
791
774
|
}
|
|
@@ -798,7 +781,10 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
798
781
|
return configFromManager;
|
|
799
782
|
}
|
|
800
783
|
updateFormConfig() {
|
|
801
|
-
|
|
784
|
+
let newConfig = this.formConfig;
|
|
785
|
+
if (this.formLegacyConfigName == undefined) {
|
|
786
|
+
newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
787
|
+
}
|
|
802
788
|
this.setFormConfig(newConfig, true);
|
|
803
789
|
if (this._formConfigManager == undefined) {
|
|
804
790
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
@@ -811,8 +797,12 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
811
797
|
this.goToView(VIEW_MODE.FORM);
|
|
812
798
|
}
|
|
813
799
|
async initKeyboardManager() {
|
|
800
|
+
var _a;
|
|
814
801
|
const keyboardManager = new KeyboardManager();
|
|
815
|
-
const dataUnit = this.dataUnit || await this._snkDataUnit.getDataUnit();
|
|
802
|
+
const dataUnit = this.dataUnit || await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
|
803
|
+
if (dataUnit == undefined) {
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
816
806
|
keyboardManager
|
|
817
807
|
.bind("F7", () => dataUnit.saveData(), { description: "Salva os dados.", element: this._element })
|
|
818
808
|
.bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
|
|
@@ -826,18 +816,22 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
826
816
|
description: "Cancela uma ação.", element: this._element
|
|
827
817
|
});
|
|
828
818
|
}
|
|
819
|
+
async handleFormConfigSaved() {
|
|
820
|
+
await this.loadFormConfig(true, true);
|
|
821
|
+
}
|
|
829
822
|
renderTaskbarContent() {
|
|
830
823
|
var _a;
|
|
831
824
|
return (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow-xsmall'} ez-padding--small`, 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" })));
|
|
832
825
|
}
|
|
833
826
|
/* istanbul ignore next */
|
|
834
827
|
render() {
|
|
828
|
+
var _a;
|
|
835
829
|
if (this.dataUnit == undefined) {
|
|
836
830
|
return;
|
|
837
831
|
}
|
|
838
832
|
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.handleDataUnitOnInsertionMode.bind(this), 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 ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section` }, 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)
|
|
839
833
|
? undefined
|
|
840
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert,
|
|
834
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), 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() }))));
|
|
841
835
|
}
|
|
842
836
|
get _element() { return this; }
|
|
843
837
|
static get watchers() { return {
|
|
@@ -850,13 +844,14 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
850
844
|
}; }
|
|
851
845
|
static get style() { return snkSimpleCrudCss; }
|
|
852
846
|
}, [6, "snk-simple-crud", {
|
|
847
|
+
"enableLockManagerLoadingComp": [4, "enable-lock-manager-loading-comp"],
|
|
848
|
+
"enableLockManagerTaskbarClick": [4, "enable-lock-manager-taskbar-click"],
|
|
853
849
|
"dataState": [16],
|
|
854
850
|
"dataUnit": [16],
|
|
855
851
|
"entityName": [1, "entity-name"],
|
|
856
852
|
"mode": [2],
|
|
857
853
|
"gridConfig": [1040],
|
|
858
854
|
"formConfig": [1040],
|
|
859
|
-
"enableLockManger": [4, "enable-lock-manger"],
|
|
860
855
|
"multipleSelection": [4, "multiple-selection"],
|
|
861
856
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
|
862
857
|
"pageSize": [2, "page-size"],
|
|
@@ -876,7 +871,6 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
876
871
|
"autoLoad": [4, "auto-load"],
|
|
877
872
|
"outlineMode": [4, "outline-mode"],
|
|
878
873
|
"_showPopUpGridConfig": [32],
|
|
879
|
-
"_showFormConfig": [32],
|
|
880
874
|
"_currentViewMode": [32],
|
|
881
875
|
"_config": [32],
|
|
882
876
|
"_fieldToGetFocus": [32],
|
|
@@ -901,7 +895,7 @@ function defineCustomElement() {
|
|
|
901
895
|
if (typeof customElements === "undefined") {
|
|
902
896
|
return;
|
|
903
897
|
}
|
|
904
|
-
const components = ["snk-simple-crud", "snk-actions-button", "snk-
|
|
898
|
+
const components = ["snk-simple-crud", "snk-actions-button", "snk-configurator", "snk-data-exporter", "snk-data-unit", "snk-exporter-email-sender", "snk-grid-config", "snk-select-box", "snk-simple-form-config", "snk-taskbar", "taskbar-actions-button"];
|
|
905
899
|
components.forEach(tagName => { switch (tagName) {
|
|
906
900
|
case "snk-simple-crud":
|
|
907
901
|
if (!customElements.get(tagName)) {
|
|
@@ -909,41 +903,26 @@ function defineCustomElement() {
|
|
|
909
903
|
}
|
|
910
904
|
break;
|
|
911
905
|
case "snk-actions-button":
|
|
912
|
-
if (!customElements.get(tagName)) {
|
|
913
|
-
defineCustomElement$d();
|
|
914
|
-
}
|
|
915
|
-
break;
|
|
916
|
-
case "snk-config-options":
|
|
917
|
-
if (!customElements.get(tagName)) {
|
|
918
|
-
defineCustomElement$c();
|
|
919
|
-
}
|
|
920
|
-
break;
|
|
921
|
-
case "snk-configurator":
|
|
922
|
-
if (!customElements.get(tagName)) {
|
|
923
|
-
defineCustomElement$b();
|
|
924
|
-
}
|
|
925
|
-
break;
|
|
926
|
-
case "snk-data-exporter":
|
|
927
906
|
if (!customElements.get(tagName)) {
|
|
928
907
|
defineCustomElement$a();
|
|
929
908
|
}
|
|
930
909
|
break;
|
|
931
|
-
case "snk-
|
|
910
|
+
case "snk-configurator":
|
|
932
911
|
if (!customElements.get(tagName)) {
|
|
933
912
|
defineCustomElement$9();
|
|
934
913
|
}
|
|
935
914
|
break;
|
|
936
|
-
case "snk-exporter
|
|
915
|
+
case "snk-data-exporter":
|
|
937
916
|
if (!customElements.get(tagName)) {
|
|
938
917
|
defineCustomElement$8();
|
|
939
918
|
}
|
|
940
919
|
break;
|
|
941
|
-
case "snk-
|
|
920
|
+
case "snk-data-unit":
|
|
942
921
|
if (!customElements.get(tagName)) {
|
|
943
922
|
defineCustomElement$7();
|
|
944
923
|
}
|
|
945
924
|
break;
|
|
946
|
-
case "snk-
|
|
925
|
+
case "snk-exporter-email-sender":
|
|
947
926
|
if (!customElements.get(tagName)) {
|
|
948
927
|
defineCustomElement$6();
|
|
949
928
|
}
|
|
@@ -958,7 +937,7 @@ function defineCustomElement() {
|
|
|
958
937
|
defineCustomElement$4();
|
|
959
938
|
}
|
|
960
939
|
break;
|
|
961
|
-
case "snk-
|
|
940
|
+
case "snk-simple-form-config":
|
|
962
941
|
if (!customElements.get(tagName)) {
|
|
963
942
|
defineCustomElement$3();
|
|
964
943
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SnkSimpleFormConfig extends Components.SnkSimpleFormConfig, HTMLElement {}
|
|
4
|
+
export const SnkSimpleFormConfig: {
|
|
5
|
+
prototype: SnkSimpleFormConfig;
|
|
6
|
+
new (): SnkSimpleFormConfig;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import './DataFetcher.js';
|
|
3
|
+
import './ISave.js';
|
|
4
|
+
import '@sankhyalabs/core';
|
|
5
|
+
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
6
|
+
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
7
|
+
import './dataunit-fetcher.js';
|
|
8
|
+
import './filter-item-type.enum.js';
|
|
9
|
+
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
|
10
|
+
|
|
11
|
+
const snkSimpleFormConfigCss = ":host{display:block}.config-container{display:flex;flex-direction:column;align-items:center;justify-content:space-between}.config-lists{margin-bottom:12px}.config-actions{display:flex;flex-direction:row;justify-content:flex-end;width:100%;gap:12px}";
|
|
12
|
+
|
|
13
|
+
const SnkSimpleFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.__registerHost();
|
|
17
|
+
this.snkConfigSaved = createEvent(this, "snkConfigSaved", 7);
|
|
18
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
19
|
+
this.fieldsToSave = [];
|
|
20
|
+
this.dataUnit = undefined;
|
|
21
|
+
this.configName = undefined;
|
|
22
|
+
this.avaliableFields = [];
|
|
23
|
+
this.selectedFields = [];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Responsável por abrir o configurador.
|
|
27
|
+
*/
|
|
28
|
+
async show() {
|
|
29
|
+
var _a;
|
|
30
|
+
await ((_a = this.ezDoubleListRef) === null || _a === void 0 ? void 0 : _a.resetSelectedLists());
|
|
31
|
+
await this.initializeFormConfig();
|
|
32
|
+
this.ezPopupRef.opened = true;
|
|
33
|
+
}
|
|
34
|
+
;
|
|
35
|
+
async initializeFormConfig() {
|
|
36
|
+
if (!this.configName)
|
|
37
|
+
return;
|
|
38
|
+
const allFields = this.getAllVisibleFieldsFromDataUnit();
|
|
39
|
+
const displayedFieldNameList = await this.getConfig();
|
|
40
|
+
//Quando não retorna dados, é por quê não existe configuração do usuário salva.
|
|
41
|
+
if (displayedFieldNameList.length === 0) {
|
|
42
|
+
this.avaliableFields = [];
|
|
43
|
+
this.selectedFields = [...allFields];
|
|
44
|
+
this.fieldsToSave = [...this.selectedFields];
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const selectedFieldsAux = this.sortDisplayedFields(displayedFieldNameList, allFields);
|
|
48
|
+
const avaliableFieldsAux = allFields.filter(field => !displayedFieldNameList.includes(field.id));
|
|
49
|
+
this.avaliableFields = [...avaliableFieldsAux];
|
|
50
|
+
this.selectedFields = [...selectedFieldsAux];
|
|
51
|
+
this.fieldsToSave = [...this.selectedFields];
|
|
52
|
+
}
|
|
53
|
+
async getConfig() {
|
|
54
|
+
const fieldList = await this._formConfigFetcher.fetchSimpleFormConfig(this.configName);
|
|
55
|
+
return [...this.removeDuplicates(fieldList)];
|
|
56
|
+
}
|
|
57
|
+
removeDuplicates(strings) {
|
|
58
|
+
return strings.filter((item, index) => strings.indexOf(item) === index);
|
|
59
|
+
}
|
|
60
|
+
sortDisplayedFields(displayedFieldNameList, allFields) {
|
|
61
|
+
const selectedFieldsAux = [];
|
|
62
|
+
//É preciso garantir a ordem na qual os campos vieram na resposta do fetchSimpleFormConfig.
|
|
63
|
+
displayedFieldNameList.forEach(fieldName => {
|
|
64
|
+
const field = allFields.find(field => field.id === fieldName);
|
|
65
|
+
if (!field)
|
|
66
|
+
return;
|
|
67
|
+
selectedFieldsAux.push(field);
|
|
68
|
+
});
|
|
69
|
+
return selectedFieldsAux;
|
|
70
|
+
}
|
|
71
|
+
getAllVisibleFieldsFromDataUnit() {
|
|
72
|
+
var _a, _b, _c;
|
|
73
|
+
const visibleFields = ((_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : []).filter(field => field.visible);
|
|
74
|
+
return visibleFields.map(field => {
|
|
75
|
+
return { id: field.name, label: field.label };
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
close() {
|
|
79
|
+
this.ezPopupRef.opened = false;
|
|
80
|
+
}
|
|
81
|
+
async handleResetConfigs() {
|
|
82
|
+
await this._formConfigFetcher.restoreFormConfig(this.configName);
|
|
83
|
+
await this.initializeFormConfig();
|
|
84
|
+
await this.handleSave();
|
|
85
|
+
}
|
|
86
|
+
handleCancel() {
|
|
87
|
+
this.close();
|
|
88
|
+
}
|
|
89
|
+
async handleSave() {
|
|
90
|
+
const saveList = this.fieldsToSave.map(field => field.id);
|
|
91
|
+
await this._formConfigFetcher.saveSimpleFormConfig(this.configName, saveList);
|
|
92
|
+
this.close();
|
|
93
|
+
this.snkConfigSaved.emit();
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
return (h("ez-popup", { ref: (ref) => this.ezPopupRef = ref, heightMode: 'auto', size: 'auto', ezTitle: 'Configurar formul\u00E1rio' }, h("div", { class: 'config-container' }, h("div", { class: 'config-lists' }, h("ez-double-list", { ref: (ref) => this.ezDoubleListRef = ref, leftList: this.avaliableFields, leftTitle: 'Campos disponíveis', rightList: this.selectedFields, rightTitle: 'Campos selecionados', onEzRightListChanged: ({ detail }) => this.fieldsToSave = [...detail], entityLabel: 'campo', entityLabelPlural: 'campos' })), h("div", { class: 'config-actions' }, h("ez-button", { label: 'Restaurar', onClick: this.handleResetConfigs.bind(this), size: 'small' }), h("ez-button", { label: 'Cancelar', onClick: this.handleCancel.bind(this), size: 'small' }), h("ez-button", { label: 'Salvar', class: 'ez-button--primary', onClick: this.handleSave.bind(this), size: 'small' })))));
|
|
97
|
+
}
|
|
98
|
+
static get style() { return snkSimpleFormConfigCss; }
|
|
99
|
+
}, [0, "snk-simple-form-config", {
|
|
100
|
+
"dataUnit": [16],
|
|
101
|
+
"configName": [1, "config-name"],
|
|
102
|
+
"avaliableFields": [32],
|
|
103
|
+
"selectedFields": [32],
|
|
104
|
+
"show": [64]
|
|
105
|
+
}]);
|
|
106
|
+
function defineCustomElement() {
|
|
107
|
+
if (typeof customElements === "undefined") {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const components = ["snk-simple-form-config"];
|
|
111
|
+
components.forEach(tagName => { switch (tagName) {
|
|
112
|
+
case "snk-simple-form-config":
|
|
113
|
+
if (!customElements.get(tagName)) {
|
|
114
|
+
customElements.define(tagName, SnkSimpleFormConfig);
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
} });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { SnkSimpleFormConfig as S, defineCustomElement as d };
|