rayyy-vue-table-components 1.2.6 → 1.2.7

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.
@@ -7,6 +7,8 @@ import { default as BaseDialog } from './components/BaseDialog.vue';
7
7
  import { default as SortTable } from './components/tables/SortTable.vue';
8
8
  import { default as SearchBar } from './components/SearchBar.vue';
9
9
  export * from './types';
10
+ export * from './utils/tableHelper';
11
+ export * from './utils/tableStyles';
10
12
  export { BaseTable, BaseBtn, BaseInput, FilterBtn, BaseDialog, SortTable, SearchBar };
11
13
  export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, PluginOptions, VueTableComponentsPlugin, } from './types/components';
12
14
  export * from './components';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Table 樣式工具類
3
+ * 將原本的 SCSS 樣式轉換為 Tailwind CSS 類名
4
+ */
5
+ export declare const tableCell = "p-0 h-10";
6
+ export declare const tableHeader = "bg-primary-15 font-bold text-text text-sm leading-4";
7
+ export declare const tableCellContent = "truncate";
8
+ export declare const dismissedRow = "bg-blue-20";
9
+ export declare const tableFooter = "font-bold";
10
+ export declare const blueText = "text-blue-10";
11
+ export declare const redText = "text-redText";
12
+ export declare const tableStyles: {
13
+ readonly cell: "p-0 h-10";
14
+ readonly header: "bg-primary-15 font-bold text-text text-sm leading-4";
15
+ readonly content: "truncate";
16
+ readonly dismissed: "bg-blue-20";
17
+ readonly footer: "font-bold";
18
+ readonly blueText: "text-blue-10";
19
+ readonly redText: "text-redText";
20
+ };
21
+ export declare const dataTableConfig: {
22
+ readonly cellClass: "p-0 h-10";
23
+ readonly headerClass: "bg-primary-15 font-bold text-text text-sm leading-4";
24
+ readonly contentClass: "truncate";
25
+ readonly dismissedClass: "bg-blue-20";
26
+ readonly footerClass: "font-bold";
27
+ readonly blueTextClass: "text-blue-10";
28
+ readonly redTextClass: "text-redText";
29
+ };
30
+ export declare const createTableCellClass: (options?: {
31
+ isDismissed?: boolean;
32
+ isHeader?: boolean;
33
+ }) => string;
34
+ export declare const createTextClass: (type?: "blue" | "red" | "normal") => "" | "text-blue-10" | "text-redText";
35
+ export type TableStylesType = typeof tableStyles;
36
+ export type DataTableConfigType = typeof dataTableConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -30,7 +30,13 @@
30
30
  "./utils": {
31
31
  "types": "./dist/src/utils/tableHelper.d.ts",
32
32
  "import": "./src/utils/tableHelper.ts"
33
- }
33
+ },
34
+ "./utils/styles": {
35
+ "types": "./dist/src/utils/tableStyles.d.ts",
36
+ "import": "./src/utils/tableStyles.ts"
37
+ },
38
+ "./styles": "./dist/rayyy-vue-table-components.css",
39
+ "./styles/element": "./src/assets/styles/element/index.scss"
34
40
  },
35
41
  "files": [
36
42
  "dist/*",
@@ -39,6 +45,7 @@
39
45
  "src/types/*",
40
46
  "src/types/components.d.ts",
41
47
  "src/utils/*",
48
+ "src/assets/styles/*",
42
49
  "tailwind-preset.js",
43
50
  "README.md"
44
51
  ],
@@ -0,0 +1,44 @@
1
+ .el-dialog.base-dialog {
2
+ @apply p-0 #{!important};
3
+
4
+ .el-dialog__header {
5
+ @apply h-12 pt-2 bg-primary-15 border-b;
6
+
7
+ .el-dialog__title {
8
+ @apply text-base leading-8;
9
+ }
10
+ }
11
+
12
+ .el-dialog__body {
13
+ @apply p-4 overflow-auto;
14
+ max-height: calc(100vh - 200px);
15
+
16
+ .sub-title {
17
+ @apply pb-2 font-bold text-base;
18
+ }
19
+ }
20
+
21
+ .el-dialog__footer {
22
+ @apply py-1 px-2 border-t;
23
+ @apply flex items-center justify-end;
24
+ }
25
+ }
26
+
27
+ .waring-dialog {
28
+ .el-dialog__header {
29
+ @apply border-b-orange;
30
+ }
31
+ }
32
+
33
+ .upload-result-dialog {
34
+ .el-dialog__header {
35
+ @apply border-b-blue-10;
36
+ }
37
+ }
38
+
39
+ .context-wrapper {
40
+ @apply w-full flex items-center justify-center flex-col gap-2;
41
+ p {
42
+ @apply font-bold text-xl;
43
+ }
44
+ }
@@ -0,0 +1,49 @@
1
+ .data-table {
2
+ .el-table__cell {
3
+ @apply p-0 #{!important};
4
+ @apply h-10 #{!important};
5
+
6
+ .el-tooltip {
7
+ .cell-content {
8
+ @apply truncate;
9
+ }
10
+ }
11
+ }
12
+
13
+ .is-dismissed {
14
+ @apply bg-blue-20;
15
+ }
16
+
17
+ .el-table__header {
18
+ th {
19
+ @apply bg-primary-15 #{!important};
20
+
21
+ .cell {
22
+ @apply font-bold text-text text-sm leading-4;
23
+ font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
24
+ }
25
+ }
26
+
27
+ th.el-table-fixed-column--left,
28
+ th.el-table-fixed-column--right {
29
+ @apply bg-primary-15;
30
+ }
31
+ }
32
+
33
+ .el-table__footer {
34
+ .el-table__cell {
35
+ .cell {
36
+ @apply font-bold;
37
+ }
38
+ }
39
+
40
+ .el-table__cell:nth-child(n + 2) {
41
+ .blue-text {
42
+ @apply text-blue-10;
43
+ }
44
+ .red-text {
45
+ @apply text-redText;
46
+ }
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,103 @@
1
+ // 導入 Element Plus 配置
2
+ //@use 'element-plus/theme-chalk/src/mixins/config.scss' as *;
3
+
4
+ // 聲明變數
5
+ $namespace: 'ep';
6
+ $colors: (
7
+ 'main': (
8
+ 'base': #0072bc,
9
+ 'light-3': #3391c9,
10
+ 'light-5': #66b0d6,
11
+ 'light-7': #99cfe3,
12
+ 'light-8': #b3def0,
13
+ 'light-9': #ccedf7,
14
+ 'dark-2': #005b96
15
+ )
16
+ );
17
+
18
+ // 主題變數覆蓋
19
+ :root {
20
+ // Tailwind 自定義顏色
21
+ --color-primary: #6785c1;
22
+ --color-primary-10: #e0e0e0;
23
+ --color-primary-15: #F5F5F5;
24
+ --color-primary-20: #E0E0E0;
25
+ --color-primary-40: #b1c4e4;
26
+ --color-primary-60: #8facd9;
27
+ --color-primary-80: #7198ce;
28
+ --color-primary-dark: #4566a8;
29
+
30
+ // 主色系
31
+ --main-color: #0072bc;
32
+ --main-color-light-3: #3391c9;
33
+ --main-color-light-5: #66b0d6;
34
+ --main-color-light-7: #99cfe3;
35
+ --main-color-light-8: #b3def0;
36
+ --main-color-light-9: #ccedf7;
37
+ --main-color-dark-2: #005b96;
38
+ --main-color-border: #606266;
39
+
40
+ // 成功色系
41
+ --el-color-success: #67c23a;
42
+ --el-color-success-light-3: #85ce61;
43
+ --el-color-success-light-5: #a3e19d;
44
+ --el-color-success-light-7: #c1e3d1;
45
+ --el-color-success-light-8: #d0edc4;
46
+ --el-color-success-light-9: #e1f3d8;
47
+ --el-color-success-dark-2: #529b2e;
48
+
49
+ // 警告色系
50
+ --el-color-warning: #e6a23c;
51
+ --el-color-warning-light-3: #ebb563;
52
+ --el-color-warning-light-5: #efc48d;
53
+ --el-color-warning-light-7: #f3d19e;
54
+ --el-color-warning-light-8: #f5dab1;
55
+ --el-color-warning-light-9: #faeec5;
56
+ --el-color-warning-dark-2: #b88230;
57
+
58
+ // 危險色系
59
+ --el-color-danger: #f56c6c;
60
+ --el-color-danger-light-3: #f78989;
61
+ --el-color-danger-light-5: #f9a7a7;
62
+ --el-color-danger-light-7: #fbc4c4;
63
+ --el-color-danger-light-8: #fcd3d3;
64
+ --el-color-danger-light-9: #fde2e2;
65
+ --el-color-danger-dark-2: #c45656;
66
+
67
+ // 資訊色系
68
+ --el-color-info: #909399;
69
+ --el-color-info-light-3: #a6a9ad;
70
+ --el-color-info-light-5: #bcbfc4;
71
+ --el-color-info-light-7: #d3d4d6;
72
+ --el-color-info-light-8: #dcdfe6;
73
+ --el-color-info-light-9: #e4e7ed;
74
+ --el-color-info-dark-2: #73767a;
75
+
76
+ // 文字顏色
77
+ --el-text-color-primary: #303133;
78
+ --el-text-color-regular: #606266;
79
+ --el-text-color-secondary: #909399;
80
+ --el-text-color-placeholder: #a8abb2;
81
+ --el-text-color-disabled: #c0c4cc;
82
+
83
+ // 邊框顏色
84
+ --el-border-color: #dcdfe6;
85
+ --el-border-color-light: #e4e7ed;
86
+ --el-border-color-lighter: #ebeef5;
87
+ --el-border-color-extra-light: #f2f6fc;
88
+
89
+ // 填充顏色
90
+ --el-fill-color: #f0f2f5;
91
+ --el-fill-color-light: #f5f7fa;
92
+ --el-fill-color-lighter: #fafafa;
93
+ --el-fill-color-extra-light: #fafcff;
94
+ --el-fill-color-dark: #ebedf0;
95
+ --el-fill-color-darker: #e6e8eb;
96
+ --el-fill-color-blank: #ffffff;
97
+
98
+ // 陰影
99
+ --el-box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.04), 0px 8px 20px rgba(0, 0, 0, 0.08);
100
+ --el-box-shadow-light: 0px 0px 12px rgba(0, 0, 0, 0.12);
101
+ --el-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, 0.12);
102
+ --el-box-shadow-dark: 0px 16px 48px 16px rgba(0, 0, 0, 0.08), 0px 12px 32px rgba(0, 0, 0, 0.12);
103
+ }
@@ -0,0 +1,7 @@
1
+
2
+ @use 'dialog';
3
+ @use "table";
4
+
5
+ @tailwind base;
6
+ @tailwind components;
7
+ @tailwind utilities;
@@ -52,17 +52,14 @@ const handleSubmit = () => {
52
52
  :before-close="props.beforeClose"
53
53
  :close-on-click-modal="false"
54
54
  center
55
- class="rounded-md"
55
+ class="rounded-md base-dialog"
56
56
  :class="{ 'waring-dialog': props.isWaring, 'upload-result-dialog': props.isPrimary }"
57
57
  align-center
58
58
  destroy-on-close
59
- header-class="h-12 pt-2 bg-primary-15 border-b"
60
- body-class="p-4 overflow-auto max-h-[calc(100vh-200px)]"
61
- footer-class="py-1 px-2 border-t flex items-center justify-end"
62
59
  >
63
60
  <template #header="{ titleId, titleClass }">
64
61
  <slot name="customHeader">
65
- <p :id="titleId" class="ext-base leading-8" :class="titleClass">
62
+ <p :id="titleId" class="base-dialog-title" :class="titleClass">
66
63
  {{ props.title }}
67
64
  </p>
68
65
  </slot>
@@ -70,7 +67,7 @@ const handleSubmit = () => {
70
67
 
71
68
  <div class="p-2" v-loading="bodyLoading">
72
69
  <div
73
- class=" pb-2 font-bold text-base"
70
+ class="sub-title"
74
71
  :class="{
75
72
  'border-b mb-4': typeof subTitle == 'string',
76
73
  }"
@@ -81,7 +78,7 @@ const handleSubmit = () => {
81
78
  <slot></slot>
82
79
  </div>
83
80
  <template #footer>
84
- <footer >
81
+ <footer>
85
82
  <slot name="customFooter">
86
83
  <base-btn
87
84
  text="確定"
@@ -97,5 +94,4 @@ const handleSubmit = () => {
97
94
  </el-dialog>
98
95
  </template>
99
96
 
100
- <style scoped>
101
- </style>
97
+ <style scoped></style>
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Table 樣式工具類
3
+ * 將原本的 SCSS 樣式轉換為 Tailwind CSS 類名
4
+ */
5
+
6
+ // 表格單元格樣式
7
+ export const tableCell = 'p-0 h-10'
8
+
9
+ // 表格標題樣式
10
+ export const tableHeader = 'bg-primary-15 font-bold text-text text-sm leading-4'
11
+
12
+ // 表格內容樣式
13
+ export const tableCellContent = 'truncate'
14
+
15
+ // 被駁回行的樣式
16
+ export const dismissedRow = 'bg-blue-20'
17
+
18
+ // 表格底部樣式
19
+ export const tableFooter = 'font-bold'
20
+
21
+ // 藍色文字樣式
22
+ export const blueText = 'text-blue-10'
23
+
24
+ // 紅色文字樣式
25
+ export const redText = 'text-redText'
26
+
27
+ // 組合樣式對象
28
+ export const tableStyles = {
29
+ cell: tableCell,
30
+ header: tableHeader,
31
+ content: tableCellContent,
32
+ dismissed: dismissedRow,
33
+ footer: tableFooter,
34
+ blueText,
35
+ redText,
36
+ } as const
37
+
38
+ // 完整的 data-table 樣式配置
39
+ export const dataTableConfig = {
40
+ // 表格單元格配置
41
+ cellClass: tableCell,
42
+ headerClass: tableHeader,
43
+
44
+ // 內容相關類名
45
+ contentClass: tableCellContent,
46
+ dismissedClass: dismissedRow,
47
+ footerClass: tableFooter,
48
+
49
+ // 文字顏色類名
50
+ blueTextClass: blueText,
51
+ redTextClass: redText,
52
+ } as const
53
+
54
+ // 樣式組合函數
55
+ export const createTableCellClass = (options?: {
56
+ isDismissed?: boolean
57
+ isHeader?: boolean
58
+ }) => {
59
+ const baseClass = tableCell
60
+ const classes = [baseClass]
61
+
62
+ if (options?.isDismissed) {
63
+ classes.push(dismissedRow)
64
+ }
65
+
66
+ if (options?.isHeader) {
67
+ classes.push(tableHeader)
68
+ }
69
+
70
+ return classes.join(' ')
71
+ }
72
+
73
+ export const createTextClass = (type: 'blue' | 'red' | 'normal' = 'normal') => {
74
+ switch (type) {
75
+ case 'blue': return blueText
76
+ case 'red': return redText
77
+ default: return ''
78
+ }
79
+ }
80
+
81
+ // 導出類型
82
+ export type TableStylesType = typeof tableStyles
83
+ export type DataTableConfigType = typeof dataTableConfig