@ftjs/antd 0.3.0 → 0.4.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 (33) hide show
  1. package/dist/antd-table/ft-antd-table.vue.d.ts +65 -0
  2. package/dist/antd-table/index.d.ts +3 -0
  3. package/dist/antd-table/type.d.ts +55 -0
  4. package/dist/antd-table/use-edit.d.ts +14 -0
  5. package/dist/form/components/auto-complete.d.ts +1 -1
  6. package/dist/form/components/cascader.d.ts +1 -1
  7. package/dist/form/components/checkbox.d.ts +1 -1
  8. package/dist/form/components/date-picker.d.ts +1 -1
  9. package/dist/form/components/input-number.d.ts +1 -1
  10. package/dist/form/components/input.d.ts +1 -1
  11. package/dist/form/components/mentions.d.ts +1 -1
  12. package/dist/form/components/radio.d.ts +1 -1
  13. package/dist/form/components/range-picker.d.ts +1 -1
  14. package/dist/form/components/rate.d.ts +1 -1
  15. package/dist/form/components/select.d.ts +1 -1
  16. package/dist/form/components/slider.d.ts +1 -1
  17. package/dist/form/components/switch.d.ts +1 -1
  18. package/dist/form/components/textarea.d.ts +1 -1
  19. package/dist/form/components/tree-select.d.ts +1 -1
  20. package/dist/form/components/upload.d.ts +1 -1
  21. package/dist/form/define-form.d.ts +31 -98
  22. package/dist/form/form-content.vue.d.ts +17 -0
  23. package/dist/form/ft-antd-form-search.vue.d.ts +21 -0
  24. package/dist/form/ft-antd-form.vue.d.ts +20 -0
  25. package/dist/form/register.d.ts +13 -52
  26. package/dist/index.d.ts +3 -4
  27. package/dist/index.js +1033 -837
  28. package/dist/vxe-table/ft-vxe-table.vue.d.ts +94 -0
  29. package/dist/vxe-table/index.d.ts +2 -0
  30. package/dist/vxe-table/types.d.ts +51 -0
  31. package/package.json +2 -2
  32. package/dist/antd-table/define-table.d.ts +0 -139
  33. package/dist/vxe-table/define-vxe-table.d.ts +0 -114
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
- import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, ref, useId, Fragment, watchEffect, onMounted, onUnmounted, nextTick, reactive, watch, h } from "vue";
2
- import { SwapOutlined, SettingOutlined } from "@ant-design/icons-vue";
3
- import { getField, defineFormComponent, useFormItem, unrefs, defineFtForm, useFormInject, set, defineFtTable, useTableInject, get, cloneDeep } from "@ftjs/core";
4
- import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Modal, Tree, Button, Form, Divider, Table, Spin, Pagination } from "ant-design-vue";
1
+ import { getField, useFormItem, unrefs, useForm, set, get, cloneDeep, useTable } from "@ftjs/core";
2
+ import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, defineComponent, createElementBlock, openBlock, Fragment, renderList, createBlock, resolveDynamicComponent, ref, useId, withCtx, createCommentVNode, createElementVNode, toDisplayString, reactive, watch, h, onMounted, onUnmounted, useTemplateRef, nextTick, normalizeStyle, renderSlot, createSlots, normalizeProps, resolveComponent } from "vue";
3
+ import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Form, Button, Modal, Tree, Divider, Table, Spin, Pagination } from "ant-design-vue";
5
4
  import dayjs from "dayjs";
6
- import { VxeGrid } from "vxe-table";
5
+ import { SwapOutlined, SettingOutlined } from "@ant-design/icons-vue";
7
6
  const useFormItemProps = (column) => {
8
7
  return computed(() => {
9
8
  const field = getField(column);
@@ -15,7 +14,7 @@ const useFormItemProps = (column) => {
15
14
  };
16
15
  });
17
16
  };
18
- const input = defineFormComponent((props) => {
17
+ const input = defineFormItem((props) => {
19
18
  const {
20
19
  valueComputed
21
20
  } = useFormItem({
@@ -36,7 +35,7 @@ const input = defineFormComponent((props) => {
36
35
  };
37
36
  });
38
37
  const isViewOptionsStyle = "display: flex; gap: 4px;";
39
- const select = defineFormComponent((props) => {
38
+ const select = defineFormItem((props) => {
40
39
  const {
41
40
  valueComputed
42
41
  } = useFormItem({
@@ -72,7 +71,7 @@ const select = defineFormComponent((props) => {
72
71
  });
73
72
  };
74
73
  });
75
- const datePicker = defineFormComponent((props) => {
74
+ const datePicker = defineFormItem((props) => {
76
75
  const {
77
76
  valueComputed
78
77
  } = useFormItem({
@@ -95,7 +94,7 @@ const datePicker = defineFormComponent((props) => {
95
94
  });
96
95
  };
97
96
  });
98
- const rangePicker = defineFormComponent((props) => {
97
+ const rangePicker = defineFormItem((props) => {
99
98
  const {
100
99
  valueComputed
101
100
  } = useFormItem({
@@ -129,7 +128,7 @@ const rangePicker = defineFormComponent((props) => {
129
128
  function isSimpleOption(option) {
130
129
  return typeof option === "string" || typeof option === "number";
131
130
  }
132
- const radio = defineFormComponent((props) => {
131
+ const radio = defineFormItem((props) => {
133
132
  const {
134
133
  valueComputed
135
134
  } = useFormItem({
@@ -165,7 +164,7 @@ const radio = defineFormComponent((props) => {
165
164
  });
166
165
  };
167
166
  });
168
- const textarea = defineFormComponent((props) => {
167
+ const textarea = defineFormItem((props) => {
169
168
  const {
170
169
  valueComputed
171
170
  } = useFormItem({
@@ -189,7 +188,7 @@ const textarea = defineFormComponent((props) => {
189
188
  function _isSlot(s) {
190
189
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
191
190
  }
192
- const upload = defineFormComponent((props) => {
191
+ const upload = defineFormItem((props) => {
193
192
  const {
194
193
  valueComputed,
195
194
  slots
@@ -224,7 +223,7 @@ const upload = defineFormComponent((props) => {
224
223
  });
225
224
  };
226
225
  });
227
- const cascader = defineFormComponent((props) => {
226
+ const cascader = defineFormItem((props) => {
228
227
  const {
229
228
  valueComputed
230
229
  } = useFormItem({
@@ -266,7 +265,7 @@ const cascader = defineFormComponent((props) => {
266
265
  });
267
266
  };
268
267
  });
269
- const autoComplete = defineFormComponent((props) => {
268
+ const autoComplete = defineFormItem((props) => {
270
269
  const {
271
270
  valueComputed
272
271
  } = useFormItem({
@@ -285,7 +284,7 @@ const autoComplete = defineFormComponent((props) => {
285
284
  });
286
285
  };
287
286
  });
288
- const checkbox = defineFormComponent((props) => {
287
+ const checkbox = defineFormItem((props) => {
289
288
  const {
290
289
  valueComputed
291
290
  } = useFormItem({
@@ -335,7 +334,7 @@ const checkbox = defineFormComponent((props) => {
335
334
  });
336
335
  };
337
336
  });
338
- const inputNumber = defineFormComponent((props) => {
337
+ const inputNumber = defineFormItem((props) => {
339
338
  const {
340
339
  valueComputed
341
340
  } = useFormItem({
@@ -353,7 +352,7 @@ const inputNumber = defineFormComponent((props) => {
353
352
  });
354
353
  };
355
354
  });
356
- const mentions = defineFormComponent((props) => {
355
+ const mentions = defineFormItem((props) => {
357
356
  const {
358
357
  valueComputed
359
358
  } = useFormItem({
@@ -370,7 +369,7 @@ const mentions = defineFormComponent((props) => {
370
369
  });
371
370
  };
372
371
  });
373
- const rate = defineFormComponent((props) => {
372
+ const rate = defineFormItem((props) => {
374
373
  const {
375
374
  valueComputed
376
375
  } = useFormItem({
@@ -388,7 +387,7 @@ const rate = defineFormComponent((props) => {
388
387
  });
389
388
  };
390
389
  });
391
- const slider = defineFormComponent((props) => {
390
+ const slider = defineFormItem((props) => {
392
391
  const {
393
392
  valueComputed
394
393
  } = useFormItem({
@@ -405,7 +404,7 @@ const slider = defineFormComponent((props) => {
405
404
  });
406
405
  };
407
406
  });
408
- const switchComponent = defineFormComponent((props) => {
407
+ const switchComponent = defineFormItem((props) => {
409
408
  const {
410
409
  valueComputed
411
410
  } = useFormItem({
@@ -429,7 +428,7 @@ const switchComponent = defineFormComponent((props) => {
429
428
  });
430
429
  };
431
430
  });
432
- const treeSelect = defineFormComponent((props) => {
431
+ const treeSelect = defineFormItem((props) => {
433
432
  const {
434
433
  valueComputed
435
434
  } = useFormItem({
@@ -475,17 +474,403 @@ const treeSelect = defineFormComponent((props) => {
475
474
  });
476
475
  };
477
476
  });
477
+ function defineFormItem(setup) {
478
+ return /* @__PURE__ */ defineComponent(setup, {
479
+ props: {
480
+ column: Object,
481
+ isView: Boolean
482
+ }
483
+ });
484
+ }
478
485
  const formRenderMap = /* @__PURE__ */ new Map([["input", input], ["textarea", textarea], ["select", select], ["radio", radio], ["date-picker", datePicker], ["range-picker", rangePicker], ["upload", upload], ["cascader", cascader], ["auto-complete", autoComplete], ["checkbox", checkbox], ["input-number", inputNumber], ["mentions", mentions], ["rate", rate], ["slider", slider], ["switch", switchComponent], ["tree-select", treeSelect]]);
479
486
  function registerForm(type, Component) {
480
487
  formRenderMap.set(type, Component);
481
488
  }
482
- const useRules = () => {
483
- const {
484
- columns
485
- } = useFormInject();
489
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
490
+ ...{
491
+ name: "FtAntdFormContent",
492
+ inheritAttrs: false
493
+ },
494
+ __name: "form-content",
495
+ props: {
496
+ columns: {},
497
+ isView: { type: Boolean }
498
+ },
499
+ setup(__props) {
500
+ const props = __props;
501
+ const isView = (column) => {
502
+ return toValue(column.isView) ?? props.isView;
503
+ };
504
+ return (_ctx, _cache) => {
505
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
506
+ return openBlock(), createBlock(resolveDynamicComponent(unref(formRenderMap).get(column.type)), {
507
+ key: unref(getField)(column),
508
+ column,
509
+ "is-view": isView(column)
510
+ }, null, 8, ["column", "is-view"]);
511
+ }), 128);
512
+ };
513
+ }
514
+ });
515
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
516
+ ...{
517
+ name: "FtAntdForm",
518
+ inheritAttrs: false
519
+ },
520
+ __name: "ft-antd-form",
521
+ props: {
522
+ width: {},
523
+ hideFooter: { type: Boolean },
524
+ hideConfirm: { type: Boolean },
525
+ hideReset: { type: Boolean },
526
+ columns: {},
527
+ internalFormProps: {},
528
+ formData: {},
529
+ "onUpdate:formData": { type: Function },
530
+ onSubmit: { type: Function },
531
+ isView: { type: Boolean },
532
+ cache: {}
533
+ },
534
+ setup(__props, { expose: __expose }) {
535
+ const props = __props;
536
+ const { getFormData, visibleColumns, form, resetToDefault, setAsDefault } = useForm(props);
537
+ const { rules } = useRules(props);
538
+ const formRef = ref();
539
+ const formProps = computed(() => {
540
+ return {
541
+ layout: "horizontal",
542
+ model: form.value,
543
+ onFinish: async () => {
544
+ var _a;
545
+ const formData = getFormData();
546
+ (_a = props.onSubmit) == null ? void 0 : _a.call(props, formData);
547
+ },
548
+ labelCol: {
549
+ style: {
550
+ width: "100px"
551
+ }
552
+ },
553
+ rules: rules.value,
554
+ ...props.internalFormProps
555
+ };
556
+ });
557
+ const id = useId();
558
+ __expose({
559
+ formInstance: formRef,
560
+ resetToDefault,
561
+ getFormData,
562
+ setAsDefault
563
+ });
564
+ return (_ctx, _cache) => {
565
+ return openBlock(), createBlock(unref(Form), mergeProps({
566
+ ref_key: "formRef",
567
+ ref: formRef,
568
+ name: unref(id),
569
+ style: { width: _ctx.width }
570
+ }, { ..._ctx.$attrs, ...formProps.value }), {
571
+ default: withCtx(() => [
572
+ createVNode(_sfc_main$4, {
573
+ columns: unref(visibleColumns),
574
+ "is-view": _ctx.isView
575
+ }, null, 8, ["columns", "is-view"]),
576
+ !_ctx.hideFooter ? (openBlock(), createBlock(unref(FormItem), {
577
+ key: 0,
578
+ label: " ",
579
+ colon: false
580
+ }, {
581
+ default: withCtx(() => [
582
+ !_ctx.hideConfirm ? (openBlock(), createBlock(unref(Button), {
583
+ key: 0,
584
+ type: "primary",
585
+ htmlType: "submit"
586
+ }, {
587
+ default: withCtx(() => _cache[1] || (_cache[1] = [
588
+ createTextVNode(" 提交 ")
589
+ ])),
590
+ _: 1
591
+ })) : createCommentVNode("", true),
592
+ !_ctx.hideReset ? (openBlock(), createBlock(unref(Button), {
593
+ key: 1,
594
+ style: { "margin-left": "10px" },
595
+ type: "primary",
596
+ danger: "",
597
+ onClick: _cache[0] || (_cache[0] = () => unref(resetToDefault)())
598
+ }, {
599
+ default: withCtx(() => _cache[2] || (_cache[2] = [
600
+ createTextVNode(" 重置 ")
601
+ ])),
602
+ _: 1
603
+ })) : createCommentVNode("", true)
604
+ ]),
605
+ _: 1
606
+ })) : createCommentVNode("", true)
607
+ ]),
608
+ _: 1
609
+ }, 16, ["name", "style"]);
610
+ };
611
+ }
612
+ });
613
+ const _hoisted_1$2 = { style: { "text-align": "center" } };
614
+ const _hoisted_2$1 = { style: { "display": "flex" } };
615
+ const _hoisted_3 = { style: { "display": "flex", "gap": "10px" } };
616
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
617
+ ...{
618
+ name: "FtAntdFormSearch",
619
+ inheritAttrs: false
620
+ },
621
+ __name: "ft-antd-form-search",
622
+ props: {
623
+ columns: {},
624
+ internalFormProps: {},
625
+ formData: {},
626
+ "onUpdate:formData": { type: Function },
627
+ onSubmit: { type: Function },
628
+ isView: { type: Boolean },
629
+ cache: {}
630
+ },
631
+ setup(__props, { expose: __expose }) {
632
+ const props = __props;
633
+ const {
634
+ visibleColumns,
635
+ form,
636
+ resetToDefault,
637
+ getFormData,
638
+ columnsSort,
639
+ columnsChecked,
640
+ resetColumnsChecked,
641
+ resetColumnsSort,
642
+ setAsDefault
643
+ } = useForm(props);
644
+ const { rules } = useRules(props);
645
+ const formRef = ref();
646
+ const formProps = computed(() => {
647
+ return {
648
+ layout: "inline",
649
+ labelCol: {
650
+ style: {
651
+ width: "100px"
652
+ }
653
+ },
654
+ wrapperCol: {
655
+ style: {
656
+ // 这样定义宽度,可以方便后续修改
657
+ width: `var(--ft-form-control-width, 200px)`
658
+ }
659
+ },
660
+ ...props.internalFormProps,
661
+ model: form.value,
662
+ onFinish: async () => {
663
+ var _a;
664
+ const formData = getFormData();
665
+ (_a = props.onSubmit) == null ? void 0 : _a.call(props, formData);
666
+ },
667
+ rules: rules.value
668
+ };
669
+ });
670
+ const settingModal = ref(false);
671
+ let oldSortList = [];
672
+ const createColumnsTree = () => {
673
+ var _a;
674
+ const treeData = [{ title: "全选", key: "__all", children: [] }];
675
+ const children = [];
676
+ for (const column of props.columns) {
677
+ const key = column.field || ((_a = column.fields) == null ? void 0 : _a[0]);
678
+ children.push({
679
+ title: column.title,
680
+ key,
681
+ isLeaf: true
682
+ });
683
+ }
684
+ children.sort((a, b) => {
685
+ const aSort = columnsSort.value[a.key];
686
+ const bSort = columnsSort.value[b.key];
687
+ return aSort - bSort;
688
+ });
689
+ oldSortList = [...children];
690
+ treeData[0].children = children;
691
+ return { treeData };
692
+ };
693
+ const columnsTree = ref([]);
694
+ const columnsCheckedTree = ref([]);
695
+ const setting = () => {
696
+ const { treeData } = createColumnsTree();
697
+ columnsTree.value = treeData;
698
+ columnsCheckedTree.value = JSON.parse(JSON.stringify(columnsChecked.value));
699
+ settingModal.value = true;
700
+ };
701
+ const onSettingOk = () => {
702
+ settingModal.value = false;
703
+ columnsChecked.value = columnsCheckedTree.value;
704
+ const list = columnsTree.value[0].children;
705
+ const oldColumnsSort = {
706
+ ...columnsSort.value
707
+ };
708
+ const newColumnsSort = {};
709
+ list.forEach((e, idx) => {
710
+ const oldNode = oldSortList[idx];
711
+ const oldField = oldNode.key;
712
+ const oldSort = oldColumnsSort[oldField];
713
+ const curField = e.key;
714
+ newColumnsSort[curField] = oldSort;
715
+ });
716
+ columnsSort.value = newColumnsSort;
717
+ };
718
+ const onCancel = () => {
719
+ resetColumnsChecked();
720
+ resetColumnsSort();
721
+ settingModal.value = false;
722
+ };
723
+ const id = useId();
724
+ const allowDrop = ({ dropNode, dropPosition }) => {
725
+ if (dropNode.isLeaf && dropPosition === 1) return true;
726
+ if (dropNode.key === "__all" && dropPosition === 0) return true;
727
+ return false;
728
+ };
729
+ const onDrop = (info) => {
730
+ const dragNode = info.dragNode;
731
+ const position = info.dropPosition;
732
+ const list = columnsTree.value[0].children;
733
+ const fromIndex = list.findIndex((e) => e.key === dragNode.key);
734
+ const toIndex = position > fromIndex ? position - 1 : position;
735
+ list.splice(fromIndex, 1);
736
+ list.splice(toIndex, 0, dragNode);
737
+ };
738
+ __expose({
739
+ formInstance: formRef,
740
+ formData: form,
741
+ resetToDefault,
742
+ getFormData,
743
+ setAsDefault
744
+ });
745
+ return (_ctx, _cache) => {
746
+ return openBlock(), createElementBlock(Fragment, null, [
747
+ createVNode(unref(Modal), {
748
+ open: settingModal.value,
749
+ "onUpdate:open": _cache[1] || (_cache[1] = ($event) => settingModal.value = $event),
750
+ mask: false,
751
+ width: 260,
752
+ maskClosable: false,
753
+ destroyOnClose: ""
754
+ }, {
755
+ title: withCtx(() => _cache[3] || (_cache[3] = [
756
+ createElementVNode("span", null, [
757
+ createTextVNode(" 配置筛选项 "),
758
+ createElementVNode("span", { style: { "font-size": "12px", "color": "gray" } }, " (可拖动排序) ")
759
+ ], -1)
760
+ ])),
761
+ footer: withCtx(() => [
762
+ createElementVNode("div", _hoisted_1$2, [
763
+ createVNode(unref(Button), {
764
+ type: "primary",
765
+ danger: "",
766
+ onClick: onCancel
767
+ }, {
768
+ default: withCtx(() => _cache[4] || (_cache[4] = [
769
+ createTextVNode(" 重置 ")
770
+ ])),
771
+ _: 1
772
+ }),
773
+ createVNode(unref(Button), {
774
+ type: "primary",
775
+ onClick: onSettingOk
776
+ }, {
777
+ default: withCtx(() => _cache[5] || (_cache[5] = [
778
+ createTextVNode(" 保存 ")
779
+ ])),
780
+ _: 1
781
+ })
782
+ ])
783
+ ]),
784
+ default: withCtx(() => [
785
+ createVNode(unref(Tree), {
786
+ treeData: columnsTree.value,
787
+ checkedKeys: columnsCheckedTree.value,
788
+ "onUpdate:checkedKeys": _cache[0] || (_cache[0] = ($event) => columnsCheckedTree.value = $event),
789
+ checkable: "",
790
+ selectable: false,
791
+ draggable: "",
792
+ blockNode: "",
793
+ expandedKeys: ["__all"],
794
+ virtual: false,
795
+ allowDrop,
796
+ onDrop
797
+ }, {
798
+ title: withCtx((node) => [
799
+ createElementVNode("div", _hoisted_2$1, [
800
+ createElementVNode("span", null, toDisplayString(node.title), 1),
801
+ node.key !== "__all" ? (openBlock(), createBlock(unref(SwapOutlined), {
802
+ key: 0,
803
+ rotate: 90,
804
+ style: { "margin-left": "auto", "color": "gray" }
805
+ })) : createCommentVNode("", true)
806
+ ])
807
+ ]),
808
+ _: 1
809
+ }, 8, ["treeData", "checkedKeys"])
810
+ ]),
811
+ _: 1
812
+ }, 8, ["open"]),
813
+ createVNode(unref(Form), mergeProps({
814
+ ref_key: "formRef",
815
+ ref: formRef,
816
+ name: unref(id),
817
+ style: { "gap": "10px" }
818
+ }, { ..._ctx.$attrs, ...formProps.value }), {
819
+ default: withCtx(() => [
820
+ createVNode(_sfc_main$4, {
821
+ columns: unref(visibleColumns),
822
+ "is-view": _ctx.isView
823
+ }, null, 8, ["columns", "is-view"]),
824
+ createVNode(unref(FormItem), { style: { "--ft-form-control-width": "220px" } }, {
825
+ default: withCtx(() => [
826
+ createElementVNode("div", _hoisted_3, [
827
+ _ctx.cache ? (openBlock(), createBlock(unref(Button), {
828
+ key: 0,
829
+ onClick: setting
830
+ }, {
831
+ icon: withCtx(() => [
832
+ createVNode(unref(SettingOutlined))
833
+ ]),
834
+ default: withCtx(() => [
835
+ _cache[6] || (_cache[6] = createTextVNode(" 配置 "))
836
+ ]),
837
+ _: 1
838
+ })) : createCommentVNode("", true),
839
+ createVNode(unref(Button), {
840
+ type: "primary",
841
+ htmlType: "submit"
842
+ }, {
843
+ default: withCtx(() => _cache[7] || (_cache[7] = [
844
+ createTextVNode(" 查询 ")
845
+ ])),
846
+ _: 1
847
+ }),
848
+ createVNode(unref(Button), {
849
+ type: "primary",
850
+ danger: "",
851
+ htmlType: "reset",
852
+ onClick: _cache[2] || (_cache[2] = () => unref(resetToDefault)())
853
+ }, {
854
+ default: withCtx(() => _cache[8] || (_cache[8] = [
855
+ createTextVNode(" 重置 ")
856
+ ])),
857
+ _: 1
858
+ })
859
+ ])
860
+ ]),
861
+ _: 1
862
+ })
863
+ ]),
864
+ _: 1
865
+ }, 16, ["name"])
866
+ ], 64);
867
+ };
868
+ }
869
+ });
870
+ const useRules = (props) => {
486
871
  const rules = computed(() => {
487
872
  const rulesObj = {};
488
- for (const column of columns.value) {
873
+ for (const column of props.columns) {
489
874
  if (column.rules) {
490
875
  const field = getField(column);
491
876
  set(rulesObj, field, toValue(column.rules));
@@ -497,300 +882,6 @@ const useRules = () => {
497
882
  rules
498
883
  };
499
884
  };
500
- const useExposed = (formRef) => {
501
- const {
502
- "onUpdate:exposed": onUpdateExposed,
503
- resetToDefault,
504
- getFormData,
505
- setAsDefault
506
- } = useFormInject();
507
- watchEffect(() => {
508
- onUpdateExposed == null ? void 0 : onUpdateExposed({
509
- getFormData,
510
- resetToDefault,
511
- setAsDefault,
512
- formInstance: formRef.value
513
- });
514
- });
515
- };
516
- const FtForm = /* @__PURE__ */ defineFtForm((_, ctx) => {
517
- const {
518
- form,
519
- width,
520
- internalFormProps: _formProps,
521
- hideFooter,
522
- hideConfirm,
523
- hideReset,
524
- onSubmit,
525
- getFormData,
526
- resetToDefault
527
- } = useFormInject();
528
- const {
529
- rules
530
- } = useRules();
531
- const formRef = ref();
532
- useExposed(formRef);
533
- const formProps = computed(() => {
534
- return {
535
- layout: "horizontal",
536
- model: form.value,
537
- onFinish: async () => {
538
- await (onSubmit == null ? void 0 : onSubmit(getFormData()));
539
- },
540
- labelCol: {
541
- style: {
542
- width: "100px"
543
- }
544
- },
545
- rules: rules.value,
546
- ..._formProps.value
547
- };
548
- });
549
- const id = useId();
550
- return () => createVNode(Form, mergeProps({
551
- "ref": formRef,
552
- "name": id,
553
- "style": {
554
- width: width.value
555
- }
556
- }, ctx.attrs, formProps.value), {
557
- default: () => [ctx.slots.formContent(), !hideFooter.value && createVNode(FormItem, {
558
- "label": " ",
559
- "colon": false
560
- }, {
561
- default: () => [!hideConfirm.value && createVNode(Button, {
562
- "type": "primary",
563
- "htmlType": "submit"
564
- }, {
565
- default: () => [createTextVNode("提交")]
566
- }), !hideReset.value && createVNode(Button, {
567
- "style": "margin-left: 10px;",
568
- "type": "primary",
569
- "danger": true,
570
- "onClick": () => resetToDefault()
571
- }, {
572
- default: () => [createTextVNode("重置")]
573
- })]
574
- })]
575
- });
576
- }, formRenderMap, ["exposed", "onUpdate:exposed", ["width", {
577
- type: String,
578
- default: "500px"
579
- }], ["hideFooter", {
580
- type: Boolean
581
- }], ["hideConfirm", {
582
- type: Boolean
583
- }], ["hideReset", {
584
- type: Boolean
585
- }]]);
586
- const FtFormSearch = /* @__PURE__ */ defineFtForm((_, ctx) => {
587
- const {
588
- form,
589
- columnsChecked,
590
- columnsSort,
591
- columns,
592
- cache,
593
- internalFormProps: _formProps,
594
- onSubmit,
595
- getFormData,
596
- resetToDefault,
597
- resetColumnsChecked,
598
- resetColumnsSort
599
- } = useFormInject();
600
- const {
601
- rules
602
- } = useRules();
603
- const formRef = ref();
604
- useExposed(formRef);
605
- const formProps = computed(() => {
606
- return {
607
- layout: "inline",
608
- labelCol: {
609
- style: {
610
- width: "100px"
611
- }
612
- },
613
- wrapperCol: {
614
- style: {
615
- // 这样定义宽度,可以方便后续修改
616
- width: `var(--ft-form-control-width, 200px)`
617
- }
618
- },
619
- ..._formProps.value,
620
- model: form.value,
621
- onFinish: async () => {
622
- await (onSubmit == null ? void 0 : onSubmit(getFormData()));
623
- },
624
- rules: rules.value
625
- };
626
- });
627
- const settingModal = ref(false);
628
- let oldSortList = [];
629
- const createColumnsTree = () => {
630
- var _a;
631
- const treeData = [{
632
- title: "全选",
633
- key: "__all",
634
- children: []
635
- }];
636
- const children = [];
637
- for (const column of columns.value) {
638
- const key = column.field || ((_a = column.fields) == null ? void 0 : _a[0]);
639
- children.push({
640
- title: column.title,
641
- key,
642
- isLeaf: true
643
- });
644
- }
645
- children.sort((a, b) => {
646
- const aSort = columnsSort.value[a.key];
647
- const bSort = columnsSort.value[b.key];
648
- return aSort - bSort;
649
- });
650
- oldSortList = [...children];
651
- treeData[0].children = children;
652
- return {
653
- treeData
654
- };
655
- };
656
- const columnsTree = ref([]);
657
- const columnsCheckedTree = ref([]);
658
- const setting = () => {
659
- const {
660
- treeData
661
- } = createColumnsTree();
662
- columnsTree.value = treeData;
663
- columnsCheckedTree.value = JSON.parse(JSON.stringify(columnsChecked.value));
664
- settingModal.value = true;
665
- };
666
- const onSettingOk = () => {
667
- settingModal.value = false;
668
- columnsChecked.value = columnsCheckedTree.value;
669
- const list = columnsTree.value[0].children;
670
- const oldColumnsSort = {
671
- ...columnsSort.value
672
- };
673
- const newColumnsSort = {};
674
- list.forEach((e, idx) => {
675
- const oldNode = oldSortList[idx];
676
- const oldField = oldNode.key;
677
- const oldSort = oldColumnsSort[oldField];
678
- const curField = e.key;
679
- newColumnsSort[curField] = oldSort;
680
- });
681
- columnsSort.value = newColumnsSort;
682
- };
683
- const onCancel = () => {
684
- resetColumnsChecked();
685
- resetColumnsSort();
686
- settingModal.value = false;
687
- };
688
- const id = useId();
689
- return () => createVNode(Fragment, null, [createVNode(Modal, {
690
- "open": settingModal.value,
691
- "onUpdate:open": ($event) => settingModal.value = $event,
692
- "mask": false,
693
- "width": 260,
694
- "maskClosable": false,
695
- "destroyOnClose": true
696
- }, {
697
- title: () => createVNode("span", null, [createTextVNode("配置筛选项"), createVNode("span", {
698
- "style": {
699
- fontSize: "12px",
700
- color: "gray"
701
- }
702
- }, [createTextVNode("(可拖动排序)")])]),
703
- footer: () => {
704
- return createVNode("div", {
705
- "style": "text-align: center;"
706
- }, [createVNode(Button, {
707
- "type": "primary",
708
- "danger": true,
709
- "onClick": onCancel
710
- }, {
711
- default: () => [createTextVNode("重置")]
712
- }), createVNode(Button, {
713
- "type": "primary",
714
- "onClick": onSettingOk
715
- }, {
716
- default: () => [createTextVNode("保存")]
717
- })]);
718
- },
719
- default: () => createVNode(Tree, {
720
- "treeData": columnsTree.value,
721
- "checkedKeys": columnsCheckedTree.value,
722
- "onUpdate:checkedKeys": ($event) => columnsCheckedTree.value = $event,
723
- "checkable": true,
724
- "selectable": false,
725
- "draggable": true,
726
- "blockNode": true,
727
- "expandedKeys": ["__all"],
728
- "virtual": false,
729
- "allowDrop": ({
730
- dropNode,
731
- dropPosition
732
- }) => {
733
- if (dropNode.isLeaf && dropPosition === 1) return true;
734
- if (dropNode.key === "__all" && dropPosition === 0) return true;
735
- return false;
736
- },
737
- "onDrop": (info) => {
738
- const dragNode = info.dragNode;
739
- const position = info.dropPosition;
740
- const list = columnsTree.value[0].children;
741
- const fromIndex = list.findIndex((e) => e.key === dragNode.key);
742
- const toIndex = position > fromIndex ? position - 1 : position;
743
- list.splice(fromIndex, 1);
744
- list.splice(toIndex, 0, dragNode);
745
- }
746
- }, {
747
- title: (node) => createVNode("div", {
748
- "style": {
749
- display: "flex"
750
- }
751
- }, [createVNode("span", null, [node.title]), node.key !== "__all" && createVNode(SwapOutlined, {
752
- "rotate": 90,
753
- "style": {
754
- marginLeft: "auto",
755
- color: "gray"
756
- }
757
- }, null)])
758
- })
759
- }), createVNode(Form, mergeProps({
760
- "name": id,
761
- "style": {
762
- gap: "10px 0"
763
- },
764
- "ref": formRef
765
- }, ctx.attrs, formProps.value), {
766
- default: () => [ctx.slots.formContent(), createVNode(FormItem, {
767
- "style": {
768
- "--ft-form-control-width": "220px"
769
- }
770
- }, {
771
- default: () => [createVNode("div", {
772
- "style": "display: flex; gap: 10px;"
773
- }, [cache.value && createVNode(Button, {
774
- "icon": createVNode(SettingOutlined, null, null),
775
- "onClick": setting
776
- }, {
777
- default: () => [createTextVNode("配置")]
778
- }), createVNode(Button, {
779
- "type": "primary",
780
- "htmlType": "submit"
781
- }, {
782
- default: () => [createTextVNode("查询")]
783
- }), createVNode(Button, {
784
- "type": "primary",
785
- "danger": true,
786
- "htmlType": "reset",
787
- "onClick": () => resetToDefault()
788
- }, {
789
- default: () => [createTextVNode("重置")]
790
- })])]
791
- })]
792
- })]);
793
- }, formRenderMap, ["exposed", "onUpdate:exposed"]);
794
885
  function isComponentTuple(value) {
795
886
  return Array.isArray(value);
796
887
  }
@@ -810,288 +901,59 @@ const editMap = /* @__PURE__ */ new Map([
810
901
  const registerEdit = (type, component) => {
811
902
  editMap.set(type, component);
812
903
  };
813
- const FtTable = defineFtTable((_p, ctx) => {
814
- const {
815
- formColumns,
816
- tableColumns,
817
- internalTableProps,
818
- internalFormProps,
819
- tableData,
820
- loading,
821
- total,
822
- keyField,
823
- defaultPageSize,
824
- cache,
825
- initSearch,
826
- fitFlexHeight,
827
- minHeight,
828
- hidePagination,
829
- onSearch,
830
- onChange,
831
- onExpand,
832
- onExpandedRowsChange,
833
- onResizeColumn,
834
- "onUpdate:exposed": onUpdateExposed
835
- } = useTableInject();
836
- const formExposed = ref();
837
- const handleSearch = async (pagination) => {
838
- var _a;
839
- if (!onSearch) return;
840
- const formData = (_a = formExposed.value) == null ? void 0 : _a.getFormData();
841
- if (!pagination && !hidePagination.value) {
842
- pagination = {
843
- page: 1,
844
- pageSize: defaultPageSize.value
845
- };
846
- }
847
- onSearch(formData, {
848
- pagination
849
- });
850
- };
851
- onMounted(() => {
852
- if (initSearch.value ?? true) {
853
- handleSearch();
854
- }
855
- });
856
- const columns = computed(() => {
857
- return tableColumns.value.map((column) => {
858
- return {
859
- width: 120,
860
- align: "center",
861
- ...column,
862
- dataIndex: column.field
863
- };
864
- });
865
- });
866
- const currentPage = ref(1);
867
- const props = computed(() => {
868
- return {
869
- bordered: true,
870
- pagination: hidePagination.value ? false : {
871
- total: total.value,
872
- defaultPageSize: defaultPageSize.value,
873
- current: currentPage.value,
874
- onChange: (page, pageSize) => {
875
- currentPage.value = page;
876
- handleSearch({
877
- page,
878
- pageSize
879
- });
880
- }
881
- },
882
- tableLayout: "fixed",
883
- rowKey: keyField.value ?? "id",
884
- ...internalTableProps.value
885
- };
886
- });
887
- const _scrollY = ref(0);
888
- const scrollY = computed(() => {
889
- if (!tableData.value || tableData.value.length === 0) return;
890
- return _scrollY.value;
891
- });
892
- const scroll = computed(() => {
893
- return {
894
- scrollToFirstRowOnChange: true,
895
- x: "100%",
896
- y: scrollY.value
897
- };
898
- });
899
- let containerStyle = {
900
- display: "flex",
901
- flexDirection: "column",
902
- gap: "10px"
903
- };
904
- let tableStyle;
905
- const containerRef = ref();
906
- const tableRef = ref();
907
- const calcTableHeight = () => {
908
- const container = containerRef.value;
909
- const table = container == null ? void 0 : container.querySelector(".ant-table-wrapper");
910
- if (!table) return;
911
- const header = container.querySelector(".ant-table-thead");
912
- const footer = container.querySelector(".ant-table-footer");
913
- if (!table) return;
914
- let y = table.clientHeight - // pagination不是立即渲染的,其高度为64
915
- // 多减去2px,避免出现小数
916
- 64 - 2 - ((header == null ? void 0 : header.clientHeight) ?? 0) - ((footer == null ? void 0 : footer.clientHeight) ?? 0);
917
- const minHeightValue = minHeight.value;
918
- if (y < minHeightValue) y = minHeightValue;
919
- _scrollY.value = y;
920
- };
921
- if (fitFlexHeight.value ?? true) {
922
- containerStyle = {
923
- ...containerStyle,
924
- flex: "1",
925
- minHeight: 0
926
- };
927
- tableStyle = {
928
- flex: "1",
929
- minHeight: 0
930
- };
931
- let resizeObserver;
932
- let prevHeight;
933
- let timer;
934
- onMounted(() => {
935
- var _a;
936
- resizeObserver = new ResizeObserver((entries) => {
937
- const height = entries[0].contentRect.height;
938
- if (prevHeight === height) return;
939
- prevHeight = height;
940
- if (timer) {
941
- clearTimeout(timer);
942
- }
943
- timer = setTimeout(() => {
944
- calcTableHeight();
945
- }, 100);
946
- });
947
- resizeObserver.observe((_a = tableRef.value) == null ? void 0 : _a.$el);
948
- });
949
- onUnmounted(() => {
950
- resizeObserver.disconnect();
951
- });
952
- }
953
- const {
954
- createBodyCell,
955
- setEditRow,
956
- cancelEditRow,
957
- saveEditRow,
958
- editRowMap
959
- } = useEdit(tableData);
960
- const scrollToIndex = (index) => {
961
- var _a;
962
- const row = (_a = containerRef.value) == null ? void 0 : _a.querySelectorAll(".ant-table-row")[index];
963
- if (!row) return;
964
- row.scrollIntoView({
965
- behavior: "smooth",
966
- block: "nearest",
967
- inline: "start"
968
- });
969
- };
970
- const scrollToRow = (row) => {
971
- const index = tableData.value.indexOf(row);
972
- scrollToIndex(index);
973
- };
974
- watchEffect(() => {
975
- onUpdateExposed == null ? void 0 : onUpdateExposed({
976
- refresh: async () => {
977
- var _a;
978
- await ((_a = formExposed.value) == null ? void 0 : _a.resetToDefault());
979
- handleSearch();
980
- },
981
- formExposed: formExposed.value,
982
- editRowMap,
983
- setEditRow: (row) => {
984
- setEditRow(row);
985
- nextTick().then(() => {
986
- scrollToRow(row);
987
- });
988
- },
989
- cancelEditRow,
990
- saveEditRow,
991
- scrollToIndex,
992
- scrollToRow
993
- });
994
- });
995
- return () => {
996
- var _a, _b, _c, _d;
997
- return createVNode("div", {
998
- "ref": containerRef,
999
- "style": containerStyle
1000
- }, [formColumns.value.length > 0 && createVNode(Fragment, null, [createVNode(FtFormSearch, mergeProps({
1001
- "exposed": formExposed.value,
1002
- "onUpdate:exposed": ($event) => formExposed.value = $event,
1003
- "cache": cache.value,
1004
- "columns": formColumns.value,
1005
- "onSubmit": () => handleSearch()
1006
- }, internalFormProps.value), null), createVNode(Divider, {
1007
- "dashed": true,
1008
- "style": "margin: 0"
1009
- }, null)]), (ctx.slots.buttons || ctx.slots.tools) && createVNode("div", null, [(_b = (_a = ctx.slots).buttons) == null ? void 0 : _b.call(_a), (_d = (_c = ctx.slots).tools) == null ? void 0 : _d.call(_c)]), createVNode(Table, mergeProps({
1010
- "ref": tableRef,
1011
- "style": tableStyle,
1012
- "columns": columns.value,
1013
- "loading": loading.value,
1014
- "dataSource": tableData.value,
1015
- "scroll": scroll.value
1016
- }, ctx.attrs, props.value, {
1017
- "onChange": onChange,
1018
- "onExpand": onExpand,
1019
- "onExpandedRowsChange": onExpandedRowsChange,
1020
- "onResizeColumn": onResizeColumn
1021
- }), {
1022
- ...ctx.slots,
1023
- bodyCell: createBodyCell(ctx.slots.bodyCell)
1024
- })]);
1025
- };
1026
- }, ["onChange", "onExpand", "onExpandedRowsChange", "onResizeColumn", "onSearch", ["initSearch", {
1027
- type: Boolean,
1028
- default: true
1029
- }], "fitFlexHeight", ["minHeight", {
1030
- type: Number,
1031
- default: 210
1032
- }], ["hidePagination", {
1033
- type: Boolean
1034
- }], "exposed", "onUpdate:exposed"]);
1035
- function useEdit(tableData) {
904
+ function useEdit(props) {
1036
905
  const editRowMap = reactive(/* @__PURE__ */ new Map());
1037
- const createBodyCell = (bodyCellDefault) => {
1038
- if (editRowMap.size === 0) return bodyCellDefault;
1039
- return (scopeProps) => {
1040
- const column = scopeProps.column;
1041
- if (column.customRender) {
1042
- return column.customRender({
1043
- ...scopeProps,
1044
- record: scopeProps.record,
1045
- // todo:: 这个是啥?
1046
- renderIndex: -1
1047
- });
906
+ const EditBodyCell = (scopeProps) => {
907
+ const column = scopeProps.column;
908
+ if (column.customRender) {
909
+ return column.customRender({
910
+ ...scopeProps,
911
+ // todo:: 这个是啥?
912
+ renderIndex: -1
913
+ });
914
+ }
915
+ if (column.edit && editRowMap.has(scopeProps.record)) {
916
+ let edit;
917
+ if (typeof column.edit === "string") {
918
+ edit = {
919
+ type: column.edit
920
+ };
921
+ } else {
922
+ edit = column.edit;
1048
923
  }
1049
- if (column.edit && editRowMap.has(scopeProps.record)) {
1050
- let edit;
1051
- if (typeof column.edit === "string") {
1052
- edit = {
1053
- type: column.edit
1054
- };
924
+ const field = edit.field ?? column.field;
925
+ const componentOrTuple = editMap.get(edit.type);
926
+ if (componentOrTuple) {
927
+ let component;
928
+ let model = "value";
929
+ if (isComponentTuple(componentOrTuple)) {
930
+ component = componentOrTuple[0];
931
+ const info = componentOrTuple[1];
932
+ if (info.model) {
933
+ model = info.model;
934
+ }
1055
935
  } else {
1056
- edit = column.edit;
936
+ component = componentOrTuple;
937
+ }
938
+ const { valueGetter, valueSetter } = edit;
939
+ let value = get(scopeProps.record, field);
940
+ if (valueGetter) {
941
+ value = valueGetter(value);
1057
942
  }
1058
- const field = edit.field ?? column.field;
1059
- const componentOrTuple = editMap.get(edit.type);
1060
- if (componentOrTuple) {
1061
- let component;
1062
- let model = "value";
1063
- if (isComponentTuple(componentOrTuple)) {
1064
- component = componentOrTuple[0];
1065
- const info = componentOrTuple[1];
1066
- if (info.model) {
1067
- model = info.model;
943
+ const props2 = {
944
+ ...unrefs(edit.props),
945
+ class: "ft-table-edit",
946
+ [model]: value,
947
+ [`onUpdate:${model}`]: (value2) => {
948
+ if (valueSetter) {
949
+ value2 = valueSetter(value2);
1068
950
  }
1069
- } else {
1070
- component = componentOrTuple;
1071
- }
1072
- const {
1073
- valueGetter,
1074
- valueSetter
1075
- } = edit;
1076
- let value = get(scopeProps.record, field);
1077
- if (valueGetter) {
1078
- value = valueGetter(value);
951
+ set(scopeProps.record, field, value2);
1079
952
  }
1080
- const props = {
1081
- ...unrefs(edit.props),
1082
- class: "ft-table-edit",
1083
- [model]: value,
1084
- [`onUpdate:${model}`]: (value2) => {
1085
- if (valueSetter) {
1086
- value2 = valueSetter(value2);
1087
- }
1088
- set(scopeProps.record, field, value2);
1089
- }
1090
- };
1091
- return h(component, props);
1092
- }
953
+ };
954
+ return h(component, props2);
1093
955
  }
1094
- };
956
+ }
1095
957
  };
1096
958
  const setEditRow = (row) => {
1097
959
  const oldRow = cloneDeep(row);
@@ -1100,8 +962,8 @@ function useEdit(tableData) {
1100
962
  const cancelEditRow = (row) => {
1101
963
  const oldRow = editRowMap.get(row);
1102
964
  if (!oldRow) return;
1103
- const index = tableData.value.indexOf(row);
1104
- tableData.value[index] = oldRow;
965
+ const index = props.tableData.indexOf(row);
966
+ props.tableData[index] = oldRow;
1105
967
  delEditRow(row);
1106
968
  };
1107
969
  const saveEditRow = (row) => {
@@ -1110,272 +972,606 @@ function useEdit(tableData) {
1110
972
  const delEditRow = (row) => {
1111
973
  editRowMap.delete(row);
1112
974
  };
1113
- watch(tableData, (v) => {
1114
- editRowMap.forEach((_val, key) => {
1115
- if (!(v == null ? void 0 : v.includes(key))) {
1116
- editRowMap.delete(key);
1117
- }
1118
- });
1119
- });
975
+ watch(
976
+ () => props.tableData,
977
+ (v) => {
978
+ editRowMap.forEach((_val, key) => {
979
+ if (!(v == null ? void 0 : v.includes(key))) {
980
+ editRowMap.delete(key);
981
+ }
982
+ });
983
+ }
984
+ );
1120
985
  return {
1121
986
  editRowMap,
1122
987
  setEditRow,
1123
- createBodyCell,
988
+ EditBodyCell,
1124
989
  cancelEditRow,
1125
990
  saveEditRow
1126
991
  };
1127
992
  }
1128
- const FtVxeTable = defineFtTable((_, ctx) => {
1129
- const {
1130
- formColumns,
1131
- tableColumns,
1132
- internalTableProps: _internalTableProps,
1133
- internalFormProps,
1134
- tableData,
1135
- loading,
1136
- total,
1137
- keyField,
1138
- defaultPageSize,
1139
- cache,
1140
- initSearch,
1141
- fitFlexHeight,
1142
- minHeight,
1143
- hidePagination,
1144
- onSearch,
1145
- "onUpdate:exposed": onUpdateExposed
1146
- } = useTableInject();
1147
- const formExposed = ref();
1148
- const tableExposed = ref();
1149
- const handleSearch = async (pagination) => {
1150
- var _a;
1151
- if (!onSearch) return;
1152
- const formData = (_a = formExposed.value) == null ? void 0 : _a.getFormData();
1153
- if (!pagination && !hidePagination.value) {
1154
- pagination = {
1155
- page: 1,
1156
- pageSize: defaultPageSize.value
1157
- };
1158
- }
1159
- await onSearch(formData, {
1160
- pagination
1161
- });
1162
- };
1163
- onMounted(() => {
1164
- if (initSearch.value) {
1165
- handleSearch();
1166
- }
1167
- });
1168
- const enableEdit = computed(() => {
1169
- return tableColumns.value.some((column) => {
993
+ const _hoisted_1$1 = {
994
+ key: 1
995
+ };
996
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
997
+ ...{
998
+ name: "FtAntdTable",
999
+ inheritAttrs: false
1000
+ },
1001
+ __name: "ft-antd-table",
1002
+ props: {
1003
+ initSearch: {
1004
+ type: Boolean,
1005
+ default: true
1006
+ },
1007
+ fitFlexHeight: {
1008
+ type: Boolean,
1009
+ default: true
1010
+ },
1011
+ minHeight: {
1012
+ default: 210
1013
+ },
1014
+ hidePagination: {
1015
+ type: Boolean
1016
+ },
1017
+ internalTableProps: {},
1018
+ internalFormProps: {},
1019
+ onChange: {},
1020
+ onExpand: {},
1021
+ onExpandedRowsChange: {},
1022
+ onResizeColumn: {},
1023
+ onSearch: {},
1024
+ cache: {},
1025
+ columns: {},
1026
+ searchColumns: {},
1027
+ total: {},
1028
+ defaultPageSize: {},
1029
+ loading: {
1030
+ type: Boolean
1031
+ },
1032
+ tableData: {},
1033
+ "onUpdate:tableData": {},
1034
+ keyField: {}
1035
+ },
1036
+ setup(__props, {
1037
+ expose: __expose
1038
+ }) {
1039
+ const props = __props;
1040
+ const {
1041
+ formColumns
1042
+ } = useTable(props);
1043
+ onMounted(() => {
1170
1044
  var _a;
1171
- return column.edit || ((_a = column.slots) == null ? void 0 : _a.edit);
1045
+ if (props.initSearch ?? true) {
1046
+ (_a = props.onSearch) == null ? void 0 : _a.call(props);
1047
+ }
1172
1048
  });
1173
- });
1174
- const columns = computed(() => {
1175
- return tableColumns.value.map((column) => {
1176
- var _a;
1177
- let editObj = column.edit;
1178
- if (typeof editObj === "string") {
1179
- editObj = {
1180
- type: editObj,
1181
- props: {}
1049
+ const columns = computed(() => {
1050
+ return props.columns.map((column) => {
1051
+ return {
1052
+ width: 120,
1053
+ align: "center",
1054
+ ...column,
1055
+ dataIndex: column.field
1182
1056
  };
1183
- }
1184
- const slots = {
1185
- edit: editObj ? (params) => {
1186
- const {
1187
- row
1188
- } = params;
1189
- const type = editObj.type;
1190
- const field = editObj.field ?? column.field;
1191
- const componentOrTuple = editMap.get(type);
1192
- if (!componentOrTuple) {
1193
- console.warn(`[@ftjs/antd] 不支持的编辑类型: ${type}`);
1194
- return "";
1195
- }
1196
- let component;
1197
- let model = "value";
1198
- if (isComponentTuple(componentOrTuple)) {
1199
- component = componentOrTuple[0];
1200
- const info = componentOrTuple[1];
1201
- if (info.model) {
1202
- model = info.model;
1203
- }
1204
- } else {
1205
- component = componentOrTuple;
1206
- }
1207
- const modelEvent = `onUpdate:${model}`;
1208
- const {
1209
- valueGetter,
1210
- valueSetter
1211
- } = editObj ?? {};
1212
- let value = get(row, field);
1213
- if (valueGetter) {
1214
- value = valueGetter(value);
1057
+ });
1058
+ });
1059
+ const currentPage = ref(1);
1060
+ const tableProps = computed(() => {
1061
+ return {
1062
+ bordered: true,
1063
+ pagination: props.hidePagination ? false : {
1064
+ total: props.total,
1065
+ defaultPageSize: props.defaultPageSize,
1066
+ current: currentPage.value,
1067
+ onChange: () => {
1068
+ var _a;
1069
+ (_a = props.onSearch) == null ? void 0 : _a.call(props);
1215
1070
  }
1216
- const props = {
1217
- ...unrefs(editObj.props),
1218
- [model]: value,
1219
- [modelEvent]: (value2) => {
1220
- if (valueSetter) {
1221
- value2 = valueSetter(value2);
1222
- }
1223
- set(row, field, value2);
1224
- }
1225
- };
1226
- return h(component, props);
1227
- } : null,
1228
- ...column.slots
1071
+ },
1072
+ tableLayout: "fixed",
1073
+ rowKey: props.keyField ?? "id",
1074
+ ...props.internalTableProps
1229
1075
  };
1230
- if (slots.edit == null) {
1231
- delete slots.edit;
1232
- }
1076
+ });
1077
+ const _scrollY = ref(0);
1078
+ const scrollY = computed(() => {
1079
+ if (!props.tableData || props.tableData.length === 0) return;
1080
+ return _scrollY.value;
1081
+ });
1082
+ const scroll = computed(() => {
1233
1083
  return {
1234
- minWidth: 120,
1235
- align: "center",
1236
- editRender: editObj || ((_a = column.slots) == null ? void 0 : _a.edit) ? {} : void 0,
1237
- ...column,
1238
- slots
1084
+ scrollToFirstRowOnChange: true,
1085
+ x: "100%",
1086
+ y: scrollY.value
1239
1087
  };
1240
1088
  });
1241
- });
1242
- const internalTableProps = computed(() => {
1089
+ let containerStyle = {
1090
+ display: "flex",
1091
+ flexDirection: "column",
1092
+ gap: "10px"
1093
+ };
1094
+ let tableStyle;
1095
+ const containerRef = ref();
1096
+ const tableRef = ref();
1097
+ const calcTableHeight = () => {
1098
+ const container = containerRef.value;
1099
+ const table = container == null ? void 0 : container.querySelector(".ant-table-wrapper");
1100
+ if (!table) return;
1101
+ const header = container.querySelector(".ant-table-thead");
1102
+ const footer = container.querySelector(".ant-table-footer");
1103
+ if (!table) return;
1104
+ let y = table.clientHeight - // pagination不是立即渲染的,其高度为64
1105
+ // 多减去2px,避免出现小数
1106
+ 64 - 2 - ((header == null ? void 0 : header.clientHeight) ?? 0) - ((footer == null ? void 0 : footer.clientHeight) ?? 0);
1107
+ const minHeightValue = props.minHeight;
1108
+ if (y < minHeightValue) y = minHeightValue;
1109
+ _scrollY.value = y;
1110
+ };
1111
+ if (props.fitFlexHeight) {
1112
+ containerStyle = {
1113
+ ...containerStyle,
1114
+ flex: "1",
1115
+ minHeight: 0
1116
+ };
1117
+ tableStyle = {
1118
+ flex: "1",
1119
+ minHeight: 0
1120
+ };
1121
+ let resizeObserver;
1122
+ let prevHeight;
1123
+ let timer;
1124
+ onMounted(() => {
1125
+ var _a;
1126
+ resizeObserver = new ResizeObserver((entries) => {
1127
+ const height = entries[0].contentRect.height;
1128
+ if (prevHeight === height) return;
1129
+ prevHeight = height;
1130
+ if (timer) {
1131
+ clearTimeout(timer);
1132
+ }
1133
+ timer = setTimeout(() => {
1134
+ calcTableHeight();
1135
+ }, 100);
1136
+ });
1137
+ resizeObserver.observe((_a = tableRef.value) == null ? void 0 : _a.$el);
1138
+ });
1139
+ onUnmounted(() => {
1140
+ resizeObserver.disconnect();
1141
+ });
1142
+ }
1143
+ const scrollToIndex = (index) => {
1144
+ var _a;
1145
+ const row = (_a = containerRef.value) == null ? void 0 : _a.querySelectorAll(".ant-table-row")[index];
1146
+ if (!row) return;
1147
+ row.scrollIntoView({
1148
+ behavior: "smooth",
1149
+ block: "nearest",
1150
+ inline: "start"
1151
+ });
1152
+ };
1153
+ const scrollToRow = (row) => {
1154
+ const index = props.tableData.indexOf(row);
1155
+ scrollToIndex(index);
1156
+ };
1157
+ const formRef = useTemplateRef("form");
1243
1158
  const {
1244
- columnConfig,
1245
- editConfig,
1246
- toolbarConfig,
1247
- customConfig,
1248
- rowConfig
1249
- } = _internalTableProps.value ?? {};
1250
- return {
1251
- ..._internalTableProps.value,
1252
- columnConfig: {
1253
- resizable: true,
1254
- ...columnConfig
1255
- },
1256
- editConfig: enableEdit.value ? {
1257
- mode: "row",
1258
- showStatus: true,
1259
- trigger: "manual",
1260
- autoClear: false,
1261
- autoPos: true,
1262
- ...editConfig
1263
- } : void 0,
1264
- toolbarConfig: {
1265
- custom: true,
1266
- zoom: true,
1267
- ...toolbarConfig
1159
+ editRowMap,
1160
+ setEditRow,
1161
+ cancelEditRow,
1162
+ saveEditRow,
1163
+ EditBodyCell
1164
+ } = useEdit(props);
1165
+ __expose({
1166
+ /**
1167
+ * 表单示例
1168
+ */
1169
+ formRef,
1170
+ /**
1171
+ * 刷新表格
1172
+ */
1173
+ refresh: async () => {
1174
+ var _a, _b;
1175
+ await ((_a = formRef.value) == null ? void 0 : _a.resetToDefault());
1176
+ (_b = props.onSearch) == null ? void 0 : _b.call(props);
1268
1177
  },
1269
- customConfig: {
1270
- storage: true,
1271
- enabled: cache.value != null,
1272
- ...customConfig
1178
+ /**
1179
+ * 设置编辑行
1180
+ */
1181
+ setEditRow: (row) => {
1182
+ setEditRow(row);
1183
+ nextTick().then(() => {
1184
+ scrollToRow(row);
1185
+ });
1273
1186
  },
1274
- rowConfig: {
1275
- keyField: keyField.value,
1276
- ...rowConfig
1277
- }
1278
- };
1279
- });
1280
- let containerStyle = {
1281
- display: "flex",
1282
- flexDirection: "column",
1283
- gap: "10px",
1284
- width: "100%"
1285
- };
1286
- let tableStyle;
1287
- const containerRef = ref();
1288
- let height;
1289
- if (fitFlexHeight.value ?? true) {
1290
- containerStyle = {
1291
- ...containerStyle,
1292
- flex: "1",
1293
- minHeight: 0
1294
- };
1295
- tableStyle = {
1296
- flex: "1",
1297
- minHeight: 0
1187
+ /**
1188
+ * 当前全部编辑行
1189
+ */
1190
+ editRowMap,
1191
+ /**
1192
+ * 取消编辑行
1193
+ */
1194
+ cancelEditRow,
1195
+ /**
1196
+ * 保存编辑行
1197
+ */
1198
+ saveEditRow,
1199
+ /**
1200
+ * 滚动到指定行
1201
+ */
1202
+ scrollToRow,
1203
+ /**
1204
+ * 滚动到指定行索引
1205
+ */
1206
+ scrollToIndex
1207
+ });
1208
+ const definedSlots = ["buttons", "tools", "bodyCell"];
1209
+ return (_ctx, _cache) => {
1210
+ return openBlock(), createElementBlock("div", {
1211
+ ref_key: "containerRef",
1212
+ ref: containerRef,
1213
+ style: normalizeStyle(unref(containerStyle))
1214
+ }, [unref(formColumns).length > 0 ? (openBlock(), createElementBlock(Fragment, {
1215
+ key: 0
1216
+ }, [createVNode(unref(_sfc_main$2), mergeProps({
1217
+ ref: "form",
1218
+ cache: _ctx.cache,
1219
+ columns: unref(formColumns)
1220
+ }, _ctx.internalFormProps, {
1221
+ onSubmit: _ctx.onSearch
1222
+ }), null, 16, ["cache", "columns", "onSubmit"]), createVNode(unref(Divider), {
1223
+ dashed: "",
1224
+ style: {
1225
+ "margin": "0"
1226
+ }
1227
+ })], 64)) : createCommentVNode("", true), _ctx.$slots.buttons || _ctx.$slots.tools ? (openBlock(), createElementBlock("div", _hoisted_1$1, [renderSlot(_ctx.$slots, "buttons"), renderSlot(_ctx.$slots, "tools")])) : createCommentVNode("", true), createVNode(unref(Table), mergeProps({
1228
+ ref_key: "tableRef",
1229
+ ref: tableRef,
1230
+ style: unref(tableStyle),
1231
+ columns: columns.value,
1232
+ loading: _ctx.loading,
1233
+ dataSource: _ctx.tableData,
1234
+ scroll: scroll.value
1235
+ }, {
1236
+ ..._ctx.$attrs,
1237
+ ...tableProps.value
1238
+ }, {
1239
+ onChange: _cache[0] || (_cache[0] = ($event) => ({
1240
+ onChange: _ctx.onChange
1241
+ })),
1242
+ onExpand: _cache[1] || (_cache[1] = ($event) => ({
1243
+ onExpand: _ctx.onExpand
1244
+ })),
1245
+ onExpandedRowsChange: _cache[2] || (_cache[2] = ($event) => ({
1246
+ onExpandedRowsChange: _ctx.onExpandedRowsChange
1247
+ })),
1248
+ onResizeColumn: _cache[3] || (_cache[3] = ($event) => ({
1249
+ onResizeColumn: _ctx.onResizeColumn
1250
+ }))
1251
+ }), createSlots({
1252
+ bodyCell: withCtx((scopedProps) => [unref(editRowMap).size === 0 ? renderSlot(_ctx.$slots, "bodyCell", normalizeProps(mergeProps({
1253
+ key: 0
1254
+ }, scopedProps))) : unref(editRowMap).has(scopedProps.record) ? (openBlock(), createBlock(resolveDynamicComponent(unref(EditBodyCell)), normalizeProps(mergeProps({
1255
+ key: 1
1256
+ }, scopedProps)), null, 16)) : createCommentVNode("", true)]),
1257
+ _: 2
1258
+ }, [renderList(_ctx.$slots, (_, name) => {
1259
+ return {
1260
+ name,
1261
+ fn: withCtx((slotData) => [!definedSlots.includes(name) ? renderSlot(_ctx.$slots, name, normalizeProps(mergeProps({
1262
+ key: 0
1263
+ }, slotData))) : createCommentVNode("", true)])
1264
+ };
1265
+ })]), 1040, ["style", "columns", "loading", "dataSource", "scroll"])], 4);
1298
1266
  };
1299
- height = "100%";
1300
1267
  }
1301
- const current = ref(1);
1302
- async function refresh() {
1303
- await handleSearch();
1268
+ });
1269
+ const _hoisted_1 = {
1270
+ key: 1,
1271
+ style: {
1272
+ "text-align": "right",
1273
+ "padding": "0.5em 0"
1274
+ }
1275
+ };
1276
+ const _hoisted_2 = {
1277
+ key: 1,
1278
+ style: {
1279
+ "height": "100%",
1280
+ "width": "100%",
1281
+ "display": "flex",
1282
+ "justify-content": "center",
1283
+ "align-items": "center"
1304
1284
  }
1305
- watchEffect(() => {
1306
- onUpdateExposed == null ? void 0 : onUpdateExposed({
1307
- refresh,
1308
- formExposed: formExposed.value,
1309
- tableExposed: tableExposed.value
1285
+ };
1286
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1287
+ ...{
1288
+ name: "FtAntdVxeTable",
1289
+ inheritAttrs: false
1290
+ },
1291
+ __name: "ft-vxe-table",
1292
+ props: {
1293
+ initSearch: {
1294
+ type: Boolean,
1295
+ default: true
1296
+ },
1297
+ fitFlexHeight: {
1298
+ type: Boolean,
1299
+ default: true
1300
+ },
1301
+ minHeight: {
1302
+ default: 310
1303
+ },
1304
+ hidePagination: {
1305
+ type: Boolean
1306
+ },
1307
+ internalTableProps: {},
1308
+ internalFormProps: {},
1309
+ onSearch: {},
1310
+ cache: {},
1311
+ columns: {},
1312
+ searchColumns: {},
1313
+ total: {},
1314
+ defaultPageSize: {
1315
+ default: 20
1316
+ },
1317
+ loading: {
1318
+ type: Boolean
1319
+ },
1320
+ tableData: {},
1321
+ "onUpdate:tableData": {},
1322
+ keyField: {}
1323
+ },
1324
+ setup(__props, {
1325
+ expose: __expose
1326
+ }) {
1327
+ const props = __props;
1328
+ const {
1329
+ formColumns
1330
+ } = useTable(props);
1331
+ onMounted(() => {
1332
+ var _a;
1333
+ if (props.initSearch) {
1334
+ (_a = props.onSearch) == null ? void 0 : _a.call(props);
1335
+ }
1310
1336
  });
1311
- });
1312
- return () => createVNode("div", {
1313
- "ref": containerRef,
1314
- "style": containerStyle
1315
- }, [formColumns.value.length > 0 && createVNode(Fragment, null, [createVNode(FtFormSearch, mergeProps({
1316
- "exposed": formExposed.value,
1317
- "onUpdate:exposed": ($event) => formExposed.value = $event,
1318
- "cache": cache.value,
1319
- "columns": formColumns.value,
1320
- "onSubmit": () => handleSearch()
1321
- }, internalFormProps.value), null), createVNode(Divider, {
1322
- "dashed": true,
1323
- "style": "margin: 0"
1324
- }, null)]), createVNode("div", {
1325
- "style": tableStyle
1326
- }, [createVNode(VxeGrid, mergeProps({
1327
- "ref": (ref2) => tableExposed.value = ref2,
1328
- "border": true,
1329
- "showOverflow": true,
1330
- "height": height,
1331
- "columns": columns.value,
1332
- "loading": loading.value,
1333
- "data": tableData.value,
1334
- "minHeight": minHeight.value ?? 310,
1335
- "id": cache.value,
1336
- "keepSource": enableEdit.value
1337
- }, internalTableProps.value), {
1338
- pager() {
1339
- return hidePagination.value ? null : createVNode("div", {
1340
- "style": "text-align: right; padding: .5em 0;"
1341
- }, [createVNode(Pagination, {
1342
- "current": current.value,
1343
- "onUpdate:current": ($event) => current.value = $event,
1344
- "showQuickJumper": true,
1345
- "showSizeChanger": true,
1346
- "showLessItems": true,
1347
- "total": total.value,
1348
- "defaultPageSize": defaultPageSize.value,
1349
- "showTotal": (total2) => {
1350
- if (total2 === 0) return null;
1351
- return `共 ${total2} 条数据`;
1337
+ const enableEdit = computed(() => {
1338
+ return props.columns.some((column) => {
1339
+ var _a;
1340
+ return column.edit || ((_a = column.slots) == null ? void 0 : _a.edit);
1341
+ });
1342
+ });
1343
+ const columns = computed(() => {
1344
+ return props.columns.map((column) => {
1345
+ var _a;
1346
+ let editObj = column.edit;
1347
+ if (typeof editObj === "string") {
1348
+ editObj = {
1349
+ type: editObj,
1350
+ props: {}
1351
+ };
1352
+ }
1353
+ const slots = {
1354
+ edit: editObj ? (params) => {
1355
+ const {
1356
+ row
1357
+ } = params;
1358
+ const type = editObj.type;
1359
+ const field = editObj.field ?? column.field;
1360
+ const componentOrTuple = editMap.get(type);
1361
+ if (!componentOrTuple) {
1362
+ console.warn(`[@ftjs/antd] 不支持的编辑类型: ${type}`);
1363
+ return "";
1364
+ }
1365
+ let component;
1366
+ let model = "value";
1367
+ if (isComponentTuple(componentOrTuple)) {
1368
+ component = componentOrTuple[0];
1369
+ const info = componentOrTuple[1];
1370
+ if (info.model) {
1371
+ model = info.model;
1372
+ }
1373
+ } else {
1374
+ component = componentOrTuple;
1375
+ }
1376
+ const modelEvent = `onUpdate:${model}`;
1377
+ const {
1378
+ valueGetter,
1379
+ valueSetter
1380
+ } = editObj ?? {};
1381
+ let value = get(row, field);
1382
+ if (valueGetter) {
1383
+ value = valueGetter(value);
1384
+ }
1385
+ const props2 = {
1386
+ ...unrefs(editObj.props),
1387
+ [model]: value,
1388
+ [modelEvent]: (value2) => {
1389
+ if (valueSetter) {
1390
+ value2 = valueSetter(value2);
1391
+ }
1392
+ set(row, field, value2);
1393
+ }
1394
+ };
1395
+ return h(component, props2);
1396
+ } : null,
1397
+ ...column.slots
1398
+ };
1399
+ if (slots.edit == null) {
1400
+ delete slots.edit;
1401
+ }
1402
+ return {
1403
+ minWidth: 120,
1404
+ align: "center",
1405
+ editRender: editObj || ((_a = column.slots) == null ? void 0 : _a.edit) ? {} : void 0,
1406
+ ...column,
1407
+ slots
1408
+ };
1409
+ });
1410
+ });
1411
+ const internalTableProps = computed(() => {
1412
+ const {
1413
+ columnConfig,
1414
+ editConfig,
1415
+ toolbarConfig,
1416
+ customConfig,
1417
+ rowConfig
1418
+ } = props.internalTableProps ?? {};
1419
+ return {
1420
+ ...props.internalTableProps,
1421
+ columnConfig: {
1422
+ resizable: true,
1423
+ ...columnConfig
1352
1424
  },
1353
- "onChange": (page, pageSize) => {
1354
- handleSearch({
1355
- page,
1356
- pageSize
1357
- });
1425
+ editConfig: enableEdit.value ? {
1426
+ mode: "row",
1427
+ showStatus: true,
1428
+ trigger: "manual",
1429
+ autoClear: false,
1430
+ autoPos: true,
1431
+ ...editConfig
1432
+ } : void 0,
1433
+ toolbarConfig: {
1434
+ custom: true,
1435
+ zoom: true,
1436
+ ...toolbarConfig
1437
+ },
1438
+ customConfig: {
1439
+ storage: true,
1440
+ enabled: props.cache != null,
1441
+ ...customConfig
1442
+ },
1443
+ rowConfig: {
1444
+ keyField: props.keyField,
1445
+ ...rowConfig
1358
1446
  }
1359
- }, null)]);
1360
- },
1361
- ...ctx.slots,
1362
- loading() {
1363
- return createVNode("div", {
1364
- "style": "height: 100%; width: 100%; display: flex; justify-content: center; align-items: center;"
1365
- }, [createVNode(Spin, null, null)]);
1447
+ };
1448
+ });
1449
+ let containerStyle = {
1450
+ display: "flex",
1451
+ flexDirection: "column",
1452
+ gap: "10px",
1453
+ width: "100%"
1454
+ };
1455
+ let tableStyle;
1456
+ const containerRef = ref();
1457
+ let height;
1458
+ if (props.fitFlexHeight) {
1459
+ containerStyle = {
1460
+ ...containerStyle,
1461
+ flex: "1",
1462
+ minHeight: 0
1463
+ };
1464
+ tableStyle = {
1465
+ flex: "1",
1466
+ minHeight: 0
1467
+ };
1468
+ height = "100%";
1469
+ }
1470
+ const current = ref(1);
1471
+ const pageSize = ref(props.defaultPageSize);
1472
+ async function refresh() {
1473
+ var _a;
1474
+ await ((_a = props.onSearch) == null ? void 0 : _a.call(props));
1366
1475
  }
1367
- })])]);
1368
- }, ["onSearch", ["initSearch", {
1369
- type: Boolean,
1370
- default: true
1371
- }], "fitFlexHeight", "minHeight", ["hidePagination", {
1372
- type: Boolean
1373
- }], "exposed", "onUpdate:exposed"]);
1476
+ const definedSlots = ["pager", "loading"];
1477
+ const searchRef = useTemplateRef("search");
1478
+ const gridRef = ref();
1479
+ __expose({
1480
+ /**
1481
+ * 搜索组件实例
1482
+ */
1483
+ searchRef,
1484
+ /**
1485
+ * 表格组件实例
1486
+ */
1487
+ gridRef,
1488
+ /**
1489
+ * 获取分页信息
1490
+ */
1491
+ getPagination() {
1492
+ return {
1493
+ page: current.value,
1494
+ pageSize: pageSize.value
1495
+ };
1496
+ },
1497
+ /**
1498
+ * 获取搜索信息
1499
+ */
1500
+ getSearchInfo() {
1501
+ var _a;
1502
+ return ((_a = searchRef.value) == null ? void 0 : _a.getFormData()) ?? {};
1503
+ }
1504
+ });
1505
+ return (_ctx, _cache) => {
1506
+ const _component_VxeGrid = resolveComponent("VxeGrid");
1507
+ return openBlock(), createElementBlock("div", {
1508
+ ref_key: "containerRef",
1509
+ ref: containerRef,
1510
+ style: normalizeStyle(unref(containerStyle))
1511
+ }, [unref(formColumns).length > 0 ? (openBlock(), createElementBlock(Fragment, {
1512
+ key: 0
1513
+ }, [createVNode(unref(_sfc_main$2), mergeProps({
1514
+ ref: "search",
1515
+ cache: _ctx.cache,
1516
+ columns: unref(formColumns),
1517
+ onSubmit: refresh
1518
+ }, _ctx.internalFormProps), null, 16, ["cache", "columns"]), createVNode(unref(Divider), {
1519
+ dashed: "",
1520
+ style: {
1521
+ "margin": "0"
1522
+ }
1523
+ })], 64)) : createCommentVNode("", true), createElementVNode("div", {
1524
+ style: normalizeStyle(unref(tableStyle))
1525
+ }, [createVNode(_component_VxeGrid, mergeProps({
1526
+ ref_key: "gridRef",
1527
+ ref: gridRef,
1528
+ border: "",
1529
+ showOverflow: "",
1530
+ height: unref(height),
1531
+ columns: columns.value,
1532
+ loading: _ctx.loading,
1533
+ data: _ctx.tableData,
1534
+ minHeight: _ctx.minHeight,
1535
+ id: _ctx.cache,
1536
+ keepSource: enableEdit.value
1537
+ }, {
1538
+ ..._ctx.$attrs,
1539
+ ...internalTableProps.value
1540
+ }), createSlots({
1541
+ pager: withCtx(() => [_ctx.$slots.pager ? renderSlot(_ctx.$slots, "pager", {
1542
+ key: 0
1543
+ }) : !_ctx.hidePagination ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(Pagination), {
1544
+ current: current.value,
1545
+ "onUpdate:current": _cache[0] || (_cache[0] = ($event) => current.value = $event),
1546
+ pageSize: pageSize.value,
1547
+ "onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => pageSize.value = $event),
1548
+ showQuickJumper: "",
1549
+ showSizeChanger: "",
1550
+ showLessItems: "",
1551
+ total: _ctx.total,
1552
+ defaultPageSize: _ctx.defaultPageSize,
1553
+ onChange: refresh
1554
+ }, null, 8, ["current", "pageSize", "total", "defaultPageSize"])])) : createCommentVNode("", true)]),
1555
+ loading: withCtx(() => [_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", {
1556
+ key: 0
1557
+ }) : (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(Spin))]))]),
1558
+ _: 2
1559
+ }, [renderList(_ctx.$slots, (_, name) => {
1560
+ return {
1561
+ name,
1562
+ fn: withCtx((slotData) => [!definedSlots.includes(name) ? renderSlot(_ctx.$slots, name, normalizeProps(mergeProps({
1563
+ key: 0
1564
+ }, slotData))) : createCommentVNode("", true)])
1565
+ };
1566
+ })]), 1040, ["height", "columns", "loading", "data", "minHeight", "id", "keepSource"])], 4)], 4);
1567
+ };
1568
+ }
1569
+ });
1374
1570
  export {
1375
- FtForm,
1376
- FtFormSearch,
1377
- FtTable,
1378
- FtVxeTable,
1571
+ _sfc_main$3 as FtAntdForm,
1572
+ _sfc_main$2 as FtAntdFormSearch,
1573
+ _sfc_main$1 as FtAntdTable,
1574
+ _sfc_main as FtVxeTable,
1379
1575
  editMap,
1380
1576
  isComponentTuple,
1381
1577
  registerEdit,