shared-ritm 1.3.132 → 1.3.135

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.
@@ -1,167 +1,167 @@
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 && hideChips" #selected>
26
- <div v-if="Array.isArray(selected) && selected.length" class="q-field__input">
27
- <span class="selected-counter">Выбрано: {{ selected.length }} </span>
28
- </div>
29
- </template>
30
-
31
- <template v-else-if="multiple" #selected-item="scope">
32
- <q-chip
33
- v-if="scope.opt"
34
- removable
35
- class="q-ma-none"
36
- dense
37
- :tabindex="scope.tabindex"
38
- color="white"
39
- text-color="secondary"
40
- @remove="scope.removeAtIndex(scope.index)"
41
- >
42
- {{ scope.opt[`${optionLabel}`] }}
43
- </q-chip>
44
- </template>
45
- <template #no-option>
46
- <q-item>{{ emptyText }}</q-item>
47
- </template>
48
- <q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
49
- </q-select>
50
- </template>
51
- <script setup lang="ts">
52
- import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
53
-
54
- import { QSelect } from 'quasar'
55
-
56
- type Option = Record<string, any>
57
-
58
- interface AppQSelectProps {
59
- modelValue: any
60
- options: Option[]
61
- placeholder: string
62
- emptyText: string
63
- optionLabel?: string
64
- optionValue?: string
65
- label?: string
66
- multiple?: boolean
67
- borderColor: string
68
- isDisabled?: boolean
69
- clearable?: boolean
70
- search?: boolean
71
- dataTest?: string
72
- hideChips?: boolean
73
- }
74
-
75
- const props = defineProps<AppQSelectProps>()
76
- const select = ref({})
77
- const emit = defineEmits(['update:modelValue'])
78
- const selected = computed({
79
- get() {
80
- return props.modelValue
81
- },
82
- set(value) {
83
- emit('update:modelValue', value)
84
- },
85
- })
86
-
87
- const type = () => {
88
- if (Array.isArray(selected.value) || props.multiple) return !selected.value?.length
89
-
90
- return !selected.value
91
- }
92
-
93
- const lcText: Ref<string> = ref('')
94
- const filteredOptions = computed(() => {
95
- return props.options.filter(x => (x[props?.optionLabel || 'label'] || '-').toLowerCase().includes(lcText.value))
96
- })
97
-
98
- function filterFn(val: string, update: (arg0: () => void) => void) {
99
- update(() => {
100
- lcText.value = val.toLowerCase()
101
- })
102
- }
103
- </script>
104
- <style module lang="scss">
105
- .wrap {
106
- position: relative;
107
-
108
- &:global(.--option-tree) {
109
- cursor: pointer;
110
- }
111
- }
112
-
113
- .select {
114
- &:global(.q-field--outlined.q-field--rounded .q-field__control) {
115
- border-radius: 14px;
116
- }
117
- &:global(.q-field--outlined .q-field__control:before) {
118
- border-color: v-bind(borderColor);
119
- }
120
- &:global(.q-select .q-field__input) {
121
- padding: 0 6px;
122
- }
123
- //&:global(.q-field--filled .q-field__control) {
124
- // //color: red;
125
- //}
126
- //&:global(.q-field--filled.q-field--focused .q-field__control) {
127
- //}
128
- //&:global(.q-field--filled .q-field__control:after) {
129
- // left: 8px;
130
- // right: 8px;
131
- //}
132
- &:global(.q-field--outlined .q-item) {
133
- color: #1d1d1d;
134
- position: absolute;
135
- padding: 0 4px;
136
- top: 18px;
137
- left: 0;
138
- }
139
- }
140
-
141
- .append-wrapper {
142
- display: flex;
143
- align-items: center;
144
- column-gap: 4px;
145
- }
146
-
147
- .menu-wrap {
148
- padding: 8px;
149
- }
150
-
151
- .search-wrapper {
152
- position: sticky;
153
- top: 0;
154
- padding: 4px;
155
- background: var(--main-bg);
156
- z-index: 1;
157
- }
158
- .app-select__menu {
159
- border-radius: 14px;
160
- .q-item__label {
161
- word-break: break-word;
162
- }
163
- &:global(.q-menu) {
164
- max-height: 200px !important;
165
- }
166
- }
167
- </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 && hideChips" #selected>
26
+ <div v-if="Array.isArray(selected) && selected.length" class="q-field__input">
27
+ <span class="selected-counter">Выбрано: {{ selected.length }} </span>
28
+ </div>
29
+ </template>
30
+
31
+ <template v-else-if="multiple" #selected-item="scope">
32
+ <q-chip
33
+ v-if="scope.opt"
34
+ removable
35
+ class="q-ma-none"
36
+ dense
37
+ :tabindex="scope.tabindex"
38
+ color="white"
39
+ text-color="secondary"
40
+ @remove="scope.removeAtIndex(scope.index)"
41
+ >
42
+ {{ scope.opt[`${optionLabel}`] }}
43
+ </q-chip>
44
+ </template>
45
+ <template #no-option>
46
+ <q-item>{{ emptyText }}</q-item>
47
+ </template>
48
+ <q-item v-if="!lcText && type()">{{ placeholder }}</q-item>
49
+ </q-select>
50
+ </template>
51
+ <script setup lang="ts">
52
+ import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
53
+
54
+ import { QSelect } from 'quasar'
55
+
56
+ type Option = Record<string, any>
57
+
58
+ interface AppQSelectProps {
59
+ modelValue: any
60
+ options: Option[]
61
+ placeholder: string
62
+ emptyText: string
63
+ optionLabel?: string
64
+ optionValue?: string
65
+ label?: string
66
+ multiple?: boolean
67
+ borderColor: string
68
+ isDisabled?: boolean
69
+ clearable?: boolean
70
+ search?: boolean
71
+ dataTest?: string
72
+ hideChips?: boolean
73
+ }
74
+
75
+ const props = defineProps<AppQSelectProps>()
76
+ const select = ref({})
77
+ const emit = defineEmits(['update:modelValue'])
78
+ const selected = computed({
79
+ get() {
80
+ return props.modelValue
81
+ },
82
+ set(value) {
83
+ emit('update:modelValue', value)
84
+ },
85
+ })
86
+
87
+ const type = () => {
88
+ if (Array.isArray(selected.value) || props.multiple) return !selected.value?.length
89
+
90
+ return !selected.value
91
+ }
92
+
93
+ const lcText: Ref<string> = ref('')
94
+ const filteredOptions = computed(() => {
95
+ return props.options.filter(x => (x[props?.optionLabel || 'label'] || '-').toLowerCase().includes(lcText.value))
96
+ })
97
+
98
+ function filterFn(val: string, update: (arg0: () => void) => void) {
99
+ update(() => {
100
+ lcText.value = val.toLowerCase()
101
+ })
102
+ }
103
+ </script>
104
+ <style module lang="scss">
105
+ .wrap {
106
+ position: relative;
107
+
108
+ &:global(.--option-tree) {
109
+ cursor: pointer;
110
+ }
111
+ }
112
+
113
+ .select {
114
+ &:global(.q-field--outlined.q-field--rounded .q-field__control) {
115
+ border-radius: 14px;
116
+ }
117
+ &:global(.q-field--outlined .q-field__control:before) {
118
+ border-color: v-bind(borderColor);
119
+ }
120
+ &:global(.q-select .q-field__input) {
121
+ padding: 0 6px;
122
+ }
123
+ //&:global(.q-field--filled .q-field__control) {
124
+ // //color: red;
125
+ //}
126
+ //&:global(.q-field--filled.q-field--focused .q-field__control) {
127
+ //}
128
+ //&:global(.q-field--filled .q-field__control:after) {
129
+ // left: 8px;
130
+ // right: 8px;
131
+ //}
132
+ &:global(.q-field--outlined .q-item) {
133
+ color: #1d1d1d;
134
+ position: absolute;
135
+ padding: 0 4px;
136
+ top: 18px;
137
+ left: 0;
138
+ }
139
+ }
140
+
141
+ .append-wrapper {
142
+ display: flex;
143
+ align-items: center;
144
+ column-gap: 4px;
145
+ }
146
+
147
+ .menu-wrap {
148
+ padding: 8px;
149
+ }
150
+
151
+ .search-wrapper {
152
+ position: sticky;
153
+ top: 0;
154
+ padding: 4px;
155
+ background: var(--main-bg);
156
+ z-index: 1;
157
+ }
158
+ .app-select__menu {
159
+ border-radius: 14px;
160
+ .q-item__label {
161
+ word-break: break-word;
162
+ }
163
+ &:global(.q-menu) {
164
+ max-height: 200px !important;
165
+ }
166
+ }
167
+ </style>