@sankhyalabs/ezui 5.22.0-dev.63 → 5.22.0-dev.65

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.
Files changed (55) hide show
  1. package/dist/cjs/{ez-card-item_3.cjs.entry.js → ez-card-item_2.cjs.entry.js} +0 -123
  2. package/dist/cjs/ez-double-list.cjs.entry.js +285 -0
  3. package/dist/cjs/ez-filter-input.cjs.entry.js +130 -0
  4. package/dist/cjs/ez-form-view.cjs.entry.js +8 -2
  5. package/dist/cjs/ez-list.cjs.entry.js +246 -205
  6. package/dist/cjs/ez-popup.cjs.entry.js +4 -1
  7. package/dist/cjs/ezListHelper-0d3970b4.js +90 -0
  8. package/dist/cjs/ezui.cjs.js +1 -1
  9. package/dist/cjs/index-a7b0c73d.js +10 -2
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/collection/collection-manifest.json +1 -0
  12. package/dist/collection/components/ez-double-list/doubleListHelper.js +82 -0
  13. package/dist/collection/components/ez-double-list/ez-double-list.css +62 -0
  14. package/dist/collection/components/ez-double-list/ez-double-list.js +418 -0
  15. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +2 -1
  16. package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +6 -2
  17. package/dist/collection/components/ez-list/ez-list.js +273 -208
  18. package/dist/collection/components/ez-list/ezListHelper.js +85 -0
  19. package/dist/collection/components/ez-popup/ez-popup.css +1 -0
  20. package/dist/collection/components/ez-popup/ez-popup.js +5 -2
  21. package/dist/custom-elements/index.d.ts +6 -0
  22. package/dist/custom-elements/index.js +631 -218
  23. package/dist/esm/{ez-card-item_3.entry.js → ez-card-item_2.entry.js} +1 -123
  24. package/dist/esm/ez-double-list.entry.js +281 -0
  25. package/dist/esm/ez-filter-input.entry.js +126 -0
  26. package/dist/esm/ez-form-view.entry.js +8 -2
  27. package/dist/esm/ez-list.entry.js +246 -205
  28. package/dist/esm/ez-popup.entry.js +4 -1
  29. package/dist/esm/ezListHelper-00fb9b8d.js +87 -0
  30. package/dist/esm/ezui.js +1 -1
  31. package/dist/esm/index-baa5e267.js +10 -2
  32. package/dist/esm/loader.js +1 -1
  33. package/dist/ezui/ezui.esm.js +1 -1
  34. package/dist/ezui/p-13165bb1.entry.js +1 -0
  35. package/dist/ezui/p-17eabf46.entry.js +1 -0
  36. package/dist/ezui/p-2475fd6e.entry.js +1 -0
  37. package/dist/ezui/p-31d1fab6.entry.js +1 -0
  38. package/dist/ezui/p-65f471bc.entry.js +1 -0
  39. package/dist/ezui/p-80dfc50b.js +1 -0
  40. package/dist/ezui/p-e3e3fd7a.entry.js +1 -0
  41. package/dist/types/components/ez-double-list/doubleListHelper.d.ts +10 -0
  42. package/dist/types/components/ez-double-list/ez-double-list.d.ts +86 -0
  43. package/dist/types/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.d.ts +2 -1
  44. package/dist/types/components/ez-list/ez-list.d.ts +19 -3
  45. package/dist/types/components/ez-list/ezListHelper.d.ts +20 -0
  46. package/dist/types/components/ez-popup/ez-popup.d.ts +1 -1
  47. package/dist/types/components.d.ts +97 -6
  48. package/package.json +1 -1
  49. package/react/components.d.ts +1 -0
  50. package/react/components.js +1 -0
  51. package/react/components.js.map +1 -1
  52. package/dist/ezui/p-4575d511.entry.js +0 -1
  53. package/dist/ezui/p-bfad39eb.entry.js +0 -1
  54. package/dist/ezui/p-c806f32f.entry.js +0 -1
  55. package/dist/ezui/p-e78e0843.entry.js +0 -1
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-a7b0c73d.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const CSSVarsUtils = require('./CSSVarsUtils-10c9d5b4.js');
8
7
 
9
8
  const ezCardItemCss = ":host { \n /*@doc Define o tamanho da fonte do componente.*/\n --ez-card-item--font-size: var(--text--medium, 14px);\n\n /*@doc Define o tamanho da fonte do componente no modo compacto.*/\n --ez-card-item--font-size-compacted: var(--text--extra-small, 10px);\n\n /*@doc Define a família da fonte do componente.*/\n --ez-card-item--font-family: var(--font-pattern, Arial);\n\n /*@doc Define o peso da fonte do componente.*/\n --ez-card-item--font-weight: var(--text-weight--medium, 400);\n\n /*@doc Define o peso da fonte do title do componente.*/\n --ez-card-item--font-weight-large: var(--text-weight--large, 600);\n\n /*@doc Define a cor da fonte do componente.*/\n --ez-card-item--color: var(--text--primary, #626e82);\n\n /*@doc Define a cor da fonte da key do componente.*/\n --ez-card-item__key--color: var(--text--primary, #626e82);\n\n /*@doc Define a cor da fonte do label do detalhe do componente.*/\n --ez-card-item__detail-label--color: var(--text--secondary, #A2ABB9);\n\n /*@doc Define o espaçamento inferior dos detalhes do componente.*/\n --ez-card-item__detail--padding-bottom: var(--space--extra-small, 3px);\n\n /*@doc Define o espaçamento inferior do title do componente.*/\n --ez-card-item__title--padding-bottom: var(--space--extra-small, 3px);\n\n /*@doc Define a cor do highlight / marcação nos textos do componente.*/\n --ez-card-item__highlight--color: var(--color--primary-300, #E2F4EF);\n\n /*@doc Define o peso da fonte do componente.*/\n --ez-card-item--detail-label--font-weight: var(--text-weight--large, 400);\n\n width: 100%;\n display: flex;\n cursor: pointer;\n}\n\n.card-item {\n display: flex;\n flex-direction: column;\n width: 100%;\n cursor: pointer;\n z-index: 0;\n position: relative;\n container-type: inline-size;\n container-name: box;\n white-space: pre-line;\n}\n\n.card-item__detail{\n display: inline-block;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n opacity: var(--opacity--soft);\n}\n\n\n\n.card-item__expanded {\n padding: var(--space--medium);\n}\n\n.card-item:hover {\n background: #F0F3F7;\n border-radius: 12px;\n}\n\n.card-item__title {\n display: flex;\n align-items: center;\n line-height: 18px;\n cursor: pointer;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--font-weight-large);\n color: var(--ez-card-item--color);\n padding-bottom: var(--ez-card-item__title--padding-bottom);\n gap: var(--space--small, 6px);\n}\n\n.card-item__key {\n /*public*/\n color: var(--ez-card-item__key--color);\n}\n\n.card-item__details {\n display: flex;\n flex-direction: column;\n cursor: pointer;\n justify-content: space-between;\n width: 100%;\n}\n\n.card-item__details-container__left {\n display: flex;\n flex-direction: column;\n white-space: pre-line;\n cursor: pointer;\n width: 50%;\n}\n\n.card-item__details-container__right {\n display: flex;\n flex-direction: column;\n white-space: pre-line;\n width: 50%;\n cursor: pointer;\n}\n\n.card-item__detail{\n cursor: pointer;\n}\n\n.card-item__detail-default:not(:last-child) {\n padding-bottom: var(--ez-card-item__detail--padding-bottom);\n}\n\n.card-item__detail-label {\n cursor: pointer;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--detail-label--font-weight);\n}\n\n.card-item__detail-value {\n cursor: pointer;\n line-break: anywhere;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--font-weight);\n}\n\n.card-item__highlight {\n position: relative;\n border-radius: 8px;\n z-index: -1;\n\n /*public*/\n background-color: var(--ez-card-item__highlight--color);\n outline: 2px solid var(--ez-card-item__highlight--color);\n box-shadow: -4px 0px 0px 0px var(--ez-card-item__highlight--color), \n 4px 0px 0px 0px var(--ez-card-item__highlight--color);\n}\n\n.card-item__content{\n display: flex;\n align-items: center;\n}\n\n.card-item__details-container_default{\n display: flex;\n}\n\n.card-item__details-slot{\n margin-left: auto;\n}\n\n/* Modo compacto */\n.card-item__compacted {\n padding: var(--space--medium);\n padding-bottom: 0px;\n padding-right: 0px;\n}\n\n.card-item__detail-label-compacted {\n font-size: var(--ez-card-item--font-size-compacted);\n}\n\n.card-item__detail-value-compacted {\n font-size: var(--ez-card-item--font-size-compacted);\n}\n\n.card-item__title-compacted {\n font-size: var(--ez-card-item--font-size-compacted);\n}\n\n.card-item__details-container__left-compacted{\n width: 100%;\n}\n\n.card-item__details-container__right-compacted {\n width: 100%;\n}\n\n\n@container box (max-width: 550px) {\n .card-item__details {\n flex-direction: column;\n }\n\n .card-item__details-container__left {\n width: 100%;\n }\n \n .card-item__details-container__right {\n width: 100%;\n }\n}\n\n@container box (max-width: 200px) {\n .card-item__title {\n font-size: 10px;\n }\n\n .card-item__detail-label {\n font-size: 10px;\n }\n\n .card-item__detail-value {\n font-size: 10px;\n }\n\n}";
10
9
 
@@ -60,127 +59,6 @@ const EzCardItem = class {
60
59
  };
61
60
  EzCardItem.style = ezCardItemCss;
62
61
 
63
- const ezFilterInputCss = ":host{display:block;width:100%}";
64
-
65
- const EzFilterInput = class {
66
- constructor(hostRef) {
67
- index.registerInstance(this, hostRef);
68
- this.ezChange = index.createEvent(this, "ezChange", 7);
69
- this.ezSearching = index.createEvent(this, "ezSearching", 7);
70
- this.ezFocusIn = index.createEvent(this, "ezFocusIn", 7);
71
- this._searchingText = "";
72
- this.handleFocus = () => {
73
- if (this._searchingText === "") {
74
- this._textInput.value = "";
75
- }
76
- else {
77
- this._textInput.value = this._searchingText;
78
- }
79
- this.ezFocusIn.emit();
80
- };
81
- this.label = undefined;
82
- this.value = undefined;
83
- this.enabled = true;
84
- this.errorMessage = undefined;
85
- this.restrict = undefined;
86
- this.mode = "regular";
87
- this.asyncSearch = false;
88
- this.canShowError = true;
89
- this.autoFocus = false;
90
- this.noMargin = false;
91
- }
92
- observeLabel() {
93
- if (this._textInput) {
94
- this._textInput.label = this.label;
95
- }
96
- }
97
- observeErrorMessage() {
98
- if (this._textInput) {
99
- this._textInput.errorMessage = this.errorMessage;
100
- }
101
- }
102
- observeValue(newValue, oldValue) {
103
- if (this._textInput && newValue != oldValue) {
104
- this._textInput.value = newValue;
105
- this.ezChange.emit(newValue);
106
- }
107
- }
108
- /**
109
- * Aplica o foco no campo.
110
- */
111
- async setFocus(options) {
112
- this._textInput.setFocus(options);
113
- }
114
- /**
115
- * Remove o foco do campo.
116
- */
117
- async setBlur() {
118
- this._textInput.setBlur();
119
- }
120
- /**
121
- * Retorna se o conteúdo é inválido.
122
- */
123
- async isInvalid() {
124
- return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
125
- }
126
- /**
127
- * Método responsável por setar um novo valor ao campo.
128
- */
129
- async setValue(newValue) {
130
- if (!this.asyncSearch || this._textInput == undefined) {
131
- return;
132
- }
133
- if (newValue !== this.value) {
134
- this.value = newValue;
135
- this._searchingText = "";
136
- }
137
- else {
138
- this._textInput.value = newValue;
139
- }
140
- }
141
- /**
142
- * Método responsável por resetar o valor do campo para o ultimo valor inputado.
143
- */
144
- async endSearch() {
145
- if (!this.asyncSearch || this._textInput == undefined) {
146
- return;
147
- }
148
- if (this._textInput.value !== this.value) {
149
- this._textInput.value = this.value;
150
- }
151
- }
152
- handleChange(evt) {
153
- const newValue = evt.detail;
154
- this.errorMessage = "";
155
- if (this.asyncSearch) {
156
- this._searchingText = newValue;
157
- this.ezSearching.emit(newValue);
158
- }
159
- else if (newValue !== this.value) {
160
- this.value = newValue;
161
- }
162
- }
163
- componentDidLoad() {
164
- CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
165
- if (this.autoFocus) {
166
- requestAnimationFrame(() => {
167
- this.setFocus({ selectText: true });
168
- });
169
- }
170
- }
171
- render() {
172
- core.ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
173
- return (index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError, noMargin: this.noMargin }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" })));
174
- }
175
- get _elem() { return index.getElement(this); }
176
- static get watchers() { return {
177
- "label": ["observeLabel"],
178
- "errorMessage": ["observeErrorMessage"],
179
- "value": ["observeValue"]
180
- }; }
181
- };
182
- EzFilterInput.style = ezFilterInputCss;
183
-
184
62
  const multiSelectionBoxMessageCss = ".multi-selection__message{display:flex;flex-direction:row;align-items:center;justify-content:center;width:100%;min-height:320px;text-align:center}.multi-selection__text-message{margin-top:-30px;font-family:var(--font-pattern);font-size:var(--text--meduim);padding:var(--space-xs);color:var(--text--primary)}";
185
63
 
186
64
  const MultiSelectionBoxMessage = class {
@@ -195,5 +73,4 @@ const MultiSelectionBoxMessage = class {
195
73
  MultiSelectionBoxMessage.style = multiSelectionBoxMessageCss;
196
74
 
197
75
  exports.ez_card_item = EzCardItem;
198
- exports.ez_filter_input = EzFilterInput;
199
76
  exports.multi_selection_box_message = MultiSelectionBoxMessage;
@@ -0,0 +1,285 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a7b0c73d.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const ezListHelper = require('./ezListHelper-0d3970b4.js');
8
+ const EzScrollDirection = require('./EzScrollDirection-b2c99895.js');
9
+
10
+ function moveItems(selectedItemsList, itemsList, foward) {
11
+ if (!selectedItemsList.length)
12
+ return [...itemsList];
13
+ if (!itemsList.length)
14
+ return [];
15
+ const selectedIndexes = getItemsIndex(selectedItemsList, itemsList);
16
+ const startIndex = getMinValue(selectedIndexes);
17
+ const endIndex = getMaxValue(selectedIndexes);
18
+ return moveRange(startIndex, endIndex, foward, itemsList);
19
+ }
20
+ function getMinValue(numbers) {
21
+ if (numbers.length === 0)
22
+ return 0;
23
+ return numbers.reduce((min, current) => (current < min ? current : min), numbers[0]);
24
+ }
25
+ function getMaxValue(numbers) {
26
+ if (numbers.length === 0)
27
+ return 0;
28
+ return numbers.reduce((max, current) => (current > max ? current : max), numbers[0]);
29
+ }
30
+ function getItemsIndex(selectedItemsList, itemsList) {
31
+ return selectedItemsList.map(selectedId => itemsList.findIndex(original => original.id === selectedId));
32
+ }
33
+ function moveRange(startIndex, endIndex, moveForward, listItem) {
34
+ if (startIndex < 0 || endIndex >= listItem.length || startIndex > endIndex)
35
+ return listItem;
36
+ if (moveForward)
37
+ return moveFoward(endIndex, startIndex, listItem);
38
+ return moveBackward(startIndex, endIndex, listItem);
39
+ }
40
+ function moveBackward(startIndex, endIndex, listItem) {
41
+ if (startIndex === 0)
42
+ return listItem;
43
+ const beforeRange = listItem.slice(0, startIndex - 1);
44
+ const range = listItem.slice(startIndex, endIndex + 1);
45
+ const afterRange = listItem.slice(endIndex + 1);
46
+ const movedItem = listItem[startIndex - 1];
47
+ return [...beforeRange, ...range, movedItem, ...afterRange];
48
+ }
49
+ function moveFoward(endIndex, startIndex, listItem) {
50
+ if (endIndex === listItem.length - 1)
51
+ return listItem;
52
+ const beforeRange = listItem.slice(0, startIndex);
53
+ const range = listItem.slice(startIndex, endIndex + 1);
54
+ const afterRange = listItem.slice(endIndex + 1);
55
+ const movedItem = afterRange.shift();
56
+ return movedItem
57
+ ? [...beforeRange, movedItem, ...range, ...afterRange]
58
+ : listItem;
59
+ }
60
+ function transferAll({ from, to, selectedFrom, selectedTo }) {
61
+ to = [...to.map(i => setItemSelection(i, false)), ...from.map(i => setItemSelection(i, true))];
62
+ selectedFrom = [];
63
+ selectedTo = [...from.map(({ id }) => id)];
64
+ from = [];
65
+ return { from, to, selectedFrom, selectedTo };
66
+ }
67
+ function transferItems({ from, to, selectedFrom, selectedTo }) {
68
+ if (!from.length)
69
+ return { from, to, selectedFrom, selectedTo };
70
+ const itemsToTransfer = getItemsToTransfer(to, selectedFrom, from);
71
+ if (!itemsToTransfer.length)
72
+ return { from, to, selectedFrom, selectedTo };
73
+ to = [
74
+ ...to.map(i => setItemSelection(i, false)),
75
+ ...itemsToTransfer.map(i => setItemSelection(i, true))
76
+ ];
77
+ const selectedFromIds = selectedFrom.map(id => id);
78
+ from = [...from.filter(item => !selectedFromIds.includes(item.id))];
79
+ selectedTo = [...selectedFrom];
80
+ selectedFrom = [];
81
+ return { from, to, selectedFrom, selectedTo };
82
+ }
83
+ function getItemsToTransfer(to, selectedFrom, from) {
84
+ const toListIds = to.map(item => item.id);
85
+ //Não deve transferir um item que já existe na lista destino
86
+ const itemsToTransferId = selectedFrom.filter((id) => !toListIds.includes(id));
87
+ return from.filter(({ id }) => itemsToTransferId.includes(id));
88
+ }
89
+ function setItemSelection(item, select) {
90
+ return Object.assign(Object.assign({}, item), { selected: select });
91
+ }
92
+
93
+ const ezDoubleListCss = ".sc-ez-double-list-h{display:flex;flex-direction:row;gap:8px;align-items:center;font-family:var(--font-pattern, \"Roboto\")}.group.sc-ez-double-list{display:flex;justify-content:space-between;gap:10px;flex-direction:column;border:var(--border--small) var(--color--strokes);border-radius:var(--border--radius-medium);width:350px;height:400px}.group__header.sc-ez-double-list{background:var(--background--body);padding:10px;border-radius:var(--border--radius-medium) var(--border--radius-medium) 0 0}.group__label.sc-ez-double-list{font-weight:var(--text-weight--large);font-size:var(--text--medium);color:var(--title--primary);margin-bottom:10px;display:block}.group__totalizer.sc-ez-double-list{padding:5px 10px;background:var(--background--body);font-weight:var(--text-weight--medium);font-size:var(--text--medium);color:var(--text--secondary);border-radius:0 0 var(--border--radius-medium) var(--border--radius-medium)}.empty-message.sc-ez-double-list{font-weight:var(--text-weight--medium);font-size:var(--text--medium);color:var(--text--secondary);text-align:center;margin:auto}.list__container.sc-ez-double-list{height:100%;min-height:150px;overflow:auto;display:flex}.actions__column.sc-ez-double-list{display:flex;flex-direction:column;gap:4px}";
94
+
95
+ const EzDoubleList = class {
96
+ constructor(hostRef) {
97
+ index.registerInstance(this, hostRef);
98
+ this.ezLeftListChanged = index.createEvent(this, "ezLeftListChanged", 7);
99
+ this.ezRightListChanged = index.createEvent(this, "ezRightListChanged", 7);
100
+ this.LEFT_LIST_ID = 'LEFT-LIST-ID';
101
+ this.RIGHT_LIST_ID = 'RIGHT-LIST-ID';
102
+ this.LEFT_FILTER_ID = 'LEFT-FILTER-ID';
103
+ this.RIGHT_FILTER_ID = 'RIGHT-FILTER-ID';
104
+ this.leftList = [];
105
+ this.leftTitle = undefined;
106
+ this.rightList = [];
107
+ this.entityLabel = 'item';
108
+ this.entityLabelPlural = 'itens';
109
+ this.leftListLabel = 'disponíveis';
110
+ this.rightListLabel = 'selecionados';
111
+ this.rightTitle = undefined;
112
+ this.leftFilteredList = [];
113
+ this.rightFilteredList = [];
114
+ this.selectedLeftList = [];
115
+ this.selectedRightList = [];
116
+ this.isFilteringLeft = false;
117
+ this.isFilteringRight = false;
118
+ }
119
+ observeLeftList(newValue, oldValue) {
120
+ if (core.ObjectUtils.equals(newValue, oldValue))
121
+ return;
122
+ this.ezLeftListChanged.emit(newValue);
123
+ }
124
+ observeRightList(newValue, oldValue) {
125
+ if (core.ObjectUtils.equals(newValue, oldValue))
126
+ return;
127
+ this.ezRightListChanged.emit(newValue);
128
+ }
129
+ handleFilterChangeLeft(value) {
130
+ this.leftFilteredList = core.ArrayUtils.applyStringFilter(value, this.leftList, true, 'label');
131
+ this.isFilteringLeft = this.leftFilteredList.length !== this.leftList.length;
132
+ }
133
+ handleFilterChangeRight(value) {
134
+ this.rightFilteredList = core.ArrayUtils.applyStringFilter(value, this.rightList, true, 'label');
135
+ this.isFilteringRight = this.rightFilteredList.length !== this.rightList.length;
136
+ }
137
+ async handleChangeLeft({ detail }) {
138
+ this.leftList = [...detail];
139
+ this.selectedLeftList = [...detail.filter(item => item.selected)];
140
+ await this.leftEzListInstance.clearHistory();
141
+ }
142
+ async handleChangeRight({ detail }) {
143
+ this.rightList = [...detail];
144
+ this.selectedRightList = [...detail.filter(item => item.selected)];
145
+ await this.rightEzListInstance.clearHistory();
146
+ }
147
+ enableTransferAllToRight() {
148
+ return this.leftList.length > 0;
149
+ }
150
+ enableTransferAllToLeft() {
151
+ return this.rightList.length > 0;
152
+ }
153
+ enableTransferToRight() {
154
+ return this.selectedLeftList.length > 0;
155
+ }
156
+ enableTransferToLeft() {
157
+ return this.selectedRightList.length > 0;
158
+ }
159
+ enableMoveUp(moveAll) {
160
+ if (this.isFilteringRight)
161
+ return false;
162
+ const selectedIndexes = this.getRightSelectedItemsIndex();
163
+ return this.selectedRightList.length > 0
164
+ && !selectedIndexes.includes(0)
165
+ && (moveAll ? true : ezListHelper.isContinuousSequence(selectedIndexes));
166
+ }
167
+ enableMoveDown(moveAll) {
168
+ if (this.isFilteringRight)
169
+ return false;
170
+ const selectedIndexes = this.getRightSelectedItemsIndex();
171
+ const lastIndex = this.rightList.length - 1;
172
+ return this.selectedRightList.length > 0
173
+ && !selectedIndexes.includes(lastIndex)
174
+ && (moveAll ? true : ezListHelper.isContinuousSequence(selectedIndexes));
175
+ }
176
+ getRightSelectedItemsIndex() {
177
+ return this.selectedRightList.map(id => this.rightList.findIndex(original => original.id === id));
178
+ }
179
+ transferToRight() {
180
+ const { from, to, selectedFrom, selectedTo } = transferItems(this.buildTransferToRightConfig());
181
+ this.leftList = [...from];
182
+ this.rightList = [...to];
183
+ this.selectedLeftList = [...selectedFrom];
184
+ this.selectedRightList = [...selectedTo];
185
+ }
186
+ transferToLeft() {
187
+ const { from, to, selectedFrom, selectedTo } = transferItems(this.buildTransferToLeftConfig());
188
+ this.rightList = [...from];
189
+ this.leftList = [...to];
190
+ this.selectedRightList = [...selectedFrom];
191
+ this.selectedLeftList = [...selectedTo];
192
+ }
193
+ handleTransferAllToRight() {
194
+ const { from, to, selectedFrom, selectedTo } = transferAll(this.buildTransferToRightConfig());
195
+ this.leftList = [...from];
196
+ this.rightList = [...to];
197
+ this.selectedLeftList = [...selectedFrom];
198
+ this.selectedRightList = [...selectedTo];
199
+ }
200
+ handleTransferAllToLeft() {
201
+ const { from, to, selectedFrom, selectedTo } = transferAll(this.buildTransferToLeftConfig());
202
+ this.rightList = [...from];
203
+ this.leftList = [...to];
204
+ this.selectedRightList = [...selectedFrom];
205
+ this.selectedLeftList = [...selectedTo];
206
+ }
207
+ buildTransferToRightConfig() {
208
+ return {
209
+ from: this.leftList,
210
+ to: this.rightList,
211
+ selectedFrom: this.selectedLeftList,
212
+ selectedTo: this.selectedRightList,
213
+ };
214
+ }
215
+ buildTransferToLeftConfig() {
216
+ return {
217
+ from: this.rightList,
218
+ to: this.leftList,
219
+ selectedFrom: this.selectedRightList,
220
+ selectedTo: this.selectedLeftList,
221
+ };
222
+ }
223
+ handleMoveUp() {
224
+ this.rightList = [...moveItems(this.selectedRightList, this.rightList, false)];
225
+ }
226
+ handleMoveDown() {
227
+ this.rightList = [...moveItems(this.selectedRightList, this.rightList, true)];
228
+ }
229
+ handleMoveToTop() {
230
+ const { itemsToKeep, itemsToMove } = this.getItemsToKeepAndToMove();
231
+ this.rightList = [...itemsToMove, ...itemsToKeep];
232
+ }
233
+ handleMoveToBottom() {
234
+ const { itemsToKeep, itemsToMove } = this.getItemsToKeepAndToMove();
235
+ this.rightList = [...itemsToKeep, ...itemsToMove];
236
+ }
237
+ handleSelectLeftItem({ detail }) {
238
+ const selectedItems = Array.isArray(detail) ? detail : [detail];
239
+ this.selectedLeftList = [...selectedItems.map(({ id }) => id)];
240
+ }
241
+ handleSelectRightItem({ detail }) {
242
+ const selectedItems = Array.isArray(detail) ? detail : [detail];
243
+ this.selectedRightList = [...selectedItems.map(({ id }) => id)];
244
+ }
245
+ getItemsToKeepAndToMove() {
246
+ const itemsToKeep = this.rightList.filter(item => !this.selectedRightList.includes(item.id));
247
+ const itemsToMove = this.rightList.filter(item => this.selectedRightList.includes(item.id));
248
+ return { itemsToKeep, itemsToMove };
249
+ }
250
+ handleTransferToRight() {
251
+ this.transferToRight();
252
+ this.leftFilteredList = [];
253
+ this.leftEzFilterInput.value = '';
254
+ }
255
+ handleTransferToLeft() {
256
+ this.transferToLeft();
257
+ this.rightFilteredList = [];
258
+ this.rightEzFilterInput.value = '';
259
+ }
260
+ buildTotalizer(list) {
261
+ return `Total de ${list.length} ${list.length === 1 ? this.entityLabel : this.entityLabelPlural}`;
262
+ }
263
+ renderLeftList() {
264
+ if (!this.leftList.length) {
265
+ return index.h("span", { class: 'empty-message' }, "Nenhum ", this.entityLabel, " dispon\u00EDvel");
266
+ }
267
+ return (index.h("ez-scroller", { direction: EzScrollDirection.EzScrollDirection.VERTICAL, activeShadow: true }, index.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) })));
268
+ }
269
+ renderRightList() {
270
+ if (!this.rightList.length) {
271
+ return index.h("span", { class: 'empty-message' }, "Nenhum ", this.entityLabel, " selecionado");
272
+ }
273
+ return (index.h("ez-scroller", { direction: EzScrollDirection.EzScrollDirection.VERTICAL, activeShadow: true }, index.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) })));
274
+ }
275
+ render() {
276
+ return (index.h(index.Host, null, index.h("div", { class: 'group' }, index.h("div", { class: 'group__header' }, index.h("span", { class: 'group__label' }, this.leftTitle), index.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) })), index.h("div", { class: 'list__container' }, this.renderLeftList()), index.h("div", { class: 'group__totalizer' }, this.buildTotalizer(this.leftList))), index.h("div", { class: 'actions__column' }, index.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) }), index.h("ez-button", { mode: 'icon', iconName: 'chevron-right', enabled: this.enableTransferToRight(), title: `Mover para ${this.leftListLabel}`, size: 'small', onClick: this.handleTransferToRight.bind(this) }), index.h("ez-button", { mode: 'icon', iconName: 'chevron-left', enabled: this.enableTransferToLeft(), title: `Mover para ${this.rightListLabel}`, size: 'small', onClick: this.handleTransferToLeft.bind(this) }), index.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) })), index.h("div", { class: 'group' }, index.h("div", { class: 'group__header' }, index.h("span", { class: 'group__label' }, this.rightTitle), index.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) })), index.h("div", { class: 'list__container' }, this.renderRightList()), index.h("div", { class: 'group__totalizer' }, this.buildTotalizer(this.rightList))), index.h("div", { class: 'actions__column' }, index.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) }), index.h("ez-button", { mode: 'icon', iconName: 'chevron-up', enabled: this.enableMoveUp(), title: 'Mover para cima', size: 'small', onClick: this.handleMoveUp.bind(this) }), index.h("ez-button", { mode: 'icon', iconName: 'chevron-down', enabled: this.enableMoveDown(), title: 'Mover para baixo', size: 'small', onClick: this.handleMoveDown.bind(this) }), index.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) }))));
277
+ }
278
+ static get watchers() { return {
279
+ "leftList": ["observeLeftList"],
280
+ "rightList": ["observeRightList"]
281
+ }; }
282
+ };
283
+ EzDoubleList.style = ezDoubleListCss;
284
+
285
+ exports.ez_double_list = EzDoubleList;
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a7b0c73d.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const CSSVarsUtils = require('./CSSVarsUtils-10c9d5b4.js');
8
+
9
+ const ezFilterInputCss = ":host{display:block;width:100%}";
10
+
11
+ const EzFilterInput = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.ezChange = index.createEvent(this, "ezChange", 7);
15
+ this.ezSearching = index.createEvent(this, "ezSearching", 7);
16
+ this.ezFocusIn = index.createEvent(this, "ezFocusIn", 7);
17
+ this._searchingText = "";
18
+ this.handleFocus = () => {
19
+ if (this._searchingText === "") {
20
+ this._textInput.value = "";
21
+ }
22
+ else {
23
+ this._textInput.value = this._searchingText;
24
+ }
25
+ this.ezFocusIn.emit();
26
+ };
27
+ this.label = undefined;
28
+ this.value = undefined;
29
+ this.enabled = true;
30
+ this.errorMessage = undefined;
31
+ this.restrict = undefined;
32
+ this.mode = "regular";
33
+ this.asyncSearch = false;
34
+ this.canShowError = true;
35
+ this.autoFocus = false;
36
+ this.noMargin = false;
37
+ }
38
+ observeLabel() {
39
+ if (this._textInput) {
40
+ this._textInput.label = this.label;
41
+ }
42
+ }
43
+ observeErrorMessage() {
44
+ if (this._textInput) {
45
+ this._textInput.errorMessage = this.errorMessage;
46
+ }
47
+ }
48
+ observeValue(newValue, oldValue) {
49
+ if (this._textInput && newValue != oldValue) {
50
+ this._textInput.value = newValue;
51
+ this.ezChange.emit(newValue);
52
+ }
53
+ }
54
+ /**
55
+ * Aplica o foco no campo.
56
+ */
57
+ async setFocus(options) {
58
+ this._textInput.setFocus(options);
59
+ }
60
+ /**
61
+ * Remove o foco do campo.
62
+ */
63
+ async setBlur() {
64
+ this._textInput.setBlur();
65
+ }
66
+ /**
67
+ * Retorna se o conteúdo é inválido.
68
+ */
69
+ async isInvalid() {
70
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
71
+ }
72
+ /**
73
+ * Método responsável por setar um novo valor ao campo.
74
+ */
75
+ async setValue(newValue) {
76
+ if (!this.asyncSearch || this._textInput == undefined) {
77
+ return;
78
+ }
79
+ if (newValue !== this.value) {
80
+ this.value = newValue;
81
+ this._searchingText = "";
82
+ }
83
+ else {
84
+ this._textInput.value = newValue;
85
+ }
86
+ }
87
+ /**
88
+ * Método responsável por resetar o valor do campo para o ultimo valor inputado.
89
+ */
90
+ async endSearch() {
91
+ if (!this.asyncSearch || this._textInput == undefined) {
92
+ return;
93
+ }
94
+ if (this._textInput.value !== this.value) {
95
+ this._textInput.value = this.value;
96
+ }
97
+ }
98
+ handleChange(evt) {
99
+ const newValue = evt.detail;
100
+ this.errorMessage = "";
101
+ if (this.asyncSearch) {
102
+ this._searchingText = newValue;
103
+ this.ezSearching.emit(newValue);
104
+ }
105
+ else if (newValue !== this.value) {
106
+ this.value = newValue;
107
+ }
108
+ }
109
+ componentDidLoad() {
110
+ CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
111
+ if (this.autoFocus) {
112
+ requestAnimationFrame(() => {
113
+ this.setFocus({ selectText: true });
114
+ });
115
+ }
116
+ }
117
+ render() {
118
+ core.ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
119
+ return (index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError, noMargin: this.noMargin }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" })));
120
+ }
121
+ get _elem() { return index.getElement(this); }
122
+ static get watchers() { return {
123
+ "label": ["observeLabel"],
124
+ "errorMessage": ["observeErrorMessage"],
125
+ "value": ["observeValue"]
126
+ }; }
127
+ };
128
+ EzFilterInput.style = ezFilterInputCss;
129
+
130
+ exports.ez_filter_input = EzFilterInput;
@@ -36,9 +36,14 @@ const buildDate = ({ name, label, readOnly, canShowError }) => {
36
36
  return (index.h("div", { class: "ez-col ez-col--sd-12" },
37
37
  index.h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError, noMargin: true })));
38
38
  };
39
- const buildTime = ({ name, label, readOnly, canShowError }) => {
39
+ const buildTime = ({ name, label, readOnly, canShowError, props }) => {
40
+ var _a;
41
+ return (index.h("div", { class: "ez-col ez-col--sd-12" },
42
+ index.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 })));
43
+ };
44
+ const buildTimeSeconds = ({ name, label, readOnly, canShowError }) => {
40
45
  return (index.h("div", { class: "ez-col ez-col--sd-12" },
41
- index.h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError, noMargin: true })));
46
+ index.h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError, noMargin: true, showSeconds: true })));
42
47
  };
43
48
  const buildDateTime = ({ name, label, readOnly, contextName, canShowError }) => {
44
49
  return (index.h("div", { class: "ez-col ez-col--sd-12" },
@@ -94,6 +99,7 @@ uiBuilders.set(core.UserInterface.SWITCH, buildSwitch);
94
99
  uiBuilders.set(core.UserInterface.OPTIONSELECTOR, buildComboBox);
95
100
  uiBuilders.set(core.UserInterface.DATE, buildDate);
96
101
  uiBuilders.set(core.UserInterface.TIME, buildTime);
102
+ uiBuilders.set(core.UserInterface.ELAPSEDTIME, buildTimeSeconds);
97
103
  uiBuilders.set(core.UserInterface.DATETIME, buildDateTime);
98
104
  uiBuilders.set(core.UserInterface.FILE, buildFile);
99
105
  uiBuilders.set(core.UserInterface.DECIMALNUMBER, buildDecimal);