shared-ritm 1.2.101 → 1.2.102

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.
Files changed (31) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared-ritm.es.js +14 -13
  3. package/dist/shared-ritm.umd.js +6 -6
  4. package/dist/types/api/services/ComentsServise.d.ts +10 -0
  5. package/dist/types/api/services/PhotoService.d.ts +51 -38
  6. package/dist/types/api/services/SearchService.d.ts +2 -1
  7. package/dist/types/api/types/Api_Search.d.ts +9 -0
  8. package/dist/types/api/types/Api_Users.d.ts +43 -0
  9. package/package.json +64 -64
  10. package/src/api/services/EquipmentService.ts +29 -29
  11. package/src/api/services/InstrumentsService.ts +22 -22
  12. package/src/api/services/SearchService.ts +4 -1
  13. package/src/api/services/UserService.ts +101 -101
  14. package/src/api/services/VideoService.ts +62 -62
  15. package/src/api/settings/ApiService.ts +123 -123
  16. package/src/api/types/Api_Equipment.ts +3 -3
  17. package/src/api/types/Api_Instruments.ts +98 -98
  18. package/src/api/types/Api_Search.ts +10 -0
  19. package/src/api/types/Api_User.ts +117 -117
  20. package/src/api/types/Api_Video.ts +123 -123
  21. package/src/common/app-input-new/AppInputNew.vue +167 -167
  22. package/src/common/app-layout/components/AppLayoutHeader.vue +250 -250
  23. package/src/common/app-sheet/AppSheet.vue +1 -1
  24. package/src/common/app-sheet-new/AppSheetNew.vue +246 -246
  25. package/src/common/app-table/AppTable.vue +312 -312
  26. package/src/common/app-table/AppTableLayout.vue +137 -137
  27. package/src/common/app-table/components/ModalSelect.vue +270 -270
  28. package/src/common/app-table/components/TableModal.vue +356 -356
  29. package/src/common/app-table/controllers/useBaseTable.ts +45 -45
  30. package/src/index.ts +116 -116
  31. package/src/styles/variables.sass +12 -12
@@ -1,312 +1,312 @@
1
- <template>
2
- <div class="flex flex-col" style="height: 100%; min-height: 100%">
3
- <q-table
4
- v-model:selected="selected"
5
- :rows="rows.value"
6
- :columns="resCols"
7
- row-key="id"
8
- flat
9
- bordered
10
- hide-bottom
11
- class="full-width"
12
- :rows-per-page-options="[0]"
13
- :selection="props.enableMultiSelect ? 'multiple' : 'none'"
14
- style="height: 100%"
15
- @row-click="rowClick"
16
- >
17
- <template #header-selection="scope">
18
- <q-toggle v-model="scope.selected" />
19
- </template>
20
-
21
- <template #body-selection="scope">
22
- <q-toggle v-model="scope.selected" />
23
- </template>
24
-
25
- <template #body-cell-index="cellProps">
26
- <q-td :props="cellProps" class="text-center" :class="{ 'q-td--no-hover': noHover }">
27
- {{ getIndex(cellProps.rowIndex) }}
28
- </q-td>
29
- </template>
30
-
31
- <template v-for="col in resCols" :key="col.name" #[`header-cell-${col.name}`]="propsSlot">
32
- <q-th
33
- :props="propsSlot"
34
- :class="{ 'cursor-pointer': col.filterType, actions: col.name === 'actions' }"
35
- :style="col.style"
36
- >
37
- <div
38
- v-if="col.filterType"
39
- class="row items-center no-wrap"
40
- @click.stop="emit('open-filter-menu', col.name, !filterMenus.value[col.name])"
41
- >
42
- <filter-icon class="q-mr-xs" />
43
- <span>{{ col.label }}</span>
44
- <div
45
- v-if="['multi', 'single'].includes(col.filterType) && columnFilters.value[col.name]?.length"
46
- class="label-length"
47
- >
48
- - {{ col.filterType === 'multi' ? columnFilters.value[col.name]?.length : 1 }}
49
- </div>
50
- </div>
51
- <div v-else>{{ col.label }}</div>
52
-
53
- <q-menu
54
- v-if="col.filterType"
55
- :model-value="filterMenus.value[col.name]"
56
- fit
57
- max-height="300px"
58
- class="filter-menu"
59
- @update:model-value="isOpen => emit('open-filter-menu', col.name, isOpen)"
60
- >
61
- <div class="filter-content">
62
- <q-input v-model="localSearches[col.name]" dense outlined placeholder="Поиск" class="q-mb-sm" clearable />
63
- <q-scroll-area style="height: 200px">
64
- <q-list style="min-width: 200px">
65
- <q-item v-for="option in filteredOptions[col.name]" :key="`${col.name}-${option.id}`" tag="label">
66
- <q-item-section avatar>
67
- <q-checkbox
68
- v-if="col.filterType === 'multi'"
69
- dense
70
- :model-value="
71
- Array.isArray(columnFilters.value[col.name]) &&
72
- columnFilters.value[col.name]?.includes(option.name)
73
- "
74
- @update:model-value="() => emit('toggle-filter-value', col.name, option.name)"
75
- />
76
- <q-radio
77
- v-else
78
- dense
79
- :model-value="columnFilters.value[col.name]"
80
- :val="option.name"
81
- @update:model-value="emit('toggle-filter-value', col.name, $event)"
82
- />
83
- </q-item-section>
84
- <q-item-section>{{ option.name }}</q-item-section>
85
- </q-item>
86
- </q-list>
87
- </q-scroll-area>
88
-
89
- <div class="filter-footer">
90
- <q-btn color="negative" flat dense label="Сбросить фильтр" @click="emit('clear-filter', col.name)" />
91
- </div>
92
- </div>
93
- </q-menu>
94
- </q-th>
95
- </template>
96
-
97
- <template #body-cell="cellProps">
98
- <q-td
99
- :props="cellProps"
100
- :class="{
101
- 'q-td--no-hover': noHover || cellProps.col.name === 'actions',
102
- actions: cellProps.col.name === 'actions',
103
- }"
104
- >
105
- <div v-if="cellProps.col.name === 'actions'" class="actions__btns">
106
- <q-btn square icon="edit" size="sm" unelevated title="Редактировать" @click="emit('edit', cellProps.row)" />
107
- </div>
108
- <q-badge
109
- v-else-if="cellProps.col.badge && typeof cellProps.value === 'boolean'"
110
- :color="
111
- cellProps.col.badge.colorTrue && cellProps.value
112
- ? cellProps.col.badge.colorTrue
113
- : cellProps.col.badge.colorFalse && !cellProps.value
114
- ? cellProps.col.badge.colorFalse
115
- : cellProps.value
116
- ? 'green'
117
- : 'red'
118
- "
119
- outline
120
- class="text-bold"
121
- >
122
- {{ cellProps.value ? cellProps.col.badge.true ?? 'Да' : cellProps.col.badge.false ?? 'Нет' }}
123
- </q-badge>
124
- <span v-else-if="cellProps.col.html" v-html="cellProps.value"></span>
125
- <slot v-else-if="hasSlot(cellProps.col.name)" :name="cellProps.col.name" :cellProps="cellProps" />
126
- <span v-else :title="cellProps.value">{{ cellProps.value }}</span>
127
- </q-td>
128
- </template>
129
- </q-table>
130
- </div>
131
- </template>
132
- <script setup lang="ts">
133
- import { defineProps, defineEmits, ref, computed, watch, Slots } from 'vue'
134
- import type { Ref } from 'vue'
135
- import FilterIcon from '@/icons/components/table-filter-icon.vue'
136
-
137
- interface FilterOption {
138
- id: string
139
- name: string
140
- }
141
-
142
- interface TableEmits {
143
- 'toggle-filter-value': [colName: string, value: string]
144
- 'clear-filter': [colName: string]
145
- 'open-filter-menu': [colName: string, isOpen: boolean]
146
- 'row-click': [row: Record<string, any>]
147
- 'update:selectedRows': [rows: any[]] // синтаксис defineEmits для эмита с именованными параметрами
148
- edit: [row: Record<string, any>]
149
- }
150
-
151
- const props = defineProps<{
152
- rows: Ref<any[]>
153
- columns: any[]
154
- columnFilters: Ref<Record<string, string | string[] | undefined>>
155
- filterMenus: Ref<Record<string, boolean>>
156
- filtersOptions: Record<string, FilterOption[]>
157
- meta: Ref<{ currentPage: number; perPage: number }>
158
- enableMultiSelect?: boolean
159
- noHover?: boolean
160
- hidePagination?: boolean
161
- selectedRows: any[]
162
- actions?: string[]
163
- slots?: Slots
164
- }>()
165
- const emit = defineEmits<TableEmits>()
166
-
167
- const localSearches = ref<Record<string, string>>({})
168
- const selected = ref<any[]>([])
169
-
170
- const resCols = computed(() => {
171
- if (!props.actions?.length) return props.columns
172
-
173
- return [...props.columns, { name: 'actions', label: 'Действия', align: 'center' }]
174
- })
175
-
176
- const filteredOptions = computed(() => {
177
- const result: Record<string, FilterOption[]> = {}
178
- for (const col of props.columns) {
179
- const search = localSearches.value[col.name]?.toLowerCase() || ''
180
- const options = props.filtersOptions[col.name] || []
181
- result[col.name] = options.filter(opt => opt.name.toLowerCase().includes(search))
182
- }
183
- return result
184
- })
185
-
186
- const hasSlot = (name: string) => props.slots && name in props.slots
187
-
188
- const rowClick = (e: Event, row: Record<string, any>) => {
189
- const target = e?.target
190
-
191
- if (!(target instanceof HTMLElement) || target.closest('.actions') || document.getSelection()?.toString()) return
192
-
193
- emit('row-click', row)
194
- }
195
-
196
- const getIndex = (rowIndex: number) => {
197
- if (props.hidePagination) return rowIndex + 1
198
-
199
- return rowIndex + 1 + (props.meta.value.currentPage - 1) * props.meta.value.perPage
200
- }
201
-
202
- watch(
203
- () => props.selectedRows,
204
- val => {
205
- selected.value = val
206
- },
207
- { immediate: true },
208
- )
209
-
210
- watch(
211
- selected,
212
- val => {
213
- emit('update:selectedRows', val)
214
- },
215
- { deep: true },
216
- )
217
- </script>
218
- <style scoped lang="scss">
219
- .actions {
220
- width: 100px;
221
- background-color: #f2f7fb;
222
- position: sticky;
223
- right: 0;
224
- z-index: 1;
225
- border-left: 1px solid #d7e0ef;
226
-
227
- &__btns {
228
- display: flex;
229
- justify-content: center;
230
- gap: 0.5rem;
231
-
232
- button {
233
- background-color: #a4b4cf50;
234
- width: 32px;
235
- height: 32px;
236
- border-radius: 8px;
237
- }
238
- }
239
- }
240
-
241
- .cursor-pointer {
242
- cursor: pointer;
243
- }
244
-
245
- .filter-menu {
246
- padding: 10px;
247
- }
248
- .label-length {
249
- margin-left: 5px;
250
- }
251
- .filter-content {
252
- display: flex;
253
- flex-direction: column;
254
- color: #1d425d;
255
- .q-item {
256
- padding: 0 5px;
257
- min-height: 40px;
258
- }
259
- .q-item__section {
260
- min-width: 30px;
261
- padding: 0;
262
- }
263
- ::v-deep(.q-radio__inner),
264
- ::v-deep(.q-checkbox__inner) {
265
- color: #a4b4cf;
266
- }
267
- }
268
-
269
- .filter-footer {
270
- border-top: 1px solid #eee;
271
- display: flex;
272
- justify-content: center;
273
- }
274
-
275
- ::v-deep(.q-table thead) {
276
- position: sticky;
277
- top: 0;
278
- background: #f2f7fb;
279
- z-index: 2;
280
- }
281
-
282
- ::v-deep(.q-table th) {
283
- font-family: NunitoSansFont, sans-serif;
284
- color: #a4b4cf;
285
- font-size: 15px;
286
- font-style: normal;
287
- font-weight: 700;
288
- line-height: 20px;
289
- height: 61px;
290
- }
291
-
292
- ::v-deep(.q-table tbody td) {
293
- height: 61px;
294
- font-size: 14px;
295
- }
296
-
297
- .q-td--no-hover {
298
- cursor: default;
299
- }
300
-
301
- ::v-deep(.q-table tbody) {
302
- font-family: NunitoSansFont, sans-serif;
303
- border-color: #d7e0ef;
304
- color: #1d425d;
305
- line-height: 20px;
306
- font-size: 14px;
307
- }
308
-
309
- ::v-deep(.q-table tbody tr:last-child td) {
310
- border-bottom: 1px solid #d7e0ef;
311
- }
312
- </style>
1
+ <template>
2
+ <div class="flex flex-col" style="height: 100%; min-height: 100%">
3
+ <q-table
4
+ v-model:selected="selected"
5
+ :rows="rows.value"
6
+ :columns="resCols"
7
+ row-key="id"
8
+ flat
9
+ bordered
10
+ hide-bottom
11
+ class="full-width"
12
+ :rows-per-page-options="[0]"
13
+ :selection="props.enableMultiSelect ? 'multiple' : 'none'"
14
+ style="height: 100%"
15
+ @row-click="rowClick"
16
+ >
17
+ <template #header-selection="scope">
18
+ <q-toggle v-model="scope.selected" />
19
+ </template>
20
+
21
+ <template #body-selection="scope">
22
+ <q-toggle v-model="scope.selected" />
23
+ </template>
24
+
25
+ <template #body-cell-index="cellProps">
26
+ <q-td :props="cellProps" class="text-center" :class="{ 'q-td--no-hover': noHover }">
27
+ {{ getIndex(cellProps.rowIndex) }}
28
+ </q-td>
29
+ </template>
30
+
31
+ <template v-for="col in resCols" :key="col.name" #[`header-cell-${col.name}`]="propsSlot">
32
+ <q-th
33
+ :props="propsSlot"
34
+ :class="{ 'cursor-pointer': col.filterType, actions: col.name === 'actions' }"
35
+ :style="col.style"
36
+ >
37
+ <div
38
+ v-if="col.filterType"
39
+ class="row items-center no-wrap"
40
+ @click.stop="emit('open-filter-menu', col.name, !filterMenus.value[col.name])"
41
+ >
42
+ <filter-icon class="q-mr-xs" />
43
+ <span>{{ col.label }}</span>
44
+ <div
45
+ v-if="['multi', 'single'].includes(col.filterType) && columnFilters.value[col.name]?.length"
46
+ class="label-length"
47
+ >
48
+ - {{ col.filterType === 'multi' ? columnFilters.value[col.name]?.length : 1 }}
49
+ </div>
50
+ </div>
51
+ <div v-else>{{ col.label }}</div>
52
+
53
+ <q-menu
54
+ v-if="col.filterType"
55
+ :model-value="filterMenus.value[col.name]"
56
+ fit
57
+ max-height="300px"
58
+ class="filter-menu"
59
+ @update:model-value="isOpen => emit('open-filter-menu', col.name, isOpen)"
60
+ >
61
+ <div class="filter-content">
62
+ <q-input v-model="localSearches[col.name]" dense outlined placeholder="Поиск" class="q-mb-sm" clearable />
63
+ <q-scroll-area style="height: 200px">
64
+ <q-list style="min-width: 200px">
65
+ <q-item v-for="option in filteredOptions[col.name]" :key="`${col.name}-${option.id}`" tag="label">
66
+ <q-item-section avatar>
67
+ <q-checkbox
68
+ v-if="col.filterType === 'multi'"
69
+ dense
70
+ :model-value="
71
+ Array.isArray(columnFilters.value[col.name]) &&
72
+ columnFilters.value[col.name]?.includes(option.name)
73
+ "
74
+ @update:model-value="() => emit('toggle-filter-value', col.name, option.name)"
75
+ />
76
+ <q-radio
77
+ v-else
78
+ dense
79
+ :model-value="columnFilters.value[col.name]"
80
+ :val="option.name"
81
+ @update:model-value="emit('toggle-filter-value', col.name, $event)"
82
+ />
83
+ </q-item-section>
84
+ <q-item-section>{{ option.name }}</q-item-section>
85
+ </q-item>
86
+ </q-list>
87
+ </q-scroll-area>
88
+
89
+ <div class="filter-footer">
90
+ <q-btn color="negative" flat dense label="Сбросить фильтр" @click="emit('clear-filter', col.name)" />
91
+ </div>
92
+ </div>
93
+ </q-menu>
94
+ </q-th>
95
+ </template>
96
+
97
+ <template #body-cell="cellProps">
98
+ <q-td
99
+ :props="cellProps"
100
+ :class="{
101
+ 'q-td--no-hover': noHover || cellProps.col.name === 'actions',
102
+ actions: cellProps.col.name === 'actions',
103
+ }"
104
+ >
105
+ <div v-if="cellProps.col.name === 'actions'" class="actions__btns">
106
+ <q-btn square icon="edit" size="sm" unelevated title="Редактировать" @click="emit('edit', cellProps.row)" />
107
+ </div>
108
+ <q-badge
109
+ v-else-if="cellProps.col.badge && typeof cellProps.value === 'boolean'"
110
+ :color="
111
+ cellProps.col.badge.colorTrue && cellProps.value
112
+ ? cellProps.col.badge.colorTrue
113
+ : cellProps.col.badge.colorFalse && !cellProps.value
114
+ ? cellProps.col.badge.colorFalse
115
+ : cellProps.value
116
+ ? 'green'
117
+ : 'red'
118
+ "
119
+ outline
120
+ class="text-bold"
121
+ >
122
+ {{ cellProps.value ? cellProps.col.badge.true ?? 'Да' : cellProps.col.badge.false ?? 'Нет' }}
123
+ </q-badge>
124
+ <span v-else-if="cellProps.col.html" v-html="cellProps.value"></span>
125
+ <slot v-else-if="hasSlot(cellProps.col.name)" :name="cellProps.col.name" :cellProps="cellProps" />
126
+ <span v-else :title="cellProps.value">{{ cellProps.value }}</span>
127
+ </q-td>
128
+ </template>
129
+ </q-table>
130
+ </div>
131
+ </template>
132
+ <script setup lang="ts">
133
+ import { defineProps, defineEmits, ref, computed, watch, Slots } from 'vue'
134
+ import type { Ref } from 'vue'
135
+ import FilterIcon from '@/icons/components/table-filter-icon.vue'
136
+
137
+ interface FilterOption {
138
+ id: string
139
+ name: string
140
+ }
141
+
142
+ interface TableEmits {
143
+ 'toggle-filter-value': [colName: string, value: string]
144
+ 'clear-filter': [colName: string]
145
+ 'open-filter-menu': [colName: string, isOpen: boolean]
146
+ 'row-click': [row: Record<string, any>]
147
+ 'update:selectedRows': [rows: any[]] // синтаксис defineEmits для эмита с именованными параметрами
148
+ edit: [row: Record<string, any>]
149
+ }
150
+
151
+ const props = defineProps<{
152
+ rows: Ref<any[]>
153
+ columns: any[]
154
+ columnFilters: Ref<Record<string, string | string[] | undefined>>
155
+ filterMenus: Ref<Record<string, boolean>>
156
+ filtersOptions: Record<string, FilterOption[]>
157
+ meta: Ref<{ currentPage: number; perPage: number }>
158
+ enableMultiSelect?: boolean
159
+ noHover?: boolean
160
+ hidePagination?: boolean
161
+ selectedRows: any[]
162
+ actions?: string[]
163
+ slots?: Slots
164
+ }>()
165
+ const emit = defineEmits<TableEmits>()
166
+
167
+ const localSearches = ref<Record<string, string>>({})
168
+ const selected = ref<any[]>([])
169
+
170
+ const resCols = computed(() => {
171
+ if (!props.actions?.length) return props.columns
172
+
173
+ return [...props.columns, { name: 'actions', label: 'Действия', align: 'center' }]
174
+ })
175
+
176
+ const filteredOptions = computed(() => {
177
+ const result: Record<string, FilterOption[]> = {}
178
+ for (const col of props.columns) {
179
+ const search = localSearches.value[col.name]?.toLowerCase() || ''
180
+ const options = props.filtersOptions[col.name] || []
181
+ result[col.name] = options.filter(opt => opt.name.toLowerCase().includes(search))
182
+ }
183
+ return result
184
+ })
185
+
186
+ const hasSlot = (name: string) => props.slots && name in props.slots
187
+
188
+ const rowClick = (e: Event, row: Record<string, any>) => {
189
+ const target = e?.target
190
+
191
+ if (!(target instanceof HTMLElement) || target.closest('.actions') || document.getSelection()?.toString()) return
192
+
193
+ emit('row-click', row)
194
+ }
195
+
196
+ const getIndex = (rowIndex: number) => {
197
+ if (props.hidePagination) return rowIndex + 1
198
+
199
+ return rowIndex + 1 + (props.meta.value.currentPage - 1) * props.meta.value.perPage
200
+ }
201
+
202
+ watch(
203
+ () => props.selectedRows,
204
+ val => {
205
+ selected.value = val
206
+ },
207
+ { immediate: true },
208
+ )
209
+
210
+ watch(
211
+ selected,
212
+ val => {
213
+ emit('update:selectedRows', val)
214
+ },
215
+ { deep: true },
216
+ )
217
+ </script>
218
+ <style scoped lang="scss">
219
+ .actions {
220
+ width: 100px;
221
+ background-color: #f2f7fb;
222
+ position: sticky;
223
+ right: 0;
224
+ z-index: 1;
225
+ border-left: 1px solid #d7e0ef;
226
+
227
+ &__btns {
228
+ display: flex;
229
+ justify-content: center;
230
+ gap: 0.5rem;
231
+
232
+ button {
233
+ background-color: #a4b4cf50;
234
+ width: 32px;
235
+ height: 32px;
236
+ border-radius: 8px;
237
+ }
238
+ }
239
+ }
240
+
241
+ .cursor-pointer {
242
+ cursor: pointer;
243
+ }
244
+
245
+ .filter-menu {
246
+ padding: 10px;
247
+ }
248
+ .label-length {
249
+ margin-left: 5px;
250
+ }
251
+ .filter-content {
252
+ display: flex;
253
+ flex-direction: column;
254
+ color: #1d425d;
255
+ .q-item {
256
+ padding: 0 5px;
257
+ min-height: 40px;
258
+ }
259
+ .q-item__section {
260
+ min-width: 30px;
261
+ padding: 0;
262
+ }
263
+ ::v-deep(.q-radio__inner),
264
+ ::v-deep(.q-checkbox__inner) {
265
+ color: #a4b4cf;
266
+ }
267
+ }
268
+
269
+ .filter-footer {
270
+ border-top: 1px solid #eee;
271
+ display: flex;
272
+ justify-content: center;
273
+ }
274
+
275
+ ::v-deep(.q-table thead) {
276
+ position: sticky;
277
+ top: 0;
278
+ background: #f2f7fb;
279
+ z-index: 2;
280
+ }
281
+
282
+ ::v-deep(.q-table th) {
283
+ font-family: NunitoSansFont, sans-serif;
284
+ color: #a4b4cf;
285
+ font-size: 15px;
286
+ font-style: normal;
287
+ font-weight: 700;
288
+ line-height: 20px;
289
+ height: 61px;
290
+ }
291
+
292
+ ::v-deep(.q-table tbody td) {
293
+ height: 61px;
294
+ font-size: 14px;
295
+ }
296
+
297
+ .q-td--no-hover {
298
+ cursor: default;
299
+ }
300
+
301
+ ::v-deep(.q-table tbody) {
302
+ font-family: NunitoSansFont, sans-serif;
303
+ border-color: #d7e0ef;
304
+ color: #1d425d;
305
+ line-height: 20px;
306
+ font-size: 14px;
307
+ }
308
+
309
+ ::v-deep(.q-table tbody tr:last-child td) {
310
+ border-bottom: 1px solid #d7e0ef;
311
+ }
312
+ </style>