@sankhyalabs/ezui 0.0.0-bugfix-dev-kb-74998.3 → 0.0.0-bugfix-dev-KB-74246.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ez-card-item_3.cjs.entry.js → ez-card-item_2.cjs.entry.js} +0 -123
- package/dist/cjs/ez-chart.cjs.entry.js +1 -1
- package/dist/cjs/ez-double-list.cjs.entry.js +285 -0
- package/dist/cjs/ez-filter-input.cjs.entry.js +130 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +8 -2
- package/dist/cjs/ez-form.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +770 -107
- package/dist/cjs/ez-list.cjs.entry.js +246 -205
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +4 -1
- package/dist/cjs/ez-split-item.cjs.entry.js +3 -2
- package/dist/cjs/ez-split-panel.cjs.entry.js +54 -2
- package/dist/cjs/ezListHelper-0d3970b4.js +90 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +2 -2
- package/dist/cjs/index-a7b0c73d.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ez-double-list/doubleListHelper.js +82 -0
- package/dist/collection/components/ez-double-list/ez-double-list.css +62 -0
- package/dist/collection/components/ez-double-list/ez-double-list.js +418 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +2 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +6 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +4 -0
- package/dist/collection/components/ez-grid/ez-grid.css +24 -6
- package/dist/collection/components/ez-grid/ez-grid.js +5 -5
- package/dist/collection/components/ez-grid/subcomponents/filter-column.css +4 -0
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +1 -1
- package/dist/collection/components/ez-list/ez-list.js +273 -208
- package/dist/collection/components/ez-list/ezListHelper.js +85 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +2 -2
- package/dist/collection/components/ez-popup/ez-popup.css +1 -0
- package/dist/collection/components/ez-popup/ez-popup.js +5 -2
- package/dist/collection/components/ez-split-panel/ez-split-panel.css +15 -0
- package/dist/collection/components/ez-split-panel/ez-split-panel.js +71 -1
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +13 -2
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +20 -1
- package/dist/collection/utils/form/FormMetadata.js +1 -1
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +1466 -337
- package/dist/esm/{ez-card-item_3.entry.js → ez-card-item_2.entry.js} +1 -123
- package/dist/esm/ez-chart.entry.js +1 -1
- package/dist/esm/ez-double-list.entry.js +281 -0
- package/dist/esm/ez-filter-input.entry.js +126 -0
- package/dist/esm/ez-form-view.entry.js +8 -2
- package/dist/esm/ez-form.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +771 -108
- package/dist/esm/ez-list.entry.js +246 -205
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +4 -1
- package/dist/esm/ez-split-item.entry.js +3 -2
- package/dist/esm/ez-split-panel.entry.js +54 -2
- package/dist/esm/ezListHelper-00fb9b8d.js +87 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +2 -2
- package/dist/esm/index-baa5e267.js +10 -2
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-13165bb1.entry.js +1 -0
- package/dist/ezui/p-17eabf46.entry.js +1 -0
- package/dist/ezui/p-2475fd6e.entry.js +1 -0
- package/dist/ezui/p-29e7a674.entry.js +309 -0
- package/dist/ezui/p-31d1fab6.entry.js +1 -0
- package/dist/ezui/{p-baf80b13.entry.js → p-35d467a8.entry.js} +1 -1
- package/dist/ezui/p-5b205c80.entry.js +1 -0
- package/dist/ezui/p-65f471bc.entry.js +1 -0
- package/dist/ezui/p-66924de6.entry.js +1 -0
- package/dist/ezui/p-80dfc50b.js +1 -0
- package/dist/ezui/{p-d520839d.entry.js → p-9aafa8f7.entry.js} +1 -1
- package/dist/ezui/{p-b36542d8.entry.js → p-a6fe527a.entry.js} +1 -1
- package/dist/ezui/p-e3e3fd7a.entry.js +1 -0
- package/dist/ezui/{p-2b46b37b.entry.js → p-fa6732f2.entry.js} +1 -1
- package/dist/types/components/ez-double-list/doubleListHelper.d.ts +10 -0
- package/dist/types/components/ez-double-list/ez-double-list.d.ts +86 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.d.ts +2 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +1 -1
- package/dist/types/components/ez-list/ez-list.d.ts +19 -3
- package/dist/types/components/ez-list/ezListHelper.d.ts +20 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +1 -1
- package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +7 -0
- package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +4 -0
- package/dist/types/components.d.ts +121 -14
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-4575d511.entry.js +0 -1
- package/dist/ezui/p-90bcd2ba.entry.js +0 -1
- package/dist/ezui/p-bfad39eb.entry.js +0 -1
- package/dist/ezui/p-c806f32f.entry.js +0 -1
- package/dist/ezui/p-ca1ce49f.entry.js +0 -309
- package/dist/ezui/p-cd2e78f0.entry.js +0 -1
- package/dist/ezui/p-e78e0843.entry.js +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export function moveItems(selectedItemsList, itemsList, foward) {
|
|
2
|
+
if (!selectedItemsList.length)
|
|
3
|
+
return [...itemsList];
|
|
4
|
+
if (!itemsList.length)
|
|
5
|
+
return [];
|
|
6
|
+
const selectedIndexes = getItemsIndex(selectedItemsList, itemsList);
|
|
7
|
+
const startIndex = getMinValue(selectedIndexes);
|
|
8
|
+
const endIndex = getMaxValue(selectedIndexes);
|
|
9
|
+
return moveRange(startIndex, endIndex, foward, itemsList);
|
|
10
|
+
}
|
|
11
|
+
function getMinValue(numbers) {
|
|
12
|
+
if (numbers.length === 0)
|
|
13
|
+
return 0;
|
|
14
|
+
return numbers.reduce((min, current) => (current < min ? current : min), numbers[0]);
|
|
15
|
+
}
|
|
16
|
+
function getMaxValue(numbers) {
|
|
17
|
+
if (numbers.length === 0)
|
|
18
|
+
return 0;
|
|
19
|
+
return numbers.reduce((max, current) => (current > max ? current : max), numbers[0]);
|
|
20
|
+
}
|
|
21
|
+
function getItemsIndex(selectedItemsList, itemsList) {
|
|
22
|
+
return selectedItemsList.map(selectedId => itemsList.findIndex(original => original.id === selectedId));
|
|
23
|
+
}
|
|
24
|
+
function moveRange(startIndex, endIndex, moveForward, listItem) {
|
|
25
|
+
if (startIndex < 0 || endIndex >= listItem.length || startIndex > endIndex)
|
|
26
|
+
return listItem;
|
|
27
|
+
if (moveForward)
|
|
28
|
+
return moveFoward(endIndex, startIndex, listItem);
|
|
29
|
+
return moveBackward(startIndex, endIndex, listItem);
|
|
30
|
+
}
|
|
31
|
+
function moveBackward(startIndex, endIndex, listItem) {
|
|
32
|
+
if (startIndex === 0)
|
|
33
|
+
return listItem;
|
|
34
|
+
const beforeRange = listItem.slice(0, startIndex - 1);
|
|
35
|
+
const range = listItem.slice(startIndex, endIndex + 1);
|
|
36
|
+
const afterRange = listItem.slice(endIndex + 1);
|
|
37
|
+
const movedItem = listItem[startIndex - 1];
|
|
38
|
+
return [...beforeRange, ...range, movedItem, ...afterRange];
|
|
39
|
+
}
|
|
40
|
+
function moveFoward(endIndex, startIndex, listItem) {
|
|
41
|
+
if (endIndex === listItem.length - 1)
|
|
42
|
+
return listItem;
|
|
43
|
+
const beforeRange = listItem.slice(0, startIndex);
|
|
44
|
+
const range = listItem.slice(startIndex, endIndex + 1);
|
|
45
|
+
const afterRange = listItem.slice(endIndex + 1);
|
|
46
|
+
const movedItem = afterRange.shift();
|
|
47
|
+
return movedItem
|
|
48
|
+
? [...beforeRange, movedItem, ...range, ...afterRange]
|
|
49
|
+
: listItem;
|
|
50
|
+
}
|
|
51
|
+
export function transferAll({ from, to, selectedFrom, selectedTo }) {
|
|
52
|
+
to = [...to.map(i => setItemSelection(i, false)), ...from.map(i => setItemSelection(i, true))];
|
|
53
|
+
selectedFrom = [];
|
|
54
|
+
selectedTo = [...from.map(({ id }) => id)];
|
|
55
|
+
from = [];
|
|
56
|
+
return { from, to, selectedFrom, selectedTo };
|
|
57
|
+
}
|
|
58
|
+
export function transferItems({ from, to, selectedFrom, selectedTo }) {
|
|
59
|
+
if (!from.length)
|
|
60
|
+
return { from, to, selectedFrom, selectedTo };
|
|
61
|
+
const itemsToTransfer = getItemsToTransfer(to, selectedFrom, from);
|
|
62
|
+
if (!itemsToTransfer.length)
|
|
63
|
+
return { from, to, selectedFrom, selectedTo };
|
|
64
|
+
to = [
|
|
65
|
+
...to.map(i => setItemSelection(i, false)),
|
|
66
|
+
...itemsToTransfer.map(i => setItemSelection(i, true))
|
|
67
|
+
];
|
|
68
|
+
const selectedFromIds = selectedFrom.map(id => id);
|
|
69
|
+
from = [...from.filter(item => !selectedFromIds.includes(item.id))];
|
|
70
|
+
selectedTo = [...selectedFrom];
|
|
71
|
+
selectedFrom = [];
|
|
72
|
+
return { from, to, selectedFrom, selectedTo };
|
|
73
|
+
}
|
|
74
|
+
function getItemsToTransfer(to, selectedFrom, from) {
|
|
75
|
+
const toListIds = to.map(item => item.id);
|
|
76
|
+
//Não deve transferir um item que já existe na lista destino
|
|
77
|
+
const itemsToTransferId = selectedFrom.filter((id) => !toListIds.includes(id));
|
|
78
|
+
return from.filter(({ id }) => itemsToTransferId.includes(id));
|
|
79
|
+
}
|
|
80
|
+
function setItemSelection(item, select) {
|
|
81
|
+
return Object.assign(Object.assign({}, item), { selected: select });
|
|
82
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
align-items: center;
|
|
6
|
+
font-family: var(--font-pattern, "Roboto");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.group {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
gap: 10px;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
border: var(--border--small) var(--color--strokes);
|
|
15
|
+
border-radius: var(--border--radius-medium);
|
|
16
|
+
width: 350px;
|
|
17
|
+
height: 400px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.group__header {
|
|
21
|
+
background: var(--background--body);
|
|
22
|
+
padding: 10px;
|
|
23
|
+
border-radius: var(--border--radius-medium) var(--border--radius-medium) 0 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.group__label {
|
|
27
|
+
font-weight: var(--text-weight--large);
|
|
28
|
+
font-size: var(--text--medium);
|
|
29
|
+
color: var(--title--primary);
|
|
30
|
+
margin-bottom: 10px;
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.group__totalizer {
|
|
35
|
+
padding: 5px 10px;
|
|
36
|
+
background: var(--background--body);
|
|
37
|
+
font-weight: var(--text-weight--medium);
|
|
38
|
+
font-size: var(--text--medium);
|
|
39
|
+
color: var(--text--secondary);
|
|
40
|
+
border-radius: 0 0 var(--border--radius-medium) var(--border--radius-medium);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.empty-message{
|
|
44
|
+
font-weight: var(--text-weight--medium);
|
|
45
|
+
font-size: var(--text--medium);
|
|
46
|
+
color: var(--text--secondary);
|
|
47
|
+
text-align: center;
|
|
48
|
+
margin: auto;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.list__container {
|
|
52
|
+
height: 100%;
|
|
53
|
+
min-height: 150px;
|
|
54
|
+
overflow: auto;
|
|
55
|
+
display: flex;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.actions__column {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
gap: 4px;
|
|
62
|
+
}
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { moveItems, transferAll, transferItems } from './doubleListHelper';
|
|
3
|
+
import { ArrayUtils, ObjectUtils } from '@sankhyalabs/core';
|
|
4
|
+
import { isContinuousSequence } from '../ez-list/ezListHelper';
|
|
5
|
+
import { EzScrollDirection } from '../ez-scroller/EzScrollDirection';
|
|
6
|
+
export class EzDoubleList {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.LEFT_LIST_ID = 'LEFT-LIST-ID';
|
|
9
|
+
this.RIGHT_LIST_ID = 'RIGHT-LIST-ID';
|
|
10
|
+
this.LEFT_FILTER_ID = 'LEFT-FILTER-ID';
|
|
11
|
+
this.RIGHT_FILTER_ID = 'RIGHT-FILTER-ID';
|
|
12
|
+
this.leftList = [];
|
|
13
|
+
this.leftTitle = undefined;
|
|
14
|
+
this.rightList = [];
|
|
15
|
+
this.entityLabel = 'item';
|
|
16
|
+
this.entityLabelPlural = 'itens';
|
|
17
|
+
this.leftListLabel = 'disponíveis';
|
|
18
|
+
this.rightListLabel = 'selecionados';
|
|
19
|
+
this.rightTitle = undefined;
|
|
20
|
+
this.leftFilteredList = [];
|
|
21
|
+
this.rightFilteredList = [];
|
|
22
|
+
this.selectedLeftList = [];
|
|
23
|
+
this.selectedRightList = [];
|
|
24
|
+
this.isFilteringLeft = false;
|
|
25
|
+
this.isFilteringRight = false;
|
|
26
|
+
}
|
|
27
|
+
observeLeftList(newValue, oldValue) {
|
|
28
|
+
if (ObjectUtils.equals(newValue, oldValue))
|
|
29
|
+
return;
|
|
30
|
+
this.ezLeftListChanged.emit(newValue);
|
|
31
|
+
}
|
|
32
|
+
observeRightList(newValue, oldValue) {
|
|
33
|
+
if (ObjectUtils.equals(newValue, oldValue))
|
|
34
|
+
return;
|
|
35
|
+
this.ezRightListChanged.emit(newValue);
|
|
36
|
+
}
|
|
37
|
+
handleFilterChangeLeft(value) {
|
|
38
|
+
this.leftFilteredList = ArrayUtils.applyStringFilter(value, this.leftList, true, 'label');
|
|
39
|
+
this.isFilteringLeft = this.leftFilteredList.length !== this.leftList.length;
|
|
40
|
+
}
|
|
41
|
+
handleFilterChangeRight(value) {
|
|
42
|
+
this.rightFilteredList = ArrayUtils.applyStringFilter(value, this.rightList, true, 'label');
|
|
43
|
+
this.isFilteringRight = this.rightFilteredList.length !== this.rightList.length;
|
|
44
|
+
}
|
|
45
|
+
async handleChangeLeft({ detail }) {
|
|
46
|
+
this.leftList = [...detail];
|
|
47
|
+
this.selectedLeftList = [...detail.filter(item => item.selected)];
|
|
48
|
+
await this.leftEzListInstance.clearHistory();
|
|
49
|
+
}
|
|
50
|
+
async handleChangeRight({ detail }) {
|
|
51
|
+
this.rightList = [...detail];
|
|
52
|
+
this.selectedRightList = [...detail.filter(item => item.selected)];
|
|
53
|
+
await this.rightEzListInstance.clearHistory();
|
|
54
|
+
}
|
|
55
|
+
enableTransferAllToRight() {
|
|
56
|
+
return this.leftList.length > 0;
|
|
57
|
+
}
|
|
58
|
+
enableTransferAllToLeft() {
|
|
59
|
+
return this.rightList.length > 0;
|
|
60
|
+
}
|
|
61
|
+
enableTransferToRight() {
|
|
62
|
+
return this.selectedLeftList.length > 0;
|
|
63
|
+
}
|
|
64
|
+
enableTransferToLeft() {
|
|
65
|
+
return this.selectedRightList.length > 0;
|
|
66
|
+
}
|
|
67
|
+
enableMoveUp(moveAll) {
|
|
68
|
+
if (this.isFilteringRight)
|
|
69
|
+
return false;
|
|
70
|
+
const selectedIndexes = this.getRightSelectedItemsIndex();
|
|
71
|
+
return this.selectedRightList.length > 0
|
|
72
|
+
&& !selectedIndexes.includes(0)
|
|
73
|
+
&& (moveAll ? true : isContinuousSequence(selectedIndexes));
|
|
74
|
+
}
|
|
75
|
+
enableMoveDown(moveAll) {
|
|
76
|
+
if (this.isFilteringRight)
|
|
77
|
+
return false;
|
|
78
|
+
const selectedIndexes = this.getRightSelectedItemsIndex();
|
|
79
|
+
const lastIndex = this.rightList.length - 1;
|
|
80
|
+
return this.selectedRightList.length > 0
|
|
81
|
+
&& !selectedIndexes.includes(lastIndex)
|
|
82
|
+
&& (moveAll ? true : isContinuousSequence(selectedIndexes));
|
|
83
|
+
}
|
|
84
|
+
getRightSelectedItemsIndex() {
|
|
85
|
+
return this.selectedRightList.map(id => this.rightList.findIndex(original => original.id === id));
|
|
86
|
+
}
|
|
87
|
+
transferToRight() {
|
|
88
|
+
const { from, to, selectedFrom, selectedTo } = transferItems(this.buildTransferToRightConfig());
|
|
89
|
+
this.leftList = [...from];
|
|
90
|
+
this.rightList = [...to];
|
|
91
|
+
this.selectedLeftList = [...selectedFrom];
|
|
92
|
+
this.selectedRightList = [...selectedTo];
|
|
93
|
+
}
|
|
94
|
+
transferToLeft() {
|
|
95
|
+
const { from, to, selectedFrom, selectedTo } = transferItems(this.buildTransferToLeftConfig());
|
|
96
|
+
this.rightList = [...from];
|
|
97
|
+
this.leftList = [...to];
|
|
98
|
+
this.selectedRightList = [...selectedFrom];
|
|
99
|
+
this.selectedLeftList = [...selectedTo];
|
|
100
|
+
}
|
|
101
|
+
handleTransferAllToRight() {
|
|
102
|
+
const { from, to, selectedFrom, selectedTo } = transferAll(this.buildTransferToRightConfig());
|
|
103
|
+
this.leftList = [...from];
|
|
104
|
+
this.rightList = [...to];
|
|
105
|
+
this.selectedLeftList = [...selectedFrom];
|
|
106
|
+
this.selectedRightList = [...selectedTo];
|
|
107
|
+
}
|
|
108
|
+
handleTransferAllToLeft() {
|
|
109
|
+
const { from, to, selectedFrom, selectedTo } = transferAll(this.buildTransferToLeftConfig());
|
|
110
|
+
this.rightList = [...from];
|
|
111
|
+
this.leftList = [...to];
|
|
112
|
+
this.selectedRightList = [...selectedFrom];
|
|
113
|
+
this.selectedLeftList = [...selectedTo];
|
|
114
|
+
}
|
|
115
|
+
buildTransferToRightConfig() {
|
|
116
|
+
return {
|
|
117
|
+
from: this.leftList,
|
|
118
|
+
to: this.rightList,
|
|
119
|
+
selectedFrom: this.selectedLeftList,
|
|
120
|
+
selectedTo: this.selectedRightList,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
buildTransferToLeftConfig() {
|
|
124
|
+
return {
|
|
125
|
+
from: this.rightList,
|
|
126
|
+
to: this.leftList,
|
|
127
|
+
selectedFrom: this.selectedRightList,
|
|
128
|
+
selectedTo: this.selectedLeftList,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
handleMoveUp() {
|
|
132
|
+
this.rightList = [...moveItems(this.selectedRightList, this.rightList, false)];
|
|
133
|
+
}
|
|
134
|
+
handleMoveDown() {
|
|
135
|
+
this.rightList = [...moveItems(this.selectedRightList, this.rightList, true)];
|
|
136
|
+
}
|
|
137
|
+
handleMoveToTop() {
|
|
138
|
+
const { itemsToKeep, itemsToMove } = this.getItemsToKeepAndToMove();
|
|
139
|
+
this.rightList = [...itemsToMove, ...itemsToKeep];
|
|
140
|
+
}
|
|
141
|
+
handleMoveToBottom() {
|
|
142
|
+
const { itemsToKeep, itemsToMove } = this.getItemsToKeepAndToMove();
|
|
143
|
+
this.rightList = [...itemsToKeep, ...itemsToMove];
|
|
144
|
+
}
|
|
145
|
+
handleSelectLeftItem({ detail }) {
|
|
146
|
+
const selectedItems = Array.isArray(detail) ? detail : [detail];
|
|
147
|
+
this.selectedLeftList = [...selectedItems.map(({ id }) => id)];
|
|
148
|
+
}
|
|
149
|
+
handleSelectRightItem({ detail }) {
|
|
150
|
+
const selectedItems = Array.isArray(detail) ? detail : [detail];
|
|
151
|
+
this.selectedRightList = [...selectedItems.map(({ id }) => id)];
|
|
152
|
+
}
|
|
153
|
+
getItemsToKeepAndToMove() {
|
|
154
|
+
const itemsToKeep = this.rightList.filter(item => !this.selectedRightList.includes(item.id));
|
|
155
|
+
const itemsToMove = this.rightList.filter(item => this.selectedRightList.includes(item.id));
|
|
156
|
+
return { itemsToKeep, itemsToMove };
|
|
157
|
+
}
|
|
158
|
+
handleTransferToRight() {
|
|
159
|
+
this.transferToRight();
|
|
160
|
+
this.leftFilteredList = [];
|
|
161
|
+
this.leftEzFilterInput.value = '';
|
|
162
|
+
}
|
|
163
|
+
handleTransferToLeft() {
|
|
164
|
+
this.transferToLeft();
|
|
165
|
+
this.rightFilteredList = [];
|
|
166
|
+
this.rightEzFilterInput.value = '';
|
|
167
|
+
}
|
|
168
|
+
buildTotalizer(list) {
|
|
169
|
+
return `Total de ${list.length} ${list.length === 1 ? this.entityLabel : this.entityLabelPlural}`;
|
|
170
|
+
}
|
|
171
|
+
renderLeftList() {
|
|
172
|
+
if (!this.leftList.length) {
|
|
173
|
+
return h("span", { class: 'empty-message' }, "Nenhum ", this.entityLabel, " dispon\u00EDvel");
|
|
174
|
+
}
|
|
175
|
+
return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL, activeShadow: true }, h("ez-list", { ref: (ref) => this.leftEzListInstance = ref, id: this.LEFT_LIST_ID, hoverFeedback: true, dataSource: this.isFilteringLeft ? this.leftFilteredList : this.leftList, ezDraggable: !this.isFilteringLeft, enableMultipleSelection: true, onEzChange: this.handleChangeLeft.bind(this), ezSelectable: true, onEzSelectItem: this.handleSelectLeftItem.bind(this), onEzDoubleClick: this.handleTransferToRight.bind(this) })));
|
|
176
|
+
}
|
|
177
|
+
renderRightList() {
|
|
178
|
+
if (!this.rightList.length) {
|
|
179
|
+
return h("span", { class: 'empty-message' }, "Nenhum ", this.entityLabel, " selecionado");
|
|
180
|
+
}
|
|
181
|
+
return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL, activeShadow: true }, h("ez-list", { ref: (ref) => this.rightEzListInstance = ref, id: this.RIGHT_LIST_ID, hoverFeedback: true, dataSource: this.isFilteringRight ? this.rightFilteredList : this.rightList, ezDraggable: !this.isFilteringRight, enableMultipleSelection: true, onEzChange: this.handleChangeRight.bind(this), ezSelectable: true, onEzSelectItem: this.handleSelectRightItem.bind(this), onEzDoubleClick: this.handleTransferToLeft.bind(this) })));
|
|
182
|
+
}
|
|
183
|
+
render() {
|
|
184
|
+
return (h(Host, null, h("div", { class: 'group' }, h("div", { class: 'group__header' }, h("span", { class: 'group__label' }, this.leftTitle), h("ez-filter-input", { ref: (ref) => this.leftEzFilterInput = ref, id: this.LEFT_FILTER_ID, label: `Buscar ${this.entityLabel}`, mode: 'slim', onEzChange: evt => this.handleFilterChangeLeft(evt.detail) })), h("div", { class: 'list__container' }, this.renderLeftList()), h("div", { class: 'group__totalizer' }, this.buildTotalizer(this.leftList))), h("div", { class: 'actions__column' }, h("ez-button", { mode: 'icon', iconName: 'dual-chevron-right', enabled: this.enableTransferAllToRight(), title: `Mover todos para ${this.leftListLabel}`, size: 'small', onClick: this.handleTransferAllToRight.bind(this) }), h("ez-button", { mode: 'icon', iconName: 'chevron-right', enabled: this.enableTransferToRight(), title: `Mover para ${this.leftListLabel}`, size: 'small', onClick: this.handleTransferToRight.bind(this) }), h("ez-button", { mode: 'icon', iconName: 'chevron-left', enabled: this.enableTransferToLeft(), title: `Mover para ${this.rightListLabel}`, size: 'small', onClick: this.handleTransferToLeft.bind(this) }), h("ez-button", { mode: 'icon', iconName: 'dual-chevron-left', enabled: this.enableTransferAllToLeft(), title: `Mover todos para ${this.rightListLabel}`, size: 'small', onClick: this.handleTransferAllToLeft.bind(this) })), h("div", { class: 'group' }, h("div", { class: 'group__header' }, h("span", { class: 'group__label' }, this.rightTitle), h("ez-filter-input", { ref: (ref) => this.rightEzFilterInput = ref, id: this.RIGHT_FILTER_ID, label: `Buscar ${this.entityLabel}`, mode: 'slim', onEzChange: evt => this.handleFilterChangeRight(evt.detail) })), h("div", { class: 'list__container' }, this.renderRightList()), h("div", { class: 'group__totalizer' }, this.buildTotalizer(this.rightList))), h("div", { class: 'actions__column' }, h("ez-button", { mode: 'icon', iconName: 'dual-chevron-up', enabled: this.enableMoveUp(true), title: 'Mover para primeira posi\u00E7\u00E3o', size: 'small', onClick: this.handleMoveToTop.bind(this) }), h("ez-button", { mode: 'icon', iconName: 'chevron-up', enabled: this.enableMoveUp(), title: 'Mover para cima', size: 'small', onClick: this.handleMoveUp.bind(this) }), h("ez-button", { mode: 'icon', iconName: 'chevron-down', enabled: this.enableMoveDown(), title: 'Mover para baixo', size: 'small', onClick: this.handleMoveDown.bind(this) }), h("ez-button", { mode: 'icon', iconName: 'dual-chevron-down', enabled: this.enableMoveDown(true), title: 'Mover para \u00FAltima posi\u00E7\u00E3o', size: 'small', onClick: this.handleMoveToBottom.bind(this) }))));
|
|
185
|
+
}
|
|
186
|
+
static get is() { return "ez-double-list"; }
|
|
187
|
+
static get encapsulation() { return "scoped"; }
|
|
188
|
+
static get originalStyleUrls() {
|
|
189
|
+
return {
|
|
190
|
+
"$": ["ez-double-list.css"]
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
static get styleUrls() {
|
|
194
|
+
return {
|
|
195
|
+
"$": ["ez-double-list.css"]
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
static get properties() {
|
|
199
|
+
return {
|
|
200
|
+
"leftList": {
|
|
201
|
+
"type": "unknown",
|
|
202
|
+
"mutable": true,
|
|
203
|
+
"complexType": {
|
|
204
|
+
"original": "ListItem[]",
|
|
205
|
+
"resolved": "ListItem[]",
|
|
206
|
+
"references": {
|
|
207
|
+
"ListItem": {
|
|
208
|
+
"location": "import",
|
|
209
|
+
"path": "../ez-list/ez-list"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"required": false,
|
|
214
|
+
"optional": false,
|
|
215
|
+
"docs": {
|
|
216
|
+
"tags": [],
|
|
217
|
+
"text": "Define a lista origem."
|
|
218
|
+
},
|
|
219
|
+
"defaultValue": "[]"
|
|
220
|
+
},
|
|
221
|
+
"leftTitle": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": false,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "Define o t\u00EDtulo da lista origem."
|
|
234
|
+
},
|
|
235
|
+
"attribute": "left-title",
|
|
236
|
+
"reflect": false
|
|
237
|
+
},
|
|
238
|
+
"rightList": {
|
|
239
|
+
"type": "unknown",
|
|
240
|
+
"mutable": true,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "ListItem[]",
|
|
243
|
+
"resolved": "ListItem[]",
|
|
244
|
+
"references": {
|
|
245
|
+
"ListItem": {
|
|
246
|
+
"location": "import",
|
|
247
|
+
"path": "../ez-list/ez-list"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"required": false,
|
|
252
|
+
"optional": false,
|
|
253
|
+
"docs": {
|
|
254
|
+
"tags": [],
|
|
255
|
+
"text": "Define a lista destino."
|
|
256
|
+
},
|
|
257
|
+
"defaultValue": "[]"
|
|
258
|
+
},
|
|
259
|
+
"entityLabel": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"mutable": false,
|
|
262
|
+
"complexType": {
|
|
263
|
+
"original": "string",
|
|
264
|
+
"resolved": "string",
|
|
265
|
+
"references": {}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": false,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "Nome da entidade listada.\nExemplo: \"Campo\", \"Item\", \"Empresa\"."
|
|
272
|
+
},
|
|
273
|
+
"attribute": "entity-label",
|
|
274
|
+
"reflect": false,
|
|
275
|
+
"defaultValue": "'item'"
|
|
276
|
+
},
|
|
277
|
+
"entityLabelPlural": {
|
|
278
|
+
"type": "string",
|
|
279
|
+
"mutable": false,
|
|
280
|
+
"complexType": {
|
|
281
|
+
"original": "string",
|
|
282
|
+
"resolved": "string",
|
|
283
|
+
"references": {}
|
|
284
|
+
},
|
|
285
|
+
"required": false,
|
|
286
|
+
"optional": false,
|
|
287
|
+
"docs": {
|
|
288
|
+
"tags": [],
|
|
289
|
+
"text": "Varia\u00E7\u00E3o plura do nome da entidade listada.\nExemplo: \"Campos\", \"Itens\", \"Empresas\"."
|
|
290
|
+
},
|
|
291
|
+
"attribute": "entity-label-plural",
|
|
292
|
+
"reflect": false,
|
|
293
|
+
"defaultValue": "'itens'"
|
|
294
|
+
},
|
|
295
|
+
"leftListLabel": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"mutable": false,
|
|
298
|
+
"complexType": {
|
|
299
|
+
"original": "string",
|
|
300
|
+
"resolved": "string",
|
|
301
|
+
"references": {}
|
|
302
|
+
},
|
|
303
|
+
"required": false,
|
|
304
|
+
"optional": false,
|
|
305
|
+
"docs": {
|
|
306
|
+
"tags": [],
|
|
307
|
+
"text": "R\u00F3tulo da lista esquerda."
|
|
308
|
+
},
|
|
309
|
+
"attribute": "left-list-label",
|
|
310
|
+
"reflect": false,
|
|
311
|
+
"defaultValue": "'dispon\u00EDveis'"
|
|
312
|
+
},
|
|
313
|
+
"rightListLabel": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"mutable": false,
|
|
316
|
+
"complexType": {
|
|
317
|
+
"original": "string",
|
|
318
|
+
"resolved": "string",
|
|
319
|
+
"references": {}
|
|
320
|
+
},
|
|
321
|
+
"required": false,
|
|
322
|
+
"optional": false,
|
|
323
|
+
"docs": {
|
|
324
|
+
"tags": [],
|
|
325
|
+
"text": "R\u00F3tulo da lista direita."
|
|
326
|
+
},
|
|
327
|
+
"attribute": "right-list-label",
|
|
328
|
+
"reflect": false,
|
|
329
|
+
"defaultValue": "'selecionados'"
|
|
330
|
+
},
|
|
331
|
+
"rightTitle": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"mutable": false,
|
|
334
|
+
"complexType": {
|
|
335
|
+
"original": "string",
|
|
336
|
+
"resolved": "string",
|
|
337
|
+
"references": {}
|
|
338
|
+
},
|
|
339
|
+
"required": false,
|
|
340
|
+
"optional": false,
|
|
341
|
+
"docs": {
|
|
342
|
+
"tags": [],
|
|
343
|
+
"text": "Define o t\u00EDtulo da lista destino."
|
|
344
|
+
},
|
|
345
|
+
"attribute": "right-title",
|
|
346
|
+
"reflect": false
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
static get states() {
|
|
351
|
+
return {
|
|
352
|
+
"leftFilteredList": {},
|
|
353
|
+
"rightFilteredList": {},
|
|
354
|
+
"selectedLeftList": {},
|
|
355
|
+
"selectedRightList": {},
|
|
356
|
+
"isFilteringLeft": {},
|
|
357
|
+
"isFilteringRight": {}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
static get events() {
|
|
361
|
+
return [{
|
|
362
|
+
"method": "ezLeftListChanged",
|
|
363
|
+
"name": "ezLeftListChanged",
|
|
364
|
+
"bubbles": true,
|
|
365
|
+
"cancelable": true,
|
|
366
|
+
"composed": true,
|
|
367
|
+
"docs": {
|
|
368
|
+
"tags": [],
|
|
369
|
+
"text": ""
|
|
370
|
+
},
|
|
371
|
+
"complexType": {
|
|
372
|
+
"original": "Array<ListItem>",
|
|
373
|
+
"resolved": "ListItem[]",
|
|
374
|
+
"references": {
|
|
375
|
+
"Array": {
|
|
376
|
+
"location": "global"
|
|
377
|
+
},
|
|
378
|
+
"ListItem": {
|
|
379
|
+
"location": "import",
|
|
380
|
+
"path": "../ez-list/ez-list"
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}, {
|
|
385
|
+
"method": "ezRightListChanged",
|
|
386
|
+
"name": "ezRightListChanged",
|
|
387
|
+
"bubbles": true,
|
|
388
|
+
"cancelable": true,
|
|
389
|
+
"composed": true,
|
|
390
|
+
"docs": {
|
|
391
|
+
"tags": [],
|
|
392
|
+
"text": ""
|
|
393
|
+
},
|
|
394
|
+
"complexType": {
|
|
395
|
+
"original": "Array<ListItem>",
|
|
396
|
+
"resolved": "ListItem[]",
|
|
397
|
+
"references": {
|
|
398
|
+
"Array": {
|
|
399
|
+
"location": "global"
|
|
400
|
+
},
|
|
401
|
+
"ListItem": {
|
|
402
|
+
"location": "import",
|
|
403
|
+
"path": "../ez-list/ez-list"
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}];
|
|
408
|
+
}
|
|
409
|
+
static get watchers() {
|
|
410
|
+
return [{
|
|
411
|
+
"propName": "leftList",
|
|
412
|
+
"methodName": "observeLeftList"
|
|
413
|
+
}, {
|
|
414
|
+
"propName": "rightList",
|
|
415
|
+
"methodName": "observeRightList"
|
|
416
|
+
}];
|
|
417
|
+
}
|
|
418
|
+
}
|
|
@@ -2,7 +2,7 @@ import { UserInterface } from "@sankhyalabs/core";
|
|
|
2
2
|
import { REQUIRED_INFO } from "../../../utils/constants";
|
|
3
3
|
import { buildCheckBox, buildSwitch } from "./templates/CheckBox.tpl";
|
|
4
4
|
import { buildComboBox } from "./templates/ComboBox.tpl";
|
|
5
|
-
import { buildDate, buildTime, buildDateTime } from "./templates/DateInput.tpl";
|
|
5
|
+
import { buildDate, buildTime, buildDateTime, buildTimeSeconds } from "./templates/DateInput.tpl";
|
|
6
6
|
import { buildFile } from "./templates/FileInput.tpl";
|
|
7
7
|
import { buildDecimal, buildInteger } from "./templates/NumberInput.tpl";
|
|
8
8
|
import { buildSearch } from "./templates/SearchInput.tpl";
|
|
@@ -14,6 +14,7 @@ uiBuilders.set(UserInterface.SWITCH, buildSwitch);
|
|
|
14
14
|
uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
15
15
|
uiBuilders.set(UserInterface.DATE, buildDate);
|
|
16
16
|
uiBuilders.set(UserInterface.TIME, buildTime);
|
|
17
|
+
uiBuilders.set(UserInterface.ELAPSEDTIME, buildTimeSeconds);
|
|
17
18
|
uiBuilders.set(UserInterface.DATETIME, buildDateTime);
|
|
18
19
|
uiBuilders.set(UserInterface.FILE, buildFile);
|
|
19
20
|
uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
|
|
@@ -2,8 +2,12 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
export const buildDate = ({ name, label, readOnly, canShowError }) => {
|
|
3
3
|
return (h("div", { class: "ez-col ez-col--sd-12" }, h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError, noMargin: true })));
|
|
4
4
|
};
|
|
5
|
-
export const buildTime = ({ name, label, readOnly, canShowError }) => {
|
|
6
|
-
|
|
5
|
+
export const buildTime = ({ name, label, readOnly, canShowError, props }) => {
|
|
6
|
+
var _a;
|
|
7
|
+
return (h("div", { class: "ez-col ez-col--sd-12" }, h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError, noMargin: true, "show-seconds": (_a = props === null || props === void 0 ? void 0 : props.showSeconds) !== null && _a !== void 0 ? _a : false })));
|
|
8
|
+
};
|
|
9
|
+
export const buildTimeSeconds = ({ name, label, readOnly, canShowError }) => {
|
|
10
|
+
return (h("div", { class: "ez-col ez-col--sd-12" }, h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError, noMargin: true, showSeconds: true })));
|
|
7
11
|
};
|
|
8
12
|
export const buildDateTime = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
9
13
|
return (h("div", { class: "ez-col ez-col--sd-12" }, h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, noMargin: true })));
|
package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ApplicationContext, HTMLBuilder } from '@sankhyalabs/core';
|
|
2
2
|
import { getViewPortHeight } from '../GridEditorUtils';
|
|
3
|
+
import { StringUtils } from "@sankhyalabs/core";
|
|
3
4
|
export const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) => {
|
|
5
|
+
var _a;
|
|
4
6
|
const ezSearch = HTMLBuilder.parseElement(`<ez-search
|
|
5
7
|
class="ez-grid grid_editor"
|
|
6
8
|
mode="slim"
|
|
@@ -8,11 +10,13 @@ export const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) =
|
|
|
8
10
|
enabled=${!readOnly}
|
|
9
11
|
/>`);
|
|
10
12
|
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
13
|
+
const metadata = dataUnit.getField(name);
|
|
11
14
|
ezSearch.optionLoader = (argument) => loader(argument, name, dataUnit);
|
|
12
15
|
ezSearch.ensureClearButtonVisible = true;
|
|
13
16
|
ezSearch.suppressPreLoad = true;
|
|
14
17
|
ezSearch.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
|
|
15
18
|
ezSearch.stopPropagateEnterKeyEvent = true;
|
|
19
|
+
ezSearch.ignoreLimitCharsToSearch = StringUtils.getBooleanValue((_a = metadata === null || metadata === void 0 ? void 0 : metadata.properties) === null || _a === void 0 ? void 0 : _a.ignoreLimitCharsToSearch);
|
|
16
20
|
ezSearch.autoFocus = true;
|
|
17
21
|
ezSearch.valueGetter = () => ezSearch.getValueAsync();
|
|
18
22
|
return ezSearch;
|
|
@@ -11,13 +11,19 @@
|
|
|
11
11
|
/*@doc Define o z-index do componente selection counter.*/
|
|
12
12
|
--ez-grid__selection-counter--z-index: var(--visible, 1);
|
|
13
13
|
/*@doc Define o sombreamento usado como borda.*/
|
|
14
|
-
--ez-grid__container--shadow:
|
|
14
|
+
--ez-grid__container--shadow: var(--shadow);
|
|
15
15
|
/*@doc Define altura mínima da grid */
|
|
16
16
|
--ez-grid--min-height: 300px;
|
|
17
17
|
/*@doc Define o outline usado como borda.*/
|
|
18
|
-
--ez-grid__container--outline:
|
|
19
|
-
/*@doc Define
|
|
20
|
-
--ez-
|
|
18
|
+
--ez-grid__container--shadow--outline: var(--shadow--outline) var(--color--strokes);
|
|
19
|
+
/*@doc Define a sombra do header.*/
|
|
20
|
+
--ez-grid__header--shadow: var(--shadow--xsmall);
|
|
21
|
+
/*@doc Define o outline usado como borda do header.*/
|
|
22
|
+
--ez-grid__header--shadow--outline: var(--shadow--outline) var(--color--strokes);
|
|
23
|
+
/*@doc Define o outline do header.*/
|
|
24
|
+
--ez-grid__header--outline: none;
|
|
25
|
+
/*@doc Define a borda do header.*/
|
|
26
|
+
--ez-grid__header--border: none;
|
|
21
27
|
|
|
22
28
|
min-height: var(--ez-grid--min-height);
|
|
23
29
|
}
|
|
@@ -31,6 +37,18 @@
|
|
|
31
37
|
background-color: var(--ez-grid__header--background-color, #FFF);
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
.grid-header.shadow-mode {
|
|
41
|
+
box-shadow: var(--ez-grid__header--shadow);
|
|
42
|
+
border: var(--ez-grid__header--border);
|
|
43
|
+
outline: var(--ez-grid__header--outline);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.grid-header.outline-mode {
|
|
47
|
+
box-shadow: var(--ez-grid__header--shadow--outline);
|
|
48
|
+
border: var(--ez-grid__header--border);
|
|
49
|
+
outline: var(--ez-grid__header--outline);
|
|
50
|
+
}
|
|
51
|
+
|
|
34
52
|
.grid__container {
|
|
35
53
|
/*private*/
|
|
36
54
|
padding-top: 15px;
|
|
@@ -42,9 +60,9 @@
|
|
|
42
60
|
background-color: var(--ez-grid__header--background-color);
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
.grid__container.
|
|
63
|
+
.grid__container.outline-mode {
|
|
46
64
|
/*public*/
|
|
47
|
-
box-shadow: var(--ez-grid__container--shadow
|
|
65
|
+
box-shadow: var(--ez-grid__container--shadow--outline);
|
|
48
66
|
border: none;
|
|
49
67
|
outline: none;
|
|
50
68
|
}
|