ch3chi-commons-vue 0.1.14 → 1.8.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.
Files changed (34) hide show
  1. package/README.md +138 -5
  2. package/package.json +24 -4
  3. package/dist/api/ApiService.d.ts +0 -126
  4. package/dist/auth/AuthorizationService.d.ts +0 -57
  5. package/dist/components/CAlert.vue.d.ts +0 -17
  6. package/dist/components/CAlertDefine.d.ts +0 -12
  7. package/dist/components/CBSToast.vue.d.ts +0 -6
  8. package/dist/components/CGlobalSpinner.vue.d.ts +0 -10
  9. package/dist/components/CRowCheckBox.vue.d.ts +0 -14
  10. package/dist/components/CRowTextInput.vue.d.ts +0 -10
  11. package/dist/components/CTableDefine.d.ts +0 -125
  12. package/dist/directive/CBootstrapDirective.d.ts +0 -17
  13. package/dist/directive/CDateFormatterDirective.d.ts +0 -10
  14. package/dist/directive/CFTurnstileDirective.d.ts +0 -9
  15. package/dist/directive/CFormDirective.d.ts +0 -9
  16. package/dist/index.cjs.js +0 -6042
  17. package/dist/index.d.ts +0 -8
  18. package/dist/index.es.js +0 -6026
  19. package/dist/model/BaseFormDataModel.d.ts +0 -195
  20. package/dist/model/BaseListViewModel.d.ts +0 -144
  21. package/dist/model/CBSModalViewModel.d.ts +0 -44
  22. package/dist/model/CFileDataModel.d.ts +0 -74
  23. package/dist/model/CImageViewModel.d.ts +0 -8
  24. package/dist/model/CMenuItem.d.ts +0 -84
  25. package/dist/model/EmailReceiverDataModel.d.ts +0 -57
  26. package/dist/model/EmptyDataModel.d.ts +0 -7
  27. package/dist/model/FormOptions.d.ts +0 -55
  28. package/dist/model/LoginDataModel.d.ts +0 -11
  29. package/dist/model/PasswordDataModel.d.ts +0 -15
  30. package/dist/model/QueryParameter.d.ts +0 -94
  31. package/dist/model/SessionUser.d.ts +0 -30
  32. package/dist/stores/FormDataStore.d.ts +0 -31
  33. package/dist/stores/ViewStore.d.ts +0 -215
  34. package/dist/utils/CToolUtils.d.ts +0 -41
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
- 請參考 src/ 目錄下的程式碼與註解,或補充詳細 API 文件。
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ch3chi-commons-vue",
3
- "version": "0.1.14",
3
+ "version": "1.8.0",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,8 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.es.js",
11
11
  "require": "./dist/index.cjs.js"
12
- }
12
+ },
13
+ "./style.css": "./dist/style.css"
13
14
  },
14
15
  "files": [
15
16
  "dist",
@@ -18,8 +19,17 @@
18
19
  ],
19
20
  "scripts": {
20
21
  "prebuild": "rm -rf dist",
22
+ "build": "tsc --noEmit",
21
23
  "vite-build": "vite build",
22
- "build": "tsc"
24
+ "yalc-push": "yalc push",
25
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
26
+ "changelog:all": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
27
+ "changelog:custom": "tsx scripts/generate-changelog.ts",
28
+ "release": "standard-version",
29
+ "release:major": "standard-version --release-as major",
30
+ "release:minor": "standard-version --release-as minor",
31
+ "release:patch": "standard-version --release-as patch",
32
+ "release:dry": "standard-version --dry-run"
23
33
  },
24
34
  "peerDependencies": {
25
35
  "@fortawesome/fontawesome-svg-core": ">=7.1.0",
@@ -38,6 +48,8 @@
38
48
  "yup": ">=1.7.1"
39
49
  },
40
50
  "devDependencies": {
51
+ "@commitlint/cli": "^20.2.0",
52
+ "@commitlint/config-conventional": "^20.2.0",
41
53
  "@fortawesome/fontawesome-svg-core": "^7.1.0",
42
54
  "@fortawesome/free-solid-svg-icons": "^7.1.0",
43
55
  "@fortawesome/vue-fontawesome": "^3.1.2",
@@ -45,20 +57,28 @@
45
57
  "@types/bootstrap": "^5.2.10",
46
58
  "@types/lodash": "^4.17.20",
47
59
  "@types/mime-types": "^3.0.1",
48
- "@types/node": "^24.10.0",
60
+ "@types/node": "^24.10.4",
61
+ "@vitejs/plugin-vue": "^6.0.2",
49
62
  "axios": "^1.13.2",
50
63
  "bootstrap": "^5.3.7",
64
+ "conventional-changelog-cli": "^5.0.0",
51
65
  "dayjs": "^1.11.13",
52
66
  "flatpickr": "^4.6.13",
53
67
  "lodash": "^4.17.21",
68
+ "loglevel": "^1.9.2",
54
69
  "mime-types": "^3.0.1",
55
70
  "pinia": "^3.0.4",
71
+ "pinia-plugin-persistedstate": "^4.7.1",
72
+ "standard-version": "^9.5.0",
56
73
  "terser": "^5.44.1",
74
+ "ts-node": "^10.9.2",
75
+ "tsx": "^4.21.0",
57
76
  "typescript": "^5.9.3",
58
77
  "uuid": "^11.1.0",
59
78
  "uuidv4": "^6.2.13",
60
79
  "vee-validate": "^4.15.1",
61
80
  "vite": "^7.2.1",
81
+ "vite-plugin-css-injected-by-js": "^3.5.2",
62
82
  "vite-plugin-dts": "^4.5.4",
63
83
  "vue": "^3.5.23",
64
84
  "vue-router": "^4.6.3",
@@ -1,126 +0,0 @@
1
- import { AxiosProgressEvent, RawAxiosResponseHeaders } from 'axios';
2
- /**
3
- * ApiEndpoint 定義 API 端點的結構
4
- */
5
- export interface ApiEndpoint {
6
- path: string;
7
- method: string;
8
- isAuthenticated?: boolean;
9
- errorMessageMap?: Record<number, string>;
10
- noSpinner?: boolean;
11
- headers?: Record<string, string>;
12
- }
13
- /**
14
- * ApiRequest 定義 API 請求的結構
15
- */
16
- export declare class ApiRequest {
17
- endpointKey: string;
18
- headers?: Record<string, string>;
19
- pathParam?: Record<string, any>;
20
- queryParam?: Record<string, any>;
21
- postBody?: Record<string, any> | FormData;
22
- isDownloadMode?: boolean;
23
- downloadFileName?: string;
24
- onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
25
- constructor(data: ApiRequest);
26
- }
27
- /**
28
- * ApiResponse 定義 API 回應的結構
29
- */
30
- export declare class ApiResponse {
31
- httpStatus: number;
32
- code: number;
33
- message?: string;
34
- data?: any;
35
- nativeError?: any;
36
- paging?: Record<string, any>;
37
- blobData?: Blob;
38
- headers?: RawAxiosResponseHeaders;
39
- constructor(data?: Partial<ApiResponse>);
40
- isOk(): boolean;
41
- }
42
- /**
43
- * ApiRejectError 定義 API 呼叫失敗時的自訂錯誤
44
- * 此物件給 ApiService.call 呼叫後,並且回傳 Promise.reject() 使用
45
- */
46
- export declare class ApiRejectError extends Error {
47
- response: ApiResponse;
48
- type?: string;
49
- constructor(response: ApiResponse);
50
- notFound(): this;
51
- }
52
- /**
53
- * ApiService 提供呼叫後端 API 的功能
54
- */
55
- export declare class ApiService {
56
- private static _apiEndpoints;
57
- private static _customHeaders;
58
- private static _customErrorMessageMap;
59
- constructor();
60
- /**
61
- * 靜態方法,配置 ApiService
62
- * 為方便管理,建議在專案啟動時呼叫此方法註冊所有端點
63
- * 可以配置
64
- * - endpoints: 預設註冊的 API 端點
65
- * - customHeaders: 全域自訂標頭
66
- * - customErrorMessageMap: 全域自訂錯誤訊息對應
67
- * @param config
68
- */
69
- static configure(config: {
70
- endpoints: Record<string, ApiEndpoint>;
71
- customHeaders?: Record<string, string>;
72
- customErrorMessageMap?: Record<number, string>;
73
- }): void;
74
- /**
75
- * 靜態方法,新增單一 API 端點
76
- * @param key
77
- * @param endpoint
78
- */
79
- static addEndpoints(key: string, endpoint: ApiEndpoint): void;
80
- /**
81
- * 靜態方法,方便直接呼叫 API
82
- * @param request
83
- */
84
- static call(request: ApiRequest): Promise<ApiResponse>;
85
- /**
86
- * 靜態方法,方便直接下載檔案
87
- * @param request
88
- */
89
- static download(request: ApiRequest): Promise<void>;
90
- /**
91
- * 取得指定的 API 端點資訊
92
- * @param endpointKey
93
- */
94
- getEndpoint(endpointKey: string): ApiEndpoint | undefined;
95
- /**
96
- * 取得完整的 API URL
97
- * @param endpointKey
98
- */
99
- getFullUrl(endpointKey: string): string | undefined;
100
- /**
101
- * 組合完整的 API URL
102
- * @param endpoint
103
- */
104
- makeBaseUrl(endpoint: ApiEndpoint): string | undefined;
105
- /**
106
- * 呼叫 API
107
- * @param request
108
- */
109
- callApi(request: ApiRequest): Promise<ApiResponse>;
110
- /**
111
- * 下載檔案
112
- * @param request
113
- */
114
- downloadFile(request: ApiRequest): Promise<void>;
115
- /**
116
- * 決定下載檔案名稱
117
- * @param request
118
- * @param response
119
- */
120
- resolveExportFileName(request: ApiRequest, response: ApiResponse): string;
121
- /**
122
- * 解碼 RFC 2047 編碼的字串
123
- * @param str RFC 2047 編碼的字串
124
- */
125
- decodeRfc2047(str: string): string;
126
- }
@@ -1,57 +0,0 @@
1
- import { CMenuItem, MenuItem } from '../model/CMenuItem';
2
- /**
3
- * 提供選單項目的參數介面
4
- */
5
- type ProvideMenuByPermissionParams = {
6
- roleCode: string;
7
- permissions: string[];
8
- picker?: (roleCode: string) => MenuItem[];
9
- };
10
- /**
11
- * AuthorizationService 類別負責處理權限相關的邏輯
12
- */
13
- export declare class AuthorizationService {
14
- /**
15
- * 角色權限映射表
16
- * 定義角色對應多個權限項目
17
- * @private
18
- */
19
- private static _rolePermissionMap;
20
- /**
21
- * 選單定義映射表
22
- * 定義不同角色對應的選單結構
23
- * @private
24
- */
25
- private static _menuDefineMap;
26
- /**
27
- * 設定角色權限映射
28
- * @param map 角色權限映射物件
29
- */
30
- static set rolePermissionMap(map: Record<string, string[]>);
31
- /**
32
- * 設定選單定義映射
33
- * @param map
34
- */
35
- static set menuDefineMap(map: Record<string, MenuItem[]>);
36
- /**
37
- * 配置角色與權限關係,以及選單定義映射
38
- * @param config 配置物件
39
- */
40
- static configure(config: {
41
- rolePermissionMap?: Record<string, string[]>;
42
- menuDefineMap: Record<string, MenuItem[]>;
43
- }): void;
44
- /**
45
- * 檢查角色列表是否包含所需的權限
46
- * @param roleCodes
47
- * @param requiredPermission
48
- */
49
- static hasPermissionByRole(roleCodes: string[], requiredPermission: string): boolean;
50
- /**
51
- * 根據角色列表提供選單項目
52
- * @param roleCode 角色代碼
53
- * @param permissions 權限列表
54
- */
55
- static provideMenuByPermission(param: ProvideMenuByPermissionParams): CMenuItem[];
56
- }
57
- export {};
@@ -1,17 +0,0 @@
1
- import { CAlertModalData } from './CAlertDefine';
2
- type __VLS_Props = {
3
- id?: string;
4
- };
5
- declare function show(data?: CAlertModalData): void;
6
- declare function hide(): void;
7
- declare const _default: import('vue').DefineComponent<__VLS_Props, {
8
- show: typeof show;
9
- hide: typeof hide;
10
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
- "c.modal.ok": (...args: any[]) => void;
12
- "c.modal.cancel": (...args: any[]) => void;
13
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
14
- "onC.modal.ok"?: ((...args: any[]) => any) | undefined;
15
- "onC.modal.cancel"?: ((...args: any[]) => any) | undefined;
16
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
17
- export default _default;
@@ -1,12 +0,0 @@
1
- export interface CAlertModalData {
2
- title?: string;
3
- content?: string;
4
- onCancel?: () => void;
5
- onOk?: () => void;
6
- }
7
- export declare enum CAlertModalType {
8
- Error = "error",// 警告類型
9
- Alert = "alert",// 警告類型
10
- Confirm = "confirm",// 確認類型
11
- Info = "info"
12
- }
@@ -1,6 +0,0 @@
1
- import { CAlertModalData } from '../components/CAlertDefine';
2
- declare function addToast(data: CAlertModalData): void;
3
- declare const _default: import('vue').DefineComponent<{}, {
4
- addToast: typeof addToast;
5
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
6
- export default _default;
@@ -1,10 +0,0 @@
1
- type __VLS_Props = {
2
- show?: boolean;
3
- };
4
- declare function showSpinner(): void;
5
- declare function hide(): void;
6
- declare const _default: import('vue').DefineComponent<__VLS_Props, {
7
- show: typeof showSpinner;
8
- hide: typeof hide;
9
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
- export default _default;
@@ -1,14 +0,0 @@
1
- import { ComputedRef } from 'vue';
2
- type __VLS_Props = {
3
- align?: 'left' | 'center' | 'right';
4
- rowData: Record<string, any>;
5
- cancelable?: boolean;
6
- disableComputed?: ComputedRef<boolean>;
7
- readMode?: boolean;
8
- };
9
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
- "update:checked": (...args: any[]) => void;
11
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
12
- "onUpdate:checked"?: ((...args: any[]) => any) | undefined;
13
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
- export default _default;
@@ -1,10 +0,0 @@
1
- type __VLS_Props = {
2
- rowData: Record<string, any>;
3
- dataName: string;
4
- };
5
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
- "update:textInput": (...args: any[]) => void;
7
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
8
- "onUpdate:textInput"?: ((...args: any[]) => any) | undefined;
9
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
10
- export default _default;
@@ -1,125 +0,0 @@
1
- import { VNode } from 'vue';
2
- /**
3
- * CTableColumnType 定義了表格欄位的類型
4
- * - RowNumber: 行號類型
5
- * - Text: 文字類型
6
- * - Date: 日期類型
7
- * - DateTime: 日期時間類型
8
- * - Action: 操作類型
9
- */
10
- export declare enum CTableColumnType {
11
- RowNumber = "rowNumber",// 行號類型
12
- Text = "text",// 文字類型
13
- TextInput = "textInput",// 文字輸入類型(可手動切換?)
14
- Date = "date",// 日期類型
15
- DateRange = "dateRange",// 日期範圍類型
16
- DateTime = "datetime",// 日期時間類型
17
- Action = "action",// 操作類型
18
- Checkbox = "checkbox"
19
- }
20
- /**
21
- * CTableColumnActionType 定義了表格欄位的操作類型
22
- */
23
- export declare enum CTableColumnActionType {
24
- Edit = "edit",// 編輯操作
25
- Delete = "delete",// 刪除操作
26
- Review = "review",// 審核操作
27
- Vote = "vote",// 投票操作
28
- Check = "check"
29
- }
30
- /**
31
- * CTableColumnActionParam 定義了表格欄位操作的參數
32
- */
33
- export interface CTableColumnActionParam {
34
- actionType: CTableColumnActionType;
35
- rowData: Record<string, any>;
36
- event?: Event;
37
- }
38
- export interface CTableColumnActionMeta {
39
- actionType: CTableColumnActionType;
40
- text?: string;
41
- cls?: string;
42
- icon?: string;
43
- onClick?: (p: CTableColumnActionParam) => void;
44
- emit?: (event: string, ...args: any[]) => void;
45
- }
46
- /**
47
- * CTableColumnDefine 定義了表格欄位的屬性和行為
48
- */
49
- export interface CTableColumnDefine {
50
- id?: string;
51
- type: CTableColumnType;
52
- idName?: string;
53
- dataName?: string;
54
- dataNameList?: string[];
55
- text: string;
56
- defaultText?: string;
57
- width?: string;
58
- align?: 'left' | 'center' | 'right';
59
- dataAlign?: 'left' | 'center' | 'right';
60
- formatPattern?: string;
61
- actionList?: CTableColumnActionMeta[];
62
- customRender?: (rowData: Record<string, any>) => string | HTMLElement | VNode;
63
- useHtml?: boolean;
64
- useVNode?: boolean;
65
- vNodeAttrs?: Record<string, any>;
66
- }
67
- /**
68
- * CTableColumn 類別定義了表格欄位的屬性和行為
69
- */
70
- export declare class CTableColumn implements CTableColumnDefine {
71
- id?: string;
72
- type: CTableColumnType;
73
- idName?: string;
74
- dataName?: string;
75
- dataNameList?: string[];
76
- text: string;
77
- defaultText?: string;
78
- width?: string;
79
- align?: 'left' | 'center' | 'right';
80
- dataAlign?: 'left' | 'center' | 'right';
81
- formatPattern?: string;
82
- actionList?: CTableColumnActionMeta[];
83
- defaultRender?: (rowData: Record<string, any>) => string | HTMLElement | VNode;
84
- customRender?: (rowData: Record<string, any>) => string | HTMLElement | VNode;
85
- useHtml: boolean;
86
- useVNode: boolean;
87
- vNodeAttrs?: Record<string, any>;
88
- constructor(define: CTableColumnDefine);
89
- static defaultIconMap: Record<CTableColumnActionType, string>;
90
- static defaultBtnClassMap: Record<CTableColumnActionType, string>;
91
- static configure(config: {
92
- iconMap?: Partial<Record<CTableColumnActionType, string>>;
93
- btnClassMap?: Partial<Record<CTableColumnActionType, string>>;
94
- }): void;
95
- /**
96
- * 渲染欄位內容
97
- * @param rowData 當前行的數據
98
- */
99
- render(rowData: Record<string, any>): string | HTMLElement | VNode;
100
- /**
101
- * 生成 th 的 class 名稱
102
- */
103
- thClass(): string;
104
- /**
105
- * 生成 td 的 class 名稱
106
- */
107
- tdClass(): string;
108
- /**
109
- * 處理欄位操作
110
- * @private
111
- */
112
- private handleAction;
113
- /**
114
- * 生成默認渲染函數
115
- * @private
116
- */
117
- private makeDefaultRender;
118
- /**
119
- * 根據操作類型生成按鈕的樣式和文字
120
- * @param actionType 操作類型
121
- * @returns {cls: string, text: string} 按鈕的樣式和文字
122
- * @private
123
- */
124
- private buildActionButtonMeta;
125
- }
@@ -1,17 +0,0 @@
1
- import { Directive } from 'vue';
2
- /**
3
- * v-tooltip 指令
4
- * 初始化 Bootstrap 的 Tooltip
5
- * 使用方式:<button v-tooltip>Hover me</button>
6
- */
7
- export declare const vdTooltip: Directive;
8
- /**
9
- * v-cbs-modal 指令
10
- * binding.value 必須是 CBSModalViewModel 的實例
11
- */
12
- export declare const vdCBSModal: Directive;
13
- /**
14
- * v-cbs-dropdown 指令
15
- * 初始化 Bootstrap 的 Dropdown
16
- */
17
- export declare const vdCBSDropdown: Directive;
@@ -1,10 +0,0 @@
1
- import { Directive } from 'vue';
2
- /**
3
- * v-date-formatter 指令
4
- * 解析 ref<Date> 並格式化為文字,根據元素型態輸出
5
- * 可以透過 attribute data-date-format 指定日期格式,預設為 'YYYY-MM-DD'
6
- * 使用方式:
7
- * <input type="text" v-date-formatter="dateRef" data-date-format="YYYY/MM/DD" />
8
- * <span v-date-formatter="dateRef" data-date-format="DD-MM-YYYY"></span>
9
- */
10
- export declare const vdDateFormatter: Directive;
@@ -1,9 +0,0 @@
1
- import { Directive } from 'vue';
2
- /**
3
- * v-cf-turnstile 指令
4
- * 用於在表單中嵌入 Cloudflare Turnstile 驗證碼
5
- * 使用方式:
6
- * <div v-cf-turnstile="fieldContext"></div>
7
- * 其中 fieldContext 為 vee-validate 的 FieldContext,用於接收驗證碼 token
8
- */
9
- export declare const CFTurnstileDirective: Directive;
@@ -1,9 +0,0 @@
1
- import { Directive } from 'vue';
2
- /**
3
- * 此指令用於當 FormField 有錯誤時,顯示錯誤樣式 'is-invalid'。
4
- */
5
- export declare const CFormFieldErrorStyleDirective: Directive;
6
- /**
7
- * 此指令用於當 Yup Schema 驗證失敗時,顯示錯誤樣式 'is-invalid'。
8
- */
9
- export declare const CFormFieldErrorOnYupDirective: Directive;