@vc-shell/framework 1.0.134 → 1.0.136
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/CHANGELOG.md +21 -0
- package/dist/framework.js +2876 -2887
- package/dist/index.css +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +0 -10
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/index.d.ts +1 -83
- package/dist/ui/components/atoms/vc-label/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +0 -2
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-input-currency/index.d.ts +1 -330
- package/dist/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +19 -3
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +3 -14
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +3 -3
- package/dist/ui/components/organisms/vc-gallery/index.d.ts +1 -136
- package/dist/ui/components/organisms/vc-gallery/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +3 -3
- package/package.json +4 -4
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +1 -0
- package/shared/modules/dynamic/components/fields/MultivalueField.ts +0 -2
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +1 -1
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +1 -1
- package/shared/modules/dynamic/types/index.ts +0 -10
- package/ui/components/atoms/vc-checkbox/vc-checkbox.stories.ts +4 -2
- package/ui/components/atoms/vc-checkbox/vc-checkbox.vue +1 -0
- package/ui/components/atoms/vc-label/index.ts +1 -3
- package/ui/components/atoms/vc-label/vc-label.vue +33 -28
- package/ui/components/molecules/vc-editor/vc-editor.vue +0 -3
- package/ui/components/molecules/vc-field/vc-field.vue +0 -2
- package/ui/components/molecules/vc-input-currency/index.ts +1 -18
- package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +13 -0
- package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +10 -17
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +0 -1
- package/ui/components/organisms/vc-gallery/index.ts +1 -3
|
@@ -1,137 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
disabled: {
|
|
3
|
-
type: import("vue").PropType<boolean>;
|
|
4
|
-
};
|
|
5
|
-
label: {
|
|
6
|
-
type: import("vue").PropType<string>;
|
|
7
|
-
};
|
|
8
|
-
variant: {
|
|
9
|
-
type: import("vue").PropType<"gallery" | "file-upload">;
|
|
10
|
-
default: string;
|
|
11
|
-
};
|
|
12
|
-
name: {
|
|
13
|
-
type: import("vue").PropType<string>;
|
|
14
|
-
default: string;
|
|
15
|
-
};
|
|
16
|
-
required: {
|
|
17
|
-
type: import("vue").PropType<boolean>;
|
|
18
|
-
};
|
|
19
|
-
tooltip: {
|
|
20
|
-
type: import("vue").PropType<string>;
|
|
21
|
-
};
|
|
22
|
-
tooltipIcon: {
|
|
23
|
-
type: import("vue").PropType<string>;
|
|
24
|
-
default: string;
|
|
25
|
-
};
|
|
26
|
-
loading: {
|
|
27
|
-
type: import("vue").PropType<boolean>;
|
|
28
|
-
};
|
|
29
|
-
multiple: {
|
|
30
|
-
type: import("vue").PropType<boolean>;
|
|
31
|
-
};
|
|
32
|
-
rules: {
|
|
33
|
-
type: import("vue").PropType<string | Record<string, unknown>>;
|
|
34
|
-
};
|
|
35
|
-
images: {
|
|
36
|
-
type: import("vue").PropType<import("../../../..").ICommonAsset[]>;
|
|
37
|
-
default: () => never[];
|
|
38
|
-
};
|
|
39
|
-
uploadIcon: {
|
|
40
|
-
type: import("vue").PropType<string>;
|
|
41
|
-
default: string;
|
|
42
|
-
};
|
|
43
|
-
itemActions: {
|
|
44
|
-
type: import("vue").PropType<{
|
|
45
|
-
preview: boolean;
|
|
46
|
-
edit: boolean;
|
|
47
|
-
remove: boolean;
|
|
48
|
-
}>;
|
|
49
|
-
default: () => {
|
|
50
|
-
preview: boolean;
|
|
51
|
-
edit: boolean;
|
|
52
|
-
remove: boolean;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
hideAfterUpload: {
|
|
56
|
-
type: import("vue").PropType<boolean>;
|
|
57
|
-
};
|
|
58
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
59
|
-
upload: (files: FileList, startingSortOrder?: number | undefined) => void;
|
|
60
|
-
sort: (sorted: import("../../../..").ICommonAsset[]) => void;
|
|
61
|
-
edit: (image: import("../../../..").ICommonAsset) => void;
|
|
62
|
-
remove: (image: import("../../../..").ICommonAsset) => void;
|
|
63
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
64
|
-
disabled: {
|
|
65
|
-
type: import("vue").PropType<boolean>;
|
|
66
|
-
};
|
|
67
|
-
label: {
|
|
68
|
-
type: import("vue").PropType<string>;
|
|
69
|
-
};
|
|
70
|
-
variant: {
|
|
71
|
-
type: import("vue").PropType<"gallery" | "file-upload">;
|
|
72
|
-
default: string;
|
|
73
|
-
};
|
|
74
|
-
name: {
|
|
75
|
-
type: import("vue").PropType<string>;
|
|
76
|
-
default: string;
|
|
77
|
-
};
|
|
78
|
-
required: {
|
|
79
|
-
type: import("vue").PropType<boolean>;
|
|
80
|
-
};
|
|
81
|
-
tooltip: {
|
|
82
|
-
type: import("vue").PropType<string>;
|
|
83
|
-
};
|
|
84
|
-
tooltipIcon: {
|
|
85
|
-
type: import("vue").PropType<string>;
|
|
86
|
-
default: string;
|
|
87
|
-
};
|
|
88
|
-
loading: {
|
|
89
|
-
type: import("vue").PropType<boolean>;
|
|
90
|
-
};
|
|
91
|
-
multiple: {
|
|
92
|
-
type: import("vue").PropType<boolean>;
|
|
93
|
-
};
|
|
94
|
-
rules: {
|
|
95
|
-
type: import("vue").PropType<string | Record<string, unknown>>;
|
|
96
|
-
};
|
|
97
|
-
images: {
|
|
98
|
-
type: import("vue").PropType<import("../../../..").ICommonAsset[]>;
|
|
99
|
-
default: () => never[];
|
|
100
|
-
};
|
|
101
|
-
uploadIcon: {
|
|
102
|
-
type: import("vue").PropType<string>;
|
|
103
|
-
default: string;
|
|
104
|
-
};
|
|
105
|
-
itemActions: {
|
|
106
|
-
type: import("vue").PropType<{
|
|
107
|
-
preview: boolean;
|
|
108
|
-
edit: boolean;
|
|
109
|
-
remove: boolean;
|
|
110
|
-
}>;
|
|
111
|
-
default: () => {
|
|
112
|
-
preview: boolean;
|
|
113
|
-
edit: boolean;
|
|
114
|
-
remove: boolean;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
hideAfterUpload: {
|
|
118
|
-
type: import("vue").PropType<boolean>;
|
|
119
|
-
};
|
|
120
|
-
}>> & {
|
|
121
|
-
onUpload?: ((files: FileList, startingSortOrder?: number | undefined) => any) | undefined;
|
|
122
|
-
onEdit?: ((image: import("../../../..").ICommonAsset) => any) | undefined;
|
|
123
|
-
onSort?: ((sorted: import("../../../..").ICommonAsset[]) => any) | undefined;
|
|
124
|
-
onRemove?: ((image: import("../../../..").ICommonAsset) => any) | undefined;
|
|
125
|
-
}, {
|
|
126
|
-
variant: "gallery" | "file-upload";
|
|
127
|
-
name: string;
|
|
128
|
-
tooltipIcon: string;
|
|
129
|
-
images: import("../../../..").ICommonAsset[];
|
|
130
|
-
uploadIcon: string;
|
|
131
|
-
itemActions: {
|
|
132
|
-
preview: boolean;
|
|
133
|
-
edit: boolean;
|
|
134
|
-
remove: boolean;
|
|
135
|
-
};
|
|
136
|
-
}, {}>;
|
|
1
|
+
export { default as VcGallery } from "./vc-gallery.vue";
|
|
137
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../ui/components/organisms/vc-gallery/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../ui/components/organisms/vc-gallery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -84,7 +84,7 @@ declare const _default: <T extends string | TableItem>(__VLS_props: {
|
|
|
84
84
|
empty: (props: any) => any;
|
|
85
85
|
footer: (props: any) => any;
|
|
86
86
|
};
|
|
87
|
-
emit: ((evt: "
|
|
87
|
+
emit: ((evt: "scroll:ptr") => void) & ((evt: "value", args_0: Record<string, unknown>) => void) & ((evt: "itemClick", item: T) => void) & ((evt: "paginationClick", page: number) => void) & ((evt: "selectionChanged", values: T[]) => void) & ((evt: "search:change", value: string | number | Date | null) => void) & ((evt: "headerClick", item: ITableColumns) => void) & ((evt: "row:reorder", args: {
|
|
88
88
|
dragIndex: number;
|
|
89
89
|
dropIndex: number;
|
|
90
90
|
value: T[];
|
|
@@ -165,7 +165,7 @@ declare const _default: <T extends string | TableItem>(__VLS_props: {
|
|
|
165
165
|
empty: (props: any) => any;
|
|
166
166
|
footer: (props: any) => any;
|
|
167
167
|
};
|
|
168
|
-
emit: ((evt: "
|
|
168
|
+
emit: ((evt: "scroll:ptr") => void) & ((evt: "value", args_0: Record<string, unknown>) => void) & ((evt: "itemClick", item: T) => void) & ((evt: "paginationClick", page: number) => void) & ((evt: "selectionChanged", values: T[]) => void) & ((evt: "search:change", value: string | number | Date | null) => void) & ((evt: "headerClick", item: ITableColumns) => void) & ((evt: "row:reorder", args: {
|
|
169
169
|
dragIndex: number;
|
|
170
170
|
dropIndex: number;
|
|
171
171
|
value: T[];
|
|
@@ -249,7 +249,7 @@ declare const _default: <T extends string | TableItem>(__VLS_props: {
|
|
|
249
249
|
empty: (props: any) => any;
|
|
250
250
|
footer: (props: any) => any;
|
|
251
251
|
};
|
|
252
|
-
emit: ((evt: "
|
|
252
|
+
emit: ((evt: "scroll:ptr") => void) & ((evt: "value", args_0: Record<string, unknown>) => void) & ((evt: "itemClick", item: T) => void) & ((evt: "paginationClick", page: number) => void) & ((evt: "selectionChanged", values: T[]) => void) & ((evt: "search:change", value: string | number | Date | null) => void) & ((evt: "headerClick", item: ITableColumns) => void) & ((evt: "row:reorder", args: {
|
|
253
253
|
dragIndex: number;
|
|
254
254
|
dropIndex: number;
|
|
255
255
|
value: T[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vc-shell/framework",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.136",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/framework.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"whatwg-fetch": "^3.6.19"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@vc-shell/api-client-generator": "^1.0.
|
|
56
|
-
"@vc-shell/config-generator": "^1.0.
|
|
57
|
-
"@vc-shell/ts-config": "^1.0.
|
|
55
|
+
"@vc-shell/api-client-generator": "^1.0.136",
|
|
56
|
+
"@vc-shell/config-generator": "^1.0.136",
|
|
57
|
+
"@vc-shell/ts-config": "^1.0.136",
|
|
58
58
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
59
59
|
"sass": "^1.69.6",
|
|
60
60
|
"typescript": "5.3.3",
|
|
@@ -20,8 +20,6 @@ export default {
|
|
|
20
20
|
type: props.element.variant,
|
|
21
21
|
optionValue: props.element.optionValue,
|
|
22
22
|
optionLabel: props.element.optionLabel,
|
|
23
|
-
emitValue: props.element.emitValue,
|
|
24
|
-
emitLabel: props.element.emitLabel,
|
|
25
23
|
options: props.element.options ? props.bladeContext.scope?.[props.element.options] : undefined,
|
|
26
24
|
currentLanguage: props.currentLocale,
|
|
27
25
|
},
|
|
@@ -305,16 +305,6 @@ export interface MultivalueSchema extends SchemaBase {
|
|
|
305
305
|
* @type {string}
|
|
306
306
|
*/
|
|
307
307
|
options?: string;
|
|
308
|
-
/**
|
|
309
|
-
* Key of emmited object on select from dictionary.
|
|
310
|
-
* @default `valueId`
|
|
311
|
-
*/
|
|
312
|
-
emitValue?: string;
|
|
313
|
-
/**
|
|
314
|
-
* Key of emmited object on input.
|
|
315
|
-
* @default `value`
|
|
316
|
-
*/
|
|
317
|
-
emitLabel?: string;
|
|
318
308
|
/**
|
|
319
309
|
* Whether the select is multivalue or not.
|
|
320
310
|
* @type {boolean}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
2
|
import { VcCheckbox } from "./";
|
|
3
|
+
import { VcLabel } from "../vc-label";
|
|
3
4
|
|
|
4
5
|
const meta: Meta<typeof VcCheckbox> = {
|
|
5
6
|
title: "atoms/VcCheckbox",
|
|
@@ -11,13 +12,14 @@ type Story = StoryObj<typeof VcCheckbox>;
|
|
|
11
12
|
|
|
12
13
|
export const Primary: Story = {
|
|
13
14
|
render: (args) => ({
|
|
14
|
-
components: { VcCheckbox },
|
|
15
|
+
components: { VcCheckbox, VcLabel },
|
|
15
16
|
setup() {
|
|
16
17
|
return { args };
|
|
17
18
|
},
|
|
18
|
-
template: '<vc-checkbox v-bind="args"
|
|
19
|
+
template: '<vc-checkbox v-bind="args">Checkbox text content</vc-checkbox>',
|
|
19
20
|
}),
|
|
20
21
|
args: {
|
|
21
22
|
modelValue: true,
|
|
23
|
+
label: "Checkbox label",
|
|
22
24
|
},
|
|
23
25
|
};
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="tw-flex tw-flex-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
>*</span
|
|
8
|
-
>
|
|
9
|
-
<span
|
|
10
|
-
v-if="multilanguage"
|
|
11
|
-
class="tw-text-[color:var(--app-menu-item-icon-color)] tw-absolute tw-right-0"
|
|
12
|
-
>
|
|
13
|
-
{{ currentLanguage }}
|
|
14
|
-
</span>
|
|
15
|
-
<span
|
|
16
|
-
v-if="$slots['tooltip']"
|
|
17
|
-
class="tw-grow tw-basis-0 tw-ml-1"
|
|
18
|
-
>
|
|
19
|
-
<VcIcon
|
|
20
|
-
class="tw-text-[color:var(--label-tooltip-color)]"
|
|
21
|
-
:icon="tooltipIcon"
|
|
22
|
-
size="s"
|
|
23
|
-
@mouseenter="tooltipVisible = true"
|
|
24
|
-
@mouseleave="tooltipVisible = false"
|
|
25
|
-
></VcIcon>
|
|
2
|
+
<div class="tw-flex tw-flex-row tw-justify-between tw-items-center">
|
|
3
|
+
<div class="tw-flex-nowrap tw-font-bold tw-relative tw-truncate">
|
|
4
|
+
<span class="tw-truncate">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</span>
|
|
26
7
|
<span
|
|
27
|
-
v-if="
|
|
28
|
-
class="tw-
|
|
8
|
+
v-if="required"
|
|
9
|
+
class="tw-text-[color:var(--label-required-color)] tw-ml-1"
|
|
10
|
+
>*</span
|
|
29
11
|
>
|
|
30
|
-
|
|
12
|
+
|
|
13
|
+
<span
|
|
14
|
+
v-if="$slots['tooltip']"
|
|
15
|
+
class="tw-grow tw-basis-0 tw-ml-1"
|
|
16
|
+
>
|
|
17
|
+
<VcIcon
|
|
18
|
+
class="tw-text-[color:var(--label-tooltip-color)]"
|
|
19
|
+
:icon="tooltipIcon"
|
|
20
|
+
size="s"
|
|
21
|
+
@mouseenter="tooltipVisible = true"
|
|
22
|
+
@mouseleave="tooltipVisible = false"
|
|
23
|
+
></VcIcon>
|
|
24
|
+
<span
|
|
25
|
+
v-if="tooltipVisible"
|
|
26
|
+
class="tw-absolute tw-z-10 tw-bg-white tw-border tw-border-solid tw-border-[color:#eef0f2] tw-shadow-[1px_1px_8px_rgba(126,142,157,0.25)] tw-rounded-[3px] tw-text-[color:#8e9daa] tw-font-normal tw-py-1 tw-px-2 tw-ml-4"
|
|
27
|
+
>
|
|
28
|
+
<slot name="tooltip"></slot>
|
|
29
|
+
</span>
|
|
31
30
|
</span>
|
|
32
|
-
</
|
|
31
|
+
</div>
|
|
32
|
+
<div
|
|
33
|
+
v-if="multilanguage"
|
|
34
|
+
class="tw-text-[color:var(--app-menu-item-icon-color)] tw-shrink-0"
|
|
35
|
+
>
|
|
36
|
+
{{ currentLanguage }}
|
|
37
|
+
</div>
|
|
33
38
|
</div>
|
|
34
39
|
</template>
|
|
35
40
|
|
|
@@ -73,14 +73,11 @@ export interface Emits {
|
|
|
73
73
|
(event: "update:modelValue", value: string | number | Date | null | undefined): void;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
// const { getAccessToken } = useUser();
|
|
77
|
-
|
|
78
76
|
const props = defineProps<Props>();
|
|
79
77
|
|
|
80
78
|
const emit = defineEmits<Emits>();
|
|
81
79
|
|
|
82
80
|
defineSlots<{
|
|
83
|
-
default: (props: any) => any;
|
|
84
81
|
error?: (props: any) => any;
|
|
85
82
|
}>();
|
|
86
83
|
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
>{{ tooltip }}</template
|
|
10
10
|
></VcLabel
|
|
11
11
|
>
|
|
12
|
-
<!-- <div> -->
|
|
13
12
|
<VcFieldType
|
|
14
13
|
:value="modelValue"
|
|
15
14
|
:type="type"
|
|
@@ -24,7 +23,6 @@
|
|
|
24
23
|
></VcButton>
|
|
25
24
|
</VcFieldType>
|
|
26
25
|
</div>
|
|
27
|
-
<!-- </div> -->
|
|
28
26
|
</template>
|
|
29
27
|
|
|
30
28
|
<script lang="ts" setup>
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import _InputCurrency from "./vc-input-currency.vue";
|
|
3
|
-
|
|
4
|
-
export const VcInputCurrency = _InputCurrency as typeof _InputCurrency & {
|
|
5
|
-
new (): {
|
|
6
|
-
$slots: {
|
|
7
|
-
/**
|
|
8
|
-
* Slot for custom dropdown open handler
|
|
9
|
-
*/
|
|
10
|
-
button?: (scope: {
|
|
11
|
-
/**
|
|
12
|
-
* Dropdown open/close handler
|
|
13
|
-
*/
|
|
14
|
-
toggleHandler: () => void;
|
|
15
|
-
}) => VNode[];
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
};
|
|
1
|
+
export { default as VcInputCurrency } from "./vc-input-currency.vue";
|
|
@@ -166,6 +166,19 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
166
166
|
debounce: 0,
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
+
defineSlots<{
|
|
170
|
+
/**
|
|
171
|
+
* Slot for custom dropdown open handler
|
|
172
|
+
*/
|
|
173
|
+
button: (scope: {
|
|
174
|
+
/**
|
|
175
|
+
* Dropdown open/close handler
|
|
176
|
+
*/
|
|
177
|
+
toggleHandler: () => void;
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
+
}) => any;
|
|
180
|
+
}>();
|
|
181
|
+
|
|
169
182
|
const emit = defineEmits<Emits>();
|
|
170
183
|
|
|
171
184
|
const { inputRef, setOptions, numberValue } = useCurrencyInput(
|
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
class="vc-multivalue__field-value"
|
|
42
42
|
>
|
|
43
43
|
<span class="tw-truncate">{{
|
|
44
|
-
type === "number"
|
|
44
|
+
type === "number"
|
|
45
|
+
? Number(item[props.optionLabel as keyof T]).toFixed(3)
|
|
46
|
+
: item[props.optionLabel as keyof T]
|
|
45
47
|
}}</span>
|
|
46
48
|
<VcIcon
|
|
47
49
|
v-if="!disabled"
|
|
@@ -118,11 +120,12 @@
|
|
|
118
120
|
</div>
|
|
119
121
|
</template>
|
|
120
122
|
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
121
|
-
<script lang="ts" setup generic="T extends { id?: string
|
|
123
|
+
<script lang="ts" setup generic="T extends { id?: string }">
|
|
122
124
|
import { unref, nextTick, ref, computed } from "vue";
|
|
123
125
|
import { vOnClickOutside } from "@vueuse/components";
|
|
124
126
|
import { useFloating, UseFloatingReturn, offset, flip, shift, autoUpdate, MiddlewareState } from "@floating-ui/vue";
|
|
125
127
|
import { generateId } from "../../../../core/utilities";
|
|
128
|
+
import * as _ from "lodash-es";
|
|
126
129
|
|
|
127
130
|
export interface Props<T> {
|
|
128
131
|
placeholder?: string;
|
|
@@ -136,8 +139,6 @@ export interface Props<T> {
|
|
|
136
139
|
options?: T[];
|
|
137
140
|
optionValue?: string;
|
|
138
141
|
optionLabel?: string;
|
|
139
|
-
emitValue?: string;
|
|
140
|
-
emitLabel?: string;
|
|
141
142
|
multivalue?: boolean;
|
|
142
143
|
error?: boolean;
|
|
143
144
|
errorMessage?: string;
|
|
@@ -169,8 +170,6 @@ const props = withDefaults(defineProps<Props<T>>(), {
|
|
|
169
170
|
options: () => [],
|
|
170
171
|
optionValue: "id",
|
|
171
172
|
optionLabel: "title",
|
|
172
|
-
emitValue: "valueId",
|
|
173
|
-
emitLabel: "value",
|
|
174
173
|
});
|
|
175
174
|
|
|
176
175
|
const emit = defineEmits<Emits<T>>();
|
|
@@ -207,30 +206,24 @@ const dropdownStyle = computed(() => {
|
|
|
207
206
|
|
|
208
207
|
const slicedDictionary = computed(() => {
|
|
209
208
|
return props.options?.filter((x) => {
|
|
210
|
-
return !props.modelValue?.find((item) =>
|
|
209
|
+
return !props.modelValue?.find((item) => {
|
|
210
|
+
return item[props.optionValue as keyof T] === x[props.optionValue as keyof T];
|
|
211
|
+
});
|
|
211
212
|
});
|
|
212
213
|
});
|
|
213
214
|
|
|
214
|
-
// Handle input event to propertly validate value and emit changes
|
|
215
215
|
function onInput(e: KeyboardEvent) {
|
|
216
216
|
const newValue = (e.target as HTMLInputElement).value;
|
|
217
|
-
emit("update:model-value", [
|
|
218
|
-
...props.modelValue,
|
|
219
|
-
{ [props.emitLabel]: newValue, languageCode: props.currentLanguage } as T,
|
|
220
|
-
]);
|
|
217
|
+
emit("update:model-value", [...props.modelValue, { [props.optionLabel]: newValue } as T]);
|
|
221
218
|
value.value = undefined;
|
|
222
219
|
}
|
|
223
220
|
|
|
224
221
|
function onItemSelect(item: T) {
|
|
225
|
-
emit("update:model-value", [
|
|
226
|
-
...props.modelValue,
|
|
227
|
-
{ [props.emitValue]: item[props.optionValue as keyof T], [props.emitLabel]: item[props.optionLabel as keyof T] },
|
|
228
|
-
] as T[]);
|
|
222
|
+
emit("update:model-value", [...props.modelValue, item]);
|
|
229
223
|
emit("close");
|
|
230
224
|
closeDropdown();
|
|
231
225
|
}
|
|
232
226
|
|
|
233
|
-
// Handle event to propertly remove particular value and emit changes
|
|
234
227
|
function onDelete(i: number) {
|
|
235
228
|
const result = unref(props.modelValue);
|
|
236
229
|
result.splice(i, 1);
|