@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,447 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="vc-multivalue"
|
|
4
|
+
:class="[
|
|
5
|
+
`vc-multivalue_${type}`,
|
|
6
|
+
{
|
|
7
|
+
'vc-multivalue_opened': isOpened,
|
|
8
|
+
'vc-multivalue_error': errorMessage,
|
|
9
|
+
'vc-multivalue_disabled': disabled
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
<!-- Input label -->
|
|
14
|
+
<VcLabel v-if="label" class="mb-2" :required="required">
|
|
15
|
+
<span>{{ label }}</span>
|
|
16
|
+
<template v-if="tooltip" v-slot:tooltip>{{ tooltip }}</template>
|
|
17
|
+
</VcLabel>
|
|
18
|
+
|
|
19
|
+
<!-- Input field -->
|
|
20
|
+
<div class="vc-multivalue__field-wrapper" ref="inputFieldWrapRef">
|
|
21
|
+
<div
|
|
22
|
+
v-for="(item, i) in modelValue"
|
|
23
|
+
:key="item.id"
|
|
24
|
+
class="vc-multivalue__field-value-wrapper"
|
|
25
|
+
>
|
|
26
|
+
<div class="vc-multivalue__field-value">
|
|
27
|
+
<span
|
|
28
|
+
class="truncate"
|
|
29
|
+
:title="
|
|
30
|
+
type === 'number' ? Number(item.value).toFixed(3) : item.value
|
|
31
|
+
"
|
|
32
|
+
>{{
|
|
33
|
+
type === "number" ? Number(item.value).toFixed(3) : item.value
|
|
34
|
+
}}</span
|
|
35
|
+
>
|
|
36
|
+
<VcIcon
|
|
37
|
+
v-if="!disabled"
|
|
38
|
+
class="vc-multivalue__field-value-clear"
|
|
39
|
+
icon="fas fa-times"
|
|
40
|
+
size="s"
|
|
41
|
+
@click="onDelete(i)"
|
|
42
|
+
></VcIcon>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<template v-if="multivalue">
|
|
47
|
+
<div
|
|
48
|
+
ref="dropdownToggleRef"
|
|
49
|
+
class="vc-multivalue__field vc-multivalue__field_dictionary grow basis-0 p-2"
|
|
50
|
+
>
|
|
51
|
+
<VcButton small @click.stop="toggleDropdown">Add +</VcButton>
|
|
52
|
+
<teleport to="#app">
|
|
53
|
+
<div
|
|
54
|
+
v-if="isOpened"
|
|
55
|
+
class="vc-multivalue__dropdown"
|
|
56
|
+
ref="dropdownRef"
|
|
57
|
+
v-click-outside="closeDropdown"
|
|
58
|
+
>
|
|
59
|
+
<input
|
|
60
|
+
ref="search"
|
|
61
|
+
class="vc-multivalue__search"
|
|
62
|
+
@input="onSearch"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<VcContainer :no-padding="true">
|
|
66
|
+
<div
|
|
67
|
+
class="vc-multivalue__item"
|
|
68
|
+
v-for="(item, i) in slicedDictionary"
|
|
69
|
+
:key="i"
|
|
70
|
+
@click="onItemSelect(item)"
|
|
71
|
+
>
|
|
72
|
+
<slot name="item" :item="item">{{
|
|
73
|
+
item[displayProperty]
|
|
74
|
+
}}</slot>
|
|
75
|
+
</div>
|
|
76
|
+
</VcContainer>
|
|
77
|
+
</div>
|
|
78
|
+
</teleport>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
<template v-else>
|
|
82
|
+
<input
|
|
83
|
+
class="vc-multivalue__field grow basis-0 pl-3"
|
|
84
|
+
:placeholder="placeholder"
|
|
85
|
+
:type="type"
|
|
86
|
+
:value="value"
|
|
87
|
+
:disabled="disabled"
|
|
88
|
+
@keypress.enter="onInput"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<slot v-if="errorMessage" name="error">
|
|
94
|
+
<VcHint class="vc-multivalue__error mt-1">
|
|
95
|
+
{{ errorMessage }}
|
|
96
|
+
</VcHint>
|
|
97
|
+
</slot>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script lang="ts" setup>
|
|
102
|
+
import { unref, getCurrentInstance, nextTick, ref, computed } from "vue";
|
|
103
|
+
|
|
104
|
+
import { useField } from "vee-validate";
|
|
105
|
+
import { VcLabel, VcIcon } from "@/components";
|
|
106
|
+
import { IValidationRules } from "@/core/types";
|
|
107
|
+
import { createPopper, Instance, State } from "@popperjs/core";
|
|
108
|
+
import { clickOutside as vClickOutside } from "@/core/directives";
|
|
109
|
+
|
|
110
|
+
const props = defineProps({
|
|
111
|
+
placeholder: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: "",
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
modelValue: {
|
|
117
|
+
type: Array,
|
|
118
|
+
default: () => [],
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
required: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: false,
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
disabled: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: false,
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
type: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "text",
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
label: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: undefined,
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
tooltip: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: undefined,
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
name: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: "Field",
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
options: {
|
|
152
|
+
type: Array,
|
|
153
|
+
default: () => [],
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
keyProperty: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: "id",
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
displayProperty: {
|
|
162
|
+
type: String,
|
|
163
|
+
default: "title",
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
multivalue: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: false,
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
errorMessage: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: undefined
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const emit = defineEmits(["update:modelValue", "search", "close"]);
|
|
178
|
+
|
|
179
|
+
const instance = getCurrentInstance();
|
|
180
|
+
const popper = ref<Instance>();
|
|
181
|
+
const dropdownToggleRef = ref();
|
|
182
|
+
const dropdownRef = ref();
|
|
183
|
+
const inputFieldWrapRef = ref();
|
|
184
|
+
const isOpened = ref(false);
|
|
185
|
+
const search = ref();
|
|
186
|
+
|
|
187
|
+
const slicedDictionary = computed(() => {
|
|
188
|
+
return props.options?.filter((x) => {
|
|
189
|
+
return !props.modelValue?.find(
|
|
190
|
+
(item) =>
|
|
191
|
+
(item as { valueId: string }).valueId === (x as { id: string }).id
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Handle input event to propertly validate value and emit changes
|
|
197
|
+
function onInput(e: InputEvent) {
|
|
198
|
+
const newValue = (e.target as HTMLInputElement).value;
|
|
199
|
+
emit("update:modelValue", [...props.modelValue, { value: newValue }]);
|
|
200
|
+
// handleChange("");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function onItemSelect(item: { [x: string]: string }) {
|
|
204
|
+
emit("update:modelValue", [
|
|
205
|
+
...props.modelValue,
|
|
206
|
+
{ valueId: item[props.keyProperty] },
|
|
207
|
+
]);
|
|
208
|
+
emit("close");
|
|
209
|
+
closeDropdown();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Handle event to propertly remove particular value and emit changes
|
|
213
|
+
function onDelete(i: number) {
|
|
214
|
+
const result = unref(props.modelValue);
|
|
215
|
+
result.splice(i, 1);
|
|
216
|
+
emit("update:modelValue", [...result]);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function toggleDropdown() {
|
|
220
|
+
if (!props.disabled) {
|
|
221
|
+
if (isOpened.value) {
|
|
222
|
+
isOpened.value = false;
|
|
223
|
+
popper.value?.destroy();
|
|
224
|
+
inputFieldWrapRef.value.style.borderRadius =
|
|
225
|
+
"var(--select-border-radius)";
|
|
226
|
+
emit("close");
|
|
227
|
+
} else {
|
|
228
|
+
isOpened.value = true;
|
|
229
|
+
nextTick(() => {
|
|
230
|
+
search?.value?.focus();
|
|
231
|
+
popper.value = createPopper(
|
|
232
|
+
inputFieldWrapRef.value,
|
|
233
|
+
dropdownRef.value,
|
|
234
|
+
{
|
|
235
|
+
placement: "bottom",
|
|
236
|
+
modifiers: [
|
|
237
|
+
{
|
|
238
|
+
name: "flip",
|
|
239
|
+
options: {
|
|
240
|
+
fallbackPlacements: ["top", "bottom"],
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "preventOverflow",
|
|
245
|
+
options: {
|
|
246
|
+
mainAxis: false,
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
name: "sameWidthChangeBorders",
|
|
251
|
+
enabled: true,
|
|
252
|
+
phase: "beforeWrite",
|
|
253
|
+
requires: ["computeStyles"],
|
|
254
|
+
fn: ({ state }: { state: State }) => {
|
|
255
|
+
const placement = state.placement;
|
|
256
|
+
if (placement === "top") {
|
|
257
|
+
state.styles.popper.borderTop =
|
|
258
|
+
"1px solid var(--select-border-color)";
|
|
259
|
+
state.styles.popper.borderBottom =
|
|
260
|
+
"1px solid var(--select-background-color)";
|
|
261
|
+
state.styles.popper.borderRadius =
|
|
262
|
+
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
263
|
+
inputFieldWrapRef.value.style.borderRadius =
|
|
264
|
+
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
265
|
+
} else {
|
|
266
|
+
state.styles.popper.borderBottom =
|
|
267
|
+
"1px solid var(--select-border-color)";
|
|
268
|
+
state.styles.popper.borderTop =
|
|
269
|
+
"1px solid var(--select-background-color)";
|
|
270
|
+
state.styles.popper.borderRadius =
|
|
271
|
+
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
272
|
+
|
|
273
|
+
if (inputFieldWrapRef.value) {
|
|
274
|
+
inputFieldWrapRef.value.style.borderRadius =
|
|
275
|
+
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
state.styles.popper.width = `${state.rects.reference.width}px`;
|
|
279
|
+
},
|
|
280
|
+
effect: ({ state }: { state: State }) => {
|
|
281
|
+
const ref = state.elements.reference as HTMLElement;
|
|
282
|
+
const placement = state.placement;
|
|
283
|
+
if (placement === "top") {
|
|
284
|
+
state.elements.popper.style.borderTop =
|
|
285
|
+
"1px solid var(--select-border-color)";
|
|
286
|
+
state.elements.popper.style.borderBottom =
|
|
287
|
+
"1px solid var(--select-background-color)";
|
|
288
|
+
state.elements.popper.style.borderRadius =
|
|
289
|
+
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
290
|
+
inputFieldWrapRef.value.style.borderRadius =
|
|
291
|
+
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
292
|
+
} else {
|
|
293
|
+
state.elements.popper.style.borderBottom =
|
|
294
|
+
"1px solid var(--select-border-color)";
|
|
295
|
+
state.elements.popper.style.borderTop =
|
|
296
|
+
"1px solid var(--select-background-color)";
|
|
297
|
+
state.elements.popper.style.borderRadius =
|
|
298
|
+
"0 0 var(--select-border-radius) var(--select-border-radius)";
|
|
299
|
+
|
|
300
|
+
if (inputFieldWrapRef.value) {
|
|
301
|
+
inputFieldWrapRef.value.style.borderRadius =
|
|
302
|
+
"var(--select-border-radius) var(--select-border-radius) 0 0";
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
state.elements.popper.style.width = `${ref.offsetWidth}px`;
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: "offset",
|
|
310
|
+
options: {
|
|
311
|
+
offset: [0, -1],
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function closeDropdown() {
|
|
323
|
+
isOpened.value = false;
|
|
324
|
+
popper.value?.destroy();
|
|
325
|
+
inputFieldWrapRef.value.style.borderRadius = "var(--select-border-radius)";
|
|
326
|
+
emit("close");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function onSearch(event: InputEvent) {
|
|
330
|
+
emit("search", (event.target as HTMLInputElement).value);
|
|
331
|
+
}
|
|
332
|
+
</script>
|
|
333
|
+
|
|
334
|
+
<style lang="scss">
|
|
335
|
+
:root {
|
|
336
|
+
--multivalue-height: 38px;
|
|
337
|
+
--multivalue-border-radius: 3px;
|
|
338
|
+
--multivalue-border-color: #d3dbe9;
|
|
339
|
+
--multivalue-border-color-error: #f14e4e;
|
|
340
|
+
--multivalue-background-color: #ffffff;
|
|
341
|
+
--multivalue-placeholder-color: #a5a5a5;
|
|
342
|
+
|
|
343
|
+
--select-height: 38px;
|
|
344
|
+
--select-border-radius: 3px;
|
|
345
|
+
--select-border-color: #d3dbe9;
|
|
346
|
+
--select-border-color-error: #f14e4e;
|
|
347
|
+
--select-background-color: #ffffff;
|
|
348
|
+
--select-background-color-disabled: #fafafa;
|
|
349
|
+
--select-placeholder-color: #a5a5a5;
|
|
350
|
+
--select-chevron-color: #43b0e6;
|
|
351
|
+
--select-chevron-color-hover: #319ed4;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.vc-multivalue {
|
|
355
|
+
@apply overflow-hidden;
|
|
356
|
+
|
|
357
|
+
&_date,
|
|
358
|
+
&_datetime-local {
|
|
359
|
+
@apply max-w-[220px];
|
|
360
|
+
|
|
361
|
+
.vc-app_mobile & {
|
|
362
|
+
@apply max-w-full;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
&__field-wrapper {
|
|
367
|
+
@apply border border-solid
|
|
368
|
+
border-[color:var(--multivalue-border-color)]
|
|
369
|
+
rounded-[var(--multivalue-border-radius)]
|
|
370
|
+
bg-[color:var(--multivalue-background-color)]
|
|
371
|
+
items-center
|
|
372
|
+
flex
|
|
373
|
+
flex-wrap;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
&__dropdown {
|
|
377
|
+
@apply flex flex-col box-border
|
|
378
|
+
max-h-[300px] z-10 overflow-hidden
|
|
379
|
+
absolute bg-[color:var(--select-background-color)]
|
|
380
|
+
border border-solid border-[color:var(--select-border-color)]
|
|
381
|
+
border-t-[color:var(--select-background-color)]
|
|
382
|
+
rounded-b-[var(--select-border-radius)]
|
|
383
|
+
p-2;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
&__search {
|
|
387
|
+
@apply w-full box-border border border-solid border-[#eaecf2]
|
|
388
|
+
rounded-[4px] h-8 leading-[32px]
|
|
389
|
+
outline-none mb-3 px-2;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
&__item {
|
|
393
|
+
@apply flex items-center min-h-[36px] px-2 rounded-[3px] cursor-pointer hover:bg-[#eff7fc];
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
&_opened &__field-wrapper {
|
|
397
|
+
@apply rounded-t-[var(--select-border-radius)];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
&_error &__field-wrapper {
|
|
401
|
+
@apply border border-solid border-[color:var(--multivalue-border-color-error)];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
&__error {
|
|
405
|
+
@apply text-[color:var(--multivalue-border-color-error)];
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
&__field {
|
|
409
|
+
@apply border-none outline-none h-[var(--multivalue-height)]
|
|
410
|
+
min-w-[120px] box-border placeholder:text-[color:var(--multivalue-placeholder-color)];
|
|
411
|
+
|
|
412
|
+
&::-webkit-input-placeholder {
|
|
413
|
+
@apply text-[color:var(--multivalue-placeholder-color)];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
&::-moz-placeholder {
|
|
417
|
+
@apply text-[color:var(--multivalue-placeholder-color)];
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
&::-ms-placeholder {
|
|
421
|
+
@apply text-[color:var(--multivalue-placeholder-color)];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
&-value-wrapper {
|
|
425
|
+
@apply h-[var(--multivalue-height)] ml-2 flex items-center;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
&-value {
|
|
429
|
+
@apply bg-[#fbfdfe] border border-solid border-[color:#bdd1df] rounded-[2px]
|
|
430
|
+
flex items-center h-[28px] box-border px-2 max-w-[150px];
|
|
431
|
+
|
|
432
|
+
&-clear {
|
|
433
|
+
@apply text-[#a9bfd2] ml-2 cursor-pointer;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
&_dictionary {
|
|
438
|
+
@apply h-auto min-w-[auto];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
&_disabled &__field-wrapper,
|
|
443
|
+
&_disabled &__field {
|
|
444
|
+
@apply bg-[#fafafa] text-[#424242];
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="vc-notification flex items-center mt-1 mb-3 mx-2 bg-[color:var(--notification-background)] border border-solid border-[color:#eef0f2] box-border shadow-[2px_2px_11px_rgba(126,142,157,0.4)] rounded-[var(--notification-border-radius)] overflow-hidden py-2 px-4 max-w-[600px]"
|
|
4
|
+
@mouseenter="onMouseEnter"
|
|
5
|
+
@mouseleave="onMouseLeave"
|
|
6
|
+
>
|
|
7
|
+
<div class="text-[color:var(--notification-content-color)]">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</div>
|
|
10
|
+
<VcIcon
|
|
11
|
+
icon="fas fa-times"
|
|
12
|
+
class="cursor-pointer text-[color:var(--notification-dismiss-color)] ml-2"
|
|
13
|
+
size="s"
|
|
14
|
+
@click="onDismiss"
|
|
15
|
+
></VcIcon>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import { VcIcon } from "@/components";
|
|
21
|
+
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
variant: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "info",
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
timeout: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 0,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const emit = defineEmits(["dismiss", "expired"]);
|
|
35
|
+
|
|
36
|
+
function Timer(callback: (...args: unknown[]) => unknown, delay: number) {
|
|
37
|
+
let timerId: number;
|
|
38
|
+
let from: number;
|
|
39
|
+
let remaining = delay;
|
|
40
|
+
|
|
41
|
+
function pause() {
|
|
42
|
+
window.clearTimeout(timerId);
|
|
43
|
+
remaining -= Date.now() - from;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function resume() {
|
|
47
|
+
from = Date.now();
|
|
48
|
+
window.clearTimeout(timerId);
|
|
49
|
+
timerId = window.setTimeout(callback, remaining);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function start() {
|
|
53
|
+
remaining = delay;
|
|
54
|
+
resume();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
pause,
|
|
59
|
+
resume,
|
|
60
|
+
start,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const timer = Timer(() => emit("expired"), props.timeout);
|
|
65
|
+
if (props.timeout) {
|
|
66
|
+
timer.start();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function onMouseEnter() {
|
|
70
|
+
timer.pause();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function onMouseLeave() {
|
|
74
|
+
if (props.timeout) {
|
|
75
|
+
timer.resume();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function onDismiss() {
|
|
80
|
+
timer.pause();
|
|
81
|
+
emit("dismiss");
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style lang="scss">
|
|
86
|
+
:root {
|
|
87
|
+
--notification-background: #ffffff;
|
|
88
|
+
--notification-border-radius: 4px;
|
|
89
|
+
--notification-box-shadow: 2px 2px 11px rgba(126, 142, 157, 0.4);
|
|
90
|
+
--notification-dismiss-color: #83a3be;
|
|
91
|
+
--notification-content-color: #8c9cab;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.vc-notification {
|
|
95
|
+
pointer-events: all;
|
|
96
|
+
|
|
97
|
+
.vc-app_mobile {
|
|
98
|
+
@apply max-w-[80%];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination component.
|
|
3
|
+
* @author Iurii A Taranov <me@flanker72.ru>
|
|
4
|
+
*/
|
|
5
|
+
import { Story } from "@storybook/vue3";
|
|
6
|
+
import VcPagination from "./vc-pagination.vue";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "molecules/vc-pagination",
|
|
10
|
+
component: VcPagination,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Template: Story = (args) => ({
|
|
14
|
+
components: { VcPagination },
|
|
15
|
+
setup() {
|
|
16
|
+
return { args };
|
|
17
|
+
},
|
|
18
|
+
template: '<vc-pagination v-bind="args"></vc-pagination>',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const Pagination = Template.bind({});
|
|
22
|
+
Pagination.storyName = "vc-pagination";
|
|
23
|
+
Pagination.args = {};
|