@vc-shell/framework 1.0.38 → 1.0.39
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/components/atoms/vc-badge/vc-badge.stories.ts +27 -0
- package/components/atoms/vc-badge/vc-badge.vue +63 -0
- package/components/atoms/vc-button/vc-button.stories.ts +34 -0
- package/components/atoms/vc-button/vc-button.vue +219 -0
- package/components/atoms/vc-card/vc-card.vue +137 -0
- package/components/atoms/vc-checkbox/vc-checkbox.stories.ts +25 -0
- package/components/atoms/vc-checkbox/vc-checkbox.vue +130 -0
- package/components/atoms/vc-col/vc-col.vue +22 -0
- package/components/atoms/vc-container/vc-container.stories.ts +31 -0
- package/components/atoms/vc-container/vc-container.vue +220 -0
- package/components/atoms/vc-hint/vc-hint.stories.ts +23 -0
- package/components/atoms/vc-hint/vc-hint.vue +11 -0
- package/components/atoms/vc-icon/vc-icon.stories.ts +32 -0
- package/components/atoms/vc-icon/vc-icon.vue +36 -0
- package/components/atoms/vc-image/vc-image.stories.ts +40 -0
- package/components/atoms/vc-image/vc-image.vue +122 -0
- package/components/atoms/vc-info-row/vc-info-row.vue +42 -0
- package/components/atoms/vc-label/vc-label.stories.ts +23 -0
- package/components/atoms/vc-label/vc-label.vue +49 -0
- package/components/atoms/vc-link/vc-link.stories.ts +30 -0
- package/components/atoms/vc-link/vc-link.vue +46 -0
- package/components/atoms/vc-loading/vc-loading.vue +30 -0
- package/components/atoms/vc-progress/vc-progress.stories.ts +25 -0
- package/components/atoms/vc-progress/vc-progress.vue +65 -0
- package/components/atoms/vc-row/vc-row.vue +13 -0
- package/components/atoms/vc-status/vc-status.stories.ts +26 -0
- package/components/atoms/vc-status/vc-status.vue +78 -0
- package/components/atoms/vc-status-icon/vc-status-icon.vue +21 -0
- package/components/atoms/vc-switch/vc-switch.stories.ts +27 -0
- package/components/atoms/vc-switch/vc-switch.vue +100 -0
- package/components/atoms/vc-widget/vc-widget.vue +85 -0
- package/components/index.ts +43 -0
- package/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +103 -0
- package/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +39 -0
- package/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +21 -0
- package/components/molecules/vc-editor/vc-editor.vue +117 -0
- package/components/molecules/vc-file-upload/vc-file-upload.vue +134 -0
- package/components/molecules/vc-form/vc-form.stories.ts +23 -0
- package/components/molecules/vc-form/vc-form.vue +5 -0
- package/components/molecules/vc-input/vc-input.stories.ts +26 -0
- package/components/molecules/vc-input/vc-input.vue +443 -0
- package/components/molecules/vc-multivalue/vc-multivalue.vue +447 -0
- package/components/molecules/vc-notification/vc-notification.vue +101 -0
- package/components/molecules/vc-pagination/vc-pagination.stories.ts +23 -0
- package/components/molecules/vc-pagination/vc-pagination.vue +169 -0
- package/components/molecules/vc-rating/vc-rating.stories.ts +23 -0
- package/components/molecules/vc-rating/vc-rating.vue +77 -0
- package/components/molecules/vc-select/vc-select.stories.ts +25 -0
- package/components/molecules/vc-select/vc-select.vue +402 -0
- package/components/molecules/vc-slider/vc-slider.vue +106 -0
- package/components/molecules/vc-textarea/vc-textarea.stories.ts +23 -0
- package/components/molecules/vc-textarea/vc-textarea.vue +155 -0
- package/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +146 -0
- package/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +148 -0
- package/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +157 -0
- package/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +110 -0
- package/components/organisms/vc-app/vc-app.stories.ts +75 -0
- package/components/organisms/vc-app/vc-app.vue +171 -0
- package/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +126 -0
- package/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +223 -0
- package/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +67 -0
- package/components/organisms/vc-blade/vc-blade.stories.ts +46 -0
- package/components/organisms/vc-blade/vc-blade.vue +87 -0
- package/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +292 -0
- package/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +123 -0
- package/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +93 -0
- package/components/organisms/vc-gallery/vc-gallery.vue +186 -0
- package/components/organisms/vc-login-form/vc-login-form.stories.ts +55 -0
- package/components/organisms/vc-login-form/vc-login-form.vue +48 -0
- package/components/organisms/vc-popup/vc-popup.stories.ts +23 -0
- package/components/organisms/vc-popup/vc-popup.vue +97 -0
- package/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +113 -0
- package/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue +29 -0
- package/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +152 -0
- package/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +272 -0
- package/components/organisms/vc-table/vc-table.stories.ts +99 -0
- package/components/organisms/vc-table/vc-table.vue +638 -0
- package/core/api/index.ts +1 -0
- package/core/api/platform.ts +8332 -0
- package/core/composables/index.ts +8 -0
- package/core/composables/useAutosave/index.ts +57 -0
- package/core/composables/useFunctions/debounce.ts +18 -0
- package/core/composables/useFunctions/delay.ts +7 -0
- package/core/composables/useFunctions/index.ts +21 -0
- package/core/composables/useFunctions/once.ts +14 -0
- package/core/composables/useFunctions/sleep.ts +4 -0
- package/core/composables/useFunctions/throttle.ts +17 -0
- package/core/composables/useI18n/index.ts +28 -0
- package/core/composables/useLogger/index.ts +24 -0
- package/core/composables/useNotifications/index.ts +116 -0
- package/core/composables/usePermissions/index.ts +32 -0
- package/core/composables/useSettings/index.ts +36 -0
- package/core/composables/useUser/index.ts +266 -0
- package/core/directives/autofocus/index.ts +9 -0
- package/core/directives/click-outside/index.ts +21 -0
- package/core/directives/index.ts +4 -0
- package/core/directives/loading/index.ts +28 -0
- package/core/directives/permissions/index.ts +20 -0
- package/core/plugins/index.ts +1 -0
- package/core/plugins/validation/index.ts +2 -0
- package/core/plugins/validation/rules.ts +196 -0
- package/core/types/index.ts +92 -0
- package/core/utilities/camelToSnake.ts +7 -0
- package/core/utilities/index.ts +1 -0
- package/dist/core/composables/useNotifications/index.d.ts +1 -1
- package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
- package/dist/core/composables/useUser/index.d.ts +2 -2
- package/dist/core/composables/useUser/index.d.ts.map +1 -1
- package/dist/core/plugins/validation/index.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +70 -97
- package/dist/framework.js.map +1 -1
- package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts +1 -1
- package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
- package/dist/shared/app-switcher/index.d.ts +2 -2
- package/dist/shared/app-switcher/index.d.ts.map +1 -1
- package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts +1 -1
- package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/blade-navigation/types/index.d.ts +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 -0
- package/dist/vite.config.d.ts.map +1 -1
- package/package.json +11 -8
- package/shared/app-switcher/components/index.ts +1 -0
- package/shared/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +90 -0
- package/shared/app-switcher/composables/index.ts +1 -0
- package/shared/app-switcher/composables/useAppSwitcher/index.ts +54 -0
- package/shared/app-switcher/index.ts +14 -0
- package/shared/assets/components/assets-details/assets-details.vue +138 -0
- package/shared/assets/components/index.ts +1 -0
- package/shared/assets/index.ts +19 -0
- package/shared/assets/locales/en.json +29 -0
- package/shared/assets/locales/index.ts +2 -0
- package/shared/blade-navigation/components/index.ts +1 -0
- package/shared/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +84 -0
- package/shared/blade-navigation/composables/index.ts +1 -0
- package/shared/blade-navigation/composables/useBladeNavigation/index.ts +216 -0
- package/shared/blade-navigation/index.ts +15 -0
- package/shared/blade-navigation/types/index.ts +52 -0
- package/shared/index.ts +16 -0
|
@@ -0,0 +1,292 @@
|
|
|
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>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="vc-gallery-item"
|
|
4
|
+
:class="{
|
|
5
|
+
'vc-gallery-item_readonly': readonly,
|
|
6
|
+
'vc-gallery-item_hover': hover,
|
|
7
|
+
}"
|
|
8
|
+
@tap.stop="hover = !hover"
|
|
9
|
+
v-click-outside="onClose"
|
|
10
|
+
>
|
|
11
|
+
<VcImage aspect="1x1" :src="image.url" background="contain"></VcImage>
|
|
12
|
+
<div class="vc-gallery-item__overlay">
|
|
13
|
+
<div class="flex">
|
|
14
|
+
<VcIcon
|
|
15
|
+
v-if="!readonly && !disableDrag"
|
|
16
|
+
class="vc-gallery-item__move"
|
|
17
|
+
icon="fas fa-arrows-alt"
|
|
18
|
+
size="s"
|
|
19
|
+
></VcIcon>
|
|
20
|
+
<div class="truncate" :title="image.name">
|
|
21
|
+
{{ image.name }}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="flex grow basis-0 items-center justify-around">
|
|
25
|
+
<div
|
|
26
|
+
class="vc-gallery-item__button"
|
|
27
|
+
@click="$emit('preview', image)"
|
|
28
|
+
v-if="actions && actions.preview"
|
|
29
|
+
>
|
|
30
|
+
<VcIcon
|
|
31
|
+
class="vc-gallery-item__button-icon"
|
|
32
|
+
icon="fas fa-eye"
|
|
33
|
+
></VcIcon>
|
|
34
|
+
<div class="mt-2">Fullscreen</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div
|
|
37
|
+
v-if="!readonly && actions && actions.edit"
|
|
38
|
+
class="vc-gallery-item__button"
|
|
39
|
+
@click="$emit('edit', image)"
|
|
40
|
+
>
|
|
41
|
+
<VcIcon
|
|
42
|
+
class="vc-gallery-item__button-icon"
|
|
43
|
+
icon="fas fa-pen"
|
|
44
|
+
></VcIcon>
|
|
45
|
+
<div class="mt-2">Edit</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div
|
|
48
|
+
v-if="!readonly && actions && actions.remove"
|
|
49
|
+
class="vc-gallery-item__button"
|
|
50
|
+
@click="$emit('remove', image)"
|
|
51
|
+
>
|
|
52
|
+
<VcIcon
|
|
53
|
+
class="vc-gallery-item__button-icon"
|
|
54
|
+
icon="fas fa-trash"
|
|
55
|
+
></VcIcon>
|
|
56
|
+
<div class="mt-2">Delete</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script lang="ts" setup>
|
|
64
|
+
import { ref } from "vue";
|
|
65
|
+
import { clickOutside as vClickOutside } from "@/core/directives";
|
|
66
|
+
|
|
67
|
+
defineProps({
|
|
68
|
+
image: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: () => ({}),
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
readonly: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false,
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
actions: {
|
|
79
|
+
type: Object,
|
|
80
|
+
default: () => ({}),
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
disableDrag: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
defineEmits(["preview", "edit", "remove"]);
|
|
90
|
+
|
|
91
|
+
const hover = ref(false);
|
|
92
|
+
|
|
93
|
+
function onClose() {
|
|
94
|
+
hover.value = false;
|
|
95
|
+
}
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<style lang="scss">
|
|
99
|
+
.vc-gallery-item {
|
|
100
|
+
@apply relative w-[155px] h-[155px] box-border border border-solid border-[#d3dae9] rounded-md p-1;
|
|
101
|
+
|
|
102
|
+
&__overlay {
|
|
103
|
+
@apply bg-[rgba(238,246,252,0.97)] flex-col p-2 opacity-0 flex absolute left-0 top-0 right-0 bottom-0 transition duration-200;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:hover &__overlay,
|
|
107
|
+
.vc-app_touch &_hover &__overlay {
|
|
108
|
+
@apply opacity-100;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&__move {
|
|
112
|
+
@apply text-[#a1c0d4] cursor-pointer mr-2;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&__button {
|
|
116
|
+
@apply cursor-pointer flex flex-col items-center;
|
|
117
|
+
|
|
118
|
+
&-icon {
|
|
119
|
+
@apply text-[#319ed4];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VcPopup :title="currentImage.title" @close="$emit('close')">
|
|
3
|
+
<template v-slot:title>
|
|
4
|
+
<div>
|
|
5
|
+
<span>{{ currentImage.name }} (</span>
|
|
6
|
+
<VcLink @click="copyLink(currentImage.url)">copy image link</VcLink>
|
|
7
|
+
<span>)</span>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<div class="w-full h-full box-border flex flex-col items-center">
|
|
11
|
+
<div class="box-border p-5 grow basis-0 w-full">
|
|
12
|
+
<div
|
|
13
|
+
class="bg-contain bg-no-repeat bg-center w-full h-full box-border"
|
|
14
|
+
:style="{ backgroundImage: 'url(' + currentImage.url + ')' }"
|
|
15
|
+
></div>
|
|
16
|
+
<div
|
|
17
|
+
v-if="localIndex > 0"
|
|
18
|
+
class="absolute top-2/4 -mt-9 h-[72px] w-[72px] flex items-center justify-center rounded-full bg-[#f1f6fa] cursor-pointer text-[#a1c0d4] [--icon-size-xl: 36px] hover:shadow-[0_0_20px_rgba(31,40,50,0.15)] left-[25px]"
|
|
19
|
+
@click="localIndex--"
|
|
20
|
+
>
|
|
21
|
+
<VcIcon icon="fas fa-arrow-left" size="xl"></VcIcon>
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
v-if="localIndex < images.length - 1"
|
|
25
|
+
class="absolute top-2/4 -mt-9 h-[72px] w-[72px] flex items-center justify-center rounded-full bg-[#f1f6fa] cursor-pointer text-[#a1c0d4] [--icon-size-xl: 36px] hover:shadow-[0_0_20px_rgba(31,40,50,0.15)] right-[25px]"
|
|
26
|
+
@click="localIndex++"
|
|
27
|
+
>
|
|
28
|
+
<VcIcon icon="fas fa-arrow-right" size="xl"></VcIcon>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
class="p-4 pb-[40px] max-w-full overflow-x-auto box-border shrink flex"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
v-for="(item, i) in images"
|
|
36
|
+
:key="i"
|
|
37
|
+
class="m-1 opacity-60"
|
|
38
|
+
:class="{
|
|
39
|
+
'vc-gallery-preview__images-item_current': i === localIndex,
|
|
40
|
+
}"
|
|
41
|
+
>
|
|
42
|
+
<VcImage
|
|
43
|
+
:src="item.url"
|
|
44
|
+
size="xl"
|
|
45
|
+
:bordered="true"
|
|
46
|
+
:clickable="true"
|
|
47
|
+
@click="localIndex = i"
|
|
48
|
+
></VcImage>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</VcPopup>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script lang="ts" setup>
|
|
56
|
+
import { computed, ref } from "vue";
|
|
57
|
+
import { VcPopup } from "@/components";
|
|
58
|
+
|
|
59
|
+
const props = defineProps({
|
|
60
|
+
images: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: () => [],
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
index: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: 0,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const localIndex = ref(props.index);
|
|
72
|
+
const currentImage = computed(() => props.images[localIndex.value] || {});
|
|
73
|
+
|
|
74
|
+
const copyLink = (link: string) => {
|
|
75
|
+
if (link.charAt(0) === "/") {
|
|
76
|
+
navigator.clipboard?.writeText(`${location.origin}${link}`);
|
|
77
|
+
} else {
|
|
78
|
+
navigator.clipboard?.writeText(link);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<style lang="scss">
|
|
84
|
+
.vc-gallery-preview {
|
|
85
|
+
&__images {
|
|
86
|
+
&-item {
|
|
87
|
+
&_current {
|
|
88
|
+
@apply relative opacity-100 after:content-[""] after:bg-[#43b0e6] after:h-1 after:w-full after:rounded-[5px] after:absolute after:left-0 after:-bottom-[12px];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</style>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vc-gallery">
|
|
3
|
+
<VcLabel
|
|
4
|
+
v-if="label"
|
|
5
|
+
:tooltip="tooltip"
|
|
6
|
+
:required="required"
|
|
7
|
+
:tooltip-icon="tooltipIcon"
|
|
8
|
+
>
|
|
9
|
+
{{ label }}
|
|
10
|
+
</VcLabel>
|
|
11
|
+
|
|
12
|
+
<template v-if="(images && images.length) || !disabled">
|
|
13
|
+
<div class="flex flex-wrap">
|
|
14
|
+
<draggable
|
|
15
|
+
:list="images"
|
|
16
|
+
class="flex flex-wrap w-full"
|
|
17
|
+
tag="transition-group"
|
|
18
|
+
v-bind="dragOptions"
|
|
19
|
+
@change="updateOrder"
|
|
20
|
+
:component-data="{
|
|
21
|
+
tag: 'div',
|
|
22
|
+
}"
|
|
23
|
+
>
|
|
24
|
+
<template #item="{ element, index }">
|
|
25
|
+
<VcGalleryItem
|
|
26
|
+
class="m-2"
|
|
27
|
+
:key="element.sortOrder"
|
|
28
|
+
:image="element"
|
|
29
|
+
:readonly="disabled"
|
|
30
|
+
@preview="onPreviewClick(index)"
|
|
31
|
+
@edit="$emit('item:edit', $event)"
|
|
32
|
+
@remove="$emit('item:remove', $event)"
|
|
33
|
+
:actions="itemActions"
|
|
34
|
+
:disableDrag="disableDrag"
|
|
35
|
+
></VcGalleryItem>
|
|
36
|
+
</template>
|
|
37
|
+
<template #footer>
|
|
38
|
+
<VcFileUpload
|
|
39
|
+
v-if="!disabled && !hideAfterUpload"
|
|
40
|
+
class="m-2"
|
|
41
|
+
:icon="uploadIcon"
|
|
42
|
+
@upload="onUpload"
|
|
43
|
+
:variant="variant"
|
|
44
|
+
:multiple="multiple"
|
|
45
|
+
:rules="rules"
|
|
46
|
+
:name="name"
|
|
47
|
+
></VcFileUpload>
|
|
48
|
+
</template>
|
|
49
|
+
</draggable>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
<div v-else class="flex justify-center p-5">
|
|
53
|
+
<VcHint>Gallery is empty</VcHint>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<VcGalleryPreview
|
|
57
|
+
v-if="preview"
|
|
58
|
+
:images="images"
|
|
59
|
+
:index="previewImageIndex"
|
|
60
|
+
@close="preview = false"
|
|
61
|
+
></VcGalleryPreview>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script lang="ts" setup>
|
|
66
|
+
import { computed, PropType, ref } from "vue";
|
|
67
|
+
import { VcLabel, VcFileUpload } from "@/components";
|
|
68
|
+
import VcGalleryItem from "./_internal/vc-gallery-item/vc-gallery-item.vue";
|
|
69
|
+
import VcGalleryPreview from "./_internal/vc-gallery-preview/vc-gallery-preview.vue";
|
|
70
|
+
import { IImage } from "@/core/types";
|
|
71
|
+
|
|
72
|
+
const props = defineProps({
|
|
73
|
+
images: {
|
|
74
|
+
type: Array as PropType<IImage[]>,
|
|
75
|
+
default: () => [],
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
disabled: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false,
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
required: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false,
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
label: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: undefined,
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
tooltip: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: undefined,
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
tooltipIcon: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: "fas fa-info",
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
uploadIcon: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: "fas fa-upload",
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
multiple: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: false,
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
variant: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: "gallery",
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
itemActions: {
|
|
119
|
+
type: Object,
|
|
120
|
+
default: () => ({
|
|
121
|
+
preview: true,
|
|
122
|
+
edit: true,
|
|
123
|
+
remove: true,
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
disableDrag: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
hideAfterUpload: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: false,
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
rules: {
|
|
138
|
+
type: [String, Object],
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
name: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: "Gallery",
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const emit = defineEmits([
|
|
148
|
+
"upload",
|
|
149
|
+
"sort",
|
|
150
|
+
"item:preview",
|
|
151
|
+
"item:edit",
|
|
152
|
+
"item:remove",
|
|
153
|
+
"item:move",
|
|
154
|
+
]);
|
|
155
|
+
|
|
156
|
+
const preview = ref(false);
|
|
157
|
+
const previewImageIndex = ref();
|
|
158
|
+
const dragOptions = computed(() => {
|
|
159
|
+
return {
|
|
160
|
+
animation: 200,
|
|
161
|
+
group: "description",
|
|
162
|
+
disabled: props.disableDrag,
|
|
163
|
+
ghostClass: "ghost",
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const onUpload = (files: FileList) => {
|
|
168
|
+
if (files && files.length) {
|
|
169
|
+
emit("upload", files);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const onPreviewClick = (index: number) => {
|
|
174
|
+
preview.value = true;
|
|
175
|
+
previewImageIndex.value = index;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const updateOrder = () => {
|
|
179
|
+
const images = props.images;
|
|
180
|
+
const sortedImgs = images.map((item, index) => {
|
|
181
|
+
item.sortOrder = index;
|
|
182
|
+
return item;
|
|
183
|
+
});
|
|
184
|
+
emit("sort", ref(sortedImgs).value);
|
|
185
|
+
};
|
|
186
|
+
</script>
|