shared-ritm 1.3.77 → 1.3.79

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