@dazhicheng/ui 1.5.265 → 1.6.0

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 (104) hide show
  1. package/dist/components/tt-area/TtArea.vue.js +1 -1
  2. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
  3. package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
  4. package/dist/components/tt-form/src/components/FormElInput.vue.js +51 -38
  5. package/dist/components/tt-form/src/form-render/FormField.vue2.js +36 -36
  6. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
  7. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +3 -1
  8. package/dist/components/tt-icon/index.vue.js +2 -2
  9. package/dist/components/tt-loading/src/loading.vue.js +2 -2
  10. package/dist/components/tt-modal-form/index.vue.js +13 -12
  11. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
  12. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +93 -86
  13. package/dist/components/tt-panel-select/src/index.vue.js +1 -0
  14. package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
  15. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  16. package/dist/components/tt-table/index.d.ts +523 -358
  17. package/dist/components/tt-table/index.js +7 -4
  18. package/dist/components/tt-table/src/Table.vue.d.ts +306 -216
  19. package/dist/components/tt-table/src/Table.vue.js +405 -618
  20. package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
  21. package/dist/components/tt-table/src/TableForm.vue.js +219 -228
  22. package/dist/components/tt-table/src/components/TableAction.vue.js +108 -131
  23. package/dist/components/tt-table/src/components/TableButtons.js +25 -25
  24. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -85
  25. package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
  26. package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +29 -31
  27. package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
  28. package/dist/components/tt-table/src/emits.js +2 -1
  29. package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
  30. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +63 -0
  31. package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
  32. package/dist/components/tt-table/src/hooks/useColumns.js +100 -245
  33. package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
  34. package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
  35. package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
  36. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +97 -0
  37. package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
  38. package/dist/components/tt-table/src/hooks/usePagination.js +29 -33
  39. package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
  40. package/dist/components/tt-table/src/hooks/useQuery.js +147 -0
  41. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
  42. package/dist/components/tt-table/src/hooks/useRowIdentity.js +96 -0
  43. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +23 -7
  44. package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -71
  45. package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
  46. package/dist/components/tt-table/src/hooks/useSideSlot.js +77 -0
  47. package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
  48. package/dist/components/tt-table/src/hooks/useSyncProps.js +55 -0
  49. package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
  50. package/dist/components/tt-table/src/hooks/useTableData.js +307 -0
  51. package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
  52. package/dist/components/tt-table/src/hooks/useTableFooter.js +46 -0
  53. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
  54. package/dist/components/tt-table/src/hooks/useTableForm.js +55 -48
  55. package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
  56. package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
  57. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +24 -55
  58. package/dist/components/tt-table/src/props.d.ts +318 -151
  59. package/dist/components/tt-table/src/props.js +117 -270
  60. package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
  61. package/dist/components/tt-table/src/table-defaults.js +71 -0
  62. package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
  63. package/dist/components/tt-table/src/table-mutation-events.js +70 -0
  64. package/dist/components/tt-table/src/types/table.d.ts +207 -88
  65. package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
  66. package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
  67. package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
  68. package/dist/components/tt-table/src/utils/action-tab-index.js +50 -0
  69. package/dist/components/tt-table/src/utils/context.js +25 -12
  70. package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
  71. package/dist/components/tt-table/src/utils/table-api.js +198 -165
  72. package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
  73. package/dist/components/tt-table/src/utils/table-form-api.js +41 -31
  74. package/dist/components/types.d.ts +0 -20
  75. package/dist/hooks/useSetup.js +0 -3
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.js +105 -101
  78. package/dist/packages/hooks/src/useDebounce.js +6 -6
  79. package/dist/packages/utils/src/is.js +20 -18
  80. package/dist/packages/utils/src/tool.js +76 -149
  81. package/dist/style.css +1 -1
  82. package/dist/utils/uppercaseInput.d.ts +29 -0
  83. package/dist/utils/uppercaseInput.js +16 -0
  84. package/package.json +3 -3
  85. package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
  86. package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
  87. package/dist/components/tt-table/src/enum.d.ts +0 -2
  88. package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
  89. package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
  90. package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
  91. package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
  92. package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
  93. package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
  94. package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
  95. package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
  96. package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
  97. package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
  98. package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
  99. package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
  100. package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
  101. package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
  102. package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
  103. package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
  104. package/dist/packages/utils/src/check.js +0 -10
@@ -1,9 +1,9 @@
1
+ import { propTypes as o } from "../../../packages/hooks/src/propTypes.js";
1
2
  import "axios";
2
3
  import "element-plus";
3
- import { isFunction as d } from "../../../packages/utils/src/is.js";
4
+ import "dayjs";
4
5
  import "vue";
5
6
  import "xe-utils";
6
- import "dayjs";
7
7
  import "dayjs/plugin/utc";
8
8
  import "dayjs/plugin/timezone";
9
9
  import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -12,109 +12,71 @@ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-u
12
12
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
13
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
14
  import "lodash-es";
15
- import { propTypes as t } from "../../../packages/hooks/src/propTypes.js";
16
15
  import "vue-router";
17
- import { GlobalConfig as o } from "../../../hooks/useSetup.js";
18
- const f = {
16
+ import { GlobalConfig as a } from "../../../hooks/useSetup.js";
17
+ import { createSharedTableDefaults as l } from "./table-defaults.js";
18
+ function e(t) {
19
+ return l()[t];
20
+ }
21
+ const r = {
19
22
  /** 是否显示分页 */
20
- showPager: t.bool.def(!0),
21
- /** 数据总数 */
22
- total: t.number.def(0),
23
+ showPager: { type: Boolean, default: () => e("showPager") },
23
24
  /** 当前页数 field */
24
- currentPageField: {
25
- type: String,
26
- default: () => {
27
- var e;
28
- return (e = o.table) == null ? void 0 : e.currentPageField;
29
- }
30
- },
25
+ currentPageField: { type: String, default: () => e("currentPageField") },
31
26
  /** 当前页的大小 field */
32
- pageSizeField: {
33
- type: String,
34
- default: () => {
35
- var e;
36
- return (e = o.table) == null ? void 0 : e.pageSizeField;
37
- }
38
- },
27
+ pageSizeField: { type: String, default: () => e("pageSizeField") },
39
28
  /** 总数 field */
40
- totalField: {
41
- type: String,
42
- default: () => {
43
- var e;
44
- return (e = o.table) == null ? void 0 : e.totalField;
45
- }
46
- },
29
+ totalField: { type: String, default: () => e("totalField") },
47
30
  /** 数据的 field */
48
- dataField: {
49
- type: String,
50
- default: () => {
51
- var e;
52
- return (e = o.table) == null ? void 0 : e.dataField;
53
- }
54
- }
55
- }, i = {
31
+ dataField: { type: String, default: () => e("dataField") }
32
+ }, p = {
56
33
  /** 是否显示复选框 */
57
- showCheckbox: t.bool.def(!1),
34
+ showCheckbox: { type: Boolean, default: () => e("showCheckbox") },
35
+ /** 是否跨页保持复选框选中状态 */
36
+ reserveSelection: { type: Boolean, default: () => e("reserveSelection") },
58
37
  /** 是否显示单选框 */
59
- showRadio: t.bool.def(!1),
38
+ showRadio: { type: Boolean, default: () => e("showRadio") },
60
39
  /** 是否显示展开列 */
61
- showExpand: t.bool.def(!1),
40
+ showExpand: { type: Boolean, default: () => e("showExpand") },
62
41
  /** 是否显示序号 */
63
- showIndex: t.bool.def(!1),
42
+ showIndex: { type: Boolean, default: () => e("showIndex") },
64
43
  /** 是否需要列拖拽 */
65
- isCellResize: t.bool.def(!1),
66
- /**
67
- * 是否拖动列
68
- * @deprecated 请使用 column-config drag 配合column-drag-config配置 支持的版本看官方文档,后续不在维护列拖拽
69
- * @default true
70
- */
71
- isColumnsDrag: t.bool.def(!1),
44
+ isCellResize: { type: Boolean, default: () => e("isCellResize") },
72
45
  /** 是否列排序 */
73
- isCellSort: t.bool.def(!1),
74
- /**
75
- * 是否checkbox区域选择 选中数据
76
- * @deprecated
77
- */
78
- isAreaCheckData: t.bool.def(!1),
46
+ isCellSort: { type: Boolean, default: () => e("isCellSort") },
79
47
  /** 是否显示操作列 */
80
- showAction: t.bool.def(!1),
48
+ showAction: { type: Boolean, default: () => e("showAction") },
81
49
  /** 操作列宽度 */
82
- actionWidth: t.number.def(0),
50
+ actionWidth: { type: Number, default: () => e("actionWidth") },
83
51
  /** 操作列列名 */
84
- actionTitle: t.string.def(""),
52
+ actionTitle: { type: String, default: () => e("actionTitle") },
85
53
  /** 操作列Props */
86
54
  actionProps: {
87
55
  type: Object,
88
- default: () => ({})
56
+ default: () => e("actionProps")
89
57
  },
90
58
  /** 序号列Props */
91
59
  indexColumnProps: {
92
60
  type: Object,
93
- default: () => ({})
61
+ default: () => e("indexColumnProps")
94
62
  },
95
63
  /** 复选框列Props */
96
64
  checkboxColumnProps: {
97
65
  type: Object,
98
- default: () => ({})
66
+ default: () => e("checkboxColumnProps")
99
67
  },
100
68
  /** 展开行props */
101
69
  expandColumnProps: {
102
70
  type: Object,
103
- default: () => ({})
71
+ default: () => e("expandColumnProps")
104
72
  },
105
73
  /** 单选框列Props */
106
74
  radioColumnProps: {
107
75
  type: Object,
108
- default: () => ({})
76
+ default: () => e("radioColumnProps")
109
77
  },
110
78
  /** 表格行id */
111
- tableRowId: {
112
- type: String,
113
- default: () => {
114
- var e;
115
- return (e = o.table) == null ? void 0 : e.tableRowId;
116
- }
117
- },
79
+ tableRowId: { type: String, default: () => e("tableRowId") },
118
80
  /** 自定义Column函数 */
119
81
  customizeColumn: {
120
82
  type: Function
@@ -127,20 +89,9 @@ const f = {
127
89
  default: null
128
90
  },
129
91
  /** 表格额外参数 */
130
- searchInfo: {
131
- type: Object,
132
- default: () => ({})
133
- },
92
+ searchInfo: { type: Object, default: () => e("searchInfo") },
134
93
  /** 是否初始化加载数据 */
135
- immediate: t.bool.def(!0),
136
- /**
137
- * 请求的状态吗
138
- * @deprecated
139
- */
140
- resultCode: {
141
- type: [String, Number],
142
- default: 200
143
- },
94
+ immediate: { type: Boolean, default: () => e("immediate") },
144
95
  /** 请求后的回调 */
145
96
  afterFetch: {
146
97
  type: Function,
@@ -154,160 +105,85 @@ const f = {
154
105
  /** data */
155
106
  data: {
156
107
  type: Array,
157
- default: []
108
+ default: () => []
158
109
  },
159
110
  /** 是否滚动加载数据 */
160
- isScrollFetch: {
161
- type: Boolean,
162
- default: !1
163
- },
164
- /** 滚动加载数据是否显示loading */
165
- showScrollFetchLoading: {
166
- type: Boolean,
167
- default: !0
168
- }
169
- }, u = {
111
+ isScrollFetch: { type: Boolean, default: () => e("isScrollFetch") }
112
+ }, i = {
170
113
  /** 是否显示toolbar */
171
- showToolbar: t.bool.def(!1),
114
+ showToolbar: { type: Boolean, default: () => e("showToolbar") },
172
115
  /** 具体某些列排序 field数组 */
173
- columnsFieldSort: t.array.def([]),
116
+ columnsFieldSort: {
117
+ type: Array,
118
+ default: () => e("columnsFieldSort")
119
+ },
174
120
  /** 具体某些列不排序 field数组 */
175
- columnsFieldNoSort: t.array.def([]),
176
- /** 是否显示右边刷新按钮 */
177
- showRefresh: {
178
- type: Boolean,
179
- default: () => {
180
- var e;
181
- return (e = o.table) == null ? void 0 : e.showRefresh;
182
- }
121
+ columnsFieldNoSort: {
122
+ type: Array,
123
+ default: () => e("columnsFieldNoSort")
183
124
  },
125
+ /** 是否显示右边刷新按钮 */
126
+ showRefresh: { type: Boolean, default: () => e("showRefresh") },
184
127
  /** 是否显示右边设置 */
185
- showSetting: {
186
- type: Boolean,
187
- default: () => {
188
- var e;
189
- return (e = o.table) == null ? void 0 : e.showSetting;
190
- }
191
- },
128
+ showSetting: { type: Boolean, default: () => e("showSetting") },
192
129
  /** 是否显示自定义列 */
193
- showSetColumn: {
194
- type: Boolean,
195
- default: () => {
196
- var e;
197
- return (e = o.table) == null ? void 0 : e.showSetColumn;
198
- }
199
- },
200
- /** 是否显示自定义行距 */
201
- showLineHeight: {
202
- type: Boolean,
203
- default: () => {
204
- var e;
205
- return (e = o.table) == null ? void 0 : e.showLineHeight;
206
- }
207
- },
130
+ showSetColumn: { type: Boolean, default: () => e("showSetColumn") },
208
131
  /** 不可自定义列数组 field数组 */
209
- notSetColumnField: t.array.def([]),
210
- /** 需要对不显示的字段进行过滤 主要针对于自定义 field数组 */
211
- filterNoVisibleField: t.array.def([]),
212
- /** 是否显示表格上方 alert */
213
- showTableAlert: t.bool.def(!1)
214
- }, p = {
215
- modelValue: {
132
+ notSetColumnField: {
216
133
  type: Array,
217
- default: () => []
134
+ default: () => e("notSetColumnField")
218
135
  },
219
- /** 标题内容 */
220
- title: t.string.def(""),
221
- /** 是否显示标题 */
222
- showTitle: t.bool.def(!1),
223
- /** 是否自适应高度 */
224
- autoHeight: t.bool.def(!0),
136
+ /** 是否显示表格上方 alert */
137
+ showTableAlert: { type: Boolean, default: () => e("showTableAlert") }
138
+ }, T = {
225
139
  /**
226
- * 额外减去的高度
227
- * @deprecated
140
+ * 是否自适应高度
141
+ *
142
+ * 组件方式默认 `true`,与 `table-api.ts` 的 `getDefaultState()` 里 hook 方式默认 `false` 有意不同,
143
+ * 不要统一:改任一边都会改变现有页面的表格高度。因此它不进 `createSharedTableDefaults()`。
228
144
  */
229
- offsetHeight: t.number.def(12),
145
+ autoHeight: o.bool.def(!0),
230
146
  /** 左侧插槽的宽度 */
231
- leftSlotWidth: t.number.def(0),
147
+ leftSlotWidth: { type: Number, default: () => e("leftSlotWidth") },
232
148
  /** 右侧插槽的宽度 */
233
- rightSlotWidth: t.number.def(0),
234
- /** loading text */
235
- loadingText: {
236
- type: String,
237
- default: () => {
238
- var e;
239
- return (e = o.table) == null ? void 0 : e.loadingText;
240
- }
241
- },
149
+ rightSlotWidth: { type: Number, default: () => e("rightSlotWidth") },
242
150
  /** 暂无数据的样式 */
243
- emptyImageStyle: t.object.def({}),
151
+ emptyImageStyle: { type: Object, default: () => e("emptyImageStyle") },
244
152
  /** 暂无数据 */
245
- emptyText: {
246
- type: String,
247
- default: () => {
248
- var e;
249
- return (e = o.table) == null ? void 0 : e.emptyText;
250
- }
251
- },
153
+ emptyText: { type: String, default: () => e("emptyText") },
252
154
  /**
253
155
  * 空数据图片状态, 对于不传api的默认展示情况
254
156
  * @default 'no-data'
255
157
  */
256
158
  emptyImageStatus: {
257
159
  type: String,
258
- default: "no-data"
160
+ default: () => e("emptyImageStatus")
259
161
  },
260
162
  /** 未查询时文字 */
261
- noSearchText: {
262
- type: String,
263
- default: () => {
264
- var e;
265
- return (e = o.table) == null ? void 0 : e.noSearchText;
266
- }
267
- },
268
- /** 是否手动触发查询事件 */
269
- isHanderSubmit: t.bool.def(!1),
270
- /** 储存的key值,支持函数动态获取 */
163
+ noSearchText: { type: String, default: () => e("noSearchText") },
164
+ /**
165
+ * 储存的key值,支持函数动态获取
166
+ *
167
+ * 组件方式固定取 `""`,与 `table-api.ts` hook 方式取 `GlobalConfig.table?.columnsKey` 有意不同,
168
+ * 不要统一:统一会改变组件方式下的列配置缓存 key,已存的服务端列配置会读不到。
169
+ */
271
170
  columnsKey: {
272
171
  type: [String, Function],
273
172
  default: ""
274
173
  },
275
174
  /** 是否开启服务端缓存 */
276
- useHttpCache: {
277
- type: Boolean,
278
- default: () => {
279
- var e;
280
- return (e = o.table) == null ? void 0 : e.useHttpCache;
281
- }
282
- },
175
+ useHttpCache: { type: Boolean, default: () => e("useHttpCache") },
283
176
  /** 开启服务端缓存时默认展示的列 用户列为null时默认展示的列 */
284
177
  defaultDisplayFields: {
285
178
  type: Array,
286
- default: () => {
287
- var e;
288
- return (e = o.table) == null ? void 0 : e.defaultDisplayFields;
289
- }
290
- },
291
- /**
292
- * 是否需要行拖拽-树形表格
293
- * @deprecated 请使用 row-config drag 配合row-drag-config配置 支持的版本看官方文档,后续不在维护行拖拽
294
- * @default false
295
- */
296
- treeNode: t.bool.def(!1),
297
- /** 外部插槽 */
298
- getSyncSlotComponent: {
299
- type: Function
179
+ default: () => e("defaultDisplayFields")
300
180
  },
301
181
  /** 是否清空树形展开状态 */
302
- clearTreeExpand: t.bool.def(!0),
303
- /** 是否进行国际化 */
304
- isI18n: t.bool.def(!0),
305
- /**
306
- * 外部数据是否拷贝一份
307
- * 设置为 false 时,会有性能问题
308
- * @default true
309
- */
310
- isDataCloneDeep: t.bool.def(!0),
182
+ clearTreeExpand: { type: Boolean, default: () => e("clearTreeExpand") },
183
+ /** 表头标题是否显示 tooltip */
184
+ showHeaderTooltip: { type: Boolean, default: () => e("showHeaderTooltip") },
185
+ /** 单元格内容是否显示 tooltip */
186
+ showCellTooltip: { type: Boolean, default: () => e("showCellTooltip") },
311
187
  /** 表格的api */
312
188
  tableApi: {
313
189
  type: Object
@@ -317,74 +193,53 @@ const f = {
317
193
  type: Object
318
194
  },
319
195
  /** 是否使用搜索form */
320
- useSearchForm: t.bool.def(!1),
321
- /** 是否禁用Teleport将节点输送至body */
322
- disabledTeleport: t.bool.def(!1),
196
+ useSearchForm: o.bool.def(!1),
323
197
  /** 表格 testId,用于生成测试标识 */
324
198
  testId: {
325
199
  type: String,
326
200
  default: void 0
327
201
  },
328
- ...f,
329
- ...i,
202
+ ...r,
203
+ ...p,
330
204
  ...n,
331
- ...u
332
- }, b = {
205
+ ...i
206
+ }, d = {
333
207
  /** 按键配置项 */
334
208
  keyboardConfig: {
335
209
  type: Object,
336
- default: () => {
337
- var e;
338
- return (e = o.table) == null ? void 0 : e.keyboardConfig;
339
- }
340
- },
341
- /** 右键菜单配置项 */
342
- menuConfig: {
343
- type: Object,
344
- default: () => ({})
210
+ default: () => e("keyboardConfig")
345
211
  },
346
212
  /** 鼠标配置项 */
347
213
  mouseConfig: {
348
214
  type: Object,
349
- default: () => {
350
- var e;
351
- return (e = o.table) == null ? void 0 : e.mouseConfig;
352
- }
215
+ default: () => e("mouseConfig")
353
216
  },
354
217
  /** 复选框配置项 */
355
218
  checkboxConfig: {
356
219
  type: Object,
357
- default: () => {
358
- var e;
359
- return (e = o.table) == null ? void 0 : e.checkboxConfig;
360
- }
220
+ default: () => e("checkboxConfig")
361
221
  },
362
222
  /** 单选框配置项 */
363
223
  radioConfig: {
364
224
  type: Object,
365
- default: () => {
366
- var e;
367
- return (e = o.table) == null ? void 0 : e.radioConfig;
368
- }
225
+ default: () => e("radioConfig")
369
226
  }
370
- }, s = Object.entries(p).reduce((e, a) => {
371
- if (a) {
372
- const [r, l] = a;
373
- d(l.default) ? e[r] = l.default() : e[r] = l.default;
374
- }
375
- return e;
376
- }, {}), R = {
377
- tableData: {
378
- type: Array,
379
- default: () => []
380
- },
381
- /** table参数 */
227
+ }, j = {
228
+ /**
229
+ * table参数
230
+ *
231
+ * `default` 必须是工厂函数:Vue 的 object prop 直接给对象时所有 `TtTableForm` 实例共享同一个引用。
232
+ *
233
+ * 取值为共用默认值加上组件方式口径的三个字段。`autoHeight` / `columnsKey` / `useSearchForm` 都不在
234
+ * 共用默认值里(前两个两处取值不同,后一个只在组件方式出现),而 `TtTableForm` 属于组件方式调用点,
235
+ * 因此这里显式补上组件方式的字面量 —— 它们与改动前 `Object.entries(tableProps).reduce(...)` 的产物逐字段相等。
236
+ */
382
237
  table: {
383
238
  type: Object,
384
- default: s
239
+ default: () => ({ ...l(), autoHeight: !0, columnsKey: "", useSearchForm: !1 })
385
240
  },
386
241
  /** 是否使用搜索form */
387
- useSearchForm: t.bool.def(!0),
242
+ useSearchForm: o.bool.def(!0),
388
243
  /** BasicFormProps 的配置 */
389
244
  form: {
390
245
  type: Object,
@@ -409,8 +264,8 @@ const f = {
409
264
  tableRowId: {
410
265
  type: String,
411
266
  default: () => {
412
- var e;
413
- return (e = o.table) == null ? void 0 : e.tableRowId;
267
+ var t;
268
+ return (t = a.table) == null ? void 0 : t.tableRowId;
414
269
  }
415
270
  },
416
271
  /** 表格 testId,用于生成测试标识 */
@@ -422,7 +277,7 @@ const f = {
422
277
  tableFormApi: {
423
278
  type: Object
424
279
  }
425
- }, k = {
280
+ }, I = {
426
281
  /** 列配置 */
427
282
  columns: {
428
283
  type: Array,
@@ -433,7 +288,7 @@ const f = {
433
288
  */
434
289
  height: {
435
290
  type: [Number, String],
436
- default: void 0
291
+ default: () => e("height")
437
292
  },
438
293
  /**
439
294
  * 设置所有内容过长时显示为省略号(如果是固定列建议设置该值,提升渲染速度
@@ -441,7 +296,7 @@ const f = {
441
296
  */
442
297
  showOverflow: {
443
298
  type: [String, Boolean],
444
- default: !0
299
+ default: () => e("showOverflow")
445
300
  },
446
301
  /**
447
302
  * @description 内部使用插槽重写title内容。true 和 'tooltip' 都会有 tooltip 效果,false 和其他的值会显示省略号不会有 tooltip 效果
@@ -449,33 +304,26 @@ const f = {
449
304
  */
450
305
  showHeaderOverflow: {
451
306
  type: [String, Boolean],
452
- default: !0
307
+ default: () => e("showHeaderOverflow")
453
308
  },
454
309
  /** 分页配置 */
455
310
  pagerConfig: {
456
311
  type: Object,
457
- default: () => {
458
- var e;
459
- return (e = o.table) == null ? void 0 : e.pagerConfig;
460
- }
312
+ default: () => e("pagerConfig")
461
313
  },
462
- /** toolbar 配置 */
314
+ /**
315
+ * toolbar 配置
316
+ *
317
+ * 不写 `default`,取值由共用默认值里的 `toolbarConfig: undefined` 提供:
318
+ * `useGridProps` 用解构默认值 `toolbarConfig = {}` 兜底,而 ES 解构默认值只对 `undefined` 生效。
319
+ */
463
320
  toolbarConfig: {
464
- type: Object,
465
- default: () => null
466
- },
467
- /** 缩放配置项 */
468
- zoomConfig: {
469
- type: Object,
470
- default: () => null
321
+ type: Object
471
322
  },
472
323
  /** 表格大小 */
473
324
  size: {
474
325
  type: String,
475
- default: () => {
476
- var e;
477
- return (e = o.table) == null ? void 0 : e.size;
478
- }
326
+ default: () => e("size")
479
327
  },
480
328
  /**
481
329
  * tooltip错误提示方向,用于控制错误信息提示的显示位置
@@ -486,11 +334,10 @@ const f = {
486
334
  type: String,
487
335
  default: "right"
488
336
  },
489
- ...b
337
+ ...d
490
338
  };
491
339
  export {
492
- R as tableFormProps,
493
- k as tableOtherProps,
494
- b as tableProProps,
495
- p as tableProps
340
+ j as tableFormProps,
341
+ I as tableOtherProps,
342
+ T as tableProps
496
343
  };
@@ -0,0 +1,25 @@
1
+ import { TtTableProps } from './types/table';
2
+ /**
3
+ * 创建组件方式(`props.ts` 的 `tableProps`)与 hook 方式(`table-api.ts` 的 `getDefaultState()`)
4
+ * 共用的表格默认配置,是这批默认值的唯一来源。
5
+ *
6
+ * 只收敛两处原本逐字重复的部分:18 个读 `GlobalConfig.table` 的字段,加上两处取值相同的静态默认。
7
+ * 只在一处出现的字段(`api` / `data` / `useSearchForm` / `testId` / `stripe` / `border` / 三个列配置接口等)
8
+ * 与两处取值不同的字段(`autoHeight` / `columnsKey`)都不在这里,仍由各调用点自己声明。
9
+ *
10
+ * `autoHeight` 为何不在其中:组件方式默认 `true`(表格铺满父容器),hook 方式默认 `false`。
11
+ * 这是有意保留的差异,改任一边都会改变现有页面的表格高度,属于调用方可见的布局回退。
12
+ * 两个调用点各写一行字面量并互相注释指向对方,不为它引入 `usage` 参数或枚举。
13
+ *
14
+ * `columnsKey` 为何不在其中:组件方式取 `""`,hook 方式取 `GlobalConfig.table?.columnsKey`。
15
+ * 统一会改变组件方式下的列配置缓存 key,已存的服务端列配置会读不到。
16
+ *
17
+ * 为何必须是工厂函数而不是模块级常量:
18
+ * 1. Vue 的 object prop 用 `default:` 直接给对象时所有实例共享同一个引用,一个实例改配置会影响另一个;
19
+ * 每次调用返回新的顶层对象才能隔离实例(`GlobalConfig` 上的嵌套对象仍是共享引用,与改动前一致)。
20
+ * 2. `GlobalConfig.table` 由 `useSetup` 的 `setup()` 在应用启动时写入,模块顶层求值会拿到初始化前的空配置。
21
+ * 未初始化时读到的字段全为 `undefined`,与改动前 `default: () => GlobalConfig.table?.x` 的时机一致。
22
+ *
23
+ * @returns 每次调用都是新对象,不与其他调用的返回值共享引用;不含 `autoHeight` 键
24
+ */
25
+ export declare function createSharedTableDefaults(): TtTableProps;
@@ -0,0 +1,71 @@
1
+ import { GlobalConfig as e } from "../../../hooks/useSetup.js";
2
+ function S() {
3
+ var o, l, t, a, i, s, r, n, d, f, h, b, c, u, g, p, C, m;
4
+ return {
5
+ showPager: !0,
6
+ showCheckbox: !1,
7
+ /** 跨页选中默认关闭,与改动前「翻页后只剩当前页选中」的行为一致。 */
8
+ reserveSelection: !1,
9
+ showExpand: !1,
10
+ showRadio: !1,
11
+ showIndex: !1,
12
+ isCellResize: !1,
13
+ isCellSort: !1,
14
+ showAction: !1,
15
+ actionWidth: 0,
16
+ actionTitle: "",
17
+ actionProps: {},
18
+ indexColumnProps: {},
19
+ checkboxColumnProps: {},
20
+ expandColumnProps: {},
21
+ radioColumnProps: {},
22
+ searchInfo: {},
23
+ immediate: !0,
24
+ showToolbar: !1,
25
+ columnsFieldSort: [],
26
+ columnsFieldNoSort: [],
27
+ notSetColumnField: [],
28
+ showTableAlert: !1,
29
+ leftSlotWidth: 0,
30
+ rightSlotWidth: 0,
31
+ emptyImageStyle: {},
32
+ emptyImageStatus: "no-data",
33
+ clearTreeExpand: !0,
34
+ showOverflow: !0,
35
+ showHeaderOverflow: !0,
36
+ /** 表头 tooltip 默认关闭,与改动前「表头从不出 tooltip」的现状一致。 */
37
+ showHeaderTooltip: !1,
38
+ /** 单元格 tooltip 默认关闭,关闭时 `showOverflow` 沿用原有取值,与改动前一致。 */
39
+ showCellTooltip: !1,
40
+ height: void 0,
41
+ formApi: void 0,
42
+ isScrollFetch: !1,
43
+ /**
44
+ * 必须是 `undefined` 而不是 `null`:`useGridProps` 用 ES 解构默认值 `toolbarConfig = {}` 兜底,
45
+ * 而解构默认值只对 `undefined` 生效。对 vxe 而言两者等价(`Object.assign` 忽略两者,
46
+ * 三处启用判定都是 `props.toolbarConfig && isEnableConf(...)`,两者同为 falsy)。
47
+ */
48
+ toolbarConfig: void 0,
49
+ useHttpCache: (o = e.table) == null ? void 0 : o.useHttpCache,
50
+ defaultDisplayFields: (l = e.table) == null ? void 0 : l.defaultDisplayFields,
51
+ emptyText: (t = e.table) == null ? void 0 : t.emptyText,
52
+ noSearchText: (a = e.table) == null ? void 0 : a.noSearchText,
53
+ showSetColumn: (i = e.table) == null ? void 0 : i.showSetColumn,
54
+ showSetting: (s = e.table) == null ? void 0 : s.showSetting,
55
+ showRefresh: (r = e.table) == null ? void 0 : r.showRefresh,
56
+ tableRowId: (n = e.table) == null ? void 0 : n.tableRowId,
57
+ currentPageField: (d = e.table) == null ? void 0 : d.currentPageField,
58
+ pageSizeField: (f = e.table) == null ? void 0 : f.pageSizeField,
59
+ totalField: (h = e.table) == null ? void 0 : h.totalField,
60
+ dataField: (b = e.table) == null ? void 0 : b.dataField,
61
+ pagerConfig: (c = e.table) == null ? void 0 : c.pagerConfig,
62
+ size: (u = e.table) == null ? void 0 : u.size,
63
+ keyboardConfig: (g = e.table) == null ? void 0 : g.keyboardConfig,
64
+ mouseConfig: (p = e.table) == null ? void 0 : p.mouseConfig,
65
+ checkboxConfig: (C = e.table) == null ? void 0 : C.checkboxConfig,
66
+ radioConfig: (m = e.table) == null ? void 0 : m.radioConfig
67
+ };
68
+ }
69
+ export {
70
+ S as createSharedTableDefaults
71
+ };