ch3chi-commons-vue 0.1.13 → 1.2.0
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/README.md +138 -5
- package/dist/api/ApiService.d.ts +109 -2
- package/dist/auth/AuthorizationService.d.ts +1 -2
- package/dist/auth/PermissionDescriptor.d.ts +37 -0
- package/dist/components/CAlertDefine.d.ts +2 -0
- package/dist/components/CGlobalSpinner.vue.d.ts +3 -0
- package/dist/components/CTable.vue.d.ts +24 -0
- package/dist/components/CTableDefine.d.ts +76 -0
- package/dist/components/CTableTD.vue.d.ts +7 -0
- package/dist/components/form/CChangePasswordFormField.vue.d.ts +14 -0
- package/dist/components/form/CCheckBoxFormField.vue.d.ts +30 -0
- package/dist/components/form/CDateFormField.vue.d.ts +17 -0
- package/dist/components/form/CDateQueryField.vue.d.ts +16 -0
- package/dist/components/form/CDateRangeFormField.vue.d.ts +17 -0
- package/dist/components/form/CFilePickerFormField.vue.d.ts +28 -0
- package/dist/components/form/CRadioFormField.vue.d.ts +30 -0
- package/dist/components/form/CSelectFormField.vue.d.ts +18 -0
- package/dist/components/form/CTextAreaFormField.vue.d.ts +16 -0
- package/dist/components/form/CTextInputFormField.vue.d.ts +22 -0
- package/dist/directive/CFTurnstileDirective.d.ts +6 -0
- package/dist/directive/PermissionDirective.d.ts +15 -0
- package/dist/index.cjs.js +19103 -6
- package/dist/index.d.ts +39 -1
- package/dist/index.es.js +18352 -4318
- package/dist/model/BSFieldStyleConfig.d.ts +121 -0
- package/dist/model/BaseDictionary.d.ts +34 -0
- package/dist/model/BaseFormDataModel.d.ts +4 -0
- package/dist/model/BaseListViewModel.d.ts +21 -0
- package/dist/model/CMenuItem.d.ts +2 -0
- package/dist/model/FormOptions.d.ts +8 -3
- package/dist/model/LoginDataModel.d.ts +1 -0
- package/dist/model/QueryParameter.d.ts +3 -5
- package/dist/model/SessionUser.d.ts +17 -2
- package/dist/model/ShowMessageDataModel.d.ts +44 -0
- package/dist/model/TokenUser.d.ts +50 -0
- package/dist/stores/ViewStore.d.ts +314 -180
- package/dist/style.css +223 -0
- package/dist/utils/CToolUtils.d.ts +12 -0
- package/package.json +26 -4
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { ComponentPublicInstance } from 'vue';
|
|
2
|
+
import { DefineStoreOptions } from 'pinia';
|
|
2
3
|
import { default as CAlert } from '../components/CAlert.vue';
|
|
3
4
|
import { CAlertModalData } from '../components/CAlertDefine';
|
|
4
5
|
import { default as CBSToast } from '../components/CBSToast.vue';
|
|
5
6
|
import { default as CGlobalSpinner } from '../components/CGlobalSpinner.vue';
|
|
6
7
|
import { SessionUser } from '../model/SessionUser';
|
|
7
8
|
import { CMenuItem } from '../model/CMenuItem';
|
|
9
|
+
import { ShowMessageType } from '../model/ShowMessageDataModel';
|
|
10
|
+
import { AccessToken } from '../model/TokenUser';
|
|
11
|
+
import { BaseDictionary, CBaseDictionary } from '../model/BaseDictionary';
|
|
8
12
|
export type RouterNavigationType = 'push' | 'back' | 'forward' | 'unknown';
|
|
9
13
|
/**
|
|
10
|
-
*
|
|
14
|
+
* 全局視圖相關的狀態
|
|
11
15
|
*/
|
|
12
|
-
export
|
|
16
|
+
export type GlobalViewState = {
|
|
13
17
|
navigationType: RouterNavigationType;
|
|
14
18
|
isSidebarOpen: boolean;
|
|
15
19
|
mainBSModal: ComponentPublicInstance<typeof CAlert> | null;
|
|
16
20
|
toastView: ComponentPublicInstance<typeof CBSToast> | null;
|
|
17
21
|
globalSpinner: ComponentPublicInstance<typeof CGlobalSpinner> | null;
|
|
18
22
|
version: string;
|
|
19
|
-
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* 全局視圖相關的行為
|
|
26
|
+
*/
|
|
27
|
+
export interface GlobalViewActions {
|
|
20
28
|
routerNavigationType(type: RouterNavigationType): void;
|
|
21
29
|
toggleSidebar(): void;
|
|
22
30
|
showModal(data: CAlertModalData): void;
|
|
@@ -28,188 +36,314 @@ export declare const useViewStore: import('pinia').StoreDefinition<"view", {
|
|
|
28
36
|
showSpinner(): void;
|
|
29
37
|
hideSpinner(): void;
|
|
30
38
|
setVersion(version: string): void;
|
|
31
|
-
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 全局視圖相關的 getters
|
|
42
|
+
*/
|
|
43
|
+
export interface GlobalViewGetters {
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 全局視圖 store 定義類型
|
|
47
|
+
*/
|
|
48
|
+
export type GlobalViewStoreOptionDefine = Omit<DefineStoreOptions<'view', GlobalViewState, GlobalViewGetters, GlobalViewActions>, 'id'>;
|
|
32
49
|
/**
|
|
33
|
-
*
|
|
50
|
+
* 全局視圖 store 定義
|
|
34
51
|
*/
|
|
35
|
-
export declare const
|
|
36
|
-
|
|
52
|
+
export declare const globalViewStoreOptions: GlobalViewStoreOptionDefine;
|
|
53
|
+
/**
|
|
54
|
+
* 保存視圖相關的狀態,例如側邊欄開啟狀態、模態框、Toast、全局加載等
|
|
55
|
+
*/
|
|
56
|
+
export declare const useViewStore: import('pinia').StoreDefinition<"view", GlobalViewState, GlobalViewGetters & ThisType<{
|
|
57
|
+
navigationType: RouterNavigationType;
|
|
58
|
+
isSidebarOpen: boolean;
|
|
59
|
+
mainBSModal: ComponentPublicInstance<typeof CAlert> | null;
|
|
60
|
+
toastView: ComponentPublicInstance<typeof CBSToast> | null;
|
|
61
|
+
globalSpinner: ComponentPublicInstance<typeof CGlobalSpinner> | null;
|
|
62
|
+
version: string;
|
|
63
|
+
} & {} & {} & import('pinia').PiniaCustomProperties<string, import('pinia').StateTree, import('pinia')._GettersTree<import('pinia').StateTree>, import('pinia')._ActionsTree>> & import('pinia')._GettersTree<GlobalViewState>, GlobalViewActions & ThisType<GlobalViewActions & {
|
|
64
|
+
navigationType: RouterNavigationType;
|
|
65
|
+
isSidebarOpen: boolean;
|
|
66
|
+
mainBSModal: ComponentPublicInstance<typeof CAlert> | null;
|
|
67
|
+
toastView: ComponentPublicInstance<typeof CBSToast> | null;
|
|
68
|
+
globalSpinner: ComponentPublicInstance<typeof CGlobalSpinner> | null;
|
|
69
|
+
version: string;
|
|
70
|
+
} & import('pinia')._StoreWithState<"view", GlobalViewState, GlobalViewGetters, GlobalViewActions> & {} & {} & import('pinia').PiniaCustomProperties<string, import('pinia').StateTree, import('pinia')._GettersTree<import('pinia').StateTree>, import('pinia')._ActionsTree>>>;
|
|
71
|
+
export declare const __GlobalViewStoreDefine__: GlobalViewState & GlobalViewActions & GlobalViewGetters & GlobalViewStoreOptionDefine;
|
|
72
|
+
/**
|
|
73
|
+
* 使用者會話相關的狀態
|
|
74
|
+
*/
|
|
75
|
+
export type UserSessionState<T extends SessionUser = SessionUser> = {
|
|
76
|
+
user: T | null;
|
|
77
|
+
token?: AccessToken | null;
|
|
37
78
|
isAuth: boolean;
|
|
38
79
|
sessionCheckTimer: number | null;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
51
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
52
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
53
|
-
} | null;
|
|
54
|
-
isAuth: boolean;
|
|
55
|
-
sessionCheckTimer: number | null;
|
|
56
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
57
|
-
user: SessionUser | null;
|
|
58
|
-
isAuth: boolean;
|
|
59
|
-
sessionCheckTimer: number | null;
|
|
60
|
-
}>) => boolean;
|
|
61
|
-
userUid: (state: {
|
|
62
|
-
user: {
|
|
63
|
-
sub?: string | undefined;
|
|
64
|
-
iat?: number | undefined;
|
|
65
|
-
account?: string | undefined;
|
|
66
|
-
name?: string | undefined;
|
|
67
|
-
email?: string | undefined;
|
|
68
|
-
roleCode?: string | undefined;
|
|
69
|
-
roleName?: string | undefined;
|
|
70
|
-
permissions?: string[] | undefined;
|
|
71
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
72
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
73
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
74
|
-
} | null;
|
|
75
|
-
isAuth: boolean;
|
|
76
|
-
sessionCheckTimer: number | null;
|
|
77
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
78
|
-
user: SessionUser | null;
|
|
79
|
-
isAuth: boolean;
|
|
80
|
-
sessionCheckTimer: number | null;
|
|
81
|
-
}>) => string | undefined;
|
|
82
|
-
account: (state: {
|
|
83
|
-
user: {
|
|
84
|
-
sub?: string | undefined;
|
|
85
|
-
iat?: number | undefined;
|
|
86
|
-
account?: string | undefined;
|
|
87
|
-
name?: string | undefined;
|
|
88
|
-
email?: string | undefined;
|
|
89
|
-
roleCode?: string | undefined;
|
|
90
|
-
roleName?: string | undefined;
|
|
91
|
-
permissions?: string[] | undefined;
|
|
92
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
93
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
94
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
95
|
-
} | null;
|
|
96
|
-
isAuth: boolean;
|
|
97
|
-
sessionCheckTimer: number | null;
|
|
98
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
99
|
-
user: SessionUser | null;
|
|
100
|
-
isAuth: boolean;
|
|
101
|
-
sessionCheckTimer: number | null;
|
|
102
|
-
}>) => string | undefined;
|
|
103
|
-
userName: (state: {
|
|
104
|
-
user: {
|
|
105
|
-
sub?: string | undefined;
|
|
106
|
-
iat?: number | undefined;
|
|
107
|
-
account?: string | undefined;
|
|
108
|
-
name?: string | undefined;
|
|
109
|
-
email?: string | undefined;
|
|
110
|
-
roleCode?: string | undefined;
|
|
111
|
-
roleName?: string | undefined;
|
|
112
|
-
permissions?: string[] | undefined;
|
|
113
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
114
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
115
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
116
|
-
} | null;
|
|
117
|
-
isAuth: boolean;
|
|
118
|
-
sessionCheckTimer: number | null;
|
|
119
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
120
|
-
user: SessionUser | null;
|
|
121
|
-
isAuth: boolean;
|
|
122
|
-
sessionCheckTimer: number | null;
|
|
123
|
-
}>) => string | undefined;
|
|
124
|
-
email: (state: {
|
|
125
|
-
user: {
|
|
126
|
-
sub?: string | undefined;
|
|
127
|
-
iat?: number | undefined;
|
|
128
|
-
account?: string | undefined;
|
|
129
|
-
name?: string | undefined;
|
|
130
|
-
email?: string | undefined;
|
|
131
|
-
roleCode?: string | undefined;
|
|
132
|
-
roleName?: string | undefined;
|
|
133
|
-
permissions?: string[] | undefined;
|
|
134
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
135
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
136
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
137
|
-
} | null;
|
|
138
|
-
isAuth: boolean;
|
|
139
|
-
sessionCheckTimer: number | null;
|
|
140
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
141
|
-
user: SessionUser | null;
|
|
142
|
-
isAuth: boolean;
|
|
143
|
-
sessionCheckTimer: number | null;
|
|
144
|
-
}>) => string | undefined;
|
|
145
|
-
roleCode: (state: {
|
|
146
|
-
user: {
|
|
147
|
-
sub?: string | undefined;
|
|
148
|
-
iat?: number | undefined;
|
|
149
|
-
account?: string | undefined;
|
|
150
|
-
name?: string | undefined;
|
|
151
|
-
email?: string | undefined;
|
|
152
|
-
roleCode?: string | undefined;
|
|
153
|
-
roleName?: string | undefined;
|
|
154
|
-
permissions?: string[] | undefined;
|
|
155
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
156
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
157
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
158
|
-
} | null;
|
|
159
|
-
isAuth: boolean;
|
|
160
|
-
sessionCheckTimer: number | null;
|
|
161
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
162
|
-
user: SessionUser | null;
|
|
163
|
-
isAuth: boolean;
|
|
164
|
-
sessionCheckTimer: number | null;
|
|
165
|
-
}>) => string | undefined;
|
|
166
|
-
permissions: (state: {
|
|
167
|
-
user: {
|
|
168
|
-
sub?: string | undefined;
|
|
169
|
-
iat?: number | undefined;
|
|
170
|
-
account?: string | undefined;
|
|
171
|
-
name?: string | undefined;
|
|
172
|
-
email?: string | undefined;
|
|
173
|
-
roleCode?: string | undefined;
|
|
174
|
-
roleName?: string | undefined;
|
|
175
|
-
permissions?: string[] | undefined;
|
|
176
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
177
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
178
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
179
|
-
} | null;
|
|
180
|
-
isAuth: boolean;
|
|
181
|
-
sessionCheckTimer: number | null;
|
|
182
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
183
|
-
user: SessionUser | null;
|
|
184
|
-
isAuth: boolean;
|
|
185
|
-
sessionCheckTimer: number | null;
|
|
186
|
-
}>) => string[] | undefined;
|
|
187
|
-
menuItems(): CMenuItem[];
|
|
188
|
-
caseDataScope: (state: {
|
|
189
|
-
user: {
|
|
190
|
-
sub?: string | undefined;
|
|
191
|
-
iat?: number | undefined;
|
|
192
|
-
account?: string | undefined;
|
|
193
|
-
name?: string | undefined;
|
|
194
|
-
email?: string | undefined;
|
|
195
|
-
roleCode?: string | undefined;
|
|
196
|
-
roleName?: string | undefined;
|
|
197
|
-
permissions?: string[] | undefined;
|
|
198
|
-
load: (data: Record<string, any>) => SessionUser;
|
|
199
|
-
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
200
|
-
process: (data: Record<string, any>) => Record<string, any>;
|
|
201
|
-
} | null;
|
|
202
|
-
isAuth: boolean;
|
|
203
|
-
sessionCheckTimer: number | null;
|
|
204
|
-
} & import('pinia').PiniaCustomStateProperties<{
|
|
205
|
-
user: SessionUser | null;
|
|
206
|
-
isAuth: boolean;
|
|
207
|
-
sessionCheckTimer: number | null;
|
|
208
|
-
}>) => never[];
|
|
209
|
-
}, {
|
|
210
|
-
saveUser(user: SessionUser | null): void;
|
|
80
|
+
shouldRedirectToLogin: boolean | null;
|
|
81
|
+
shouldRedirectToMessage?: boolean;
|
|
82
|
+
redirectMessageType?: ShowMessageType | null;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* 使用者會話相關的行為
|
|
86
|
+
*/
|
|
87
|
+
export interface UserSessionActions<T extends SessionUser = SessionUser> {
|
|
88
|
+
saveUser(user: T | null): void;
|
|
89
|
+
saveToken(token: AccessToken | null): void;
|
|
90
|
+
setAuthenticated(isAuth: boolean): void;
|
|
211
91
|
checkSessionIsValid(): Promise<boolean>;
|
|
92
|
+
validateSession(helper: () => Promise<T>): Promise<boolean>;
|
|
93
|
+
refreshToken(helper: () => Promise<AccessToken>): Promise<boolean>;
|
|
212
94
|
startSessionCheck(): void;
|
|
213
95
|
stopSessionCheck(): void;
|
|
96
|
+
hasPermission(needPermission: string | string[]): boolean;
|
|
214
97
|
logout(): void;
|
|
215
|
-
|
|
98
|
+
triggerManualLogout: () => void;
|
|
99
|
+
resetShouldRedirectToLogin: () => void;
|
|
100
|
+
triggerAuthFailedRedirect: () => void;
|
|
101
|
+
resetAuthFailedRedirect: () => void;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 使用者會話相關的 getters
|
|
105
|
+
*/
|
|
106
|
+
export interface UserSessionGetters<T extends SessionUser = SessionUser> {
|
|
107
|
+
currentUser(state: UserSessionState<T>): T | null;
|
|
108
|
+
currentToken(state: UserSessionState<T>): AccessToken | null;
|
|
109
|
+
isAuthenticated(state: UserSessionState<T>): boolean;
|
|
110
|
+
userUid(state: UserSessionState<T>): string | undefined;
|
|
111
|
+
account(state: UserSessionState<T>): string | undefined;
|
|
112
|
+
userName(state: UserSessionState<T>): string | undefined;
|
|
113
|
+
email(state: UserSessionState<T>): string | undefined;
|
|
114
|
+
roleCode(state: UserSessionState<T>): string | undefined;
|
|
115
|
+
permissions(state: UserSessionState<T>): string[] | undefined;
|
|
116
|
+
menuItems(): CMenuItem[];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 使用者會話 store 定義類型
|
|
120
|
+
*/
|
|
121
|
+
export type UserSessionStoreOptionDefine<T extends SessionUser = SessionUser> = Omit<DefineStoreOptions<'session', UserSessionState<T>, UserSessionGetters<T>, UserSessionActions<T>>, 'id'>;
|
|
122
|
+
/**
|
|
123
|
+
* 使用者會話 store 定義
|
|
124
|
+
* 此方式僅適用於 SessionUser 類型,只使用 session 當作帳號權限驗證
|
|
125
|
+
*/
|
|
126
|
+
export declare const userSessionStoreOptions: UserSessionStoreOptionDefine<SessionUser>;
|
|
127
|
+
/**
|
|
128
|
+
* 持久化設定選項
|
|
129
|
+
*/
|
|
130
|
+
export interface PersistOptions<T extends SessionUser = SessionUser> {
|
|
131
|
+
enabled?: boolean;
|
|
132
|
+
key?: string;
|
|
133
|
+
storage?: Storage;
|
|
134
|
+
paths?: string[];
|
|
135
|
+
userConstructor?: new () => T;
|
|
136
|
+
serializer?: {
|
|
137
|
+
serialize: (state: any) => string;
|
|
138
|
+
deserialize: (str: string) => any;
|
|
139
|
+
};
|
|
140
|
+
onLogout?: (user: T | null, token: AccessToken | null) => void;
|
|
141
|
+
onLogin?: (user: T) => void;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 創建使用者會話 store 選項的工廠函數,支援自訂的 SessionUser 類型
|
|
145
|
+
* @param persistOptions
|
|
146
|
+
*/
|
|
147
|
+
export declare function createUserSessionOptions<T extends SessionUser = SessionUser>(persistOptions?: PersistOptions<T>): UserSessionStoreOptionDefine<T>;
|
|
148
|
+
/**
|
|
149
|
+
* 創建使用者會話 store 的工廠函數,支援自訂的 SessionUser 類型
|
|
150
|
+
*/
|
|
151
|
+
export declare function createUserSessionStore<T extends SessionUser = SessionUser>(storeId?: string, persistOptions?: PersistOptions<T>): import('pinia').StoreDefinition<string, UserSessionState<T>, UserSessionGetters<T> & ThisType<{
|
|
152
|
+
user: import('vue').UnwrapRef<T> | null;
|
|
153
|
+
token?: {
|
|
154
|
+
tokenType?: string | undefined;
|
|
155
|
+
accessToken?: string | undefined;
|
|
156
|
+
accessTokenExpiresAt?: string | undefined;
|
|
157
|
+
refreshToken?: string | undefined;
|
|
158
|
+
refreshTokenExpiresAt?: string | undefined;
|
|
159
|
+
sessionUid?: string | undefined;
|
|
160
|
+
isExpired: () => boolean;
|
|
161
|
+
isRefreshTokenExpired: () => boolean;
|
|
162
|
+
loadToken: (data: Record<string, any>) => AccessToken;
|
|
163
|
+
toJSON: () => Record<string, any>;
|
|
164
|
+
loadJSON: (data: Record<string, any>) => AccessToken;
|
|
165
|
+
readonly bearerToken: string;
|
|
166
|
+
} | null | undefined;
|
|
167
|
+
isAuth: boolean;
|
|
168
|
+
sessionCheckTimer: number | null;
|
|
169
|
+
shouldRedirectToLogin: boolean | null;
|
|
170
|
+
shouldRedirectToMessage?: boolean | undefined;
|
|
171
|
+
redirectMessageType?: (ShowMessageType | null) | undefined;
|
|
172
|
+
} & {
|
|
173
|
+
readonly currentUser: T | null;
|
|
174
|
+
readonly currentToken: AccessToken | null;
|
|
175
|
+
readonly isAuthenticated: boolean;
|
|
176
|
+
readonly userUid: string | undefined;
|
|
177
|
+
readonly account: string | undefined;
|
|
178
|
+
readonly userName: string | undefined;
|
|
179
|
+
readonly email: string | undefined;
|
|
180
|
+
readonly roleCode: string | undefined;
|
|
181
|
+
readonly permissions: string[] | undefined;
|
|
182
|
+
readonly menuItems: CMenuItem[];
|
|
183
|
+
} & {} & import('pinia').PiniaCustomProperties<string, import('pinia').StateTree, import('pinia')._GettersTree<import('pinia').StateTree>, import('pinia')._ActionsTree>> & import('pinia')._GettersTree<UserSessionState<T>>, UserSessionActions<T> & ThisType<UserSessionActions<T> & {
|
|
184
|
+
user: import('vue').UnwrapRef<T> | null;
|
|
185
|
+
token?: {
|
|
186
|
+
tokenType?: string | undefined;
|
|
187
|
+
accessToken?: string | undefined;
|
|
188
|
+
accessTokenExpiresAt?: string | undefined;
|
|
189
|
+
refreshToken?: string | undefined;
|
|
190
|
+
refreshTokenExpiresAt?: string | undefined;
|
|
191
|
+
sessionUid?: string | undefined;
|
|
192
|
+
isExpired: () => boolean;
|
|
193
|
+
isRefreshTokenExpired: () => boolean;
|
|
194
|
+
loadToken: (data: Record<string, any>) => AccessToken;
|
|
195
|
+
toJSON: () => Record<string, any>;
|
|
196
|
+
loadJSON: (data: Record<string, any>) => AccessToken;
|
|
197
|
+
readonly bearerToken: string;
|
|
198
|
+
} | null | undefined;
|
|
199
|
+
isAuth: boolean;
|
|
200
|
+
sessionCheckTimer: number | null;
|
|
201
|
+
shouldRedirectToLogin: boolean | null;
|
|
202
|
+
shouldRedirectToMessage?: boolean | undefined;
|
|
203
|
+
redirectMessageType?: (ShowMessageType | null) | undefined;
|
|
204
|
+
} & import('pinia')._StoreWithState<"session", UserSessionState<T>, UserSessionGetters<T>, UserSessionActions<T>> & {
|
|
205
|
+
readonly currentUser: T | null;
|
|
206
|
+
readonly currentToken: AccessToken | null;
|
|
207
|
+
readonly isAuthenticated: boolean;
|
|
208
|
+
readonly userUid: string | undefined;
|
|
209
|
+
readonly account: string | undefined;
|
|
210
|
+
readonly userName: string | undefined;
|
|
211
|
+
readonly email: string | undefined;
|
|
212
|
+
readonly roleCode: string | undefined;
|
|
213
|
+
readonly permissions: string[] | undefined;
|
|
214
|
+
readonly menuItems: CMenuItem[];
|
|
215
|
+
} & {} & import('pinia').PiniaCustomProperties<string, import('pinia').StateTree, import('pinia')._GettersTree<import('pinia').StateTree>, import('pinia')._ActionsTree>>>;
|
|
216
|
+
/**
|
|
217
|
+
* 預設的使用者會話 store(使用 SessionUser)
|
|
218
|
+
*/
|
|
219
|
+
export declare const useUserSessionStore: import('pinia').StoreDefinition<string, UserSessionState<SessionUser>, UserSessionGetters<SessionUser> & ThisType<{
|
|
220
|
+
user: {
|
|
221
|
+
userUid?: string | undefined;
|
|
222
|
+
iat?: number | undefined;
|
|
223
|
+
account?: string | undefined;
|
|
224
|
+
name?: string | undefined;
|
|
225
|
+
email?: string | undefined;
|
|
226
|
+
roleCode?: string | undefined;
|
|
227
|
+
roleName?: string | undefined;
|
|
228
|
+
permissions?: string[] | undefined;
|
|
229
|
+
load: (data: Record<string, any>) => SessionUser;
|
|
230
|
+
loadFromValidateSession: (data: any) => SessionUser;
|
|
231
|
+
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
232
|
+
process: (data: Record<string, any>) => Record<string, any>;
|
|
233
|
+
toJSON: () => Record<string, any>;
|
|
234
|
+
loadJSON: (data: Record<string, any>) => SessionUser;
|
|
235
|
+
} | null;
|
|
236
|
+
token?: {
|
|
237
|
+
tokenType?: string | undefined;
|
|
238
|
+
accessToken?: string | undefined;
|
|
239
|
+
accessTokenExpiresAt?: string | undefined;
|
|
240
|
+
refreshToken?: string | undefined;
|
|
241
|
+
refreshTokenExpiresAt?: string | undefined;
|
|
242
|
+
sessionUid?: string | undefined;
|
|
243
|
+
isExpired: () => boolean;
|
|
244
|
+
isRefreshTokenExpired: () => boolean;
|
|
245
|
+
loadToken: (data: Record<string, any>) => AccessToken;
|
|
246
|
+
toJSON: () => Record<string, any>;
|
|
247
|
+
loadJSON: (data: Record<string, any>) => AccessToken;
|
|
248
|
+
readonly bearerToken: string;
|
|
249
|
+
} | null | undefined;
|
|
250
|
+
isAuth: boolean;
|
|
251
|
+
sessionCheckTimer: number | null;
|
|
252
|
+
shouldRedirectToLogin: boolean | null;
|
|
253
|
+
shouldRedirectToMessage?: boolean | undefined;
|
|
254
|
+
redirectMessageType?: (ShowMessageType | null) | undefined;
|
|
255
|
+
} & {
|
|
256
|
+
readonly currentUser: SessionUser | null;
|
|
257
|
+
readonly currentToken: AccessToken | null;
|
|
258
|
+
readonly isAuthenticated: boolean;
|
|
259
|
+
readonly userUid: string | undefined;
|
|
260
|
+
readonly account: string | undefined;
|
|
261
|
+
readonly userName: string | undefined;
|
|
262
|
+
readonly email: string | undefined;
|
|
263
|
+
readonly roleCode: string | undefined;
|
|
264
|
+
readonly permissions: string[] | undefined;
|
|
265
|
+
readonly menuItems: CMenuItem[];
|
|
266
|
+
} & {} & import('pinia').PiniaCustomProperties<string, import('pinia').StateTree, import('pinia')._GettersTree<import('pinia').StateTree>, import('pinia')._ActionsTree>> & import('pinia')._GettersTree<UserSessionState<SessionUser>>, UserSessionActions<SessionUser> & ThisType<UserSessionActions<SessionUser> & {
|
|
267
|
+
user: {
|
|
268
|
+
userUid?: string | undefined;
|
|
269
|
+
iat?: number | undefined;
|
|
270
|
+
account?: string | undefined;
|
|
271
|
+
name?: string | undefined;
|
|
272
|
+
email?: string | undefined;
|
|
273
|
+
roleCode?: string | undefined;
|
|
274
|
+
roleName?: string | undefined;
|
|
275
|
+
permissions?: string[] | undefined;
|
|
276
|
+
load: (data: Record<string, any>) => SessionUser;
|
|
277
|
+
loadFromValidateSession: (data: any) => SessionUser;
|
|
278
|
+
merge: (data: Partial<SessionUser>) => SessionUser;
|
|
279
|
+
process: (data: Record<string, any>) => Record<string, any>;
|
|
280
|
+
toJSON: () => Record<string, any>;
|
|
281
|
+
loadJSON: (data: Record<string, any>) => SessionUser;
|
|
282
|
+
} | null;
|
|
283
|
+
token?: {
|
|
284
|
+
tokenType?: string | undefined;
|
|
285
|
+
accessToken?: string | undefined;
|
|
286
|
+
accessTokenExpiresAt?: string | undefined;
|
|
287
|
+
refreshToken?: string | undefined;
|
|
288
|
+
refreshTokenExpiresAt?: string | undefined;
|
|
289
|
+
sessionUid?: string | undefined;
|
|
290
|
+
isExpired: () => boolean;
|
|
291
|
+
isRefreshTokenExpired: () => boolean;
|
|
292
|
+
loadToken: (data: Record<string, any>) => AccessToken;
|
|
293
|
+
toJSON: () => Record<string, any>;
|
|
294
|
+
loadJSON: (data: Record<string, any>) => AccessToken;
|
|
295
|
+
readonly bearerToken: string;
|
|
296
|
+
} | null | undefined;
|
|
297
|
+
isAuth: boolean;
|
|
298
|
+
sessionCheckTimer: number | null;
|
|
299
|
+
shouldRedirectToLogin: boolean | null;
|
|
300
|
+
shouldRedirectToMessage?: boolean | undefined;
|
|
301
|
+
redirectMessageType?: (ShowMessageType | null) | undefined;
|
|
302
|
+
} & import('pinia')._StoreWithState<"session", UserSessionState<SessionUser>, UserSessionGetters<SessionUser>, UserSessionActions<SessionUser>> & {
|
|
303
|
+
readonly currentUser: SessionUser | null;
|
|
304
|
+
readonly currentToken: AccessToken | null;
|
|
305
|
+
readonly isAuthenticated: boolean;
|
|
306
|
+
readonly userUid: string | undefined;
|
|
307
|
+
readonly account: string | undefined;
|
|
308
|
+
readonly userName: string | undefined;
|
|
309
|
+
readonly email: string | undefined;
|
|
310
|
+
readonly roleCode: string | undefined;
|
|
311
|
+
readonly permissions: string[] | undefined;
|
|
312
|
+
readonly menuItems: CMenuItem[];
|
|
313
|
+
} & {} & import('pinia').PiniaCustomProperties<string, import('pinia').StateTree, import('pinia')._GettersTree<import('pinia').StateTree>, import('pinia')._ActionsTree>>>;
|
|
314
|
+
export declare const __UserSessionTypes__: UserSessionState & UserSessionGetters & UserSessionActions & UserSessionStoreOptionDefine & PersistOptions;
|
|
315
|
+
export interface DictionaryPersistOptions<T extends BaseDictionary = CBaseDictionary> {
|
|
316
|
+
enabled?: boolean;
|
|
317
|
+
key?: string;
|
|
318
|
+
storage?: Storage;
|
|
319
|
+
paths?: string[];
|
|
320
|
+
dictConstructor?: new () => T;
|
|
321
|
+
serializer?: {
|
|
322
|
+
serialize: (state: any) => string;
|
|
323
|
+
deserialize: (str: string) => any;
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
export type DictionaryState<T extends BaseDictionary = CBaseDictionary> = {
|
|
327
|
+
dictionary: T | null;
|
|
328
|
+
};
|
|
329
|
+
export interface DictionaryActions<T extends BaseDictionary = CBaseDictionary> {
|
|
330
|
+
setDictionary(dict: T): void;
|
|
331
|
+
loadAll(): void;
|
|
332
|
+
loadDictionary(key: string): void;
|
|
333
|
+
}
|
|
334
|
+
export interface DictionaryGetters<T extends BaseDictionary = CBaseDictionary> {
|
|
335
|
+
dict(): T | null;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Dictionary store 定義類型
|
|
339
|
+
*/
|
|
340
|
+
export type DictionaryStoreOptionDefine<T extends BaseDictionary = CBaseDictionary> = Omit<DefineStoreOptions<'dictionary', DictionaryState<T>, DictionaryGetters<T>, DictionaryActions<T>>, 'id'>;
|
|
341
|
+
/**
|
|
342
|
+
* 創建 Dictionary store 選項的工廠函數
|
|
343
|
+
* @param dictConstructor
|
|
344
|
+
*/
|
|
345
|
+
export declare function createDictionaryStoreOptions<T extends BaseDictionary = CBaseDictionary>(options: {
|
|
346
|
+
dictionary?: T;
|
|
347
|
+
persistOptions?: DictionaryPersistOptions<T>;
|
|
348
|
+
}): DictionaryStoreOptionDefine<T>;
|
|
349
|
+
export declare const __DictionaryStoreTypes__: DictionaryState & DictionaryActions & DictionaryGetters & DictionaryStoreOptionDefine;
|