shared-ritm 1.3.21 → 1.3.23

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 (58) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared-ritm.es.js +4936 -4981
  3. package/dist/shared-ritm.umd.js +103 -103
  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/RepairsService.d.ts +1 -1
  7. package/dist/types/api/services/TasksService.d.ts +5 -0
  8. package/dist/types/api/settings/ApiService.d.ts +1 -1
  9. package/dist/types/api/types/Api_Tasks.d.ts +1 -0
  10. package/dist/types/api/types/Api_Users.d.ts +43 -0
  11. package/package.json +65 -65
  12. package/src/App.vue +2461 -2461
  13. package/src/api/services/BrigadesService.ts +32 -32
  14. package/src/api/services/ControlsService.ts +96 -96
  15. package/src/api/services/EquipmentService.ts +29 -29
  16. package/src/api/services/InstrumentsService.ts +68 -68
  17. package/src/api/services/MetricsService.ts +123 -123
  18. package/src/api/services/ModulesService.ts +27 -27
  19. package/src/api/services/ProjectsService.ts +83 -83
  20. package/src/api/services/RepairsService.ts +111 -111
  21. package/src/api/services/ScheduleService.ts +69 -69
  22. package/src/api/services/SearchService.ts +22 -22
  23. package/src/api/services/TasksService.ts +7 -0
  24. package/src/api/services/UserService.ts +119 -119
  25. package/src/api/services/VideoService.ts +108 -108
  26. package/src/api/settings/ApiService.ts +124 -124
  27. package/src/api/types/Api_Auth.ts +105 -105
  28. package/src/api/types/Api_Brigades.ts +36 -36
  29. package/src/api/types/Api_Controls.ts +111 -111
  30. package/src/api/types/Api_Equipment.ts +3 -3
  31. package/src/api/types/Api_Instruments.ts +156 -156
  32. package/src/api/types/Api_Metrics.ts +5 -5
  33. package/src/api/types/Api_Modules.ts +21 -21
  34. package/src/api/types/Api_Projects.ts +62 -62
  35. package/src/api/types/Api_Repairs.ts +140 -140
  36. package/src/api/types/Api_Schedule.ts +64 -64
  37. package/src/api/types/Api_Search.ts +80 -80
  38. package/src/api/types/Api_Tasks.ts +372 -371
  39. package/src/api/types/Api_User.ts +146 -146
  40. package/src/api/types/Api_Video.ts +198 -198
  41. package/src/common/app-datepicker/AppDatepicker.vue +218 -218
  42. package/src/common/app-dropdown/AppDropdown.vue +37 -37
  43. package/src/common/app-input-new/AppInputNew.vue +179 -179
  44. package/src/common/app-layout/AppLayout.vue +84 -84
  45. package/src/common/app-modal/index.vue +96 -96
  46. package/src/common/app-sheet-new/AppSheetNew.vue +244 -244
  47. package/src/common/app-sidebar/AppSidebar.vue +174 -174
  48. package/src/common/app-sidebar/components/SidebarMenuItem.vue +149 -149
  49. package/src/common/app-table/AppTable.vue +308 -308
  50. package/src/common/app-table/AppTableLayout.vue +137 -137
  51. package/src/common/app-table/components/ModalSelect.vue +296 -296
  52. package/src/common/app-table/components/TableModal.vue +356 -356
  53. package/src/common/app-table/controllers/useBaseTable.ts +45 -45
  54. package/src/common/app-table/controllers/useTableModel.ts +102 -102
  55. package/src/icons/dialogs/SafetyIcon.vue +12 -12
  56. package/src/index.ts +131 -131
  57. package/src/styles/variables.sass +12 -12
  58. package/src/utils/files.ts +19 -19
@@ -1,296 +1,296 @@
1
- <template>
2
- <label v-if="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="isEmpty || (multiple && !showChip) ? placeholder : null"
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="!hideSearch"
24
- :use-chips="!simple"
25
- :hide-bottom-space="hideBottomSpace"
26
- input-debounce="100"
27
- autocomplete=""
28
- :rules="rules"
29
- :popup-content-style="popupContentStyle"
30
- @virtual-scroll="onScroll"
31
- @filter="filterFn"
32
- @add="clearInputAfterFilterSelection"
33
- >
34
- <template v-if="multiple || showChip || 'selected' in slots" #selected-item="scope">
35
- <slot v-if="'selected' in slots && scope.opt" name="selected" :opt="scope.opt" />
36
- <q-chip
37
- v-else-if="scope.opt"
38
- removable
39
- :tabindex="scope.tabindex"
40
- :style="{ backgroundColor: chipColor }"
41
- icon-remove="close"
42
- text-color="secondary"
43
- @remove="scope.removeAtIndex(scope.index)"
44
- >
45
- {{ scope.opt[optionLabel || 'label'] }}
46
- </q-chip>
47
- </template>
48
-
49
- <template #append>
50
- <q-icon
51
- v-if="!isDisabled && !isEmpty"
52
- name="close"
53
- class="cursor-pointer clear-input"
54
- @click.stop="handleClear"
55
- />
56
- </template>
57
-
58
- <template #no-option>
59
- <div class="q-pa-sm">
60
- <q-item>
61
- <q-item-section class="wrapper-empty-text">
62
- {{ emptyText || 'Ничего не найдено' }}
63
- <button
64
- v-if="allowCreate && internalSearch && internalSearch.trim()"
65
- class="add-new-items"
66
- @click="handleCreateFromSearch"
67
- >
68
- Добавить
69
- </button>
70
- </q-item-section>
71
- </q-item>
72
- </div>
73
- </template>
74
-
75
- <template #option="scope">
76
- <q-item v-if="scope.opt.__loading" class="q-py-md q-ml-md">
77
- <q-spinner-dots size="24px" color="primary" />
78
- </q-item>
79
- <q-item v-else-if="'option' in slots" v-bind="scope.itemProps">
80
- <slot name="option" :opt="scope.opt" />
81
- </q-item>
82
- <q-item v-else v-bind="scope.itemProps">
83
- <q-item-section>{{ scope.opt[optionLabel || 'label'] }}</q-item-section>
84
- </q-item>
85
- </template>
86
- </q-select>
87
- </template>
88
-
89
- <script setup lang="ts">
90
- import { computed, defineEmits, defineProps, ref, Ref, useSlots } from 'vue'
91
- import { QSelect } from 'quasar'
92
- type Option = Record<string, any>
93
-
94
- interface AppQSelectProps {
95
- modelValue: any
96
- options: Option[]
97
- placeholder?: string | undefined
98
- emptyText?: string
99
- optionLabel?: string
100
- optionValue?: string
101
- label?: string
102
- multiple?: boolean
103
- loading?: boolean
104
- isShowRequired?: boolean
105
- isDisabled?: boolean
106
- allowCreate?: boolean
107
- isSearch?: boolean
108
- hideSearch?: boolean
109
- showChip?: boolean
110
- simple?: boolean
111
- hideBottomSpace?: boolean
112
- chipColor?: string
113
- height?: string
114
- borderColor?: string
115
- borderRadius?: string
116
- menuWidth?: string
117
- rules?: ((val: any) => boolean | string)[]
118
- popupContentStyle?: string
119
- }
120
-
121
- const props = defineProps<AppQSelectProps>()
122
- const emit = defineEmits(['update:modelValue', 'update:scroll', 'update:search', 'clear', 'create'])
123
-
124
- const slots = useSlots()
125
-
126
- const select = ref<QSelect | null>(null)
127
- const lcText: Ref<string> = ref('')
128
- const internalSearch = ref('')
129
-
130
- const selected = computed({
131
- get() {
132
- return props.modelValue
133
- },
134
- set(value) {
135
- emit('update:modelValue', value)
136
- },
137
- })
138
-
139
- const isEmpty = computed(() => {
140
- if (!props.modelValue && props.modelValue !== 0) return true
141
-
142
- return Array.isArray(props.modelValue) && !props.modelValue.length
143
- })
144
-
145
- function handleClear() {
146
- const emptyValue = props.multiple ? [] : null
147
- selected.value = emptyValue
148
- lcText.value = ''
149
- emit('update:modelValue', emptyValue)
150
- emit('clear')
151
- }
152
-
153
- const filteredOptions = computed(() => {
154
- const labelKey = props.optionLabel || 'label'
155
-
156
- const baseOptions =
157
- 'option' in slots
158
- ? props.options
159
- : props.options.filter(x => {
160
- const label = x[labelKey]
161
- return typeof label === 'string' && label.toLowerCase().includes(lcText.value)
162
- })
163
-
164
- if (props.loading) {
165
- return [
166
- ...baseOptions,
167
- {
168
- __loading: true,
169
- label: '__loading__',
170
- value: '__loading__',
171
- },
172
- ]
173
- }
174
-
175
- return baseOptions
176
- })
177
-
178
- function handleCreateFromSearch() {
179
- const labelKey = props.optionLabel || 'label'
180
- const valueKey = props.optionValue || 'value'
181
-
182
- const trimmed = internalSearch.value?.trim()
183
- if (!trimmed) return
184
-
185
- const newOption = {
186
- [labelKey]: trimmed,
187
- [valueKey]: trimmed,
188
- }
189
- emit('create', newOption)
190
- handleClear()
191
- }
192
-
193
- function filterFn(val: string, update: (cb: () => void) => void) {
194
- debouncedFilter(val, update)
195
- }
196
-
197
- const debouncedFilter = debounce((val: string, update: (cb: () => void) => void) => {
198
- internalSearch.value = val
199
- emit('update:search', val)
200
- update(() => {
201
- lcText.value = val.toLowerCase()
202
- })
203
- }, 500)
204
-
205
- function onScroll({ to, ref: qSelectRef }) {
206
- const totalOptions = qSelectRef.options.length
207
- if (to >= totalOptions - 1 && !lcText.value) {
208
- emit('update:scroll')
209
- }
210
- }
211
-
212
- function clearInputAfterFilterSelection() {
213
- if (!props.hideSearch && select.value) {
214
- select.value.updateInputValue('')
215
- }
216
- }
217
-
218
- function debounce<T>(fn: T, ms) {
219
- let timeoutId
220
- return function (...args) {
221
- clearTimeout(timeoutId)
222
- return new Promise(resolve => {
223
- timeoutId = setTimeout(() => {
224
- resolve(fn(...args))
225
- }, ms)
226
- })
227
- }
228
- }
229
- </script>
230
-
231
- <style lang="scss" scoped>
232
- .wrapper-empty-text {
233
- display: flex;
234
- align-items: center;
235
- justify-content: space-between;
236
- flex-direction: row;
237
- .add-new-items {
238
- background: #3f8cff;
239
- color: #fff;
240
- outline: none;
241
- border: none;
242
- border-radius: 4px;
243
- padding: 5px 10px;
244
- cursor: pointer;
245
- }
246
- }
247
- .field-label {
248
- font-size: 14px;
249
- font-weight: 700;
250
- color: #7d8592;
251
- }
252
- .required {
253
- color: #f65160;
254
- font-weight: bold;
255
- }
256
-
257
- ::v-deep(.q-placeholder) {
258
- color: #7d8592;
259
- }
260
- ::v-deep(.q-field__control) {
261
- border-radius: 8px;
262
- border: 1px solid #d8e0f0;
263
- background: #fff;
264
- box-shadow: 0 1px 2px 0 rgba(184, 200, 224, 0.22);
265
- }
266
- :deep(.q-field__control:before) {
267
- display: none;
268
- }
269
- :global(.q-field--filled.q-field--highlighted .q-field__control:before) {
270
- background: #fff !important;
271
- border: none;
272
- }
273
- ::v-deep(.q-field--with-bottom) {
274
- padding-bottom: 0;
275
- }
276
- ::v-deep(.q-field__bottom) {
277
- padding: 0;
278
- }
279
- .clear-input {
280
- color: #d8e0f0;
281
- }
282
- ::v-deep(.q-chip) {
283
- border-radius: 4px;
284
- background: #e9eff9;
285
- color: #1d425d;
286
- font-family: NunitoSansFont, sans-serif;
287
- font-size: 14px;
288
- height: 30px;
289
- line-height: 30px;
290
- padding: 0 15px;
291
- .q-chip__icon {
292
- color: #3f8cff;
293
- margin-left: 5px;
294
- }
295
- }
296
- </style>
1
+ <template>
2
+ <label v-if="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="isEmpty || (multiple && !showChip) ? placeholder : null"
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="!hideSearch"
24
+ :use-chips="!simple"
25
+ :hide-bottom-space="hideBottomSpace"
26
+ input-debounce="100"
27
+ autocomplete=""
28
+ :rules="rules"
29
+ :popup-content-style="popupContentStyle"
30
+ @virtual-scroll="onScroll"
31
+ @filter="filterFn"
32
+ @add="clearInputAfterFilterSelection"
33
+ >
34
+ <template v-if="multiple || showChip || 'selected' in slots" #selected-item="scope">
35
+ <slot v-if="'selected' in slots && scope.opt" name="selected" :opt="scope.opt" />
36
+ <q-chip
37
+ v-else-if="scope.opt"
38
+ removable
39
+ :tabindex="scope.tabindex"
40
+ :style="{ backgroundColor: chipColor }"
41
+ icon-remove="close"
42
+ text-color="secondary"
43
+ @remove="scope.removeAtIndex(scope.index)"
44
+ >
45
+ {{ scope.opt[optionLabel || 'label'] }}
46
+ </q-chip>
47
+ </template>
48
+
49
+ <template #append>
50
+ <q-icon
51
+ v-if="!isDisabled && !isEmpty"
52
+ name="close"
53
+ class="cursor-pointer clear-input"
54
+ @click.stop="handleClear"
55
+ />
56
+ </template>
57
+
58
+ <template #no-option>
59
+ <div class="q-pa-sm">
60
+ <q-item>
61
+ <q-item-section class="wrapper-empty-text">
62
+ {{ emptyText || 'Ничего не найдено' }}
63
+ <button
64
+ v-if="allowCreate && internalSearch && internalSearch.trim()"
65
+ class="add-new-items"
66
+ @click="handleCreateFromSearch"
67
+ >
68
+ Добавить
69
+ </button>
70
+ </q-item-section>
71
+ </q-item>
72
+ </div>
73
+ </template>
74
+
75
+ <template #option="scope">
76
+ <q-item v-if="scope.opt.__loading" class="q-py-md q-ml-md">
77
+ <q-spinner-dots size="24px" color="primary" />
78
+ </q-item>
79
+ <q-item v-else-if="'option' in slots" v-bind="scope.itemProps">
80
+ <slot name="option" :opt="scope.opt" />
81
+ </q-item>
82
+ <q-item v-else v-bind="scope.itemProps">
83
+ <q-item-section>{{ scope.opt[optionLabel || 'label'] }}</q-item-section>
84
+ </q-item>
85
+ </template>
86
+ </q-select>
87
+ </template>
88
+
89
+ <script setup lang="ts">
90
+ import { computed, defineEmits, defineProps, ref, Ref, useSlots } from 'vue'
91
+ import { QSelect } from 'quasar'
92
+ type Option = Record<string, any>
93
+
94
+ interface AppQSelectProps {
95
+ modelValue: any
96
+ options: Option[]
97
+ placeholder?: string | undefined
98
+ emptyText?: string
99
+ optionLabel?: string
100
+ optionValue?: string
101
+ label?: string
102
+ multiple?: boolean
103
+ loading?: boolean
104
+ isShowRequired?: boolean
105
+ isDisabled?: boolean
106
+ allowCreate?: boolean
107
+ isSearch?: boolean
108
+ hideSearch?: boolean
109
+ showChip?: boolean
110
+ simple?: boolean
111
+ hideBottomSpace?: boolean
112
+ chipColor?: string
113
+ height?: string
114
+ borderColor?: string
115
+ borderRadius?: string
116
+ menuWidth?: string
117
+ rules?: ((val: any) => boolean | string)[]
118
+ popupContentStyle?: string
119
+ }
120
+
121
+ const props = defineProps<AppQSelectProps>()
122
+ const emit = defineEmits(['update:modelValue', 'update:scroll', 'update:search', 'clear', 'create'])
123
+
124
+ const slots = useSlots()
125
+
126
+ const select = ref<QSelect | null>(null)
127
+ const lcText: Ref<string> = ref('')
128
+ const internalSearch = ref('')
129
+
130
+ const selected = computed({
131
+ get() {
132
+ return props.modelValue
133
+ },
134
+ set(value) {
135
+ emit('update:modelValue', value)
136
+ },
137
+ })
138
+
139
+ const isEmpty = computed(() => {
140
+ if (!props.modelValue && props.modelValue !== 0) return true
141
+
142
+ return Array.isArray(props.modelValue) && !props.modelValue.length
143
+ })
144
+
145
+ function handleClear() {
146
+ const emptyValue = props.multiple ? [] : null
147
+ selected.value = emptyValue
148
+ lcText.value = ''
149
+ emit('update:modelValue', emptyValue)
150
+ emit('clear')
151
+ }
152
+
153
+ const filteredOptions = computed(() => {
154
+ const labelKey = props.optionLabel || 'label'
155
+
156
+ const baseOptions =
157
+ 'option' in slots
158
+ ? props.options
159
+ : props.options.filter(x => {
160
+ const label = x[labelKey]
161
+ return typeof label === 'string' && label.toLowerCase().includes(lcText.value)
162
+ })
163
+
164
+ if (props.loading) {
165
+ return [
166
+ ...baseOptions,
167
+ {
168
+ __loading: true,
169
+ label: '__loading__',
170
+ value: '__loading__',
171
+ },
172
+ ]
173
+ }
174
+
175
+ return baseOptions
176
+ })
177
+
178
+ function handleCreateFromSearch() {
179
+ const labelKey = props.optionLabel || 'label'
180
+ const valueKey = props.optionValue || 'value'
181
+
182
+ const trimmed = internalSearch.value?.trim()
183
+ if (!trimmed) return
184
+
185
+ const newOption = {
186
+ [labelKey]: trimmed,
187
+ [valueKey]: trimmed,
188
+ }
189
+ emit('create', newOption)
190
+ handleClear()
191
+ }
192
+
193
+ function filterFn(val: string, update: (cb: () => void) => void) {
194
+ debouncedFilter(val, update)
195
+ }
196
+
197
+ const debouncedFilter = debounce((val: string, update: (cb: () => void) => void) => {
198
+ internalSearch.value = val
199
+ emit('update:search', val)
200
+ update(() => {
201
+ lcText.value = val.toLowerCase()
202
+ })
203
+ }, 500)
204
+
205
+ function onScroll({ to, ref: qSelectRef }) {
206
+ const totalOptions = qSelectRef.options.length
207
+ if (to >= totalOptions - 1 && !lcText.value) {
208
+ emit('update:scroll')
209
+ }
210
+ }
211
+
212
+ function clearInputAfterFilterSelection() {
213
+ if (!props.hideSearch && select.value) {
214
+ select.value.updateInputValue('')
215
+ }
216
+ }
217
+
218
+ function debounce<T>(fn: T, ms) {
219
+ let timeoutId
220
+ return function (...args) {
221
+ clearTimeout(timeoutId)
222
+ return new Promise(resolve => {
223
+ timeoutId = setTimeout(() => {
224
+ resolve(fn(...args))
225
+ }, ms)
226
+ })
227
+ }
228
+ }
229
+ </script>
230
+
231
+ <style lang="scss" scoped>
232
+ .wrapper-empty-text {
233
+ display: flex;
234
+ align-items: center;
235
+ justify-content: space-between;
236
+ flex-direction: row;
237
+ .add-new-items {
238
+ background: #3f8cff;
239
+ color: #fff;
240
+ outline: none;
241
+ border: none;
242
+ border-radius: 4px;
243
+ padding: 5px 10px;
244
+ cursor: pointer;
245
+ }
246
+ }
247
+ .field-label {
248
+ font-size: 14px;
249
+ font-weight: 700;
250
+ color: #7d8592;
251
+ }
252
+ .required {
253
+ color: #f65160;
254
+ font-weight: bold;
255
+ }
256
+
257
+ ::v-deep(.q-placeholder) {
258
+ color: #7d8592;
259
+ }
260
+ ::v-deep(.q-field__control) {
261
+ border-radius: 8px;
262
+ border: 1px solid #d8e0f0;
263
+ background: #fff;
264
+ box-shadow: 0 1px 2px 0 rgba(184, 200, 224, 0.22);
265
+ }
266
+ :deep(.q-field__control:before) {
267
+ display: none;
268
+ }
269
+ :global(.q-field--filled.q-field--highlighted .q-field__control:before) {
270
+ background: #fff !important;
271
+ border: none;
272
+ }
273
+ ::v-deep(.q-field--with-bottom) {
274
+ padding-bottom: 0;
275
+ }
276
+ ::v-deep(.q-field__bottom) {
277
+ padding: 0;
278
+ }
279
+ .clear-input {
280
+ color: #d8e0f0;
281
+ }
282
+ ::v-deep(.q-chip) {
283
+ border-radius: 4px;
284
+ background: #e9eff9;
285
+ color: #1d425d;
286
+ font-family: NunitoSansFont, sans-serif;
287
+ font-size: 14px;
288
+ height: 30px;
289
+ line-height: 30px;
290
+ padding: 0 15px;
291
+ .q-chip__icon {
292
+ color: #3f8cff;
293
+ margin-left: 5px;
294
+ }
295
+ }
296
+ </style>