fx-platform-ui 0.0.3 → 0.0.4
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/CHANGELOG.md +0 -28
- package/Readme.md +7 -38
- package/lib/fx-platform-ui.mjs +29865 -26684
- package/lib/fx-platform-ui.umd.js +30 -30
- package/lib/packages/components/table/index.d.ts +2 -0
- package/lib/packages/components/table/src/components/index.d.ts +2 -0
- package/lib/packages/components/table/src/components/tool-bar.vue.d.ts +2 -0
- package/lib/packages/components/table/src/hook/index.d.ts +2 -0
- package/lib/packages/components/table/src/hook/useTableMethods.d.ts +21 -0
- package/lib/packages/components/table/src/plat-table-emits.d.ts +2 -0
- package/lib/packages/components/table/src/type/column.d.ts +24 -0
- package/lib/packages/components/table/src/type/index.d.ts +3 -0
- package/lib/packages/components/table/src/type/table.d.ts +8 -0
- package/lib/packages/components/table/src/type/tableAction.d.ts +12 -0
- package/lib/style.css +1 -1
- package/package.json +8 -5
- package/packages/component.ts +3 -3
- package/packages/components/form/src/components/form-action.vue +7 -3
- package/packages/components/form/src/hook/useFormEvents.ts +0 -2
- package/packages/components/form/src/hook/useFormMethods.ts +0 -3
- package/packages/components/form/src/plat-form-item.vue +34 -37
- package/packages/components/table/index.ts +10 -0
- package/packages/components/table/src/components/index.ts +2 -0
- package/packages/components/table/src/components/table-action.vue +25 -0
- package/packages/components/table/src/components/tool-bar.vue +7 -0
- package/packages/components/table/src/hook/index.ts +2 -0
- package/packages/components/table/src/hook/useTableMethods.tsx +128 -0
- package/packages/components/table/src/hook/useTableState.tsx +92 -0
- package/packages/components/table/src/index.vue +93 -0
- package/packages/components/table/src/plat-table-emits.ts +3 -0
- package/packages/components/table/src/plat-table-props.ts +68 -0
- package/packages/components/table/src/type/column.ts +29 -0
- package/packages/components/table/src/type/index.ts +3 -0
- package/packages/components/table/src/type/table.ts +13 -0
- package/packages/components/table/src/type/tableAction.ts +13 -0
- package/lib/packages/components/card/index.d.ts +0 -2
- package/lib/packages/components/card/src/index.vue.d.ts +0 -2
- package/packages/components/card/index.tsx +0 -11
- package/packages/components/card/src/index.vue +0 -22
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ExtractPropTypes } from 'vue'
|
|
2
|
+
import { tableProps } from 'ant-design-vue/es/table'
|
|
3
|
+
import type { PlatFormProps } from '../../form/src/plat-form-props'
|
|
4
|
+
import type {
|
|
5
|
+
TableColumn,
|
|
6
|
+
LoadDataParams,
|
|
7
|
+
OnChangeCallbackParams
|
|
8
|
+
} from './type'
|
|
9
|
+
|
|
10
|
+
export const platTableProps = {
|
|
11
|
+
...tableProps(),
|
|
12
|
+
// 是否显示搜索菜单
|
|
13
|
+
searchShow: {
|
|
14
|
+
type: Boolean as PropType<boolean>,
|
|
15
|
+
default: true
|
|
16
|
+
},
|
|
17
|
+
// 表单属性
|
|
18
|
+
formProps: {
|
|
19
|
+
type: Object as PropType<PlatFormProps>,
|
|
20
|
+
default: () => ({})
|
|
21
|
+
},
|
|
22
|
+
// 表格配置
|
|
23
|
+
columns: {
|
|
24
|
+
type: Array as PropType<TableColumn[]>,
|
|
25
|
+
default: () => [],
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
/** 表格数据请求函数 */
|
|
29
|
+
dataRequest: {
|
|
30
|
+
// 获取列表数据函数API
|
|
31
|
+
// todo any 要替换成表格返回类型
|
|
32
|
+
type: Function as PropType<
|
|
33
|
+
(
|
|
34
|
+
params?: LoadDataParams,
|
|
35
|
+
onChangeParams?: OnChangeCallbackParams
|
|
36
|
+
) => Promise<any>
|
|
37
|
+
>
|
|
38
|
+
},
|
|
39
|
+
/** 是否显示索引号 */
|
|
40
|
+
showIndex: {
|
|
41
|
+
type: Boolean as PropType<boolean>,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
/** 索引列属性配置 */
|
|
45
|
+
indexColumnProps: {
|
|
46
|
+
type: Object as PropType<Partial<TableColumn>>,
|
|
47
|
+
default: () => ({})
|
|
48
|
+
},
|
|
49
|
+
/** 是否显示表格工具栏 */
|
|
50
|
+
showToolBar: {
|
|
51
|
+
type: Boolean as PropType<boolean>,
|
|
52
|
+
default: false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type PlatTableProps = ExtractPropTypes<typeof platTableProps>
|
|
57
|
+
|
|
58
|
+
// 默认支持的插槽
|
|
59
|
+
export const defaultSlots = [
|
|
60
|
+
'emptyText',
|
|
61
|
+
'expandIcon',
|
|
62
|
+
'title',
|
|
63
|
+
'footer',
|
|
64
|
+
'summary',
|
|
65
|
+
'expandedRowRender',
|
|
66
|
+
'customFilterIcon',
|
|
67
|
+
'customFilterDropdown'
|
|
68
|
+
] as const
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TableColumnType } from 'ant-design-vue'
|
|
2
|
+
import type { VNode } from 'vue'
|
|
3
|
+
import type { ActionItem } from './tableAction'
|
|
4
|
+
|
|
5
|
+
export type ColumnParams<T = any> = {
|
|
6
|
+
record: T
|
|
7
|
+
text: string
|
|
8
|
+
index: number
|
|
9
|
+
column: TableColumn<T>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TableColumn<T = Indexable>
|
|
13
|
+
extends Omit<TableColumnType<T>, 'dataIndex' | 'key'> {
|
|
14
|
+
title: string
|
|
15
|
+
dataIndex: keyof T | '$action'
|
|
16
|
+
key?: keyof T | '$action'
|
|
17
|
+
width?: number
|
|
18
|
+
/** 指定搜索的字段 */
|
|
19
|
+
searchField?: string
|
|
20
|
+
/** 在查询表单中不展示此项 */
|
|
21
|
+
hideInSearch?: boolean
|
|
22
|
+
/** 在 Table 中不展示此列 */
|
|
23
|
+
hideInTable?: boolean
|
|
24
|
+
// /** 传递给 Form.Item 的配置,可以配置 rules */
|
|
25
|
+
// formItemProps?: Partial<FormSchema<T>>
|
|
26
|
+
bodyCell?: (params: ColumnParams<T>) => VNode | string
|
|
27
|
+
headerCell?: (params: ColumnParams<T>) => VNode | string
|
|
28
|
+
actions?: (params: ColumnParams<T>) => ActionItem[]
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TablePaginationConfig } from 'ant-design-vue/es/table'
|
|
2
|
+
import type { TableProps } from 'ant-design-vue'
|
|
3
|
+
// 加载表格数据参数
|
|
4
|
+
export type LoadDataParams = TablePaginationConfig & {
|
|
5
|
+
currentPage?: number
|
|
6
|
+
pageSize?: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// 表格onChange回掉参数
|
|
10
|
+
export type OnChangeCallbackParams = any
|
|
11
|
+
|
|
12
|
+
// 表格onChange回掉函数
|
|
13
|
+
export type OnChangeCallback = TableProps['onChange']
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ColumnParams } from './column'
|
|
2
|
+
import type { ButtonProps } from 'ant-design-vue/es/components'
|
|
3
|
+
|
|
4
|
+
export interface ActionItem extends Omit<ButtonProps, 'onClick'> {
|
|
5
|
+
onClick?: Fn<ColumnParams, any>
|
|
6
|
+
label?: string
|
|
7
|
+
color?: 'success' | 'error' | 'warning'
|
|
8
|
+
icon?: string
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
divider?: boolean
|
|
11
|
+
ifShow?: boolean | ((action: ActionItem) => boolean)
|
|
12
|
+
tooltip?: string
|
|
13
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _sfc_main: import("vue").DefineComponent<unknown, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<unknown>, {}>;
|
|
2
|
-
export default _sfc_main;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ACard class="card">
|
|
3
|
-
我是一个封装组件-- {{ text }} --- {{ message }}
|
|
4
|
-
<AButton type="primary">test</AButton>
|
|
5
|
-
</ACard>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script lang="ts" setup>
|
|
9
|
-
defineOptions({
|
|
10
|
-
name: 'PlCard'
|
|
11
|
-
})
|
|
12
|
-
defineProps({
|
|
13
|
-
text: String,
|
|
14
|
-
message: String
|
|
15
|
-
})
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<style lang="less" scoped>
|
|
19
|
-
.card {
|
|
20
|
-
color: red;
|
|
21
|
-
}
|
|
22
|
-
</style>
|