shared-ritm 1.2.151 → 1.2.152

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