@voicenter-team/voicenter-ui-plus 4.0.0-beta.6 → 4.0.0-beta.8

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 (93) hide show
  1. package/README.md +4 -1
  2. package/library/assets/components/VcFilterBar/VcFilterAddMenu.css +1 -0
  3. package/library/assets/components/VcFilterBar/VcFilterBar.css +1 -0
  4. package/library/assets/components/VcFilterBar/VcFilterChip.css +1 -0
  5. package/library/assets/components/VcFilterBar/VcFilterChipEditor.css +1 -0
  6. package/library/assets/components/VcFilterBar/VcFilterEditorModal.css +1 -0
  7. package/library/assets/components/VcFilterBar/VcFilterEditorPanel.css +1 -0
  8. package/library/assets/components/VcFilterBar/editors/VcFilterBooleanEditor.css +1 -0
  9. package/library/assets/components/VcFilterBar/editors/VcFilterMultiselectEditor.css +1 -0
  10. package/library/assets/components/VcFilterBar/editors/VcFilterRangeEditor.css +1 -0
  11. package/library/assets/components/VcFilterBar/editors/VcFilterSelectEditor.css +1 -0
  12. package/library/assets/components/VcFilterBar/editors/VcFilterTextEditor.css +1 -0
  13. package/library/assets/components/VcFilterBar/editors/VcFilterTextListEditor.css +1 -0
  14. package/library/assets/components/VcTimeInput/VcTimeInput.css +1 -1
  15. package/library/components/VcFilterBar/VcFilterAddMenu.vue.mjs +380 -0
  16. package/library/components/VcFilterBar/VcFilterAddMenu.vue3.mjs +5 -0
  17. package/library/components/VcFilterBar/VcFilterBar.vue.mjs +469 -0
  18. package/library/components/VcFilterBar/VcFilterBar.vue3.mjs +5 -0
  19. package/library/components/VcFilterBar/VcFilterChip.vue.mjs +136 -0
  20. package/library/components/VcFilterBar/VcFilterChip.vue3.mjs +5 -0
  21. package/library/components/VcFilterBar/VcFilterChipEditor.vue.mjs +133 -0
  22. package/library/components/VcFilterBar/VcFilterChipEditor.vue3.mjs +5 -0
  23. package/library/components/VcFilterBar/VcFilterEditorModal.vue.mjs +90 -0
  24. package/library/components/VcFilterBar/VcFilterEditorModal.vue3.mjs +5 -0
  25. package/library/components/VcFilterBar/VcFilterEditorPanel.vue.mjs +179 -0
  26. package/library/components/VcFilterBar/VcFilterEditorPanel.vue3.mjs +5 -0
  27. package/library/components/VcFilterBar/editors/VcFilterBooleanEditor.vue.mjs +62 -0
  28. package/library/components/VcFilterBar/editors/VcFilterBooleanEditor.vue3.mjs +5 -0
  29. package/library/components/VcFilterBar/editors/VcFilterMultiselectEditor.vue.mjs +199 -0
  30. package/library/components/VcFilterBar/editors/VcFilterMultiselectEditor.vue3.mjs +5 -0
  31. package/library/components/VcFilterBar/editors/VcFilterRangeEditor.vue.mjs +124 -0
  32. package/library/components/VcFilterBar/editors/VcFilterRangeEditor.vue3.mjs +5 -0
  33. package/library/components/VcFilterBar/editors/VcFilterSelectEditor.vue.mjs +96 -0
  34. package/library/components/VcFilterBar/editors/VcFilterSelectEditor.vue3.mjs +5 -0
  35. package/library/components/VcFilterBar/editors/VcFilterTextEditor.vue.mjs +58 -0
  36. package/library/components/VcFilterBar/editors/VcFilterTextEditor.vue3.mjs +5 -0
  37. package/library/components/VcFilterBar/editors/VcFilterTextListEditor.vue.mjs +155 -0
  38. package/library/components/VcFilterBar/editors/VcFilterTextListEditor.vue3.mjs +5 -0
  39. package/library/components/VcFilterBar/filterBarChip.mjs +59 -0
  40. package/library/components/VcFilterBar/filterBarDate.mjs +69 -0
  41. package/library/components/VcFilterBar/filterBarDraft.mjs +86 -0
  42. package/library/components/VcFilterBar/filterBarEditors.mjs +36 -0
  43. package/library/components/VcFilterBar/filterBarErrors.mjs +57 -0
  44. package/library/components/VcFilterBar/filterBarModel.mjs +378 -0
  45. package/library/components/VcFilterBar/filterBarOptions.mjs +253 -0
  46. package/library/components/VcFilterBar/filterBarSearch.mjs +89 -0
  47. package/library/components/VcFilterBar/filterBarValidate.mjs +99 -0
  48. package/library/components/VcTimeInput/VcTimeInput.vue.mjs +178 -36
  49. package/library/index.mjs +227 -162
  50. package/library/index.mjs.br +0 -0
  51. package/library/index.mjs.gz +0 -0
  52. package/library/localization/locales/en.json.mjs +51 -1
  53. package/library/plugin-components.gen.mjs +125 -122
  54. package/library/plugin.mjs +225 -160
  55. package/library/plugin.mjs.br +0 -0
  56. package/library/plugin.mjs.gz +0 -0
  57. package/library/style.css +25 -1
  58. package/library/style.css.br +0 -0
  59. package/library/style.css.gz +0 -0
  60. package/library/tokens/tokens.mjs +2 -0
  61. package/library/types/components/VcFilterBar/VcFilterAddMenu.vue.d.ts +39 -0
  62. package/library/types/components/VcFilterBar/VcFilterBar.vue.d.ts +132 -0
  63. package/library/types/components/VcFilterBar/VcFilterChip.vue.d.ts +42 -0
  64. package/library/types/components/VcFilterBar/VcFilterChipEditor.vue.d.ts +46 -0
  65. package/library/types/components/VcFilterBar/VcFilterEditorModal.vue.d.ts +40 -0
  66. package/library/types/components/VcFilterBar/VcFilterEditorPanel.vue.d.ts +116 -0
  67. package/library/types/components/VcFilterBar/editors/VcFilterBooleanEditor.vue.d.ts +66 -0
  68. package/library/types/components/VcFilterBar/editors/VcFilterMultiselectEditor.vue.d.ts +73 -0
  69. package/library/types/components/VcFilterBar/editors/VcFilterRangeEditor.vue.d.ts +62 -0
  70. package/library/types/components/VcFilterBar/editors/VcFilterSelectEditor.vue.d.ts +62 -0
  71. package/library/types/components/VcFilterBar/editors/VcFilterTextEditor.vue.d.ts +68 -0
  72. package/library/types/components/VcFilterBar/editors/VcFilterTextListEditor.vue.d.ts +64 -0
  73. package/library/types/components/VcFilterBar/filterBarChip.d.ts +23 -0
  74. package/library/types/components/VcFilterBar/filterBarDate.d.ts +14 -0
  75. package/library/types/components/VcFilterBar/filterBarDraft.d.ts +28 -0
  76. package/library/types/components/VcFilterBar/filterBarEditors.d.ts +7 -0
  77. package/library/types/components/VcFilterBar/filterBarErrors.d.ts +22 -0
  78. package/library/types/components/VcFilterBar/filterBarModel.d.ts +83 -0
  79. package/library/types/components/VcFilterBar/filterBarOptions.d.ts +52 -0
  80. package/library/types/components/VcFilterBar/filterBarSearch.d.ts +23 -0
  81. package/library/types/components/VcFilterBar/filterBarValidate.d.ts +34 -0
  82. package/library/types/components/VcJsonSchema/Components/JsonSchemaEditor.vue.d.ts +1 -1
  83. package/library/types/components/VcTimeInput/VcTimeInput.vue.d.ts +29 -6
  84. package/library/types/components/exports.d.ts +3 -1
  85. package/library/types/components.gen.d.ts +1 -0
  86. package/library/types/entity/components/Table/VcEntityListTable.vue.d.ts +3 -3
  87. package/library/types/index.d.ts +8 -0
  88. package/library/types/localization/locales/en.json.d.ts +51 -1
  89. package/library/types/tokens/tokens.d.ts +2 -1
  90. package/library/types/types/VcFilterBar.types.d.ts +329 -0
  91. package/library/types/types/VcTimeInput.types.d.ts +3 -0
  92. package/library/types/types/index.d.ts +2 -0
  93. package/package.json +1 -1
@@ -0,0 +1,469 @@
1
+ import '../../assets/components/VcFilterBar/VcFilterBar.css';
2
+ import { defineComponent, useSlots, ref, computed, watch, onBeforeUnmount, openBlock, createElementBlock, unref, createElementVNode, renderSlot, createVNode, normalizeClass, createCommentVNode, Fragment, createBlock, withKeys, withModifiers, toDisplayString, mergeProps, withCtx, createTextVNode, withDirectives, renderList, vShow } from "vue";
3
+ import { Search, ListFilter, ChevronDown, ChevronUp, CircleAlert } from "@lucide/vue";
4
+ import _sfc_main$7 from "../VcButton/VcButton.vue.mjs";
5
+ import '../../assets/components/VcFilterBar/VcFilterEditorModal.css';import '../../assets/components/VcFilterBar/VcFilterChipEditor.css';import '../../assets/components/VcFilterBar/VcFilterChip.css';import '../../assets/components/VcFilterBar/VcFilterAddMenu.css';import '../../assets/components/VcTag/VcTag.css';import '../../assets/components/VcSelect/VcSelect.css';import '../../assets/components/VcInput/VcInput.css';import '../../assets/components/VcIcon/VcIcon.css';import '../../assets/components/VcDatePicker/VcDatePicker.css';import '../../assets/components/VcButton/VcButtonIcon.css';import '../../assets/components/VcButton/VcButton.css';/* empty css */
6
+ import _sfc_main$8 from "../VcButton/VcButtonIcon.vue.mjs";
7
+ /* empty css */
8
+ import _sfc_main$1 from "../VcDatePicker/VcDatePicker.vue.mjs";
9
+ /* empty css */
10
+ import _sfc_main$5 from "../VcIcon/VcIcon.vue.mjs";
11
+ /* empty css */
12
+ import _sfc_main$3 from "../VcInput/VcInput.vue.mjs";
13
+ /* empty css */
14
+ import _sfc_main$2 from "../VcSelect/VcSelect.vue.mjs";
15
+ /* empty css */
16
+ import _sfc_main$4 from "../VcTag/VcTag.vue.mjs";
17
+ /* empty css */
18
+ import UniqueComponentId from "../../utils/UniqueComponentId.mjs";
19
+ import { tVU } from "../../localization/index.mjs";
20
+ import _sfc_main$6 from "./VcFilterAddMenu.vue.mjs";
21
+ /* empty css */
22
+ import _sfc_main$9 from "./VcFilterChip.vue.mjs";
23
+ /* empty css */
24
+ import _sfc_main$a from "./VcFilterChipEditor.vue.mjs";
25
+ /* empty css */
26
+ import _sfc_main$b from "./VcFilterEditorModal.vue.mjs";
27
+ /* empty css */
28
+ import { isModalField } from "./filterBarEditors.mjs";
29
+ import { splitFilterModel, removeFieldValue, joinFilterModel } from "./filterBarModel.mjs";
30
+ import { provideFilterOptionsStore } from "./filterBarOptions.mjs";
31
+ import { getSearchKeys, readSearchText, getSearchTarget, readLinkedValue, writeSearchText, DEFAULT_SEARCH_DEBOUNCE, appendSearchText, writeLinkedValue } from "./filterBarSearch.mjs";
32
+ import { getDateKeys, readDateRange, writeDateRange } from "./filterBarDate.mjs";
33
+ import { placeFilterErrors, getRefusedValues } from "./filterBarErrors.mjs";
34
+ const _hoisted_1 = ["aria-label"];
35
+ const _hoisted_2 = { class: "vc-filter-bar__toolbar" };
36
+ const _hoisted_3 = { class: "vc-filter-bar__row" };
37
+ const _hoisted_4 = { class: "vc-filter-bar__search" };
38
+ const _hoisted_5 = {
39
+ key: 1,
40
+ class: "vc-filter-bar__hint",
41
+ "data-test": "vc-filter-bar-hint"
42
+ };
43
+ const _hoisted_6 = { key: 1 };
44
+ const _hoisted_7 = ["aria-controls"];
45
+ const _hoisted_8 = { class: "vc-filter-bar__end" };
46
+ const _hoisted_9 = ["id", "aria-label"];
47
+ const _hoisted_10 = {
48
+ key: 0,
49
+ class: "vc-filter-bar__errors",
50
+ role: "alert",
51
+ "data-test": "vc-filter-bar-errors"
52
+ };
53
+ const _hoisted_11 = {
54
+ key: 0,
55
+ class: "vc-filter-bar__footer"
56
+ };
57
+ const _hoisted_12 = { class: "vc-filter-bar__footer-start" };
58
+ const _hoisted_13 = { class: "vc-filter-bar__footer-end" };
59
+ const DEFAULT_DATE_FORMAT = "D MMM YYYY";
60
+ const DEFAULT_DATETIME_FORMAT = "D MMM YYYY, HH:mm";
61
+ const _sfc_main = /* @__PURE__ */ defineComponent({
62
+ __name: "VcFilterBar",
63
+ props: {
64
+ modelValue: { default: () => ({}) },
65
+ fields: {},
66
+ dateRange: { type: [Object, Boolean], default: void 0 },
67
+ search: { type: [Object, Boolean], default: void 0 },
68
+ excludeKey: { default: void 0 },
69
+ optionsStore: { default: void 0 },
70
+ collapsible: { type: Boolean, default: true },
71
+ optionsCaption: { default: void 0 },
72
+ errors: { default: void 0 },
73
+ refusedValues: { default: void 0 }
74
+ },
75
+ emits: ["update:modelValue", "search"],
76
+ setup(__props, { emit: __emit }) {
77
+ const DEFAULT_RANGE_TIME = [new Date(2e3, 0, 1, 0, 0, 0), new Date(2e3, 0, 1, 23, 59, 59)];
78
+ const props = __props;
79
+ const emit = __emit;
80
+ provideFilterOptionsStore(props.optionsStore);
81
+ const slots = useSlots();
82
+ const chipsId = UniqueComponentId("vc-filter-bar-chips-");
83
+ const collapsed = ref(false);
84
+ const modelOptions = computed(() => ({ excludeKey: props.excludeKey }));
85
+ const split = computed(() => splitFilterModel(props.modelValue, props.fields, modelOptions.value));
86
+ const applied = computed(() => split.value.applied);
87
+ const appliedText = computed(() => applied.value.length === 1 ? tVU.t("voicenterUi.filterBar.appliedOne") : tVU.t("voicenterUi.filterBar.appliedMany", { count: applied.value.length }));
88
+ function update(next) {
89
+ emit("update:modelValue", next);
90
+ }
91
+ const editorSlots = computed(() => Object.fromEntries(
92
+ Object.entries(slots).filter(([name]) => name.startsWith("editor-") && name !== "editor-footer")
93
+ ));
94
+ const editorBindings = computed(() => ({
95
+ modelValue: props.modelValue,
96
+ modelOptions: modelOptions.value,
97
+ editorSlots: editorSlots.value,
98
+ footerSlot: slots["editor-footer"],
99
+ optionsCaption: props.optionsCaption
100
+ }));
101
+ const modalRef = ref();
102
+ function openModal(next) {
103
+ var _a;
104
+ (_a = modalRef.value) == null ? void 0 : _a.open(next);
105
+ }
106
+ const addMenuBindings = computed(() => ({
107
+ fields: props.fields,
108
+ modelValue: props.modelValue,
109
+ modelOptions: modelOptions.value,
110
+ editorSlots: Object.fromEntries(Object.entries(slots).filter(([name]) => name.startsWith("editor-") && name !== "editor-footer")),
111
+ footerSlot: slots["editor-footer"],
112
+ optionsCaption: props.optionsCaption
113
+ }));
114
+ const errorSnapshot = ref(props.modelValue);
115
+ watch(() => props.errors, () => {
116
+ errorSnapshot.value = props.modelValue;
117
+ });
118
+ const errorPlacement = computed(() => placeFilterErrors(props.errors, {
119
+ fields: props.fields,
120
+ model: props.modelValue,
121
+ snapshot: errorSnapshot.value,
122
+ dateKeys: props.dateRange === false ? [] : getDateKeys(dateConfig.value),
123
+ searchKeys: props.search === false ? [] : getSearchKeys(searchConfig.value),
124
+ options: modelOptions.value
125
+ }));
126
+ const errorLines = computed(() => [
127
+ errorPlacement.value.date,
128
+ errorPlacement.value.search,
129
+ ...errorPlacement.value.other
130
+ ].filter((line) => !!line));
131
+ function refusedOf(item) {
132
+ return getRefusedValues(props.refusedValues, item.field, item.mode, props.modelValue, modelOptions.value);
133
+ }
134
+ function removeApplied(item) {
135
+ update(removeFieldValue(props.modelValue, item.field, item.mode, modelOptions.value));
136
+ }
137
+ const dateConfig = computed(() => props.dateRange || {});
138
+ function updateDateRange(range) {
139
+ update(writeDateRange(props.modelValue, range, dateConfig.value));
140
+ }
141
+ const dateModel = computed({
142
+ get: () => readDateRange(props.modelValue, dateConfig.value),
143
+ set: (range) => {
144
+ const [start, end] = range ?? [];
145
+ updateDateRange(start instanceof Date && end instanceof Date ? [start, end] : null);
146
+ }
147
+ });
148
+ const DEFAULT_SEARCH = { targets: [{ valueKey: "search" }] };
149
+ const searchConfig = computed(() => {
150
+ if (props.search === false) {
151
+ return { targets: [] };
152
+ }
153
+ return props.search ?? DEFAULT_SEARCH;
154
+ });
155
+ const searchText = ref(readSearchText(props.modelValue, searchConfig.value));
156
+ let searchTimer;
157
+ const pickedTarget = ref();
158
+ const matchedTarget = computed(() => getSearchTarget(searchText.value, searchConfig.value, pickedTarget.value));
159
+ const targetOptions = computed(() => searchConfig.value.targets.map((target) => ({
160
+ value: target.valueKey,
161
+ label: target.label ?? target.valueKey
162
+ })));
163
+ function onPickTarget(value) {
164
+ var _a;
165
+ pickedTarget.value = typeof value === "string" ? value : void 0;
166
+ if (searchText.value.trim() && ((_a = matchedTarget.value) == null ? void 0 : _a.mode) !== "append") {
167
+ commitSearch();
168
+ }
169
+ }
170
+ const linkedTarget = computed(() => {
171
+ var _a, _b;
172
+ return (((_a = matchedTarget.value) == null ? void 0 : _a.mode) ?? "set") === "set" && ((_b = matchedTarget.value) == null ? void 0 : _b.linked) ? matchedTarget.value : void 0;
173
+ });
174
+ const linkedValue = computed(() => {
175
+ var _a;
176
+ return ((_a = linkedTarget.value) == null ? void 0 : _a.linked) ? readLinkedValue(props.modelValue, linkedTarget.value.linked) : void 0;
177
+ });
178
+ const searchHint = computed(() => {
179
+ if (!searchText.value.trim() || searchConfig.value.local) {
180
+ return void 0;
181
+ }
182
+ const target = matchedTarget.value;
183
+ if (!target) {
184
+ return searchConfig.value.noMatchHint ? {
185
+ tag: void 0,
186
+ text: searchConfig.value.noMatchHint
187
+ } : void 0;
188
+ }
189
+ return target.tag || target.hint ? {
190
+ tag: target.tag,
191
+ text: target.hint
192
+ } : void 0;
193
+ });
194
+ function cancelSearchTimer() {
195
+ if (searchTimer !== void 0) {
196
+ clearTimeout(searchTimer);
197
+ searchTimer = void 0;
198
+ }
199
+ }
200
+ let writtenSearchText;
201
+ function commitSearch() {
202
+ cancelSearchTimer();
203
+ if (searchConfig.value.local) {
204
+ emit("search", searchText.value.trim());
205
+ return;
206
+ }
207
+ const next = writeSearchText(props.modelValue, searchText.value, searchConfig.value, pickedTarget.value);
208
+ if (getSearchKeys(searchConfig.value).some((key) => next[key] !== props.modelValue[key])) {
209
+ writtenSearchText = readSearchText(next, searchConfig.value);
210
+ update(next);
211
+ }
212
+ }
213
+ function onSearchInput(text, immediate = false) {
214
+ searchText.value = text;
215
+ cancelSearchTimer();
216
+ if (immediate) {
217
+ commitSearch();
218
+ return;
219
+ }
220
+ searchTimer = setTimeout(commitSearch, searchConfig.value.debounce ?? DEFAULT_SEARCH_DEBOUNCE);
221
+ }
222
+ function onSearchEnter() {
223
+ var _a;
224
+ if (((_a = matchedTarget.value) == null ? void 0 : _a.mode) === "append") {
225
+ cancelSearchTimer();
226
+ update(appendSearchText(props.modelValue, searchText.value, searchConfig.value, props.fields, modelOptions.value, pickedTarget.value));
227
+ searchText.value = "";
228
+ return;
229
+ }
230
+ commitSearch();
231
+ }
232
+ function onLinkedChange(value) {
233
+ const target = linkedTarget.value;
234
+ if (!target || typeof value !== "string" && typeof value !== "number") {
235
+ return;
236
+ }
237
+ cancelSearchTimer();
238
+ const withText = writeSearchText(props.modelValue, searchText.value, searchConfig.value, pickedTarget.value);
239
+ update(writeLinkedValue(withText, target, value));
240
+ }
241
+ watch(() => readSearchText(props.modelValue, searchConfig.value), (text) => {
242
+ if (searchTimer !== void 0 || text === writtenSearchText) {
243
+ writtenSearchText = void 0;
244
+ return;
245
+ }
246
+ searchText.value = text;
247
+ });
248
+ onBeforeUnmount(cancelSearchTimer);
249
+ const canClear = computed(() => applied.value.length > 0 || !!searchText.value);
250
+ function clearAll() {
251
+ cancelSearchTimer();
252
+ if (searchConfig.value.local && searchText.value) {
253
+ emit("search", "");
254
+ }
255
+ searchText.value = "";
256
+ pickedTarget.value = void 0;
257
+ const next = joinFilterModel([], split.value.rest, modelOptions.value);
258
+ getSearchKeys(searchConfig.value).forEach((key) => {
259
+ delete next[key];
260
+ });
261
+ collapsed.value = false;
262
+ update(next);
263
+ }
264
+ return (_ctx, _cache) => {
265
+ var _a;
266
+ return openBlock(), createElementBlock("section", {
267
+ class: "vc-filter-bar",
268
+ "aria-label": unref(tVU).t("voicenterUi.filterBar.label"),
269
+ "data-test": "vc-filter-bar"
270
+ }, [
271
+ createElementVNode("div", _hoisted_2, [
272
+ createElementVNode("div", _hoisted_3, [
273
+ __props.dateRange !== false ? renderSlot(_ctx.$slots, "date", {
274
+ key: 0,
275
+ value: dateModel.value,
276
+ update: updateDateRange
277
+ }, () => [
278
+ createVNode(_sfc_main$1, {
279
+ modelValue: dateModel.value,
280
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dateModel.value = $event),
281
+ type: dateConfig.value.picker === "datetime" ? "datetimerange" : "daterange",
282
+ class: normalizeClass(["vc-filter-bar__date", { "vc-filter-bar__date--error": !!errorPlacement.value.date }]),
283
+ title: errorPlacement.value.date,
284
+ format: dateConfig.value.format ?? (dateConfig.value.picker === "datetime" ? DEFAULT_DATETIME_FORMAT : DEFAULT_DATE_FORMAT),
285
+ shortcuts: dateConfig.value.shortcuts,
286
+ clearable: dateConfig.value.clearable ?? false,
287
+ "default-time": DEFAULT_RANGE_TIME,
288
+ "start-placeholder": unref(tVU).t("voicenterUi.filterBar.dateFrom"),
289
+ "end-placeholder": unref(tVU).t("voicenterUi.filterBar.dateTo")
290
+ }, null, 8, ["modelValue", "type", "class", "title", "format", "shortcuts", "clearable", "start-placeholder", "end-placeholder"])
291
+ ]) : createCommentVNode("", true),
292
+ __props.search !== false ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
293
+ renderSlot(_ctx.$slots, "search", {
294
+ text: searchText.value,
295
+ update: onSearchInput
296
+ }, () => {
297
+ var _a2;
298
+ return [
299
+ searchConfig.value.picker ? (openBlock(), createBlock(_sfc_main$2, {
300
+ key: 0,
301
+ "model-value": pickedTarget.value ?? ((_a2 = matchedTarget.value) == null ? void 0 : _a2.valueKey),
302
+ options: targetOptions.value,
303
+ config: { valueKey: "value", labelKey: "label" },
304
+ placeholder: unref(tVU).t("voicenterUi.filterBar.searchIn"),
305
+ "aria-label": unref(tVU).t("voicenterUi.filterBar.searchIn"),
306
+ class: "vc-filter-bar__picker",
307
+ "data-test": "vc-filter-bar-picker",
308
+ "onUpdate:modelValue": onPickTarget
309
+ }, null, 8, ["model-value", "options", "placeholder", "aria-label"])) : createCommentVNode("", true),
310
+ createElementVNode("div", _hoisted_4, [
311
+ createVNode(_sfc_main$3, {
312
+ "model-value": searchText.value,
313
+ "prefix-icon": unref(Search),
314
+ placeholder: searchConfig.value.placeholder ?? unref(tVU).t("voicenterUi.filterBar.search"),
315
+ "aria-label": searchConfig.value.placeholder ?? unref(tVU).t("voicenterUi.filterBar.search"),
316
+ clearable: "",
317
+ "is-error": !!errorPlacement.value.search,
318
+ title: errorPlacement.value.search,
319
+ "data-test": "vc-filter-bar-search",
320
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => onSearchInput(String($event))),
321
+ onClear: _cache[2] || (_cache[2] = ($event) => onSearchInput("", true)),
322
+ onKeydown: withKeys(withModifiers(onSearchEnter, ["prevent"]), ["enter"])
323
+ }, null, 8, ["model-value", "prefix-icon", "placeholder", "aria-label", "is-error", "title", "onKeydown"])
324
+ ])
325
+ ];
326
+ }),
327
+ ((_a = linkedTarget.value) == null ? void 0 : _a.linked) ? (openBlock(), createBlock(_sfc_main$2, {
328
+ key: 0,
329
+ "model-value": linkedValue.value,
330
+ options: linkedTarget.value.linked.options,
331
+ config: { valueKey: "value", labelKey: "label" },
332
+ "prefix-icon": linkedTarget.value.linked.icon,
333
+ "aria-label": linkedTarget.value.linked.label,
334
+ class: "vc-filter-bar__linked",
335
+ "data-test": "vc-filter-bar-linked",
336
+ "onUpdate:modelValue": onLinkedChange
337
+ }, null, 8, ["model-value", "options", "prefix-icon", "aria-label"])) : createCommentVNode("", true),
338
+ searchHint.value ? (openBlock(), createElementBlock("span", _hoisted_5, [
339
+ searchHint.value.tag ? (openBlock(), createBlock(_sfc_main$4, {
340
+ key: 0,
341
+ label: searchHint.value.tag,
342
+ color: "info",
343
+ compact: ""
344
+ }, null, 8, ["label"])) : createCommentVNode("", true),
345
+ searchHint.value.text ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(searchHint.value.text), 1)) : createCommentVNode("", true)
346
+ ])) : createCommentVNode("", true),
347
+ renderSlot(_ctx.$slots, "search-append")
348
+ ], 64)) : createCommentVNode("", true),
349
+ collapsed.value && applied.value.length ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
350
+ createElementVNode("button", {
351
+ type: "button",
352
+ class: "vc-filter-bar__toggle",
353
+ "aria-controls": unref(chipsId),
354
+ "aria-expanded": false,
355
+ "data-test": "vc-filter-bar-applied-toggle",
356
+ onClick: _cache[3] || (_cache[3] = ($event) => collapsed.value = false)
357
+ }, [
358
+ createVNode(_sfc_main$5, {
359
+ icon: unref(ListFilter),
360
+ class: "vc-filter-bar__toggle-icon"
361
+ }, null, 8, ["icon"]),
362
+ createElementVNode("span", null, toDisplayString(appliedText.value), 1)
363
+ ], 8, _hoisted_7),
364
+ renderSlot(_ctx.$slots, "add", { modelValue: __props.modelValue }, () => [
365
+ createVNode(_sfc_main$6, mergeProps(addMenuBindings.value, {
366
+ "onUpdate:modelValue": update,
367
+ onOpenModal: _cache[4] || (_cache[4] = ($event) => openModal({ field: $event, origin: "add" }))
368
+ }), null, 16)
369
+ ])
370
+ ], 64)) : createCommentVNode("", true),
371
+ createElementVNode("div", _hoisted_8, [
372
+ canClear.value ? (openBlock(), createBlock(_sfc_main$7, {
373
+ key: 0,
374
+ type: "borderless",
375
+ color: "secondary",
376
+ size: "small",
377
+ "data-test": "vc-filter-bar-clear",
378
+ onClick: clearAll
379
+ }, {
380
+ default: withCtx(() => [
381
+ createTextVNode(toDisplayString(unref(tVU).t("voicenterUi.filterBar.clear")), 1)
382
+ ]),
383
+ _: 1
384
+ })) : createCommentVNode("", true),
385
+ renderSlot(_ctx.$slots, "actions", { modelValue: __props.modelValue }),
386
+ __props.collapsible && applied.value.length ? (openBlock(), createBlock(_sfc_main$8, {
387
+ key: 1,
388
+ icon: collapsed.value ? unref(ChevronDown) : unref(ChevronUp),
389
+ plain: "",
390
+ color: "secondary",
391
+ "aria-label": collapsed.value ? unref(tVU).t("voicenterUi.filterBar.showFilters") : unref(tVU).t("voicenterUi.filterBar.hideFilters"),
392
+ "aria-expanded": collapsed.value ? "false" : "true",
393
+ "aria-controls": unref(chipsId),
394
+ "data-test": "vc-filter-bar-collapse",
395
+ onClick: _cache[5] || (_cache[5] = ($event) => collapsed.value = !collapsed.value)
396
+ }, null, 8, ["icon", "aria-label", "aria-expanded", "aria-controls"])) : createCommentVNode("", true)
397
+ ])
398
+ ]),
399
+ withDirectives(createElementVNode("div", {
400
+ id: unref(chipsId),
401
+ class: "vc-filter-bar__chips",
402
+ role: "group",
403
+ "aria-label": unref(tVU).t("voicenterUi.filterBar.activeFilters")
404
+ }, [
405
+ (openBlock(true), createElementBlock(Fragment, null, renderList(applied.value, (item) => {
406
+ return renderSlot(_ctx.$slots, `chip-${item.field.key}`, {
407
+ key: item.id,
408
+ item,
409
+ remove: () => removeApplied(item)
410
+ }, () => [
411
+ unref(isModalField)(item.field) ? (openBlock(), createBlock(_sfc_main$9, {
412
+ key: 0,
413
+ field: item.field,
414
+ mode: item.mode,
415
+ value: item.value,
416
+ error: errorPlacement.value.byChip[item.id],
417
+ refused: refusedOf(item),
418
+ onEdit: ($event) => openModal({ field: item.field, origin: "edit", mode: item.mode, value: item.value, error: errorPlacement.value.byChip[item.id], refused: refusedOf(item) }),
419
+ onRemove: ($event) => removeApplied(item)
420
+ }, null, 8, ["field", "mode", "value", "error", "refused", "onEdit", "onRemove"])) : (openBlock(), createBlock(_sfc_main$a, mergeProps({
421
+ key: 1,
422
+ ref_for: true
423
+ }, editorBindings.value, {
424
+ field: item.field,
425
+ mode: item.mode,
426
+ value: item.value,
427
+ error: errorPlacement.value.byChip[item.id],
428
+ refused: refusedOf(item),
429
+ "onUpdate:modelValue": update,
430
+ onRemove: ($event) => removeApplied(item)
431
+ }), null, 16, ["field", "mode", "value", "error", "refused", "onRemove"]))
432
+ ]);
433
+ }), 128)),
434
+ renderSlot(_ctx.$slots, "add", { modelValue: __props.modelValue }, () => [
435
+ createVNode(_sfc_main$6, mergeProps(addMenuBindings.value, {
436
+ "onUpdate:modelValue": update,
437
+ onOpenModal: _cache[6] || (_cache[6] = ($event) => openModal({ field: $event, origin: "add" }))
438
+ }), null, 16)
439
+ ])
440
+ ], 8, _hoisted_9), [
441
+ [vShow, !collapsed.value || !applied.value.length]
442
+ ]),
443
+ errorLines.value.length ? (openBlock(), createElementBlock("div", _hoisted_10, [
444
+ createVNode(_sfc_main$5, {
445
+ icon: unref(CircleAlert),
446
+ class: "vc-filter-bar__errors-icon"
447
+ }, null, 8, ["icon"]),
448
+ createElementVNode("span", null, toDisplayString(errorLines.value.join(" ")), 1)
449
+ ])) : createCommentVNode("", true)
450
+ ]),
451
+ _ctx.$slots["footer-start"] || _ctx.$slots["footer-end"] ? (openBlock(), createElementBlock("div", _hoisted_11, [
452
+ createElementVNode("div", _hoisted_12, [
453
+ renderSlot(_ctx.$slots, "footer-start")
454
+ ]),
455
+ createElementVNode("div", _hoisted_13, [
456
+ renderSlot(_ctx.$slots, "footer-end")
457
+ ])
458
+ ])) : createCommentVNode("", true),
459
+ createVNode(_sfc_main$b, mergeProps({
460
+ ref_key: "modalRef",
461
+ ref: modalRef
462
+ }, editorBindings.value, { "onUpdate:modelValue": update }), null, 16)
463
+ ], 8, _hoisted_1);
464
+ };
465
+ }
466
+ });
467
+ export {
468
+ _sfc_main as default
469
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcFilterBar.vue.mjs";
2
+ import '../../assets/components/VcFilterBar/VcFilterBar.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,136 @@
1
+ import '../../assets/components/VcFilterBar/VcFilterChip.css';
2
+ import { defineComponent, computed, onMounted, openBlock, createElementBlock, normalizeClass, createElementVNode, unref, createVNode, createCommentVNode, createBlock, createTextVNode, toDisplayString, renderSlot, withModifiers } from "vue";
3
+ import { Minus, CircleAlert, X } from "@lucide/vue";
4
+ import _sfc_main$1 from "../VcIcon/VcIcon.vue.mjs";
5
+ import '../../assets/components/VcIcon/VcIcon.css';/* empty css */
6
+ import { tVU } from "../../localization/index.mjs";
7
+ import { formatChipValue, getTextDirection, readOptionKey } from "./filterBarChip.mjs";
8
+ import { useFieldOptions } from "./filterBarOptions.mjs";
9
+ import { isFilterListValue } from "./filterBarModel.mjs";
10
+ const _hoisted_1 = ["data-test"];
11
+ const _hoisted_2 = ["aria-label", "title"];
12
+ const _hoisted_3 = ["title"];
13
+ const _hoisted_4 = { class: "vc-filter-chip__segment" };
14
+ const _hoisted_5 = { class: "vc-filter-chip__segment" };
15
+ const _hoisted_6 = ["dir"];
16
+ const _hoisted_7 = ["aria-label"];
17
+ const _sfc_main = /* @__PURE__ */ defineComponent({
18
+ __name: "VcFilterChip",
19
+ props: {
20
+ field: {},
21
+ mode: {},
22
+ value: { type: [Array, Object, String, Boolean, Number] },
23
+ error: {},
24
+ refused: {}
25
+ },
26
+ emits: ["edit", "remove"],
27
+ setup(__props, { emit: __emit }) {
28
+ const props = __props;
29
+ const emit = __emit;
30
+ const options = useFieldOptions(() => props.field);
31
+ const hasOptions = computed(() => (props.field.kind === "multiselect" || props.field.kind === "select") && !!props.field.options);
32
+ function optionLabel(item) {
33
+ var _a, _b;
34
+ const field = props.field;
35
+ if (field.kind !== "multiselect" && field.kind !== "select") {
36
+ return void 0;
37
+ }
38
+ const valueKey = ((_a = field.optionConfig) == null ? void 0 : _a.valueKey) ?? "value";
39
+ const labelKey = ((_b = field.optionConfig) == null ? void 0 : _b.labelKey) ?? "label";
40
+ const option = options.data.value.find((candidate) => readOptionKey(candidate, valueKey) === item);
41
+ const label = option ? readOptionKey(option, labelKey) : void 0;
42
+ return typeof label === "string" || typeof label === "number" ? String(label) : void 0;
43
+ }
44
+ const chipText = computed(() => formatChipValue(props.field, props.value, {
45
+ optionLabel,
46
+ yes: tVU.t("voicenterUi.filterBar.yes"),
47
+ no: tVU.t("voicenterUi.filterBar.no")
48
+ }));
49
+ const problemText = computed(() => {
50
+ var _a;
51
+ if (props.error) {
52
+ return props.error;
53
+ }
54
+ if ((_a = props.refused) == null ? void 0 : _a.length) {
55
+ const names = props.refused.map((item) => optionLabel(item) ?? String(item)).join(", ");
56
+ return tVU.t("voicenterUi.filterBar.notPermittedList", { values: names });
57
+ }
58
+ return options.deniedReason.value ?? "";
59
+ });
60
+ const namesPending = computed(() => hasOptions.value && !options.loaded.value && options.loading.value && !options.deniedReason.value);
61
+ const accessibleText = computed(() => {
62
+ const key = props.mode === "exclude" ? "voicenterUi.filterBar.isNot" : "voicenterUi.filterBar.is";
63
+ return tVU.t(key, {
64
+ field: props.field.label,
65
+ value: chipText.value.full
66
+ });
67
+ });
68
+ onMounted(() => {
69
+ if (hasOptions.value && (isFilterListValue(props.value) || props.field.kind === "select")) {
70
+ void options.get();
71
+ }
72
+ });
73
+ return (_ctx, _cache) => {
74
+ return openBlock(), createElementBlock("div", {
75
+ class: normalizeClass(["vc-filter-chip", { "is-exclude": __props.mode === "exclude", "is-error": !!problemText.value }]),
76
+ "data-test": `filter-chip-${__props.field.key}-${__props.mode}`
77
+ }, [
78
+ createElementVNode("button", {
79
+ type: "button",
80
+ class: "vc-filter-chip__main",
81
+ "aria-label": unref(tVU).t("voicenterUi.filterBar.editFilter", { filter: accessibleText.value }),
82
+ title: problemText.value || chipText.value.full,
83
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("edit", $event))
84
+ }, [
85
+ __props.mode === "exclude" ? (openBlock(), createElementBlock("span", {
86
+ key: 0,
87
+ class: "vc-filter-chip__segment vc-filter-chip__segment--mode",
88
+ title: unref(tVU).t("voicenterUi.filterBar.excluded")
89
+ }, [
90
+ createVNode(_sfc_main$1, {
91
+ icon: unref(Minus),
92
+ class: "vc-filter-chip__icon"
93
+ }, null, 8, ["icon"])
94
+ ], 8, _hoisted_3)) : createCommentVNode("", true),
95
+ createElementVNode("span", _hoisted_4, [
96
+ __props.field.icon ? (openBlock(), createBlock(_sfc_main$1, {
97
+ key: 0,
98
+ icon: __props.field.icon,
99
+ class: "vc-filter-chip__icon"
100
+ }, null, 8, ["icon"])) : createCommentVNode("", true),
101
+ createTextVNode(" " + toDisplayString(__props.field.label), 1)
102
+ ]),
103
+ createElementVNode("span", _hoisted_5, [
104
+ problemText.value ? (openBlock(), createBlock(_sfc_main$1, {
105
+ key: 0,
106
+ icon: unref(CircleAlert),
107
+ class: "vc-filter-chip__icon vc-filter-chip__alert"
108
+ }, null, 8, ["icon"])) : createCommentVNode("", true),
109
+ createElementVNode("span", {
110
+ class: normalizeClass(["vc-filter-chip__value", { "is-pending": namesPending.value }]),
111
+ dir: unref(getTextDirection)(chipText.value.text)
112
+ }, [
113
+ renderSlot(_ctx.$slots, "value", {
114
+ text: chipText.value.text,
115
+ value: __props.value
116
+ }, () => [
117
+ createTextVNode(toDisplayString(namesPending.value ? unref(tVU).t("voicenterUi.filterBar.loading") : chipText.value.text), 1)
118
+ ])
119
+ ], 10, _hoisted_6)
120
+ ])
121
+ ], 8, _hoisted_2),
122
+ createElementVNode("button", {
123
+ type: "button",
124
+ class: "vc-filter-chip__remove",
125
+ "aria-label": unref(tVU).t("voicenterUi.filterBar.removeFilter", { filter: accessibleText.value }),
126
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => emit("remove"), ["stop"]))
127
+ }, [
128
+ createVNode(_sfc_main$1, { icon: unref(X) }, null, 8, ["icon"])
129
+ ], 8, _hoisted_7)
130
+ ], 10, _hoisted_1);
131
+ };
132
+ }
133
+ });
134
+ export {
135
+ _sfc_main as default
136
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcFilterChip.vue.mjs";
2
+ import '../../assets/components/VcFilterBar/VcFilterChip.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };