@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76031.0 → 0.0.0-bugfix-dev-KB-81146.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-54d44192.js → ContinuousInsertUtils-6e536e37.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-f3454c23.js → pesquisa-fetcher-3b86b6c4.js} +6 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +37 -9
- 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-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-b20b0cfd.js → snk-guides-viewer-84cb012b.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-pesquisa.cjs.entry.js +37 -32
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.css +1 -1
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +0 -1
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +41 -5
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +4 -1
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +41 -6
- package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +6 -0
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +10 -0
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +38 -32
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +0 -1
- package/dist/components/ISave.js +7 -2
- package/dist/components/pesquisa-grid2.js +21 -6
- package/dist/components/pesquisa-tree2.js +20 -5
- package/dist/components/snk-personalized-filter-editor.js +1 -1
- package/dist/components/snk-pesquisa2.js +39 -33
- package/dist/esm/{ContinuousInsertUtils-25e7bd9a.js → ContinuousInsertUtils-91011e01.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-0af41f09.js → pesquisa-fetcher-767abffa.js} +7 -2
- package/dist/esm/pesquisa-grid_2.entry.js +38 -10
- 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-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-94918cf7.js → snk-guides-viewer-45ee10ff.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-pesquisa.entry.js +37 -32
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-68134a67.entry.js → p-035c63df.entry.js} +1 -1
- package/dist/sankhyablocks/{p-469384a2.entry.js → p-03e37897.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4ca8e061.entry.js → p-0e6874ca.entry.js} +1 -1
- package/dist/sankhyablocks/{p-471785a1.entry.js → p-1bab295e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d92d4f91.entry.js → p-1c2d8a9a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-36967e1a.entry.js → p-47178038.entry.js} +1 -1
- package/dist/sankhyablocks/p-4fe8bb73.js +6 -0
- package/dist/sankhyablocks/{p-3150ad41.js → p-6cfa8913.js} +1 -1
- package/dist/sankhyablocks/{p-8bd86610.entry.js → p-6e0adddc.entry.js} +1 -1
- package/dist/sankhyablocks/p-81222caa.entry.js +1 -0
- package/dist/sankhyablocks/{p-16cc8640.entry.js → p-853074f4.entry.js} +3 -3
- package/dist/sankhyablocks/{p-3a3d4055.entry.js → p-935aa4fa.entry.js} +1 -1
- package/dist/sankhyablocks/{p-09067bee.entry.js → p-dd7fb984.entry.js} +1 -1
- package/dist/sankhyablocks/p-e74eb86d.entry.js +1 -0
- package/dist/sankhyablocks/{p-8a1ee5b5.js → p-ee759111.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +11 -5
- package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +8 -3
- package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +6 -1
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +6 -6
- package/dist/types/components.d.ts +18 -2
- package/package.json +1 -1
- package/dist/sankhyablocks/p-798386c7.js +0 -6
- package/dist/sankhyablocks/p-b50a0753.entry.js +0 -1
- package/dist/sankhyablocks/p-c475ac24.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-3b86b6c4.js');
|
|
8
8
|
require('./DataFetcher-65879b2c.js');
|
|
9
9
|
require('./index-1dfc7a6e.js');
|
|
10
10
|
require('./ISave-e91b70a7.js');
|
|
@@ -13,13 +13,12 @@ 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');
|
|
17
16
|
require('./PrintUtils-bcaeb82f.js');
|
|
18
17
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
19
18
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
20
19
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
21
20
|
|
|
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)}";
|
|
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);height:100vh}.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-label.hidden.sc-snk-pesquisa{display:none}.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)}.snk-pesquisa__cards-container.sc-snk-pesquisa{height:100%;overflow-y:auto}";
|
|
23
22
|
|
|
24
23
|
const SnkPesquisa = class {
|
|
25
24
|
constructor(hostRef) {
|
|
@@ -38,6 +37,7 @@ const SnkPesquisa = class {
|
|
|
38
37
|
this._itemList = undefined;
|
|
39
38
|
this._startLoading = false;
|
|
40
39
|
this._presentationMode = "list";
|
|
40
|
+
this._currentView = undefined;
|
|
41
41
|
this.searchLoader = undefined;
|
|
42
42
|
this.treeLoader = undefined;
|
|
43
43
|
this.selectItem = undefined;
|
|
@@ -340,53 +340,58 @@ const SnkPesquisa = class {
|
|
|
340
340
|
}
|
|
341
341
|
async componentDidLoad() {
|
|
342
342
|
core.ElementIDUtils.addIDInfo(this._element);
|
|
343
|
+
await this.chooseViewMode();
|
|
343
344
|
}
|
|
344
|
-
async
|
|
345
|
+
async handleChangeViewMode() {
|
|
345
346
|
this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
|
|
347
|
+
await this.chooseViewMode();
|
|
346
348
|
await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
|
|
347
349
|
}
|
|
348
|
-
|
|
349
|
-
var _a;
|
|
350
|
-
|
|
350
|
+
async chooseViewMode() {
|
|
351
|
+
var _a, _b;
|
|
352
|
+
if (this._presentationMode !== 'list') {
|
|
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;
|
|
351
360
|
}
|
|
352
361
|
//Os limites de exibição são diferentes para lista e grade
|
|
353
362
|
hideLimitMessage() {
|
|
354
|
-
if (!this._itemList)
|
|
363
|
+
if (!this._itemList || this.isHierarchyEntity)
|
|
355
364
|
return true;
|
|
356
|
-
|
|
357
|
-
if (this.isHierarchyEntity)
|
|
358
|
-
return true;
|
|
359
|
-
return this._itemList.length <= 100;
|
|
360
|
-
}
|
|
361
|
-
return this._itemList.length <= 150;
|
|
365
|
+
return this._itemList.length < 100;
|
|
362
366
|
}
|
|
363
367
|
hideRecordsMessage() {
|
|
364
368
|
return (this._presentationMode === "list" && this.isHierarchyEntity);
|
|
365
369
|
}
|
|
366
|
-
|
|
367
|
-
if (!this._itemList)
|
|
368
|
-
return;
|
|
370
|
+
getButtonModeInfo() {
|
|
369
371
|
if (this._presentationMode === 'list') {
|
|
370
|
-
return
|
|
372
|
+
return {
|
|
373
|
+
iconName: 'table',
|
|
374
|
+
title: 'Modo grade',
|
|
375
|
+
};
|
|
371
376
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
renderPesquisaGrid() {
|
|
383
|
-
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) });
|
|
377
|
+
if (this.isHierarchyEntity) {
|
|
378
|
+
return {
|
|
379
|
+
iconName: 'hierarchical-tree',
|
|
380
|
+
title: 'Modo árvore hierárquica',
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
iconName: 'list',
|
|
385
|
+
title: 'Modo lista',
|
|
386
|
+
};
|
|
384
387
|
}
|
|
385
388
|
render() {
|
|
386
|
-
var _a;
|
|
389
|
+
var _a, _b;
|
|
387
390
|
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)
|
|
388
391
|
? index.h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
|
|
389
|
-
: 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.
|
|
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.handleChangeViewMode() })), index.h("div", { class: `snk-pesquisa__records-label ${this._currentView === pesquisaFetcher.PESQUISA_VIEW_MODE.TREE ? 'hidden' : ''}` }, 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" }, index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, shouldLoadConfig: this._currentView === pesquisaFetcher.PESQUISA_VIEW_MODE.GRID, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) })), index.h("stack-item", null, index.h("div", { class: 'snk-pesquisa__cards-container' }, (_b = this._itemList) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
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) })))))));
|
|
390
395
|
}
|
|
391
396
|
get _element() { return index.getElement(this); }
|
|
392
397
|
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-3b86b6c4.js');
|
|
12
|
+
const ContinuousInsertUtils = require('./ContinuousInsertUtils-6e536e37.js');
|
|
13
13
|
const index = require('./index-1dfc7a6e.js');
|
|
14
14
|
require('./ISave-e91b70a7.js');
|
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*@doc Define um valor personalizado para a altura*/
|
|
3
3
|
--snk-filter-personalized__max-height: 21;
|
|
4
4
|
/*@doc Define um valor personalizado para a largura*/
|
|
5
|
-
--snk-filter-personalized__max-width: 21;
|
|
5
|
+
--snk-filter-personalized__max-width: 21.5;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.SnkFilterPersonalized_list-container {
|
|
@@ -9,21 +9,31 @@ 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;
|
|
12
14
|
this._inMemoryLoader = undefined;
|
|
13
15
|
this._dataunit = undefined;
|
|
14
|
-
this._gridConfig = undefined;
|
|
15
16
|
}
|
|
16
17
|
observeDataSource(newValue) {
|
|
17
18
|
if (!this._inMemoryLoader || !this._dataunit || !newValue)
|
|
18
19
|
return;
|
|
19
20
|
this._inMemoryLoader.records = [...newValue];
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
observeMetadata() {
|
|
22
23
|
this.initializeDataUnit();
|
|
24
|
+
}
|
|
25
|
+
async observeShouldLoadConfig(newValue) {
|
|
26
|
+
if (!newValue || this._gridConfig)
|
|
27
|
+
return;
|
|
28
|
+
await this.loadGridConfig();
|
|
29
|
+
}
|
|
30
|
+
async loadGridConfig() {
|
|
23
31
|
this._gridConfig = await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName);
|
|
24
32
|
}
|
|
25
33
|
initializeDataUnit() {
|
|
26
34
|
var _a;
|
|
35
|
+
if (!this.metadata)
|
|
36
|
+
return;
|
|
27
37
|
this._inMemoryLoader = new InMemoryLoader(this.metadata, (_a = this.dataSource) !== null && _a !== void 0 ? _a : []);
|
|
28
38
|
this._dataunit = this._inMemoryLoader.dataUnit;
|
|
29
39
|
this._dataunit.pageSize = 0;
|
|
@@ -41,6 +51,8 @@ export class PesquisaGrid {
|
|
|
41
51
|
await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName, columns);
|
|
42
52
|
}
|
|
43
53
|
render() {
|
|
54
|
+
if (!this.metadata || !this._dataunit)
|
|
55
|
+
return;
|
|
44
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) })));
|
|
45
57
|
}
|
|
46
58
|
static get is() { return "pesquisa-grid"; }
|
|
@@ -148,14 +160,32 @@ export class PesquisaGrid {
|
|
|
148
160
|
},
|
|
149
161
|
"attribute": "entity-name",
|
|
150
162
|
"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"
|
|
151
181
|
}
|
|
152
182
|
};
|
|
153
183
|
}
|
|
154
184
|
static get states() {
|
|
155
185
|
return {
|
|
186
|
+
"_gridConfig": {},
|
|
156
187
|
"_inMemoryLoader": {},
|
|
157
|
-
"_dataunit": {}
|
|
158
|
-
"_gridConfig": {}
|
|
188
|
+
"_dataunit": {}
|
|
159
189
|
};
|
|
160
190
|
}
|
|
161
191
|
static get events() {
|
|
@@ -175,7 +205,7 @@ export class PesquisaGrid {
|
|
|
175
205
|
"references": {
|
|
176
206
|
"IOption": {
|
|
177
207
|
"location": "import",
|
|
178
|
-
"path": "@sankhyalabs/ezui
|
|
208
|
+
"path": "@sankhyalabs/ezui/src/components/ez-search/ez-search"
|
|
179
209
|
}
|
|
180
210
|
}
|
|
181
211
|
}
|
|
@@ -185,6 +215,12 @@ export class PesquisaGrid {
|
|
|
185
215
|
return [{
|
|
186
216
|
"propName": "dataSource",
|
|
187
217
|
"methodName": "observeDataSource"
|
|
218
|
+
}, {
|
|
219
|
+
"propName": "metadata",
|
|
220
|
+
"methodName": "observeMetadata"
|
|
221
|
+
}, {
|
|
222
|
+
"propName": "shouldLoadConfig",
|
|
223
|
+
"methodName": "observeShouldLoadConfig"
|
|
188
224
|
}];
|
|
189
225
|
}
|
|
190
226
|
}
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
background: var(--background--xlight, #FFF);
|
|
10
10
|
position: relative;
|
|
11
|
-
display: inline-block;
|
|
12
11
|
min-height: var(--snk-pesquisa--tree__min-height);
|
|
12
|
+
|
|
13
|
+
height: 100%;
|
|
14
|
+
display: block;
|
|
15
|
+
overflow-y: auto;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
:host:hover .actions-container{
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { h, Host } from '@stencil/core';
|
|
1
|
+
import { Fragment, h, Host } from '@stencil/core';
|
|
2
2
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
3
|
export class PesquisaTree {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.treeLoader = undefined;
|
|
6
6
|
this.argument = undefined;
|
|
7
7
|
this.allowsNonAnalytic = false;
|
|
8
|
+
this.shouldLoadTree = false;
|
|
8
9
|
this.items = [];
|
|
9
10
|
}
|
|
10
11
|
async applyFilter() {
|
|
11
12
|
await this._tree.applyFilter(this.argument);
|
|
12
13
|
}
|
|
14
|
+
async observeShouldLoadTree(newValue) {
|
|
15
|
+
if (!newValue || this.items.length > 0)
|
|
16
|
+
return;
|
|
17
|
+
await this.loadTree();
|
|
18
|
+
}
|
|
13
19
|
async loadTree() {
|
|
20
|
+
if (!this.shouldLoadTree)
|
|
21
|
+
return;
|
|
14
22
|
if (!this.treeLoader || typeof this.treeLoader !== 'function')
|
|
15
23
|
return;
|
|
16
24
|
const response = await this.treeLoader((this.argument || '').trim());
|
|
@@ -39,11 +47,14 @@ export class PesquisaTree {
|
|
|
39
47
|
};
|
|
40
48
|
this.pesquisaTreeSelectItem.emit(option);
|
|
41
49
|
}
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
renderEmptyMessage() {
|
|
51
|
+
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...")));
|
|
44
52
|
}
|
|
45
53
|
render() {
|
|
46
|
-
|
|
54
|
+
var _a;
|
|
55
|
+
return (h(Host, null, !((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) ?
|
|
56
|
+
this.renderEmptyMessage() :
|
|
57
|
+
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 }))));
|
|
47
58
|
}
|
|
48
59
|
static get is() { return "pesquisa-tree"; }
|
|
49
60
|
static get encapsulation() { return "scoped"; }
|
|
@@ -74,7 +85,7 @@ export class PesquisaTree {
|
|
|
74
85
|
},
|
|
75
86
|
"ITreeItem": {
|
|
76
87
|
"location": "import",
|
|
77
|
-
"path": "@sankhyalabs/ezui
|
|
88
|
+
"path": "@sankhyalabs/ezui/src/components/ez-tree/interfaces/ITreeItem"
|
|
78
89
|
}
|
|
79
90
|
}
|
|
80
91
|
},
|
|
@@ -119,6 +130,24 @@ export class PesquisaTree {
|
|
|
119
130
|
"attribute": "allows-non-analytic",
|
|
120
131
|
"reflect": false,
|
|
121
132
|
"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"
|
|
122
151
|
}
|
|
123
152
|
};
|
|
124
153
|
}
|
|
@@ -144,7 +173,7 @@ export class PesquisaTree {
|
|
|
144
173
|
"references": {
|
|
145
174
|
"IOption": {
|
|
146
175
|
"location": "import",
|
|
147
|
-
"path": "@sankhyalabs/ezui
|
|
176
|
+
"path": "@sankhyalabs/ezui/src/components/ez-search/ez-search"
|
|
148
177
|
}
|
|
149
178
|
}
|
|
150
179
|
}
|
|
@@ -170,4 +199,10 @@ export class PesquisaTree {
|
|
|
170
199
|
}
|
|
171
200
|
};
|
|
172
201
|
}
|
|
202
|
+
static get watchers() {
|
|
203
|
+
return [{
|
|
204
|
+
"propName": "shouldLoadTree",
|
|
205
|
+
"methodName": "observeShouldLoadTree"
|
|
206
|
+
}];
|
|
207
|
+
}
|
|
173
208
|
}
|
|
@@ -87,3 +87,9 @@ export function parseGridConfig(rawConfig) {
|
|
|
87
87
|
return undefined;
|
|
88
88
|
return { columns };
|
|
89
89
|
}
|
|
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,6 +79,7 @@
|
|
|
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;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
.snk-pesquisa__content::-webkit-scrollbar {
|
|
@@ -125,6 +126,10 @@
|
|
|
125
126
|
padding-top: var(--snk-pesquisa__records--padding-vertical);
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
.snk-pesquisa__records-label.hidden{
|
|
130
|
+
display: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
128
133
|
.snk-pesquisa__records {
|
|
129
134
|
color: var(--snk-pesquisa__records--color);
|
|
130
135
|
}
|
|
@@ -166,3 +171,8 @@
|
|
|
166
171
|
/*public*/
|
|
167
172
|
color: var(--snk-pesquisa__btn-hover--color);
|
|
168
173
|
}
|
|
174
|
+
|
|
175
|
+
.snk-pesquisa__cards-container{
|
|
176
|
+
height: 100%;
|
|
177
|
+
overflow-y: auto;
|
|
178
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ElementIDUtils, ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h, Host } from '@stencil/core';
|
|
3
|
-
import { buildGridMetadata } from './pesquisaHelper';
|
|
3
|
+
import { buildGridMetadata, PESQUISA_VIEW_MODE } from './pesquisaHelper';
|
|
4
4
|
import { PesquisaFetcher } from '../../lib';
|
|
5
|
-
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
|
6
5
|
export class SnkPesquisa {
|
|
7
6
|
constructor() {
|
|
8
7
|
this._mdByName = {};
|
|
@@ -19,6 +18,7 @@ export class SnkPesquisa {
|
|
|
19
18
|
this._itemList = undefined;
|
|
20
19
|
this._startLoading = false;
|
|
21
20
|
this._presentationMode = "list";
|
|
21
|
+
this._currentView = undefined;
|
|
22
22
|
this.searchLoader = undefined;
|
|
23
23
|
this.treeLoader = undefined;
|
|
24
24
|
this.selectItem = undefined;
|
|
@@ -321,53 +321,58 @@ export class SnkPesquisa {
|
|
|
321
321
|
}
|
|
322
322
|
async componentDidLoad() {
|
|
323
323
|
ElementIDUtils.addIDInfo(this._element);
|
|
324
|
+
await this.chooseViewMode();
|
|
324
325
|
}
|
|
325
|
-
async
|
|
326
|
+
async handleChangeViewMode() {
|
|
326
327
|
this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
|
|
328
|
+
await this.chooseViewMode();
|
|
327
329
|
await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
|
|
328
330
|
}
|
|
329
|
-
|
|
330
|
-
var _a;
|
|
331
|
-
|
|
331
|
+
async chooseViewMode() {
|
|
332
|
+
var _a, _b;
|
|
333
|
+
if (this._presentationMode !== 'list') {
|
|
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;
|
|
332
341
|
}
|
|
333
342
|
//Os limites de exibição são diferentes para lista e grade
|
|
334
343
|
hideLimitMessage() {
|
|
335
|
-
if (!this._itemList)
|
|
344
|
+
if (!this._itemList || this.isHierarchyEntity)
|
|
336
345
|
return true;
|
|
337
|
-
|
|
338
|
-
if (this.isHierarchyEntity)
|
|
339
|
-
return true;
|
|
340
|
-
return this._itemList.length <= 100;
|
|
341
|
-
}
|
|
342
|
-
return this._itemList.length <= 150;
|
|
346
|
+
return this._itemList.length < 100;
|
|
343
347
|
}
|
|
344
348
|
hideRecordsMessage() {
|
|
345
349
|
return (this._presentationMode === "list" && this.isHierarchyEntity);
|
|
346
350
|
}
|
|
347
|
-
|
|
348
|
-
if (!this._itemList)
|
|
349
|
-
return;
|
|
351
|
+
getButtonModeInfo() {
|
|
350
352
|
if (this._presentationMode === 'list') {
|
|
351
|
-
return
|
|
353
|
+
return {
|
|
354
|
+
iconName: 'table',
|
|
355
|
+
title: 'Modo grade',
|
|
356
|
+
};
|
|
352
357
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
renderPesquisaGrid() {
|
|
364
|
-
return h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
|
|
358
|
+
if (this.isHierarchyEntity) {
|
|
359
|
+
return {
|
|
360
|
+
iconName: 'hierarchical-tree',
|
|
361
|
+
title: 'Modo árvore hierárquica',
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
return {
|
|
365
|
+
iconName: 'list',
|
|
366
|
+
title: 'Modo lista',
|
|
367
|
+
};
|
|
365
368
|
}
|
|
366
369
|
render() {
|
|
367
|
-
var _a;
|
|
370
|
+
var _a, _b;
|
|
368
371
|
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)
|
|
369
372
|
? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
370
|
-
: 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.
|
|
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.handleChangeViewMode() })), h("div", { class: `snk-pesquisa__records-label ${this._currentView === PESQUISA_VIEW_MODE.TREE ? 'hidden' : ''}` }, 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" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, shouldLoadConfig: this._currentView === PESQUISA_VIEW_MODE.GRID, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) })), h("stack-item", null, h("div", { class: 'snk-pesquisa__cards-container' }, (_b = this._itemList) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
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) })))))));
|
|
371
376
|
}
|
|
372
377
|
static get is() { return "snk-pesquisa"; }
|
|
373
378
|
static get encapsulation() { return "scoped"; }
|
|
@@ -517,7 +522,8 @@ export class SnkPesquisa {
|
|
|
517
522
|
return {
|
|
518
523
|
"_itemList": {},
|
|
519
524
|
"_startLoading": {},
|
|
520
|
-
"_presentationMode": {}
|
|
525
|
+
"_presentationMode": {},
|
|
526
|
+
"_currentView": {}
|
|
521
527
|
};
|
|
522
528
|
}
|
|
523
529
|
static get elementRef() { return "_element"; }
|
|
@@ -178,7 +178,6 @@ 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);
|
|
182
181
|
const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
|
|
183
182
|
const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
|
|
184
183
|
const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
|
package/dist/components/ISave.js
CHANGED
|
@@ -89,6 +89,12 @@ function parseGridConfig(rawConfig) {
|
|
|
89
89
|
return undefined;
|
|
90
90
|
return { columns };
|
|
91
91
|
}
|
|
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 = {}));
|
|
92
98
|
|
|
93
99
|
class PesquisaFetcher {
|
|
94
100
|
constructor() {
|
|
@@ -266,7 +272,6 @@ class PesquisaFetcher {
|
|
|
266
272
|
buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
|
|
267
273
|
var _a, _b, _c;
|
|
268
274
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
269
|
-
console.log("criteria: ", criteria);
|
|
270
275
|
const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
|
|
271
276
|
const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
|
|
272
277
|
const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
|
|
@@ -389,4 +394,4 @@ var SaveErrorsEnum;
|
|
|
389
394
|
SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
|
|
390
395
|
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
|
391
396
|
|
|
392
|
-
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d };
|
|
397
|
+
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d, PESQUISA_VIEW_MODE as e };
|
|
@@ -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{
|
|
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}";
|
|
12
12
|
|
|
13
13
|
const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
@@ -21,21 +21,31 @@ 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;
|
|
24
26
|
this._inMemoryLoader = undefined;
|
|
25
27
|
this._dataunit = undefined;
|
|
26
|
-
this._gridConfig = undefined;
|
|
27
28
|
}
|
|
28
29
|
observeDataSource(newValue) {
|
|
29
30
|
if (!this._inMemoryLoader || !this._dataunit || !newValue)
|
|
30
31
|
return;
|
|
31
32
|
this._inMemoryLoader.records = [...newValue];
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
observeMetadata() {
|
|
34
35
|
this.initializeDataUnit();
|
|
36
|
+
}
|
|
37
|
+
async observeShouldLoadConfig(newValue) {
|
|
38
|
+
if (!newValue || this._gridConfig)
|
|
39
|
+
return;
|
|
40
|
+
await this.loadGridConfig();
|
|
41
|
+
}
|
|
42
|
+
async loadGridConfig() {
|
|
35
43
|
this._gridConfig = await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName);
|
|
36
44
|
}
|
|
37
45
|
initializeDataUnit() {
|
|
38
46
|
var _a;
|
|
47
|
+
if (!this.metadata)
|
|
48
|
+
return;
|
|
39
49
|
this._inMemoryLoader = new InMemoryLoader(this.metadata, (_a = this.dataSource) !== null && _a !== void 0 ? _a : []);
|
|
40
50
|
this._dataunit = this._inMemoryLoader.dataUnit;
|
|
41
51
|
this._dataunit.pageSize = 0;
|
|
@@ -53,10 +63,14 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
53
63
|
await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName, columns);
|
|
54
64
|
}
|
|
55
65
|
render() {
|
|
66
|
+
if (!this.metadata || !this._dataunit)
|
|
67
|
+
return;
|
|
56
68
|
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
69
|
}
|
|
58
70
|
static get watchers() { return {
|
|
59
|
-
"dataSource": ["observeDataSource"]
|
|
71
|
+
"dataSource": ["observeDataSource"],
|
|
72
|
+
"metadata": ["observeMetadata"],
|
|
73
|
+
"shouldLoadConfig": ["observeShouldLoadConfig"]
|
|
60
74
|
}; }
|
|
61
75
|
static get style() { return pesquisaGridCss; }
|
|
62
76
|
}, [2, "pesquisa-grid", {
|
|
@@ -65,9 +79,10 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
65
79
|
"pkField": [1, "pk-field"],
|
|
66
80
|
"descriptionField": [1, "description-field"],
|
|
67
81
|
"entityName": [1, "entity-name"],
|
|
82
|
+
"shouldLoadConfig": [4, "should-load-config"],
|
|
83
|
+
"_gridConfig": [32],
|
|
68
84
|
"_inMemoryLoader": [32],
|
|
69
|
-
"_dataunit": [32]
|
|
70
|
-
"_gridConfig": [32]
|
|
85
|
+
"_dataunit": [32]
|
|
71
86
|
}]);
|
|
72
87
|
function defineCustomElement() {
|
|
73
88
|
if (typeof customElements === "undefined") {
|