@yidun/antd-super-table 0.1.7 → 0.1.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.
@@ -435,6 +435,11 @@ export interface SuperTableSlots {
435
435
  * @public
436
436
  */
437
437
  export interface SuperTableExpose extends SuperTableFormOperations, SuperTableTableOperations {
438
+ /**
439
+ * 重置表单查询条件
440
+ */
441
+ onResetForm(): void
442
+
438
443
  /** 是否已初始化 */
439
444
  isInitialized: Ref<boolean>
440
445
  }
package/example/index.vue CHANGED
@@ -14,6 +14,30 @@ const tableRef = ref<InstanceType<typeof SuperTable>>()
14
14
  // 查询条件配置 - 改为响应式
15
15
  const formItems = ref<any[]>(createFormItems())
16
16
 
17
+ function onTableChange(pagination: any, filters: any, sorter: any, extra: any) {
18
+ // sorter 可能是对象或数组(多列排序)
19
+ const sorters = Array.isArray(sorter) ? sorter : [sorter]
20
+ const activeSorters = sorters.filter(s => s?.order)
21
+ if (activeSorters.length > 0) {
22
+ console.log('sort-change:', {
23
+ sorter,
24
+ activeSorters,
25
+ pagination,
26
+ filters,
27
+ extra,
28
+ })
29
+ }
30
+ }
31
+
32
+ function onResizeColumn(width: number, column: any) {
33
+ console.log('resize-column:', {
34
+ width,
35
+ key: column?.key,
36
+ title: column?.title,
37
+ column,
38
+ })
39
+ }
40
+
17
41
  // 表头配置
18
42
  const tableColumns: any = createTableColumns({
19
43
  onDelete,
@@ -161,7 +185,7 @@ const handleClearCache = () => {
161
185
  content: '确定要清空所有 localStorage 缓存吗?此操作不可恢复。',
162
186
  onOk: () => {
163
187
  try {
164
- localStorage.clear()
188
+ window.localStorage.clear()
165
189
  Modal.success({
166
190
  title: '成功',
167
191
  content: '缓存已清空,页面将自动刷新',
@@ -380,6 +404,8 @@ onMounted(() => {
380
404
  },
381
405
  }"
382
406
  @form-item-change="onFormItemChange"
407
+ @change="onTableChange"
408
+ @resize-column="onResizeColumn"
383
409
  >
384
410
  <template
385
411
  v-if="setting.showSceneAddonBefore"
@@ -17,6 +17,9 @@ export const createTableColumns = (options: {
17
17
  content: 'id',
18
18
  width: 80,
19
19
  fixed: 'left',
20
+ // column 示例:开启 antd 排序(配合 example/index.vue 的 @change 打印 sort 日志)
21
+ sorter: (a: any, b: any) => Number(a?.id ?? 0) - Number(b?.id ?? 0),
22
+ sortDirections: ['ascend', 'descend'],
20
23
  },
21
24
  {
22
25
  key: 'index',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yidun/antd-super-table",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",