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
package/README.md
CHANGED
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
# Commons Vue Library
|
|
2
2
|
|
|
3
|
-
這是一個 Vue
|
|
3
|
+
這是一個 Vue 3 公用元件/函式庫,提供常用的 UI 元件、API 服務、權限管理等功能,基於 TypeScript 和 Bootstrap 5。
|
|
4
|
+
|
|
5
|
+
## 功能概述
|
|
6
|
+
|
|
7
|
+
- **API 服務**: 封裝 Axios,提供統一的 API 呼叫介面,支持身份驗證、檔案下載等。
|
|
8
|
+
- **權限管理**: 提供角色權限映射和選單權限控制。
|
|
9
|
+
- **UI 元件**: 包括表格、表單欄位、警示、載入動畫等 Vue 元件。
|
|
10
|
+
- **指令**: 提供權限控制、日期格式化、表單驗證等 Vue 指令。
|
|
11
|
+
- **模型與工具**: 提供資料模型、工具函式等。
|
|
4
12
|
|
|
5
13
|
## 安裝
|
|
6
14
|
|
|
7
15
|
```bash
|
|
8
|
-
npm install commons-vue
|
|
16
|
+
npm install ch3chi-commons-vue
|
|
9
17
|
```
|
|
10
18
|
|
|
19
|
+
### 相依套件
|
|
20
|
+
|
|
21
|
+
此函式庫依賴以下套件,請確保您的專案已安裝:
|
|
22
|
+
|
|
23
|
+
- Vue 3
|
|
24
|
+
- Bootstrap 5
|
|
25
|
+
- Axios
|
|
26
|
+
- Vee-Validate
|
|
27
|
+
- Yup
|
|
28
|
+
- Day.js
|
|
29
|
+
- Lodash
|
|
30
|
+
- 其他請參考 package.json 的 peerDependencies
|
|
31
|
+
|
|
11
32
|
## 使用方式
|
|
12
33
|
|
|
13
34
|
### APIService 範例
|
|
14
35
|
|
|
15
36
|
```ts
|
|
16
|
-
import { ApiService, ApiRequest } from 'commons-vue';
|
|
37
|
+
import { ApiService, ApiRequest } from 'ch3chi-commons-vue';
|
|
17
38
|
|
|
18
39
|
// 註冊多個 API 端點
|
|
19
40
|
ApiService.registerEndpoints({
|
|
@@ -53,7 +74,7 @@ ApiService.download(downloadReq).then(() => {
|
|
|
53
74
|
### AuthorizationService 範例
|
|
54
75
|
|
|
55
76
|
```ts
|
|
56
|
-
import { AuthorizationService, CMenuItem, MenuItem } from 'commons-vue';
|
|
77
|
+
import { AuthorizationService, CMenuItem, MenuItem } from 'ch3chi-commons-vue';
|
|
57
78
|
|
|
58
79
|
// 設定角色權限映射
|
|
59
80
|
AuthorizationService.rolePermissionMap = {
|
|
@@ -81,8 +102,120 @@ const menu = AuthorizationService.provideMenuByPermission({
|
|
|
81
102
|
console.log('使用者可見選單:', menu);
|
|
82
103
|
```
|
|
83
104
|
|
|
105
|
+
### UI 元件範例
|
|
106
|
+
|
|
107
|
+
#### CTable 表格元件
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<template>
|
|
111
|
+
<CTable
|
|
112
|
+
:columns="columns"
|
|
113
|
+
:data-list="dataList"
|
|
114
|
+
:query-param="queryParam"
|
|
115
|
+
@page-change="handlePageChange"
|
|
116
|
+
@sort-change="handleSortChange"
|
|
117
|
+
/>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script setup lang="ts">
|
|
121
|
+
import { CTable, CTableColumn } from 'ch3chi-commons-vue';
|
|
122
|
+
|
|
123
|
+
const columns: CTableColumn[] = [
|
|
124
|
+
{ key: 'name', label: '名稱', sortable: true },
|
|
125
|
+
{ key: 'email', label: '電子郵件' }
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
const dataList = [
|
|
129
|
+
{ name: 'John Doe', email: 'john@example.com' }
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
const queryParam = reactive({
|
|
133
|
+
page: 1,
|
|
134
|
+
size: 10,
|
|
135
|
+
sort: []
|
|
136
|
+
});
|
|
137
|
+
</script>
|
|
138
|
+
```
|
|
84
139
|
|
|
140
|
+
#### 表單欄位元件
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<template>
|
|
144
|
+
<CTextInputFormField
|
|
145
|
+
v-model="formData.name"
|
|
146
|
+
label="名稱"
|
|
147
|
+
:validation-rules="{ required: true }"
|
|
148
|
+
/>
|
|
149
|
+
<CDateFormField
|
|
150
|
+
v-model="formData.birthDate"
|
|
151
|
+
label="生日"
|
|
152
|
+
/>
|
|
153
|
+
</template>
|
|
154
|
+
|
|
155
|
+
<script setup lang="ts">
|
|
156
|
+
import { CTextInputFormField, CDateFormField } from 'ch3chi-commons-vue';
|
|
157
|
+
|
|
158
|
+
const formData = reactive({
|
|
159
|
+
name: '',
|
|
160
|
+
birthDate: null
|
|
161
|
+
});
|
|
162
|
+
</script>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### 其他元件
|
|
166
|
+
|
|
167
|
+
- `CAlert`: 警示訊息元件
|
|
168
|
+
- `CBSToast`: Toast 通知
|
|
169
|
+
- `CGlobalSpinner`: 全域載入動畫
|
|
170
|
+
|
|
171
|
+
### 指令範例
|
|
172
|
+
|
|
173
|
+
#### 權限指令
|
|
174
|
+
|
|
175
|
+
```vue
|
|
176
|
+
<template>
|
|
177
|
+
<button v-permission="'user.write'">編輯使用者</button>
|
|
178
|
+
</template>
|
|
179
|
+
|
|
180
|
+
<script setup lang="ts">
|
|
181
|
+
import { PermissionDirective } from 'ch3chi-commons-vue';
|
|
182
|
+
</script>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### 日期格式化指令
|
|
186
|
+
|
|
187
|
+
```vue
|
|
188
|
+
<template>
|
|
189
|
+
<span v-date-formatter="dateValue"></span>
|
|
190
|
+
</template>
|
|
191
|
+
|
|
192
|
+
<script setup lang="ts">
|
|
193
|
+
import { vdDateFormatter } from 'ch3chi-commons-vue';
|
|
194
|
+
</script>
|
|
195
|
+
```
|
|
85
196
|
|
|
86
197
|
## 文件
|
|
87
198
|
|
|
88
|
-
|
|
199
|
+
請參考以下文件以獲取詳細資訊:
|
|
200
|
+
|
|
201
|
+
- [API Service 使用指南](doc/ApiService-BearerAuth-Mechanism.md)
|
|
202
|
+
- [CTable 樣式配置指南](doc/CTableStyleConfig-Usage-Guide.md)
|
|
203
|
+
- [權限管理指南](doc/UserSession-Store-Generic-Guide.md)
|
|
204
|
+
- 其他文件請參考 `doc/` 目錄
|
|
205
|
+
|
|
206
|
+
## 開發與建置
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# 安裝依賴
|
|
210
|
+
npm install
|
|
211
|
+
|
|
212
|
+
# 建置
|
|
213
|
+
npm run vite-build
|
|
214
|
+
|
|
215
|
+
# 發行新版本
|
|
216
|
+
npm run release
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## 授權
|
|
220
|
+
|
|
221
|
+
此專案採用 MIT 授權。
|
package/dist/api/ApiService.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AxiosProgressEvent, RawAxiosResponseHeaders } from 'axios';
|
|
1
|
+
import { AxiosProgressEvent, AxiosRequestConfig, AxiosResponse, RawAxiosResponseHeaders } from 'axios';
|
|
2
|
+
import { AccessToken } from '../model/TokenUser';
|
|
2
3
|
/**
|
|
3
4
|
* ApiEndpoint 定義 API 端點的結構
|
|
4
5
|
*/
|
|
@@ -6,9 +7,22 @@ export interface ApiEndpoint {
|
|
|
6
7
|
path: string;
|
|
7
8
|
method: string;
|
|
8
9
|
isAuthenticated?: boolean;
|
|
10
|
+
security?: string[];
|
|
11
|
+
withCredentials?: boolean;
|
|
12
|
+
isRefreshTokenEndpoint?: boolean;
|
|
9
13
|
errorMessageMap?: Record<number, string>;
|
|
10
14
|
noSpinner?: boolean;
|
|
11
15
|
headers?: Record<string, string>;
|
|
16
|
+
metaData?: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* CreateEndpointOptions 定義建立 ApiEndpoint 時的選項
|
|
20
|
+
* 通常用於設定預設值
|
|
21
|
+
*/
|
|
22
|
+
export interface CreateEndpointOptions {
|
|
23
|
+
isAuthenticated?: boolean;
|
|
24
|
+
security?: string[];
|
|
25
|
+
headers?: Record<string, string>;
|
|
12
26
|
}
|
|
13
27
|
/**
|
|
14
28
|
* ApiRequest 定義 API 請求的結構
|
|
@@ -22,6 +36,8 @@ export declare class ApiRequest {
|
|
|
22
36
|
isDownloadMode?: boolean;
|
|
23
37
|
downloadFileName?: string;
|
|
24
38
|
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
|
39
|
+
axiosConfig?: AxiosRequestConfig;
|
|
40
|
+
noSpinner?: boolean;
|
|
25
41
|
constructor(data: ApiRequest);
|
|
26
42
|
}
|
|
27
43
|
/**
|
|
@@ -29,13 +45,15 @@ export declare class ApiRequest {
|
|
|
29
45
|
*/
|
|
30
46
|
export declare class ApiResponse {
|
|
31
47
|
httpStatus: number;
|
|
32
|
-
|
|
48
|
+
status?: number;
|
|
33
49
|
message?: string;
|
|
34
50
|
data?: any;
|
|
35
51
|
nativeError?: any;
|
|
36
52
|
paging?: Record<string, any>;
|
|
37
53
|
blobData?: Blob;
|
|
38
54
|
headers?: RawAxiosResponseHeaders;
|
|
55
|
+
details?: any;
|
|
56
|
+
axiosResponse?: AxiosResponse;
|
|
39
57
|
constructor(data?: Partial<ApiResponse>);
|
|
40
58
|
isOk(): boolean;
|
|
41
59
|
}
|
|
@@ -53,23 +71,79 @@ export declare class ApiRejectError extends Error {
|
|
|
53
71
|
* ApiService 提供呼叫後端 API 的功能
|
|
54
72
|
*/
|
|
55
73
|
export declare class ApiService {
|
|
74
|
+
private static _options;
|
|
56
75
|
private static _apiEndpoints;
|
|
57
76
|
private static _customHeaders;
|
|
77
|
+
private static _customHeaderProvider?;
|
|
58
78
|
private static _customErrorMessageMap;
|
|
79
|
+
private static _accessToken?;
|
|
80
|
+
private static _accessTokenProvider?;
|
|
81
|
+
private static _refreshTokenPromise?;
|
|
82
|
+
private static _axiosInstance?;
|
|
83
|
+
private static _failedRequestQueue;
|
|
84
|
+
private static _isRefreshing;
|
|
85
|
+
static set accessToken(token: AccessToken);
|
|
86
|
+
static set accessTokenProvider(provider: () => Promise<AccessToken | undefined>);
|
|
87
|
+
static getAccessToken(): Promise<AccessToken | undefined>;
|
|
88
|
+
/**
|
|
89
|
+
* 靜態方法,新增全域自訂標頭
|
|
90
|
+
* @param key
|
|
91
|
+
* @param value
|
|
92
|
+
*/
|
|
93
|
+
static addHeader(key: string, value: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* 靜態方法,移除全域自訂標頭
|
|
96
|
+
* @param key
|
|
97
|
+
*/
|
|
98
|
+
static removeHeader(key: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* 靜態方法,設定自訂標頭提供者
|
|
101
|
+
* @param provider
|
|
102
|
+
*/
|
|
103
|
+
static customHeaderProvider(provider: (endpoint: ApiEndpoint, header: Record<string, any>) => Promise<Record<string, string>>): void;
|
|
59
104
|
constructor();
|
|
60
105
|
/**
|
|
61
106
|
* 靜態方法,配置 ApiService
|
|
62
107
|
* 為方便管理,建議在專案啟動時呼叫此方法註冊所有端點
|
|
63
108
|
* 可以配置
|
|
109
|
+
* - debugMode: 是否啟用除錯模式
|
|
110
|
+
* - baseUrl: API 伺服器的基礎 URL
|
|
111
|
+
* - contextPath: API 的上下文路徑
|
|
112
|
+
* - proxyEnable: 是否啟用代理
|
|
113
|
+
* - proxyBaseUrl: 代理的基礎 URL
|
|
114
|
+
* - showSpinnerFunc: 顯示全域載入動畫的函式
|
|
115
|
+
* - hideSpinnerFunc: 隱藏全域載入動畫的函式
|
|
116
|
+
* - showErrorToastFunc: 顯示全域錯誤提示的函式
|
|
64
117
|
* - endpoints: 預設註冊的 API 端點
|
|
65
118
|
* - customHeaders: 全域自訂標頭
|
|
66
119
|
* - customErrorMessageMap: 全域自訂錯誤訊息對應
|
|
120
|
+
* - createEndpointOptions: 建立端點時的預設選項
|
|
121
|
+
* - refreshTokenFunc: 刷新存取權杖的函式
|
|
122
|
+
* - onAuthenticateFailed: 認證失敗時的回調函式
|
|
67
123
|
* @param config
|
|
68
124
|
*/
|
|
69
125
|
static configure(config: {
|
|
126
|
+
debugMode?: boolean;
|
|
127
|
+
baseUrl?: string;
|
|
128
|
+
contextPath?: string;
|
|
129
|
+
proxyEnable?: boolean;
|
|
130
|
+
proxyBaseUrl?: string;
|
|
131
|
+
showSpinnerFunc?: () => void;
|
|
132
|
+
hideSpinnerFunc?: () => void;
|
|
133
|
+
showErrorToastFunc?: (param: {
|
|
134
|
+
title?: string;
|
|
135
|
+
content?: string;
|
|
136
|
+
}) => void;
|
|
70
137
|
endpoints: Record<string, ApiEndpoint>;
|
|
71
138
|
customHeaders?: Record<string, string>;
|
|
139
|
+
customHeaderProvider?: (endpoint: ApiEndpoint, header: Record<string, any>) => Promise<Record<string, string>>;
|
|
72
140
|
customErrorMessageMap?: Record<number, string>;
|
|
141
|
+
createEndpointOptions?: CreateEndpointOptions;
|
|
142
|
+
refreshTokenFunc?: () => Promise<AccessToken>;
|
|
143
|
+
onAuthenticateFailed?: (param: {
|
|
144
|
+
apiEndpoint: ApiEndpoint;
|
|
145
|
+
apiRequest: ApiRequest;
|
|
146
|
+
}) => void;
|
|
73
147
|
}): void;
|
|
74
148
|
/**
|
|
75
149
|
* 靜態方法,新增單一 API 端點
|
|
@@ -123,4 +197,37 @@ export declare class ApiService {
|
|
|
123
197
|
* @param str RFC 2047 編碼的字串
|
|
124
198
|
*/
|
|
125
199
|
decodeRfc2047(str: string): string;
|
|
200
|
+
/**
|
|
201
|
+
* 檢查是否啟用 Bearer Token 認證
|
|
202
|
+
*/
|
|
203
|
+
private static hasBearerAuth;
|
|
204
|
+
/**
|
|
205
|
+
* 設定 axios 攔截器
|
|
206
|
+
*/
|
|
207
|
+
private static setupAxiosInterceptors;
|
|
208
|
+
/**
|
|
209
|
+
* 設定認證相關的 interceptors
|
|
210
|
+
*/
|
|
211
|
+
private static setupAuthInterceptorsOnBearerAuth;
|
|
212
|
+
/**
|
|
213
|
+
* 刷新 access token
|
|
214
|
+
*/
|
|
215
|
+
static refreshToken(): Promise<AccessToken>;
|
|
216
|
+
/**
|
|
217
|
+
* 檢查並刷新 token(如果需要)
|
|
218
|
+
*/
|
|
219
|
+
private static refreshTokenIfNeeded;
|
|
220
|
+
/**
|
|
221
|
+
* 處理佇列中的失敗請求
|
|
222
|
+
*/
|
|
223
|
+
private static processFailedRequestQueue;
|
|
224
|
+
/**
|
|
225
|
+
* 處理認證失敗
|
|
226
|
+
*/
|
|
227
|
+
private static handleAuthenticationFailed;
|
|
228
|
+
/**
|
|
229
|
+
* 取得 axios 實例
|
|
230
|
+
*/
|
|
231
|
+
private static getAxiosInstance;
|
|
126
232
|
}
|
|
233
|
+
export declare const __ApiServiceDefine__: ApiEndpoint;
|
|
@@ -49,8 +49,7 @@ export declare class AuthorizationService {
|
|
|
49
49
|
static hasPermissionByRole(roleCodes: string[], requiredPermission: string): boolean;
|
|
50
50
|
/**
|
|
51
51
|
* 根據角色列表提供選單項目
|
|
52
|
-
* @param
|
|
53
|
-
* @param permissions 權限列表
|
|
52
|
+
* @param param 配置參數
|
|
54
53
|
*/
|
|
55
54
|
static provideMenuByPermission(param: ProvideMenuByPermissionParams): CMenuItem[];
|
|
56
55
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 權限:操作字串列舉
|
|
3
|
+
*/
|
|
4
|
+
export declare enum PermissionAction {
|
|
5
|
+
NONE = "NONE",// 無操作
|
|
6
|
+
SIGN_IN = "SIGN_IN",// 登入
|
|
7
|
+
SIGN_OUT = "SIGN_OUT",// 登出
|
|
8
|
+
FORGOT_PASSWORD = "FORGOT_PASSWORD",// 忘記密碼
|
|
9
|
+
RESET_PASSWORD = "RESET_PASSWORD",// 重設個人密碼
|
|
10
|
+
CHANGE_PASSWORD = "CHANGE_PASSWORD",// 更改密碼
|
|
11
|
+
CREATE = "CREATE",// 建立資料
|
|
12
|
+
SEARCH = "SEARCH",// 查詢列表
|
|
13
|
+
READ = "READ",// 讀取資料
|
|
14
|
+
UPDATE = "UPDATE",// 更新資料
|
|
15
|
+
DELETE = "DELETE",// 刪除資料
|
|
16
|
+
EXPORT = "EXPORT"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 權限描述類別
|
|
20
|
+
*/
|
|
21
|
+
export declare class PermissionDescriptor {
|
|
22
|
+
module: string;
|
|
23
|
+
action: PermissionAction;
|
|
24
|
+
supportedActions: PermissionAction[];
|
|
25
|
+
constructor(data?: Partial<PermissionDescriptor> | string);
|
|
26
|
+
/**
|
|
27
|
+
* 檢查是否屬於同一個 module
|
|
28
|
+
* @param toCheckPermissions
|
|
29
|
+
*/
|
|
30
|
+
checkModule(toCheckPermissions: string[]): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 檢查是否具有指定的權限
|
|
33
|
+
* @param toCheckPermissions
|
|
34
|
+
*/
|
|
35
|
+
checkPermission(toCheckPermissions: string[]): boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare const __PermissionStringDefine__: PermissionAction;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export interface CAlertModalData {
|
|
2
|
+
type?: CAlertModalType | string;
|
|
2
3
|
title?: string;
|
|
3
4
|
content?: string;
|
|
4
5
|
onCancel?: () => void;
|
|
@@ -10,3 +11,4 @@ export declare enum CAlertModalType {
|
|
|
10
11
|
Confirm = "confirm",// 確認類型
|
|
11
12
|
Info = "info"
|
|
12
13
|
}
|
|
14
|
+
export declare const __CAlertModelDefine__: CAlertModalData & CAlertModalType;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Reactive } from 'vue';
|
|
2
|
+
import { BaseFormDataModel } from '../model/BaseFormDataModel';
|
|
3
|
+
import { QueryParameter } from '../model/QueryParameter';
|
|
4
|
+
import { CTableColumn } from './CTableDefine';
|
|
5
|
+
type CTableProps<T extends QueryParameter, V extends BaseFormDataModel> = {
|
|
6
|
+
queryParam?: Reactive<T>;
|
|
7
|
+
columns: CTableColumn[];
|
|
8
|
+
dataList?: V[];
|
|
9
|
+
disablePagination?: boolean;
|
|
10
|
+
multiSort?: boolean;
|
|
11
|
+
pageSizeOptions?: number[];
|
|
12
|
+
styleConfig?: Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_Props = CTableProps<QueryParameter, BaseFormDataModel>;
|
|
15
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
16
|
+
"table-action": (...args: any[]) => void;
|
|
17
|
+
"page-change": (...args: any[]) => void;
|
|
18
|
+
"sort-change": (...args: any[]) => void;
|
|
19
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
+
"onTable-action"?: ((...args: any[]) => any) | undefined;
|
|
21
|
+
"onPage-change"?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
"onSort-change"?: ((...args: any[]) => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
24
|
+
export default _default;
|
|
@@ -54,6 +54,11 @@ export interface CTableColumnDefine {
|
|
|
54
54
|
dataNameList?: string[];
|
|
55
55
|
text: string;
|
|
56
56
|
defaultText?: string;
|
|
57
|
+
sortConfig?: {
|
|
58
|
+
sortable?: boolean;
|
|
59
|
+
key?: string | string[];
|
|
60
|
+
direction?: 'asc' | 'desc';
|
|
61
|
+
} | undefined;
|
|
57
62
|
width?: string;
|
|
58
63
|
align?: 'left' | 'center' | 'right';
|
|
59
64
|
dataAlign?: 'left' | 'center' | 'right';
|
|
@@ -75,6 +80,11 @@ export declare class CTableColumn implements CTableColumnDefine {
|
|
|
75
80
|
dataNameList?: string[];
|
|
76
81
|
text: string;
|
|
77
82
|
defaultText?: string;
|
|
83
|
+
sortConfig?: {
|
|
84
|
+
sortable?: boolean;
|
|
85
|
+
key?: string | string[];
|
|
86
|
+
direction?: 'asc' | 'desc';
|
|
87
|
+
};
|
|
78
88
|
width?: string;
|
|
79
89
|
align?: 'left' | 'center' | 'right';
|
|
80
90
|
dataAlign?: 'left' | 'center' | 'right';
|
|
@@ -123,3 +133,69 @@ export declare class CTableColumn implements CTableColumnDefine {
|
|
|
123
133
|
*/
|
|
124
134
|
private buildActionButtonMeta;
|
|
125
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* 分頁樣式配置介面
|
|
138
|
+
*/
|
|
139
|
+
export interface PaginationStyleConfig {
|
|
140
|
+
backgroundColor: string;
|
|
141
|
+
textColor: string;
|
|
142
|
+
borderColor: string;
|
|
143
|
+
hoverBackgroundColor: string;
|
|
144
|
+
hoverTextColor: string;
|
|
145
|
+
hoverBorderColor: string;
|
|
146
|
+
activeBackgroundColor: string;
|
|
147
|
+
activeTextColor: string;
|
|
148
|
+
activeBorderColor: string;
|
|
149
|
+
previousIcon: string;
|
|
150
|
+
nextIcon: string;
|
|
151
|
+
firstIcon: string;
|
|
152
|
+
lastIcon: string;
|
|
153
|
+
ellipsisIcon: string;
|
|
154
|
+
}
|
|
155
|
+
export interface TableStyleConfig {
|
|
156
|
+
sortIconNone?: string;
|
|
157
|
+
sortIconAsc?: string;
|
|
158
|
+
sortIconDesc?: string;
|
|
159
|
+
scrollbarThumbColor?: string;
|
|
160
|
+
scrollbarTrackColor?: string;
|
|
161
|
+
scrollbarThumbHoverColor?: string;
|
|
162
|
+
scrollbarHeight?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* CTableConfig 類別用於配置表格的全域設定 包含以下
|
|
166
|
+
* - 分頁樣式設定
|
|
167
|
+
* - 每頁顯示選項
|
|
168
|
+
*/
|
|
169
|
+
export declare class CTableConfig {
|
|
170
|
+
private static tableStyleConfig;
|
|
171
|
+
static getTableStyleConfig(): TableStyleConfig;
|
|
172
|
+
static setTableStyleConfig(config: Partial<TableStyleConfig>): void;
|
|
173
|
+
private static defaultPaginationStyle;
|
|
174
|
+
private static currentPaginationStyle;
|
|
175
|
+
/**
|
|
176
|
+
* 設定全域分頁樣式
|
|
177
|
+
* @param config 分頁樣式配置
|
|
178
|
+
*/
|
|
179
|
+
static setPaginationStyle(config: Partial<PaginationStyleConfig>): void;
|
|
180
|
+
/**
|
|
181
|
+
* 取得當前分頁樣式
|
|
182
|
+
*/
|
|
183
|
+
static getPaginationStyle(): PaginationStyleConfig;
|
|
184
|
+
/**
|
|
185
|
+
* 重置分頁樣式為預設值
|
|
186
|
+
*/
|
|
187
|
+
static resetPaginationStyle(): void;
|
|
188
|
+
/**
|
|
189
|
+
* 產生分頁樣式的 CSS 變數物件
|
|
190
|
+
*/
|
|
191
|
+
static getPaginationStyleVars(): Record<string, string>;
|
|
192
|
+
/**
|
|
193
|
+
* 產生表格樣式的 CSS 變數物件
|
|
194
|
+
*/
|
|
195
|
+
static getTableStyleVars(): Record<string, string>;
|
|
196
|
+
/**
|
|
197
|
+
* 預設每頁顯示選項
|
|
198
|
+
*/
|
|
199
|
+
static pageSizeOptions: number[];
|
|
200
|
+
}
|
|
201
|
+
export declare const __CTableDefine__: CTableColumnType & CTableColumnActionType & CTableColumnActionParam & CTableColumnActionMeta & CTableColumnDefine & PaginationStyleConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CTableColumn } from '../components/CTableDefine';
|
|
2
|
+
export interface CTableTDProps {
|
|
3
|
+
columnItem: CTableColumn;
|
|
4
|
+
dataItem: Record<string, any>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import('vue').DefineComponent<CTableTDProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CTableTDProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PasswordDataModel } from '../../model/PasswordDataModel';
|
|
2
|
+
import { ApiResponse } from '../../api/ApiService';
|
|
3
|
+
import { IBSFieldStyleConfig } from '../../model/BSFieldStyleConfig';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
userUid: string;
|
|
6
|
+
requireOldPassword?: boolean;
|
|
7
|
+
dataModelConstructor?: new () => PasswordDataModel;
|
|
8
|
+
callApi: (dataModel: PasswordDataModel) => Promise<ApiResponse>;
|
|
9
|
+
styleConfig?: IBSFieldStyleConfig;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
|
+
requireOldPassword: boolean;
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { COptionItem } from '../../model/FormOptions';
|
|
2
|
+
import { IBSFieldStyleConfig } from '../../model/BSFieldStyleConfig';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* Radio 欄位的標籤文字
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Radio 欄位是否為必填
|
|
10
|
+
*/
|
|
11
|
+
required?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Radio 欄位的名稱,為 form field 的 name 屬性
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Radio 選項集
|
|
18
|
+
*/
|
|
19
|
+
optionList: COptionItem[];
|
|
20
|
+
/**
|
|
21
|
+
* 是否為閱讀模式,若為 true 則只顯示選項文字,不顯示 Radio 按鈕
|
|
22
|
+
*/
|
|
23
|
+
readMode?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* BS 欄位樣式設定
|
|
26
|
+
*/
|
|
27
|
+
styleConfig?: IBSFieldStyleConfig;
|
|
28
|
+
};
|
|
29
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IBSFieldStyleConfig } from '../../model/BSFieldStyleConfig';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
readMode?: boolean;
|
|
9
|
+
timeType?: 'startOfDay' | 'endOfDay';
|
|
10
|
+
styleConfig?: IBSFieldStyleConfig;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
13
|
+
label: string;
|
|
14
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
15
|
+
dateBtn: HTMLButtonElement;
|
|
16
|
+
}, HTMLDivElement>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IBSFieldStyleConfig } from '../../model/BSFieldStyleConfig';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
model: any;
|
|
6
|
+
name: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
timeType?: 'startOfDay' | 'endOfDay';
|
|
9
|
+
styleConfig?: IBSFieldStyleConfig;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
|
+
label: string;
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
14
|
+
dateBtn: HTMLButtonElement;
|
|
15
|
+
}, HTMLDivElement>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IBSFieldStyleConfig } from '../../model/BSFieldStyleConfig';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
startDateFieldName?: string;
|
|
7
|
+
endDateFieldName?: string;
|
|
8
|
+
styleConfig?: IBSFieldStyleConfig;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
+
label: string;
|
|
12
|
+
startDateFieldName: string;
|
|
13
|
+
endDateFieldName: string;
|
|
14
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
15
|
+
dateBtn: HTMLButtonElement;
|
|
16
|
+
}, HTMLDivElement>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CFileDataModel } from '../../model/CFileDataModel';
|
|
2
|
+
import { IBSFieldStyleConfig } from '../../model/BSFieldStyleConfig';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
dataModel?: any;
|
|
8
|
+
validationDataKey?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
tip?: string;
|
|
11
|
+
accept?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
fileCountLimit?: number;
|
|
15
|
+
fileSizeLimit?: number;
|
|
16
|
+
styleConfig?: IBSFieldStyleConfig;
|
|
17
|
+
};
|
|
18
|
+
declare function addSavedFiles(files: CFileDataModel[]): void;
|
|
19
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
20
|
+
addSavedFiles: typeof addSavedFiles;
|
|
21
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
22
|
+
label: string;
|
|
23
|
+
placeholder: string;
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
25
|
+
fileInputRef: HTMLInputElement;
|
|
26
|
+
textInputRef: HTMLInputElement;
|
|
27
|
+
}, any>;
|
|
28
|
+
export default _default;
|