shared-ritm 1.3.79 → 1.3.81
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.
- package/dist/index.css +1 -1
- package/dist/shared-ritm.es.js +1090 -1072
- package/dist/shared-ritm.umd.js +3 -3
- package/dist/types/api/services/EquipmentService.d.ts +9 -1
- package/dist/types/api/services/PhotoService.d.ts +40 -0
- package/dist/types/api/types/Api_Equipment.d.ts +8 -0
- package/dist/types/api/types/Api_Metrics.d.ts +1 -1
- package/dist/types/stories/Button.stories.d.ts +13 -0
- package/dist/types/stories/Checkbox.stories.d.ts +7 -0
- package/dist/types/stories/Confirm.stories.d.ts +8 -0
- package/dist/types/stories/DatePicker.stories.d.ts +8 -0
- package/dist/types/stories/Dropdown.stories.d.ts +8 -0
- package/dist/types/stories/File.stories.d.ts +8 -0
- package/dist/types/stories/Icon.stories.d.ts +7 -0
- package/dist/types/stories/Input.stories.d.ts +11 -0
- package/dist/types/stories/InputNew.stories.d.ts +12 -0
- package/dist/types/stories/InputSearch.stories.d.ts +10 -0
- package/dist/types/stories/Loader.stories.d.ts +8 -0
- package/dist/types/stories/Select.stories.d.ts +7 -0
- package/dist/types/stories/Toggle.stories.d.ts +8 -0
- package/package.json +70 -70
- package/src/App.vue +2461 -2461
- package/src/api/services/AuthService.ts +67 -67
- package/src/api/services/ControlsService.ts +96 -96
- package/src/api/services/EquipmentService.ts +52 -29
- package/src/api/services/MetricsService.ts +143 -143
- package/src/api/services/RepairsService.ts +111 -111
- package/src/api/services/UserIssueService.ts +32 -32
- package/src/api/services/UserService.ts +129 -129
- package/src/api/services/VideoService.ts +118 -118
- package/src/api/settings/ApiService.ts +184 -184
- package/src/api/types/Api_Auth.ts +121 -121
- package/src/api/types/Api_Equipment.ts +10 -0
- package/src/api/types/Api_Metrics.ts +51 -51
- package/src/api/types/Api_Repairs.ts +187 -187
- package/src/api/types/Api_Tasks.ts +376 -376
- package/src/api/types/Api_User.ts +156 -156
- package/src/api/types/Api_User_Issue.ts +36 -36
- package/src/api/types/Api_Video.ts +244 -244
- package/src/common/app-button/Button.stories.ts +369 -369
- package/src/common/app-checkbox/AppCheckbox.vue +31 -31
- package/src/common/app-checkbox/Checkbox.stories.ts +252 -252
- package/src/common/app-date-picker/DatePicker.stories.ts +66 -66
- package/src/common/app-datepicker/Datepicker.stories.ts +145 -145
- package/src/common/app-dialogs/AppConfirmDialog.vue +109 -109
- package/src/common/app-dialogs/Confirm.stories.ts +93 -93
- package/src/common/app-dropdown/Dropdown.stories.ts +94 -94
- package/src/common/app-file/File.stories.ts +104 -104
- package/src/common/app-icon/AppIcon.vue +110 -110
- package/src/common/app-icon/Icon.stories.ts +91 -91
- package/src/common/app-input/Input.stories.ts +160 -160
- package/src/common/app-input-new/AppInputNew.vue +181 -181
- package/src/common/app-input-new/InputNew.stories.ts +240 -240
- package/src/common/app-input-search/InputSearch.stories.ts +149 -149
- package/src/common/app-layout/components/AppLayoutHeader.vue +289 -289
- package/src/common/app-loader/Loader.stories.ts +114 -114
- package/src/common/app-select/AppSelect.vue +159 -159
- package/src/common/app-select/Select.stories.ts +155 -155
- package/src/common/app-sidebar/AppSidebar.vue +174 -174
- package/src/common/app-table/AppTable.vue +313 -313
- package/src/common/app-table/components/ModalSelect.stories.ts +323 -323
- package/src/common/app-table/components/ModalSelect.vue +302 -302
- package/src/common/app-table/components/TableModal.vue +367 -367
- package/src/common/app-table/controllers/useColumnSelector.ts +45 -45
- package/src/common/app-table/controllers/useTableModel.ts +97 -97
- package/src/common/app-toggle/AppToggle.vue +12 -12
- package/src/common/app-toggle/Toggle.stories.ts +245 -245
- package/src/common/app-wrapper/AppWrapper.vue +31 -31
- package/src/configs/storybook.ts +14 -14
- package/src/icons/sidebar/user-requests-icon.vue +23 -23
- package/src/index.ts +134 -134
- package/src/shared/styles/general.css +140 -140
- package/src/styles/variables.sass +12 -12
- package/src/utils/files.ts +38 -38
- package/src/utils/helpers.ts +59 -59
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { computed, ref } from 'vue'
|
|
2
|
-
|
|
3
|
-
export interface ColumnConfig {
|
|
4
|
-
name: string
|
|
5
|
-
label: string
|
|
6
|
-
[key: string]: any
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function useColumnSelector(allColumns: ColumnConfig[], fixedColumnNames: string[] = []) {
|
|
10
|
-
const selectedColumnNames = ref<string[]>([...new Set([...fixedColumnNames, ...allColumns.map(col => col.name)])])
|
|
11
|
-
|
|
12
|
-
const visibleColumns = computed(() => allColumns.filter(col => selectedColumnNames.value.includes(col.name)))
|
|
13
|
-
|
|
14
|
-
function openColumnSelectorDialog($q: any) {
|
|
15
|
-
$q.dialog({
|
|
16
|
-
title: 'Выберите колонки',
|
|
17
|
-
options: {
|
|
18
|
-
type: 'checkbox',
|
|
19
|
-
model: [...selectedColumnNames.value],
|
|
20
|
-
items: allColumns.map(col => ({
|
|
21
|
-
label: col.label,
|
|
22
|
-
value: col.name,
|
|
23
|
-
disable: fixedColumnNames.includes(col.name),
|
|
24
|
-
})),
|
|
25
|
-
},
|
|
26
|
-
cancel: {
|
|
27
|
-
label: 'Отмена',
|
|
28
|
-
'data-test': 'cancel-button',
|
|
29
|
-
},
|
|
30
|
-
ok: {
|
|
31
|
-
label: 'Ок',
|
|
32
|
-
'data-test': 'ok-button',
|
|
33
|
-
},
|
|
34
|
-
persistent: true,
|
|
35
|
-
}).onOk((val: string[]) => {
|
|
36
|
-
selectedColumnNames.value = Array.from(new Set([...val, ...fixedColumnNames]))
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
selectedColumnNames,
|
|
42
|
-
visibleColumns,
|
|
43
|
-
openColumnSelectorDialog,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
import { computed, ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface ColumnConfig {
|
|
4
|
+
name: string
|
|
5
|
+
label: string
|
|
6
|
+
[key: string]: any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function useColumnSelector(allColumns: ColumnConfig[], fixedColumnNames: string[] = []) {
|
|
10
|
+
const selectedColumnNames = ref<string[]>([...new Set([...fixedColumnNames, ...allColumns.map(col => col.name)])])
|
|
11
|
+
|
|
12
|
+
const visibleColumns = computed(() => allColumns.filter(col => selectedColumnNames.value.includes(col.name)))
|
|
13
|
+
|
|
14
|
+
function openColumnSelectorDialog($q: any) {
|
|
15
|
+
$q.dialog({
|
|
16
|
+
title: 'Выберите колонки',
|
|
17
|
+
options: {
|
|
18
|
+
type: 'checkbox',
|
|
19
|
+
model: [...selectedColumnNames.value],
|
|
20
|
+
items: allColumns.map(col => ({
|
|
21
|
+
label: col.label,
|
|
22
|
+
value: col.name,
|
|
23
|
+
disable: fixedColumnNames.includes(col.name),
|
|
24
|
+
})),
|
|
25
|
+
},
|
|
26
|
+
cancel: {
|
|
27
|
+
label: 'Отмена',
|
|
28
|
+
'data-test': 'cancel-button',
|
|
29
|
+
},
|
|
30
|
+
ok: {
|
|
31
|
+
label: 'Ок',
|
|
32
|
+
'data-test': 'ok-button',
|
|
33
|
+
},
|
|
34
|
+
persistent: true,
|
|
35
|
+
}).onOk((val: string[]) => {
|
|
36
|
+
selectedColumnNames.value = Array.from(new Set([...val, ...fixedColumnNames]))
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
selectedColumnNames,
|
|
42
|
+
visibleColumns,
|
|
43
|
+
openColumnSelectorDialog,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { Ref, computed, ref } from 'vue'
|
|
2
|
-
|
|
3
|
-
export interface TableColumn {
|
|
4
|
-
name: string
|
|
5
|
-
label: string
|
|
6
|
-
style?: string
|
|
7
|
-
headerStyle?: string
|
|
8
|
-
field?: string | ((row: any) => any)
|
|
9
|
-
sortable?: boolean
|
|
10
|
-
filterType?: 'single' | 'multi' | null
|
|
11
|
-
align?: 'left' | 'center' | 'right'
|
|
12
|
-
badge?: {
|
|
13
|
-
true?: string
|
|
14
|
-
false?: string
|
|
15
|
-
colorTrue?: string
|
|
16
|
-
colorFalse?: string
|
|
17
|
-
}
|
|
18
|
-
format?: (val: any) => any
|
|
19
|
-
html?: boolean
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface FilterOption {
|
|
23
|
-
id: string
|
|
24
|
-
name: string
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface TableModel<T = any> {
|
|
28
|
-
columns: TableColumn[]
|
|
29
|
-
rows: T[] | Ref<T[]>
|
|
30
|
-
filtersOptions?: Ref<Record<string, FilterOption[]>>
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const useTableModel = <T = any>(model: TableModel<T>) => {
|
|
34
|
-
const columnFilters = ref<Record<string, string | string[] | undefined>>({})
|
|
35
|
-
const filterMenus = ref<Record<string, boolean>>({})
|
|
36
|
-
|
|
37
|
-
model.columns.forEach(({ name, filterType }) => {
|
|
38
|
-
if (filterType) {
|
|
39
|
-
columnFilters.value[name] = filterType === 'multi' ? [] : undefined
|
|
40
|
-
filterMenus.value[name] = false
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
const resolvedRows = computed(() => (Array.isArray(model.rows) ? model.rows : model.rows.value))
|
|
45
|
-
|
|
46
|
-
const toggleFilterValue = (colName: string, value: string) => {
|
|
47
|
-
const col = model.columns.find(c => c.name === colName)
|
|
48
|
-
if (col?.filterType === 'multi') {
|
|
49
|
-
const current = columnFilters.value[colName] as string[]
|
|
50
|
-
const index = current.indexOf(value)
|
|
51
|
-
index > -1 ? current.splice(index, 1) : current.push(value)
|
|
52
|
-
columnFilters.value[colName] = [...current]
|
|
53
|
-
} else {
|
|
54
|
-
columnFilters.value[colName] = value
|
|
55
|
-
filterMenus.value[colName] = false
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const selectedFilters = computed(() => {
|
|
60
|
-
const result: Record<string, string[]> = {}
|
|
61
|
-
for (const col of model.columns) {
|
|
62
|
-
const filter = columnFilters.value[col.name]
|
|
63
|
-
const options = model.filtersOptions?.value[col.name] || []
|
|
64
|
-
|
|
65
|
-
if (filter) {
|
|
66
|
-
let selectedIds: string[] = []
|
|
67
|
-
if (Array.isArray(filter)) {
|
|
68
|
-
selectedIds = options.filter(opt => filter.includes(opt.name)).map(opt => opt.id)
|
|
69
|
-
} else {
|
|
70
|
-
selectedIds = options.filter(opt => opt.name === filter).map(opt => opt.id)
|
|
71
|
-
}
|
|
72
|
-
result[col.name] = Array.from(new Set(selectedIds))
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return result
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const clearFilter = (colName: string) => {
|
|
79
|
-
const col = model.columns.find(c => c.name === colName)
|
|
80
|
-
columnFilters.value[colName] = col?.filterType === 'multi' ? [] : undefined
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const openFilterMenu = (colName: string, isOpen: boolean) => {
|
|
84
|
-
filterMenus.value[colName] = isOpen
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
rows: resolvedRows,
|
|
89
|
-
columns: computed(() => model.columns),
|
|
90
|
-
columnFilters,
|
|
91
|
-
filterMenus,
|
|
92
|
-
toggleFilterValue,
|
|
93
|
-
clearFilter,
|
|
94
|
-
openFilterMenu,
|
|
95
|
-
selectedFilters,
|
|
96
|
-
}
|
|
97
|
-
}
|
|
1
|
+
import { Ref, computed, ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface TableColumn {
|
|
4
|
+
name: string
|
|
5
|
+
label: string
|
|
6
|
+
style?: string
|
|
7
|
+
headerStyle?: string
|
|
8
|
+
field?: string | ((row: any) => any)
|
|
9
|
+
sortable?: boolean
|
|
10
|
+
filterType?: 'single' | 'multi' | null
|
|
11
|
+
align?: 'left' | 'center' | 'right'
|
|
12
|
+
badge?: {
|
|
13
|
+
true?: string
|
|
14
|
+
false?: string
|
|
15
|
+
colorTrue?: string
|
|
16
|
+
colorFalse?: string
|
|
17
|
+
}
|
|
18
|
+
format?: (val: any) => any
|
|
19
|
+
html?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface FilterOption {
|
|
23
|
+
id: string
|
|
24
|
+
name: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TableModel<T = any> {
|
|
28
|
+
columns: TableColumn[]
|
|
29
|
+
rows: T[] | Ref<T[]>
|
|
30
|
+
filtersOptions?: Ref<Record<string, FilterOption[]>>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const useTableModel = <T = any>(model: TableModel<T>) => {
|
|
34
|
+
const columnFilters = ref<Record<string, string | string[] | undefined>>({})
|
|
35
|
+
const filterMenus = ref<Record<string, boolean>>({})
|
|
36
|
+
|
|
37
|
+
model.columns.forEach(({ name, filterType }) => {
|
|
38
|
+
if (filterType) {
|
|
39
|
+
columnFilters.value[name] = filterType === 'multi' ? [] : undefined
|
|
40
|
+
filterMenus.value[name] = false
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const resolvedRows = computed(() => (Array.isArray(model.rows) ? model.rows : model.rows.value))
|
|
45
|
+
|
|
46
|
+
const toggleFilterValue = (colName: string, value: string) => {
|
|
47
|
+
const col = model.columns.find(c => c.name === colName)
|
|
48
|
+
if (col?.filterType === 'multi') {
|
|
49
|
+
const current = columnFilters.value[colName] as string[]
|
|
50
|
+
const index = current.indexOf(value)
|
|
51
|
+
index > -1 ? current.splice(index, 1) : current.push(value)
|
|
52
|
+
columnFilters.value[colName] = [...current]
|
|
53
|
+
} else {
|
|
54
|
+
columnFilters.value[colName] = value
|
|
55
|
+
filterMenus.value[colName] = false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const selectedFilters = computed(() => {
|
|
60
|
+
const result: Record<string, string[]> = {}
|
|
61
|
+
for (const col of model.columns) {
|
|
62
|
+
const filter = columnFilters.value[col.name]
|
|
63
|
+
const options = model.filtersOptions?.value[col.name] || []
|
|
64
|
+
|
|
65
|
+
if (filter) {
|
|
66
|
+
let selectedIds: string[] = []
|
|
67
|
+
if (Array.isArray(filter)) {
|
|
68
|
+
selectedIds = options.filter(opt => filter.includes(opt.name)).map(opt => opt.id)
|
|
69
|
+
} else {
|
|
70
|
+
selectedIds = options.filter(opt => opt.name === filter).map(opt => opt.id)
|
|
71
|
+
}
|
|
72
|
+
result[col.name] = Array.from(new Set(selectedIds))
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return result
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const clearFilter = (colName: string) => {
|
|
79
|
+
const col = model.columns.find(c => c.name === colName)
|
|
80
|
+
columnFilters.value[colName] = col?.filterType === 'multi' ? [] : undefined
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const openFilterMenu = (colName: string, isOpen: boolean) => {
|
|
84
|
+
filterMenus.value[colName] = isOpen
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
rows: resolvedRows,
|
|
89
|
+
columns: computed(() => model.columns),
|
|
90
|
+
columnFilters,
|
|
91
|
+
filterMenus,
|
|
92
|
+
toggleFilterValue,
|
|
93
|
+
clearFilter,
|
|
94
|
+
openFilterMenu,
|
|
95
|
+
selectedFilters,
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<q-toggle v-bind="$props" />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { defineProps } from 'vue'
|
|
9
|
-
import { QToggleProps } from 'quasar'
|
|
10
|
-
|
|
11
|
-
defineProps<QToggleProps>()
|
|
12
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<q-toggle v-bind="$props" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { defineProps } from 'vue'
|
|
9
|
+
import { QToggleProps } from 'quasar'
|
|
10
|
+
|
|
11
|
+
defineProps<QToggleProps>()
|
|
12
|
+
</script>
|