@voicenter-team/voicenter-ui-plus 4.0.0-beta.6 → 4.0.0-beta.7
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/MIGRATION_v3.md +196 -196
- package/README.md +2 -1
- package/library/assets/components/VcFileUploader/VcFileUploaderSimple.css +1 -1
- package/library/assets/components/VcFilterBar/VcFilterAddMenu.css +1 -0
- package/library/assets/components/VcFilterBar/VcFilterBar.css +1 -0
- package/library/assets/components/VcFilterBar/VcFilterChip.css +1 -0
- package/library/assets/components/VcFilterBar/VcFilterChipEditor.css +1 -0
- package/library/assets/components/VcFilterBar/VcFilterEditorModal.css +1 -0
- package/library/assets/components/VcFilterBar/VcFilterEditorPanel.css +1 -0
- package/library/assets/components/VcFilterBar/editors/VcFilterBooleanEditor.css +1 -0
- package/library/assets/components/VcFilterBar/editors/VcFilterMultiselectEditor.css +1 -0
- package/library/assets/components/VcFilterBar/editors/VcFilterRangeEditor.css +1 -0
- package/library/assets/components/VcFilterBar/editors/VcFilterSelectEditor.css +1 -0
- package/library/assets/components/VcFilterBar/editors/VcFilterTextEditor.css +1 -0
- package/library/assets/components/VcFilterBar/editors/VcFilterTextListEditor.css +1 -0
- package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
- package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
- package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
- package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
- package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
- package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
- package/library/assets/components/VcLoading/VcLoading.css +1 -1
- package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
- package/library/assets/components/VcSegmented/VcSegmented.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
- package/library/assets/components/VcTimeInput/VcTimeInput.css +1 -1
- package/library/components/VcCheckbox/VcCheckbox.vue.mjs +1 -1
- package/library/components/VcCheckbox/VcCheckboxButton.vue.mjs +1 -1
- package/library/components/VcDatePicker/VcDatePicker.vue.mjs +1 -1
- package/library/components/VcDropdown/VcDropdownItem.vue.mjs +1 -1
- package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +1 -1
- package/library/components/VcFilterBar/VcFilterAddMenu.vue.mjs +380 -0
- package/library/components/VcFilterBar/VcFilterAddMenu.vue3.mjs +5 -0
- package/library/components/VcFilterBar/VcFilterBar.vue.mjs +469 -0
- package/library/components/VcFilterBar/VcFilterBar.vue3.mjs +5 -0
- package/library/components/VcFilterBar/VcFilterChip.vue.mjs +136 -0
- package/library/components/VcFilterBar/VcFilterChip.vue3.mjs +5 -0
- package/library/components/VcFilterBar/VcFilterChipEditor.vue.mjs +133 -0
- package/library/components/VcFilterBar/VcFilterChipEditor.vue3.mjs +5 -0
- package/library/components/VcFilterBar/VcFilterEditorModal.vue.mjs +90 -0
- package/library/components/VcFilterBar/VcFilterEditorModal.vue3.mjs +5 -0
- package/library/components/VcFilterBar/VcFilterEditorPanel.vue.mjs +179 -0
- package/library/components/VcFilterBar/VcFilterEditorPanel.vue3.mjs +5 -0
- package/library/components/VcFilterBar/editors/VcFilterBooleanEditor.vue.mjs +62 -0
- package/library/components/VcFilterBar/editors/VcFilterBooleanEditor.vue3.mjs +5 -0
- package/library/components/VcFilterBar/editors/VcFilterMultiselectEditor.vue.mjs +199 -0
- package/library/components/VcFilterBar/editors/VcFilterMultiselectEditor.vue3.mjs +5 -0
- package/library/components/VcFilterBar/editors/VcFilterRangeEditor.vue.mjs +124 -0
- package/library/components/VcFilterBar/editors/VcFilterRangeEditor.vue3.mjs +5 -0
- package/library/components/VcFilterBar/editors/VcFilterSelectEditor.vue.mjs +96 -0
- package/library/components/VcFilterBar/editors/VcFilterSelectEditor.vue3.mjs +5 -0
- package/library/components/VcFilterBar/editors/VcFilterTextEditor.vue.mjs +58 -0
- package/library/components/VcFilterBar/editors/VcFilterTextEditor.vue3.mjs +5 -0
- package/library/components/VcFilterBar/editors/VcFilterTextListEditor.vue.mjs +155 -0
- package/library/components/VcFilterBar/editors/VcFilterTextListEditor.vue3.mjs +5 -0
- package/library/components/VcFilterBar/filterBarChip.mjs +59 -0
- package/library/components/VcFilterBar/filterBarDate.mjs +69 -0
- package/library/components/VcFilterBar/filterBarDraft.mjs +86 -0
- package/library/components/VcFilterBar/filterBarEditors.mjs +36 -0
- package/library/components/VcFilterBar/filterBarErrors.mjs +57 -0
- package/library/components/VcFilterBar/filterBarModel.mjs +378 -0
- package/library/components/VcFilterBar/filterBarOptions.mjs +253 -0
- package/library/components/VcFilterBar/filterBarSearch.mjs +89 -0
- package/library/components/VcFilterBar/filterBarValidate.mjs +99 -0
- package/library/components/VcForm/VcForm.vue.mjs +1 -1
- package/library/components/VcForm/VcFormItem.vue.mjs +1 -1
- package/library/components/VcHtmlEditor/VcHtmlEditorToolbar.vue.mjs +1 -1
- package/library/components/VcInput/VcInput.vue.mjs +1 -1
- package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
- package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
- package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
- package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
- package/library/components/VcMdEditor/VcMdEditor.vue.mjs +1 -1
- package/library/components/VcMdEditor/VcMdEditorToolbar.vue.mjs +1 -1
- package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +1 -1
- package/library/components/VcRadio/VcRadio.vue.mjs +1 -1
- package/library/components/VcSegmented/VcSegmented.vue.mjs +1 -1
- package/library/components/VcSelect/VcSelect.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
- package/library/components/VcSlider/VcSlider.vue.mjs +1 -1
- package/library/components/VcTimeInput/VcTimeInput.vue.mjs +61 -27
- package/library/index.mjs +227 -162
- package/library/index.mjs.br +0 -0
- package/library/index.mjs.gz +0 -0
- package/library/localization/index.mjs.gz +0 -0
- package/library/localization/locales/en.json.mjs +51 -1
- package/library/plugin-components.gen.mjs +125 -122
- package/library/plugin.mjs +225 -160
- package/library/plugin.mjs.br +0 -0
- package/library/plugin.mjs.gz +0 -0
- package/library/style.css +40 -16
- package/library/style.css.br +0 -0
- package/library/style.css.gz +0 -0
- package/library/theme/index.mjs.gz +0 -0
- package/library/tokens/tokens.mjs +2 -0
- package/library/types/components/VcFilterBar/VcFilterAddMenu.vue.d.ts +39 -0
- package/library/types/components/VcFilterBar/VcFilterBar.vue.d.ts +132 -0
- package/library/types/components/VcFilterBar/VcFilterChip.vue.d.ts +42 -0
- package/library/types/components/VcFilterBar/VcFilterChipEditor.vue.d.ts +46 -0
- package/library/types/components/VcFilterBar/VcFilterEditorModal.vue.d.ts +40 -0
- package/library/types/components/VcFilterBar/VcFilterEditorPanel.vue.d.ts +116 -0
- package/library/types/components/VcFilterBar/editors/VcFilterBooleanEditor.vue.d.ts +66 -0
- package/library/types/components/VcFilterBar/editors/VcFilterMultiselectEditor.vue.d.ts +73 -0
- package/library/types/components/VcFilterBar/editors/VcFilterRangeEditor.vue.d.ts +62 -0
- package/library/types/components/VcFilterBar/editors/VcFilterSelectEditor.vue.d.ts +62 -0
- package/library/types/components/VcFilterBar/editors/VcFilterTextEditor.vue.d.ts +68 -0
- package/library/types/components/VcFilterBar/editors/VcFilterTextListEditor.vue.d.ts +64 -0
- package/library/types/components/VcFilterBar/filterBarChip.d.ts +23 -0
- package/library/types/components/VcFilterBar/filterBarDate.d.ts +14 -0
- package/library/types/components/VcFilterBar/filterBarDraft.d.ts +28 -0
- package/library/types/components/VcFilterBar/filterBarEditors.d.ts +7 -0
- package/library/types/components/VcFilterBar/filterBarErrors.d.ts +22 -0
- package/library/types/components/VcFilterBar/filterBarModel.d.ts +83 -0
- package/library/types/components/VcFilterBar/filterBarOptions.d.ts +52 -0
- package/library/types/components/VcFilterBar/filterBarSearch.d.ts +23 -0
- package/library/types/components/VcFilterBar/filterBarValidate.d.ts +34 -0
- package/library/types/components/VcJsonSchema/Components/JsonSchemaEditor.vue.d.ts +1 -1
- package/library/types/components/VcTimeInput/VcTimeInput.vue.d.ts +9 -0
- package/library/types/components/exports.d.ts +3 -1
- package/library/types/components.gen.d.ts +1 -0
- package/library/types/entity/components/Table/VcEntityListTable.vue.d.ts +3 -3
- package/library/types/index.d.ts +8 -0
- package/library/types/localization/locales/en.json.d.ts +415 -365
- package/library/types/theme/themes.json.d.ts +72 -72
- package/library/types/tokens/tokens.d.ts +2 -1
- package/library/types/types/VcFilterBar.types.d.ts +329 -0
- package/library/types/types/VcTimeInput.types.d.ts +3 -0
- package/library/types/types/index.d.ts +2 -0
- package/library/utils/jsonSchema/index.mjs.gz +0 -0
- package/package.json +311 -311
- package/src/theme/index.ts +101 -101
- package/src/theme/tailwindScheme.js +78 -78
- package/src/theme/theme.types.ts +31 -31
- package/src/theme/themeMerge.ts +63 -63
- package/src/theme/themes.json +72 -72
- package/tailwind.config.d.ts +5 -5
- package/tailwind.config.js +178 -178
- /package/library/assets/node_modules/element-plus/theme-chalk/src/{tooltip.css → date-picker.css} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import '../../../assets/components/VcFilterBar/editors/VcFilterMultiselectEditor.css';
|
|
2
|
+
import { defineComponent, ref, computed, onMounted, openBlock, createElementBlock, createElementVNode, createVNode, unref, toDisplayString, createTextVNode, withCtx, createCommentVNode, Fragment, renderList, normalizeClass } from "vue";
|
|
3
|
+
import { Search } from "@lucide/vue";
|
|
4
|
+
import _sfc_main$2 from "../../VcButton/VcButton.vue.mjs";
|
|
5
|
+
import '../../../assets/components/VcInput/VcInput.css';import '../../../assets/components/VcCheckbox/VcCheckbox.css';import '../../../assets/components/VcButton/VcButton.css';/* empty css */
|
|
6
|
+
import _sfc_main$3 from "../../VcCheckbox/VcCheckbox.vue.mjs";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import _sfc_main$1 from "../../VcInput/VcInput.vue.mjs";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
11
|
+
import { readOptionKey, getTextDirection } from "../filterBarChip.mjs";
|
|
12
|
+
import { isFilterListValue } from "../filterBarModel.mjs";
|
|
13
|
+
import { useFieldOptions } from "../filterBarOptions.mjs";
|
|
14
|
+
import { validateFieldValue, getProblemMessage } from "../filterBarValidate.mjs";
|
|
15
|
+
const _hoisted_1 = { class: "vc-filter-multiselect-editor" };
|
|
16
|
+
const _hoisted_2 = { class: "vc-filter-multiselect-editor__search" };
|
|
17
|
+
const _hoisted_3 = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "vc-filter-multiselect-editor__message",
|
|
20
|
+
"data-test": "vc-filter-options-denied"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_4 = {
|
|
23
|
+
key: 1,
|
|
24
|
+
class: "vc-filter-multiselect-editor__message"
|
|
25
|
+
};
|
|
26
|
+
const _hoisted_5 = {
|
|
27
|
+
key: 2,
|
|
28
|
+
class: "vc-filter-multiselect-editor__message"
|
|
29
|
+
};
|
|
30
|
+
const _hoisted_6 = ["aria-label"];
|
|
31
|
+
const _hoisted_7 = {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "vc-filter-multiselect-editor__caption"
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_8 = ["data-test"];
|
|
36
|
+
const _hoisted_9 = ["dir"];
|
|
37
|
+
const _hoisted_10 = {
|
|
38
|
+
key: 1,
|
|
39
|
+
class: "vc-filter-multiselect-editor__message"
|
|
40
|
+
};
|
|
41
|
+
const _hoisted_11 = {
|
|
42
|
+
key: 4,
|
|
43
|
+
class: "vc-filter-multiselect-editor__problem",
|
|
44
|
+
role: "alert"
|
|
45
|
+
};
|
|
46
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
47
|
+
__name: "VcFilterMultiselectEditor",
|
|
48
|
+
props: {
|
|
49
|
+
modelValue: { type: [Array, Object, String, Boolean, Number], default: void 0 },
|
|
50
|
+
field: {},
|
|
51
|
+
mode: {},
|
|
52
|
+
blocked: { default: () => [] },
|
|
53
|
+
applied: { default: () => [] },
|
|
54
|
+
error: { default: void 0 },
|
|
55
|
+
refused: { default: () => [] },
|
|
56
|
+
caption: { default: void 0 }
|
|
57
|
+
},
|
|
58
|
+
emits: ["update:modelValue"],
|
|
59
|
+
setup(__props, { emit: __emit }) {
|
|
60
|
+
const props = __props;
|
|
61
|
+
const emit = __emit;
|
|
62
|
+
const query = ref("");
|
|
63
|
+
const { data, loading, loaded, error, deniedReason, get, refresh } = useFieldOptions(() => props.field);
|
|
64
|
+
const selected = computed(() => isFilterListValue(props.modelValue) ? props.modelValue : []);
|
|
65
|
+
const config = computed(() => {
|
|
66
|
+
const field = props.field;
|
|
67
|
+
const optionConfig = field.kind === "multiselect" || field.kind === "select" ? field.optionConfig : void 0;
|
|
68
|
+
return {
|
|
69
|
+
valueKey: (optionConfig == null ? void 0 : optionConfig.valueKey) ?? "value",
|
|
70
|
+
labelKey: (optionConfig == null ? void 0 : optionConfig.labelKey) ?? "label",
|
|
71
|
+
countKey: optionConfig == null ? void 0 : optionConfig.countKey,
|
|
72
|
+
disabledKey: optionConfig == null ? void 0 : optionConfig.disabledKey,
|
|
73
|
+
disabledHintKey: optionConfig == null ? void 0 : optionConfig.disabledHintKey
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const maxValues = computed(() => props.field.kind === "multiselect" ? props.field.maxValues : void 0);
|
|
77
|
+
const atLimit = computed(() => maxValues.value !== void 0 && (/* @__PURE__ */ new Set([...props.applied, ...selected.value])).size >= maxValues.value);
|
|
78
|
+
function asText(value) {
|
|
79
|
+
return typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
80
|
+
}
|
|
81
|
+
const rows = computed(() => data.value.flatMap((option) => {
|
|
82
|
+
const value = readOptionKey(option, config.value.valueKey);
|
|
83
|
+
if (typeof value !== "string" && typeof value !== "number") {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
const isApplied = props.applied.includes(value);
|
|
87
|
+
const isBlocked = props.blocked.includes(value);
|
|
88
|
+
const isSelected = selected.value.includes(value);
|
|
89
|
+
const optionDisabled = config.value.disabledKey ? !!readOptionKey(option, config.value.disabledKey) : false;
|
|
90
|
+
const isRefused = props.refused.includes(value);
|
|
91
|
+
let hint = "";
|
|
92
|
+
if (isRefused) {
|
|
93
|
+
hint = tVU.t("voicenterUi.filterBar.notPermitted");
|
|
94
|
+
} else if (isApplied) {
|
|
95
|
+
hint = tVU.t("voicenterUi.filterBar.alreadyAdded");
|
|
96
|
+
} else if (isBlocked) {
|
|
97
|
+
hint = props.mode === "exclude" ? tVU.t("voicenterUi.filterBar.alreadyIncluded") : tVU.t("voicenterUi.filterBar.alreadyExcluded");
|
|
98
|
+
} else if (optionDisabled) {
|
|
99
|
+
hint = config.value.disabledHintKey ? asText(readOptionKey(option, config.value.disabledHintKey)) : "";
|
|
100
|
+
}
|
|
101
|
+
const count = config.value.countKey ? readOptionKey(option, config.value.countKey) : void 0;
|
|
102
|
+
return [{
|
|
103
|
+
value,
|
|
104
|
+
label: asText(readOptionKey(option, config.value.labelKey)) || String(value),
|
|
105
|
+
checked: isApplied || isSelected,
|
|
106
|
+
disabled: isApplied || isBlocked || optionDisabled || atLimit.value && !isSelected,
|
|
107
|
+
aside: hint || (typeof count === "number" ? count.toLocaleString() : asText(count)),
|
|
108
|
+
refused: isRefused
|
|
109
|
+
}];
|
|
110
|
+
}));
|
|
111
|
+
const visibleRows = computed(() => {
|
|
112
|
+
const text = query.value.trim().toLowerCase();
|
|
113
|
+
return text ? rows.value.filter((row) => row.label.toLowerCase().includes(text)) : rows.value;
|
|
114
|
+
});
|
|
115
|
+
const searchPlaceholder = computed(() => {
|
|
116
|
+
const plural = props.field.kind === "multiselect" ? props.field.plural : void 0;
|
|
117
|
+
return plural ? tVU.t("voicenterUi.filterBar.searchOptions", { plural }) : tVU.t("voicenterUi.filterBar.search");
|
|
118
|
+
});
|
|
119
|
+
const problemText = computed(() => {
|
|
120
|
+
const problem = validateFieldValue(props.field, selected.value, props.applied);
|
|
121
|
+
if (!problem) {
|
|
122
|
+
return props.error;
|
|
123
|
+
}
|
|
124
|
+
const { key, params } = getProblemMessage(problem);
|
|
125
|
+
return tVU.t(key, params);
|
|
126
|
+
});
|
|
127
|
+
function toggle(value, checked) {
|
|
128
|
+
const next = checked ? [...selected.value, value] : selected.value.filter((item) => item !== value);
|
|
129
|
+
emit("update:modelValue", next.length ? next : void 0);
|
|
130
|
+
}
|
|
131
|
+
onMounted(() => {
|
|
132
|
+
void get();
|
|
133
|
+
});
|
|
134
|
+
return (_ctx, _cache) => {
|
|
135
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
136
|
+
createElementVNode("div", _hoisted_2, [
|
|
137
|
+
createVNode(_sfc_main$1, {
|
|
138
|
+
modelValue: query.value,
|
|
139
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => query.value = $event),
|
|
140
|
+
"prefix-icon": unref(Search),
|
|
141
|
+
placeholder: searchPlaceholder.value,
|
|
142
|
+
"aria-label": searchPlaceholder.value,
|
|
143
|
+
clearable: "",
|
|
144
|
+
"data-test": "vc-filter-options-search"
|
|
145
|
+
}, null, 8, ["modelValue", "prefix-icon", "placeholder", "aria-label"])
|
|
146
|
+
]),
|
|
147
|
+
unref(deniedReason) ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(unref(deniedReason)), 1)) : unref(loading) && !unref(loaded) ? (openBlock(), createElementBlock("p", _hoisted_4, toDisplayString(unref(tVU).t("voicenterUi.filterBar.loading")), 1)) : unref(error) && !unref(loaded) ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
148
|
+
createTextVNode(toDisplayString(unref(tVU).t("voicenterUi.filterBar.loadFailed")) + " ", 1),
|
|
149
|
+
createVNode(_sfc_main$2, {
|
|
150
|
+
type: "borderless",
|
|
151
|
+
color: "secondary",
|
|
152
|
+
size: "small",
|
|
153
|
+
onClick: unref(refresh)
|
|
154
|
+
}, {
|
|
155
|
+
default: withCtx(() => [
|
|
156
|
+
createTextVNode(toDisplayString(unref(tVU).t("voicenterUi.filterBar.retry")), 1)
|
|
157
|
+
]),
|
|
158
|
+
_: 1
|
|
159
|
+
}, 8, ["onClick"])
|
|
160
|
+
])) : (openBlock(), createElementBlock("div", {
|
|
161
|
+
key: 3,
|
|
162
|
+
class: "vc-filter-multiselect-editor__list",
|
|
163
|
+
role: "group",
|
|
164
|
+
"aria-label": __props.field.label
|
|
165
|
+
}, [
|
|
166
|
+
__props.caption ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString(__props.caption), 1)) : createCommentVNode("", true),
|
|
167
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleRows.value, (row) => {
|
|
168
|
+
return openBlock(), createElementBlock("div", {
|
|
169
|
+
key: String(row.value),
|
|
170
|
+
class: "vc-filter-multiselect-editor__row",
|
|
171
|
+
"data-test": `vc-filter-option-${row.value}`
|
|
172
|
+
}, [
|
|
173
|
+
createVNode(_sfc_main$3, {
|
|
174
|
+
"model-value": row.checked,
|
|
175
|
+
disabled: row.disabled,
|
|
176
|
+
"onUpdate:modelValue": ($event) => toggle(row.value, $event)
|
|
177
|
+
}, {
|
|
178
|
+
default: withCtx(() => [
|
|
179
|
+
createElementVNode("span", {
|
|
180
|
+
dir: unref(getTextDirection)(row.label)
|
|
181
|
+
}, toDisplayString(row.label), 9, _hoisted_9)
|
|
182
|
+
]),
|
|
183
|
+
_: 2
|
|
184
|
+
}, 1032, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
185
|
+
createElementVNode("span", {
|
|
186
|
+
class: normalizeClass(["vc-filter-multiselect-editor__aside", { "is-refused": row.refused }])
|
|
187
|
+
}, toDisplayString(row.aside), 3)
|
|
188
|
+
], 8, _hoisted_8);
|
|
189
|
+
}), 128)),
|
|
190
|
+
!visibleRows.value.length ? (openBlock(), createElementBlock("p", _hoisted_10, toDisplayString(rows.value.length ? unref(tVU).t("voicenterUi.filterBar.noOptionsMatch") : unref(tVU).t("voicenterUi.filterBar.noOptions")), 1)) : createCommentVNode("", true)
|
|
191
|
+
], 8, _hoisted_6)),
|
|
192
|
+
problemText.value ? (openBlock(), createElementBlock("p", _hoisted_11, toDisplayString(problemText.value), 1)) : createCommentVNode("", true)
|
|
193
|
+
]);
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
export {
|
|
198
|
+
_sfc_main as default
|
|
199
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import '../../../assets/components/VcFilterBar/editors/VcFilterRangeEditor.css';
|
|
2
|
+
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, unref, createBlock, createCommentVNode } from "vue";
|
|
3
|
+
import _sfc_main$2 from "../../VcInputNumber/VcInputNumber.vue.mjs";
|
|
4
|
+
import '../../../assets/components/VcTimeInput/VcTimeInput.css';import '../../../assets/components/VcInputNumber/VcInputNumber.css';/* empty css */
|
|
5
|
+
import _sfc_main$1 from "../../VcTimeInput/VcTimeInput.vue.mjs";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
8
|
+
import { isFilterRangeValue } from "../filterBarModel.mjs";
|
|
9
|
+
import { validateFieldValue, getProblemMessage } from "../filterBarValidate.mjs";
|
|
10
|
+
const _hoisted_1 = { class: "vc-filter-range-editor" };
|
|
11
|
+
const _hoisted_2 = { class: "vc-filter-range-editor__bounds" };
|
|
12
|
+
const _hoisted_3 = { class: "vc-filter-range-editor__bound" };
|
|
13
|
+
const _hoisted_4 = { class: "vc-filter-range-editor__label" };
|
|
14
|
+
const _hoisted_5 = { class: "vc-filter-range-editor__bound" };
|
|
15
|
+
const _hoisted_6 = { class: "vc-filter-range-editor__label" };
|
|
16
|
+
const _hoisted_7 = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "vc-filter-range-editor__problem",
|
|
19
|
+
role: "alert"
|
|
20
|
+
};
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
22
|
+
__name: "VcFilterRangeEditor",
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: { type: [Array, Object, String, Boolean, Number], default: void 0 },
|
|
25
|
+
field: {},
|
|
26
|
+
mode: {},
|
|
27
|
+
blocked: { default: () => [] },
|
|
28
|
+
applied: { default: () => [] },
|
|
29
|
+
error: { default: void 0 },
|
|
30
|
+
refused: { default: () => [] }
|
|
31
|
+
},
|
|
32
|
+
emits: ["update:modelValue"],
|
|
33
|
+
setup(__props, { emit: __emit }) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const emit = __emit;
|
|
36
|
+
const range = computed(() => isFilterRangeValue(props.modelValue) ? props.modelValue : {
|
|
37
|
+
from: null,
|
|
38
|
+
to: null
|
|
39
|
+
});
|
|
40
|
+
const isTime = computed(() => props.field.kind === "range" && props.field.input === "time");
|
|
41
|
+
const timeFormat = computed(() => props.field.kind === "range" ? props.field.timeFormat ?? "mm:ss" : "mm:ss");
|
|
42
|
+
const step = computed(() => props.field.kind === "range" ? props.field.step : void 0);
|
|
43
|
+
const min = computed(() => props.field.kind === "range" ? props.field.min : void 0);
|
|
44
|
+
const max = computed(() => props.field.kind === "range" ? props.field.max : void 0);
|
|
45
|
+
function setBound(bound, value) {
|
|
46
|
+
let next = typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
47
|
+
if (isTime.value && next === 0) {
|
|
48
|
+
next = null;
|
|
49
|
+
}
|
|
50
|
+
if (range.value[bound] === next) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const updated = {
|
|
54
|
+
...range.value,
|
|
55
|
+
[bound]: next
|
|
56
|
+
};
|
|
57
|
+
emit("update:modelValue", updated.from === null && updated.to === null ? void 0 : updated);
|
|
58
|
+
}
|
|
59
|
+
const problemText = computed(() => {
|
|
60
|
+
const problem = validateFieldValue(props.field, range.value);
|
|
61
|
+
if (!problem) {
|
|
62
|
+
return props.error;
|
|
63
|
+
}
|
|
64
|
+
const { key, params } = getProblemMessage(problem);
|
|
65
|
+
return tVU.t(key, params);
|
|
66
|
+
});
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
69
|
+
createElementVNode("div", _hoisted_2, [
|
|
70
|
+
createElementVNode("label", _hoisted_3, [
|
|
71
|
+
createElementVNode("span", _hoisted_4, toDisplayString(unref(tVU).t("voicenterUi.filterBar.dateFrom")), 1),
|
|
72
|
+
isTime.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
73
|
+
key: 0,
|
|
74
|
+
"model-value": range.value.from ?? 0,
|
|
75
|
+
format: timeFormat.value,
|
|
76
|
+
step: step.value ?? 1,
|
|
77
|
+
"max-value": 0,
|
|
78
|
+
"empty-data-text": unref(tVU).t("voicenterUi.filterBar.any"),
|
|
79
|
+
"data-test-name": "vc-filter-range-from",
|
|
80
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => setBound("from", $event))
|
|
81
|
+
}, null, 8, ["model-value", "format", "step", "empty-data-text"])) : (openBlock(), createBlock(_sfc_main$2, {
|
|
82
|
+
key: 1,
|
|
83
|
+
"model-value": range.value.from ?? void 0,
|
|
84
|
+
"min-value": min.value,
|
|
85
|
+
"max-value": max.value,
|
|
86
|
+
step: step.value ?? 1,
|
|
87
|
+
placeholder: unref(tVU).t("voicenterUi.filterBar.any"),
|
|
88
|
+
"full-width": "",
|
|
89
|
+
"data-test-name": "vc-filter-range-from",
|
|
90
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => setBound("from", $event))
|
|
91
|
+
}, null, 8, ["model-value", "min-value", "max-value", "step", "placeholder"]))
|
|
92
|
+
]),
|
|
93
|
+
createElementVNode("label", _hoisted_5, [
|
|
94
|
+
createElementVNode("span", _hoisted_6, toDisplayString(unref(tVU).t("voicenterUi.filterBar.dateTo")), 1),
|
|
95
|
+
isTime.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
96
|
+
key: 0,
|
|
97
|
+
"model-value": range.value.to ?? 0,
|
|
98
|
+
format: timeFormat.value,
|
|
99
|
+
step: step.value ?? 1,
|
|
100
|
+
"max-value": 0,
|
|
101
|
+
"empty-data-text": unref(tVU).t("voicenterUi.filterBar.any"),
|
|
102
|
+
"data-test-name": "vc-filter-range-to",
|
|
103
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => setBound("to", $event))
|
|
104
|
+
}, null, 8, ["model-value", "format", "step", "empty-data-text"])) : (openBlock(), createBlock(_sfc_main$2, {
|
|
105
|
+
key: 1,
|
|
106
|
+
"model-value": range.value.to ?? void 0,
|
|
107
|
+
"min-value": min.value,
|
|
108
|
+
"max-value": max.value,
|
|
109
|
+
step: step.value ?? 1,
|
|
110
|
+
placeholder: unref(tVU).t("voicenterUi.filterBar.any"),
|
|
111
|
+
"full-width": "",
|
|
112
|
+
"data-test-name": "vc-filter-range-to",
|
|
113
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => setBound("to", $event))
|
|
114
|
+
}, null, 8, ["model-value", "min-value", "max-value", "step", "placeholder"]))
|
|
115
|
+
])
|
|
116
|
+
]),
|
|
117
|
+
problemText.value ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString(problemText.value), 1)) : createCommentVNode("", true)
|
|
118
|
+
]);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
export {
|
|
123
|
+
_sfc_main as default
|
|
124
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import '../../../assets/components/VcFilterBar/editors/VcFilterSelectEditor.css';
|
|
2
|
+
import { defineComponent, computed, onMounted, openBlock, createElementBlock, toDisplayString, createCommentVNode, unref, Fragment, renderList, createBlock } from "vue";
|
|
3
|
+
import _sfc_main$1 from "../../VcRadio/VcRadio.vue.mjs";
|
|
4
|
+
import '../../../assets/components/VcRadio/VcRadio.css';/* empty css */
|
|
5
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
6
|
+
import { readOptionKey } from "../filterBarChip.mjs";
|
|
7
|
+
import { useFieldOptions } from "../filterBarOptions.mjs";
|
|
8
|
+
const _hoisted_1 = { class: "vc-filter-select-editor" };
|
|
9
|
+
const _hoisted_2 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "vc-filter-select-editor__error",
|
|
12
|
+
role: "alert"
|
|
13
|
+
};
|
|
14
|
+
const _hoisted_3 = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "vc-filter-select-editor__message"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_4 = {
|
|
19
|
+
key: 2,
|
|
20
|
+
class: "vc-filter-select-editor__message"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_5 = ["aria-label"];
|
|
23
|
+
const _hoisted_6 = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "vc-filter-select-editor__message"
|
|
26
|
+
};
|
|
27
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
28
|
+
__name: "VcFilterSelectEditor",
|
|
29
|
+
props: {
|
|
30
|
+
modelValue: { type: [Array, Object, String, Boolean, Number], default: void 0 },
|
|
31
|
+
field: {},
|
|
32
|
+
mode: {},
|
|
33
|
+
blocked: { default: () => [] },
|
|
34
|
+
applied: { default: () => [] },
|
|
35
|
+
error: { default: void 0 },
|
|
36
|
+
refused: { default: () => [] }
|
|
37
|
+
},
|
|
38
|
+
emits: ["update:modelValue"],
|
|
39
|
+
setup(__props, { emit: __emit }) {
|
|
40
|
+
const props = __props;
|
|
41
|
+
const emit = __emit;
|
|
42
|
+
const { data, loading, loaded, deniedReason, get } = useFieldOptions(() => props.field);
|
|
43
|
+
const selected = computed(() => typeof props.modelValue === "string" || typeof props.modelValue === "number" ? props.modelValue : void 0);
|
|
44
|
+
const rows = computed(() => {
|
|
45
|
+
const field = props.field;
|
|
46
|
+
const config = field.kind === "select" ? field.optionConfig : void 0;
|
|
47
|
+
const valueKey = (config == null ? void 0 : config.valueKey) ?? "value";
|
|
48
|
+
const labelKey = (config == null ? void 0 : config.labelKey) ?? "label";
|
|
49
|
+
return data.value.flatMap((option) => {
|
|
50
|
+
const value = readOptionKey(option, valueKey);
|
|
51
|
+
if (typeof value !== "string" && typeof value !== "number") {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const label = readOptionKey(option, labelKey);
|
|
55
|
+
return [{
|
|
56
|
+
value,
|
|
57
|
+
label: typeof label === "string" || typeof label === "number" ? String(label) : String(value),
|
|
58
|
+
disabled: (config == null ? void 0 : config.disabledKey) ? !!readOptionKey(option, config.disabledKey) : false
|
|
59
|
+
}];
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
function onChange(value) {
|
|
63
|
+
emit("update:modelValue", typeof value === "string" || typeof value === "number" ? value : void 0);
|
|
64
|
+
}
|
|
65
|
+
onMounted(() => {
|
|
66
|
+
void get();
|
|
67
|
+
});
|
|
68
|
+
return (_ctx, _cache) => {
|
|
69
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
70
|
+
__props.error ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(__props.error), 1)) : createCommentVNode("", true),
|
|
71
|
+
unref(deniedReason) ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(unref(deniedReason)), 1)) : unref(loading) && !unref(loaded) ? (openBlock(), createElementBlock("p", _hoisted_4, toDisplayString(unref(tVU).t("voicenterUi.filterBar.loading")), 1)) : (openBlock(), createElementBlock("div", {
|
|
72
|
+
key: 3,
|
|
73
|
+
class: "vc-filter-select-editor__list",
|
|
74
|
+
role: "radiogroup",
|
|
75
|
+
"aria-label": __props.field.label
|
|
76
|
+
}, [
|
|
77
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row) => {
|
|
78
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
79
|
+
key: String(row.value),
|
|
80
|
+
"model-value": selected.value,
|
|
81
|
+
value: row.value,
|
|
82
|
+
label: row.label,
|
|
83
|
+
disabled: row.disabled,
|
|
84
|
+
"data-test-name": `vc-filter-select-${row.value}`,
|
|
85
|
+
"onUpdate:modelValue": onChange
|
|
86
|
+
}, null, 8, ["model-value", "value", "label", "disabled", "data-test-name"]);
|
|
87
|
+
}), 128)),
|
|
88
|
+
!rows.value.length ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(unref(tVU).t("voicenterUi.filterBar.noOptions")), 1)) : createCommentVNode("", true)
|
|
89
|
+
], 8, _hoisted_5))
|
|
90
|
+
]);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
export {
|
|
95
|
+
_sfc_main as default
|
|
96
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import '../../../assets/components/VcFilterBar/editors/VcFilterTextEditor.css';
|
|
2
|
+
import { defineComponent, computed, openBlock, createElementBlock, createVNode, withKeys, withModifiers, toDisplayString, createCommentVNode } from "vue";
|
|
3
|
+
import _sfc_main$1 from "../../VcInput/VcInput.vue.mjs";
|
|
4
|
+
import '../../../assets/components/VcInput/VcInput.css';/* empty css */
|
|
5
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
6
|
+
import { validateFieldValue, getProblemMessage } from "../filterBarValidate.mjs";
|
|
7
|
+
const _hoisted_1 = { class: "vc-filter-text-editor" };
|
|
8
|
+
const _hoisted_2 = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "vc-filter-text-editor__problem",
|
|
11
|
+
role: "alert"
|
|
12
|
+
};
|
|
13
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
+
__name: "VcFilterTextEditor",
|
|
15
|
+
props: {
|
|
16
|
+
modelValue: { type: [Array, Object, String, Boolean, Number], default: void 0 },
|
|
17
|
+
field: {},
|
|
18
|
+
mode: {},
|
|
19
|
+
blocked: { default: () => [] },
|
|
20
|
+
applied: { default: () => [] },
|
|
21
|
+
error: { default: void 0 },
|
|
22
|
+
refused: { default: () => [] }
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:modelValue", "close"],
|
|
25
|
+
setup(__props, { emit: __emit }) {
|
|
26
|
+
const props = __props;
|
|
27
|
+
const emit = __emit;
|
|
28
|
+
const text = computed(() => typeof props.modelValue === "string" ? props.modelValue : "");
|
|
29
|
+
const problemText = computed(() => {
|
|
30
|
+
const problem = text.value ? validateFieldValue(props.field, text.value) : void 0;
|
|
31
|
+
if (!problem) {
|
|
32
|
+
return props.error;
|
|
33
|
+
}
|
|
34
|
+
const { key, params } = getProblemMessage(problem);
|
|
35
|
+
return tVU.t(key, params);
|
|
36
|
+
});
|
|
37
|
+
function onInput(value) {
|
|
38
|
+
emit("update:modelValue", value ? value : void 0);
|
|
39
|
+
}
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
42
|
+
createVNode(_sfc_main$1, {
|
|
43
|
+
"model-value": text.value,
|
|
44
|
+
"aria-label": __props.field.label,
|
|
45
|
+
"is-error": !!problemText.value,
|
|
46
|
+
clearable: "",
|
|
47
|
+
"data-test": "vc-filter-text-input",
|
|
48
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => onInput(String($event))),
|
|
49
|
+
onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => emit("close"), ["prevent"]), ["enter"]))
|
|
50
|
+
}, null, 8, ["model-value", "aria-label", "is-error"]),
|
|
51
|
+
problemText.value ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(problemText.value), 1)) : createCommentVNode("", true)
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
_sfc_main as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import '../../../assets/components/VcFilterBar/editors/VcFilterTextListEditor.css';
|
|
2
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, createVNode, withKeys, withModifiers, createBlock, unref, nextTick } from "vue";
|
|
3
|
+
import { X } from "@lucide/vue";
|
|
4
|
+
import _sfc_main$2 from "../../VcButton/VcButtonIcon.vue.mjs";
|
|
5
|
+
import '../../../assets/components/VcInput/VcInput.css';import '../../../assets/components/VcButton/VcButtonIcon.css';/* empty css */
|
|
6
|
+
import _sfc_main$1 from "../../VcInput/VcInput.vue.mjs";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { tVU } from "../../../localization/index.mjs";
|
|
9
|
+
import { isFilterListValue } from "../filterBarModel.mjs";
|
|
10
|
+
import { validateFieldValue, getProblemMessage } from "../filterBarValidate.mjs";
|
|
11
|
+
const _hoisted_1 = ["aria-label"];
|
|
12
|
+
const _hoisted_2 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "vc-filter-text-list-editor__note"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_3 = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "vc-filter-text-list-editor__problem",
|
|
19
|
+
role: "alert"
|
|
20
|
+
};
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
22
|
+
__name: "VcFilterTextListEditor",
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: { type: [Array, Object, String, Boolean, Number], default: void 0 },
|
|
25
|
+
field: {},
|
|
26
|
+
mode: {},
|
|
27
|
+
blocked: { default: () => [] },
|
|
28
|
+
applied: { default: () => [] },
|
|
29
|
+
error: { default: void 0 },
|
|
30
|
+
refused: { default: () => [] }
|
|
31
|
+
},
|
|
32
|
+
emits: ["update:modelValue", "close"],
|
|
33
|
+
setup(__props, { emit: __emit }) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const emit = __emit;
|
|
36
|
+
const rootRef = ref();
|
|
37
|
+
let lastId = 0;
|
|
38
|
+
function newRow(text = "") {
|
|
39
|
+
lastId += 1;
|
|
40
|
+
return {
|
|
41
|
+
id: lastId,
|
|
42
|
+
text
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const rows = ref([
|
|
46
|
+
...isFilterListValue(props.modelValue) ? props.modelValue.map((item) => newRow(String(item))) : [],
|
|
47
|
+
newRow()
|
|
48
|
+
]);
|
|
49
|
+
const room = computed(() => {
|
|
50
|
+
const max = props.field.kind === "textList" ? props.field.maxValues : void 0;
|
|
51
|
+
return max === void 0 ? Infinity : Math.max(0, max - props.applied.length);
|
|
52
|
+
});
|
|
53
|
+
const pattern = computed(() => props.field.kind === "textList" ? props.field.pattern : void 0);
|
|
54
|
+
function isWrong(text) {
|
|
55
|
+
const value = text.trim();
|
|
56
|
+
if (!value) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const regex = pattern.value ? new RegExp(pattern.value.source, pattern.value.flags.replace("g", "")) : void 0;
|
|
60
|
+
return (regex ? !regex.test(value) : false) || props.applied.includes(value) || props.blocked.includes(value);
|
|
61
|
+
}
|
|
62
|
+
const values = computed(() => {
|
|
63
|
+
const texts = rows.value.map((row) => row.text.trim()).filter((text) => text !== "");
|
|
64
|
+
return texts.filter((text, index) => texts.indexOf(text) === index);
|
|
65
|
+
});
|
|
66
|
+
const appliedText = computed(() => props.applied.length ? tVU.t("voicenterUi.filterBar.alreadyAddedList", { values: props.applied.join(", ") }) : "");
|
|
67
|
+
const kept = computed(() => values.value.filter((value) => !isWrong(value)));
|
|
68
|
+
const problemText = computed(() => {
|
|
69
|
+
const problem = validateFieldValue(props.field, kept.value, props.applied);
|
|
70
|
+
if (problem) {
|
|
71
|
+
const { key, params } = getProblemMessage(problem);
|
|
72
|
+
return tVU.t(key, params);
|
|
73
|
+
}
|
|
74
|
+
if (values.value.some(isWrong)) {
|
|
75
|
+
return tVU.t("voicenterUi.filterBar.wrongLeftOut");
|
|
76
|
+
}
|
|
77
|
+
return props.error;
|
|
78
|
+
});
|
|
79
|
+
function emitValues() {
|
|
80
|
+
emit("update:modelValue", kept.value.length ? kept.value : void 0);
|
|
81
|
+
}
|
|
82
|
+
function keepEmptyRow() {
|
|
83
|
+
const last = rows.value[rows.value.length - 1];
|
|
84
|
+
if ((!last || last.text) && rows.value.length < room.value) {
|
|
85
|
+
rows.value.push(newRow());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function onInput(index, text) {
|
|
89
|
+
rows.value[index].text = text;
|
|
90
|
+
keepEmptyRow();
|
|
91
|
+
emitValues();
|
|
92
|
+
}
|
|
93
|
+
function removeRow(index) {
|
|
94
|
+
rows.value.splice(index, 1);
|
|
95
|
+
if (!rows.value.length) {
|
|
96
|
+
rows.value.push(newRow());
|
|
97
|
+
}
|
|
98
|
+
keepEmptyRow();
|
|
99
|
+
emitValues();
|
|
100
|
+
}
|
|
101
|
+
function focusRow(index) {
|
|
102
|
+
void nextTick(() => {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
return (_b = (_a = rootRef.value) == null ? void 0 : _a.querySelectorAll("input")[index]) == null ? void 0 : _b.focus();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function onEnter(index) {
|
|
108
|
+
if (index === rows.value.length - 1 && !rows.value[index].text.trim()) {
|
|
109
|
+
emit("close");
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
keepEmptyRow();
|
|
113
|
+
focusRow(index + 1);
|
|
114
|
+
}
|
|
115
|
+
return (_ctx, _cache) => {
|
|
116
|
+
return openBlock(), createElementBlock("div", {
|
|
117
|
+
ref_key: "rootRef",
|
|
118
|
+
ref: rootRef,
|
|
119
|
+
class: "vc-filter-text-list-editor",
|
|
120
|
+
role: "group",
|
|
121
|
+
"aria-label": __props.field.label
|
|
122
|
+
}, [
|
|
123
|
+
appliedText.value ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(appliedText.value), 1)) : createCommentVNode("", true),
|
|
124
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, index) => {
|
|
125
|
+
return openBlock(), createElementBlock("div", {
|
|
126
|
+
key: row.id,
|
|
127
|
+
class: "vc-filter-text-list-editor__row"
|
|
128
|
+
}, [
|
|
129
|
+
createVNode(_sfc_main$1, {
|
|
130
|
+
"model-value": row.text,
|
|
131
|
+
"aria-label": `${__props.field.label} ${index + 1}`,
|
|
132
|
+
"is-error": isWrong(row.text),
|
|
133
|
+
"data-test": "vc-filter-text-list-input",
|
|
134
|
+
"onUpdate:modelValue": ($event) => onInput(index, String($event)),
|
|
135
|
+
onKeydown: withKeys(withModifiers(($event) => onEnter(index), ["prevent"]), ["enter"])
|
|
136
|
+
}, null, 8, ["model-value", "aria-label", "is-error", "onUpdate:modelValue", "onKeydown"]),
|
|
137
|
+
row.text || rows.value.length > 1 ? (openBlock(), createBlock(_sfc_main$2, {
|
|
138
|
+
key: 0,
|
|
139
|
+
icon: unref(X),
|
|
140
|
+
plain: "",
|
|
141
|
+
color: "secondary",
|
|
142
|
+
"aria-label": unref(tVU).t("voicenterUi.filterBar.removeValue"),
|
|
143
|
+
"data-test": "vc-filter-text-list-remove",
|
|
144
|
+
onClick: ($event) => removeRow(index)
|
|
145
|
+
}, null, 8, ["icon", "aria-label", "onClick"])) : createCommentVNode("", true)
|
|
146
|
+
]);
|
|
147
|
+
}), 128)),
|
|
148
|
+
problemText.value ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(problemText.value), 1)) : createCommentVNode("", true)
|
|
149
|
+
], 8, _hoisted_1);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
export {
|
|
154
|
+
_sfc_main as default
|
|
155
|
+
};
|