@vc-shell/framework 1.0.39 → 1.0.40
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/core/composables/usePermissions/index.ts +1 -1
- package/core/composables/useSettings/index.ts +31 -5
- package/core/types/index.ts +12 -12
- package/dist/core/composables/useSettings/index.d.ts +10 -1
- package/dist/core/composables/useSettings/index.d.ts.map +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +69 -69
- package/dist/framework.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/shared/blade-navigation/types/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-badge/index.d.ts +5 -0
- package/dist/ui/components/atoms/vc-badge/index.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts +28 -0
- package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-badge/vc-badge.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-button/index.d.ts +5 -0
- package/dist/ui/components/atoms/vc-button/index.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts +28 -0
- package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-button/vc-button.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-container/vc-container.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-container/vc-container.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-hint/vc-hint.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-icon/vc-icon.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-image/vc-image.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-label/vc-label.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-link/vc-link.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-progress/vc-progress.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-status/vc-status.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/atoms/vc-switch/vc-switch.stories.d.ts +0 -0
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/index.d.ts +4 -3
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts +0 -0
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/molecules/vc-form/vc-form.stories.d.ts +0 -0
- package/dist/ui/components/molecules/vc-form/vc-form.stories.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-input/index.d.ts +5 -0
- package/dist/ui/components/molecules/vc-input/index.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts +140 -0
- package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-input-currency/index.d.ts +5 -0
- package/dist/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts +124 -0
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts.map +1 -0
- package/dist/{components → ui/components}/molecules/vc-pagination/vc-pagination.stories.d.ts +0 -0
- package/dist/ui/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/molecules/vc-rating/vc-rating.stories.d.ts +0 -0
- package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-select/index.d.ts +5 -0
- package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts +207 -0
- package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts.map +1 -0
- package/dist/{components → ui/components}/molecules/vc-textarea/vc-textarea.stories.d.ts +0 -0
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/organisms/vc-app/vc-app.stories.d.ts +0 -0
- package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/organisms/vc-blade/vc-blade.stories.d.ts +0 -0
- package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/organisms/vc-login-form/vc-login-form.stories.d.ts +0 -0
- package/dist/ui/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/organisms/vc-popup/vc-popup.stories.d.ts +0 -0
- package/dist/ui/components/organisms/vc-popup/vc-popup.stories.d.ts.map +1 -0
- package/dist/{components → ui/components}/organisms/vc-table/vc-table.stories.d.ts +0 -0
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -0
- package/dist/ui/types/index.d.ts +13 -0
- package/dist/ui/types/index.d.ts.map +1 -0
- package/dist/ui/types/ts-helpers.d.ts +13 -0
- package/dist/ui/types/ts-helpers.d.ts.map +1 -0
- package/dist/vite.config.d.ts.map +1 -1
- package/package.json +27 -10
- package/shared/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +9 -9
- package/shared/assets/components/assets-details/assets-details.vue +12 -12
- package/shared/blade-navigation/composables/useBladeNavigation/index.ts +4 -4
- package/shared/blade-navigation/types/index.ts +25 -25
- package/tailwind.config.js +4 -3
- package/ui/components/atoms/vc-badge/index.ts +7 -0
- package/ui/components/atoms/vc-badge/vc-badge-model.ts +30 -0
- package/{components → ui/components}/atoms/vc-badge/vc-badge.stories.ts +0 -0
- package/ui/components/atoms/vc-badge/vc-badge.vue +57 -0
- package/ui/components/atoms/vc-button/index.ts +7 -0
- package/ui/components/atoms/vc-button/vc-button-model.ts +30 -0
- package/{components → ui/components}/atoms/vc-button/vc-button.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-button/vc-button.vue +54 -54
- package/{components → ui/components}/atoms/vc-card/vc-card.vue +15 -15
- package/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.vue +21 -21
- package/{components → ui/components}/atoms/vc-col/vc-col.vue +2 -2
- package/{components → ui/components}/atoms/vc-container/vc-container.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-container/vc-container.vue +21 -19
- package/{components → ui/components}/atoms/vc-hint/vc-hint.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-hint/vc-hint.vue +1 -1
- package/{components → ui/components}/atoms/vc-icon/vc-icon.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-icon/vc-icon.vue +1 -1
- package/{components → ui/components}/atoms/vc-image/vc-image.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-image/vc-image.vue +9 -9
- package/{components → ui/components}/atoms/vc-info-row/vc-info-row.vue +3 -3
- package/{components → ui/components}/atoms/vc-label/vc-label.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-label/vc-label.vue +6 -6
- package/{components → ui/components}/atoms/vc-link/vc-link.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-link/vc-link.vue +3 -3
- package/ui/components/atoms/vc-loading/vc-loading.vue +33 -0
- package/{components → ui/components}/atoms/vc-progress/vc-progress.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-progress/vc-progress.vue +2 -2
- package/{components → ui/components}/atoms/vc-row/vc-row.vue +1 -1
- package/{components → ui/components}/atoms/vc-status/vc-status.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-status/vc-status.vue +4 -4
- package/{components → ui/components}/atoms/vc-status-icon/vc-status-icon.vue +3 -3
- package/{components → ui/components}/atoms/vc-switch/vc-switch.stories.ts +0 -0
- package/{components → ui/components}/atoms/vc-switch/vc-switch.vue +10 -10
- package/{components → ui/components}/atoms/vc-widget/vc-widget.vue +12 -12
- package/{components → ui/components}/index.ts +4 -3
- package/{components → ui/components}/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +17 -17
- package/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +0 -0
- package/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +1 -1
- package/{components/molecules/vc-input → ui/components/molecules/vc-currency-input}/vc-input.vue +30 -37
- package/{components → ui/components}/molecules/vc-editor/vc-editor.vue +4 -4
- package/{components → ui/components}/molecules/vc-file-upload/vc-file-upload.vue +6 -6
- package/{components → ui/components}/molecules/vc-form/vc-form.stories.ts +0 -0
- package/{components → ui/components}/molecules/vc-form/vc-form.vue +0 -0
- package/ui/components/molecules/vc-input/index.ts +8 -0
- package/ui/components/molecules/vc-input/vc-input-model.ts +150 -0
- package/ui/components/molecules/vc-input/vc-input.vue +324 -0
- package/ui/components/molecules/vc-input-currency/index.ts +8 -0
- package/ui/components/molecules/vc-input-currency/vc-input-currency-model.ts +128 -0
- package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +86 -0
- package/{components → ui/components}/molecules/vc-multivalue/vc-multivalue.vue +41 -41
- package/{components → ui/components}/molecules/vc-notification/vc-notification.vue +5 -5
- package/{components → ui/components}/molecules/vc-pagination/vc-pagination.stories.ts +0 -0
- package/{components → ui/components}/molecules/vc-pagination/vc-pagination.vue +24 -24
- package/{components → ui/components}/molecules/vc-rating/vc-rating.stories.ts +0 -0
- package/{components → ui/components}/molecules/vc-rating/vc-rating.vue +6 -6
- package/ui/components/molecules/vc-select/index.ts +7 -0
- package/ui/components/molecules/vc-select/vc-select-model.ts +216 -0
- package/ui/components/molecules/vc-select/vc-select.vue +727 -0
- package/{components → ui/components}/molecules/vc-slider/vc-slider.vue +12 -12
- package/{components → ui/components}/molecules/vc-textarea/vc-textarea.stories.ts +0 -0
- package/{components → ui/components}/molecules/vc-textarea/vc-textarea.vue +17 -17
- package/{components → ui/components}/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +20 -16
- package/{components → ui/components}/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +31 -31
- package/{components → ui/components}/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +9 -9
- package/{components → ui/components}/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +11 -11
- package/{components → ui/components}/organisms/vc-app/vc-app.stories.ts +0 -0
- package/{components → ui/components}/organisms/vc-app/vc-app.vue +9 -11
- package/{components → ui/components}/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +10 -10
- package/{components → ui/components}/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +17 -17
- package/{components → ui/components}/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +4 -4
- package/{components → ui/components}/organisms/vc-blade/vc-blade.stories.ts +0 -0
- package/{components → ui/components}/organisms/vc-blade/vc-blade.vue +5 -5
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +426 -0
- package/{components → ui/components}/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +12 -12
- package/{components → ui/components}/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +9 -9
- package/{components → ui/components}/organisms/vc-gallery/vc-gallery.vue +6 -6
- package/{components → ui/components}/organisms/vc-login-form/vc-login-form.stories.ts +6 -6
- package/{components → ui/components}/organisms/vc-login-form/vc-login-form.vue +5 -5
- package/{components → ui/components}/organisms/vc-popup/vc-popup.stories.ts +0 -0
- package/{components → ui/components}/organisms/vc-popup/vc-popup.vue +13 -13
- package/{components → ui/components}/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +6 -6
- package/{components → ui/components}/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue +3 -3
- package/{components → ui/components}/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +13 -13
- package/{components → ui/components}/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +23 -23
- package/{components → ui/components}/organisms/vc-table/vc-table.stories.ts +3 -3
- package/{components → ui/components}/organisms/vc-table/vc-table.vue +42 -42
- package/ui/types/index.ts +38 -0
- package/ui/types/ts-helpers.ts +46 -0
- package/components/atoms/vc-badge/vc-badge.vue +0 -63
- package/components/atoms/vc-loading/vc-loading.vue +0 -30
- package/components/molecules/vc-input/vc-input.stories.ts +0 -26
- package/components/molecules/vc-select/vc-select.stories.ts +0 -25
- package/components/molecules/vc-select/vc-select.vue +0 -402
- package/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +0 -292
- package/dist/components/atoms/vc-badge/vc-badge.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-button/vc-button.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-container/vc-container.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-hint/vc-hint.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-icon/vc-icon.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-image/vc-image.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-label/vc-label.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-link/vc-link.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-progress/vc-progress.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-status/vc-status.stories.d.ts.map +0 -1
- package/dist/components/atoms/vc-switch/vc-switch.stories.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +0 -1
- package/dist/components/molecules/vc-form/vc-form.stories.d.ts.map +0 -1
- package/dist/components/molecules/vc-input/vc-input.stories.d.ts +0 -7
- package/dist/components/molecules/vc-input/vc-input.stories.d.ts.map +0 -1
- package/dist/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +0 -1
- package/dist/components/molecules/vc-rating/vc-rating.stories.d.ts.map +0 -1
- package/dist/components/molecules/vc-select/vc-select.stories.d.ts +0 -7
- package/dist/components/molecules/vc-select/vc-select.stories.d.ts.map +0 -1
- package/dist/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +0 -1
- package/dist/components/organisms/vc-app/vc-app.stories.d.ts.map +0 -1
- package/dist/components/organisms/vc-blade/vc-blade.stories.d.ts.map +0 -1
- package/dist/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +0 -1
- package/dist/components/organisms/vc-popup/vc-popup.stories.d.ts.map +0 -1
- package/dist/components/organisms/vc-table/vc-table.stories.d.ts.map +0 -1
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="vc-select box-border"
|
|
4
|
-
:class="{
|
|
5
|
-
'vc-select_opened': isOpened,
|
|
6
|
-
'vc-select_error': errorMessage,
|
|
7
|
-
'vc-select_disabled': isDisabled,
|
|
8
|
-
}"
|
|
9
|
-
>
|
|
10
|
-
<!-- Select label -->
|
|
11
|
-
<VcLabel v-if="label" class="mb-2" :required="isRequired">
|
|
12
|
-
<span>{{ label }}</span>
|
|
13
|
-
<template v-if="tooltip" v-slot:tooltip>
|
|
14
|
-
<span v-html="tooltip"></span>
|
|
15
|
-
</template>
|
|
16
|
-
</VcLabel>
|
|
17
|
-
|
|
18
|
-
<!-- Select field -->
|
|
19
|
-
<div
|
|
20
|
-
class="vc-select__field-wrapper relative box-border border border-solid border-[color:var(--select-border-color)] rounded-[var(--select-border-radius)] bg-[color:var(--select-background-color)] flex items-stretch"
|
|
21
|
-
ref="inputFieldWrapRef"
|
|
22
|
-
>
|
|
23
|
-
<div
|
|
24
|
-
class="w-full appearance-none border-none outline-none min-h-[var(--select-height)] px-3 flex items-center w-full box-border box-border cursor-pointer invalid:text-[color:var(--select-placeholder-color)] overflow-hidden"
|
|
25
|
-
@click.stop="toggleDropdown"
|
|
26
|
-
ref="dropdownToggleRef"
|
|
27
|
-
>
|
|
28
|
-
<div v-if="!selectedItem" class="text-[#a5a5a5]">
|
|
29
|
-
{{ placeholder }}
|
|
30
|
-
</div>
|
|
31
|
-
<slot
|
|
32
|
-
v-else-if="$slots['selectedItem']"
|
|
33
|
-
name="selectedItem"
|
|
34
|
-
:item="selectedItem"
|
|
35
|
-
></slot>
|
|
36
|
-
<slot v-else name="item" :item="selectedItem">
|
|
37
|
-
{{ selectedItem[displayProperty] }}
|
|
38
|
-
</slot>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<!-- Select chevron -->
|
|
42
|
-
<div
|
|
43
|
-
v-if="!isDisabled"
|
|
44
|
-
class="vc-select__chevron absolute right-0 top-0 h-full cursor-pointer px-3 flex items-center text-[color:var(--select-chevron-color)] hover:text-[color:var(--select-chevron-color-hover)]"
|
|
45
|
-
@click.stop="toggleDropdown"
|
|
46
|
-
>
|
|
47
|
-
<VcIcon size="s" icon="fas fa-chevron-down"></VcIcon>
|
|
48
|
-
</div>
|
|
49
|
-
<teleport to="#app">
|
|
50
|
-
<div
|
|
51
|
-
v-if="isOpened"
|
|
52
|
-
class="flex flex-col box-border max-h-[300px] z-10 overflow-hidden absolute bg-[color:var(--select-background-color)] border border-solid border-[color:var(--select-border-color)] border-t-[color:var(--select-background-color)] rounded-b-[var(--select-border-radius)] p-2"
|
|
53
|
-
ref="dropdownRef"
|
|
54
|
-
v-click-outside="closeDropdown"
|
|
55
|
-
>
|
|
56
|
-
<input
|
|
57
|
-
v-if="isSearchable"
|
|
58
|
-
ref="search"
|
|
59
|
-
class="w-full box-border border border-solid border-[#eaecf2] rounded-[4px] h-[32px] leading-[32px] outline-none mb-3 px-2"
|
|
60
|
-
@input="onSearch"
|
|
61
|
-
/>
|
|
62
|
-
|
|
63
|
-
<VcContainer :no-padding="true">
|
|
64
|
-
<div
|
|
65
|
-
class="flex items-center min-h-[36px] px-2 rounded-[3px] cursor-pointer hover:bg-[#eff7fc]"
|
|
66
|
-
v-for="(item, i) in options"
|
|
67
|
-
:key="i"
|
|
68
|
-
@click="onItemSelect(item)"
|
|
69
|
-
>
|
|
70
|
-
<slot name="item" :item="item">{{ item[displayProperty] }}</slot>
|
|
71
|
-
</div>
|
|
72
|
-
<div v-show="hasNextPage" ref="load" class="text-center">
|
|
73
|
-
Loading...
|
|
74
|
-
</div>
|
|
75
|
-
</VcContainer>
|
|
76
|
-
</div>
|
|
77
|
-
</teleport>
|
|
78
|
-
|
|
79
|
-
<!-- Input clear button -->
|
|
80
|
-
<div
|
|
81
|
-
v-if="clearable && modelValue && !isDisabled"
|
|
82
|
-
class="vc-select__clear"
|
|
83
|
-
@click="onReset"
|
|
84
|
-
>
|
|
85
|
-
<VcIcon size="s" icon="fas fa-times"></VcIcon>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<slot v-if="errorMessage" name="error">
|
|
90
|
-
<VcHint class="text-[color:var(--select-border-color-error)] mt-1">
|
|
91
|
-
{{ errorMessage }}
|
|
92
|
-
</VcHint>
|
|
93
|
-
</slot>
|
|
94
|
-
</div>
|
|
95
|
-
</template>
|
|
96
|
-
|
|
97
|
-
<script lang="ts" setup>
|
|
98
|
-
import { nextTick, ref, computed, watch, getCurrentInstance } from "vue";
|
|
99
|
-
import { VcIcon, VcLabel, VcContainer } from "@/components";
|
|
100
|
-
import { createPopper, Instance, State } from "@popperjs/core";
|
|
101
|
-
import { clickOutside as vClickOutside } from "@/core/directives";
|
|
102
|
-
|
|
103
|
-
const props = defineProps({
|
|
104
|
-
modelValue: {
|
|
105
|
-
type: [String, Number],
|
|
106
|
-
default: undefined,
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
placeholder: {
|
|
110
|
-
type: String,
|
|
111
|
-
default: "Click to select...",
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
options: {
|
|
115
|
-
type: Array,
|
|
116
|
-
default: () => [],
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
isRequired: {
|
|
120
|
-
type: Boolean,
|
|
121
|
-
default: false,
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
isDisabled: {
|
|
125
|
-
type: Boolean,
|
|
126
|
-
default: false,
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
isSearchable: {
|
|
130
|
-
type: Boolean,
|
|
131
|
-
default: false,
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
label: {
|
|
135
|
-
type: String,
|
|
136
|
-
default: undefined,
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
tooltip: {
|
|
140
|
-
type: String,
|
|
141
|
-
default: undefined,
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
keyProperty: {
|
|
145
|
-
type: String,
|
|
146
|
-
default: "id",
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
displayProperty: {
|
|
150
|
-
type: String,
|
|
151
|
-
default: "title",
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
initialItem: {
|
|
155
|
-
type: Object,
|
|
156
|
-
default: undefined,
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
name: {
|
|
160
|
-
type: String,
|
|
161
|
-
default: "Field",
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
clearable: {
|
|
165
|
-
type: Boolean,
|
|
166
|
-
default: true,
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
optionsTotal: {
|
|
170
|
-
type: Number,
|
|
171
|
-
default: 0,
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
onInfiniteScroll: {
|
|
175
|
-
type: Function,
|
|
176
|
-
default: undefined,
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
errorMessage: {
|
|
180
|
-
type: String,
|
|
181
|
-
default: undefined
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
const emit = defineEmits(["update:modelValue", "change", "close", "search"]);
|
|
186
|
-
|
|
187
|
-
const instance = getCurrentInstance();
|
|
188
|
-
const isOpened = ref(false);
|
|
189
|
-
const search = ref();
|
|
190
|
-
const popper = ref<Instance>();
|
|
191
|
-
const dropdownToggleRef = ref();
|
|
192
|
-
const dropdownRef = ref();
|
|
193
|
-
const inputFieldWrapRef = ref();
|
|
194
|
-
const load = ref();
|
|
195
|
-
const observer = new IntersectionObserver(infiniteScroll);
|
|
196
|
-
|
|
197
|
-
const selectedItem = computed(
|
|
198
|
-
() =>
|
|
199
|
-
(props.options as Record<string, unknown>[])?.find(
|
|
200
|
-
(item) => item[props.keyProperty] === props.modelValue
|
|
201
|
-
) || props.initialItem
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
const hasNextPage = computed(() => {
|
|
205
|
-
return props.options.length < props.optionsTotal;
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
watch(
|
|
209
|
-
() => props.modelValue,
|
|
210
|
-
(value) => {
|
|
211
|
-
emit("update:modelValue", value);
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
function closeDropdown() {
|
|
216
|
-
observer.disconnect();
|
|
217
|
-
isOpened.value = false;
|
|
218
|
-
popper.value?.destroy();
|
|
219
|
-
inputFieldWrapRef.value.style.borderRadius = "var(--select-border-radius)";
|
|
220
|
-
emit("close");
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
async function toggleDropdown() {
|
|
224
|
-
if (!props.isDisabled) {
|
|
225
|
-
if (isOpened.value) {
|
|
226
|
-
closeDropdown();
|
|
227
|
-
} else {
|
|
228
|
-
isOpened.value = true;
|
|
229
|
-
if (hasNextPage.value) {
|
|
230
|
-
await nextTick();
|
|
231
|
-
observer.observe(load.value);
|
|
232
|
-
}
|
|
233
|
-
await nextTick(() => {
|
|
234
|
-
search?.value?.focus();
|
|
235
|
-
popper.value = createPopper(
|
|
236
|
-
dropdownToggleRef.value,
|
|
237
|
-
dropdownRef.value,
|
|
238
|
-
{
|
|
239
|
-
placement: "bottom",
|
|
240
|
-
modifiers: [
|
|
241
|
-
{
|
|
242
|
-
name: "flip",
|
|
243
|
-
options: {
|
|
244
|
-
fallbackPlacements: ["top", "bottom"],
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: "preventOverflow",
|
|
249
|
-
options: {
|
|
250
|
-
mainAxis: false,
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
name: "sameWidthChangeBorders",
|
|
255
|
-
enabled: true,
|
|
256
|
-
phase: "beforeWrite",
|
|
257
|
-
requires: ["computeStyles"],
|
|
258
|
-
fn: ({ state }: { state: State }) => {
|
|
259
|
-
const placement = state.placement;
|
|
260
|
-
if (placement === "top") {
|
|
261
|
-
state.styles.popper.borderTop =
|
|
262
|
-
"1px solid var(--select-border-color)";
|
|
263
|
-
state.styles.popper.borderBottom =
|
|
264
|
-
"1px solid var(--select-background-color)";
|
|
265
|
-
state.styles.popper.borderRadius =
|
|
266
|
-
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
267
|
-
inputFieldWrapRef.value.style.borderRadius =
|
|
268
|
-
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
269
|
-
} else {
|
|
270
|
-
state.styles.popper.borderBottom =
|
|
271
|
-
"1px solid var(--select-border-color)";
|
|
272
|
-
state.styles.popper.borderTop =
|
|
273
|
-
"1px solid var(--select-background-color)";
|
|
274
|
-
state.styles.popper.borderRadius =
|
|
275
|
-
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
276
|
-
|
|
277
|
-
if (inputFieldWrapRef.value) {
|
|
278
|
-
inputFieldWrapRef.value.style.borderRadius =
|
|
279
|
-
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
state.styles.popper.width = `${
|
|
283
|
-
state.rects.reference.width + 2
|
|
284
|
-
}px`;
|
|
285
|
-
},
|
|
286
|
-
effect: ({ state }: { state: State }) => {
|
|
287
|
-
const ref = state.elements.reference as HTMLElement;
|
|
288
|
-
const placement = state.placement;
|
|
289
|
-
if (placement === "top") {
|
|
290
|
-
state.elements.popper.style.borderTop =
|
|
291
|
-
"1px solid var(--select-border-color)";
|
|
292
|
-
state.elements.popper.style.borderBottom =
|
|
293
|
-
"1px solid var(--select-background-color)";
|
|
294
|
-
state.elements.popper.style.borderRadius =
|
|
295
|
-
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
296
|
-
inputFieldWrapRef.value.style.borderRadius =
|
|
297
|
-
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
298
|
-
} else {
|
|
299
|
-
state.elements.popper.style.borderBottom =
|
|
300
|
-
"1px solid var(--select-border-color)";
|
|
301
|
-
state.elements.popper.style.borderTop =
|
|
302
|
-
"1px solid var(--select-background-color)";
|
|
303
|
-
state.elements.popper.style.borderRadius =
|
|
304
|
-
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
305
|
-
|
|
306
|
-
if (inputFieldWrapRef.value) {
|
|
307
|
-
inputFieldWrapRef.value.style.borderRadius =
|
|
308
|
-
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
state.elements.popper.style.width = `${
|
|
312
|
-
ref.offsetWidth + 2
|
|
313
|
-
}px`;
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
name: "offset",
|
|
318
|
-
options: {
|
|
319
|
-
offset: [0, 0],
|
|
320
|
-
},
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function onItemSelect(item: { [x: string]: string }) {
|
|
331
|
-
emit("update:modelValue", item[props.keyProperty]);
|
|
332
|
-
emit("change", item[props.keyProperty]);
|
|
333
|
-
emit("close");
|
|
334
|
-
isOpened.value = false;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function onSearch(event: InputEvent) {
|
|
338
|
-
emit("search", (event.target as HTMLInputElement).value);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// Handle input event to propertly reset value and emit changes
|
|
342
|
-
function onReset() {
|
|
343
|
-
emit("update:modelValue", "");
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
async function infiniteScroll([
|
|
347
|
-
{ isIntersecting, target },
|
|
348
|
-
]: IntersectionObserverEntry[]) {
|
|
349
|
-
if (
|
|
350
|
-
isIntersecting &&
|
|
351
|
-
props.onInfiniteScroll &&
|
|
352
|
-
typeof props.onInfiniteScroll === "function"
|
|
353
|
-
) {
|
|
354
|
-
const ul = (target as HTMLElement).offsetParent as Element;
|
|
355
|
-
const scrollTop = (target as HTMLElement).offsetParent?.scrollTop;
|
|
356
|
-
await props.onInfiniteScroll();
|
|
357
|
-
await nextTick();
|
|
358
|
-
ul.scrollTop = scrollTop as number;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
</script>
|
|
362
|
-
|
|
363
|
-
<style lang="scss">
|
|
364
|
-
:root {
|
|
365
|
-
--select-height: 38px;
|
|
366
|
-
--select-border-radius: 3px;
|
|
367
|
-
--select-border-color: #d3dbe9;
|
|
368
|
-
--select-border-color-error: #f14e4e;
|
|
369
|
-
--select-background-color: #ffffff;
|
|
370
|
-
--select-background-color-disabled: #fafafa;
|
|
371
|
-
--select-placeholder-color: #a5a5a5;
|
|
372
|
-
--select-chevron-color: #43b0e6;
|
|
373
|
-
--select-chevron-color-hover: #319ed4;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
.vc-select {
|
|
377
|
-
&_disabled &__field-wrapper,
|
|
378
|
-
&_disabled &__field {
|
|
379
|
-
@apply bg-[color:var(--select-background-color-disabled)] text-[#424242];
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
&_error &__field-wrapper {
|
|
383
|
-
@apply border border-solid border-[color:var(--select-border-color-error)];
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
&_disabled &__field {
|
|
387
|
-
@apply cursor-auto;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
&_opened &__chevron {
|
|
391
|
-
@apply rotate-180;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
&_opened &__field-wrapper {
|
|
395
|
-
@apply rounded-t-[var(--select-border-radius)];
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
&__clear {
|
|
399
|
-
@apply cursor-pointer text-[color:var(--input-clear-color)] hover:text-[color:var(--input-clear-color-hover)] pr-10 pl-3 flex items-center;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
</style>
|
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Field v-if="(property.dictionary || property.isDictionary) && !property.multivalue" v-slot="{field, errorMessage, handleChange}" :name="property.displayName || property.name" :modelValue="getter(property, true)" :rules="rules">
|
|
3
|
-
<VcSelect
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
:error-message="errorMessage"
|
|
6
|
-
:label="handleDisplayName || property.displayName"
|
|
7
|
-
:modelValue="getter(property, true)"
|
|
8
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e, items)}"
|
|
9
|
-
:isRequired="property.required || property.isRequired"
|
|
10
|
-
:placeholder="handleDisplayName || property.defaultValue"
|
|
11
|
-
:options="items"
|
|
12
|
-
keyProperty="id"
|
|
13
|
-
:displayProperty="handleDisplayProperty"
|
|
14
|
-
:is-disabled="disabled"
|
|
15
|
-
:isSearchable="true"
|
|
16
|
-
@search="onSearch"
|
|
17
|
-
@close="onClose"
|
|
18
|
-
></VcSelect>
|
|
19
|
-
</Field>
|
|
20
|
-
|
|
21
|
-
<Field v-else-if="property.valueType === 'ShortText' && property.multivalue && !(property.dictionary || property.isDictionary)" v-slot="{field, errorMessage, handleChange}" :name="property.name" :modelValue="property.values" :rules="rules">
|
|
22
|
-
<VcMultivalue
|
|
23
|
-
v-bind="$attrs"
|
|
24
|
-
:error-message="errorMessage"
|
|
25
|
-
:label="handleDisplayName"
|
|
26
|
-
:modelValue="property.values"
|
|
27
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
28
|
-
:required="property.required || property.isRequired"
|
|
29
|
-
placeholder="Add value"
|
|
30
|
-
:disabled="disabled"
|
|
31
|
-
></VcMultivalue>
|
|
32
|
-
</Field>
|
|
33
|
-
|
|
34
|
-
<Field v-else-if="property.valueType === 'ShortText' && property.multivalue && (property.dictionary || property.isDictionary)" v-slot="{field, errorMessage, handleChange}" :name="property.name" :modelValue="property.values" :rules="rules">
|
|
35
|
-
<VcMultivalue
|
|
36
|
-
v-bind="$attrs"
|
|
37
|
-
:error-message="errorMessage"
|
|
38
|
-
:label="handleDisplayName"
|
|
39
|
-
:modelValue="property.values"
|
|
40
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e, items)}"
|
|
41
|
-
:required="property.required || property.isRequired"
|
|
42
|
-
placeholder="Add value"
|
|
43
|
-
:multivalue="property.multivalue"
|
|
44
|
-
:disabled="disabled"
|
|
45
|
-
:options="items"
|
|
46
|
-
keyProperty="id"
|
|
47
|
-
displayProperty="alias"
|
|
48
|
-
@search="onSearch"
|
|
49
|
-
@close="onClose"
|
|
50
|
-
></VcMultivalue>
|
|
51
|
-
</Field>
|
|
52
|
-
|
|
53
|
-
<Field v-else-if="property.valueType === 'ShortText'" v-slot="{field, errorMessage, handleChange}" :name="property.displayName || property.name" :modelValue="getter(property)" :rules="rules">
|
|
54
|
-
<VcInput
|
|
55
|
-
v-bind="$attrs"
|
|
56
|
-
:error-message="errorMessage"
|
|
57
|
-
:label="handleDisplayName || property.displayName"
|
|
58
|
-
:modelValue="getter(property)"
|
|
59
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
60
|
-
:clearable="true"
|
|
61
|
-
:isRequired="property.required || property.isRequired"
|
|
62
|
-
:placeholder="handleDisplayName || 'Add value'"
|
|
63
|
-
:disabled="disabled"
|
|
64
|
-
></VcInput>
|
|
65
|
-
</Field>
|
|
66
|
-
|
|
67
|
-
<Field v-else-if="property.valueType === 'Number' && property.multivalue" v-slot="{field, errorMessage, handleChange}" :name="property.name" :modelValue="property.values" :rules="rules">
|
|
68
|
-
<VcMultivalue
|
|
69
|
-
v-bind="$attrs"
|
|
70
|
-
:error-message="errorMessage"
|
|
71
|
-
:label="handleDisplayName"
|
|
72
|
-
:modelValue="property.values"
|
|
73
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
74
|
-
type="number"
|
|
75
|
-
:required="property.required || property.isRequired"
|
|
76
|
-
placeholder="Add value"
|
|
77
|
-
:disabled="disabled"
|
|
78
|
-
></VcMultivalue>
|
|
79
|
-
</Field>
|
|
80
|
-
|
|
81
|
-
<Field v-else-if="property.valueType === 'Number'" v-slot="{field, errorMessage, handleChange}" :name="property.name" :modelValue="getter(property)" :rules="rules">
|
|
82
|
-
<VcInput
|
|
83
|
-
v-bind="$attrs"
|
|
84
|
-
:error-message="errorMessage"
|
|
85
|
-
:label="handleDisplayName"
|
|
86
|
-
:modelValue="getter(property)"
|
|
87
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
88
|
-
:clearable="true"
|
|
89
|
-
type="number"
|
|
90
|
-
:isRequired="property.required || property.isRequired"
|
|
91
|
-
:placeholder="handleDisplayName || property.defaultValue"
|
|
92
|
-
:disabled="disabled"
|
|
93
|
-
></VcInput>
|
|
94
|
-
</Field>
|
|
95
|
-
|
|
96
|
-
<Field v-else-if="property.valueType === 'Integer'" v-slot="{field, errorMessage, handleChange}" :name="property.name" :modelValue="getter(property)" :rules="rules">
|
|
97
|
-
<VcInput
|
|
98
|
-
v-bind="$attrs"
|
|
99
|
-
:error-message="errorMessage"
|
|
100
|
-
:label="handleDisplayName"
|
|
101
|
-
:modelValue="getter(property)"
|
|
102
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
103
|
-
:clearable="true"
|
|
104
|
-
type="number"
|
|
105
|
-
step="1"
|
|
106
|
-
:isRequired="property.required || property.isRequired"
|
|
107
|
-
:placeholder="handleDisplayName || property.defaultValue"
|
|
108
|
-
:disabled="disabled"
|
|
109
|
-
></VcInput>
|
|
110
|
-
</Field>
|
|
111
|
-
|
|
112
|
-
<Field v-else-if="property.valueType === 'DateTime'" v-slot="{field, errorMessage, handleChange}" :name="property.name" :modelValue="getter(property)" :rules="rules">
|
|
113
|
-
<VcInput
|
|
114
|
-
v-bind="$attrs"
|
|
115
|
-
:error-message="errorMessage"
|
|
116
|
-
:label="handleDisplayName"
|
|
117
|
-
:modelValue="getter(property)"
|
|
118
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
119
|
-
type="datetime-local"
|
|
120
|
-
:isRequired="property.required || property.isRequired"
|
|
121
|
-
:placeholder="handleDisplayName || property.defaultValue"
|
|
122
|
-
:disabled="disabled"
|
|
123
|
-
></VcInput>
|
|
124
|
-
</Field>
|
|
125
|
-
|
|
126
|
-
<Field v-else-if="property.valueType === 'LongText'" v-slot="{field, errorMessage, handleChange}" :name="property.name" :modelValue="getter(property)" :rules="rules">
|
|
127
|
-
<VcTextarea
|
|
128
|
-
v-bind="$attrs"
|
|
129
|
-
:error-message="errorMessage"
|
|
130
|
-
:label="handleDisplayName"
|
|
131
|
-
:modelValue="getter(property)"
|
|
132
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
133
|
-
:isRequired="property.required || property.isRequired"
|
|
134
|
-
:placeholder="handleDisplayName || property.defaultValue"
|
|
135
|
-
:disabled="disabled"
|
|
136
|
-
></VcTextarea>
|
|
137
|
-
</Field>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<Field v-else-if="property.valueType === 'Boolean'" v-slot="{field, errorMessage, handleChange}" :name="property.displayName || property.name" :modelValue="getter(property)" :rules="rules">
|
|
141
|
-
<VcCheckbox
|
|
142
|
-
v-bind="$attrs"
|
|
143
|
-
:error-message="errorMessage"
|
|
144
|
-
:modelValue="getter(property)"
|
|
145
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
146
|
-
:required="property.required || property.isRequired"
|
|
147
|
-
:disabled="disabled"
|
|
148
|
-
:name="property.displayName || property.name"
|
|
149
|
-
>
|
|
150
|
-
{{ handleDisplayName || property.displayName }}
|
|
151
|
-
</VcCheckbox>
|
|
152
|
-
|
|
153
|
-
</Field>
|
|
154
|
-
|
|
155
|
-
<Field v-else-if="property.valueType === 'Html'" v-slot="{field, errorMessage, handleChange}" :name="property.displayName || property.name" :modelValue="getter(property)" :rules="rules">
|
|
156
|
-
<VcEditor
|
|
157
|
-
v-bind="$attrs"
|
|
158
|
-
:label="handleDisplayName || property.displayName"
|
|
159
|
-
:modelValue="getter(property)"
|
|
160
|
-
@update:modelValue="(e) => {handleChange(e); setter(property, e)}"
|
|
161
|
-
:required="property.required || property.isRequired"
|
|
162
|
-
:placeholder="handleDisplayName || 'Add value'"
|
|
163
|
-
:disabled="disabled"
|
|
164
|
-
:name="property.displayName || property.name"
|
|
165
|
-
:error-message="errorMessage"
|
|
166
|
-
>
|
|
167
|
-
</VcEditor>
|
|
168
|
-
</Field>
|
|
169
|
-
</template>
|
|
170
|
-
|
|
171
|
-
<script lang="ts" setup>
|
|
172
|
-
import { ref, onMounted, computed } from "vue";
|
|
173
|
-
import { useI18n } from "@/core/composables";
|
|
174
|
-
import {Field} from 'vee-validate'
|
|
175
|
-
|
|
176
|
-
interface IValidationRules {
|
|
177
|
-
required?: boolean;
|
|
178
|
-
min?: number;
|
|
179
|
-
max?: number;
|
|
180
|
-
regex?: RegExp;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
interface IDisplayName {
|
|
184
|
-
languageCode: string;
|
|
185
|
-
name?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const props = defineProps({
|
|
189
|
-
property: {
|
|
190
|
-
type: Object,
|
|
191
|
-
default: () => ({}),
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
dictionaries: {
|
|
195
|
-
type: Object,
|
|
196
|
-
default: () => ({}),
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
getter: {
|
|
200
|
-
type: Function,
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
optionsGetter: {
|
|
204
|
-
type: Function,
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
setter: {
|
|
208
|
-
type: Function,
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
culture: {
|
|
212
|
-
type: String,
|
|
213
|
-
default: "en-US",
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
disabled: {
|
|
217
|
-
type: Boolean,
|
|
218
|
-
default: false,
|
|
219
|
-
},
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
const { locale, te, t } = useI18n();
|
|
223
|
-
|
|
224
|
-
const rules: IValidationRules = {};
|
|
225
|
-
const items = ref([]);
|
|
226
|
-
const handleDisplayProperty = computed(() => {
|
|
227
|
-
return items.value?.some((x: { alias: string }) => x.alias)
|
|
228
|
-
? "alias"
|
|
229
|
-
: "name";
|
|
230
|
-
});
|
|
231
|
-
const handleDisplayName = computed(() => {
|
|
232
|
-
let localized: string;
|
|
233
|
-
const isLocaleExists = props.property.displayNames?.find((x: IDisplayName) =>
|
|
234
|
-
x.languageCode
|
|
235
|
-
?.toLowerCase()
|
|
236
|
-
.startsWith((locale.value as string)?.toLowerCase())
|
|
237
|
-
);
|
|
238
|
-
if (isLocaleExists && isLocaleExists.name) {
|
|
239
|
-
localized = isLocaleExists.name;
|
|
240
|
-
} else {
|
|
241
|
-
const fallback = props.property.displayNames?.find((x: IDisplayName) =>
|
|
242
|
-
x.languageCode?.toLowerCase().includes(props.culture?.toLowerCase())
|
|
243
|
-
);
|
|
244
|
-
localized =
|
|
245
|
-
fallback && fallback?.name ? fallback.name : props.property.name;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return localized && te(localized.toUpperCase())
|
|
249
|
-
? t(localized.toUpperCase())
|
|
250
|
-
: localized;
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
onMounted(async () => {
|
|
254
|
-
if (props.optionsGetter) {
|
|
255
|
-
items.value = await props.optionsGetter(props.property);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
if (props.property.required || props.property.isRequired) {
|
|
260
|
-
rules.required = true;
|
|
261
|
-
}
|
|
262
|
-
if (props.property.validationRule?.charCountMin) {
|
|
263
|
-
rules.min = Number(props.property.validationRule.charCountMin);
|
|
264
|
-
}
|
|
265
|
-
if (props.property.validationRule?.charCountMax) {
|
|
266
|
-
rules.max = Number(props.property.validationRule.charCountMax);
|
|
267
|
-
}
|
|
268
|
-
if (props.property.validationRule?.regExp) {
|
|
269
|
-
rules.regex = new RegExp(props.property.validationRule?.regExp);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/*function getLabel() {
|
|
273
|
-
return (
|
|
274
|
-
(props.property.displayNames as { culture: string }[]).find(
|
|
275
|
-
(item) => item.culture === props.culture
|
|
276
|
-
) || props.property.name
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
*/
|
|
280
|
-
|
|
281
|
-
async function onSearch(keyword: string) {
|
|
282
|
-
if (props.optionsGetter) {
|
|
283
|
-
items.value = await props.optionsGetter(props.property, keyword);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
async function onClose() {
|
|
288
|
-
if (props.optionsGetter) {
|
|
289
|
-
items.value = await props.optionsGetter(props.property);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vc-badge.stories.d.ts","sourceRoot":"","sources":["../../../../components/atoms/vc-badge/vc-badge.stories.ts"],"names":[],"mappings":";;;;AAOA,wBAGE;AAUF,eAAO,MAAM,KAAK,KAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vc-button.stories.d.ts","sourceRoot":"","sources":["../../../../components/atoms/vc-button/vc-button.stories.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,wBASE;AAUF,eAAO,MAAM,MAAM,KAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vc-checkbox.stories.d.ts","sourceRoot":"","sources":["../../../../components/atoms/vc-checkbox/vc-checkbox.stories.ts"],"names":[],"mappings":";;;;AAOA,wBAGE;AAUF,eAAO,MAAM,QAAQ,KAAoB,CAAC"}
|