@dt-frames/ui 1.0.6 → 1.0.9

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 (46) hide show
  1. package/es/components/curd/src/components/dialog.d.ts +1 -0
  2. package/es/components/forms/src/components/formIcon.d.ts +3 -1
  3. package/es/components/icons/src/pick-icon.d.ts +1 -0
  4. package/es/components/modal/src/components/modal-wrap.d.ts +1 -0
  5. package/es/components/modal/src/index.d.ts +1 -0
  6. package/es/components/modal/src/types/modal.type.d.ts +3 -3
  7. package/es/components/source/src/hooks/useFetch.d.ts +1 -2
  8. package/es/components/source/src/hooks/useSource.d.ts +10 -0
  9. package/es/components/source/src/types/source.type.d.ts +9 -8
  10. package/es/components/table/src/components/TableActions.d.ts +2 -2
  11. package/es/components/table/src/components/setting/Column.d.ts +1 -1
  12. package/es/components/table/src/components/setting/Download.d.ts +2 -2
  13. package/es/components/table/src/components/setting/Size.d.ts +2 -2
  14. package/es/components/table/src/hooks/useHeaderCode.d.ts +3 -2
  15. package/es/components/table/src/index.d.ts +23 -20
  16. package/es/components/table/src/props.d.ts +5 -4
  17. package/es/components/table/src/types/table.type.d.ts +2 -2
  18. package/es/index.js +937 -906
  19. package/es/style/components/icons/index.less +5 -1
  20. package/es/theme/sider/components/basic-menu/basic-menu.d.ts +3 -3
  21. package/es/theme/tabs/components/TabContent.d.ts +2 -2
  22. package/package.json +3 -3
  23. package/src/components/forms/src/components/formIcon.vue +3 -2
  24. package/src/components/forms/src/index.vue +14 -10
  25. package/src/components/icons/index.less +5 -1
  26. package/src/components/icons/src/pick-icon.vue +3 -1
  27. package/src/components/modal/src/components/modal-wrap.vue +49 -39
  28. package/src/components/modal/src/components/modal.tsx +1 -1
  29. package/src/components/modal/src/hooks/useFullScreen.ts +3 -1
  30. package/src/components/modal/src/hooks/useModal.ts +23 -7
  31. package/src/components/modal/src/index.vue +1 -1
  32. package/src/components/modal/src/types/modal.type.ts +3 -3
  33. package/src/components/source/src/hooks/useFetch.ts +11 -42
  34. package/src/components/source/src/hooks/useSource.ts +18 -4
  35. package/src/components/source/src/types/source.type.ts +10 -20
  36. package/src/components/table/src/components/TableHeader.vue +1 -0
  37. package/src/components/table/src/components/TableRender.vue +7 -7
  38. package/src/components/table/src/components/setting/Fullscreen.vue +1 -1
  39. package/src/components/table/src/components/setting/index.vue +2 -2
  40. package/src/components/table/src/hooks/useDataSource.ts +24 -13
  41. package/src/components/table/src/hooks/useHeaderCode.ts +9 -2
  42. package/src/components/table/src/hooks/useTable.ts +5 -4
  43. package/src/components/table/src/hooks/useTableHeader.ts +2 -2
  44. package/src/components/table/src/index.vue +0 -2
  45. package/src/components/table/src/props.ts +3 -3
  46. package/src/components/table/src/types/table.type.ts +2 -2
@@ -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
- redo: true,
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
- onMounted(() => {
79
- const { defSort, onTableChange } = unref( propsRef )
80
- const { appConf } = useAppStore()
91
+ const { defSort, onTableChange } = unref( propsRef )
92
+ const { appConf } = useAppStore()
81
93
 
82
- onTableChange({
83
- pagination: {
84
- current: 1,
85
- pageSize: appConf.ui.table.defaultPageSize
86
- },
87
- sort:defSort,
88
- filter: null,
89
- showBtnLoading: false
90
- }, false)
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, CellFormat } from "../types/table.type"
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: CellFormat = {}, changeColumns: ( rows: BasicColumn[] ) => void) {
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, CellFormat, TableActionType } from '../types/table.type'
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 CellFormat,
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 && (!tableSetting || !tableSetting.length)
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, CellFormat, SizeType } from './types/table.type'
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: Array, default: ['redo', 'size', 'setting', 'fullscreen']},
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<CellFormat> },
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
- redo?: boolean
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
- | ((text: string, record: Recordable, index: number) => any)
53
+ | ((record: Recordable, index: number, text: string) => any)
54
54
  | { dict: DictType }
55
55
  | { number: string }
56
56
  | { date: string }