shared-ritm 1.3.83 → 1.3.85
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/dist/index.css +1 -1
- package/dist/shared-ritm.es.js +13 -13
- package/dist/shared-ritm.umd.js +3 -3
- package/package.json +70 -70
- package/src/App.vue +2461 -2461
- package/src/api/services/AuthService.ts +67 -67
- package/src/api/services/ControlsService.ts +96 -96
- package/src/api/services/EquipmentService.ts +52 -52
- package/src/api/services/MetricsService.ts +143 -143
- package/src/api/services/RepairsService.ts +111 -111
- package/src/api/services/UserIssueService.ts +32 -32
- package/src/api/services/UserService.ts +129 -129
- package/src/api/services/VideoService.ts +118 -118
- package/src/api/settings/ApiService.ts +4 -2
- package/src/api/types/Api_Auth.ts +121 -121
- package/src/api/types/Api_Equipment.ts +13 -13
- package/src/api/types/Api_Metrics.ts +51 -51
- package/src/api/types/Api_Repairs.ts +187 -187
- package/src/api/types/Api_Search.ts +81 -81
- package/src/api/types/Api_Tasks.ts +376 -376
- package/src/api/types/Api_User.ts +157 -157
- package/src/api/types/Api_User_Issue.ts +36 -36
- package/src/api/types/Api_Video.ts +244 -244
- package/src/common/app-button/Button.stories.ts +369 -369
- package/src/common/app-checkbox/AppCheckbox.vue +31 -31
- package/src/common/app-checkbox/Checkbox.stories.ts +252 -252
- package/src/common/app-date-picker/DatePicker.stories.ts +66 -66
- package/src/common/app-datepicker/Datepicker.stories.ts +145 -145
- package/src/common/app-dialogs/AppConfirmDialog.vue +109 -109
- package/src/common/app-dialogs/Confirm.stories.ts +93 -93
- package/src/common/app-dropdown/Dropdown.stories.ts +94 -94
- package/src/common/app-file/File.stories.ts +104 -104
- package/src/common/app-icon/AppIcon.vue +110 -110
- package/src/common/app-icon/Icon.stories.ts +91 -91
- package/src/common/app-input/Input.stories.ts +160 -160
- package/src/common/app-input-new/AppInputNew.vue +181 -181
- package/src/common/app-input-new/InputNew.stories.ts +240 -240
- package/src/common/app-input-search/InputSearch.stories.ts +149 -149
- package/src/common/app-layout/components/AppLayoutHeader.vue +289 -289
- package/src/common/app-loader/Loader.stories.ts +114 -114
- package/src/common/app-select/AppSelect.vue +159 -159
- package/src/common/app-select/Select.stories.ts +155 -155
- package/src/common/app-sidebar/AppSidebar.vue +174 -174
- package/src/common/app-table/AppTable.vue +313 -313
- package/src/common/app-table/components/ModalSelect.stories.ts +323 -323
- package/src/common/app-table/components/ModalSelect.vue +302 -302
- package/src/common/app-table/components/TableModal.vue +367 -367
- package/src/common/app-table/controllers/useColumnSelector.ts +45 -45
- package/src/common/app-table/controllers/useTableModel.ts +97 -97
- package/src/common/app-toggle/AppToggle.vue +12 -12
- package/src/common/app-toggle/Toggle.stories.ts +245 -245
- package/src/common/app-wrapper/AppWrapper.vue +31 -31
- package/src/configs/storybook.ts +14 -14
- package/src/icons/sidebar/user-requests-icon.vue +23 -23
- package/src/index.ts +134 -134
- package/src/shared/styles/general.css +140 -140
- package/src/styles/variables.sass +12 -12
- package/src/utils/files.ts +38 -38
- package/src/utils/helpers.ts +59 -59
- package/dist/types/api/services/PhotoService.d.ts +0 -40
- package/dist/types/stories/Button.stories.d.ts +0 -13
- package/dist/types/stories/Checkbox.stories.d.ts +0 -7
- package/dist/types/stories/Confirm.stories.d.ts +0 -8
- package/dist/types/stories/DatePicker.stories.d.ts +0 -8
- package/dist/types/stories/Dropdown.stories.d.ts +0 -8
- package/dist/types/stories/File.stories.d.ts +0 -8
- package/dist/types/stories/Icon.stories.d.ts +0 -7
- package/dist/types/stories/Input.stories.d.ts +0 -11
- package/dist/types/stories/InputNew.stories.d.ts +0 -12
- package/dist/types/stories/InputSearch.stories.d.ts +0 -10
- package/dist/types/stories/Loader.stories.d.ts +0 -8
- package/dist/types/stories/Select.stories.d.ts +0 -7
- package/dist/types/stories/Toggle.stories.d.ts +0 -8
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
import AppDialog from '@/common/app-dialogs/AppConfirmDialog.vue'
|
|
3
|
-
import AppButton from '@/common/app-button/AppButton.vue'
|
|
4
|
-
import { useQuasar } from 'quasar'
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof AppDialog> = {
|
|
7
|
-
title: 'Components/AppDialog',
|
|
8
|
-
component: AppDialog,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
argTypes: {
|
|
11
|
-
content: {
|
|
12
|
-
control: 'text',
|
|
13
|
-
description: 'Текстовое содержимое диалога',
|
|
14
|
-
},
|
|
15
|
-
type: {
|
|
16
|
-
control: 'radio',
|
|
17
|
-
options: ['edit', 'delete'],
|
|
18
|
-
description: 'Тип диалога — определяет иконку',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
args: {
|
|
22
|
-
content: 'Вы уверены, что хотите продолжить?',
|
|
23
|
-
type: 'edit',
|
|
24
|
-
},
|
|
25
|
-
decorators: [
|
|
26
|
-
story => ({
|
|
27
|
-
components: { story: story() },
|
|
28
|
-
template: '<story />',
|
|
29
|
-
}),
|
|
30
|
-
],
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default meta
|
|
34
|
-
|
|
35
|
-
type Story = StoryObj<typeof AppDialog>
|
|
36
|
-
|
|
37
|
-
const DialogWrapper = (args: any) => ({
|
|
38
|
-
components: { AppDialog, AppButton },
|
|
39
|
-
setup() {
|
|
40
|
-
const $q = useQuasar()
|
|
41
|
-
const open = () => {
|
|
42
|
-
$q.dialog({
|
|
43
|
-
component: AppDialog,
|
|
44
|
-
componentProps: args,
|
|
45
|
-
})
|
|
46
|
-
.onOk(() => {
|
|
47
|
-
$q.notify({
|
|
48
|
-
message: 'Принято',
|
|
49
|
-
color: 'green',
|
|
50
|
-
position: 'top-right',
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
.onCancel(() => {
|
|
54
|
-
$q.notify({
|
|
55
|
-
message: 'Отклонено',
|
|
56
|
-
color: 'red',
|
|
57
|
-
position: 'top-right',
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
return { open }
|
|
62
|
-
},
|
|
63
|
-
template: `
|
|
64
|
-
<div>
|
|
65
|
-
<app-button label="Open dialog" @click="open" style="margin-bottom: 20px;" />
|
|
66
|
-
</div>
|
|
67
|
-
`,
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
export const Edit: Story = {
|
|
71
|
-
render: DialogWrapper,
|
|
72
|
-
args: {
|
|
73
|
-
type: 'edit',
|
|
74
|
-
content: 'Вы хотите изменить данные?',
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const Delete: Story = {
|
|
79
|
-
render: DialogWrapper,
|
|
80
|
-
args: {
|
|
81
|
-
type: 'delete',
|
|
82
|
-
content: 'Вы уверены, что хотите удалить?',
|
|
83
|
-
},
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export const CustomMessage: Story = {
|
|
87
|
-
render: DialogWrapper,
|
|
88
|
-
args: {
|
|
89
|
-
type: 'edit',
|
|
90
|
-
content:
|
|
91
|
-
'Это очень важное предупреждение с длинным текстом, чтобы проверить, как оно переносится и выглядит в диалоге.',
|
|
92
|
-
},
|
|
93
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import AppDialog from '@/common/app-dialogs/AppConfirmDialog.vue'
|
|
3
|
+
import AppButton from '@/common/app-button/AppButton.vue'
|
|
4
|
+
import { useQuasar } from 'quasar'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof AppDialog> = {
|
|
7
|
+
title: 'Components/AppDialog',
|
|
8
|
+
component: AppDialog,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
content: {
|
|
12
|
+
control: 'text',
|
|
13
|
+
description: 'Текстовое содержимое диалога',
|
|
14
|
+
},
|
|
15
|
+
type: {
|
|
16
|
+
control: 'radio',
|
|
17
|
+
options: ['edit', 'delete'],
|
|
18
|
+
description: 'Тип диалога — определяет иконку',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
args: {
|
|
22
|
+
content: 'Вы уверены, что хотите продолжить?',
|
|
23
|
+
type: 'edit',
|
|
24
|
+
},
|
|
25
|
+
decorators: [
|
|
26
|
+
story => ({
|
|
27
|
+
components: { story: story() },
|
|
28
|
+
template: '<story />',
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default meta
|
|
34
|
+
|
|
35
|
+
type Story = StoryObj<typeof AppDialog>
|
|
36
|
+
|
|
37
|
+
const DialogWrapper = (args: any) => ({
|
|
38
|
+
components: { AppDialog, AppButton },
|
|
39
|
+
setup() {
|
|
40
|
+
const $q = useQuasar()
|
|
41
|
+
const open = () => {
|
|
42
|
+
$q.dialog({
|
|
43
|
+
component: AppDialog,
|
|
44
|
+
componentProps: args,
|
|
45
|
+
})
|
|
46
|
+
.onOk(() => {
|
|
47
|
+
$q.notify({
|
|
48
|
+
message: 'Принято',
|
|
49
|
+
color: 'green',
|
|
50
|
+
position: 'top-right',
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
.onCancel(() => {
|
|
54
|
+
$q.notify({
|
|
55
|
+
message: 'Отклонено',
|
|
56
|
+
color: 'red',
|
|
57
|
+
position: 'top-right',
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
return { open }
|
|
62
|
+
},
|
|
63
|
+
template: `
|
|
64
|
+
<div>
|
|
65
|
+
<app-button label="Open dialog" @click="open" style="margin-bottom: 20px;" />
|
|
66
|
+
</div>
|
|
67
|
+
`,
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export const Edit: Story = {
|
|
71
|
+
render: DialogWrapper,
|
|
72
|
+
args: {
|
|
73
|
+
type: 'edit',
|
|
74
|
+
content: 'Вы хотите изменить данные?',
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const Delete: Story = {
|
|
79
|
+
render: DialogWrapper,
|
|
80
|
+
args: {
|
|
81
|
+
type: 'delete',
|
|
82
|
+
content: 'Вы уверены, что хотите удалить?',
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const CustomMessage: Story = {
|
|
87
|
+
render: DialogWrapper,
|
|
88
|
+
args: {
|
|
89
|
+
type: 'edit',
|
|
90
|
+
content:
|
|
91
|
+
'Это очень важное предупреждение с длинным текстом, чтобы проверить, как оно переносится и выглядит в диалоге.',
|
|
92
|
+
},
|
|
93
|
+
}
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
import AppDropdown from '@/common/app-dropdown/AppDropdown.vue'
|
|
3
|
-
import AppButton from '@/common/app-button/AppButton.vue'
|
|
4
|
-
import { quasarColorOpts } from '@/configs/storybook'
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof AppDropdown> = {
|
|
7
|
-
title: 'Components/AppDropdown',
|
|
8
|
-
component: AppDropdown,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
argTypes: {
|
|
11
|
-
label: {
|
|
12
|
-
control: 'text',
|
|
13
|
-
description: 'Текст на кнопке. Можно переопределить через слот `label`.',
|
|
14
|
-
},
|
|
15
|
-
color: {
|
|
16
|
-
control: 'select',
|
|
17
|
-
options: quasarColorOpts,
|
|
18
|
-
description: 'Цвет фона кнопки. Используйте имена из палитры Quasar.',
|
|
19
|
-
},
|
|
20
|
-
width: {
|
|
21
|
-
control: 'text',
|
|
22
|
-
description: 'Ширина выпадающего контента.',
|
|
23
|
-
},
|
|
24
|
-
height: {
|
|
25
|
-
control: 'text',
|
|
26
|
-
description: 'Минимальная ширина выпадающего контента. Используется как `minWidth`.',
|
|
27
|
-
},
|
|
28
|
-
modelValue: {
|
|
29
|
-
control: 'boolean',
|
|
30
|
-
description: 'Состояние открыт/закрыт.',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
args: {
|
|
34
|
-
label: 'Меню',
|
|
35
|
-
color: 'primary',
|
|
36
|
-
width: 200,
|
|
37
|
-
height: 200,
|
|
38
|
-
modelValue: false,
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default meta
|
|
43
|
-
|
|
44
|
-
type Story = StoryObj<typeof AppDropdown>
|
|
45
|
-
|
|
46
|
-
export const Default: Story = { args: { label: 'Меню' } }
|
|
47
|
-
|
|
48
|
-
export const WithSlots: Story = {
|
|
49
|
-
render: () => ({
|
|
50
|
-
components: { AppDropdown, AppButton },
|
|
51
|
-
template: `
|
|
52
|
-
<div>
|
|
53
|
-
<AppDropdown color="primary">
|
|
54
|
-
<template #label>
|
|
55
|
-
<span style="display: flex; align-items: center; gap: 6px;">
|
|
56
|
-
Меню
|
|
57
|
-
</span>
|
|
58
|
-
</template>
|
|
59
|
-
<template #content>
|
|
60
|
-
<div style="padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
|
61
|
-
<p>Контент</p>
|
|
62
|
-
<AppButton color="primary" label="Кнопка внутри"/>
|
|
63
|
-
</div>
|
|
64
|
-
</template>
|
|
65
|
-
</AppDropdown>
|
|
66
|
-
</div>
|
|
67
|
-
`,
|
|
68
|
-
}),
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const ContentSize: Story = {
|
|
72
|
-
render: () => ({
|
|
73
|
-
components: { AppDropdown },
|
|
74
|
-
template: `
|
|
75
|
-
<div style="display: flex; gap: 16px; flex-wrap: wrap;">
|
|
76
|
-
<AppDropdown label="200×200" width="200px" height="200px">
|
|
77
|
-
<template #content>
|
|
78
|
-
<div style="padding: 12px;">Стандартный размер</div>
|
|
79
|
-
</template>
|
|
80
|
-
</AppDropdown>
|
|
81
|
-
<AppDropdown label="300×150" width="300px" height="150px">
|
|
82
|
-
<template #content>
|
|
83
|
-
<div style="padding: 12px;">Широкий и низкий</div>
|
|
84
|
-
</template>
|
|
85
|
-
</AppDropdown>
|
|
86
|
-
<AppDropdown label="150×300" width="150px" height="300px">
|
|
87
|
-
<template #content>
|
|
88
|
-
<div style="padding: 12px;">Узкий и высокий</div>
|
|
89
|
-
</template>
|
|
90
|
-
</AppDropdown>
|
|
91
|
-
</div>
|
|
92
|
-
`,
|
|
93
|
-
}),
|
|
94
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import AppDropdown from '@/common/app-dropdown/AppDropdown.vue'
|
|
3
|
+
import AppButton from '@/common/app-button/AppButton.vue'
|
|
4
|
+
import { quasarColorOpts } from '@/configs/storybook'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof AppDropdown> = {
|
|
7
|
+
title: 'Components/AppDropdown',
|
|
8
|
+
component: AppDropdown,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
label: {
|
|
12
|
+
control: 'text',
|
|
13
|
+
description: 'Текст на кнопке. Можно переопределить через слот `label`.',
|
|
14
|
+
},
|
|
15
|
+
color: {
|
|
16
|
+
control: 'select',
|
|
17
|
+
options: quasarColorOpts,
|
|
18
|
+
description: 'Цвет фона кнопки. Используйте имена из палитры Quasar.',
|
|
19
|
+
},
|
|
20
|
+
width: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Ширина выпадающего контента.',
|
|
23
|
+
},
|
|
24
|
+
height: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Минимальная ширина выпадающего контента. Используется как `minWidth`.',
|
|
27
|
+
},
|
|
28
|
+
modelValue: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Состояние открыт/закрыт.',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
args: {
|
|
34
|
+
label: 'Меню',
|
|
35
|
+
color: 'primary',
|
|
36
|
+
width: 200,
|
|
37
|
+
height: 200,
|
|
38
|
+
modelValue: false,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default meta
|
|
43
|
+
|
|
44
|
+
type Story = StoryObj<typeof AppDropdown>
|
|
45
|
+
|
|
46
|
+
export const Default: Story = { args: { label: 'Меню' } }
|
|
47
|
+
|
|
48
|
+
export const WithSlots: Story = {
|
|
49
|
+
render: () => ({
|
|
50
|
+
components: { AppDropdown, AppButton },
|
|
51
|
+
template: `
|
|
52
|
+
<div>
|
|
53
|
+
<AppDropdown color="primary">
|
|
54
|
+
<template #label>
|
|
55
|
+
<span style="display: flex; align-items: center; gap: 6px;">
|
|
56
|
+
Меню
|
|
57
|
+
</span>
|
|
58
|
+
</template>
|
|
59
|
+
<template #content>
|
|
60
|
+
<div style="padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
|
61
|
+
<p>Контент</p>
|
|
62
|
+
<AppButton color="primary" label="Кнопка внутри"/>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
</AppDropdown>
|
|
66
|
+
</div>
|
|
67
|
+
`,
|
|
68
|
+
}),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const ContentSize: Story = {
|
|
72
|
+
render: () => ({
|
|
73
|
+
components: { AppDropdown },
|
|
74
|
+
template: `
|
|
75
|
+
<div style="display: flex; gap: 16px; flex-wrap: wrap;">
|
|
76
|
+
<AppDropdown label="200×200" width="200px" height="200px">
|
|
77
|
+
<template #content>
|
|
78
|
+
<div style="padding: 12px;">Стандартный размер</div>
|
|
79
|
+
</template>
|
|
80
|
+
</AppDropdown>
|
|
81
|
+
<AppDropdown label="300×150" width="300px" height="150px">
|
|
82
|
+
<template #content>
|
|
83
|
+
<div style="padding: 12px;">Широкий и низкий</div>
|
|
84
|
+
</template>
|
|
85
|
+
</AppDropdown>
|
|
86
|
+
<AppDropdown label="150×300" width="150px" height="300px">
|
|
87
|
+
<template #content>
|
|
88
|
+
<div style="padding: 12px;">Узкий и высокий</div>
|
|
89
|
+
</template>
|
|
90
|
+
</AppDropdown>
|
|
91
|
+
</div>
|
|
92
|
+
`,
|
|
93
|
+
}),
|
|
94
|
+
}
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
import AppFile from '@/common/app-file/AppFile.vue'
|
|
3
|
-
import { ref } from 'vue'
|
|
4
|
-
import AppButton from '@/common/app-button/AppButton.vue'
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof AppFile> = {
|
|
7
|
-
title: 'Components/AppFile',
|
|
8
|
-
component: AppFile,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
argTypes: {
|
|
11
|
-
modelValue: { control: false },
|
|
12
|
-
label: { control: 'text' },
|
|
13
|
-
accept: { control: 'text' },
|
|
14
|
-
multiple: { control: 'boolean' },
|
|
15
|
-
disabled: { control: 'boolean' },
|
|
16
|
-
},
|
|
17
|
-
args: {
|
|
18
|
-
label: 'Загрузите файл',
|
|
19
|
-
accept: '',
|
|
20
|
-
multiple: false,
|
|
21
|
-
disabled: false,
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default meta
|
|
26
|
-
type Story = StoryObj<typeof AppFile>
|
|
27
|
-
|
|
28
|
-
const FileInputWrapper = (args: any) => ({
|
|
29
|
-
components: { AppFile, AppButton },
|
|
30
|
-
setup() {
|
|
31
|
-
const fileInputRef = ref<InstanceType<typeof AppFile> | null>(null)
|
|
32
|
-
const model = ref<File | File[] | null>(null)
|
|
33
|
-
|
|
34
|
-
const openFilePicker = () => {
|
|
35
|
-
fileInputRef.value?.pickFiles?.()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return { args, model, fileInputRef, openFilePicker }
|
|
39
|
-
},
|
|
40
|
-
template: `
|
|
41
|
-
<div style="width: 400px;">
|
|
42
|
-
<app-file
|
|
43
|
-
ref="fileInputRef"
|
|
44
|
-
v-model="model"
|
|
45
|
-
v-bind="args"
|
|
46
|
-
>
|
|
47
|
-
<template #drag-drop="{ isFileHover }">
|
|
48
|
-
<div
|
|
49
|
-
:style="{
|
|
50
|
-
border: isFileHover ? '2px dashed #3f8cff' : '2px dashed #ccc',
|
|
51
|
-
borderRadius: '8px',
|
|
52
|
-
padding: '24px',
|
|
53
|
-
textAlign: 'center',
|
|
54
|
-
backgroundColor: isFileHover ? '#f0f8ff' : '#fafafa',
|
|
55
|
-
cursor: 'pointer',
|
|
56
|
-
transition: 'all 0.2s',
|
|
57
|
-
minHeight: '100px',
|
|
58
|
-
display: 'flex',
|
|
59
|
-
alignItems: 'center',
|
|
60
|
-
justifyContent: 'center',
|
|
61
|
-
fontSize: '14px',
|
|
62
|
-
color: '#555',
|
|
63
|
-
}"
|
|
64
|
-
>
|
|
65
|
-
Перетащите файл сюда
|
|
66
|
-
</div>
|
|
67
|
-
</template>
|
|
68
|
-
</app-file>
|
|
69
|
-
|
|
70
|
-
<app-button
|
|
71
|
-
label="Выбрать файл"
|
|
72
|
-
@click="openFilePicker"
|
|
73
|
-
style="margin-top: 12px;"
|
|
74
|
-
:disabled="args.disabled"
|
|
75
|
-
/>
|
|
76
|
-
|
|
77
|
-
<div style="margin-top: 16px; padding: 12px; background: #f9f9f9; border-radius: 4px;">
|
|
78
|
-
<strong>Выбрано:</strong>
|
|
79
|
-
<pre style="font-size: 12px; margin-top: 8px;">{{
|
|
80
|
-
model
|
|
81
|
-
? Array.isArray(model)
|
|
82
|
-
? model.map(f => f.name).join(', ')
|
|
83
|
-
: model.name
|
|
84
|
-
: '—'
|
|
85
|
-
}}</pre>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
`,
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
export const SingleFile: Story = {
|
|
92
|
-
render: FileInputWrapper,
|
|
93
|
-
args: { multiple: false },
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export const MultipleFiles: Story = {
|
|
97
|
-
render: FileInputWrapper,
|
|
98
|
-
args: { multiple: true, accept: 'image/*' },
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export const Disabled: Story = {
|
|
102
|
-
render: FileInputWrapper,
|
|
103
|
-
args: { disabled: true },
|
|
104
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import AppFile from '@/common/app-file/AppFile.vue'
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
import AppButton from '@/common/app-button/AppButton.vue'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof AppFile> = {
|
|
7
|
+
title: 'Components/AppFile',
|
|
8
|
+
component: AppFile,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
modelValue: { control: false },
|
|
12
|
+
label: { control: 'text' },
|
|
13
|
+
accept: { control: 'text' },
|
|
14
|
+
multiple: { control: 'boolean' },
|
|
15
|
+
disabled: { control: 'boolean' },
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
label: 'Загрузите файл',
|
|
19
|
+
accept: '',
|
|
20
|
+
multiple: false,
|
|
21
|
+
disabled: false,
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default meta
|
|
26
|
+
type Story = StoryObj<typeof AppFile>
|
|
27
|
+
|
|
28
|
+
const FileInputWrapper = (args: any) => ({
|
|
29
|
+
components: { AppFile, AppButton },
|
|
30
|
+
setup() {
|
|
31
|
+
const fileInputRef = ref<InstanceType<typeof AppFile> | null>(null)
|
|
32
|
+
const model = ref<File | File[] | null>(null)
|
|
33
|
+
|
|
34
|
+
const openFilePicker = () => {
|
|
35
|
+
fileInputRef.value?.pickFiles?.()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return { args, model, fileInputRef, openFilePicker }
|
|
39
|
+
},
|
|
40
|
+
template: `
|
|
41
|
+
<div style="width: 400px;">
|
|
42
|
+
<app-file
|
|
43
|
+
ref="fileInputRef"
|
|
44
|
+
v-model="model"
|
|
45
|
+
v-bind="args"
|
|
46
|
+
>
|
|
47
|
+
<template #drag-drop="{ isFileHover }">
|
|
48
|
+
<div
|
|
49
|
+
:style="{
|
|
50
|
+
border: isFileHover ? '2px dashed #3f8cff' : '2px dashed #ccc',
|
|
51
|
+
borderRadius: '8px',
|
|
52
|
+
padding: '24px',
|
|
53
|
+
textAlign: 'center',
|
|
54
|
+
backgroundColor: isFileHover ? '#f0f8ff' : '#fafafa',
|
|
55
|
+
cursor: 'pointer',
|
|
56
|
+
transition: 'all 0.2s',
|
|
57
|
+
minHeight: '100px',
|
|
58
|
+
display: 'flex',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
justifyContent: 'center',
|
|
61
|
+
fontSize: '14px',
|
|
62
|
+
color: '#555',
|
|
63
|
+
}"
|
|
64
|
+
>
|
|
65
|
+
Перетащите файл сюда
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
</app-file>
|
|
69
|
+
|
|
70
|
+
<app-button
|
|
71
|
+
label="Выбрать файл"
|
|
72
|
+
@click="openFilePicker"
|
|
73
|
+
style="margin-top: 12px;"
|
|
74
|
+
:disabled="args.disabled"
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
<div style="margin-top: 16px; padding: 12px; background: #f9f9f9; border-radius: 4px;">
|
|
78
|
+
<strong>Выбрано:</strong>
|
|
79
|
+
<pre style="font-size: 12px; margin-top: 8px;">{{
|
|
80
|
+
model
|
|
81
|
+
? Array.isArray(model)
|
|
82
|
+
? model.map(f => f.name).join(', ')
|
|
83
|
+
: model.name
|
|
84
|
+
: '—'
|
|
85
|
+
}}</pre>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
`,
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
export const SingleFile: Story = {
|
|
92
|
+
render: FileInputWrapper,
|
|
93
|
+
args: { multiple: false },
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const MultipleFiles: Story = {
|
|
97
|
+
render: FileInputWrapper,
|
|
98
|
+
args: { multiple: true, accept: 'image/*' },
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const Disabled: Story = {
|
|
102
|
+
render: FileInputWrapper,
|
|
103
|
+
args: { disabled: true },
|
|
104
|
+
}
|