@sankhyalabs/sankhyablocks 8.9.0-dev.3 → 8.9.0-dev.5
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/{SnkMessageBuilder-0202c090.js → SnkMessageBuilder-fbc33123.js} +5 -4
- package/dist/cjs/{dataunit-fetcher-55f98541.js → dataunit-fetcher-a0079a6f.js} +2 -1
- package/dist/cjs/filterNumberVariation-d65332da.js +7 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-attach.cjs.entry.js +6 -4
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-bcfdd657.js → snk-data-unit-b949160d.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-bar.cjs.entry.js +71 -0
- package/dist/cjs/snk-filter-item.cjs.entry.js +15 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal.cjs.entry.js +8 -2
- package/dist/cjs/snk-filter-number.cjs.entry.js +41 -2
- package/dist/cjs/snk-filter-period.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-6dfeec5c.js → snk-guides-viewer-f7ef9607.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +1 -1
- package/dist/collection/components/snk-attach/structure/data-unit-builder.js +4 -1
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +33 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/enum/filterNumberVariation.js +5 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +93 -8
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +2 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +15 -2
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +8 -2
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +116 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +2 -1
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +5 -4
- package/dist/components/SnkMessageBuilder.js +5 -4
- package/dist/components/dataunit-fetcher.js +2 -1
- package/dist/components/filterNumberVariation.js +7 -0
- package/dist/components/snk-attach2.js +4 -2
- package/dist/components/snk-filter-bar2.js +75 -1
- package/dist/components/snk-filter-item2.js +15 -2
- package/dist/components/snk-filter-modal-item2.js +1 -1
- package/dist/components/snk-filter-modal.js +8 -2
- package/dist/components/snk-filter-number.js +43 -2
- package/dist/components/snk-filter-period.js +2 -2
- package/dist/esm/{SnkMessageBuilder-ba5d04d3.js → SnkMessageBuilder-f60c5443.js} +5 -4
- package/dist/esm/{dataunit-fetcher-6725cb0e.js → dataunit-fetcher-a2e763f3.js} +2 -1
- package/dist/esm/filterNumberVariation-8cee02ea.js +7 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-attach.entry.js +6 -4
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-ddd25458.js → snk-data-unit-ca945bf5.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +3 -3
- package/dist/esm/snk-filter-bar.entry.js +71 -0
- package/dist/esm/snk-filter-item.entry.js +15 -2
- package/dist/esm/snk-filter-modal-item.entry.js +1 -1
- package/dist/esm/snk-filter-modal.entry.js +8 -2
- package/dist/esm/snk-filter-number.entry.js +41 -2
- package/dist/esm/snk-filter-period.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-8b47f38c.js → snk-guides-viewer-9f5dfbcc.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +1 -1
- package/dist/sankhyablocks/{p-cab6a969.entry.js → p-1e8262a0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-deeba96a.js → p-210b4794.js} +1 -1
- package/dist/sankhyablocks/p-2640ba03.entry.js +1 -0
- package/dist/sankhyablocks/p-29529c8f.entry.js +1 -0
- package/dist/sankhyablocks/{p-47d20cb0.entry.js → p-32b0a5e1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e31d92cd.entry.js → p-51529d47.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e57c9958.entry.js → p-6a33f844.entry.js} +2 -2
- package/dist/sankhyablocks/{p-651b4f89.entry.js → p-6bdb1068.entry.js} +1 -1
- package/dist/sankhyablocks/{p-08fca9d1.js → p-80e9773f.js} +1 -1
- package/dist/sankhyablocks/{p-73407f35.js → p-839da75f.js} +1 -1
- package/dist/sankhyablocks/p-94c532bb.entry.js +1 -0
- package/dist/sankhyablocks/p-aa3b0d19.js +1 -0
- package/dist/sankhyablocks/{p-9531cb90.entry.js → p-b2ce189a.entry.js} +1 -1
- package/dist/sankhyablocks/p-c1e50dda.entry.js +1 -0
- package/dist/sankhyablocks/p-cd024328.entry.js +1 -0
- package/dist/sankhyablocks/p-d4c72815.entry.js +1 -0
- package/dist/sankhyablocks/{p-7749c662.entry.js → p-d88d67e9.entry.js} +1 -1
- package/dist/sankhyablocks/p-fa80e546.js +1 -0
- package/dist/sankhyablocks/{p-959e0835.entry.js → p-fc257290.entry.js} +1 -1
- package/dist/sankhyablocks/p-fda8c84c.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/filter-item/editors/enum/filterNumberVariation.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +24 -2
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +16 -0
- package/dist/types/components.d.ts +33 -3
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0383e477.entry.js +0 -1
- package/dist/sankhyablocks/p-3bf4df20.entry.js +0 -1
- package/dist/sankhyablocks/p-3ca9120f.entry.js +0 -1
- package/dist/sankhyablocks/p-b3dc25aa.entry.js +0 -1
- package/dist/sankhyablocks/p-c8f8391a.js +0 -1
- package/dist/sankhyablocks/p-e11c5038.entry.js +0 -1
- package/dist/sankhyablocks/p-e3a82e1c.entry.js +0 -1
- package/dist/sankhyablocks/p-fb83ea95.entry.js +0 -1
@@ -5,18 +5,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
8
|
+
const presentationMode = require('./presentationMode-52ec3bdd.js');
|
9
|
+
const filterNumberVariation = require('./filterNumberVariation-d65332da.js');
|
8
10
|
|
9
11
|
const SnkFilterPeriod = class {
|
10
12
|
constructor(hostRef) {
|
11
13
|
index.registerInstance(this, hostRef);
|
12
14
|
this.valueChanged = index.createEvent(this, "valueChanged", 7);
|
15
|
+
this._startIntervalLabel = 'Inicial';
|
16
|
+
this._endIntervalLabel = 'Final';
|
13
17
|
this.config = undefined;
|
18
|
+
this.getMessage = undefined;
|
14
19
|
this.value = undefined;
|
20
|
+
this.presentationMode = presentationMode.EPresentationMode.CHIP;
|
15
21
|
}
|
16
22
|
/**
|
17
23
|
* Emitido quando acontece a alteração de valor do componente snk-filter-number
|
18
24
|
*/
|
19
25
|
ezChangeListener(evt) {
|
26
|
+
if (this.getVariation() === filterNumberVariation.FilterNumberVariation.INTERVAL) {
|
27
|
+
const start = this._startInterval.value;
|
28
|
+
const end = this._endInterval.value;
|
29
|
+
this.value = (start || end ? { start, end } : undefined);
|
30
|
+
this.valueChanged.emit(this.value);
|
31
|
+
return;
|
32
|
+
}
|
20
33
|
this.value = evt.detail;
|
21
34
|
this.valueChanged.emit(this.value);
|
22
35
|
}
|
@@ -24,19 +37,45 @@ const SnkFilterPeriod = class {
|
|
24
37
|
* Exibe o componente snk-filter-number
|
25
38
|
*/
|
26
39
|
async show() {
|
40
|
+
if (this.getVariation() === filterNumberVariation.FilterNumberVariation.INTERVAL) {
|
41
|
+
this._startInterval.setFocus();
|
42
|
+
return;
|
43
|
+
}
|
27
44
|
this._numberElement.setFocus();
|
28
45
|
}
|
46
|
+
getIntervalValue(prop) {
|
47
|
+
const objValue = this.value ? this.value[prop] : null;
|
48
|
+
return objValue !== null && objValue !== void 0 ? objValue : null;
|
49
|
+
}
|
50
|
+
buildLabel() {
|
51
|
+
if (this.presentationMode === presentationMode.EPresentationMode.CHIP) {
|
52
|
+
return index.h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9");
|
53
|
+
}
|
54
|
+
}
|
55
|
+
getVariation() {
|
56
|
+
var _a, _b;
|
57
|
+
return (_b = (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.variation) !== null && _b !== void 0 ? _b : filterNumberVariation.FilterNumberVariation.DEFAULT;
|
58
|
+
}
|
59
|
+
componentWillLoad() {
|
60
|
+
if (this.getMessage) {
|
61
|
+
this._startIntervalLabel = this.getMessage('snkFilterBar.labelStart');
|
62
|
+
this._endIntervalLabel = this.getMessage('snkFilterBar.labelEnd');
|
63
|
+
}
|
64
|
+
}
|
29
65
|
componentDidLoad() {
|
30
66
|
if (this._element) {
|
31
67
|
core.ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
32
68
|
}
|
33
69
|
}
|
34
70
|
render() {
|
35
|
-
var _a;
|
71
|
+
var _a, _b, _c;
|
36
72
|
if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.NUMBER) {
|
37
73
|
return undefined;
|
38
74
|
}
|
39
|
-
|
75
|
+
if (this.getVariation() === filterNumberVariation.FilterNumberVariation.INTERVAL) {
|
76
|
+
return (index.h("div", { class: "ez-col ez-col--nowrap" }, index.h("ez-number-input", { id: `${this.config.id}_start`, class: this.presentationMode === presentationMode.EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this._startIntervalLabel, ref: ref => this._startInterval = ref, value: this.getIntervalValue("start"), precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }), this.buildLabel(), index.h("ez-number-input", { id: `${this.config.id}_end`, class: this.presentationMode === presentationMode.EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this._endIntervalLabel, ref: ref => this._endInterval = ref, value: this.getIntervalValue("end"), precision: (_b = this.config.props) === null || _b === void 0 ? void 0 : _b.precision })));
|
77
|
+
}
|
78
|
+
return (index.h("ez-number-input", { id: this.config.id, ref: ref => this._numberElement = ref, label: this.config.label, value: this.config.value, precision: (_c = this.config.props) === null || _c === void 0 ? void 0 : _c.precision }));
|
40
79
|
}
|
41
80
|
get _element() { return index.getElement(this); }
|
42
81
|
};
|
@@ -57,8 +57,8 @@ const SnkFilterPeriod = class {
|
|
57
57
|
}
|
58
58
|
componentWillLoad() {
|
59
59
|
if (this.getMessage) {
|
60
|
-
this._startDateLabel = this.getMessage('snkFilterBar.
|
61
|
-
this._endDateLabel = this.getMessage('snkFilterBar.
|
60
|
+
this._startDateLabel = this.getMessage('snkFilterBar.labelStart');
|
61
|
+
this._endDateLabel = this.getMessage('snkFilterBar.labelEnd');
|
62
62
|
}
|
63
63
|
}
|
64
64
|
render() {
|
@@ -13,7 +13,7 @@ const index$1 = require('./index-0e663819.js');
|
|
13
13
|
require('./ISave-d68ce3cd.js');
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
16
|
-
require('./dataunit-fetcher-
|
16
|
+
require('./dataunit-fetcher-a0079a6f.js');
|
17
17
|
require('./PreloadManager-84466da6.js');
|
18
18
|
require('./filter-item-type.enum-aa823a00.js');
|
19
19
|
require('./form-config-fetcher-17775a75.js');
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-f7ef9607.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('./SnkFormConfigManager-29101e20.js');
|
@@ -22,7 +22,7 @@ require('./constants-d187e03e.js');
|
|
22
22
|
require('./pesquisa-fetcher-34922b83.js');
|
23
23
|
require('./ISave-d68ce3cd.js');
|
24
24
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
25
|
-
require('./dataunit-fetcher-
|
25
|
+
require('./dataunit-fetcher-a0079a6f.js');
|
26
26
|
require('./PreloadManager-84466da6.js');
|
27
27
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
28
28
|
require('./ResourceIDUtils-5ff86aa7.js');
|
@@ -12,7 +12,7 @@ const index$1 = require('./index-0e663819.js');
|
|
12
12
|
require('./ISave-d68ce3cd.js');
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
15
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
15
|
+
const dataunitFetcher = require('./dataunit-fetcher-a0079a6f.js');
|
16
16
|
require('./PreloadManager-84466da6.js');
|
17
17
|
require('./filter-item-type.enum-aa823a00.js');
|
18
18
|
require('./form-config-fetcher-17775a75.js');
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Action, ApplicationContext, DataType } from "@sankhyalabs/core";
|
2
2
|
import { SaveErrorsEnum } from "../../../lib/http/data-fetcher/fetchers/fecthAttach/interfaces";
|
3
3
|
import { VIEW_MODE } from "../../../lib/utils/constants";
|
4
|
+
import PreloadManager from '../../../lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager';
|
4
5
|
export class AttachmentDataUnitBuilder {
|
5
6
|
constructor(entityName, getMessage) {
|
6
7
|
this.entityName = entityName;
|
@@ -64,7 +65,9 @@ export class AttachmentDataUnitBuilder {
|
|
64
65
|
removeLoader(dataUnit, ids, attachFetcher) {
|
65
66
|
return new Promise((resolve) => {
|
66
67
|
const { records } = dataUnit.getSelectionInfo();
|
67
|
-
|
68
|
+
const recordToDelete = records[0];
|
69
|
+
attachFetcher.delete(recordToDelete).then(() => {
|
70
|
+
PreloadManager.removeRecords(dataUnit, [recordToDelete]);
|
68
71
|
return resolve(ids);
|
69
72
|
});
|
70
73
|
});
|
@@ -2,6 +2,7 @@ import { DataType, StringUtils } from "@sankhyalabs/core";
|
|
2
2
|
import { toString } from "@sankhyalabs/core/dist/dataunit/metadata/DataType";
|
3
3
|
import FilterItemType from "../filter-item-type.enum";
|
4
4
|
import { FilterOperand } from "../../../snk-personalized-filter/interfaces/index";
|
5
|
+
import { FilterNumberVariation } from "../editors/enum/filterNumberVariation";
|
5
6
|
const buildFilter = (item) => {
|
6
7
|
switch (item.type) {
|
7
8
|
case FilterItemType.DEFAULT_FILTER:
|
@@ -102,6 +103,38 @@ function buildText(item) {
|
|
102
103
|
}
|
103
104
|
function buildNumber(item) {
|
104
105
|
const { id, value, props } = item;
|
106
|
+
const variation = props.variation;
|
107
|
+
if (variation === FilterNumberVariation.INTERVAL) {
|
108
|
+
const { start, end } = value !== null && value !== void 0 ? value : { start: 0, end: 0 };
|
109
|
+
if (start && end) {
|
110
|
+
return {
|
111
|
+
name: id,
|
112
|
+
expression: props.intervalExpression.fullfill,
|
113
|
+
params: [
|
114
|
+
{ name: `${id}.START`, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, start) },
|
115
|
+
{ name: `${id}.END`, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, end) }
|
116
|
+
]
|
117
|
+
};
|
118
|
+
}
|
119
|
+
if (start) {
|
120
|
+
return {
|
121
|
+
name: id,
|
122
|
+
expression: props.intervalExpression.onlystart,
|
123
|
+
params: [
|
124
|
+
{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, start) }
|
125
|
+
]
|
126
|
+
};
|
127
|
+
}
|
128
|
+
if (end) {
|
129
|
+
return {
|
130
|
+
name: id,
|
131
|
+
expression: props.intervalExpression.onlyend,
|
132
|
+
params: [
|
133
|
+
{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, end) }
|
134
|
+
]
|
135
|
+
};
|
136
|
+
}
|
137
|
+
}
|
105
138
|
const expression = props.expression;
|
106
139
|
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
107
140
|
}
|
@@ -1,15 +1,28 @@
|
|
1
1
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
2
2
|
import { h } from '@stencil/core';
|
3
3
|
import FilterItemType from '../filter-item-type.enum';
|
4
|
+
import { EPresentationMode } from './enum/presentationMode';
|
5
|
+
import { FilterNumberVariation } from './enum/filterNumberVariation';
|
4
6
|
export class SnkFilterPeriod {
|
5
7
|
constructor() {
|
8
|
+
this._startIntervalLabel = 'Inicial';
|
9
|
+
this._endIntervalLabel = 'Final';
|
6
10
|
this.config = undefined;
|
11
|
+
this.getMessage = undefined;
|
7
12
|
this.value = undefined;
|
13
|
+
this.presentationMode = EPresentationMode.CHIP;
|
8
14
|
}
|
9
15
|
/**
|
10
16
|
* Emitido quando acontece a alteração de valor do componente snk-filter-number
|
11
17
|
*/
|
12
18
|
ezChangeListener(evt) {
|
19
|
+
if (this.getVariation() === FilterNumberVariation.INTERVAL) {
|
20
|
+
const start = this._startInterval.value;
|
21
|
+
const end = this._endInterval.value;
|
22
|
+
this.value = (start || end ? { start, end } : undefined);
|
23
|
+
this.valueChanged.emit(this.value);
|
24
|
+
return;
|
25
|
+
}
|
13
26
|
this.value = evt.detail;
|
14
27
|
this.valueChanged.emit(this.value);
|
15
28
|
}
|
@@ -17,19 +30,45 @@ export class SnkFilterPeriod {
|
|
17
30
|
* Exibe o componente snk-filter-number
|
18
31
|
*/
|
19
32
|
async show() {
|
33
|
+
if (this.getVariation() === FilterNumberVariation.INTERVAL) {
|
34
|
+
this._startInterval.setFocus();
|
35
|
+
return;
|
36
|
+
}
|
20
37
|
this._numberElement.setFocus();
|
21
38
|
}
|
39
|
+
getIntervalValue(prop) {
|
40
|
+
const objValue = this.value ? this.value[prop] : null;
|
41
|
+
return objValue !== null && objValue !== void 0 ? objValue : null;
|
42
|
+
}
|
43
|
+
buildLabel() {
|
44
|
+
if (this.presentationMode === EPresentationMode.CHIP) {
|
45
|
+
return h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9");
|
46
|
+
}
|
47
|
+
}
|
48
|
+
getVariation() {
|
49
|
+
var _a, _b;
|
50
|
+
return (_b = (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.variation) !== null && _b !== void 0 ? _b : FilterNumberVariation.DEFAULT;
|
51
|
+
}
|
52
|
+
componentWillLoad() {
|
53
|
+
if (this.getMessage) {
|
54
|
+
this._startIntervalLabel = this.getMessage('snkFilterBar.labelStart');
|
55
|
+
this._endIntervalLabel = this.getMessage('snkFilterBar.labelEnd');
|
56
|
+
}
|
57
|
+
}
|
22
58
|
componentDidLoad() {
|
23
59
|
if (this._element) {
|
24
60
|
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
25
61
|
}
|
26
62
|
}
|
27
63
|
render() {
|
28
|
-
var _a;
|
64
|
+
var _a, _b, _c;
|
29
65
|
if (!this.config || this.config.type !== FilterItemType.NUMBER) {
|
30
66
|
return undefined;
|
31
67
|
}
|
32
|
-
|
68
|
+
if (this.getVariation() === FilterNumberVariation.INTERVAL) {
|
69
|
+
return (h("div", { class: "ez-col ez-col--nowrap" }, h("ez-number-input", { id: `${this.config.id}_start`, class: this.presentationMode === EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this._startIntervalLabel, ref: ref => this._startInterval = ref, value: this.getIntervalValue("start"), precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }), this.buildLabel(), h("ez-number-input", { id: `${this.config.id}_end`, class: this.presentationMode === EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this._endIntervalLabel, ref: ref => this._endInterval = ref, value: this.getIntervalValue("end"), precision: (_b = this.config.props) === null || _b === void 0 ? void 0 : _b.precision })));
|
70
|
+
}
|
71
|
+
return (h("ez-number-input", { id: this.config.id, ref: ref => this._numberElement = ref, label: this.config.label, value: this.config.value, precision: (_c = this.config.props) === null || _c === void 0 ? void 0 : _c.precision }));
|
33
72
|
}
|
34
73
|
static get is() { return "snk-filter-number"; }
|
35
74
|
static get properties() {
|
@@ -54,13 +93,32 @@ export class SnkFilterPeriod {
|
|
54
93
|
"text": "Define as configura\u00E7\u00F5es do componente snk-filter-number"
|
55
94
|
}
|
56
95
|
},
|
96
|
+
"getMessage": {
|
97
|
+
"type": "unknown",
|
98
|
+
"mutable": false,
|
99
|
+
"complexType": {
|
100
|
+
"original": "(key: string, props?: any) => string",
|
101
|
+
"resolved": "(key: string, props?: any) => string",
|
102
|
+
"references": {}
|
103
|
+
},
|
104
|
+
"required": false,
|
105
|
+
"optional": false,
|
106
|
+
"docs": {
|
107
|
+
"tags": [],
|
108
|
+
"text": "Usado pra flexibilizar os verbetes e mensagens de acordo com o SnkMessageBuilder."
|
109
|
+
}
|
110
|
+
},
|
57
111
|
"value": {
|
58
112
|
"type": "number",
|
59
113
|
"mutable": false,
|
60
114
|
"complexType": {
|
61
|
-
"original": "
|
62
|
-
"resolved": "number",
|
63
|
-
"references": {
|
115
|
+
"original": "FilterNumberValueType",
|
116
|
+
"resolved": "number | { start: number; end: number; }",
|
117
|
+
"references": {
|
118
|
+
"FilterNumberValueType": {
|
119
|
+
"location": "global"
|
120
|
+
}
|
121
|
+
}
|
64
122
|
},
|
65
123
|
"required": false,
|
66
124
|
"optional": false,
|
@@ -70,6 +128,29 @@ export class SnkFilterPeriod {
|
|
70
128
|
},
|
71
129
|
"attribute": "value",
|
72
130
|
"reflect": false
|
131
|
+
},
|
132
|
+
"presentationMode": {
|
133
|
+
"type": "number",
|
134
|
+
"mutable": false,
|
135
|
+
"complexType": {
|
136
|
+
"original": "EPresentationMode",
|
137
|
+
"resolved": "EPresentationMode.CHIP | EPresentationMode.MODAL",
|
138
|
+
"references": {
|
139
|
+
"EPresentationMode": {
|
140
|
+
"location": "import",
|
141
|
+
"path": "./enum/presentationMode"
|
142
|
+
}
|
143
|
+
}
|
144
|
+
},
|
145
|
+
"required": false,
|
146
|
+
"optional": false,
|
147
|
+
"docs": {
|
148
|
+
"tags": [],
|
149
|
+
"text": "Define a varia\u00E7\u00E3o do componente"
|
150
|
+
},
|
151
|
+
"attribute": "presentation-mode",
|
152
|
+
"reflect": false,
|
153
|
+
"defaultValue": "EPresentationMode.CHIP"
|
73
154
|
}
|
74
155
|
};
|
75
156
|
}
|
@@ -85,9 +166,13 @@ export class SnkFilterPeriod {
|
|
85
166
|
"text": "Emitido quando o valor do filtro \u00E9 alterado."
|
86
167
|
},
|
87
168
|
"complexType": {
|
88
|
-
"original": "
|
89
|
-
"resolved": "
|
90
|
-
"references": {
|
169
|
+
"original": "FilterNumberValueType",
|
170
|
+
"resolved": "number | { start: number; end: number; }",
|
171
|
+
"references": {
|
172
|
+
"FilterNumberValueType": {
|
173
|
+
"location": "global"
|
174
|
+
}
|
175
|
+
}
|
91
176
|
}
|
92
177
|
}];
|
93
178
|
}
|
@@ -50,8 +50,8 @@ export class SnkFilterPeriod {
|
|
50
50
|
}
|
51
51
|
componentWillLoad() {
|
52
52
|
if (this.getMessage) {
|
53
|
-
this._startDateLabel = this.getMessage('snkFilterBar.
|
54
|
-
this._endDateLabel = this.getMessage('snkFilterBar.
|
53
|
+
this._startDateLabel = this.getMessage('snkFilterBar.labelStart');
|
54
|
+
this._endDateLabel = this.getMessage('snkFilterBar.labelEnd');
|
55
55
|
}
|
56
56
|
}
|
57
57
|
render() {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { ElementIDUtils, FloatingManager, DateUtils } from '@sankhyalabs/core';
|
2
2
|
import { h, Host } from '@stencil/core';
|
3
3
|
import FilterItemType from './filter-item-type.enum';
|
4
|
+
import { FilterNumberVariation } from './editors/enum/filterNumberVariation';
|
4
5
|
export class SnkFilterItem {
|
5
6
|
constructor() {
|
6
7
|
this.innerClickCheck = (_floatingContainer, node) => {
|
@@ -163,10 +164,10 @@ export class SnkFilterItem {
|
|
163
164
|
}
|
164
165
|
else {
|
165
166
|
if (start) {
|
166
|
-
return `${label}: ${this.getMessage('snkFilterBar.
|
167
|
+
return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${dateFormater.format(start)}`;
|
167
168
|
}
|
168
169
|
else if (end) {
|
169
|
-
return `${label}: ${this.getMessage('snkFilterBar.
|
170
|
+
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${dateFormater.format(end)}`;
|
170
171
|
}
|
171
172
|
else {
|
172
173
|
return label;
|
@@ -197,6 +198,18 @@ export class SnkFilterItem {
|
|
197
198
|
}
|
198
199
|
return `${label}: ${selectedOptions[0].label}`;
|
199
200
|
}
|
201
|
+
if (type === FilterItemType.NUMBER && props.variation === FilterNumberVariation.INTERVAL) {
|
202
|
+
const { start, end } = value;
|
203
|
+
if (start && end) {
|
204
|
+
return this.getMessage('snkFilterBar.fullIntervalTooltip', { LABEL: label, START_LABEL: start, END_LABEL: end });
|
205
|
+
}
|
206
|
+
if (start) {
|
207
|
+
return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${Number(start)}`;
|
208
|
+
}
|
209
|
+
if (end) {
|
210
|
+
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
|
211
|
+
}
|
212
|
+
}
|
200
213
|
return `${label}: ${value}`;
|
201
214
|
}
|
202
215
|
return label;
|
@@ -5,6 +5,7 @@ import FilterType from '../types/filter-type.enum';
|
|
5
5
|
import FilterItemType from '../filter-item/filter-item-type.enum';
|
6
6
|
import { ObjectUtils } from '@sankhyalabs/core';
|
7
7
|
import { PersonalizedFilterUtils } from '../../snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils';
|
8
|
+
import { FilterNumberVariation } from '../filter-item/editors/enum/filterNumberVariation';
|
8
9
|
export class SnkFilterModal {
|
9
10
|
constructor() {
|
10
11
|
this.getMessage = undefined;
|
@@ -136,6 +137,11 @@ export class SnkFilterModal {
|
|
136
137
|
renderFilterItem(filterItem, fullRow) {
|
137
138
|
return (h("snk-filter-modal-item", { class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event.detail), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
|
138
139
|
}
|
140
|
+
isDefaultFilterNumberVariation(filter) {
|
141
|
+
var _a;
|
142
|
+
return filter.type === FilterItemType.NUMBER
|
143
|
+
&& (!filter.props.variation || ((_a = filter.props) === null || _a === void 0 ? void 0 : _a.variation) === FilterNumberVariation.DEFAULT);
|
144
|
+
}
|
139
145
|
mountFiltersLines(filters) {
|
140
146
|
const MAX_LINE_LENGTH = 2;
|
141
147
|
let currentLine = 0;
|
@@ -145,8 +151,8 @@ export class SnkFilterModal {
|
|
145
151
|
filtersLines[currentLine] = filtersLines[currentLine] || [];
|
146
152
|
const item = filters[curr];
|
147
153
|
const isLast = curr === filters.length - 1;
|
148
|
-
const currentItemMatch =
|
149
|
-
const nextItemMatch = isLast ? false : [FilterItemType.TEXT
|
154
|
+
const currentItemMatch = item.type === FilterItemType.TEXT || this.isDefaultFilterNumberVariation(item);
|
155
|
+
const nextItemMatch = isLast ? false : filters[curr + 1].type === FilterItemType.TEXT || this.isDefaultFilterNumberVariation(filters[curr + 1]);
|
150
156
|
if ((currentItemMatch && nextItemMatch) || forceAddCurrent) {
|
151
157
|
filtersLines[currentLine].push(item);
|
152
158
|
forceAddCurrent = filtersLines[currentLine].length < MAX_LINE_LENGTH;
|
@@ -28,7 +28,7 @@ export class SnkFilterModalItem {
|
|
28
28
|
case FilterItemType.SEARCH:
|
29
29
|
return { tag: "snk-filter-search" };
|
30
30
|
case FilterItemType.NUMBER:
|
31
|
-
return { tag: "snk-filter-number" };
|
31
|
+
return { tag: "snk-filter-number", props };
|
32
32
|
case FilterItemType.PERSONALIZED:
|
33
33
|
return this.buildSnkFilterPersonalizedProps();
|
34
34
|
case FilterItemType.MULTI_LIST:
|
@@ -76,6 +76,44 @@ export class SnkFilterBar {
|
|
76
76
|
async reload() {
|
77
77
|
this.loadConfigFromStorage();
|
78
78
|
}
|
79
|
+
/**
|
80
|
+
* Retorna um item de filtro pelo ID.
|
81
|
+
*/
|
82
|
+
async getFilterItem(id) {
|
83
|
+
const item = this.filterConfig.find(item => item.id === id);
|
84
|
+
return Promise.resolve(ObjectUtils.copy(item));
|
85
|
+
}
|
86
|
+
/**
|
87
|
+
* Atualiza um item do filtro.
|
88
|
+
*
|
89
|
+
* @param filterItem - Item com as informações atualizadas, caso o item não seja encontrado no array ele mão será modificado
|
90
|
+
*/
|
91
|
+
async updateFilterItem(newFilterItem) {
|
92
|
+
const itemIndex = this.filterConfig.findIndex(item => item.id === newFilterItem.id);
|
93
|
+
if (itemIndex == -1) {
|
94
|
+
console.warn("[SnkFilterBar.updateFilterItem] FilterItem não encontrado, o mesmo não será atualizado.");
|
95
|
+
return Promise.resolve();
|
96
|
+
}
|
97
|
+
this._loadingPending = true;
|
98
|
+
this.updateFilter(newFilterItem);
|
99
|
+
return Promise.resolve();
|
100
|
+
}
|
101
|
+
/**
|
102
|
+
* Adiciona um item de filtro.
|
103
|
+
*
|
104
|
+
* @param filterItem - Item a ser adicionado, caso o item já exista com o ID ele não será adicionado novamente
|
105
|
+
*/
|
106
|
+
async addFilterItem(filterItem) {
|
107
|
+
const itemIndex = this.filterConfig.findIndex(item => item.id === filterItem.id);
|
108
|
+
if (itemIndex > -1) {
|
109
|
+
console.warn("[SnkFilterBar.addFilterItem] FilterItem já existe , o mesmo não será adicionado novamente.");
|
110
|
+
return Promise.resolve();
|
111
|
+
}
|
112
|
+
this.filterConfig.push(filterItem);
|
113
|
+
this._loadingPending = true;
|
114
|
+
this.updateFilter(filterItem);
|
115
|
+
return Promise.resolve();
|
116
|
+
}
|
79
117
|
componentDidLoad() {
|
80
118
|
if (this._element) {
|
81
119
|
const dataInfo = { dataUnit: this.dataUnit };
|
@@ -492,6 +530,84 @@ export class SnkFilterBar {
|
|
492
530
|
"text": "Faz o recarregamento da filterbar buscando o state no servidor.",
|
493
531
|
"tags": []
|
494
532
|
}
|
533
|
+
},
|
534
|
+
"getFilterItem": {
|
535
|
+
"complexType": {
|
536
|
+
"signature": "(id: string) => Promise<SnkFilterItemConfig | undefined>",
|
537
|
+
"parameters": [{
|
538
|
+
"tags": [],
|
539
|
+
"text": ""
|
540
|
+
}],
|
541
|
+
"references": {
|
542
|
+
"Promise": {
|
543
|
+
"location": "global"
|
544
|
+
},
|
545
|
+
"SnkFilterItemConfig": {
|
546
|
+
"location": "import",
|
547
|
+
"path": "./filter-item/snk-filter-item"
|
548
|
+
}
|
549
|
+
},
|
550
|
+
"return": "Promise<SnkFilterItemConfig>"
|
551
|
+
},
|
552
|
+
"docs": {
|
553
|
+
"text": "Retorna um item de filtro pelo ID.",
|
554
|
+
"tags": []
|
555
|
+
}
|
556
|
+
},
|
557
|
+
"updateFilterItem": {
|
558
|
+
"complexType": {
|
559
|
+
"signature": "(newFilterItem: SnkFilterItemConfig) => Promise<void>",
|
560
|
+
"parameters": [{
|
561
|
+
"tags": [],
|
562
|
+
"text": ""
|
563
|
+
}],
|
564
|
+
"references": {
|
565
|
+
"Promise": {
|
566
|
+
"location": "global"
|
567
|
+
},
|
568
|
+
"SnkFilterItemConfig": {
|
569
|
+
"location": "import",
|
570
|
+
"path": "./filter-item/snk-filter-item"
|
571
|
+
}
|
572
|
+
},
|
573
|
+
"return": "Promise<void>"
|
574
|
+
},
|
575
|
+
"docs": {
|
576
|
+
"text": "Atualiza um item do filtro.",
|
577
|
+
"tags": [{
|
578
|
+
"name": "param",
|
579
|
+
"text": "filterItem - Item com as informa\u00E7\u00F5es atualizadas, caso o item n\u00E3o seja encontrado no array ele m\u00E3o ser\u00E1 modificado"
|
580
|
+
}]
|
581
|
+
}
|
582
|
+
},
|
583
|
+
"addFilterItem": {
|
584
|
+
"complexType": {
|
585
|
+
"signature": "(filterItem: SnkFilterItemConfig) => Promise<void>",
|
586
|
+
"parameters": [{
|
587
|
+
"tags": [{
|
588
|
+
"name": "param",
|
589
|
+
"text": "filterItem - Item a ser adicionado, caso o item j\u00E1 exista com o ID ele n\u00E3o ser\u00E1 adicionado novamente"
|
590
|
+
}],
|
591
|
+
"text": "- Item a ser adicionado, caso o item j\u00E1 exista com o ID ele n\u00E3o ser\u00E1 adicionado novamente"
|
592
|
+
}],
|
593
|
+
"references": {
|
594
|
+
"Promise": {
|
595
|
+
"location": "global"
|
596
|
+
},
|
597
|
+
"SnkFilterItemConfig": {
|
598
|
+
"location": "import",
|
599
|
+
"path": "./filter-item/snk-filter-item"
|
600
|
+
}
|
601
|
+
},
|
602
|
+
"return": "Promise<void>"
|
603
|
+
},
|
604
|
+
"docs": {
|
605
|
+
"text": "Adiciona um item de filtro.",
|
606
|
+
"tags": [{
|
607
|
+
"name": "param",
|
608
|
+
"text": "filterItem - Item a ser adicionado, caso o item j\u00E1 exista com o ID ele n\u00E3o ser\u00E1 adicionado novamente"
|
609
|
+
}]
|
610
|
+
}
|
495
611
|
}
|
496
612
|
};
|
497
613
|
}
|
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
@@ -69,6 +69,7 @@ export class DatasetStrategy {
|
|
69
69
|
const dataSetID = dataUnit.dataUnitId;
|
70
70
|
const dataUnitName = dataUnit.name;
|
71
71
|
const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
|
72
|
+
const useParallelLoader = !!(request.limit || request.offset);
|
72
73
|
const requestBody = {
|
73
74
|
serviceName,
|
74
75
|
requestBody: {
|
@@ -84,7 +85,7 @@ export class DatasetStrategy {
|
|
84
85
|
__record__label__: { "fieldType": "S", "userType": "P" }
|
85
86
|
},
|
86
87
|
tryJoinedFields: true,
|
87
|
-
parallelLoader:
|
88
|
+
parallelLoader: useParallelLoader,
|
88
89
|
crudListener: "br.com.sankhya.modelcore.dataset.DataUnitDatasetAdapter",
|
89
90
|
txProperties: this.getTxProperties(dataUnitName, request, sorting),
|
90
91
|
useDefaultRowsLimit: false
|
@@ -30,11 +30,12 @@ const snkFilterBarMessages = {
|
|
30
30
|
"modalCancelButtonLabel": "Limpar",
|
31
31
|
"binarySelectTooltip": "Exibindo registros",
|
32
32
|
"multiListToltip": "selecionado(a)s",
|
33
|
-
"
|
34
|
-
"
|
33
|
+
"onlyStartToltip": "A partir de",
|
34
|
+
"onlyEndToltip": "Até",
|
35
35
|
"fullPeriodTooltip": "Data de {{LABEL}}: {{START_LABEL}} até {{END_LABEL}}",
|
36
|
-
"
|
37
|
-
"
|
36
|
+
"labelStart": "Inicial",
|
37
|
+
"labelEnd": "Final",
|
38
|
+
"fullIntervalTooltip": "{{LABEL}}: {{START_LABEL}} até {{END_LABEL}}",
|
38
39
|
"filters": "Filtros",
|
39
40
|
"personalizedCount": "{{activeCount}} selecionado(s)",
|
40
41
|
"filterModal": {
|
@@ -63,11 +63,12 @@ const snkFilterBarMessages = {
|
|
63
63
|
"modalCancelButtonLabel": "Limpar",
|
64
64
|
"binarySelectTooltip": "Exibindo registros",
|
65
65
|
"multiListToltip": "selecionado(a)s",
|
66
|
-
"
|
67
|
-
"
|
66
|
+
"onlyStartToltip": "A partir de",
|
67
|
+
"onlyEndToltip": "Até",
|
68
68
|
"fullPeriodTooltip": "Data de {{LABEL}}: {{START_LABEL}} até {{END_LABEL}}",
|
69
|
-
"
|
70
|
-
"
|
69
|
+
"labelStart": "Inicial",
|
70
|
+
"labelEnd": "Final",
|
71
|
+
"fullIntervalTooltip": "{{LABEL}}: {{START_LABEL}} até {{END_LABEL}}",
|
71
72
|
"filters": "Filtros",
|
72
73
|
"personalizedCount": "{{activeCount}} selecionado(s)",
|
73
74
|
"filterModal": {
|
@@ -591,6 +591,7 @@ class DatasetStrategy {
|
|
591
591
|
const dataSetID = dataUnit.dataUnitId;
|
592
592
|
const dataUnitName = dataUnit.name;
|
593
593
|
const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
|
594
|
+
const useParallelLoader = !!(request.limit || request.offset);
|
594
595
|
const requestBody = {
|
595
596
|
serviceName,
|
596
597
|
requestBody: {
|
@@ -606,7 +607,7 @@ class DatasetStrategy {
|
|
606
607
|
__record__label__: { "fieldType": "S", "userType": "P" }
|
607
608
|
},
|
608
609
|
tryJoinedFields: true,
|
609
|
-
parallelLoader:
|
610
|
+
parallelLoader: useParallelLoader,
|
610
611
|
crudListener: "br.com.sankhya.modelcore.dataset.DataUnitDatasetAdapter",
|
611
612
|
txProperties: this.getTxProperties(dataUnitName, request, sorting),
|
612
613
|
useDefaultRowsLimit: false
|