@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-81146.2 → 0.0.0-bugfix-dev-KB-81512.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ContinuousInsertUtils-6e536e37.js → ContinuousInsertUtils-14107ec6.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-3b86b6c4.js → pesquisa-fetcher-b3f1d550.js} +4 -7
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +11 -33
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_5.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-84cb012b.js → snk-guides-viewer-8c5cec6f.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-pesquisa.cjs.entry.js +34 -21
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +1 -1
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +1 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +5 -41
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +1 -4
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +7 -36
- package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +3 -7
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +0 -10
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +34 -22
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -0
- package/dist/components/ISave.js +5 -8
- package/dist/components/pesquisa-grid2.js +6 -21
- package/dist/components/pesquisa-tree2.js +6 -15
- package/dist/components/snk-filter-modal.js +1 -1
- package/dist/components/snk-pesquisa2.js +35 -23
- package/dist/esm/{ContinuousInsertUtils-91011e01.js → ContinuousInsertUtils-0af2b9bf.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-767abffa.js → pesquisa-fetcher-50c9f0d2.js} +5 -8
- package/dist/esm/pesquisa-grid_2.entry.js +11 -33
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_5.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-filter-bar_4.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-45ee10ff.js → snk-guides-viewer-7ff3e8d7.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-pesquisa.entry.js +34 -21
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-6e0adddc.entry.js → p-077e6170.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1c2d8a9a.entry.js → p-128eda45.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1bab295e.entry.js → p-1740ad8f.entry.js} +1 -1
- package/dist/sankhyablocks/p-1eb694a6.entry.js +1 -0
- package/dist/sankhyablocks/{p-853074f4.entry.js → p-3547021c.entry.js} +1 -1
- package/dist/sankhyablocks/p-6b4f5027.entry.js +1 -0
- package/dist/sankhyablocks/{p-dd7fb984.entry.js → p-8930218f.entry.js} +1 -1
- package/dist/sankhyablocks/p-90bf98b6.js +6 -0
- package/dist/sankhyablocks/{p-0e6874ca.entry.js → p-9fb159f0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-935aa4fa.entry.js → p-ba9929c6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ee759111.js → p-bfc1c5e6.js} +1 -1
- package/dist/sankhyablocks/{p-03e37897.entry.js → p-c9557d42.entry.js} +1 -1
- package/dist/sankhyablocks/{p-035c63df.entry.js → p-cbab9448.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e5430b29.entry.js → p-edbe8e15.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6cfa8913.js → p-f85736b2.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +5 -11
- package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +4 -8
- package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +1 -6
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +6 -5
- package/dist/types/components.d.ts +2 -18
- package/package.json +1 -1
- package/dist/sankhyablocks/p-4fe8bb73.js +0 -6
- package/dist/sankhyablocks/p-cfd229f4.entry.js +0 -1
- package/dist/sankhyablocks/p-e74eb86d.entry.js +0 -1
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const pesquisaFetcher = require('./pesquisa-fetcher-
|
|
7
|
+
const pesquisaFetcher = require('./pesquisa-fetcher-b3f1d550.js');
|
|
8
8
|
require('./DataFetcher-65879b2c.js');
|
|
9
9
|
require('./index-1dfc7a6e.js');
|
|
10
10
|
require('./ISave-e91b70a7.js');
|
|
@@ -13,12 +13,13 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
|
13
13
|
require('./dataunit-fetcher-8ea97d88.js');
|
|
14
14
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
15
15
|
require('./form-config-fetcher-90126e4c.js');
|
|
16
|
+
const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
|
|
16
17
|
require('./PrintUtils-bcaeb82f.js');
|
|
17
18
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
18
19
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
19
20
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
20
21
|
|
|
21
|
-
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)
|
|
22
|
+
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)}";
|
|
22
23
|
|
|
23
24
|
const SnkPesquisa = class {
|
|
24
25
|
constructor(hostRef) {
|
|
@@ -37,7 +38,6 @@ const SnkPesquisa = class {
|
|
|
37
38
|
this._itemList = undefined;
|
|
38
39
|
this._startLoading = false;
|
|
39
40
|
this._presentationMode = "list";
|
|
40
|
-
this._currentView = undefined;
|
|
41
41
|
this.searchLoader = undefined;
|
|
42
42
|
this.treeLoader = undefined;
|
|
43
43
|
this.selectItem = undefined;
|
|
@@ -340,29 +340,25 @@ const SnkPesquisa = class {
|
|
|
340
340
|
}
|
|
341
341
|
async componentDidLoad() {
|
|
342
342
|
core.ElementIDUtils.addIDInfo(this._element);
|
|
343
|
-
await this.chooseViewMode();
|
|
344
343
|
}
|
|
345
|
-
async
|
|
344
|
+
async onClickList() {
|
|
346
345
|
this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
|
|
347
|
-
await this.chooseViewMode();
|
|
348
346
|
await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
|
|
349
347
|
}
|
|
350
|
-
|
|
351
|
-
var _a
|
|
352
|
-
|
|
353
|
-
await ((_a = this._viewStack) === null || _a === void 0 ? void 0 : _a.show(pesquisaFetcher.PESQUISA_VIEW_MODE.GRID));
|
|
354
|
-
this._currentView = pesquisaFetcher.PESQUISA_VIEW_MODE.GRID;
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
const view = this.isHierarchyEntity ? pesquisaFetcher.PESQUISA_VIEW_MODE.TREE : pesquisaFetcher.PESQUISA_VIEW_MODE.CARDS;
|
|
358
|
-
await ((_b = this._viewStack) === null || _b === void 0 ? void 0 : _b.show(view));
|
|
359
|
-
this._currentView = view;
|
|
348
|
+
enableListButton() {
|
|
349
|
+
var _a;
|
|
350
|
+
return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
360
351
|
}
|
|
361
352
|
//Os limites de exibição são diferentes para lista e grade
|
|
362
353
|
hideLimitMessage() {
|
|
363
354
|
if (!this._itemList)
|
|
364
355
|
return true;
|
|
365
|
-
|
|
356
|
+
if (this._presentationMode === "list") {
|
|
357
|
+
if (this.isHierarchyEntity)
|
|
358
|
+
return true;
|
|
359
|
+
return this._itemList.length <= 100;
|
|
360
|
+
}
|
|
361
|
+
return this._itemList.length <= 150;
|
|
366
362
|
}
|
|
367
363
|
hideRecordsMessage() {
|
|
368
364
|
return (this._presentationMode === "list" && this.isHierarchyEntity);
|
|
@@ -385,13 +381,30 @@ const SnkPesquisa = class {
|
|
|
385
381
|
title: 'Modo lista',
|
|
386
382
|
};
|
|
387
383
|
}
|
|
384
|
+
renderContent() {
|
|
385
|
+
if (!this._itemList)
|
|
386
|
+
return;
|
|
387
|
+
if (this._presentationMode === 'list') {
|
|
388
|
+
return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
|
|
389
|
+
}
|
|
390
|
+
return this.renderPesquisaGrid();
|
|
391
|
+
}
|
|
392
|
+
renderTree() {
|
|
393
|
+
return index.h("ez-scroller", { direction: EzScrollDirection.EzScrollDirection.VERTICAL }, index.h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) }));
|
|
394
|
+
}
|
|
395
|
+
renderCards() {
|
|
396
|
+
return (index.h("ez-scroller", { direction: EzScrollDirection.EzScrollDirection.VERTICAL }, index.h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
|
|
397
|
+
return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
398
|
+
}))));
|
|
399
|
+
}
|
|
400
|
+
renderPesquisaGrid() {
|
|
401
|
+
return index.h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
|
|
402
|
+
}
|
|
388
403
|
render() {
|
|
389
|
-
var _a
|
|
404
|
+
var _a;
|
|
390
405
|
return (index.h(index.Host, null, index.h("div", { class: "snk-pesquisa" }, index.h("div", { class: "snk-pesquisa__input" }, index.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" }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
|
|
391
406
|
? index.h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
|
|
392
|
-
: undefined), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), index.h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.
|
|
393
|
-
return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
394
|
-
}))), index.h("stack-item", null, index.h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, shouldLoadTree: this._currentView === pesquisaFetcher.PESQUISA_VIEW_MODE.TREE, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) })))))));
|
|
407
|
+
: undefined), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), index.h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.onClickList(), enabled: this.enableListButton() })), index.h("div", { class: "snk-pesquisa__records-label" }, index.h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), index.h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), index.h("div", { class: "snk-pesquisa__content" }, this.renderContent()))));
|
|
395
408
|
}
|
|
396
409
|
get _element() { return index.getElement(this); }
|
|
397
410
|
static get watchers() { return {
|
|
@@ -8,8 +8,8 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
|
8
8
|
const constants = require('./constants-35ddd366.js');
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
|
10
10
|
require('./DataFetcher-65879b2c.js');
|
|
11
|
-
require('./pesquisa-fetcher-
|
|
12
|
-
const ContinuousInsertUtils = require('./ContinuousInsertUtils-
|
|
11
|
+
require('./pesquisa-fetcher-b3f1d550.js');
|
|
12
|
+
const ContinuousInsertUtils = require('./ContinuousInsertUtils-14107ec6.js');
|
|
13
13
|
const index = require('./index-1dfc7a6e.js');
|
|
14
14
|
require('./ISave-e91b70a7.js');
|
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
@@ -9,31 +9,21 @@ export class PesquisaGrid {
|
|
|
9
9
|
this.pkField = undefined;
|
|
10
10
|
this.descriptionField = undefined;
|
|
11
11
|
this.entityName = undefined;
|
|
12
|
-
this.shouldLoadConfig = false;
|
|
13
|
-
this._gridConfig = undefined;
|
|
14
12
|
this._inMemoryLoader = undefined;
|
|
15
13
|
this._dataunit = undefined;
|
|
14
|
+
this._gridConfig = undefined;
|
|
16
15
|
}
|
|
17
16
|
observeDataSource(newValue) {
|
|
18
17
|
if (!this._inMemoryLoader || !this._dataunit || !newValue)
|
|
19
18
|
return;
|
|
20
19
|
this._inMemoryLoader.records = [...newValue];
|
|
21
20
|
}
|
|
22
|
-
|
|
21
|
+
async componentWillLoad() {
|
|
23
22
|
this.initializeDataUnit();
|
|
24
|
-
}
|
|
25
|
-
async observeShouldLoadConfig(newValue) {
|
|
26
|
-
if (!newValue || this._gridConfig)
|
|
27
|
-
return;
|
|
28
|
-
await this.loadGridConfig();
|
|
29
|
-
}
|
|
30
|
-
async loadGridConfig() {
|
|
31
23
|
this._gridConfig = await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName);
|
|
32
24
|
}
|
|
33
25
|
initializeDataUnit() {
|
|
34
26
|
var _a;
|
|
35
|
-
if (!this.metadata)
|
|
36
|
-
return;
|
|
37
27
|
this._inMemoryLoader = new InMemoryLoader(this.metadata, (_a = this.dataSource) !== null && _a !== void 0 ? _a : []);
|
|
38
28
|
this._dataunit = this._inMemoryLoader.dataUnit;
|
|
39
29
|
this._dataunit.pageSize = 0;
|
|
@@ -51,8 +41,6 @@ export class PesquisaGrid {
|
|
|
51
41
|
await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName, columns);
|
|
52
42
|
}
|
|
53
43
|
render() {
|
|
54
|
-
if (!this.metadata || !this._dataunit)
|
|
55
|
-
return;
|
|
56
44
|
return (h(Host, null, h("ez-grid", { dataUnit: this._dataunit, config: this._gridConfig, canEdit: false, suppressCheckboxColumn: true, compact: true, autoFocus: false, onEzDoubleClick: ({ detail }) => this.handleDbClick(detail), onConfigChange: async (event) => this.handleConfigChanged(event) })));
|
|
57
45
|
}
|
|
58
46
|
static get is() { return "pesquisa-grid"; }
|
|
@@ -160,32 +148,14 @@ export class PesquisaGrid {
|
|
|
160
148
|
},
|
|
161
149
|
"attribute": "entity-name",
|
|
162
150
|
"reflect": false
|
|
163
|
-
},
|
|
164
|
-
"shouldLoadConfig": {
|
|
165
|
-
"type": "boolean",
|
|
166
|
-
"mutable": false,
|
|
167
|
-
"complexType": {
|
|
168
|
-
"original": "boolean",
|
|
169
|
-
"resolved": "boolean",
|
|
170
|
-
"references": {}
|
|
171
|
-
},
|
|
172
|
-
"required": false,
|
|
173
|
-
"optional": false,
|
|
174
|
-
"docs": {
|
|
175
|
-
"tags": [],
|
|
176
|
-
"text": "Define se deve carregar configura\u00E7\u00F5es da grade"
|
|
177
|
-
},
|
|
178
|
-
"attribute": "should-load-config",
|
|
179
|
-
"reflect": false,
|
|
180
|
-
"defaultValue": "false"
|
|
181
151
|
}
|
|
182
152
|
};
|
|
183
153
|
}
|
|
184
154
|
static get states() {
|
|
185
155
|
return {
|
|
186
|
-
"_gridConfig": {},
|
|
187
156
|
"_inMemoryLoader": {},
|
|
188
|
-
"_dataunit": {}
|
|
157
|
+
"_dataunit": {},
|
|
158
|
+
"_gridConfig": {}
|
|
189
159
|
};
|
|
190
160
|
}
|
|
191
161
|
static get events() {
|
|
@@ -205,7 +175,7 @@ export class PesquisaGrid {
|
|
|
205
175
|
"references": {
|
|
206
176
|
"IOption": {
|
|
207
177
|
"location": "import",
|
|
208
|
-
"path": "@sankhyalabs/ezui/
|
|
178
|
+
"path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-combo-box/ez-combo-box"
|
|
209
179
|
}
|
|
210
180
|
}
|
|
211
181
|
}
|
|
@@ -215,12 +185,6 @@ export class PesquisaGrid {
|
|
|
215
185
|
return [{
|
|
216
186
|
"propName": "dataSource",
|
|
217
187
|
"methodName": "observeDataSource"
|
|
218
|
-
}, {
|
|
219
|
-
"propName": "metadata",
|
|
220
|
-
"methodName": "observeMetadata"
|
|
221
|
-
}, {
|
|
222
|
-
"propName": "shouldLoadConfig",
|
|
223
|
-
"methodName": "observeShouldLoadConfig"
|
|
224
188
|
}];
|
|
225
189
|
}
|
|
226
190
|
}
|
|
@@ -8,11 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
background: var(--background--xlight, #FFF);
|
|
10
10
|
position: relative;
|
|
11
|
+
display: inline-block;
|
|
11
12
|
min-height: var(--snk-pesquisa--tree__min-height);
|
|
12
|
-
|
|
13
|
-
height: 100%;
|
|
14
|
-
display: block;
|
|
15
|
-
overflow-y: auto;
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
:host:hover .actions-container{
|
|
@@ -5,20 +5,12 @@ export class PesquisaTree {
|
|
|
5
5
|
this.treeLoader = undefined;
|
|
6
6
|
this.argument = undefined;
|
|
7
7
|
this.allowsNonAnalytic = false;
|
|
8
|
-
this.shouldLoadTree = false;
|
|
9
8
|
this.items = [];
|
|
10
9
|
}
|
|
11
10
|
async applyFilter() {
|
|
12
11
|
await this._tree.applyFilter(this.argument);
|
|
13
12
|
}
|
|
14
|
-
async observeShouldLoadTree(newValue) {
|
|
15
|
-
if (!newValue || this.items.length > 0)
|
|
16
|
-
return;
|
|
17
|
-
await this.loadTree();
|
|
18
|
-
}
|
|
19
13
|
async loadTree() {
|
|
20
|
-
if (!this.shouldLoadTree)
|
|
21
|
-
return;
|
|
22
14
|
if (!this.treeLoader || typeof this.treeLoader !== 'function')
|
|
23
15
|
return;
|
|
24
16
|
const response = await this.treeLoader((this.argument || '').trim());
|
|
@@ -47,13 +39,16 @@ export class PesquisaTree {
|
|
|
47
39
|
};
|
|
48
40
|
this.pesquisaTreeSelectItem.emit(option);
|
|
49
41
|
}
|
|
50
|
-
|
|
42
|
+
async componentWillLoad() {
|
|
43
|
+
await this.loadTree();
|
|
44
|
+
}
|
|
45
|
+
renderEmptyMessate() {
|
|
51
46
|
return (h("div", { class: "ez-flex ez-flex--justify-center ez-flex--align-items-center ez-margin--large ez-text ez-text--xlarge ez-text--secondary" }, h("span", null, "Nenhum registro encontrado...")));
|
|
52
47
|
}
|
|
53
48
|
render() {
|
|
54
49
|
var _a;
|
|
55
50
|
return (h(Host, null, !((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) ?
|
|
56
|
-
this.
|
|
51
|
+
this.renderEmptyMessate() :
|
|
57
52
|
h(Fragment, null, h("div", { class: 'actions-container' }, h("ez-button", { size: 'small', mode: 'icon', class: 'ez-margin-right--small', iconName: 'show-list', title: "Expandir", onClick: () => this.handleExpandAll() }), h("ez-button", { size: 'small', mode: 'icon', iconName: 'hide-list', title: "Recolher", onClick: () => this.handleCloseAll() })), h("ez-tree", { ref: (element) => this._tree = element, onEzDbClickItem: ({ detail }) => this.handleDbClick(detail), items: this.items }))));
|
|
58
53
|
}
|
|
59
54
|
static get is() { return "pesquisa-tree"; }
|
|
@@ -85,7 +80,7 @@ export class PesquisaTree {
|
|
|
85
80
|
},
|
|
86
81
|
"ITreeItem": {
|
|
87
82
|
"location": "import",
|
|
88
|
-
"path": "@sankhyalabs/ezui/
|
|
83
|
+
"path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-tree/interfaces/ITreeItem"
|
|
89
84
|
}
|
|
90
85
|
}
|
|
91
86
|
},
|
|
@@ -130,24 +125,6 @@ export class PesquisaTree {
|
|
|
130
125
|
"attribute": "allows-non-analytic",
|
|
131
126
|
"reflect": false,
|
|
132
127
|
"defaultValue": "false"
|
|
133
|
-
},
|
|
134
|
-
"shouldLoadTree": {
|
|
135
|
-
"type": "boolean",
|
|
136
|
-
"mutable": false,
|
|
137
|
-
"complexType": {
|
|
138
|
-
"original": "boolean",
|
|
139
|
-
"resolved": "boolean",
|
|
140
|
-
"references": {}
|
|
141
|
-
},
|
|
142
|
-
"required": false,
|
|
143
|
-
"optional": false,
|
|
144
|
-
"docs": {
|
|
145
|
-
"tags": [],
|
|
146
|
-
"text": "Informa se a \u00E1rvore hier\u00E1rquica deve ou n\u00E3o ser carregada."
|
|
147
|
-
},
|
|
148
|
-
"attribute": "should-load-tree",
|
|
149
|
-
"reflect": false,
|
|
150
|
-
"defaultValue": "false"
|
|
151
128
|
}
|
|
152
129
|
};
|
|
153
130
|
}
|
|
@@ -173,7 +150,7 @@ export class PesquisaTree {
|
|
|
173
150
|
"references": {
|
|
174
151
|
"IOption": {
|
|
175
152
|
"location": "import",
|
|
176
|
-
"path": "@sankhyalabs/ezui/
|
|
153
|
+
"path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-combo-box/ez-combo-box"
|
|
177
154
|
}
|
|
178
155
|
}
|
|
179
156
|
}
|
|
@@ -199,10 +176,4 @@ export class PesquisaTree {
|
|
|
199
176
|
}
|
|
200
177
|
};
|
|
201
178
|
}
|
|
202
|
-
static get watchers() {
|
|
203
|
-
return [{
|
|
204
|
-
"propName": "shouldLoadTree",
|
|
205
|
-
"methodName": "observeShouldLoadTree"
|
|
206
|
-
}];
|
|
207
|
-
}
|
|
208
179
|
}
|
|
@@ -30,7 +30,7 @@ function bildProperties(field) {
|
|
|
30
30
|
}
|
|
31
31
|
function buildMask(field) {
|
|
32
32
|
const fieldUI = field['uiType'];
|
|
33
|
-
return fieldUI ? String(fieldUI).toLowerCase() : undefined;
|
|
33
|
+
return fieldUI ? field['type'] === "I" ? parseInt(fieldUI) : String(fieldUI).toLowerCase() : undefined;
|
|
34
34
|
}
|
|
35
35
|
function buildOptions(field) {
|
|
36
36
|
const optionsJson = field.options;
|
|
@@ -55,6 +55,8 @@ function buildUserInterface(field) {
|
|
|
55
55
|
return UserInterface.DATETIME;
|
|
56
56
|
if (field['type'] === 'T')
|
|
57
57
|
return UserInterface.TIME;
|
|
58
|
+
if (field['type'] === 'I')
|
|
59
|
+
return UserInterface.INTEGERNUMBER;
|
|
58
60
|
return undefined;
|
|
59
61
|
}
|
|
60
62
|
function buildDataType(rawType) {
|
|
@@ -87,9 +89,3 @@ export function parseGridConfig(rawConfig) {
|
|
|
87
89
|
return undefined;
|
|
88
90
|
return { columns };
|
|
89
91
|
}
|
|
90
|
-
export var PESQUISA_VIEW_MODE;
|
|
91
|
-
(function (PESQUISA_VIEW_MODE) {
|
|
92
|
-
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["GRID"] = 0] = "GRID";
|
|
93
|
-
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["CARDS"] = 1] = "CARDS";
|
|
94
|
-
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["TREE"] = 2] = "TREE";
|
|
95
|
-
})(PESQUISA_VIEW_MODE || (PESQUISA_VIEW_MODE = {}));
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
/*public*/
|
|
80
80
|
scrollbar-color: var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);
|
|
81
81
|
padding-right: var(--snk-pesquisa__content--padding-right);
|
|
82
|
-
height: 100vh;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
.snk-pesquisa__content::-webkit-scrollbar {
|
|
@@ -126,10 +125,6 @@
|
|
|
126
125
|
padding-top: var(--snk-pesquisa__records--padding-vertical);
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
.snk-pesquisa__records-label.hidden{
|
|
130
|
-
display: none;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
128
|
.snk-pesquisa__records {
|
|
134
129
|
color: var(--snk-pesquisa__records--color);
|
|
135
130
|
}
|
|
@@ -171,8 +166,3 @@
|
|
|
171
166
|
/*public*/
|
|
172
167
|
color: var(--snk-pesquisa__btn-hover--color);
|
|
173
168
|
}
|
|
174
|
-
|
|
175
|
-
.snk-pesquisa__cards-container{
|
|
176
|
-
height: 100%;
|
|
177
|
-
overflow-y: auto;
|
|
178
|
-
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ElementIDUtils, ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h, Host } from '@stencil/core';
|
|
3
|
-
import { buildGridMetadata
|
|
3
|
+
import { buildGridMetadata } from './pesquisaHelper';
|
|
4
4
|
import { PesquisaFetcher } from '../../lib';
|
|
5
|
+
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
|
5
6
|
export class SnkPesquisa {
|
|
6
7
|
constructor() {
|
|
7
8
|
this._mdByName = {};
|
|
@@ -18,7 +19,6 @@ export class SnkPesquisa {
|
|
|
18
19
|
this._itemList = undefined;
|
|
19
20
|
this._startLoading = false;
|
|
20
21
|
this._presentationMode = "list";
|
|
21
|
-
this._currentView = undefined;
|
|
22
22
|
this.searchLoader = undefined;
|
|
23
23
|
this.treeLoader = undefined;
|
|
24
24
|
this.selectItem = undefined;
|
|
@@ -321,29 +321,25 @@ export class SnkPesquisa {
|
|
|
321
321
|
}
|
|
322
322
|
async componentDidLoad() {
|
|
323
323
|
ElementIDUtils.addIDInfo(this._element);
|
|
324
|
-
await this.chooseViewMode();
|
|
325
324
|
}
|
|
326
|
-
async
|
|
325
|
+
async onClickList() {
|
|
327
326
|
this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
|
|
328
|
-
await this.chooseViewMode();
|
|
329
327
|
await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
|
|
330
328
|
}
|
|
331
|
-
|
|
332
|
-
var _a
|
|
333
|
-
|
|
334
|
-
await ((_a = this._viewStack) === null || _a === void 0 ? void 0 : _a.show(PESQUISA_VIEW_MODE.GRID));
|
|
335
|
-
this._currentView = PESQUISA_VIEW_MODE.GRID;
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
const view = this.isHierarchyEntity ? PESQUISA_VIEW_MODE.TREE : PESQUISA_VIEW_MODE.CARDS;
|
|
339
|
-
await ((_b = this._viewStack) === null || _b === void 0 ? void 0 : _b.show(view));
|
|
340
|
-
this._currentView = view;
|
|
329
|
+
enableListButton() {
|
|
330
|
+
var _a;
|
|
331
|
+
return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
341
332
|
}
|
|
342
333
|
//Os limites de exibição são diferentes para lista e grade
|
|
343
334
|
hideLimitMessage() {
|
|
344
335
|
if (!this._itemList)
|
|
345
336
|
return true;
|
|
346
|
-
|
|
337
|
+
if (this._presentationMode === "list") {
|
|
338
|
+
if (this.isHierarchyEntity)
|
|
339
|
+
return true;
|
|
340
|
+
return this._itemList.length <= 100;
|
|
341
|
+
}
|
|
342
|
+
return this._itemList.length <= 150;
|
|
347
343
|
}
|
|
348
344
|
hideRecordsMessage() {
|
|
349
345
|
return (this._presentationMode === "list" && this.isHierarchyEntity);
|
|
@@ -366,13 +362,30 @@ export class SnkPesquisa {
|
|
|
366
362
|
title: 'Modo lista',
|
|
367
363
|
};
|
|
368
364
|
}
|
|
365
|
+
renderContent() {
|
|
366
|
+
if (!this._itemList)
|
|
367
|
+
return;
|
|
368
|
+
if (this._presentationMode === 'list') {
|
|
369
|
+
return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
|
|
370
|
+
}
|
|
371
|
+
return this.renderPesquisaGrid();
|
|
372
|
+
}
|
|
373
|
+
renderTree() {
|
|
374
|
+
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) }));
|
|
375
|
+
}
|
|
376
|
+
renderCards() {
|
|
377
|
+
return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
|
|
378
|
+
return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
379
|
+
}))));
|
|
380
|
+
}
|
|
381
|
+
renderPesquisaGrid() {
|
|
382
|
+
return h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
|
|
383
|
+
}
|
|
369
384
|
render() {
|
|
370
|
-
var _a
|
|
385
|
+
var _a;
|
|
371
386
|
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)
|
|
372
387
|
? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
373
|
-
: 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.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.
|
|
374
|
-
return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
375
|
-
}))), h("stack-item", null, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, shouldLoadTree: this._currentView === PESQUISA_VIEW_MODE.TREE, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) })))))));
|
|
388
|
+
: 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.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, 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()))));
|
|
376
389
|
}
|
|
377
390
|
static get is() { return "snk-pesquisa"; }
|
|
378
391
|
static get encapsulation() { return "scoped"; }
|
|
@@ -522,8 +535,7 @@ export class SnkPesquisa {
|
|
|
522
535
|
return {
|
|
523
536
|
"_itemList": {},
|
|
524
537
|
"_startLoading": {},
|
|
525
|
-
"_presentationMode": {}
|
|
526
|
-
"_currentView": {}
|
|
538
|
+
"_presentationMode": {}
|
|
527
539
|
};
|
|
528
540
|
}
|
|
529
541
|
static get elementRef() { return "_element"; }
|
|
@@ -178,6 +178,7 @@ export class PesquisaFetcher {
|
|
|
178
178
|
buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
|
|
179
179
|
var _a, _b, _c;
|
|
180
180
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
181
|
+
console.log("criteria: ", criteria);
|
|
181
182
|
const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
|
|
182
183
|
const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
|
|
183
184
|
const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
|
package/dist/components/ISave.js
CHANGED
|
@@ -32,7 +32,7 @@ function bildProperties(field) {
|
|
|
32
32
|
}
|
|
33
33
|
function buildMask(field) {
|
|
34
34
|
const fieldUI = field['uiType'];
|
|
35
|
-
return fieldUI ? String(fieldUI).toLowerCase() : undefined;
|
|
35
|
+
return fieldUI ? field['type'] === "I" ? parseInt(fieldUI) : String(fieldUI).toLowerCase() : undefined;
|
|
36
36
|
}
|
|
37
37
|
function buildOptions(field) {
|
|
38
38
|
const optionsJson = field.options;
|
|
@@ -57,6 +57,8 @@ function buildUserInterface(field) {
|
|
|
57
57
|
return UserInterface.DATETIME;
|
|
58
58
|
if (field['type'] === 'T')
|
|
59
59
|
return UserInterface.TIME;
|
|
60
|
+
if (field['type'] === 'I')
|
|
61
|
+
return UserInterface.INTEGERNUMBER;
|
|
60
62
|
return undefined;
|
|
61
63
|
}
|
|
62
64
|
function buildDataType(rawType) {
|
|
@@ -89,12 +91,6 @@ function parseGridConfig(rawConfig) {
|
|
|
89
91
|
return undefined;
|
|
90
92
|
return { columns };
|
|
91
93
|
}
|
|
92
|
-
var PESQUISA_VIEW_MODE;
|
|
93
|
-
(function (PESQUISA_VIEW_MODE) {
|
|
94
|
-
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["GRID"] = 0] = "GRID";
|
|
95
|
-
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["CARDS"] = 1] = "CARDS";
|
|
96
|
-
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["TREE"] = 2] = "TREE";
|
|
97
|
-
})(PESQUISA_VIEW_MODE || (PESQUISA_VIEW_MODE = {}));
|
|
98
94
|
|
|
99
95
|
class PesquisaFetcher {
|
|
100
96
|
constructor() {
|
|
@@ -272,6 +268,7 @@ class PesquisaFetcher {
|
|
|
272
268
|
buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
|
|
273
269
|
var _a, _b, _c;
|
|
274
270
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
271
|
+
console.log("criteria: ", criteria);
|
|
275
272
|
const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
|
|
276
273
|
const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
|
|
277
274
|
const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
|
|
@@ -394,4 +391,4 @@ var SaveErrorsEnum;
|
|
|
394
391
|
SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
|
|
395
392
|
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
|
396
393
|
|
|
397
|
-
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d
|
|
394
|
+
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d };
|
|
@@ -8,7 +8,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
|
8
8
|
import './filter-item-type.enum.js';
|
|
9
9
|
import './form-config-fetcher.js';
|
|
10
10
|
|
|
11
|
-
const pesquisaGridCss = ".sc-pesquisa-grid-h{background:var(--background--xlight, #FFF);overflow-x:auto}ez-grid.sc-pesquisa-grid{--ez-grid__container--shadow:none;--ez-grid__header--shadow:none}";
|
|
11
|
+
const pesquisaGridCss = ".sc-pesquisa-grid-h{height:100vh;background:var(--background--xlight, #FFF);overflow-x:auto}ez-grid.sc-pesquisa-grid{--ez-grid__container--shadow:none;--ez-grid__header--shadow:none}";
|
|
12
12
|
|
|
13
13
|
const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
@@ -21,31 +21,21 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
21
21
|
this.pkField = undefined;
|
|
22
22
|
this.descriptionField = undefined;
|
|
23
23
|
this.entityName = undefined;
|
|
24
|
-
this.shouldLoadConfig = false;
|
|
25
|
-
this._gridConfig = undefined;
|
|
26
24
|
this._inMemoryLoader = undefined;
|
|
27
25
|
this._dataunit = undefined;
|
|
26
|
+
this._gridConfig = undefined;
|
|
28
27
|
}
|
|
29
28
|
observeDataSource(newValue) {
|
|
30
29
|
if (!this._inMemoryLoader || !this._dataunit || !newValue)
|
|
31
30
|
return;
|
|
32
31
|
this._inMemoryLoader.records = [...newValue];
|
|
33
32
|
}
|
|
34
|
-
|
|
33
|
+
async componentWillLoad() {
|
|
35
34
|
this.initializeDataUnit();
|
|
36
|
-
}
|
|
37
|
-
async observeShouldLoadConfig(newValue) {
|
|
38
|
-
if (!newValue || this._gridConfig)
|
|
39
|
-
return;
|
|
40
|
-
await this.loadGridConfig();
|
|
41
|
-
}
|
|
42
|
-
async loadGridConfig() {
|
|
43
35
|
this._gridConfig = await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName);
|
|
44
36
|
}
|
|
45
37
|
initializeDataUnit() {
|
|
46
38
|
var _a;
|
|
47
|
-
if (!this.metadata)
|
|
48
|
-
return;
|
|
49
39
|
this._inMemoryLoader = new InMemoryLoader(this.metadata, (_a = this.dataSource) !== null && _a !== void 0 ? _a : []);
|
|
50
40
|
this._dataunit = this._inMemoryLoader.dataUnit;
|
|
51
41
|
this._dataunit.pageSize = 0;
|
|
@@ -63,14 +53,10 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
63
53
|
await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName, columns);
|
|
64
54
|
}
|
|
65
55
|
render() {
|
|
66
|
-
if (!this.metadata || !this._dataunit)
|
|
67
|
-
return;
|
|
68
56
|
return (h(Host, null, h("ez-grid", { dataUnit: this._dataunit, config: this._gridConfig, canEdit: false, suppressCheckboxColumn: true, compact: true, autoFocus: false, onEzDoubleClick: ({ detail }) => this.handleDbClick(detail), onConfigChange: async (event) => this.handleConfigChanged(event) })));
|
|
69
57
|
}
|
|
70
58
|
static get watchers() { return {
|
|
71
|
-
"dataSource": ["observeDataSource"]
|
|
72
|
-
"metadata": ["observeMetadata"],
|
|
73
|
-
"shouldLoadConfig": ["observeShouldLoadConfig"]
|
|
59
|
+
"dataSource": ["observeDataSource"]
|
|
74
60
|
}; }
|
|
75
61
|
static get style() { return pesquisaGridCss; }
|
|
76
62
|
}, [2, "pesquisa-grid", {
|
|
@@ -79,10 +65,9 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
79
65
|
"pkField": [1, "pk-field"],
|
|
80
66
|
"descriptionField": [1, "description-field"],
|
|
81
67
|
"entityName": [1, "entity-name"],
|
|
82
|
-
"shouldLoadConfig": [4, "should-load-config"],
|
|
83
|
-
"_gridConfig": [32],
|
|
84
68
|
"_inMemoryLoader": [32],
|
|
85
|
-
"_dataunit": [32]
|
|
69
|
+
"_dataunit": [32],
|
|
70
|
+
"_gridConfig": [32]
|
|
86
71
|
}]);
|
|
87
72
|
function defineCustomElement() {
|
|
88
73
|
if (typeof customElements === "undefined") {
|