shared-ritm 1.2.55 → 1.2.56
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 +4770 -4777
- package/dist/shared-ritm.umd.js +7 -7
- package/dist/types/api/types/Api_Controls.d.ts +6 -6
- package/package.json +1 -1
- package/src/App.vue +2461 -2461
- package/src/api/services/AuthService.ts +58 -58
- package/src/api/services/ControlsService.ts +64 -64
- package/src/api/services/FileService.ts +15 -15
- package/src/api/services/TasksService.ts +137 -137
- package/src/api/settings/ApiService.ts +128 -128
- package/src/api/types/Api_Controls.ts +3 -3
- package/src/common/app-button/AppButton.vue +173 -173
- package/src/common/app-date-picker/AppDatePicker.vue +81 -81
- package/src/common/app-icon/AppIcon.vue +108 -108
- package/src/common/app-input/AppInput.vue +147 -147
- package/src/common/app-input-search/AppInputSearch.vue +174 -174
- package/src/common/app-layout/AppLayout.vue +84 -84
- package/src/common/app-layout/components/AppLayoutHeader.vue +246 -246
- package/src/common/app-layout/components/AppLayoutPage.vue +16 -16
- package/src/common/app-loader/index.vue +43 -43
- package/src/common/app-page-layout/AppPageLayout.vue +122 -122
- package/src/common/app-sidebar/AppSidebar.vue +168 -168
- package/src/common/app-sidebar/components/SidebarMenu.vue +37 -37
- package/src/common/app-table/AppTable.vue +244 -244
- package/src/common/app-table/AppTableLayout.vue +104 -104
- package/src/common/app-table/components/ModalSelect.vue +264 -264
- package/src/common/app-table/components/TableModal.vue +357 -357
- package/src/common/app-table/controllers/useBaseTable.ts +42 -42
- package/src/global.d.ts +1 -1
- package/src/icons/components/arrow-down-icon.vue +25 -25
- package/src/icons/components/arrow-frame-icon.vue +19 -19
- package/src/icons/components/arrow-square.vue +22 -22
- package/src/icons/header/NotificationIcon.vue +18 -18
- package/src/icons/header/PersonIcon.vue +11 -11
- package/src/icons/header/SettingIcon.vue +14 -14
- package/src/icons/header/flashIcon.vue +24 -24
- package/src/icons/header/searchStatusIcon.vue +24 -24
- package/src/icons/header/smallCapsIcon.vue +34 -34
- package/src/icons/sidebar/assign-module-icon.vue +36 -36
- package/src/icons/sidebar/instrument-history-icon.vue +32 -32
- package/src/icons/sidebar/instrument-order-icon.vue +38 -38
- package/src/icons/sidebar/instrument-work-zone-icon.vue +18 -18
- package/src/icons/sidebar/instruments-icon.vue +45 -45
- package/src/icons/sidebar/logo-icon.vue +15 -15
- package/src/icons/sidebar/logout-icon.vue +13 -13
- package/src/icons/sidebar/modules-icon.vue +16 -16
- package/src/icons/sidebar/notifications-icon.vue +24 -24
- package/src/icons/sidebar/order-icon.vue +44 -44
- package/src/icons/sidebar/pass-icon.vue +38 -38
- package/src/icons/sidebar/positions-icon.vue +42 -42
- package/src/icons/sidebar/preorder-icon.vue +19 -19
- package/src/icons/sidebar/projects-icon.vue +31 -31
- package/src/icons/sidebar/repair-object-icon.vue +18 -18
- package/src/icons/sidebar/repairs-icon.vue +20 -20
- package/src/icons/sidebar/roles-icon.vue +26 -26
- package/src/icons/sidebar/status-history-icon.vue +24 -24
- package/src/icons/sidebar/tasks-icon.vue +28 -28
- package/src/icons/sidebar/tasks_tasks-icon.vue +39 -39
- package/src/icons/sidebar/tasks_today-icon.vue +27 -27
- package/src/icons/sidebar/teams-icon.vue +32 -32
- package/src/icons/sidebar/user-icon.vue +18 -18
- package/src/icons/sidebar/users-icon.vue +46 -46
- package/src/icons/sidebar/videosources-icon.vue +19 -19
- package/src/icons/sidebar/videowall-icon.vue +13 -13
- package/src/icons/sidebar/videozones-icon.vue +21 -21
- package/src/icons/sidebar/warehouses-icon.vue +43 -43
- package/src/icons/sidebar/workshop-icon.vue +100 -100
- package/src/icons/sidebar/workzones-icon.vue +22 -22
- package/src/index.ts +84 -84
- package/src/main.ts +28 -28
- package/src/quasar-user-options.ts +17 -17
- package/src/router/index.ts +10 -10
- package/src/shims-vue.d.ts +5 -5
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
|
2
|
-
|
|
3
|
-
export enum ApiServiceType {
|
|
4
|
-
SERVICE_AUTH = 'SERVICE_AUTH',
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type ResponseApi<T> = {
|
|
8
|
-
count: number
|
|
9
|
-
current_page: number
|
|
10
|
-
data: T
|
|
11
|
-
per_page: number
|
|
12
|
-
total: number
|
|
13
|
-
total_pages: number
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default class ApiService {
|
|
17
|
-
private axiosInstance: AxiosInstance
|
|
18
|
-
|
|
19
|
-
constructor() {
|
|
20
|
-
this.axiosInstance = axios.create({
|
|
21
|
-
baseURL: process.env.VUE_APP_BACKEND,
|
|
22
|
-
headers: {
|
|
23
|
-
'Content-Type': 'application/json',
|
|
24
|
-
Accept: 'application/json',
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
this.axiosInstance.interceptors.request.use(
|
|
29
|
-
(config: InternalAxiosRequestConfig) => {
|
|
30
|
-
const token = this.getToken()
|
|
31
|
-
if (token && config.headers) {
|
|
32
|
-
config.headers.Authorization = `Bearer ${token}`
|
|
33
|
-
}
|
|
34
|
-
return config
|
|
35
|
-
},
|
|
36
|
-
(error: AxiosError) => {
|
|
37
|
-
return Promise.reject(error)
|
|
38
|
-
},
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
this.axiosInstance.interceptors.response.use(
|
|
42
|
-
(response: AxiosResponse) => {
|
|
43
|
-
return response.data
|
|
44
|
-
},
|
|
45
|
-
(error: AxiosError) => {
|
|
46
|
-
if (error.response?.status === 401 || error.response?.status === 403) {
|
|
47
|
-
this.logout()
|
|
48
|
-
}
|
|
49
|
-
return Promise.reject(error)
|
|
50
|
-
},
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private getToken() {
|
|
55
|
-
return localStorage.getItem('token')
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private removeToken() {
|
|
59
|
-
localStorage.removeItem('token')
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public logout(): void {
|
|
63
|
-
this.removeToken()
|
|
64
|
-
window.location.href = '/sign-in'
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
private handleError(error: AxiosError): void {
|
|
68
|
-
if (error.response) {
|
|
69
|
-
console.error('API Error:', error.response.status, error.response.data)
|
|
70
|
-
} else if (error.request) {
|
|
71
|
-
console.error('No response received:', error.request)
|
|
72
|
-
} else {
|
|
73
|
-
console.error('Error during request setup:', error.message)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
protected async get<T>(url: string, options?: AxiosRequestConfig) {
|
|
78
|
-
try {
|
|
79
|
-
const response: AxiosResponse<T> = await this.axiosInstance.get<T>(url, options)
|
|
80
|
-
if (response?.data === false) return false as unknown as T
|
|
81
|
-
return response?.data ?? (response as unknown as T)
|
|
82
|
-
} catch (error) {
|
|
83
|
-
const axiosError = error as AxiosError
|
|
84
|
-
this.handleError(axiosError)
|
|
85
|
-
throw error
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
protected async delete<T>(url: string, options?: AxiosRequestConfig) {
|
|
90
|
-
try {
|
|
91
|
-
return await this.axiosInstance.delete<T>(url, options)
|
|
92
|
-
} catch (error) {
|
|
93
|
-
const axiosError = error as AxiosError
|
|
94
|
-
this.handleError(axiosError)
|
|
95
|
-
throw error
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
protected async post<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
|
|
100
|
-
try {
|
|
101
|
-
const response: AxiosResponse<T2> = await this.axiosInstance.post<T1, AxiosResponse<T2>>(url, payload, options)
|
|
102
|
-
if (response?.data === false) return false
|
|
103
|
-
return response?.data || (response as any)
|
|
104
|
-
} catch (error) {
|
|
105
|
-
const axiosError = error as AxiosError
|
|
106
|
-
this.handleError(axiosError)
|
|
107
|
-
throw error
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// protected patch<T1, T2>(url: string, payload: T1, type: ApiServiceType, options?: AxiosRequestConfig): Promise<T2> {
|
|
112
|
-
// return axios
|
|
113
|
-
// .patch<T1, AxiosResponse<T2>>(apiServiceUrls[type] + url, payload, options)
|
|
114
|
-
// .catch((err: AxiosError) => processError401<T2>(err))
|
|
115
|
-
// .then(extractData)
|
|
116
|
-
// }
|
|
117
|
-
//
|
|
118
|
-
protected async put<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
|
|
119
|
-
try {
|
|
120
|
-
const response: AxiosResponse<T2> = await this.axiosInstance.put<T1, AxiosResponse<T2>>(url, payload, options)
|
|
121
|
-
return response.data
|
|
122
|
-
} catch (error) {
|
|
123
|
-
const axiosError = error as AxiosError
|
|
124
|
-
this.handleError(axiosError)
|
|
125
|
-
throw error
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
1
|
+
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
|
2
|
+
|
|
3
|
+
export enum ApiServiceType {
|
|
4
|
+
SERVICE_AUTH = 'SERVICE_AUTH',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type ResponseApi<T> = {
|
|
8
|
+
count: number
|
|
9
|
+
current_page: number
|
|
10
|
+
data: T
|
|
11
|
+
per_page: number
|
|
12
|
+
total: number
|
|
13
|
+
total_pages: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default class ApiService {
|
|
17
|
+
private axiosInstance: AxiosInstance
|
|
18
|
+
|
|
19
|
+
constructor() {
|
|
20
|
+
this.axiosInstance = axios.create({
|
|
21
|
+
baseURL: process.env.VUE_APP_BACKEND,
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
Accept: 'application/json',
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
this.axiosInstance.interceptors.request.use(
|
|
29
|
+
(config: InternalAxiosRequestConfig) => {
|
|
30
|
+
const token = this.getToken()
|
|
31
|
+
if (token && config.headers) {
|
|
32
|
+
config.headers.Authorization = `Bearer ${token}`
|
|
33
|
+
}
|
|
34
|
+
return config
|
|
35
|
+
},
|
|
36
|
+
(error: AxiosError) => {
|
|
37
|
+
return Promise.reject(error)
|
|
38
|
+
},
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
this.axiosInstance.interceptors.response.use(
|
|
42
|
+
(response: AxiosResponse) => {
|
|
43
|
+
return response.data
|
|
44
|
+
},
|
|
45
|
+
(error: AxiosError) => {
|
|
46
|
+
if (error.response?.status === 401 || error.response?.status === 403) {
|
|
47
|
+
this.logout()
|
|
48
|
+
}
|
|
49
|
+
return Promise.reject(error)
|
|
50
|
+
},
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private getToken() {
|
|
55
|
+
return localStorage.getItem('token')
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private removeToken() {
|
|
59
|
+
localStorage.removeItem('token')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public logout(): void {
|
|
63
|
+
this.removeToken()
|
|
64
|
+
window.location.href = '/sign-in'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private handleError(error: AxiosError): void {
|
|
68
|
+
if (error.response) {
|
|
69
|
+
console.error('API Error:', error.response.status, error.response.data)
|
|
70
|
+
} else if (error.request) {
|
|
71
|
+
console.error('No response received:', error.request)
|
|
72
|
+
} else {
|
|
73
|
+
console.error('Error during request setup:', error.message)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected async get<T>(url: string, options?: AxiosRequestConfig) {
|
|
78
|
+
try {
|
|
79
|
+
const response: AxiosResponse<T> = await this.axiosInstance.get<T>(url, options)
|
|
80
|
+
if (response?.data === false) return false as unknown as T
|
|
81
|
+
return response?.data ?? (response as unknown as T)
|
|
82
|
+
} catch (error) {
|
|
83
|
+
const axiosError = error as AxiosError
|
|
84
|
+
this.handleError(axiosError)
|
|
85
|
+
throw error
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
protected async delete<T>(url: string, options?: AxiosRequestConfig) {
|
|
90
|
+
try {
|
|
91
|
+
return await this.axiosInstance.delete<T>(url, options)
|
|
92
|
+
} catch (error) {
|
|
93
|
+
const axiosError = error as AxiosError
|
|
94
|
+
this.handleError(axiosError)
|
|
95
|
+
throw error
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
protected async post<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
|
|
100
|
+
try {
|
|
101
|
+
const response: AxiosResponse<T2> = await this.axiosInstance.post<T1, AxiosResponse<T2>>(url, payload, options)
|
|
102
|
+
if (response?.data === false) return false
|
|
103
|
+
return response?.data || (response as any)
|
|
104
|
+
} catch (error) {
|
|
105
|
+
const axiosError = error as AxiosError
|
|
106
|
+
this.handleError(axiosError)
|
|
107
|
+
throw error
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// protected patch<T1, T2>(url: string, payload: T1, type: ApiServiceType, options?: AxiosRequestConfig): Promise<T2> {
|
|
112
|
+
// return axios
|
|
113
|
+
// .patch<T1, AxiosResponse<T2>>(apiServiceUrls[type] + url, payload, options)
|
|
114
|
+
// .catch((err: AxiosError) => processError401<T2>(err))
|
|
115
|
+
// .then(extractData)
|
|
116
|
+
// }
|
|
117
|
+
//
|
|
118
|
+
protected async put<T1, T2>(url: string, payload: T1, options?: AxiosRequestConfig) {
|
|
119
|
+
try {
|
|
120
|
+
const response: AxiosResponse<T2> = await this.axiosInstance.put<T1, AxiosResponse<T2>>(url, payload, options)
|
|
121
|
+
return response.data
|
|
122
|
+
} catch (error) {
|
|
123
|
+
const axiosError = error as AxiosError
|
|
124
|
+
this.handleError(axiosError)
|
|
125
|
+
throw error
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -23,7 +23,7 @@ export interface ControlMeta {
|
|
|
23
23
|
currentPage: number
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export
|
|
26
|
+
export type FiltersValue = {
|
|
27
27
|
users?: {
|
|
28
28
|
users: Api_User_Dto[]
|
|
29
29
|
}
|
|
@@ -37,12 +37,12 @@ export interface FiltersValue {
|
|
|
37
37
|
status: boolean
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
export
|
|
40
|
+
export type Api_Instrument_Dto = {
|
|
41
41
|
id: string
|
|
42
42
|
name: string
|
|
43
43
|
storage_id?: string
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type Api_Warehouse_Dto = {
|
|
46
46
|
id: string
|
|
47
47
|
invoice_ref_key: string
|
|
48
48
|
inventory_number: string
|
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-btn
|
|
3
|
-
v-bind="$props"
|
|
4
|
-
:class="[$style.wrapper]"
|
|
5
|
-
:disable="isDisabled"
|
|
6
|
-
:no-caps="!uppercase"
|
|
7
|
-
:no-wrap="!wrap"
|
|
8
|
-
class="hover-bg-secondary hover-text-black"
|
|
9
|
-
@click="onClick"
|
|
10
|
-
>
|
|
11
|
-
<slot></slot>
|
|
12
|
-
<q-badge
|
|
13
|
-
v-if="badge"
|
|
14
|
-
style="padding: 6px; top: -10px; right: -10px; font-size: 12px"
|
|
15
|
-
:color="badgeColor"
|
|
16
|
-
:floating="!badgeInline"
|
|
17
|
-
:rounded="true"
|
|
18
|
-
>{{ badgeText }}</q-badge
|
|
19
|
-
>
|
|
20
|
-
<q-tooltip v-if="tooltip" class="text-body2" :delay="400">{{ tooltip }}</q-tooltip>
|
|
21
|
-
</q-btn>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script lang="ts" setup>
|
|
25
|
-
import { computed, defineProps, defineEmits } from 'vue'
|
|
26
|
-
|
|
27
|
-
interface QBtnProps {
|
|
28
|
-
size?: string | undefined
|
|
29
|
-
type?: string | undefined
|
|
30
|
-
to?: string | any | undefined
|
|
31
|
-
replace?: boolean | undefined
|
|
32
|
-
href?: string | undefined
|
|
33
|
-
target?: string | undefined
|
|
34
|
-
label?: string | number | undefined
|
|
35
|
-
icon?: string | undefined
|
|
36
|
-
iconRight?: string | undefined
|
|
37
|
-
outline?: boolean | undefined
|
|
38
|
-
flat?: boolean | undefined
|
|
39
|
-
unelevated?: boolean | undefined
|
|
40
|
-
rounded?: boolean | undefined
|
|
41
|
-
push?: boolean | undefined
|
|
42
|
-
square?: boolean | undefined
|
|
43
|
-
glossy?: boolean | undefined
|
|
44
|
-
fab?: boolean | undefined
|
|
45
|
-
fabMini?: boolean | undefined
|
|
46
|
-
padding?: string | undefined
|
|
47
|
-
color?: string | undefined
|
|
48
|
-
textColor?: string | undefined
|
|
49
|
-
noCaps?: boolean | undefined
|
|
50
|
-
noWrap?: boolean | undefined
|
|
51
|
-
dense?: boolean | undefined
|
|
52
|
-
ripple?: boolean | any | undefined
|
|
53
|
-
tabindex?: number | string | undefined
|
|
54
|
-
align?: 'left' | 'right' | 'center' | 'around' | 'between' | 'evenly' | undefined
|
|
55
|
-
stack?: boolean | undefined
|
|
56
|
-
stretch?: boolean | undefined
|
|
57
|
-
loading?: boolean | undefined
|
|
58
|
-
round?: boolean | undefined
|
|
59
|
-
percentage?: number | undefined
|
|
60
|
-
darkPercentage?: boolean | undefined
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface Props extends QBtnProps {
|
|
64
|
-
disable?: boolean | ((...args: any[]) => boolean)
|
|
65
|
-
tooltip?: string
|
|
66
|
-
uppercase?: boolean
|
|
67
|
-
xSmall?: boolean
|
|
68
|
-
small?: boolean
|
|
69
|
-
large?: boolean
|
|
70
|
-
fullWidth?: boolean
|
|
71
|
-
wrap?: boolean
|
|
72
|
-
largeIcon?: boolean
|
|
73
|
-
modelValue?: boolean
|
|
74
|
-
badge?: string | boolean | number
|
|
75
|
-
badgeColor?: string
|
|
76
|
-
badgeInline?: boolean
|
|
77
|
-
link?: boolean
|
|
78
|
-
borderColor?: string
|
|
79
|
-
borderRadius?: string
|
|
80
|
-
borderWidth?: string
|
|
81
|
-
width?: string
|
|
82
|
-
height?: string
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
86
|
-
borderRadius: '16px',
|
|
87
|
-
borderWidth: '1px',
|
|
88
|
-
width: 'auto',
|
|
89
|
-
height: 'auto',
|
|
90
|
-
disable: false,
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
const emit = defineEmits(['update:modelValue', 'click'])
|
|
94
|
-
|
|
95
|
-
function onClick(event: any) {
|
|
96
|
-
emit('click', event)
|
|
97
|
-
emit('update:modelValue', !props.modelValue)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const badgeText = computed(() => {
|
|
101
|
-
if (props.badge === undefined || props.badge === false) return ''
|
|
102
|
-
if (props.badge === true || props.badge === '') return ''
|
|
103
|
-
return props.badge
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
// const btnClasses = computed(() => {
|
|
107
|
-
// return {
|
|
108
|
-
// '--icon': props.icon && !props.label,
|
|
109
|
-
// '--width-left-icon': props.icon && props.label,
|
|
110
|
-
// '--width-right-icon': props.iconRight && props.label,
|
|
111
|
-
// '--default': !props.small && !props.large && !props.xSmall,
|
|
112
|
-
// '--x-small': props.xSmall,
|
|
113
|
-
// '--small': props.small,
|
|
114
|
-
// '--large': props.large,
|
|
115
|
-
// '--full-width': props.fullWidth,
|
|
116
|
-
// '--large-icon': props.largeIcon,
|
|
117
|
-
// '--is-active': props.modelValue,
|
|
118
|
-
// '--link': props.link,
|
|
119
|
-
// '--loading': props.loading,
|
|
120
|
-
// }
|
|
121
|
-
// })
|
|
122
|
-
|
|
123
|
-
const isDisabled = computed(() => {
|
|
124
|
-
return typeof props.disable === 'function' ? props.disable() : props.disable
|
|
125
|
-
})
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<style lang="scss" module>
|
|
129
|
-
.wrapper {
|
|
130
|
-
flex: 0 0 auto;
|
|
131
|
-
width: v-bind(width);
|
|
132
|
-
height: v-bind(height);
|
|
133
|
-
&:global(.q-btn--rounded) {
|
|
134
|
-
border-radius: v-bind(borderRadius);
|
|
135
|
-
}
|
|
136
|
-
&:global(.q-btn--outline:before) {
|
|
137
|
-
border-width: v-bind(borderWidth);
|
|
138
|
-
}
|
|
139
|
-
&:global(.q-btn) {
|
|
140
|
-
color: #0a1629;
|
|
141
|
-
font-size: 16px;
|
|
142
|
-
font-style: normal;
|
|
143
|
-
font-weight: 700;
|
|
144
|
-
font-family: NunitoSansFont, sans-serif;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
&:global(.--loading) {
|
|
148
|
-
span:has(> svg) {
|
|
149
|
-
overflow: hidden;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
:global(.q-icon) {
|
|
154
|
-
font-size: 1.2em;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
&:global(.--large-icon .q-icon) {
|
|
158
|
-
font-size: 1.715em;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
&:global(.--full-width) {
|
|
162
|
-
width: 100%;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
&:global(.--link) {
|
|
166
|
-
padding: 0 8px;
|
|
167
|
-
display: inline;
|
|
168
|
-
min-height: unset;
|
|
169
|
-
font-size: inherit;
|
|
170
|
-
text-decoration: underline;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-btn
|
|
3
|
+
v-bind="$props"
|
|
4
|
+
:class="[$style.wrapper]"
|
|
5
|
+
:disable="isDisabled"
|
|
6
|
+
:no-caps="!uppercase"
|
|
7
|
+
:no-wrap="!wrap"
|
|
8
|
+
class="hover-bg-secondary hover-text-black"
|
|
9
|
+
@click="onClick"
|
|
10
|
+
>
|
|
11
|
+
<slot></slot>
|
|
12
|
+
<q-badge
|
|
13
|
+
v-if="badge"
|
|
14
|
+
style="padding: 6px; top: -10px; right: -10px; font-size: 12px"
|
|
15
|
+
:color="badgeColor"
|
|
16
|
+
:floating="!badgeInline"
|
|
17
|
+
:rounded="true"
|
|
18
|
+
>{{ badgeText }}</q-badge
|
|
19
|
+
>
|
|
20
|
+
<q-tooltip v-if="tooltip" class="text-body2" :delay="400">{{ tooltip }}</q-tooltip>
|
|
21
|
+
</q-btn>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { computed, defineProps, defineEmits } from 'vue'
|
|
26
|
+
|
|
27
|
+
interface QBtnProps {
|
|
28
|
+
size?: string | undefined
|
|
29
|
+
type?: string | undefined
|
|
30
|
+
to?: string | any | undefined
|
|
31
|
+
replace?: boolean | undefined
|
|
32
|
+
href?: string | undefined
|
|
33
|
+
target?: string | undefined
|
|
34
|
+
label?: string | number | undefined
|
|
35
|
+
icon?: string | undefined
|
|
36
|
+
iconRight?: string | undefined
|
|
37
|
+
outline?: boolean | undefined
|
|
38
|
+
flat?: boolean | undefined
|
|
39
|
+
unelevated?: boolean | undefined
|
|
40
|
+
rounded?: boolean | undefined
|
|
41
|
+
push?: boolean | undefined
|
|
42
|
+
square?: boolean | undefined
|
|
43
|
+
glossy?: boolean | undefined
|
|
44
|
+
fab?: boolean | undefined
|
|
45
|
+
fabMini?: boolean | undefined
|
|
46
|
+
padding?: string | undefined
|
|
47
|
+
color?: string | undefined
|
|
48
|
+
textColor?: string | undefined
|
|
49
|
+
noCaps?: boolean | undefined
|
|
50
|
+
noWrap?: boolean | undefined
|
|
51
|
+
dense?: boolean | undefined
|
|
52
|
+
ripple?: boolean | any | undefined
|
|
53
|
+
tabindex?: number | string | undefined
|
|
54
|
+
align?: 'left' | 'right' | 'center' | 'around' | 'between' | 'evenly' | undefined
|
|
55
|
+
stack?: boolean | undefined
|
|
56
|
+
stretch?: boolean | undefined
|
|
57
|
+
loading?: boolean | undefined
|
|
58
|
+
round?: boolean | undefined
|
|
59
|
+
percentage?: number | undefined
|
|
60
|
+
darkPercentage?: boolean | undefined
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface Props extends QBtnProps {
|
|
64
|
+
disable?: boolean | ((...args: any[]) => boolean)
|
|
65
|
+
tooltip?: string
|
|
66
|
+
uppercase?: boolean
|
|
67
|
+
xSmall?: boolean
|
|
68
|
+
small?: boolean
|
|
69
|
+
large?: boolean
|
|
70
|
+
fullWidth?: boolean
|
|
71
|
+
wrap?: boolean
|
|
72
|
+
largeIcon?: boolean
|
|
73
|
+
modelValue?: boolean
|
|
74
|
+
badge?: string | boolean | number
|
|
75
|
+
badgeColor?: string
|
|
76
|
+
badgeInline?: boolean
|
|
77
|
+
link?: boolean
|
|
78
|
+
borderColor?: string
|
|
79
|
+
borderRadius?: string
|
|
80
|
+
borderWidth?: string
|
|
81
|
+
width?: string
|
|
82
|
+
height?: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
86
|
+
borderRadius: '16px',
|
|
87
|
+
borderWidth: '1px',
|
|
88
|
+
width: 'auto',
|
|
89
|
+
height: 'auto',
|
|
90
|
+
disable: false,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const emit = defineEmits(['update:modelValue', 'click'])
|
|
94
|
+
|
|
95
|
+
function onClick(event: any) {
|
|
96
|
+
emit('click', event)
|
|
97
|
+
emit('update:modelValue', !props.modelValue)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const badgeText = computed(() => {
|
|
101
|
+
if (props.badge === undefined || props.badge === false) return ''
|
|
102
|
+
if (props.badge === true || props.badge === '') return ''
|
|
103
|
+
return props.badge
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// const btnClasses = computed(() => {
|
|
107
|
+
// return {
|
|
108
|
+
// '--icon': props.icon && !props.label,
|
|
109
|
+
// '--width-left-icon': props.icon && props.label,
|
|
110
|
+
// '--width-right-icon': props.iconRight && props.label,
|
|
111
|
+
// '--default': !props.small && !props.large && !props.xSmall,
|
|
112
|
+
// '--x-small': props.xSmall,
|
|
113
|
+
// '--small': props.small,
|
|
114
|
+
// '--large': props.large,
|
|
115
|
+
// '--full-width': props.fullWidth,
|
|
116
|
+
// '--large-icon': props.largeIcon,
|
|
117
|
+
// '--is-active': props.modelValue,
|
|
118
|
+
// '--link': props.link,
|
|
119
|
+
// '--loading': props.loading,
|
|
120
|
+
// }
|
|
121
|
+
// })
|
|
122
|
+
|
|
123
|
+
const isDisabled = computed(() => {
|
|
124
|
+
return typeof props.disable === 'function' ? props.disable() : props.disable
|
|
125
|
+
})
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<style lang="scss" module>
|
|
129
|
+
.wrapper {
|
|
130
|
+
flex: 0 0 auto;
|
|
131
|
+
width: v-bind(width);
|
|
132
|
+
height: v-bind(height);
|
|
133
|
+
&:global(.q-btn--rounded) {
|
|
134
|
+
border-radius: v-bind(borderRadius);
|
|
135
|
+
}
|
|
136
|
+
&:global(.q-btn--outline:before) {
|
|
137
|
+
border-width: v-bind(borderWidth);
|
|
138
|
+
}
|
|
139
|
+
&:global(.q-btn) {
|
|
140
|
+
color: #0a1629;
|
|
141
|
+
font-size: 16px;
|
|
142
|
+
font-style: normal;
|
|
143
|
+
font-weight: 700;
|
|
144
|
+
font-family: NunitoSansFont, sans-serif;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:global(.--loading) {
|
|
148
|
+
span:has(> svg) {
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:global(.q-icon) {
|
|
154
|
+
font-size: 1.2em;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&:global(.--large-icon .q-icon) {
|
|
158
|
+
font-size: 1.715em;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&:global(.--full-width) {
|
|
162
|
+
width: 100%;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&:global(.--link) {
|
|
166
|
+
padding: 0 8px;
|
|
167
|
+
display: inline;
|
|
168
|
+
min-height: unset;
|
|
169
|
+
font-size: inherit;
|
|
170
|
+
text-decoration: underline;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
</style>
|