shared-ritm 1.2.87 → 1.2.89

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,270 +1,270 @@
1
- <template>
2
- <label class="field-label">
3
- {{ label }}
4
- <span v-if="rules?.length && isShowRequired" class="required">*</span>
5
- </label>
6
-
7
- <q-select
8
- ref="select"
9
- v-model="selected"
10
- :options="filteredOptions"
11
- :disable="isDisabled"
12
- :multiple="multiple"
13
- :popup-content-class="'custom-select-menu'"
14
- :hide-selected="!showChip && !simple"
15
- :placeholder="placeholder"
16
- :loading="loading"
17
- :option-value="optionValue || 'value'"
18
- :option-label="optionLabel || 'label'"
19
- emit-value
20
- filled
21
- map-options
22
- stack-label
23
- use-input
24
- :use-chips="!simple"
25
- :hide-bottom-space="hideBottomSpace"
26
- input-debounce="100"
27
- autocomplete=""
28
- :rules="rules"
29
- @virtual-scroll="onScroll"
30
- @filter="filterFn"
31
- >
32
- <template v-if="multiple || showChip" #selected-item="scope">
33
- <q-chip
34
- v-if="scope.opt"
35
- removable
36
- :tabindex="scope.tabindex"
37
- :style="{ backgroundColor: chipColor }"
38
- icon-remove="close"
39
- text-color="secondary"
40
- @remove="scope.removeAtIndex(scope.index)"
41
- >
42
- {{ scope.opt[optionLabel || 'label'] }}
43
- </q-chip>
44
- </template>
45
-
46
- <template #append>
47
- <q-icon
48
- v-if="!isDisabled && selected && (selected.length || selected > 0)"
49
- name="close"
50
- class="cursor-pointer clear-input"
51
- @click.stop="handleClear"
52
- />
53
- </template>
54
-
55
- <template #no-option>
56
- <div class="q-pa-sm">
57
- <q-item>
58
- <q-item-section class="wrapper-empty-text">
59
- {{ emptyText || 'Ничего не найдено' }}
60
- <button
61
- v-if="allowCreate && internalSearch && internalSearch.trim()"
62
- class="add-new-items"
63
- @click="handleCreateFromSearch"
64
- >
65
- Добавить
66
- </button>
67
- </q-item-section>
68
- </q-item>
69
- </div>
70
- </template>
71
-
72
- <template #option="scope">
73
- <q-item v-if="scope.opt.__loading" class="q-py-md q-ml-md">
74
- <q-spinner-dots size="24px" color="primary" />
75
- </q-item>
76
- <q-item v-else v-bind="scope.itemProps">
77
- <q-item-section>{{ scope.opt[optionLabel || 'label'] }}</q-item-section>
78
- </q-item>
79
- </template>
80
- </q-select>
81
- </template>
82
-
83
- <script setup lang="ts">
84
- import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
85
- type Option = Record<string, any>
86
-
87
- interface AppQSelectProps {
88
- modelValue: any
89
- options: Option[]
90
- placeholder?: string | undefined
91
- emptyText?: string
92
- optionLabel?: string
93
- optionValue?: string
94
- label?: string
95
- multiple?: boolean
96
- loading?: boolean
97
- isShowRequired?: boolean
98
- isDisabled?: boolean
99
- allowCreate?: boolean
100
- isSearch?: boolean
101
- showChip?: boolean
102
- simple?: boolean
103
- hideBottomSpace?: boolean
104
- chipColor?: string
105
- height?: string
106
- borderColor?: string
107
- borderRadius?: string
108
- menuWidth?: string
109
- rules?: ((val: any) => boolean | string)[]
110
- }
111
-
112
- const props = defineProps<AppQSelectProps>()
113
- const emit = defineEmits(['update:modelValue', 'update:scroll', 'update:search', 'clear', 'create'])
114
-
115
- const select = ref({})
116
- const lcText: Ref<string> = ref('')
117
- const internalSearch = ref('')
118
-
119
- const selected = computed({
120
- get() {
121
- return props.modelValue
122
- },
123
- set(value) {
124
- emit('update:modelValue', value)
125
- },
126
- })
127
-
128
- function handleClear() {
129
- const emptyValue = props.multiple ? [] : null
130
- selected.value = emptyValue
131
- lcText.value = ''
132
- emit('update:modelValue', emptyValue)
133
- emit('clear')
134
- }
135
-
136
- const filteredOptions = computed(() => {
137
- const labelKey = props.optionLabel || 'label'
138
-
139
- const baseOptions = props.options.filter(x => {
140
- const label = x[labelKey]
141
- return typeof label === 'string' && label.toLowerCase().includes(lcText.value)
142
- })
143
-
144
- if (props.loading) {
145
- return [
146
- ...baseOptions,
147
- {
148
- __loading: true,
149
- label: '__loading__',
150
- value: '__loading__',
151
- },
152
- ]
153
- }
154
-
155
- return baseOptions
156
- })
157
-
158
- function handleCreateFromSearch() {
159
- const labelKey = props.optionLabel || 'label'
160
- const valueKey = props.optionValue || 'value'
161
-
162
- const trimmed = internalSearch.value?.trim()
163
- if (!trimmed) return
164
-
165
- const newOption = {
166
- [labelKey]: trimmed,
167
- [valueKey]: trimmed,
168
- }
169
- emit('create', newOption)
170
- handleClear()
171
- }
172
-
173
- function filterFn(val: string, update: (cb: () => void) => void) {
174
- debouncedFilter(val, update)
175
- }
176
-
177
- const debouncedFilter = debounce((val: string, update: (cb: () => void) => void) => {
178
- internalSearch.value = val
179
- emit('update:search', val)
180
- update(() => {
181
- lcText.value = val.toLowerCase()
182
- })
183
- }, 500)
184
-
185
- function onScroll({ to, ref: qSelectRef }) {
186
- const totalOptions = qSelectRef.options.length
187
- if (to >= totalOptions - 1 && !lcText.value) {
188
- emit('update:scroll')
189
- }
190
- }
191
-
192
- function debounce<T>(fn: T, ms) {
193
- let timeoutId
194
- return function (...args) {
195
- clearTimeout(timeoutId)
196
- return new Promise(resolve => {
197
- timeoutId = setTimeout(() => {
198
- resolve(fn(...args))
199
- }, ms)
200
- })
201
- }
202
- }
203
- </script>
204
-
205
- <style lang="scss" scoped>
206
- .wrapper-empty-text {
207
- display: flex;
208
- align-items: center;
209
- justify-content: space-between;
210
- flex-direction: row;
211
- .add-new-items {
212
- background: #3f8cff;
213
- color: #fff;
214
- outline: none;
215
- border: none;
216
- border-radius: 4px;
217
- padding: 5px 10px;
218
- cursor: pointer;
219
- }
220
- }
221
- .field-label {
222
- font-size: 14px;
223
- font-weight: 700;
224
- color: #7d8592;
225
- }
226
- .required {
227
- color: #f65160;
228
- font-weight: bold;
229
- }
230
-
231
- ::v-deep(.q-placeholder) {
232
- color: #7d8592;
233
- }
234
- ::v-deep(.q-field__control) {
235
- border-radius: 8px;
236
- border: 1px solid #d8e0f0;
237
- background: #fff;
238
- box-shadow: 0 1px 2px 0 rgba(184, 200, 224, 0.22);
239
- }
240
- :deep(.q-field__control:before) {
241
- display: none;
242
- }
243
- :global(.q-field--filled.q-field--highlighted .q-field__control:before) {
244
- background: #fff !important;
245
- border: none;
246
- }
247
- ::v-deep(.q-field--with-bottom) {
248
- padding-bottom: 0;
249
- }
250
- ::v-deep(.q-field__bottom) {
251
- padding: 0;
252
- }
253
- .clear-input {
254
- color: #d8e0f0;
255
- }
256
- ::v-deep(.q-chip) {
257
- border-radius: 4px;
258
- background: #e9eff9;
259
- color: #1d425d;
260
- font-family: NunitoSansFont, sans-serif;
261
- font-size: 14px;
262
- height: 30px;
263
- line-height: 30px;
264
- padding: 0 15px;
265
- .q-chip__icon {
266
- color: #3f8cff;
267
- margin-left: 5px;
268
- }
269
- }
270
- </style>
1
+ <template>
2
+ <label class="field-label">
3
+ {{ label }}
4
+ <span v-if="rules?.length && isShowRequired" class="required">*</span>
5
+ </label>
6
+
7
+ <q-select
8
+ ref="select"
9
+ v-model="selected"
10
+ :options="filteredOptions"
11
+ :disable="isDisabled"
12
+ :multiple="multiple"
13
+ :popup-content-class="'custom-select-menu'"
14
+ :hide-selected="!showChip && !simple"
15
+ :placeholder="placeholder"
16
+ :loading="loading"
17
+ :option-value="optionValue || 'value'"
18
+ :option-label="optionLabel || 'label'"
19
+ emit-value
20
+ filled
21
+ map-options
22
+ stack-label
23
+ use-input
24
+ :use-chips="!simple"
25
+ :hide-bottom-space="hideBottomSpace"
26
+ input-debounce="100"
27
+ autocomplete=""
28
+ :rules="rules"
29
+ @virtual-scroll="onScroll"
30
+ @filter="filterFn"
31
+ >
32
+ <template v-if="multiple || showChip" #selected-item="scope">
33
+ <q-chip
34
+ v-if="scope.opt"
35
+ removable
36
+ :tabindex="scope.tabindex"
37
+ :style="{ backgroundColor: chipColor }"
38
+ icon-remove="close"
39
+ text-color="secondary"
40
+ @remove="scope.removeAtIndex(scope.index)"
41
+ >
42
+ {{ scope.opt[optionLabel || 'label'] }}
43
+ </q-chip>
44
+ </template>
45
+
46
+ <template #append>
47
+ <q-icon
48
+ v-if="!isDisabled && selected && (selected.length || selected > 0)"
49
+ name="close"
50
+ class="cursor-pointer clear-input"
51
+ @click.stop="handleClear"
52
+ />
53
+ </template>
54
+
55
+ <template #no-option>
56
+ <div class="q-pa-sm">
57
+ <q-item>
58
+ <q-item-section class="wrapper-empty-text">
59
+ {{ emptyText || 'Ничего не найдено' }}
60
+ <button
61
+ v-if="allowCreate && internalSearch && internalSearch.trim()"
62
+ class="add-new-items"
63
+ @click="handleCreateFromSearch"
64
+ >
65
+ Добавить
66
+ </button>
67
+ </q-item-section>
68
+ </q-item>
69
+ </div>
70
+ </template>
71
+
72
+ <template #option="scope">
73
+ <q-item v-if="scope.opt.__loading" class="q-py-md q-ml-md">
74
+ <q-spinner-dots size="24px" color="primary" />
75
+ </q-item>
76
+ <q-item v-else v-bind="scope.itemProps">
77
+ <q-item-section>{{ scope.opt[optionLabel || 'label'] }}</q-item-section>
78
+ </q-item>
79
+ </template>
80
+ </q-select>
81
+ </template>
82
+
83
+ <script setup lang="ts">
84
+ import { computed, defineEmits, defineProps, ref, Ref } from 'vue'
85
+ type Option = Record<string, any>
86
+
87
+ interface AppQSelectProps {
88
+ modelValue: any
89
+ options: Option[]
90
+ placeholder?: string | undefined
91
+ emptyText?: string
92
+ optionLabel?: string
93
+ optionValue?: string
94
+ label?: string
95
+ multiple?: boolean
96
+ loading?: boolean
97
+ isShowRequired?: boolean
98
+ isDisabled?: boolean
99
+ allowCreate?: boolean
100
+ isSearch?: boolean
101
+ showChip?: boolean
102
+ simple?: boolean
103
+ hideBottomSpace?: boolean
104
+ chipColor?: string
105
+ height?: string
106
+ borderColor?: string
107
+ borderRadius?: string
108
+ menuWidth?: string
109
+ rules?: ((val: any) => boolean | string)[]
110
+ }
111
+
112
+ const props = defineProps<AppQSelectProps>()
113
+ const emit = defineEmits(['update:modelValue', 'update:scroll', 'update:search', 'clear', 'create'])
114
+
115
+ const select = ref({})
116
+ const lcText: Ref<string> = ref('')
117
+ const internalSearch = ref('')
118
+
119
+ const selected = computed({
120
+ get() {
121
+ return props.modelValue
122
+ },
123
+ set(value) {
124
+ emit('update:modelValue', value)
125
+ },
126
+ })
127
+
128
+ function handleClear() {
129
+ const emptyValue = props.multiple ? [] : null
130
+ selected.value = emptyValue
131
+ lcText.value = ''
132
+ emit('update:modelValue', emptyValue)
133
+ emit('clear')
134
+ }
135
+
136
+ const filteredOptions = computed(() => {
137
+ const labelKey = props.optionLabel || 'label'
138
+
139
+ const baseOptions = props.options.filter(x => {
140
+ const label = x[labelKey]
141
+ return typeof label === 'string' && label.toLowerCase().includes(lcText.value)
142
+ })
143
+
144
+ if (props.loading) {
145
+ return [
146
+ ...baseOptions,
147
+ {
148
+ __loading: true,
149
+ label: '__loading__',
150
+ value: '__loading__',
151
+ },
152
+ ]
153
+ }
154
+
155
+ return baseOptions
156
+ })
157
+
158
+ function handleCreateFromSearch() {
159
+ const labelKey = props.optionLabel || 'label'
160
+ const valueKey = props.optionValue || 'value'
161
+
162
+ const trimmed = internalSearch.value?.trim()
163
+ if (!trimmed) return
164
+
165
+ const newOption = {
166
+ [labelKey]: trimmed,
167
+ [valueKey]: trimmed,
168
+ }
169
+ emit('create', newOption)
170
+ handleClear()
171
+ }
172
+
173
+ function filterFn(val: string, update: (cb: () => void) => void) {
174
+ debouncedFilter(val, update)
175
+ }
176
+
177
+ const debouncedFilter = debounce((val: string, update: (cb: () => void) => void) => {
178
+ internalSearch.value = val
179
+ emit('update:search', val)
180
+ update(() => {
181
+ lcText.value = val.toLowerCase()
182
+ })
183
+ }, 500)
184
+
185
+ function onScroll({ to, ref: qSelectRef }) {
186
+ const totalOptions = qSelectRef.options.length
187
+ if (to >= totalOptions - 1 && !lcText.value) {
188
+ emit('update:scroll')
189
+ }
190
+ }
191
+
192
+ function debounce<T>(fn: T, ms) {
193
+ let timeoutId
194
+ return function (...args) {
195
+ clearTimeout(timeoutId)
196
+ return new Promise(resolve => {
197
+ timeoutId = setTimeout(() => {
198
+ resolve(fn(...args))
199
+ }, ms)
200
+ })
201
+ }
202
+ }
203
+ </script>
204
+
205
+ <style lang="scss" scoped>
206
+ .wrapper-empty-text {
207
+ display: flex;
208
+ align-items: center;
209
+ justify-content: space-between;
210
+ flex-direction: row;
211
+ .add-new-items {
212
+ background: #3f8cff;
213
+ color: #fff;
214
+ outline: none;
215
+ border: none;
216
+ border-radius: 4px;
217
+ padding: 5px 10px;
218
+ cursor: pointer;
219
+ }
220
+ }
221
+ .field-label {
222
+ font-size: 14px;
223
+ font-weight: 700;
224
+ color: #7d8592;
225
+ }
226
+ .required {
227
+ color: #f65160;
228
+ font-weight: bold;
229
+ }
230
+
231
+ ::v-deep(.q-placeholder) {
232
+ color: #7d8592;
233
+ }
234
+ ::v-deep(.q-field__control) {
235
+ border-radius: 8px;
236
+ border: 1px solid #d8e0f0;
237
+ background: #fff;
238
+ box-shadow: 0 1px 2px 0 rgba(184, 200, 224, 0.22);
239
+ }
240
+ :deep(.q-field__control:before) {
241
+ display: none;
242
+ }
243
+ :global(.q-field--filled.q-field--highlighted .q-field__control:before) {
244
+ background: #fff !important;
245
+ border: none;
246
+ }
247
+ ::v-deep(.q-field--with-bottom) {
248
+ padding-bottom: 0;
249
+ }
250
+ ::v-deep(.q-field__bottom) {
251
+ padding: 0;
252
+ }
253
+ .clear-input {
254
+ color: #d8e0f0;
255
+ }
256
+ ::v-deep(.q-chip) {
257
+ border-radius: 4px;
258
+ background: #e9eff9;
259
+ color: #1d425d;
260
+ font-family: NunitoSansFont, sans-serif;
261
+ font-size: 14px;
262
+ height: 30px;
263
+ line-height: 30px;
264
+ padding: 0 15px;
265
+ .q-chip__icon {
266
+ color: #3f8cff;
267
+ margin-left: 5px;
268
+ }
269
+ }
270
+ </style>
@@ -77,17 +77,18 @@
77
77
  </q-card-section>
78
78
 
79
79
  <q-card-actions align="center">
80
- <q-btn v-if="mode === 'view'" class="remove" flat label="Удалить" @click="emit('delete')" />
80
+ <q-btn v-if="mode === 'view'" class="remove" flat label="Удалить" :loading="loading" @click="emit('delete')" />
81
81
  <q-btn
82
82
  v-if="mode !== 'view'"
83
83
  class="confirm"
84
84
  flat
85
85
  :label="mode === 'edit' ? 'Сохранить' : 'Создать'"
86
86
  :disable="isSubmitDisabled"
87
+ :loading="loading"
87
88
  @click="submit"
88
89
  />
89
- <q-btn v-else class="confirm" flat label="Редактировать" @click="$emit('edit')" />
90
- <q-btn v-close-popup class="cancel" flat label="Закрыть" />
90
+ <q-btn v-else class="confirm" flat label="Редактировать" :disable="loading" @click="$emit('edit')" />
91
+ <q-btn v-close-popup class="cancel" flat label="Закрыть" :disable="loading" />
91
92
  </q-card-actions>
92
93
  </q-card>
93
94
  </q-dialog>
@@ -125,6 +126,7 @@ const props = defineProps<{
125
126
  mode: ModalMode
126
127
  fields: FieldSchema[]
127
128
  initialData?: Record<string, any>
129
+ loading?: boolean
128
130
  }>()
129
131
  const emit = defineEmits<{
130
132
  (e: 'update:modelValue', val: boolean): void
@@ -25,7 +25,10 @@ export function useBaseTable(model: {
25
25
 
26
26
  watch(
27
27
  () => model.columnFilters.value,
28
- () => loadTable(search.value, currentPage.value),
28
+ async () => {
29
+ currentPage.value = 1
30
+ await loadTable(search.value, currentPage.value)
31
+ },
29
32
  { deep: true },
30
33
  )
31
34
 
@@ -1,12 +1,12 @@
1
- $primary : #1976D2
2
- $secondary : #C4C4C4
3
- $accent : #665BA6
4
- $positive : #3B9F69
5
- $negative : #C10015
6
- $info : #31CCEC
7
- $warning : #F2C037
8
-
9
- $dark : #1D1D1D
10
- $dark-page : #121212
11
-
12
- $secondary: #1D1D1D
1
+ $primary : #1976D2
2
+ $secondary : #C4C4C4
3
+ $accent : #665BA6
4
+ $positive : #3B9F69
5
+ $negative : #C10015
6
+ $info : #31CCEC
7
+ $warning : #F2C037
8
+
9
+ $dark : #1D1D1D
10
+ $dark-page : #121212
11
+
12
+ $secondary: #1D1D1D
@@ -1,10 +0,0 @@
1
- import ApiService from '@/api/settings/ApiService'
2
- import { Api_Comment_Request_Dto } from '@/api/types/Api_Comment'
3
- import { Api_Tasks_Task_Dto } from '@/api/types/Api_Tasks'
4
- declare class CommentsService extends ApiService {
5
- uploadComment(payload: Api_Comment_Request_Dto): Promise<Api_Tasks_Task_Dto>
6
- deleteComment(commentId: string): Promise<unknown>
7
- editComment(payload: { commentId: string; data: unknown }): Promise<unknown>
8
- }
9
- export default function useCommentsService(): CommentsService
10
- export {}
@@ -1,43 +0,0 @@
1
- export type Api_Search_User_Passes = {
2
- id: string
3
- type: string
4
- uuid: string
5
- }
6
- export type Api_Search_User_Positions = {
7
- id: string
8
- name: string
9
- display_name: string
10
- description: string
11
- }
12
- export type Api_Search_User_Roles = {
13
- id: string
14
- name: string
15
- display_name: string
16
- }
17
- export type Api_Search_User_Teams = {
18
- id: string
19
- name: string
20
- display_name: string
21
- roles: Api_Search_User_Roles[]
22
- }
23
- export type Api_Search_User_Photos = {
24
- id: string
25
- name: string
26
- path: string
27
- type: string
28
- }
29
- export type Api_Search_User = {
30
- id: string
31
- full_name: string
32
- last_name: string
33
- first_name: string
34
- patronymic: string
35
- email: string
36
- phone: string
37
- divisions: string
38
- personnel_number: string
39
- passes: Api_Search_User_Passes[]
40
- positions: Api_Search_User_Positions[]
41
- teams: Api_Search_User_Teams[]
42
- photos: Api_Search_User_Photos[]
43
- }