shared-ritm 1.3.68 → 1.3.69
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 +4555 -4392
- package/dist/shared-ritm.umd.js +181 -181
- package/dist/types/api/services/AuthService.d.ts +0 -1
- package/dist/types/api/services/MetricsService.d.ts +2 -1
- package/dist/types/api/services/PhotoService.d.ts +40 -0
- package/dist/types/api/services/UserService.d.ts +1 -2
- package/dist/types/api/settings/ApiService.d.ts +2 -6
- package/dist/types/api/types/Api_Auth.d.ts +0 -15
- package/dist/types/api/types/Api_Metrics.d.ts +18 -0
- package/dist/types/api/types/Api_User.d.ts +0 -9
- package/dist/types/common/app-checkbox/Checkbox.stories.d.ts +5 -1
- package/dist/types/common/app-toggle/Toggle.stories.d.ts +5 -1
- package/dist/types/stories/Button.stories.d.ts +13 -0
- package/dist/types/stories/Checkbox.stories.d.ts +7 -0
- package/dist/types/stories/Confirm.stories.d.ts +8 -0
- package/dist/types/stories/DatePicker.stories.d.ts +8 -0
- package/dist/types/stories/Dropdown.stories.d.ts +8 -0
- package/dist/types/stories/File.stories.d.ts +8 -0
- package/dist/types/stories/Icon.stories.d.ts +7 -0
- package/dist/types/stories/Input.stories.d.ts +11 -0
- package/dist/types/stories/InputNew.stories.d.ts +12 -0
- package/dist/types/stories/InputSearch.stories.d.ts +10 -0
- package/dist/types/stories/Loader.stories.d.ts +8 -0
- package/dist/types/stories/Select.stories.d.ts +7 -0
- package/dist/types/stories/Toggle.stories.d.ts +8 -0
- package/package.json +70 -70
- package/src/App.vue +2461 -2461
- package/src/api/services/AuthService.ts +4 -18
- package/src/api/services/ControlsService.ts +96 -96
- package/src/api/services/EquipmentService.ts +29 -29
- package/src/api/services/GanttService.ts +23 -23
- package/src/api/services/MetricsService.ts +127 -123
- package/src/api/services/RepairsService.ts +111 -111
- package/src/api/services/UserService.ts +0 -6
- package/src/api/services/VideoService.ts +118 -118
- package/src/api/settings/ApiService.ts +10 -70
- package/src/api/types/Api_Auth.ts +0 -16
- package/src/api/types/Api_Metrics.ts +26 -5
- package/src/api/types/Api_Repairs.ts +186 -186
- package/src/api/types/Api_Tasks.ts +376 -376
- package/src/api/types/Api_User.ts +0 -10
- 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 +19 -12
- package/src/common/app-checkbox/Checkbox.stories.ts +252 -60
- 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 +108 -108
- 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/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 +5 -15
- package/src/common/app-toggle/Toggle.stories.ts +245 -69
- package/src/common/app-wrapper/AppWrapper.vue +31 -31
- package/src/configs/storybook.ts +14 -14
- package/src/index.ts +131 -131
- package/src/shared/styles/general.css +140 -140
- package/src/styles/variables.sass +12 -12
- package/src/utils/helpers.ts +59 -59
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
import AppLoader from '@/common/app-loader/index.vue'
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof AppLoader> = {
|
|
5
|
-
title: 'Components/AppLoader',
|
|
6
|
-
component: AppLoader,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
argTypes: {
|
|
9
|
-
loading: {
|
|
10
|
-
control: 'boolean',
|
|
11
|
-
description: 'Показывать ли спиннер',
|
|
12
|
-
},
|
|
13
|
-
backdrop: {
|
|
14
|
-
control: 'boolean',
|
|
15
|
-
description: 'Показывать затемнение фона при загрузке',
|
|
16
|
-
table: { disable: true },
|
|
17
|
-
},
|
|
18
|
-
size: {
|
|
19
|
-
control: 'select',
|
|
20
|
-
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
21
|
-
description: 'Размер спиннера',
|
|
22
|
-
},
|
|
23
|
-
thickness: {
|
|
24
|
-
control: 'number',
|
|
25
|
-
description: 'Толщина линии спиннера (в px)',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
loading: true,
|
|
30
|
-
backdrop: false,
|
|
31
|
-
size: 'md',
|
|
32
|
-
thickness: 2,
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default meta
|
|
37
|
-
type Story = StoryObj<typeof AppLoader>
|
|
38
|
-
|
|
39
|
-
export const GlobalLoader: Story = {
|
|
40
|
-
render: args => ({
|
|
41
|
-
components: { AppLoader },
|
|
42
|
-
setup() {
|
|
43
|
-
return { args }
|
|
44
|
-
},
|
|
45
|
-
template: `
|
|
46
|
-
<div style="position: relative; height: 300px;">
|
|
47
|
-
<app-loader v-bind="args" />
|
|
48
|
-
|
|
49
|
-
<h2>Контент страницы</h2>
|
|
50
|
-
</div>
|
|
51
|
-
`,
|
|
52
|
-
}),
|
|
53
|
-
args: {
|
|
54
|
-
loading: true,
|
|
55
|
-
backdrop: true,
|
|
56
|
-
size: 'lg',
|
|
57
|
-
},
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const Size: Story = {
|
|
61
|
-
render: () => ({
|
|
62
|
-
components: { AppLoader },
|
|
63
|
-
template: `
|
|
64
|
-
<div style="display: flex; flex-wrap: wrap; gap: 32px; padding: 24px; background: white;">
|
|
65
|
-
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
66
|
-
<app-loader :loading="true" size="xs" />
|
|
67
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">xs</div>
|
|
68
|
-
</div>
|
|
69
|
-
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
70
|
-
<app-loader :loading="true" size="sm" />
|
|
71
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">sm</div>
|
|
72
|
-
</div>
|
|
73
|
-
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
74
|
-
<app-loader :loading="true" size="md" />
|
|
75
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">md</div>
|
|
76
|
-
</div>
|
|
77
|
-
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
78
|
-
<app-loader :loading="true" size="lg" />
|
|
79
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">lg</div>
|
|
80
|
-
</div>
|
|
81
|
-
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
82
|
-
<app-loader :loading="true" size="xl" />
|
|
83
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">xl</div>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
`,
|
|
87
|
-
}),
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export const Thickness: Story = {
|
|
91
|
-
render: () => ({
|
|
92
|
-
components: { AppLoader },
|
|
93
|
-
template: `
|
|
94
|
-
<div style="display: flex; flex-wrap: wrap; gap: 32px; padding: 24px; background: white;">
|
|
95
|
-
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
96
|
-
<app-loader :loading="true" size="lg" :thickness="1" />
|
|
97
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=1</div>
|
|
98
|
-
</div>
|
|
99
|
-
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
100
|
-
<app-loader :loading="true" size="lg" :thickness="2" />
|
|
101
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=2</div>
|
|
102
|
-
</div>
|
|
103
|
-
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
104
|
-
<app-loader :loading="true" size="lg" :thickness="3" />
|
|
105
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=3</div>
|
|
106
|
-
</div>
|
|
107
|
-
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
108
|
-
<app-loader :loading="true" size="lg" :thickness="5" />
|
|
109
|
-
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=5</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
`,
|
|
113
|
-
}),
|
|
114
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import AppLoader from '@/common/app-loader/index.vue'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof AppLoader> = {
|
|
5
|
+
title: 'Components/AppLoader',
|
|
6
|
+
component: AppLoader,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
loading: {
|
|
10
|
+
control: 'boolean',
|
|
11
|
+
description: 'Показывать ли спиннер',
|
|
12
|
+
},
|
|
13
|
+
backdrop: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
description: 'Показывать затемнение фона при загрузке',
|
|
16
|
+
table: { disable: true },
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
21
|
+
description: 'Размер спиннера',
|
|
22
|
+
},
|
|
23
|
+
thickness: {
|
|
24
|
+
control: 'number',
|
|
25
|
+
description: 'Толщина линии спиннера (в px)',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
args: {
|
|
29
|
+
loading: true,
|
|
30
|
+
backdrop: false,
|
|
31
|
+
size: 'md',
|
|
32
|
+
thickness: 2,
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default meta
|
|
37
|
+
type Story = StoryObj<typeof AppLoader>
|
|
38
|
+
|
|
39
|
+
export const GlobalLoader: Story = {
|
|
40
|
+
render: args => ({
|
|
41
|
+
components: { AppLoader },
|
|
42
|
+
setup() {
|
|
43
|
+
return { args }
|
|
44
|
+
},
|
|
45
|
+
template: `
|
|
46
|
+
<div style="position: relative; height: 300px;">
|
|
47
|
+
<app-loader v-bind="args" />
|
|
48
|
+
|
|
49
|
+
<h2>Контент страницы</h2>
|
|
50
|
+
</div>
|
|
51
|
+
`,
|
|
52
|
+
}),
|
|
53
|
+
args: {
|
|
54
|
+
loading: true,
|
|
55
|
+
backdrop: true,
|
|
56
|
+
size: 'lg',
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const Size: Story = {
|
|
61
|
+
render: () => ({
|
|
62
|
+
components: { AppLoader },
|
|
63
|
+
template: `
|
|
64
|
+
<div style="display: flex; flex-wrap: wrap; gap: 32px; padding: 24px; background: white;">
|
|
65
|
+
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
66
|
+
<app-loader :loading="true" size="xs" />
|
|
67
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">xs</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
70
|
+
<app-loader :loading="true" size="sm" />
|
|
71
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">sm</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
74
|
+
<app-loader :loading="true" size="md" />
|
|
75
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">md</div>
|
|
76
|
+
</div>
|
|
77
|
+
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
78
|
+
<app-loader :loading="true" size="lg" />
|
|
79
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">lg</div>
|
|
80
|
+
</div>
|
|
81
|
+
<div style="text-align: center; width: 100px; height: 100px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
82
|
+
<app-loader :loading="true" size="xl" />
|
|
83
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">xl</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
`,
|
|
87
|
+
}),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const Thickness: Story = {
|
|
91
|
+
render: () => ({
|
|
92
|
+
components: { AppLoader },
|
|
93
|
+
template: `
|
|
94
|
+
<div style="display: flex; flex-wrap: wrap; gap: 32px; padding: 24px; background: white;">
|
|
95
|
+
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
96
|
+
<app-loader :loading="true" size="lg" :thickness="1" />
|
|
97
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=1</div>
|
|
98
|
+
</div>
|
|
99
|
+
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
100
|
+
<app-loader :loading="true" size="lg" :thickness="2" />
|
|
101
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=2</div>
|
|
102
|
+
</div>
|
|
103
|
+
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
104
|
+
<app-loader :loading="true" size="lg" :thickness="3" />
|
|
105
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=3</div>
|
|
106
|
+
</div>
|
|
107
|
+
<div style="text-align: center; width: 120px; height: 120px; position: relative; border: 1px solid #eee; border-radius: 8px;">
|
|
108
|
+
<app-loader :loading="true" size="lg" :thickness="5" />
|
|
109
|
+
<div style="margin-top: 8px; font-size: 12px; color: #666;">thickness=5</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
`,
|
|
113
|
+
}),
|
|
114
|
+
}
|
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-select
|
|
3
|
-
ref="select"
|
|
4
|
-
v-model="selected"
|
|
5
|
-
:data-test="dataTest"
|
|
6
|
-
:options="filteredOptions"
|
|
7
|
-
:option-value="optionValue"
|
|
8
|
-
:option-label="optionLabel"
|
|
9
|
-
emit-value
|
|
10
|
-
map-options
|
|
11
|
-
:disable="isDisabled"
|
|
12
|
-
:multiple="multiple"
|
|
13
|
-
outlined
|
|
14
|
-
stack-label
|
|
15
|
-
:use-input="search"
|
|
16
|
-
:class="[$style.select]"
|
|
17
|
-
:label="label"
|
|
18
|
-
input-debounce="100"
|
|
19
|
-
:popup-content-class="$style['app-select__menu']"
|
|
20
|
-
:clearable="clearable"
|
|
21
|
-
rounded
|
|
22
|
-
autocomplete=""
|
|
23
|
-
@filter="filterFn"
|
|
24
|
-
>
|
|
25
|
-
<template v-if="multiple" #selected-item="scope">
|
|
26
|
-
<q-chip
|
|
27
|
-
v-if="scope.opt"
|
|
28
|
-
removable
|
|
29
|
-
class="q-ma-none"
|
|
30
|
-
dense
|
|
31
|
-
:tabindex="scope.tabindex"
|
|
32
|
-
color="white"
|
|
33
|
-
text-color="secondary"
|
|
34
|
-
@remove="scope.removeAtIndex(scope.index)"
|
|
35
|
-
>
|
|
36
|
-
{{ scope.opt[`${optionLabel}`] }}
|
|
37
|
-
</q-chip>
|
|
38
|
-
</template>
|
|
39
|
-
<template #no-option>
|
|
40
|
-
<q-item>{{ emptyText }}</q-item>
|
|
41
|
-
</template>
|
|
42
|
-
<q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
|
|
43
|
-
</q-select>
|
|
44
|
-
</template>
|
|
45
|
-
<script setup lang="ts">
|
|
46
|
-
import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
|
|
47
|
-
|
|
48
|
-
import { QSelect } from 'quasar'
|
|
49
|
-
|
|
50
|
-
type Option = Record<string, any>
|
|
51
|
-
|
|
52
|
-
interface AppQSelectProps {
|
|
53
|
-
modelValue: any
|
|
54
|
-
options: Option[]
|
|
55
|
-
placeholder: string
|
|
56
|
-
emptyText: string
|
|
57
|
-
optionLabel?: string
|
|
58
|
-
optionValue?: string
|
|
59
|
-
label?: string
|
|
60
|
-
multiple?: boolean
|
|
61
|
-
borderColor: string
|
|
62
|
-
isDisabled?: boolean
|
|
63
|
-
clearable?: boolean
|
|
64
|
-
search?: boolean
|
|
65
|
-
dataTest?: string
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const props = defineProps<AppQSelectProps>()
|
|
69
|
-
const select = ref({})
|
|
70
|
-
const emit = defineEmits(['update:modelValue'])
|
|
71
|
-
const selected = computed({
|
|
72
|
-
get() {
|
|
73
|
-
return props.modelValue
|
|
74
|
-
},
|
|
75
|
-
set(value) {
|
|
76
|
-
emit('update:modelValue', value)
|
|
77
|
-
},
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const type = () => {
|
|
81
|
-
if (Array.isArray(selected.value) && !selected.value.length) return true
|
|
82
|
-
return typeof selected.value === 'string' && !selected.value
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const lcText: Ref<string> = ref('')
|
|
86
|
-
const filteredOptions = computed(() => {
|
|
87
|
-
return props.options.filter(x => x[props?.optionLabel || 'label'].toLowerCase().includes(lcText.value))
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
function filterFn(val: string, update: (arg0: () => void) => void) {
|
|
91
|
-
update(() => {
|
|
92
|
-
lcText.value = val.toLowerCase()
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
</script>
|
|
96
|
-
<style module lang="scss">
|
|
97
|
-
.wrap {
|
|
98
|
-
position: relative;
|
|
99
|
-
|
|
100
|
-
&:global(.--option-tree) {
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.select {
|
|
106
|
-
&:global(.q-field--outlined.q-field--rounded .q-field__control) {
|
|
107
|
-
border-radius: 14px;
|
|
108
|
-
}
|
|
109
|
-
&:global(.q-field--outlined .q-field__control:before) {
|
|
110
|
-
border-color: v-bind(borderColor);
|
|
111
|
-
}
|
|
112
|
-
&:global(.q-select .q-field__input) {
|
|
113
|
-
padding: 0 6px;
|
|
114
|
-
}
|
|
115
|
-
//&:global(.q-field--filled .q-field__control) {
|
|
116
|
-
// //color: red;
|
|
117
|
-
//}
|
|
118
|
-
//&:global(.q-field--filled.q-field--focused .q-field__control) {
|
|
119
|
-
//}
|
|
120
|
-
//&:global(.q-field--filled .q-field__control:after) {
|
|
121
|
-
// left: 8px;
|
|
122
|
-
// right: 8px;
|
|
123
|
-
//}
|
|
124
|
-
&:global(.q-field--outlined .q-item) {
|
|
125
|
-
color: #1d1d1d;
|
|
126
|
-
position: absolute;
|
|
127
|
-
padding: 0 4px;
|
|
128
|
-
top: 18px;
|
|
129
|
-
left: 0;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.append-wrapper {
|
|
134
|
-
display: flex;
|
|
135
|
-
align-items: center;
|
|
136
|
-
column-gap: 4px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.menu-wrap {
|
|
140
|
-
padding: 8px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.search-wrapper {
|
|
144
|
-
position: sticky;
|
|
145
|
-
top: 0;
|
|
146
|
-
padding: 4px;
|
|
147
|
-
background: var(--main-bg);
|
|
148
|
-
z-index: 1;
|
|
149
|
-
}
|
|
150
|
-
.app-select__menu {
|
|
151
|
-
border-radius: 14px;
|
|
152
|
-
.q-item__label {
|
|
153
|
-
word-break: break-word;
|
|
154
|
-
}
|
|
155
|
-
&:global(.q-menu) {
|
|
156
|
-
max-height: 200px !important;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-select
|
|
3
|
+
ref="select"
|
|
4
|
+
v-model="selected"
|
|
5
|
+
:data-test="dataTest"
|
|
6
|
+
:options="filteredOptions"
|
|
7
|
+
:option-value="optionValue"
|
|
8
|
+
:option-label="optionLabel"
|
|
9
|
+
emit-value
|
|
10
|
+
map-options
|
|
11
|
+
:disable="isDisabled"
|
|
12
|
+
:multiple="multiple"
|
|
13
|
+
outlined
|
|
14
|
+
stack-label
|
|
15
|
+
:use-input="search"
|
|
16
|
+
:class="[$style.select]"
|
|
17
|
+
:label="label"
|
|
18
|
+
input-debounce="100"
|
|
19
|
+
:popup-content-class="$style['app-select__menu']"
|
|
20
|
+
:clearable="clearable"
|
|
21
|
+
rounded
|
|
22
|
+
autocomplete=""
|
|
23
|
+
@filter="filterFn"
|
|
24
|
+
>
|
|
25
|
+
<template v-if="multiple" #selected-item="scope">
|
|
26
|
+
<q-chip
|
|
27
|
+
v-if="scope.opt"
|
|
28
|
+
removable
|
|
29
|
+
class="q-ma-none"
|
|
30
|
+
dense
|
|
31
|
+
:tabindex="scope.tabindex"
|
|
32
|
+
color="white"
|
|
33
|
+
text-color="secondary"
|
|
34
|
+
@remove="scope.removeAtIndex(scope.index)"
|
|
35
|
+
>
|
|
36
|
+
{{ scope.opt[`${optionLabel}`] }}
|
|
37
|
+
</q-chip>
|
|
38
|
+
</template>
|
|
39
|
+
<template #no-option>
|
|
40
|
+
<q-item>{{ emptyText }}</q-item>
|
|
41
|
+
</template>
|
|
42
|
+
<q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
|
|
43
|
+
</q-select>
|
|
44
|
+
</template>
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
|
|
47
|
+
|
|
48
|
+
import { QSelect } from 'quasar'
|
|
49
|
+
|
|
50
|
+
type Option = Record<string, any>
|
|
51
|
+
|
|
52
|
+
interface AppQSelectProps {
|
|
53
|
+
modelValue: any
|
|
54
|
+
options: Option[]
|
|
55
|
+
placeholder: string
|
|
56
|
+
emptyText: string
|
|
57
|
+
optionLabel?: string
|
|
58
|
+
optionValue?: string
|
|
59
|
+
label?: string
|
|
60
|
+
multiple?: boolean
|
|
61
|
+
borderColor: string
|
|
62
|
+
isDisabled?: boolean
|
|
63
|
+
clearable?: boolean
|
|
64
|
+
search?: boolean
|
|
65
|
+
dataTest?: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const props = defineProps<AppQSelectProps>()
|
|
69
|
+
const select = ref({})
|
|
70
|
+
const emit = defineEmits(['update:modelValue'])
|
|
71
|
+
const selected = computed({
|
|
72
|
+
get() {
|
|
73
|
+
return props.modelValue
|
|
74
|
+
},
|
|
75
|
+
set(value) {
|
|
76
|
+
emit('update:modelValue', value)
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const type = () => {
|
|
81
|
+
if (Array.isArray(selected.value) && !selected.value.length) return true
|
|
82
|
+
return typeof selected.value === 'string' && !selected.value
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const lcText: Ref<string> = ref('')
|
|
86
|
+
const filteredOptions = computed(() => {
|
|
87
|
+
return props.options.filter(x => x[props?.optionLabel || 'label'].toLowerCase().includes(lcText.value))
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
function filterFn(val: string, update: (arg0: () => void) => void) {
|
|
91
|
+
update(() => {
|
|
92
|
+
lcText.value = val.toLowerCase()
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
96
|
+
<style module lang="scss">
|
|
97
|
+
.wrap {
|
|
98
|
+
position: relative;
|
|
99
|
+
|
|
100
|
+
&:global(.--option-tree) {
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.select {
|
|
106
|
+
&:global(.q-field--outlined.q-field--rounded .q-field__control) {
|
|
107
|
+
border-radius: 14px;
|
|
108
|
+
}
|
|
109
|
+
&:global(.q-field--outlined .q-field__control:before) {
|
|
110
|
+
border-color: v-bind(borderColor);
|
|
111
|
+
}
|
|
112
|
+
&:global(.q-select .q-field__input) {
|
|
113
|
+
padding: 0 6px;
|
|
114
|
+
}
|
|
115
|
+
//&:global(.q-field--filled .q-field__control) {
|
|
116
|
+
// //color: red;
|
|
117
|
+
//}
|
|
118
|
+
//&:global(.q-field--filled.q-field--focused .q-field__control) {
|
|
119
|
+
//}
|
|
120
|
+
//&:global(.q-field--filled .q-field__control:after) {
|
|
121
|
+
// left: 8px;
|
|
122
|
+
// right: 8px;
|
|
123
|
+
//}
|
|
124
|
+
&:global(.q-field--outlined .q-item) {
|
|
125
|
+
color: #1d1d1d;
|
|
126
|
+
position: absolute;
|
|
127
|
+
padding: 0 4px;
|
|
128
|
+
top: 18px;
|
|
129
|
+
left: 0;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.append-wrapper {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
column-gap: 4px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.menu-wrap {
|
|
140
|
+
padding: 8px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.search-wrapper {
|
|
144
|
+
position: sticky;
|
|
145
|
+
top: 0;
|
|
146
|
+
padding: 4px;
|
|
147
|
+
background: var(--main-bg);
|
|
148
|
+
z-index: 1;
|
|
149
|
+
}
|
|
150
|
+
.app-select__menu {
|
|
151
|
+
border-radius: 14px;
|
|
152
|
+
.q-item__label {
|
|
153
|
+
word-break: break-word;
|
|
154
|
+
}
|
|
155
|
+
&:global(.q-menu) {
|
|
156
|
+
max-height: 200px !important;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</style>
|