@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,223 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="vc-blade-toolbar-button"
|
|
4
|
+
:class="{ 'vc-blade-toolbar-button_disabled': disabled || isWaiting }"
|
|
5
|
+
@click="onClick"
|
|
6
|
+
:title="title"
|
|
7
|
+
>
|
|
8
|
+
<div ref="dropButtonRef">
|
|
9
|
+
<div class="vc-blade-toolbar-button__wrap" ref="bladeDropToggle">
|
|
10
|
+
<VcIcon
|
|
11
|
+
class="vc-blade-toolbar-button__icon"
|
|
12
|
+
:icon="icon"
|
|
13
|
+
size="m"
|
|
14
|
+
></VcIcon>
|
|
15
|
+
<div v-if="isExpanded" class="vc-blade-toolbar-button__title">
|
|
16
|
+
{{ title }}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<teleport to="#app">
|
|
20
|
+
<div
|
|
21
|
+
class="vc-blade-toolbar-button__dropdown"
|
|
22
|
+
v-if="isDropActive"
|
|
23
|
+
ref="bladeDropRef"
|
|
24
|
+
>
|
|
25
|
+
<div
|
|
26
|
+
class="vc-blade-toolbar-button__dropdown-item"
|
|
27
|
+
v-for="(item, i) in dropdownItems"
|
|
28
|
+
:key="i"
|
|
29
|
+
@click="handleDropItemClick(item)"
|
|
30
|
+
>
|
|
31
|
+
<VcIcon
|
|
32
|
+
:icon="item.icon"
|
|
33
|
+
class="vc-blade-toolbar-button__dropdown-item-icon"
|
|
34
|
+
/>
|
|
35
|
+
{{ item.title }}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</teleport>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script lang="ts">
|
|
44
|
+
import { defineComponent, nextTick, PropType, ref } from "vue";
|
|
45
|
+
|
|
46
|
+
export default defineComponent({
|
|
47
|
+
inheritAttrs: false,
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<script lang="ts" setup>
|
|
52
|
+
import { VcIcon } from "@/components";
|
|
53
|
+
import { createPopper, Instance } from "@popperjs/core";
|
|
54
|
+
import { IBladeDropdownItem } from "@/core/types";
|
|
55
|
+
|
|
56
|
+
const props = defineProps({
|
|
57
|
+
disabled: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
isExpanded: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true,
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
icon: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "fas fa-question-circle",
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
title: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: undefined,
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
dropdownItems: {
|
|
78
|
+
type: Array as PropType<IBladeDropdownItem[]>,
|
|
79
|
+
default: () => [],
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
clickHandler: {
|
|
83
|
+
type: Function,
|
|
84
|
+
default: undefined,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const emit = defineEmits(["click"]);
|
|
88
|
+
|
|
89
|
+
const popper = ref<Instance>();
|
|
90
|
+
const isWaiting = ref(false);
|
|
91
|
+
const isDropActive = ref(false);
|
|
92
|
+
const bladeDropToggle = ref();
|
|
93
|
+
const dropButtonRef = ref();
|
|
94
|
+
const bladeDropRef = ref();
|
|
95
|
+
|
|
96
|
+
async function onClick(): Promise<void> {
|
|
97
|
+
console.debug("vc-blade-toolbar-item#onClick()");
|
|
98
|
+
|
|
99
|
+
if (!props.disabled && !isWaiting.value) {
|
|
100
|
+
if (props.clickHandler && typeof props.clickHandler === "function") {
|
|
101
|
+
isWaiting.value = true;
|
|
102
|
+
try {
|
|
103
|
+
await props.clickHandler();
|
|
104
|
+
} finally {
|
|
105
|
+
isWaiting.value = false;
|
|
106
|
+
}
|
|
107
|
+
} else if (props.dropdownItems?.length) {
|
|
108
|
+
toggleDropdown();
|
|
109
|
+
} else {
|
|
110
|
+
emit("click");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function toggleDropdown() {
|
|
116
|
+
if (props.dropdownItems?.length) {
|
|
117
|
+
if (isDropActive.value) {
|
|
118
|
+
isDropActive.value = false;
|
|
119
|
+
popper.value?.destroy();
|
|
120
|
+
} else {
|
|
121
|
+
isDropActive.value = true;
|
|
122
|
+
nextTick(() => {
|
|
123
|
+
popper.value = createPopper(bladeDropToggle.value, bladeDropRef.value, {
|
|
124
|
+
placement: "bottom",
|
|
125
|
+
modifiers: [
|
|
126
|
+
{
|
|
127
|
+
name: "offset",
|
|
128
|
+
options: {
|
|
129
|
+
offset: [70, 5],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function handleDropItemClick(item: IBladeDropdownItem) {
|
|
140
|
+
if (item.clickHandler && typeof item.clickHandler === "function") {
|
|
141
|
+
item.clickHandler();
|
|
142
|
+
toggleDropdown();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<style lang="scss">
|
|
148
|
+
:root {
|
|
149
|
+
--blade-toolbar-button-title-color: #465769;
|
|
150
|
+
--blade-toolbar-button-title-color-hover: #465769;
|
|
151
|
+
--blade-toolbar-button-title-color-disabled: #9fa2a6;
|
|
152
|
+
|
|
153
|
+
--blade-toolbar-button-icon-color: #319ed4;
|
|
154
|
+
--blade-toolbar-button-icon-color-hover: #257fad;
|
|
155
|
+
--blade-toolbar-button-icon-color-disabled: #d2d4d7;
|
|
156
|
+
|
|
157
|
+
--blade-toolbar-button-background-color: var(
|
|
158
|
+
--blade-toolbar-background-color
|
|
159
|
+
);
|
|
160
|
+
--blade-toolbar-button-background-color-hover: var(
|
|
161
|
+
--blade-toolbar-background-color
|
|
162
|
+
);
|
|
163
|
+
--blade-toolbar-button-background-color-disabled: var(
|
|
164
|
+
--blade-toolbar-background-color
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.vc-blade-toolbar-button {
|
|
169
|
+
@apply px-2 bg-[color:var(--blade-toolbar-button-background-color)] box-border cursor-pointer;
|
|
170
|
+
|
|
171
|
+
&__wrap {
|
|
172
|
+
@apply inline-flex flex-col justify-center items-center relative;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&__title {
|
|
176
|
+
@apply text-sm whitespace-nowrap mt-1 text-[color:var(--blade-toolbar-button-title-color)];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&__icon {
|
|
180
|
+
@apply text-[color:var(--blade-toolbar-button-icon-color)];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&__dropdown {
|
|
184
|
+
@apply absolute bg-white z-[9999] shadow-[1px_1px_22px_rgba(126,142,157,0.2)];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&__dropdown-item {
|
|
188
|
+
@apply p-3 text-lg text-black border-l border-solid
|
|
189
|
+
border-l-[#eef0f2] border-b border-b-[#eef0f2]
|
|
190
|
+
bg-white cursor-pointer flex flex-row items-center
|
|
191
|
+
hover:bg-[#eff7fc];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&__dropdown-item-icon {
|
|
195
|
+
@apply text-[#a9bfd2] mr-2;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&:hover {
|
|
199
|
+
@apply bg-[color:var(--blade-toolbar-button-background-color-hover)];
|
|
200
|
+
|
|
201
|
+
.vc-blade-toolbar-button__title {
|
|
202
|
+
@apply text-[color:var(--blade-toolbar-button-title-color-hover)];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.vc-blade-toolbar-button__icon {
|
|
206
|
+
@apply text-[color:var(--blade-toolbar-button-icon-color-hover)];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&_disabled,
|
|
211
|
+
&_disabled:hover {
|
|
212
|
+
@apply bg-[color:var(--blade-toolbar-button-background-color-disabled)] cursor-default;
|
|
213
|
+
|
|
214
|
+
.vc-blade-toolbar-button__title {
|
|
215
|
+
@apply text-[color:var(--blade-toolbar-button-title-color-disabled)];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.vc-blade-toolbar-button__icon {
|
|
219
|
+
@apply text-[color:var(--blade-toolbar-button-icon-color-disabled)];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="isToolbarVisible()"
|
|
4
|
+
class="h-[var(--blade-toolbar-height)] bg-[color:var(--blade-toolbar-background-color)] border-b-[color:#eaedf3] border-solid border-b flex box-border w-full content-center items-stretch shrink-0"
|
|
5
|
+
:class="{ '!h-[var(--blade-toolbar-height-expanded)]': isExpanded }"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
class="grow basis-0 flex content-start items-center overflow-x-auto px-2"
|
|
9
|
+
>
|
|
10
|
+
<template v-for="item in items" :key="item.id">
|
|
11
|
+
<VcBladeToolbarButton
|
|
12
|
+
v-if="item.isVisible === undefined || item.isVisible"
|
|
13
|
+
v-bind="item"
|
|
14
|
+
:isExpanded="isExpanded"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
</div>
|
|
18
|
+
<VcIcon
|
|
19
|
+
class="self-center justify-self-center text-[#a1c0d4] cursor-pointer mr-4 hover:text-[#7ea8c4]"
|
|
20
|
+
:icon="`fas fa-chevron-${isExpanded ? 'up' : 'down'}`"
|
|
21
|
+
@click="toggleToolbar"
|
|
22
|
+
></VcIcon>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import { ref } from "vue";
|
|
28
|
+
import VcBladeToolbarButton from "./_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue";
|
|
29
|
+
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
items: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => [],
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const isExpanded = ref(true);
|
|
38
|
+
try {
|
|
39
|
+
isExpanded.value =
|
|
40
|
+
localStorage.getItem("VC_BLADE_TOOLBAR_IS_EXPANDED") === "true";
|
|
41
|
+
} catch (err) {
|
|
42
|
+
isExpanded.value = true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function toggleToolbar() {
|
|
46
|
+
isExpanded.value = !isExpanded.value;
|
|
47
|
+
localStorage.setItem(
|
|
48
|
+
"VC_BLADE_TOOLBAR_IS_EXPANDED",
|
|
49
|
+
isExpanded.value.toString()
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isToolbarVisible() {
|
|
54
|
+
const visibleItems = (props.items as { isVisible: boolean }[]).filter(
|
|
55
|
+
(item) => item.isVisible === undefined || item.isVisible
|
|
56
|
+
);
|
|
57
|
+
return !!visibleItems.length;
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style lang="scss">
|
|
62
|
+
:root {
|
|
63
|
+
--blade-toolbar-height: 36px;
|
|
64
|
+
--blade-toolbar-height-expanded: 50px;
|
|
65
|
+
--blade-toolbar-background-color: #ffffff;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blade component.
|
|
3
|
+
* @author Iurii A Taranov <me@flanker72.ru>
|
|
4
|
+
*/
|
|
5
|
+
import { Story } from "@storybook/vue3";
|
|
6
|
+
import VcBlade from "./vc-blade.vue";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "organisms/vc-blade",
|
|
10
|
+
component: VcBlade,
|
|
11
|
+
argTypes: {
|
|
12
|
+
collapse: { action: "collapse", name: "collapse" },
|
|
13
|
+
expand: { action: "expand", name: "expand" },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Template: Story = (args) => ({
|
|
18
|
+
components: { VcBlade },
|
|
19
|
+
setup() {
|
|
20
|
+
return { args };
|
|
21
|
+
},
|
|
22
|
+
template:
|
|
23
|
+
'<vc-blade v-bind="args"><div class="p-4">Blade Contents</div></vc-blade>',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const Blade = Template.bind({});
|
|
27
|
+
Blade.storyName = "vc-blade";
|
|
28
|
+
Blade.args = {
|
|
29
|
+
icon: "fas fa-star",
|
|
30
|
+
title: "My Awesome Blade",
|
|
31
|
+
subtitle: "Optional Subtitle",
|
|
32
|
+
width: 700,
|
|
33
|
+
closable: false,
|
|
34
|
+
searchable: false,
|
|
35
|
+
|
|
36
|
+
toolbarItems: [
|
|
37
|
+
{ id: 1, icon: "fas fa-sync-alt", title: "Refresh" },
|
|
38
|
+
{ id: 2, icon: "fas fa-plus", title: "Add" },
|
|
39
|
+
{ id: 3, icon: "fas fa-trash", title: "Delete", disabled: true },
|
|
40
|
+
{ id: 4, icon: "fas fa-download", title: "Import" },
|
|
41
|
+
{ id: 5, icon: "fas fa-upload", title: "Export" },
|
|
42
|
+
{ id: 6, icon: "fas fa-cut", title: "Cut", disabled: true },
|
|
43
|
+
{ id: 7, icon: "fas fa-paste", title: "Paste", disabled: true },
|
|
44
|
+
{ id: 8, icon: "fas fa-cubes", title: "Bulk export", disabled: true },
|
|
45
|
+
],
|
|
46
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="vc-blade relative flex shrink-0 flex-col bg-[color:var(--blade-background-color)] rounded-[var(--blade-border-radius)] shadow-[2px_2px_8px_rgba(126,142,157,0.14)] my-4 mx-2 overflow-hidden transition-[width] duration-200"
|
|
4
|
+
:style="{ width: typeof width === 'number' ? `${width}px` : width }"
|
|
5
|
+
:class="[$attrs.class, { '!w-full shrink': $isMobile.value || expanded }]"
|
|
6
|
+
>
|
|
7
|
+
<!-- Init blade header -->
|
|
8
|
+
<VcBladeHeader
|
|
9
|
+
class="shrink-0"
|
|
10
|
+
v-if="!$isMobile.value || closable"
|
|
11
|
+
:expanded="expanded"
|
|
12
|
+
:closable="closable"
|
|
13
|
+
:icon="icon"
|
|
14
|
+
:title="title"
|
|
15
|
+
:subtitle="subtitle"
|
|
16
|
+
@close="$emit('close')"
|
|
17
|
+
>
|
|
18
|
+
<template v-slot:actions v-if="$slots['actions']">
|
|
19
|
+
<slot name="actions"></slot>
|
|
20
|
+
</template>
|
|
21
|
+
</VcBladeHeader>
|
|
22
|
+
|
|
23
|
+
<!-- Set up blade toolbar -->
|
|
24
|
+
<VcBladeToolbar class="shrink-0" :items="toolbarItems"></VcBladeToolbar>
|
|
25
|
+
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
import { defineComponent, PropType } from "vue";
|
|
32
|
+
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
inheritAttrs: false,
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
import VcBladeHeader from "./_internal/vc-blade-header/vc-blade-header.vue";
|
|
40
|
+
import VcBladeToolbar from "./_internal/vc-blade-toolbar/vc-blade-toolbar.vue";
|
|
41
|
+
import { IBladeToolbar } from "@/core/types";
|
|
42
|
+
|
|
43
|
+
defineProps({
|
|
44
|
+
icon: {
|
|
45
|
+
type: String,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
title: {
|
|
49
|
+
type: String,
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
subtitle: {
|
|
53
|
+
type: String,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
width: {
|
|
57
|
+
type: [Number, String],
|
|
58
|
+
default: "30%",
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
expanded: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
closable: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true,
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
toolbarItems: {
|
|
72
|
+
type: Array as PropType<IBladeToolbar[]>,
|
|
73
|
+
default: () => [],
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style lang="scss">
|
|
79
|
+
:root {
|
|
80
|
+
--blade-background-color: #ffffff;
|
|
81
|
+
--blade-border-radius: 6px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.vc-app_mobile .vc-blade {
|
|
85
|
+
@apply m-0 rounded-none;
|
|
86
|
+
}
|
|
87
|
+
</style>
|