@aoao-y33/ui 0.0.2 → 0.0.5

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 (120) hide show
  1. package/README.md +0 -11
  2. package/dist/button/components/button/props.d.ts +43 -0
  3. package/dist/button/components/button/props.d.ts.map +1 -1
  4. package/dist/button/utils/index.d.ts +20 -0
  5. package/dist/button/utils/index.d.ts.map +1 -1
  6. package/dist/common/utils/iconUtils.d.ts +16 -0
  7. package/dist/common/utils/iconUtils.d.ts.map +1 -1
  8. package/dist/form/components/fields/index.d.ts.map +1 -1
  9. package/dist/form/components/form/form.vue.d.ts.map +1 -1
  10. package/dist/form/components/form/props.d.ts +43 -0
  11. package/dist/form/components/form/props.d.ts.map +1 -1
  12. package/dist/form/components/form-item/props.d.ts +29 -0
  13. package/dist/form/components/form-item/props.d.ts.map +1 -1
  14. package/dist/form/hoc/useForm.d.ts +43 -0
  15. package/dist/form/hoc/useForm.d.ts.map +1 -1
  16. package/dist/form/utils/index.d.ts +65 -0
  17. package/dist/form/utils/index.d.ts.map +1 -1
  18. package/dist/index.d.ts +0 -5
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +22523 -12091
  21. package/dist/layout/utils/index.d.ts +20 -0
  22. package/dist/layout/utils/index.d.ts.map +1 -1
  23. package/dist/modal/components/form-modal/props.d.ts +36 -1
  24. package/dist/modal/components/form-modal/props.d.ts.map +1 -1
  25. package/dist/modal/components/modal/props.d.ts +43 -1
  26. package/dist/modal/components/modal/props.d.ts.map +1 -1
  27. package/dist/modal/hoc/useFormModal.d.ts +50 -0
  28. package/dist/modal/hoc/useFormModal.d.ts.map +1 -1
  29. package/dist/modal/hoc/useModal.d.ts +55 -0
  30. package/dist/modal/hoc/useModal.d.ts.map +1 -1
  31. package/dist/modal/hoc/useModalExpose.d.ts +24 -0
  32. package/dist/modal/hoc/useModalExpose.d.ts.map +1 -1
  33. package/dist/table/components/table/props.d.ts +75 -0
  34. package/dist/table/components/table/props.d.ts.map +1 -1
  35. package/dist/table/components/table-column/props.d.ts +19 -0
  36. package/dist/table/components/table-column/props.d.ts.map +1 -1
  37. package/dist/table/components/table-page/props.d.ts +31 -0
  38. package/dist/table/components/table-page/props.d.ts.map +1 -1
  39. package/dist/table/components/table-select/props.d.ts +49 -0
  40. package/dist/table/components/table-select/props.d.ts.map +1 -1
  41. package/dist/table/hoc/useTable.d.ts +41 -0
  42. package/dist/table/hoc/useTable.d.ts.map +1 -1
  43. package/dist/table/hoc/useTableExpose.d.ts +27 -0
  44. package/dist/table/hoc/useTableExpose.d.ts.map +1 -1
  45. package/dist/table/utils/index.d.ts +26 -0
  46. package/dist/table/utils/index.d.ts.map +1 -1
  47. package/package.json +13 -6
  48. package/dist/global.d.ts +0 -33
  49. package/dist/global.d.ts.map +0 -1
  50. package/src/button/components/button/button.vue +0 -64
  51. package/src/button/components/button/index.ts +0 -2
  52. package/src/button/components/button/props.ts +0 -75
  53. package/src/button/components/fields/index.ts +0 -6
  54. package/src/button/hoc/index.ts +0 -1
  55. package/src/button/hoc/useButton.ts +0 -27
  56. package/src/button/index.ts +0 -4
  57. package/src/button/utils/index.ts +0 -32
  58. package/src/common/index.ts +0 -1
  59. package/src/common/utils/iconUtils.ts +0 -21
  60. package/src/common/utils/index.ts +0 -1
  61. package/src/form/components/fields/index.ts +0 -35
  62. package/src/form/components/form/form.vue +0 -130
  63. package/src/form/components/form/index.ts +0 -6
  64. package/src/form/components/form/props.ts +0 -73
  65. package/src/form/components/form-item/form-item.vue +0 -90
  66. package/src/form/components/form-item/index.ts +0 -6
  67. package/src/form/components/form-item/props.ts +0 -50
  68. package/src/form/hoc/index.ts +0 -3
  69. package/src/form/hoc/useForm.ts +0 -106
  70. package/src/form/hoc/useFormExpose.ts +0 -97
  71. package/src/form/hoc/useFormFetch.ts +0 -103
  72. package/src/form/index.ts +0 -5
  73. package/src/form/utils/index.ts +0 -149
  74. package/src/global.ts +0 -40
  75. package/src/index.ts +0 -37
  76. package/src/layout/components/fields/basic/basic.vue +0 -18
  77. package/src/layout/components/fields/index.ts +0 -10
  78. package/src/layout/components/fields/side/side.vue +0 -26
  79. package/src/layout/components/fields/top/top.vue +0 -13
  80. package/src/layout/components/layout/index.ts +0 -6
  81. package/src/layout/components/layout/layout.vue +0 -19
  82. package/src/layout/components/layout/props.ts +0 -3
  83. package/src/layout/hoc/index.ts +0 -1
  84. package/src/layout/hoc/useLayout.ts +0 -32
  85. package/src/layout/index.ts +0 -4
  86. package/src/layout/utils/index.ts +0 -31
  87. package/src/modal/components/form-modal/form-modal.vue +0 -158
  88. package/src/modal/components/form-modal/index.ts +0 -5
  89. package/src/modal/components/form-modal/props.ts +0 -61
  90. package/src/modal/components/modal/index.ts +0 -6
  91. package/src/modal/components/modal/modal.vue +0 -127
  92. package/src/modal/components/modal/props.ts +0 -78
  93. package/src/modal/hoc/index.ts +0 -3
  94. package/src/modal/hoc/useFormModal.ts +0 -140
  95. package/src/modal/hoc/useModal.ts +0 -151
  96. package/src/modal/hoc/useModalExpose.ts +0 -52
  97. package/src/modal/index.ts +0 -3
  98. package/src/style/index.css +0 -21
  99. package/src/table/components/fields/action-column/action-column.vue +0 -34
  100. package/src/table/components/fields/action-column/props.ts +0 -8
  101. package/src/table/components/fields/index.ts +0 -6
  102. package/src/table/components/table/index.ts +0 -6
  103. package/src/table/components/table/props.ts +0 -148
  104. package/src/table/components/table/table.vue +0 -77
  105. package/src/table/components/table-column/index.ts +0 -6
  106. package/src/table/components/table-column/props.ts +0 -26
  107. package/src/table/components/table-column/table-column.vue +0 -31
  108. package/src/table/components/table-page/index.ts +0 -6
  109. package/src/table/components/table-page/props.ts +0 -48
  110. package/src/table/components/table-page/table-page.vue +0 -51
  111. package/src/table/components/table-select/index.ts +0 -6
  112. package/src/table/components/table-select/props.ts +0 -79
  113. package/src/table/components/table-select/table-select.vue +0 -70
  114. package/src/table/hoc/index.ts +0 -2
  115. package/src/table/hoc/useTable.ts +0 -206
  116. package/src/table/hoc/useTableExpose.ts +0 -46
  117. package/src/table/index.ts +0 -7
  118. package/src/table/utils/index.ts +0 -37
  119. package/tsconfig.json +0 -30
  120. package/vite.config.ts +0 -49
@@ -1,78 +0,0 @@
1
- import type {DrawerProps,DrawerEmits} from "element-plus";
2
- import type {AxButtonOptions, AxButtonProps} from "@/button";
3
- import type {EmitsToEventProps} from "@aoao-y33/utils";
4
- import type {Component, EmitsToProps} from "vue";
5
- import type {FieldsConfig} from "@aoao-y33/hooks";
6
-
7
- /**
8
- * AxModal 弹窗组件属性接口
9
- * 继承自 Element Plus DrawerProps,扩展了通用弹窗功能
10
- * 支持 Drawer(抽屉)和 Dialog(对话框)两种展示模式
11
- */
12
- export interface AxModalProps extends DrawerProps{
13
- /**
14
- * 弹窗类型,决定使用哪种展示形式
15
- * - 'drawer': 抽屉式弹窗,从屏幕边缘滑出
16
- * - 'dialog': 对话框式弹窗,居中显示
17
- * @default 'drawer'
18
- */
19
- type?:'drawer'|'dialog',
20
-
21
- /** 弹窗标题,显示在弹窗顶部 */
22
- title?:string
23
-
24
- /** 弹窗的显示/隐藏状态,用于外部控制 */
25
- open?:boolean
26
-
27
- /** 自定义 CSS 类名,用于样式定制 */
28
- className?:string
29
-
30
- /** 确认按钮的配置项,用于自定义确认按钮的外观和行为 */
31
- confirmButton?:AxButtonProps
32
-
33
- /** 取消按钮的配置项,用于自定义取消按钮的外观和行为 */
34
- cancelButton?:AxButtonProps
35
-
36
- /** 是否使用默认配置,启用后将自动应用预设的弹窗样式和按钮 */
37
- isDefault?:boolean
38
- }
39
-
40
- /**
41
- * AxModal 弹窗组件事件发射接口
42
- */
43
- export interface AxModalEmits{
44
- /**
45
- * 弹窗显示状态变化事件(用于 v-model:open 双向绑定)
46
- * @param data - 新的显示状态(true/false)
47
- */
48
- 'update:open':[data:boolean],
49
-
50
- /** 取消按钮点击或关闭弹窗时触发 */
51
- 'cancel':[]
52
-
53
- /** 确认按钮点击时触发 */
54
- 'confirm':[]
55
- }
56
-
57
- /**
58
- * AxModal 弹窗配置选项接口
59
- * 整合了弹窗属性、事件处理和动态内容配置
60
- */
61
- export interface AxModalOptions
62
- extends Omit<AxModalProps, 'open'>, // 排除 open 属性(由内部状态管理)
63
- EmitsToEventProps<AxModalEmits>, // 合并自定义事件处理函数
64
- EmitsToProps<DrawerEmits>{ // 合并 Element Plus Drawer 的事件属性
65
- /**
66
- * 动态渲染的组件,用于在弹窗内容区域显示自定义组件
67
- * @example
68
- * component: UserFormComponent
69
- */
70
- component?:Component,
71
-
72
- /**
73
- * 按钮配置映射表,用于配置弹窗中的各种操作按钮
74
- * @see FieldsConfig - 字段配置类型
75
- * @see AxButtonOptions - 按钮选项类型
76
- */
77
- buttonConfig?:FieldsConfig<AxButtonOptions>
78
- }
@@ -1,3 +0,0 @@
1
- export * from './useModal';
2
- export * from './useFormModal';
3
- export * from './useModalExpose';
@@ -1,140 +0,0 @@
1
- import {type AxFormModalOptions, AxFormModal, useModalExpose, type ModalApi} from "@/modal";
2
- import {type FieldsApi, type StateApi, useComponentPool, useState} from "@aoao-y33/hooks";
3
- import {omit} from "lodash";
4
- import {AxButton, type AxButtonOptions} from "@/button";
5
- import {AxFormItem, type AxFormItemOptions, type FormApi, type FormFetchApi, useFormExpose, useFormFetch} from "@/form";
6
- import {type Component, defineComponent, h, ref} from "vue";
7
-
8
- /**
9
- * UseFormModal Hook 返回的 API 接口
10
- * 整合了弹窗控制、表单操作和请求管理的完整功能集
11
- * @template T - 表单数据类型
12
- */
13
- export interface UseFormModalApi<T extends Record<string, any>> extends ModalApi, FormApi<T>, FormFetchApi<T> {
14
- /**
15
- * 打开弹窗的方法
16
- * 调用后将显示表单弹窗
17
- */
18
- readonly open: () => void;
19
-
20
- /** 按钮组件池 API,用于管理弹窗中的操作按钮(确认、取消等) */
21
- readonly buttonsApi: FieldsApi<AxButtonOptions>
22
-
23
- /**
24
- * 弹窗属性状态管理器
25
- * 用于动态更新弹窗配置(不包含 buttonConfig 和 fieldConfig)
26
- */
27
- readonly setModal: StateApi<Omit<AxFormModalOptions, 'buttonConfig' | 'fieldConfig'>>
28
-
29
- /** 表单项组件池 API,用于管理弹窗内表单的各个字段配置 */
30
- readonly fieldsApi: FieldsApi<AxFormItemOptions>
31
- }
32
-
33
- /**
34
- * 表单弹窗 Hook,用于创建集成了表单功能的弹窗组件
35
- *
36
- * 该 Hook 封装了弹窗和表单的组合逻辑,包括:
37
- * - 弹窗显示/隐藏控制
38
- * - 表单字段动态配置
39
- * - 按钮动态配置
40
- * - 表单验证和提交
41
- * - 数据双向绑定
42
- *
43
- * @param options - 表单弹窗初始配置选项
44
- * @returns [Modal 组件, FormModal API] 元组
45
- *
46
- * @example
47
- * const [FormModal, modalApi] = useFormModal({
48
- * title: '编辑用户',
49
- * api: submitUserData,
50
- * fieldConfig: {
51
- * username: { label: '用户名', type: 'input', vtypes: ['required'] },
52
- * email: { label: '邮箱', type: 'input', vtypes: ['required', 'mail'] }
53
- * },
54
- * buttonConfig: {
55
- * confirm: { text: '保存' },
56
- * cancel: { text: '取消' }
57
- * }
58
- * })
59
- *
60
- * // 在模板中使用
61
- * <FormModal />
62
- *
63
- * // 通过 API 控制弹窗
64
- * modalApi.open() // 打开弹窗
65
- * modalApi.fieldsApi.addField('phone', { label: '电话', type: 'input' })
66
- * modalApi.requestApi.submit()
67
- */
68
- export function useFormModal<T extends Record<string, any> = any>(options: AxFormModalOptions<T> = {}): [Component, UseFormModalApi<T>] {
69
- // 创建弹窗属性状态,排除 buttonConfig 和 fieldConfig(它们由独立的组件池管理)
70
- const [props, setModal] = useState(omit(options, ['buttonConfig', 'fieldConfig']))
71
-
72
- // 创建按钮组件池,用于管理和渲染弹窗中的操作按钮
73
- const [Buttons, buttonsApi] = useComponentPool<AxButtonOptions>(AxButton, options.buttonConfig);
74
-
75
- // 创建表单项组件池,用于管理和渲染弹窗内的表单字段
76
- const [Fields, fieldsApi] = useComponentPool<AxFormItemOptions>(AxFormItem, options.fieldConfig);
77
-
78
- // 创建弹窗引用,用于访问弹窗实例的方法
79
- const modalRef = ref();
80
-
81
- // 获取弹窗暴露的 API(关闭、销毁等方法)
82
- const modalApi = useModalExpose(modalRef);
83
-
84
- // 获取表单暴露的 API(验证、重置、获取数据等方法)
85
- const formApi = useFormExpose<T>(modalRef);
86
-
87
- // 获取表单请求 API(提交、数据获取等异步操作)
88
- const requestApi = useFormFetch<T>(modalRef);
89
-
90
- // 创建内部可见性状态,用于控制弹窗显示/隐藏
91
- const [visible, setVisible] = useState(false);
92
-
93
- /**
94
- * 打开弹窗方法
95
- * 设置内部可见性状态为 true
96
- */
97
- const open = () => {
98
- setVisible(true);
99
- }
100
-
101
- // 定义表单弹窗渲染组件
102
- const Modal = defineComponent({
103
- setup() {
104
- const slots: Record<string, Component> = {};
105
-
106
- // 如果存在字段配置,创建默认插槽(表单项列表)
107
- if (fieldsApi.getList().length) {
108
- slots.default = () => h(Fields);
109
- }
110
-
111
- // 如果存在按钮配置,创建按钮插槽
112
- if (buttonsApi.getList().length) {
113
- slots.button = () => h(Buttons);
114
- }
115
-
116
- // 渲染 AxFormModal 组件,传入 ref、属性和事件处理
117
- return () => h(AxFormModal, {
118
- ref: modalRef,
119
- ...props.value,
120
- // 监听弹窗显示状态变化,同步到内部状态
121
- "onUpdate:open": (val: boolean) => {
122
- setVisible(val);
123
- },
124
- // 绑定内部可见性状态到弹窗
125
- open: visible.value,
126
- }, slots);
127
- }
128
- })
129
-
130
- // 返回弹窗组件和完整的 API 集合(合并弹窗、表单、请求 API)
131
- return [Modal, {
132
- ...modalApi,
133
- ...formApi,
134
- ...requestApi,
135
- buttonsApi,
136
- fieldsApi,
137
- open,
138
- setModal
139
- }] as const;
140
- }
@@ -1,151 +0,0 @@
1
- import {AxModal, type AxModalOptions, type ModalApi} from "@/modal";
2
- import {type FieldsApi, type StateApi, useComponentPool, useState} from "@aoao-y33/hooks";
3
- import {type Component, defineComponent, h, ref, shallowRef} from "vue";
4
- import {omit} from "lodash";
5
- import {AxButton, type AxButtonOptions} from "@/button";
6
- import {useModalExpose} from "@/modal";
7
-
8
- /**
9
- * UseModal Hook 返回的 API 接口
10
- * 提供完整的弹窗控制和内容管理能力
11
- */
12
- export interface UseModalApi extends ModalApi {
13
- /**
14
- * 打开弹窗的方法
15
- * 调用后将显示弹窗
16
- */
17
- readonly open: () => void;
18
-
19
- /** 按钮组件池 API,用于管理弹窗中的操作按钮(确认、取消等) */
20
- readonly buttonsApi: FieldsApi<AxButtonOptions>
21
-
22
- /**
23
- * 弹窗属性状态管理器
24
- * 用于动态更新弹窗配置(不包含 buttonConfig 和 component)
25
- */
26
- readonly setModal: StateApi<Omit<AxModalOptions, 'buttonConfig' | 'component'>>
27
-
28
- /**
29
- * 获取弹窗内动态组件实例的方法
30
- * @returns 组件实例引用,可用于访问子组件的方法和属性
31
- */
32
- readonly getComponent: () => any
33
- }
34
-
35
- /**
36
- * 通用弹窗 Hook,用于创建可配置的弹窗组件
37
- *
38
- * 该 Hook 封装了弹窗的核心逻辑,包括:
39
- * - 弹窗显示/隐藏控制
40
- * - 动态组件渲染(支持自定义内容组件)
41
- * - 按钮动态配置
42
- * - 弹窗状态管理
43
- * - 组件实例访问
44
- *
45
- * @param options - 弹窗初始配置选项
46
- * @returns [Modal 组件, Modal API] 元组
47
- *
48
- * @example
49
- * // 基础用法
50
- * const [Modal, modalApi] = useModal({
51
- * title: '提示',
52
- * type: 'dialog'
53
- * })
54
- *
55
- * // 带自定义组件的用法
56
- * import UserDetail from './UserDetail.vue'
57
- * const [Modal, modalApi] = useModal({
58
- * title: '用户详情',
59
- * component: UserDetail,
60
- * buttonConfig: {
61
- * confirm: { text: '关闭' }
62
- * }
63
- * })
64
- *
65
- * // 在模板中使用
66
- * <Modal />
67
- *
68
- * // 通过 API 控制弹窗
69
- * modalApi.open() // 打开弹窗
70
- * modalApi.getComponent() // 获取内部组件实例
71
- * modalApi.setModal({ title: '新标题' }) // 动态修改弹窗属性
72
- */
73
- export function useModal(options: AxModalOptions = {}): [Component, UseModalApi] {
74
-
75
- // 创建弹窗属性状态,排除 component 和 buttonConfig(它们由独立方式管理)
76
- const [props, setModal] = useState(omit(options, ['component', 'buttonConfig']));
77
-
78
- // 使用 shallowRef 存储动态组件,避免深层响应式开销
79
- const component = shallowRef(options.component);
80
-
81
- // 创建按钮组件池,用于管理和渲染弹窗中的操作按钮
82
- const [Buttons, buttonsApi] = useComponentPool<AxButtonOptions>(AxButton, options.buttonConfig);
83
-
84
- // 创建内部可见性状态,用于控制弹窗显示/隐藏
85
- const [visible, setVisible] = useState(false);
86
-
87
- /**
88
- * 打开弹窗方法
89
- * 设置内部可见性状态为 true
90
- */
91
- const open = () => {
92
- setVisible(true);
93
- }
94
-
95
- // 创建组件引用,用于访问弹窗内动态组件的实例
96
- const componentRef = ref();
97
-
98
- /**
99
- * 获取动态组件实例的方法
100
- * @returns 组件实例引用
101
- */
102
- const getComponent = () => {
103
- return componentRef.value;
104
- }
105
-
106
- // 创建弹窗引用,用于访问弹窗实例的方法
107
- const modalRef = ref();
108
-
109
- // 获取弹窗暴露的 API(关闭、销毁等方法)
110
- const modalApi = useModalExpose(modalRef);
111
-
112
- // 定义弹窗渲染组件
113
- const Modal = defineComponent({
114
- setup() {
115
- const slots: Record<string, Component> = {};
116
-
117
- // 如果配置了动态组件,创建默认插槽并传入组件引用
118
- if (component.value) {
119
- slots.default = () => h(component.value, {ref: componentRef});
120
- }
121
-
122
- // 如果存在按钮配置,创建按钮插槽
123
- if (buttonsApi.getList().length) {
124
- slots.button = () => h(Buttons);
125
- }
126
-
127
- // 渲染 AxModal 组件,传入 ref、属性和事件处理
128
- return () => h(AxModal, {
129
- ref: modalRef,
130
- ...props.value,
131
- // 监听弹窗显示状态变化,同步到内部状态
132
- "onUpdate:open": (val: boolean) => {
133
- setVisible(val);
134
- },
135
- // 绑定内部可见性状态到弹窗
136
- open: visible.value,
137
- }, slots);
138
- }
139
- })
140
-
141
- // 返回弹窗组件和完整的 API 集合(合并按钮管理、状态管理、打开方法和弹窗 API)
142
- return [Modal,
143
- {
144
- buttonsApi,
145
- setModal,
146
- open,
147
- ...modalApi,
148
- getComponent
149
- }] as const;
150
-
151
- }
@@ -1,52 +0,0 @@
1
- import type {Ref} from "vue";
2
- import type {AxModalInstance} from "@/modal";
3
-
4
- /**
5
- * ModalApi 类型定义
6
- * 由 useModalExpose 函数返回的 API 对象类型
7
- */
8
- export type ModalApi = ReturnType<typeof useModalExpose>;
9
-
10
- /**
11
- * 弹窗暴露 API Hook,用于获取和控制弹窗实例的方法
12
- *
13
- * 该 Hook 提供了访问底层弹窗实例的能力,包括:
14
- * - 关闭弹窗
15
- * - 获取原生弹窗组件实例
16
- *
17
- * @param modal - 弹窗组件的 Ref 引用,指向 AxModalInstance 实例
18
- * @returns 包含弹窗控制方法的 API 对象
19
- *
20
- * @example
21
- * const modalRef = ref<AxModalInstance>();
22
- * const modalApi = useModalExpose(modalRef);
23
- *
24
- * // 关闭弹窗
25
- * modalApi.close()
26
- *
27
- * // 获取原生弹窗实例(如 Element Plus 的 Drawer/Dialog 实例)
28
- * const instance = modalApi.getModal()
29
- */
30
- export function useModalExpose(modal:Ref<AxModalInstance>){
31
- /**
32
- * 关闭弹窗方法
33
- * 调用底层弹窗实例的 close 方法
34
- */
35
- const close = ()=>{
36
- modal.value.close();
37
- }
38
-
39
- /**
40
- * 获取原生弹窗组件实例
41
- * 可用于访问 Element Plus 弹窗组件的原生方法和属性
42
- * @returns 原生弹窗实例(Drawer 或 Dialog 实例)
43
- */
44
- const getModal=()=>{
45
- return modal.value.getModal();
46
- }
47
-
48
- return {
49
- close,
50
- getModal
51
- }
52
- }
@@ -1,3 +0,0 @@
1
- export * from "./components/modal";
2
- export * from './components/form-modal';
3
- export * from './hoc';
@@ -1,21 +0,0 @@
1
- @import "element-plus/dist/index.css";
2
- @import "tailwindcss";
3
- @import 'element-plus/theme-chalk/dark/css-vars.css';
4
-
5
- :root {
6
- --ax-bg-color: #F5F5F5;
7
- --ax-block-color: #FFFFFF;
8
- --ax-border-color: #E7E7E7;
9
- --ax-small-radius: 4px;
10
- --ax-normal-radius: 10px;
11
- --el-fill-color-lighter: #EEF1F5;
12
- --el-fill-color-blank: #fff;
13
- }
14
-
15
- :root.dark {
16
- --ax-bg-color: #14161A;
17
- --ax-block-color: #1C1E23;
18
- --ax-border-color: #1C1E23;
19
- --el-fill-color-lighter: #313740;
20
- --el-fill-color-blank: #191E27;
21
- }
@@ -1,34 +0,0 @@
1
- <template>
2
- <div class="flex items-center gap-1">
3
- <ax-button v-for="button in actionList.slice(0, over)" v-bind="button" :link="link" :isMl="false"></ax-button>
4
- <ElPopover trigger="click" v-if="actionList.length>over">
5
- <template #reference>
6
- <el-icon style="transform: rotate(90deg);cursor: pointer">
7
- <MoreFilled/>
8
- </el-icon>
9
- </template>
10
- <div class="flex flex-col gap-2">
11
- <ax-button v-for="button in hiddenAction.slice(0, over)" v-bind="button" :link="link" :isMl="false"></ax-button>
12
- </div>
13
- </ElPopover>
14
- </div>
15
- </template>
16
-
17
- <script setup lang="ts">
18
- import type {ActionColumnProps} from "./props";
19
- import {computed, provide} from "vue";
20
- import {AxButton} from "@/button";
21
- import {ElPopover, ElIcon} from "element-plus";
22
- import {MoreFilled} from "@element-plus/icons-vue";
23
-
24
- defineOptions({name: 'action-column'})
25
- const {rowData = {}, link = true, over = 1, actionList = []} = defineProps<ActionColumnProps>()
26
- provide("clickData", rowData.row)
27
- const hiddenAction = computed(() => {
28
- return actionList.slice(over);
29
- })
30
- </script>
31
-
32
- <style scoped>
33
-
34
- </style>
@@ -1,8 +0,0 @@
1
- import type {AxButtonOptions} from "@/button";
2
-
3
- export interface ActionColumnProps<T extends Record<string, any> = any> {
4
- over?: number,
5
- rowData?: any,
6
- link?:boolean
7
- actionList?: AxButtonOptions<T>[]
8
- }
@@ -1,6 +0,0 @@
1
- import action from './action-column/action-column.vue';
2
- import {addTableColumnField} from "@/table";
3
-
4
- export const initTableColumns = () => {
5
- addTableColumnField('action', action);
6
- }
@@ -1,6 +0,0 @@
1
- import table from './table.vue';
2
-
3
- export const AxTable = table;
4
- export type AxTableInstance = InstanceType<typeof table>;
5
- export default AxTable;
6
- export * from './props';
@@ -1,148 +0,0 @@
1
- import type {TableProps} from "element-plus";
2
- import type {FetchOptions, FieldsConfig, RequestFetch} from "@aoao-y33/hooks";
3
- import type {AxTableColumnsProps, AxTablePageOptions, AxTableSelectOptions} from "@/table";
4
- import type {AxButtonOptions} from "@/button";
5
-
6
- /**
7
- * 分页数据结构
8
- * 用于封装分页查询返回的数据格式
9
- * @template T - 列表项数据类型
10
- */
11
- export interface PageData<T> {
12
- /** 数据总条数 */
13
- total: number;
14
-
15
- /** 当前页的数据列表 */
16
- list: T[];
17
-
18
- /** 当前页码 */
19
- currentPage: number
20
-
21
- /** 每页显示条数 */
22
- currentSize: number
23
- }
24
-
25
- /**
26
- * AxTable 表格组件属性接口
27
- * 继承自 Element Plus TableProps,扩展了数据请求和分页功能
28
- * @template T - 表格行数据类型,必须是对象类型
29
- */
30
- export interface AxTableProps<T extends Record<string, any> = any> extends Partial<TableProps<T>> {
31
- /**
32
- * 表格数据源(本地数据)
33
- * 如果提供了 api,则优先使用 api 获取数据
34
- */
35
- data?: T[];
36
-
37
- /**
38
- * API 请求函数,用于从服务器获取表格数据
39
- * 支持返回普通数组或分页数据结构
40
- * @see RequestFetch - 请求函数类型
41
- */
42
- api?: RequestFetch<any, T[] | PageData<T>>
43
-
44
- /**
45
- * API 请求配置项,包含请求参数、拦截器、转换函数等配置
46
- * @see FetchOptions - 请求配置选项类型
47
- */
48
- apiConfig?: FetchOptions<any, T[] | PageData<T>>
49
- }
50
-
51
- /**
52
- * AxTable 表格组件事件发射接口
53
- * 封装了 Element Plus Table 的所有事件
54
- * @template T - 表格行数据类型
55
- */
56
- export interface AxTableEmits<T extends Record<string, any> = any> {
57
- /** 滚动事件 */
58
- onScroll?: ((...args: T[]) => any) | undefined;
59
-
60
- /** 选择行事件(点击复选框) */
61
- onSelect?: ((...args: T[]) => any) | undefined;
62
-
63
- /** 展开行变化事件 */
64
- "onExpand-change"?: ((...args: T[]) => any) | undefined;
65
-
66
- /** 当前页变化事件(分页) */
67
- "onCurrent-change"?: ((...args: T[]) => any) | undefined;
68
-
69
- /** 全选事件 */
70
- "onSelect-all"?: ((...args: T[]) => any) | undefined;
71
-
72
- /** 选中项变化事件 */
73
- "onSelection-change"?: ((...args: T[]) => any) | undefined;
74
-
75
- /** 单元格鼠标进入事件 */
76
- "onCell-mouse-enter"?: ((...args: T[]) => any) | undefined;
77
-
78
- /** 单元格鼠标离开事件 */
79
- "onCell-mouse-leave"?: ((...args: T[]) => any) | undefined;
80
-
81
- /** 单元格右键菜单事件 */
82
- "onCell-contextmenu"?: ((...args: T[]) => any) | undefined;
83
-
84
- /** 单元格单击事件 */
85
- "onCell-click"?: ((...args: T[]) => any) | undefined;
86
-
87
- /** 单元格双击事件 */
88
- "onCell-dblclick"?: ((...args: T[]) => any) | undefined;
89
-
90
- /** 行单击事件 */
91
- "onRow-click"?: ((...args: T[]) => any) | undefined;
92
-
93
- /** 行右键菜单事件 */
94
- "onRow-contextmenu"?: ((...args: T[]) => any) | undefined;
95
-
96
- /** 行双击事件 */
97
- "onRow-dblclick"?: ((...args: T[]) => any) | undefined;
98
-
99
- /** 表头单击事件 */
100
- "onHeader-click"?: ((...args: T[]) => any) | undefined;
101
-
102
- /** 表头右键菜单事件 */
103
- "onHeader-contextmenu"?: ((...args: T[]) => any) | undefined;
104
-
105
- /** 排序变化事件 */
106
- "onSort-change"?: ((...args: T[]) => any) | undefined;
107
-
108
- /** 筛选变化事件 */
109
- "onFilter-change"?: ((...args: T[]) => any) | undefined;
110
-
111
- /** 表头拖拽结束事件 */
112
- "onHeader-dragend"?: ((...args: T[]) => any) | undefined;
113
- }
114
-
115
- /**
116
- * AxTable 表格配置选项接口
117
- * 整合了表格属性、事件、列配置、分页配置、工具栏和搜索配置
118
- * @template T - 表格行数据类型
119
- * @template R - 搜索条件数据类型
120
- */
121
- export interface AxTableOptions<T extends Record<string, any> = any, R extends Record<string, any> = any>
122
- extends AxTableProps<T>, AxTableEmits<T>, AxTableEmits<T> {
123
- /**
124
- * 表格列配置映射表,用于定义表格的各个列(字段名、宽度、渲染方式等)
125
- * @see FieldsConfig - 字段配置类型
126
- * @see AxTableColumnsProps - 表格列属性类型
127
- */
128
- columnConfig?: FieldsConfig<AxTableColumnsProps>
129
-
130
- /**
131
- * 分页配置项,用于配置分页组件的显示和行为
132
- * @see AxTablePageOptions - 分页选项类型
133
- */
134
- pageConfig?: AxTablePageOptions
135
-
136
- /**
137
- * 工具栏按钮配置映射表,用于配置表格上方的操作按钮(新增、删除、导出等)
138
- * @see FieldsConfig - 字段配置类型
139
- * @see AxButtonOptions - 按钮选项类型
140
- */
141
- toolConfig?: FieldsConfig<AxButtonOptions>
142
-
143
- /**
144
- * 搜索区域配置项,用于配置表格上方的搜索表单
145
- * @see AxTableSelectOptions - 表格搜索选项类型
146
- */
147
- searchConfig?: AxTableSelectOptions<R>
148
- }