@dt-frames/ui 1.0.5 → 1.0.8
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/es/components/curd/src/components/dialog.d.ts +1 -0
- package/es/components/forms/src/components/formIcon.d.ts +3 -1
- package/es/components/icons/src/pick-icon.d.ts +1 -0
- package/es/components/modal/src/components/modal-wrap.d.ts +1 -0
- package/es/components/modal/src/index.d.ts +1 -0
- package/es/components/modal/src/types/modal.type.d.ts +3 -3
- package/es/components/source/src/hooks/useFetch.d.ts +1 -2
- package/es/components/source/src/hooks/useSource.d.ts +10 -0
- package/es/components/source/src/types/source.type.d.ts +9 -8
- package/es/components/table/src/components/TableActions.d.ts +2 -2
- package/es/components/table/src/components/setting/Column.d.ts +1 -1
- package/es/components/table/src/components/setting/Download.d.ts +2 -2
- package/es/components/table/src/components/setting/Size.d.ts +2 -2
- package/es/components/table/src/hooks/useHeaderCode.d.ts +3 -2
- package/es/components/table/src/index.d.ts +23 -20
- package/es/components/table/src/props.d.ts +5 -4
- package/es/components/table/src/types/table.type.d.ts +2 -2
- package/es/index.js +937 -906
- package/es/style/components/icons/index.less +5 -1
- package/es/theme/sider/components/basic-menu/basic-menu.d.ts +3 -3
- package/es/theme/tabs/components/TabContent.d.ts +2 -2
- package/package.json +4 -4
- package/src/components/forms/src/components/formIcon.vue +3 -2
- package/src/components/forms/src/index.vue +14 -10
- package/src/components/icons/index.less +5 -1
- package/src/components/icons/src/pick-icon.vue +3 -1
- package/src/components/modal/src/components/close-icon.vue +0 -1
- package/src/components/modal/src/components/modal-wrap.vue +49 -39
- package/src/components/modal/src/components/modal.tsx +1 -1
- package/src/components/modal/src/hooks/useFullScreen.ts +3 -1
- package/src/components/modal/src/hooks/useModal.ts +23 -7
- package/src/components/modal/src/index.vue +1 -1
- package/src/components/modal/src/types/modal.type.ts +3 -3
- package/src/components/source/src/hooks/useFetch.ts +11 -42
- package/src/components/source/src/hooks/useSource.ts +18 -4
- package/src/components/source/src/types/source.type.ts +10 -20
- package/src/components/table/src/components/TableHeader.vue +1 -0
- package/src/components/table/src/components/TableRender.vue +8 -6
- package/src/components/table/src/components/setting/Fullscreen.vue +1 -1
- package/src/components/table/src/components/setting/index.vue +2 -2
- package/src/components/table/src/hooks/useDataSource.ts +24 -13
- package/src/components/table/src/hooks/useHeaderCode.ts +9 -2
- package/src/components/table/src/hooks/useTable.ts +5 -4
- package/src/components/table/src/hooks/useTableHeader.ts +2 -2
- package/src/components/table/src/index.vue +0 -2
- package/src/components/table/src/props.ts +3 -3
- package/src/components/table/src/types/table.type.ts +2 -2
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
if( !el || !el.parentNode ) return null
|
|
31
31
|
|
|
32
32
|
// 找到路由的下一层 进行全屏
|
|
33
|
-
if(el.parentNode.className
|
|
33
|
+
if(el.parentNode.className?.indexOf('dt-layout-content') !== -1) {
|
|
34
34
|
wrapEl.value = el.parentNode
|
|
35
35
|
} else {
|
|
36
36
|
getParent( el.parentNode )
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Download></Download>
|
|
2
|
+
<Download v-if="getSetting.download"></Download>
|
|
3
3
|
<SizeSetting v-if="getSetting.size" />
|
|
4
4
|
<ColumnSetting
|
|
5
5
|
v-if="getSetting.setting"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
setup(props, { emit }) {
|
|
44
44
|
const getSetting = computed((): TableSetting => {
|
|
45
45
|
return {
|
|
46
|
-
|
|
46
|
+
download: true,
|
|
47
47
|
size: true,
|
|
48
48
|
setting: true,
|
|
49
49
|
fullscreen: true,
|
|
@@ -24,6 +24,19 @@ export function useDataSource(
|
|
|
24
24
|
// 拷贝一份表格数据 然后再做数据处理
|
|
25
25
|
const dataSourceRef = ref<Recordable[]>([])
|
|
26
26
|
|
|
27
|
+
// const { defSort, onTableChange } = unref( propsRef )
|
|
28
|
+
// const { appConf } = useAppStore()
|
|
29
|
+
|
|
30
|
+
// onTableChange({
|
|
31
|
+
// pagination: {
|
|
32
|
+
// current: 1,
|
|
33
|
+
// pageSize: appConf.ui.table.defaultPageSize
|
|
34
|
+
// },
|
|
35
|
+
// sort:defSort,
|
|
36
|
+
// filter: null,
|
|
37
|
+
// showBtnLoading: false
|
|
38
|
+
// }, false)
|
|
39
|
+
|
|
27
40
|
watch(
|
|
28
41
|
() => unref(propsRef).dataSource,
|
|
29
42
|
(dataSource) => {
|
|
@@ -75,20 +88,18 @@ export function useDataSource(
|
|
|
75
88
|
}
|
|
76
89
|
|
|
77
90
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const { appConf } = useAppStore()
|
|
91
|
+
const { defSort, onTableChange } = unref( propsRef )
|
|
92
|
+
const { appConf } = useAppStore()
|
|
81
93
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
94
|
+
onTableChange({
|
|
95
|
+
pagination: {
|
|
96
|
+
current: 1,
|
|
97
|
+
pageSize: appConf.ui.table.defaultPageSize
|
|
98
|
+
},
|
|
99
|
+
sort:defSort,
|
|
100
|
+
filter: null,
|
|
101
|
+
showBtnLoading: false
|
|
102
|
+
}, false)
|
|
92
103
|
|
|
93
104
|
|
|
94
105
|
return {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { error, http, Recordable, useAppStore } from "@dt-frames/core"
|
|
2
|
-
import { BasicColumn
|
|
2
|
+
import { BasicColumn } from "../types/table.type"
|
|
3
3
|
|
|
4
|
+
const codeMap = new Map()
|
|
4
5
|
|
|
5
6
|
// 解析header
|
|
6
|
-
export function useHeaderCode(code: string, templates:
|
|
7
|
+
export function useHeaderCode(code: string, templates: Recordable = {}, changeColumns: ( rows: BasicColumn[] ) => void) {
|
|
7
8
|
const { appConf } = useAppStore()
|
|
8
9
|
|
|
9
10
|
if( !appConf.pages.queryColumnApi ) {
|
|
@@ -46,6 +47,11 @@ export function useHeaderCode(code: string, templates: CellFormat = {}, changeCo
|
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
function getColumns() {
|
|
50
|
+
if( codeMap.get(code ) ) {
|
|
51
|
+
changeColumns( codeMap.get(code ) )
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
http.post(
|
|
50
56
|
appConf.pages.queryColumnApi,
|
|
51
57
|
{ tableCode: code }
|
|
@@ -74,6 +80,7 @@ export function useHeaderCode(code: string, templates: CellFormat = {}, changeCo
|
|
|
74
80
|
rows.push(obj)
|
|
75
81
|
} )
|
|
76
82
|
|
|
83
|
+
codeMap.set(code, rows )
|
|
77
84
|
changeColumns( rows )
|
|
78
85
|
}
|
|
79
86
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DynamicProps, Nullable, getDynamicProps, error } from '@dt-frames/core'
|
|
1
|
+
import { DynamicProps, Nullable, getDynamicProps, error, Recordable } from '@dt-frames/core'
|
|
2
2
|
import { onUnmounted, ref, toRaw, unref, watch } from 'vue'
|
|
3
|
-
import { BasicColumn, BasicTableProps,
|
|
3
|
+
import { BasicColumn, BasicTableProps, TableActionType } from '../types/table.type'
|
|
4
4
|
import { useHeaderCode } from './useHeaderCode'
|
|
5
5
|
|
|
6
6
|
|
|
@@ -23,14 +23,15 @@ export function useTable(tableProps?: Props) {
|
|
|
23
23
|
if( tableProps.columnCode ) {
|
|
24
24
|
useHeaderCode(
|
|
25
25
|
tableProps.columnCode as string,
|
|
26
|
-
tableProps.templates as
|
|
26
|
+
tableProps.templates as Recordable,
|
|
27
27
|
(columns: BasicColumn[]) => {
|
|
28
28
|
tableProps.columns = columns
|
|
29
|
+
|
|
30
|
+
instance.setProps(getDynamicProps(tableProps))
|
|
29
31
|
}
|
|
30
32
|
)
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
tableProps && instance.setProps(getDynamicProps(tableProps))
|
|
34
35
|
|
|
35
36
|
watch(
|
|
36
37
|
() => tableProps,
|
|
@@ -12,7 +12,7 @@ export function useTableHeader(
|
|
|
12
12
|
const { tableSetting, toolbar } = unref(propsRef)
|
|
13
13
|
|
|
14
14
|
const { getSlot } = useSlots()
|
|
15
|
-
const hideTitle = !slots.toolbar && !slots.headerTop &&
|
|
15
|
+
const hideTitle = !slots.toolbar && !slots.headerTop && !tableSetting
|
|
16
16
|
|
|
17
17
|
return {
|
|
18
18
|
title: hideTitle
|
|
@@ -21,7 +21,7 @@ export function useTableHeader(
|
|
|
21
21
|
h(
|
|
22
22
|
TableHeader,
|
|
23
23
|
{
|
|
24
|
-
tableSetting,
|
|
24
|
+
tableTools: tableSetting,
|
|
25
25
|
toolbar,
|
|
26
26
|
onColumnsChange: handlers.onColumnsChange
|
|
27
27
|
} as Recordable,
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
import { usePagination } from "./hooks/usePagination"
|
|
33
33
|
import { useDataSource } from "./hooks/useDataSource"
|
|
34
34
|
import { useRowSelection } from "./hooks/useRowSelection"
|
|
35
|
-
import TableHeader from './components/TableHeader.vue'
|
|
36
35
|
import TableRender from './components/TableRender.vue'
|
|
37
36
|
import { createTableInstance } from "./hooks/useTableInstance"
|
|
38
37
|
import { useColumns } from "./hooks/useColumns"
|
|
@@ -45,7 +44,6 @@
|
|
|
45
44
|
props: TableProps,
|
|
46
45
|
components: {
|
|
47
46
|
Table,
|
|
48
|
-
TableHeader,
|
|
49
47
|
TableRender
|
|
50
48
|
},
|
|
51
49
|
emits: [
|
|
@@ -3,7 +3,7 @@ import { PropType } from 'vue'
|
|
|
3
3
|
import { DEFAULT_SORT_FN } from './const'
|
|
4
4
|
import type { PaginationProps } from 'ant-design-vue/lib/pagination'
|
|
5
5
|
import type { TableRowSelection } from 'ant-design-vue/lib/table/interface'
|
|
6
|
-
import { ActionType, BasicColumn, BtnsType,
|
|
6
|
+
import { ActionType, BasicColumn, BtnsType, SizeType, TableSetting } from './types/table.type'
|
|
7
7
|
import { ButtonProps } from '../../forms'
|
|
8
8
|
import { DownloadType } from './types/tableHeader.type'
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ export const TableProps = {
|
|
|
12
12
|
clickRowSelect: { type: Boolean, default: false },
|
|
13
13
|
|
|
14
14
|
// 表格设置
|
|
15
|
-
tableSetting: {type:
|
|
15
|
+
tableSetting: {type: Object as PropType<TableSetting>, default: () => ({})},
|
|
16
16
|
|
|
17
17
|
// 是否显示斑马条纹
|
|
18
18
|
striped: { type: Boolean, default: true },
|
|
@@ -53,7 +53,7 @@ export const TableProps = {
|
|
|
53
53
|
// 列code编码
|
|
54
54
|
columnCode: { type: String },
|
|
55
55
|
// 列自定义的模板
|
|
56
|
-
templates: { type: Object as PropType<
|
|
56
|
+
templates: { type: Object as PropType<Recordable>, default: {} },
|
|
57
57
|
|
|
58
58
|
// 列
|
|
59
59
|
columns: { type: [Array] as PropType<BasicColumn[]>, default: () => [] },
|
|
@@ -21,7 +21,7 @@ export interface TableRowSelection<T = any> extends ITableRowSelection {
|
|
|
21
21
|
|
|
22
22
|
export type TableSetting = {
|
|
23
23
|
// 表格刷新
|
|
24
|
-
|
|
24
|
+
download?: boolean
|
|
25
25
|
// 表格的尺寸
|
|
26
26
|
size?: boolean
|
|
27
27
|
// 是否显示列控制
|
|
@@ -50,7 +50,7 @@ export type SorterResult = {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export type CellFormat =
|
|
53
|
-
| ((
|
|
53
|
+
| ((record: Recordable, index: number, text: string) => any)
|
|
54
54
|
| { dict: DictType }
|
|
55
55
|
| { number: string }
|
|
56
56
|
| { date: string }
|