shared-ritm 1.2.67 → 1.2.68
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/README.md +103 -103
- package/dist/index.css +1 -1
- package/dist/shared-ritm.es.js +27926 -8480
- package/dist/shared-ritm.umd.js +3834 -7
- package/dist/types/api/services/ControlsService.d.ts +1 -2
- package/dist/types/api/services/FileService.d.ts +1 -2
- package/dist/types/api/services/MetricsService.d.ts +1 -2
- package/dist/types/api/services/PhotoService.d.ts +41 -0
- package/dist/types/api/services/ProjectsService.d.ts +1 -2
- package/dist/types/api/services/RepairsService.d.ts +1 -2
- package/dist/types/api/services/TasksService.d.ts +1 -2
- package/dist/types/api/services/UserService.d.ts +11 -0
- package/dist/types/api/settings/ApiService.d.ts +8 -0
- package/dist/types/api/types/Api_Instruments.d.ts +1 -35
- package/dist/types/api/types/Api_User.d.ts +42 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/types/utils/helpers.d.ts +1 -0
- package/package.json +64 -63
- package/src/api/services/PhotoService.ts +137 -0
- package/src/api/services/UserService.ts +19 -0
- package/src/api/types/Api_Controls.ts +72 -72
- package/src/api/types/Api_Files.ts +1 -1
- package/src/api/types/Api_Instruments.ts +98 -133
- package/src/api/types/Api_Projects.ts +55 -55
- package/src/api/types/Api_Repairs.ts +93 -93
- package/src/api/types/Api_Tasks.ts +155 -155
- package/src/api/types/Api_User.ts +44 -0
- package/src/common/app-checkbox/AppCheckbox.vue +26 -26
- package/src/common/app-dialogs/AppConfirmDialog.vue +99 -99
- package/src/common/app-dropdown/AppDropdown.vue +31 -31
- package/src/common/app-input/AppInput.vue +148 -148
- package/src/common/app-select/AppSelect.vue +157 -157
- package/src/common/app-sheet/AppSheet.vue +120 -120
- package/src/common/app-sidebar/components/SidebarMenuItem.vue +148 -148
- package/src/common/app-table/AppTable.vue +250 -250
- package/src/common/app-table/AppTableLayout.vue +111 -111
- package/src/common/app-table/components/ModalSelect.vue +264 -264
- package/src/common/app-table/components/TableModal.vue +329 -329
- package/src/common/app-table/components/TablePagination.vue +152 -152
- package/src/common/app-table/components/TableSearch.vue +76 -76
- package/src/common/app-table/controllers/useBaseTable.ts +42 -42
- package/src/common/app-table/controllers/useColumnSelector.ts +38 -38
- package/src/common/app-table/controllers/useTableModel.ts +93 -93
- package/src/common/app-toggle/AppToggle.vue +23 -23
- package/src/common/app-wrapper/AppWrapper.vue +28 -28
- package/src/icons/components/table-filter-icon.vue +30 -30
- package/src/icons/dialogs/RemoveIcon.vue +12 -12
- package/src/icons/dialogs/SafetyIcon.vue +12 -12
- package/src/icons/task/attention-icon.vue +13 -13
- package/src/icons/task/clock-icon.vue +10 -10
- package/src/icons/task/delete-icon.vue +10 -10
- package/src/icons/task/fire-icon.vue +16 -16
- package/src/index.ts +6 -0
- package/src/main.ts +28 -28
- package/src/shared/styles/general.css +125 -125
- package/src/styles/variables.sass +12 -12
- package/src/utils/confirm.ts +12 -12
- package/src/utils/helpers.ts +58 -39
- package/src/utils/notification.ts +9 -9
- package/dist/types/api/services/SearchService.d.ts +0 -8
- package/dist/types/api/types/Api_Search.d.ts +0 -43
- package/dist/types/api/types/Api_Service.d.ts +0 -9
- package/dist/types/api/types/Api_Users.d.ts +0 -43
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-input
|
|
3
|
-
v-model="value"
|
|
4
|
-
:class="[inputClasses, $style['app-input']]"
|
|
5
|
-
standout
|
|
6
|
-
outlined
|
|
7
|
-
dense
|
|
8
|
-
:rules="rules"
|
|
9
|
-
:type="inputType"
|
|
10
|
-
autocomplete="h87h58g7h8hd"
|
|
11
|
-
:readonly="readonly || field"
|
|
12
|
-
:disable="disabled"
|
|
13
|
-
:placeholder="placeholder"
|
|
14
|
-
>
|
|
15
|
-
</q-input>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script lang="ts" setup>
|
|
19
|
-
import { defineProps, defineEmits, computed, ref, withDefaults } from 'vue'
|
|
20
|
-
|
|
21
|
-
interface AppQInputProps {
|
|
22
|
-
name?: string | undefined
|
|
23
|
-
mask?: string | undefined
|
|
24
|
-
fillMask?: boolean | string | undefined
|
|
25
|
-
reverseFillMask?: boolean | undefined
|
|
26
|
-
unmaskedValue?: boolean | undefined
|
|
27
|
-
modelValue: string | number | null | undefined
|
|
28
|
-
error?: boolean | undefined
|
|
29
|
-
errorMessage?: string | undefined
|
|
30
|
-
noErrorIcon?: boolean | undefined
|
|
31
|
-
rules?: any | undefined
|
|
32
|
-
reactiveRules?: boolean | undefined
|
|
33
|
-
lazyRules?: boolean | 'ondemand' | undefined
|
|
34
|
-
label?: string | undefined
|
|
35
|
-
stackLabel?: boolean | undefined
|
|
36
|
-
hint?: string | undefined
|
|
37
|
-
hideHint?: boolean | undefined
|
|
38
|
-
prefix?: string | undefined
|
|
39
|
-
suffix?: string | undefined
|
|
40
|
-
labelColor?: string | undefined
|
|
41
|
-
color?: string | undefined
|
|
42
|
-
bgColor?: string | undefined
|
|
43
|
-
dark?: boolean | undefined
|
|
44
|
-
loading?: boolean | undefined
|
|
45
|
-
clearable?: boolean | undefined
|
|
46
|
-
clearIcon?: string | undefined
|
|
47
|
-
filled?: boolean | undefined
|
|
48
|
-
outlined?: boolean | undefined
|
|
49
|
-
borderless?: boolean | undefined
|
|
50
|
-
standout?: boolean | string | undefined
|
|
51
|
-
labelSlot?: boolean | undefined
|
|
52
|
-
bottomSlots?: boolean | undefined
|
|
53
|
-
hideBottomSpace?: boolean | undefined
|
|
54
|
-
counter?: boolean | undefined
|
|
55
|
-
rounded?: boolean | undefined
|
|
56
|
-
square?: boolean | undefined
|
|
57
|
-
dense?: boolean | undefined
|
|
58
|
-
itemAligned?: boolean | undefined
|
|
59
|
-
disable?: boolean | undefined
|
|
60
|
-
readonly?: boolean | undefined
|
|
61
|
-
autofocus?: boolean | undefined
|
|
62
|
-
for?: string | undefined
|
|
63
|
-
shadowText?: string | undefined
|
|
64
|
-
type?:
|
|
65
|
-
| 'text'
|
|
66
|
-
| 'password'
|
|
67
|
-
| 'textarea'
|
|
68
|
-
| 'email'
|
|
69
|
-
| 'search'
|
|
70
|
-
| 'tel'
|
|
71
|
-
| 'file'
|
|
72
|
-
| 'number'
|
|
73
|
-
| 'url'
|
|
74
|
-
| 'time'
|
|
75
|
-
| 'date'
|
|
76
|
-
| undefined
|
|
77
|
-
debounce?: string | number | undefined
|
|
78
|
-
disabled?: boolean | undefined
|
|
79
|
-
maxlength?: string | number | undefined
|
|
80
|
-
autogrow?: boolean | undefined
|
|
81
|
-
inputClass?: any | undefined
|
|
82
|
-
inputStyle?: any | undefined
|
|
83
|
-
onClear?: (value: any) => void
|
|
84
|
-
'onUpdate:modelValue'?: (value: string | number | null) => void
|
|
85
|
-
onFocus?: (evt: Event) => void
|
|
86
|
-
onBlur?: (evt: Event) => void
|
|
87
|
-
onClick?: (evt: Event) => void
|
|
88
|
-
placeholder?: string | undefined
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
interface AppInputProps extends AppQInputProps {
|
|
92
|
-
field?: boolean
|
|
93
|
-
required?: boolean
|
|
94
|
-
datePicker?: boolean
|
|
95
|
-
timePicker?: boolean
|
|
96
|
-
withIcon?: boolean
|
|
97
|
-
withButton?: boolean
|
|
98
|
-
withArrow?: boolean
|
|
99
|
-
borderColor?: string
|
|
100
|
-
borderRadius?: string
|
|
101
|
-
borderWidth?: string
|
|
102
|
-
width?: string
|
|
103
|
-
height?: string
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const props = withDefaults(defineProps<AppInputProps>(), {
|
|
107
|
-
dense: true,
|
|
108
|
-
outlined: true,
|
|
109
|
-
error: undefined,
|
|
110
|
-
modelValue: '',
|
|
111
|
-
borderRadius: '8px',
|
|
112
|
-
borderWidth: '1px',
|
|
113
|
-
width: 'auto',
|
|
114
|
-
height: 'auto',
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
const emit = defineEmits(['update:modelValue', 'button-click', 'clear', 'focus', 'blur', 'click'])
|
|
118
|
-
const passwordVisibility = ref(false)
|
|
119
|
-
const inputType = computed(() => {
|
|
120
|
-
if (props.type === 'password') return passwordVisibility.value ? 'text' : 'password'
|
|
121
|
-
return props.type || 'text'
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
const value = computed({
|
|
125
|
-
get: () =>
|
|
126
|
-
props.modelValue !== null && props.modelValue !== undefined && props.type === 'number'
|
|
127
|
-
? +props.modelValue
|
|
128
|
-
: props.modelValue,
|
|
129
|
-
set: (newValue: any) => emit('update:modelValue', props.type === 'number' ? +newValue : newValue),
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
const inputClasses = computed(() => {
|
|
133
|
-
return {
|
|
134
|
-
'app-input': true,
|
|
135
|
-
'--required': props.required,
|
|
136
|
-
'--field': props.field,
|
|
137
|
-
'input-number-without-arrow': inputType.value === 'number' && !props.withArrow,
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
</script>
|
|
141
|
-
|
|
142
|
-
<style module lang="scss">
|
|
143
|
-
.app-input {
|
|
144
|
-
&:global(.q-field--dense .q-field__control) {
|
|
145
|
-
height: v-bind(height);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-input
|
|
3
|
+
v-model="value"
|
|
4
|
+
:class="[inputClasses, $style['app-input']]"
|
|
5
|
+
standout
|
|
6
|
+
outlined
|
|
7
|
+
dense
|
|
8
|
+
:rules="rules"
|
|
9
|
+
:type="inputType"
|
|
10
|
+
autocomplete="h87h58g7h8hd"
|
|
11
|
+
:readonly="readonly || field"
|
|
12
|
+
:disable="disabled"
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
>
|
|
15
|
+
</q-input>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
import { defineProps, defineEmits, computed, ref, withDefaults } from 'vue'
|
|
20
|
+
|
|
21
|
+
interface AppQInputProps {
|
|
22
|
+
name?: string | undefined
|
|
23
|
+
mask?: string | undefined
|
|
24
|
+
fillMask?: boolean | string | undefined
|
|
25
|
+
reverseFillMask?: boolean | undefined
|
|
26
|
+
unmaskedValue?: boolean | undefined
|
|
27
|
+
modelValue: string | number | null | undefined
|
|
28
|
+
error?: boolean | undefined
|
|
29
|
+
errorMessage?: string | undefined
|
|
30
|
+
noErrorIcon?: boolean | undefined
|
|
31
|
+
rules?: any | undefined
|
|
32
|
+
reactiveRules?: boolean | undefined
|
|
33
|
+
lazyRules?: boolean | 'ondemand' | undefined
|
|
34
|
+
label?: string | undefined
|
|
35
|
+
stackLabel?: boolean | undefined
|
|
36
|
+
hint?: string | undefined
|
|
37
|
+
hideHint?: boolean | undefined
|
|
38
|
+
prefix?: string | undefined
|
|
39
|
+
suffix?: string | undefined
|
|
40
|
+
labelColor?: string | undefined
|
|
41
|
+
color?: string | undefined
|
|
42
|
+
bgColor?: string | undefined
|
|
43
|
+
dark?: boolean | undefined
|
|
44
|
+
loading?: boolean | undefined
|
|
45
|
+
clearable?: boolean | undefined
|
|
46
|
+
clearIcon?: string | undefined
|
|
47
|
+
filled?: boolean | undefined
|
|
48
|
+
outlined?: boolean | undefined
|
|
49
|
+
borderless?: boolean | undefined
|
|
50
|
+
standout?: boolean | string | undefined
|
|
51
|
+
labelSlot?: boolean | undefined
|
|
52
|
+
bottomSlots?: boolean | undefined
|
|
53
|
+
hideBottomSpace?: boolean | undefined
|
|
54
|
+
counter?: boolean | undefined
|
|
55
|
+
rounded?: boolean | undefined
|
|
56
|
+
square?: boolean | undefined
|
|
57
|
+
dense?: boolean | undefined
|
|
58
|
+
itemAligned?: boolean | undefined
|
|
59
|
+
disable?: boolean | undefined
|
|
60
|
+
readonly?: boolean | undefined
|
|
61
|
+
autofocus?: boolean | undefined
|
|
62
|
+
for?: string | undefined
|
|
63
|
+
shadowText?: string | undefined
|
|
64
|
+
type?:
|
|
65
|
+
| 'text'
|
|
66
|
+
| 'password'
|
|
67
|
+
| 'textarea'
|
|
68
|
+
| 'email'
|
|
69
|
+
| 'search'
|
|
70
|
+
| 'tel'
|
|
71
|
+
| 'file'
|
|
72
|
+
| 'number'
|
|
73
|
+
| 'url'
|
|
74
|
+
| 'time'
|
|
75
|
+
| 'date'
|
|
76
|
+
| undefined
|
|
77
|
+
debounce?: string | number | undefined
|
|
78
|
+
disabled?: boolean | undefined
|
|
79
|
+
maxlength?: string | number | undefined
|
|
80
|
+
autogrow?: boolean | undefined
|
|
81
|
+
inputClass?: any | undefined
|
|
82
|
+
inputStyle?: any | undefined
|
|
83
|
+
onClear?: (value: any) => void
|
|
84
|
+
'onUpdate:modelValue'?: (value: string | number | null) => void
|
|
85
|
+
onFocus?: (evt: Event) => void
|
|
86
|
+
onBlur?: (evt: Event) => void
|
|
87
|
+
onClick?: (evt: Event) => void
|
|
88
|
+
placeholder?: string | undefined
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface AppInputProps extends AppQInputProps {
|
|
92
|
+
field?: boolean
|
|
93
|
+
required?: boolean
|
|
94
|
+
datePicker?: boolean
|
|
95
|
+
timePicker?: boolean
|
|
96
|
+
withIcon?: boolean
|
|
97
|
+
withButton?: boolean
|
|
98
|
+
withArrow?: boolean
|
|
99
|
+
borderColor?: string
|
|
100
|
+
borderRadius?: string
|
|
101
|
+
borderWidth?: string
|
|
102
|
+
width?: string
|
|
103
|
+
height?: string
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const props = withDefaults(defineProps<AppInputProps>(), {
|
|
107
|
+
dense: true,
|
|
108
|
+
outlined: true,
|
|
109
|
+
error: undefined,
|
|
110
|
+
modelValue: '',
|
|
111
|
+
borderRadius: '8px',
|
|
112
|
+
borderWidth: '1px',
|
|
113
|
+
width: 'auto',
|
|
114
|
+
height: 'auto',
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const emit = defineEmits(['update:modelValue', 'button-click', 'clear', 'focus', 'blur', 'click'])
|
|
118
|
+
const passwordVisibility = ref(false)
|
|
119
|
+
const inputType = computed(() => {
|
|
120
|
+
if (props.type === 'password') return passwordVisibility.value ? 'text' : 'password'
|
|
121
|
+
return props.type || 'text'
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const value = computed({
|
|
125
|
+
get: () =>
|
|
126
|
+
props.modelValue !== null && props.modelValue !== undefined && props.type === 'number'
|
|
127
|
+
? +props.modelValue
|
|
128
|
+
: props.modelValue,
|
|
129
|
+
set: (newValue: any) => emit('update:modelValue', props.type === 'number' ? +newValue : newValue),
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const inputClasses = computed(() => {
|
|
133
|
+
return {
|
|
134
|
+
'app-input': true,
|
|
135
|
+
'--required': props.required,
|
|
136
|
+
'--field': props.field,
|
|
137
|
+
'input-number-without-arrow': inputType.value === 'number' && !props.withArrow,
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<style module lang="scss">
|
|
143
|
+
.app-input {
|
|
144
|
+
&:global(.q-field--dense .q-field__control) {
|
|
145
|
+
height: v-bind(height);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-select
|
|
3
|
-
ref="select"
|
|
4
|
-
v-model="selected"
|
|
5
|
-
:options="filteredOptions"
|
|
6
|
-
:option-value="optionValue"
|
|
7
|
-
:option-label="optionLabel"
|
|
8
|
-
emit-value
|
|
9
|
-
map-options
|
|
10
|
-
:disable="isDisabled"
|
|
11
|
-
:multiple="multiple"
|
|
12
|
-
outlined
|
|
13
|
-
stack-label
|
|
14
|
-
:use-input="search"
|
|
15
|
-
:class="[$style.select]"
|
|
16
|
-
:label="label"
|
|
17
|
-
input-debounce="100"
|
|
18
|
-
:popup-content-class="$style['app-select__menu']"
|
|
19
|
-
:clearable="clearable"
|
|
20
|
-
rounded
|
|
21
|
-
autocomplete=""
|
|
22
|
-
@filter="filterFn"
|
|
23
|
-
>
|
|
24
|
-
<template v-if="multiple" #selected-item="scope">
|
|
25
|
-
<q-chip
|
|
26
|
-
v-if="scope.opt"
|
|
27
|
-
removable
|
|
28
|
-
class="q-ma-none"
|
|
29
|
-
dense
|
|
30
|
-
:tabindex="scope.tabindex"
|
|
31
|
-
color="white"
|
|
32
|
-
text-color="secondary"
|
|
33
|
-
@remove="scope.removeAtIndex(scope.index)"
|
|
34
|
-
>
|
|
35
|
-
{{ scope.opt[`${optionLabel}`] }}
|
|
36
|
-
</q-chip>
|
|
37
|
-
</template>
|
|
38
|
-
<template #no-option>
|
|
39
|
-
<q-item>{{ emptyText }}</q-item>
|
|
40
|
-
</template>
|
|
41
|
-
<q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
|
|
42
|
-
</q-select>
|
|
43
|
-
</template>
|
|
44
|
-
<script setup lang="ts">
|
|
45
|
-
import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
|
|
46
|
-
|
|
47
|
-
import { QSelect } from 'quasar'
|
|
48
|
-
|
|
49
|
-
type Option = Record<string, any>
|
|
50
|
-
|
|
51
|
-
interface AppQSelectProps {
|
|
52
|
-
modelValue: any
|
|
53
|
-
options: Option[]
|
|
54
|
-
placeholder: string
|
|
55
|
-
emptyText: string
|
|
56
|
-
optionLabel?: string
|
|
57
|
-
optionValue?: string
|
|
58
|
-
label?: string
|
|
59
|
-
multiple?: boolean
|
|
60
|
-
borderColor: string
|
|
61
|
-
isDisabled?: boolean
|
|
62
|
-
clearable?: boolean
|
|
63
|
-
search?: boolean
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const props = defineProps<AppQSelectProps>()
|
|
67
|
-
const select = ref({})
|
|
68
|
-
const emit = defineEmits(['update:modelValue'])
|
|
69
|
-
const selected = computed({
|
|
70
|
-
get() {
|
|
71
|
-
return props.modelValue
|
|
72
|
-
},
|
|
73
|
-
set(value) {
|
|
74
|
-
emit('update:modelValue', value)
|
|
75
|
-
},
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const type = () => {
|
|
79
|
-
if (Array.isArray(selected.value) && !selected.value.length) return true
|
|
80
|
-
return typeof selected.value === 'string' && !selected.value
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const lcText: Ref<string> = ref('')
|
|
84
|
-
const filteredOptions = computed(() => {
|
|
85
|
-
return props.options.filter(x => x[props?.optionLabel || 'label'].toLowerCase().includes(lcText.value))
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
function filterFn(val: string, update: (arg0: () => void) => void) {
|
|
89
|
-
update(() => {
|
|
90
|
-
lcText.value = val.toLowerCase()
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
</script>
|
|
94
|
-
<style module lang="scss">
|
|
95
|
-
.wrap {
|
|
96
|
-
position: relative;
|
|
97
|
-
|
|
98
|
-
&:global(.--option-tree) {
|
|
99
|
-
cursor: pointer;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.select {
|
|
104
|
-
&:global(.q-field--outlined.q-field--rounded .q-field__control) {
|
|
105
|
-
border-radius: 14px;
|
|
106
|
-
}
|
|
107
|
-
&:global(.q-field--outlined .q-field__control:before) {
|
|
108
|
-
border-color: v-bind(borderColor);
|
|
109
|
-
}
|
|
110
|
-
&:global(.q-select .q-field__input) {
|
|
111
|
-
padding: 0 6px;
|
|
112
|
-
}
|
|
113
|
-
//&:global(.q-field--filled .q-field__control) {
|
|
114
|
-
// //color: red;
|
|
115
|
-
//}
|
|
116
|
-
//&:global(.q-field--filled.q-field--focused .q-field__control) {
|
|
117
|
-
//}
|
|
118
|
-
//&:global(.q-field--filled .q-field__control:after) {
|
|
119
|
-
// left: 8px;
|
|
120
|
-
// right: 8px;
|
|
121
|
-
//}
|
|
122
|
-
&:global(.q-field--outlined .q-item) {
|
|
123
|
-
color: #1d1d1d;
|
|
124
|
-
position: absolute;
|
|
125
|
-
padding: 0 4px;
|
|
126
|
-
top: 18px;
|
|
127
|
-
left: 0;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.append-wrapper {
|
|
132
|
-
display: flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
column-gap: 4px;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.menu-wrap {
|
|
138
|
-
padding: 8px;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.search-wrapper {
|
|
142
|
-
position: sticky;
|
|
143
|
-
top: 0;
|
|
144
|
-
padding: 4px;
|
|
145
|
-
background: var(--main-bg);
|
|
146
|
-
z-index: 1;
|
|
147
|
-
}
|
|
148
|
-
.app-select__menu {
|
|
149
|
-
border-radius: 14px;
|
|
150
|
-
.q-item__label {
|
|
151
|
-
word-break: break-word;
|
|
152
|
-
}
|
|
153
|
-
&:global(.q-menu) {
|
|
154
|
-
max-height: 200px !important;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-select
|
|
3
|
+
ref="select"
|
|
4
|
+
v-model="selected"
|
|
5
|
+
:options="filteredOptions"
|
|
6
|
+
:option-value="optionValue"
|
|
7
|
+
:option-label="optionLabel"
|
|
8
|
+
emit-value
|
|
9
|
+
map-options
|
|
10
|
+
:disable="isDisabled"
|
|
11
|
+
:multiple="multiple"
|
|
12
|
+
outlined
|
|
13
|
+
stack-label
|
|
14
|
+
:use-input="search"
|
|
15
|
+
:class="[$style.select]"
|
|
16
|
+
:label="label"
|
|
17
|
+
input-debounce="100"
|
|
18
|
+
:popup-content-class="$style['app-select__menu']"
|
|
19
|
+
:clearable="clearable"
|
|
20
|
+
rounded
|
|
21
|
+
autocomplete=""
|
|
22
|
+
@filter="filterFn"
|
|
23
|
+
>
|
|
24
|
+
<template v-if="multiple" #selected-item="scope">
|
|
25
|
+
<q-chip
|
|
26
|
+
v-if="scope.opt"
|
|
27
|
+
removable
|
|
28
|
+
class="q-ma-none"
|
|
29
|
+
dense
|
|
30
|
+
:tabindex="scope.tabindex"
|
|
31
|
+
color="white"
|
|
32
|
+
text-color="secondary"
|
|
33
|
+
@remove="scope.removeAtIndex(scope.index)"
|
|
34
|
+
>
|
|
35
|
+
{{ scope.opt[`${optionLabel}`] }}
|
|
36
|
+
</q-chip>
|
|
37
|
+
</template>
|
|
38
|
+
<template #no-option>
|
|
39
|
+
<q-item>{{ emptyText }}</q-item>
|
|
40
|
+
</template>
|
|
41
|
+
<q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
|
|
42
|
+
</q-select>
|
|
43
|
+
</template>
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
|
|
46
|
+
|
|
47
|
+
import { QSelect } from 'quasar'
|
|
48
|
+
|
|
49
|
+
type Option = Record<string, any>
|
|
50
|
+
|
|
51
|
+
interface AppQSelectProps {
|
|
52
|
+
modelValue: any
|
|
53
|
+
options: Option[]
|
|
54
|
+
placeholder: string
|
|
55
|
+
emptyText: string
|
|
56
|
+
optionLabel?: string
|
|
57
|
+
optionValue?: string
|
|
58
|
+
label?: string
|
|
59
|
+
multiple?: boolean
|
|
60
|
+
borderColor: string
|
|
61
|
+
isDisabled?: boolean
|
|
62
|
+
clearable?: boolean
|
|
63
|
+
search?: boolean
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const props = defineProps<AppQSelectProps>()
|
|
67
|
+
const select = ref({})
|
|
68
|
+
const emit = defineEmits(['update:modelValue'])
|
|
69
|
+
const selected = computed({
|
|
70
|
+
get() {
|
|
71
|
+
return props.modelValue
|
|
72
|
+
},
|
|
73
|
+
set(value) {
|
|
74
|
+
emit('update:modelValue', value)
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const type = () => {
|
|
79
|
+
if (Array.isArray(selected.value) && !selected.value.length) return true
|
|
80
|
+
return typeof selected.value === 'string' && !selected.value
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const lcText: Ref<string> = ref('')
|
|
84
|
+
const filteredOptions = computed(() => {
|
|
85
|
+
return props.options.filter(x => x[props?.optionLabel || 'label'].toLowerCase().includes(lcText.value))
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
function filterFn(val: string, update: (arg0: () => void) => void) {
|
|
89
|
+
update(() => {
|
|
90
|
+
lcText.value = val.toLowerCase()
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
<style module lang="scss">
|
|
95
|
+
.wrap {
|
|
96
|
+
position: relative;
|
|
97
|
+
|
|
98
|
+
&:global(.--option-tree) {
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.select {
|
|
104
|
+
&:global(.q-field--outlined.q-field--rounded .q-field__control) {
|
|
105
|
+
border-radius: 14px;
|
|
106
|
+
}
|
|
107
|
+
&:global(.q-field--outlined .q-field__control:before) {
|
|
108
|
+
border-color: v-bind(borderColor);
|
|
109
|
+
}
|
|
110
|
+
&:global(.q-select .q-field__input) {
|
|
111
|
+
padding: 0 6px;
|
|
112
|
+
}
|
|
113
|
+
//&:global(.q-field--filled .q-field__control) {
|
|
114
|
+
// //color: red;
|
|
115
|
+
//}
|
|
116
|
+
//&:global(.q-field--filled.q-field--focused .q-field__control) {
|
|
117
|
+
//}
|
|
118
|
+
//&:global(.q-field--filled .q-field__control:after) {
|
|
119
|
+
// left: 8px;
|
|
120
|
+
// right: 8px;
|
|
121
|
+
//}
|
|
122
|
+
&:global(.q-field--outlined .q-item) {
|
|
123
|
+
color: #1d1d1d;
|
|
124
|
+
position: absolute;
|
|
125
|
+
padding: 0 4px;
|
|
126
|
+
top: 18px;
|
|
127
|
+
left: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.append-wrapper {
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
column-gap: 4px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.menu-wrap {
|
|
138
|
+
padding: 8px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.search-wrapper {
|
|
142
|
+
position: sticky;
|
|
143
|
+
top: 0;
|
|
144
|
+
padding: 4px;
|
|
145
|
+
background: var(--main-bg);
|
|
146
|
+
z-index: 1;
|
|
147
|
+
}
|
|
148
|
+
.app-select__menu {
|
|
149
|
+
border-radius: 14px;
|
|
150
|
+
.q-item__label {
|
|
151
|
+
word-break: break-word;
|
|
152
|
+
}
|
|
153
|
+
&:global(.q-menu) {
|
|
154
|
+
max-height: 200px !important;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
</style>
|