@dt-frames/ui 1.0.10 → 1.0.13

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 (73) hide show
  1. package/es/components/curd/src/components/dialog.d.ts +28 -18
  2. package/es/components/curd/src/components/props.d.ts +4 -4
  3. package/es/components/curd/src/types/curd.type.d.ts +3 -2
  4. package/es/components/forms/src/components/formIcon.d.ts +11 -6
  5. package/es/components/forms/src/components/formInputUseDialog.d.ts +903 -0
  6. package/es/components/forms/src/types/form.type.d.ts +3 -1
  7. package/es/components/index.d.ts +1 -1
  8. package/es/components/modal/src/components/modal.d.ts +2 -2
  9. package/es/components/modal/src/components/modalFooter.d.ts +9 -4
  10. package/es/components/modal/src/index.d.ts +10 -5
  11. package/es/components/modal/src/props.d.ts +2 -1
  12. package/es/components/modal/src/types/modal.type.d.ts +5 -2
  13. package/es/components/source/src/hooks/useFetch.d.ts +2 -2
  14. package/es/components/source/src/hooks/useSource.d.ts +4 -4
  15. package/es/components/table/src/components/TableHeader.d.ts +2 -2
  16. package/es/components/table/src/components/editable/CellComponent.d.ts +14 -0
  17. package/es/components/table/src/components/editable/EditTableCell.d.ts +88 -0
  18. package/es/components/table/src/components/editable/componentMap.d.ts +4 -0
  19. package/es/components/table/src/components/editable/index.d.ts +9 -0
  20. package/es/components/table/src/hooks/useCustomRow.d.ts +19 -0
  21. package/es/components/table/src/hooks/useTable.d.ts +2 -2
  22. package/es/components/table/src/index.d.ts +27 -4
  23. package/es/components/table/src/props.d.ts +5 -1
  24. package/es/components/table/src/types/table.type.d.ts +18 -2
  25. package/es/components/upload/index.d.ts +1 -2
  26. package/es/components/upload/src/helper.d.ts +1 -0
  27. package/es/components/upload/src/index.d.ts +40 -13
  28. package/es/components/upload/src/props.d.ts +4 -1
  29. package/es/components/upload/src/upload.d.ts +45 -10
  30. package/es/index.js +589 -212
  31. package/es/style/components/forms/index.less +23 -0
  32. package/es/style/components/table/index.less +6 -0
  33. package/es/style/components/upload/index.less +3 -11
  34. package/es/style/theme/header/index.less +1 -1
  35. package/package.json +1 -1
  36. package/src/components/curd/src/components/dialog.vue +7 -5
  37. package/src/components/curd/src/components/props.ts +4 -4
  38. package/src/components/curd/src/hooks/useCurd.tsx +1 -1
  39. package/src/components/curd/src/types/curd.type.ts +3 -2
  40. package/src/components/forms/index.less +23 -0
  41. package/src/components/forms/src/componentMap.ts +2 -0
  42. package/src/components/forms/src/components/formInputUseDialog.vue +43 -0
  43. package/src/components/forms/src/components/formItem.vue +10 -10
  44. package/src/components/forms/src/types/form.type.ts +6 -0
  45. package/src/components/index.ts +1 -2
  46. package/src/components/modal/src/components/modalFooter.vue +10 -2
  47. package/src/components/modal/src/hooks/useModal.ts +12 -4
  48. package/src/components/modal/src/index.vue +19 -8
  49. package/src/components/modal/src/props.ts +3 -2
  50. package/src/components/modal/src/types/modal.type.ts +5 -2
  51. package/src/components/source/src/hooks/useFetch.ts +6 -4
  52. package/src/components/source/src/hooks/useSource.ts +5 -4
  53. package/src/components/table/index.less +6 -0
  54. package/src/components/table/src/components/TableHeader.vue +2 -2
  55. package/src/components/table/src/components/editable/CellComponent.ts +57 -0
  56. package/src/components/table/src/components/editable/EditTableCell.vue +181 -0
  57. package/src/components/table/src/components/editable/componentMap.ts +18 -0
  58. package/src/components/table/src/components/editable/index.ts +58 -0
  59. package/src/components/table/src/hooks/useColumns.ts +15 -8
  60. package/src/components/table/src/hooks/useCustomRow.ts +86 -0
  61. package/src/components/table/src/hooks/useRowSelection.ts +1 -1
  62. package/src/components/table/src/hooks/useTable.ts +1 -1
  63. package/src/components/table/src/hooks/useTableHeader.ts +1 -1
  64. package/src/components/table/src/index.vue +20 -3
  65. package/src/components/table/src/props.ts +4 -1
  66. package/src/components/table/src/types/table.type.ts +30 -3
  67. package/src/components/upload/index.less +3 -11
  68. package/src/components/upload/index.ts +0 -2
  69. package/src/components/upload/src/helper.ts +29 -1
  70. package/src/components/upload/src/props.ts +4 -1
  71. package/src/components/upload/src/upload.vue +88 -63
  72. package/src/theme/header/index.less +1 -1
  73. package/src/components/upload/src/index.vue +0 -38
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent, resolveComponent, openBlock, createBlock, computed, unref, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, ref, watch, Fragment, renderList, createTextVNode, toDisplayString, KeepAlive, createVNode, withCtx, reactive, toRaw, getCurrentInstance, watchEffect, nextTick, onUnmounted, toRefs, isVNode, inject, h, provide, onMounted, onBeforeUnmount, resolveDynamicComponent, renderSlot, createCommentVNode, mergeProps, readonly, isRef, withDirectives, resolveDirective, render, normalizeProps, guardReactiveProps, createSlots, useAttrs as useAttrs$1, useSlots as useSlots$1, withModifiers, vShow, toRef, Transition } from "vue";
1
+ import { defineComponent, resolveComponent, openBlock, createBlock, computed, unref, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, ref, watch, Fragment, renderList, createTextVNode, toDisplayString, KeepAlive, createVNode, withCtx, reactive, toRaw, getCurrentInstance, watchEffect, nextTick, onUnmounted, toRefs, isVNode, inject, h, provide, onMounted, onBeforeUnmount, resolveDynamicComponent, renderSlot, createCommentVNode, mergeProps, readonly, isRef, useAttrs as useAttrs$1, normalizeProps, guardReactiveProps, withDirectives, resolveDirective, render, createSlots, useSlots as useSlots$1, withModifiers, vShow, toRef, Transition } from "vue";
2
2
  import { isString, isArray as isArray$1, isObject, isFunction, error, useTimeoutFn, useAttrs, useSlots, dispatchResize, BAR_MAP, off, renderThumbStyle, on, useAppStore, addResizeListener, removeResizeListener, windowResizeFn, isNumber, isBoolean, isNull, DtCache, CacheKey, deepMerge, http, getDynamicProps, getDictValueByCode, formatNumber, isVnode, getPopupContainer, isNullAndUnDef, dateFormat, useMessage, isEmpty, useTheme, useMenu, useHeader, useGo, Pages, localeList, changeLocale, Theme, MenuMode, MenuType, useThemeStore, ContentMode, useMultipleTab, copyText, MenuSplitTye, isUrl, openWindow, RouteReuseStore, menuList2Map, useApp } from "@dt-frames/core";
3
- import { InputSearch, Tooltip, Modal as Modal$1, RadioGroup, RadioButton, InputGroup, Input, Button, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Form, FormItem, Row, Dropdown, Menu, MenuItem, Popover, CheckboxGroup, Table, Spin, Upload, Image, MenuDivider, Tree, Empty, BackTop, Breadcrumb, Avatar, Drawer, SubMenu, LayoutHeader, LayoutSider, Tabs, TabPane, LayoutFooter, LayoutContent, ConfigProvider, Layout } from "ant-design-vue";
4
- import { isEqual, cloneDeep, upperFirst, set, uniqBy, omit, difference, get, trim } from "lodash-es";
3
+ import { InputSearch, Tooltip, Modal as Modal$1, RadioGroup, RadioButton, InputGroup, Input, Button, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Form, FormItem, Row, Popover, Spin, Dropdown, Menu, MenuItem, CheckboxGroup, Table, Upload, Image, MenuDivider, Tree, Empty, BackTop, Breadcrumb, Avatar, Drawer, SubMenu, LayoutHeader, LayoutSider, Tabs, TabPane, LayoutFooter, LayoutContent, ConfigProvider, Layout } from "ant-design-vue";
4
+ import { isEqual, omit, cloneDeep, upperFirst, set, uniqBy, difference, get, trim } from "lodash-es";
5
5
  import { tryOnUnmounted, isFunction as isFunction$1, useFullscreen, useDebounceFn, useThrottleFn } from "@vueuse/core";
6
6
  import Sortablejs from "sortablejs";
7
7
  import * as xlsx from "xlsx";
@@ -14,15 +14,15 @@ var _export_sfc = (sfc, props) => {
14
14
  }
15
15
  return target;
16
16
  };
17
- const _sfc_main$X = defineComponent({
17
+ const _sfc_main$Y = defineComponent({
18
18
  name: "dt-base-router"
19
19
  });
20
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
20
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
21
21
  const _component_router_view = resolveComponent("router-view");
22
22
  return openBlock(), createBlock(_component_router_view);
23
23
  }
24
- var DtBaseRouter = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["render", _sfc_render$7]]);
25
- const _sfc_main$W = defineComponent({
24
+ var DtBaseRouter = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$8]]);
25
+ const _sfc_main$X = defineComponent({
26
26
  props: {
27
27
  iconClass: {
28
28
  type: String,
@@ -90,8 +90,8 @@ const _sfc_main$W = defineComponent({
90
90
  };
91
91
  }
92
92
  });
93
- const _hoisted_1$v = ["xlink:href", "fill"];
94
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
93
+ const _hoisted_1$w = ["xlink:href", "fill"];
94
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
95
95
  return _ctx.isSvgIcon ? (openBlock(), createElementBlock("svg", {
96
96
  key: 0,
97
97
  class: normalizeClass(_ctx.clsName),
@@ -105,7 +105,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
105
105
  createElementVNode("use", {
106
106
  "xlink:href": _ctx.iconName,
107
107
  fill: _ctx.color
108
- }, null, 8, _hoisted_1$v)
108
+ }, null, 8, _hoisted_1$w)
109
109
  ], 6)) : (openBlock(), createElementBlock("i", {
110
110
  key: 1,
111
111
  class: normalizeClass(["dt-icon i", [_ctx.iconName, _ctx.clsName]]),
@@ -115,7 +115,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
115
115
  })
116
116
  }, null, 6));
117
117
  }
118
- var DtIcon = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$6]]);
118
+ var DtIcon = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["render", _sfc_render$7]]);
119
119
  const Actions = [
120
120
  "ic:baseline-save",
121
121
  "ic:baseline-save-all",
@@ -1874,9 +1874,9 @@ const Icons = [
1874
1874
  children: Other
1875
1875
  }
1876
1876
  ];
1877
- const _hoisted_1$u = ["onClick"];
1878
- const _hoisted_2$l = ["onClick"];
1879
- const _sfc_main$V = /* @__PURE__ */ defineComponent({
1877
+ const _hoisted_1$v = ["onClick"];
1878
+ const _hoisted_2$k = ["onClick"];
1879
+ const _sfc_main$W = /* @__PURE__ */ defineComponent({
1880
1880
  __name: "pick-icon",
1881
1881
  emits: ["chooseIcon"],
1882
1882
  setup(__props, { emit: emits }) {
@@ -1943,7 +1943,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
1943
1943
  createTextVNode(toDisplayString(menu.type), 1),
1944
1944
  createElementVNode("span", null, "(" + toDisplayString(menu.total) + ")", 1)
1945
1945
  ])
1946
- ], 10, _hoisted_1$u);
1946
+ ], 10, _hoisted_1$v);
1947
1947
  }), 128))
1948
1948
  ], 2),
1949
1949
  createElementVNode("div", {
@@ -1980,7 +1980,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
1980
1980
  ]),
1981
1981
  _: 2
1982
1982
  }, 1024)
1983
- ], 10, _hoisted_2$l);
1983
+ ], 10, _hoisted_2$k);
1984
1984
  }), 128))
1985
1985
  ], 2)
1986
1986
  ], 1024))
@@ -2106,7 +2106,8 @@ function useModal(props, callbackFn) {
2106
2106
  getVisible: computed(() => visibleData[~~unref(uidRef)]),
2107
2107
  closeModal: (rsp) => {
2108
2108
  var _a;
2109
- cbTransfer[unref(uidRef)](rsp);
2109
+ if (cbTransfer[unref(uidRef)])
2110
+ cbTransfer[unref(uidRef)](rsp);
2110
2111
  (_a = getInstance()) == null ? void 0 : _a.setModalProps({ visible: false });
2111
2112
  },
2112
2113
  openModal: (visable = true, data, openOnSet = true) => {
@@ -2383,8 +2384,8 @@ var Bar = defineComponent({
2383
2384
  }));
2384
2385
  }
2385
2386
  });
2386
- const _hoisted_1$t = { class: "scrollbar" };
2387
- const _sfc_main$U = /* @__PURE__ */ defineComponent({
2387
+ const _hoisted_1$u = { class: "scrollbar" };
2388
+ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2388
2389
  __name: "scroll-bar",
2389
2390
  props: {
2390
2391
  wrapClass: {
@@ -2461,7 +2462,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
2461
2462
  }
2462
2463
  });
2463
2464
  return (_ctx, _cache) => {
2464
- return openBlock(), createElementBlock("div", _hoisted_1$t, [
2465
+ return openBlock(), createElementBlock("div", _hoisted_1$u, [
2465
2466
  createElementVNode("div", {
2466
2467
  ref_key: "wrap",
2467
2468
  ref: wrap,
@@ -2496,12 +2497,12 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
2496
2497
  };
2497
2498
  }
2498
2499
  });
2499
- const _sfc_main$T = /* @__PURE__ */ defineComponent({
2500
+ const _sfc_main$U = /* @__PURE__ */ defineComponent({
2500
2501
  __name: "scroll-container",
2501
2502
  setup(__props) {
2502
2503
  const scrollbarRef = ref(null);
2503
2504
  return (_ctx, _cache) => {
2504
- return openBlock(), createBlock(_sfc_main$U, mergeProps({
2505
+ return openBlock(), createBlock(_sfc_main$V, mergeProps({
2505
2506
  ref_key: "scrollbarRef",
2506
2507
  ref: scrollbarRef,
2507
2508
  class: "scroll-container"
@@ -2514,7 +2515,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
2514
2515
  };
2515
2516
  }
2516
2517
  });
2517
- const _sfc_main$S = /* @__PURE__ */ defineComponent({
2518
+ const _sfc_main$T = /* @__PURE__ */ defineComponent({
2518
2519
  __name: "modal-wrap",
2519
2520
  props: {
2520
2521
  loading: { type: Boolean },
@@ -2602,7 +2603,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
2602
2603
  }
2603
2604
  });
2604
2605
  return (_ctx, _cache) => {
2605
- return openBlock(), createBlock(unref(_sfc_main$T), {
2606
+ return openBlock(), createBlock(unref(_sfc_main$U), {
2606
2607
  ref_key: "wrapperRef",
2607
2608
  ref: wrapperRef
2608
2609
  }, {
@@ -2688,7 +2689,7 @@ function useFormValue(props, key = "value", changeEvent = "change", emitData) {
2688
2689
  });
2689
2690
  return [state, setState, defaultState];
2690
2691
  }
2691
- const _sfc_main$R = defineComponent({
2692
+ const _sfc_main$S = defineComponent({
2692
2693
  name: "radio-button",
2693
2694
  props: {
2694
2695
  value: {
@@ -2721,7 +2722,7 @@ const _sfc_main$R = defineComponent({
2721
2722
  };
2722
2723
  }
2723
2724
  });
2724
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2725
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2725
2726
  const _component_RadioButton = resolveComponent("RadioButton", true);
2726
2727
  const _component_RadioGroup = resolveComponent("RadioGroup");
2727
2728
  return openBlock(), createBlock(_component_RadioGroup, mergeProps(_ctx.attrs, {
@@ -2746,8 +2747,8 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2746
2747
  _: 1
2747
2748
  }, 16, ["value"]);
2748
2749
  }
2749
- var RadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["render", _sfc_render$5]]);
2750
- const _sfc_main$Q = /* @__PURE__ */ defineComponent({
2750
+ var RadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["render", _sfc_render$6]]);
2751
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
2751
2752
  __name: "formIcon",
2752
2753
  props: {
2753
2754
  value: String,
@@ -2799,7 +2800,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
2799
2800
  }),
2800
2801
  createVNode(unref(_sfc_main$K), { onRegister: unref(register) }, {
2801
2802
  default: withCtx(() => [
2802
- createVNode(unref(_sfc_main$V), {
2803
+ createVNode(unref(_sfc_main$W), {
2803
2804
  onChooseIcon: _cache[2] || (_cache[2] = ($event) => chooseIcon($event))
2804
2805
  })
2805
2806
  ]),
@@ -2809,8 +2810,47 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
2809
2810
  };
2810
2811
  }
2811
2812
  });
2813
+ const _hoisted_1$t = { class: "input-with-dialog" };
2814
+ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
2815
+ __name: "formInputUseDialog",
2816
+ setup(__props) {
2817
+ const attrs = useAttrs$1();
2818
+ const bindProps = computed(() => {
2819
+ return {
2820
+ ...omit(attrs, [
2821
+ "formValues"
2822
+ ]),
2823
+ disabled: true
2824
+ };
2825
+ });
2826
+ function onClickInput() {
2827
+ const { model, schema = {} } = attrs.formValues;
2828
+ if (!schema.openDialog || !isFunction(schema.openDialog)) {
2829
+ error("openDialog\u5FC5\u987B\u662F\u51FD\u6570");
2830
+ return;
2831
+ }
2832
+ schema.openDialog(model);
2833
+ }
2834
+ function clearProps() {
2835
+ const { model, schema = {} } = attrs.formValues;
2836
+ [...schema.linkProps, schema.name].forEach((it) => model[it] = null);
2837
+ }
2838
+ return (_ctx, _cache) => {
2839
+ return openBlock(), createElementBlock("div", _hoisted_1$t, [
2840
+ createElementVNode("div", { onClick: onClickInput }, [
2841
+ createVNode(unref(Input), normalizeProps(guardReactiveProps(unref(bindProps))), null, 16)
2842
+ ]),
2843
+ createElementVNode("i", {
2844
+ class: "i mdi:close-circle",
2845
+ onClick: clearProps
2846
+ })
2847
+ ]);
2848
+ };
2849
+ }
2850
+ });
2812
2851
  const components = {
2813
2852
  Input,
2853
+ InputWithDialog: _sfc_main$Q,
2814
2854
  InputTextArea: Input.TextArea,
2815
2855
  InputSearch: Input.Search,
2816
2856
  InputGroup: Input.Group,
@@ -2834,11 +2874,11 @@ const components = {
2834
2874
  Slider,
2835
2875
  Rate,
2836
2876
  Divider,
2837
- Icon: _sfc_main$Q
2877
+ Icon: _sfc_main$R
2838
2878
  };
2839
- const componentMap = /* @__PURE__ */ new Map();
2879
+ const componentMap$1 = /* @__PURE__ */ new Map();
2840
2880
  for (let item in components) {
2841
- componentMap.set(item, components[item]);
2881
+ componentMap$1.set(item, components[item]);
2842
2882
  }
2843
2883
  function createPlaceholder(component) {
2844
2884
  if (component.includes("Input") || component.includes("Complete")) {
@@ -3179,12 +3219,12 @@ var _sfc_main$P = defineComponent({
3179
3219
  const bindValue = {
3180
3220
  [valueField || (isCheck ? "checked" : "value")]: props.formModel[name]
3181
3221
  };
3182
- const compAttr = {
3222
+ let compAttr = {
3183
3223
  ...itemProps,
3184
3224
  ...bindValue,
3185
3225
  ...on2
3186
3226
  };
3187
- const Comp = componentMap.get(component);
3227
+ const Comp = componentMap$1.get(component);
3188
3228
  if (!renderComponent) {
3189
3229
  return createVNode(Comp, compAttr, null);
3190
3230
  }
@@ -3420,12 +3460,12 @@ const _hoisted_1$s = {
3420
3460
  key: 0,
3421
3461
  className: "preIcon"
3422
3462
  };
3423
- const _hoisted_2$k = {
3463
+ const _hoisted_2$j = {
3424
3464
  key: 0,
3425
3465
  className: "preIcon"
3426
3466
  };
3427
3467
  const _hoisted_3$c = { class: "text" };
3428
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3468
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
3429
3469
  const _component_Button = resolveComponent("Button");
3430
3470
  const _component_DtIcon = resolveComponent("DtIcon");
3431
3471
  const _component_FormItem = resolveComponent("FormItem");
@@ -3458,7 +3498,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3458
3498
  ]),
3459
3499
  default: withCtx(() => [
3460
3500
  createTextVNode(" " + toDisplayString(button.name) + " ", 1),
3461
- button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$k, null, 512)), [
3501
+ button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$j, null, 512)), [
3462
3502
  [_directive_icon, button.postIcon]
3463
3503
  ]) : createCommentVNode("", true)
3464
3504
  ]),
@@ -3492,7 +3532,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3492
3532
  _: 1
3493
3533
  }, 16)) : createCommentVNode("", true);
3494
3534
  }
3495
- var FormButtons = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$4]]);
3535
+ var FormButtons = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$5]]);
3496
3536
  const isArray = Array.isArray;
3497
3537
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3498
3538
  var dayjs_min = { exports: {} };
@@ -4154,7 +4194,7 @@ const _sfc_main$N = defineComponent({
4154
4194
  };
4155
4195
  }
4156
4196
  });
4157
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
4197
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
4158
4198
  const _component_FormItem = resolveComponent("FormItem");
4159
4199
  const _component_FormButtons = resolveComponent("FormButtons");
4160
4200
  const _component_Row = resolveComponent("Row");
@@ -4199,7 +4239,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
4199
4239
  _: 3
4200
4240
  }, 16, ["class", "model", "layout"]);
4201
4241
  }
4202
- var DtForm = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$3]]);
4242
+ var DtForm = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$4]]);
4203
4243
  function useForm(props) {
4204
4244
  const formRef = ref(null);
4205
4245
  const loadedRef = ref(false);
@@ -4275,6 +4315,7 @@ function useForm(props) {
4275
4315
  const _sfc_main$M = /* @__PURE__ */ defineComponent({
4276
4316
  __name: "modalFooter",
4277
4317
  props: {
4318
+ buttons: Object,
4278
4319
  showSave: {
4279
4320
  type: Boolean,
4280
4321
  default: true
@@ -4285,10 +4326,16 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4285
4326
  "handleCancel"
4286
4327
  ],
4287
4328
  setup(__props, { emit: emits }) {
4329
+ const props = __props;
4288
4330
  const buttonActions = [
4289
4331
  { name: "\u4FDD\u5B58", preIcon: "mdi:content-save", type: "primary", flag: "OK" },
4290
4332
  { name: "\u5173\u95ED", preIcon: "mdi:close", flag: "CANCEL" }
4291
4333
  ];
4334
+ const buttonList = computed(() => {
4335
+ if (props.buttons && props.buttons.length)
4336
+ return props.buttons;
4337
+ return buttonActions;
4338
+ });
4292
4339
  function handleMethod(item) {
4293
4340
  switch (item.flag) {
4294
4341
  case "OK":
@@ -4304,9 +4351,9 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4304
4351
  renderSlot(_ctx.$slots, "appendFooter"),
4305
4352
  createVNode(unref(FormButtons), {
4306
4353
  mode: "dialog",
4307
- buttonList: buttonActions,
4354
+ buttonList: unref(buttonList),
4308
4355
  onHandleMethod: _cache[0] || (_cache[0] = ($event) => handleMethod($event))
4309
- })
4356
+ }, null, 8, ["buttonList"])
4310
4357
  ], 64);
4311
4358
  };
4312
4359
  }
@@ -4386,6 +4433,12 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4386
4433
  const propsRef = ref();
4387
4434
  const modalWrapperRef = ref(null);
4388
4435
  const extHeightRef = ref(0);
4436
+ const modalFooterHeight = computed(() => {
4437
+ if (isArray$1(props.footer)) {
4438
+ return unref(propsRef).footer.length ? 0 : void 0;
4439
+ }
4440
+ return props.footer !== void 0 && !props.footer ? 0 : void 0;
4441
+ });
4389
4442
  const modalMethods = {
4390
4443
  setModalProps,
4391
4444
  emitVisible: void 0,
@@ -4418,7 +4471,11 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4418
4471
  visible: unref(visibleRef),
4419
4472
  wrapClassName: unref(getWrapClassName)
4420
4473
  };
4421
- return omit(bindValue, unref(fullScreenRef) ? ["height", "title"] : "title");
4474
+ let omitArr = unref(fullScreenRef) ? ["height", "title"] : ["title"];
4475
+ if (isArray$1(unref(propsRef).footer)) {
4476
+ omitArr.push("footer");
4477
+ }
4478
+ return omit(bindValue, omitArr);
4422
4479
  });
4423
4480
  const getWrapperHeight = computed(() => {
4424
4481
  if (unref(fullScreenRef))
@@ -4459,7 +4516,6 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4459
4516
  }
4460
4517
  function handleSave() {
4461
4518
  emits("save");
4462
- handleCancel();
4463
4519
  }
4464
4520
  async function handleCancel(e = null) {
4465
4521
  var _a, _b;
@@ -4479,7 +4535,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4479
4535
  return (_ctx, _cache) => {
4480
4536
  return openBlock(), createBlock(unref(Modal), mergeProps(unref(getBindValue), { onCancel: handleCancel }), createSlots({
4481
4537
  default: withCtx(() => [
4482
- createVNode(_sfc_main$S, mergeProps({
4538
+ createVNode(_sfc_main$T, mergeProps({
4483
4539
  useWrapper: unref(getBindValue).useWrapper,
4484
4540
  footerOffset: _ctx.wrapperFooterOffset,
4485
4541
  fullScreen: unref(fullScreenRef),
@@ -4490,7 +4546,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4490
4546
  minHeight: unref(getBindValue).minHeight,
4491
4547
  height: unref(getWrapperHeight),
4492
4548
  visible: visibleRef.value,
4493
- modalFooterHeight: _ctx.footer !== void 0 && !_ctx.footer ? 0 : void 0
4549
+ modalFooterHeight: unref(modalFooterHeight)
4494
4550
  }, unref(omit)(unref(getBindValue).wrapperProps, "visible", "height", "modalFooterHeight"), {
4495
4551
  onExtHeight: handleExtHeight,
4496
4552
  onHeightChange: handleHeightChange
@@ -4524,6 +4580,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4524
4580
  name: "footer",
4525
4581
  fn: withCtx(() => [
4526
4582
  createVNode(_sfc_main$M, {
4583
+ buttons: propsRef.value.footer,
4527
4584
  showSave: unref(getBindValue).showSave,
4528
4585
  onHandleSave: handleSave,
4529
4586
  onHandleCancel: handleCancel
@@ -4536,7 +4593,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4536
4593
  ])
4537
4594
  };
4538
4595
  })
4539
- ]), 1032, ["showSave"])
4596
+ ]), 1032, ["buttons", "showSave"])
4540
4597
  ])
4541
4598
  } : void 0,
4542
4599
  renderList(Object.keys(unref(omit)(_ctx.$slots, "default")), (item) => {
@@ -4685,6 +4742,7 @@ const TABLE_SIZE_HEIGHT = {
4685
4742
  const TableProps = {
4686
4743
  clickRowSelect: { type: Boolean, default: false },
4687
4744
  tableSetting: { type: Object, default: () => ({}) },
4745
+ clickToRowSelect: { type: Boolean, default: false },
4688
4746
  striped: { type: Boolean, default: true },
4689
4747
  canColDrag: { type: Boolean, default: true },
4690
4748
  resizable: { type: Boolean, default: true },
@@ -5060,9 +5118,239 @@ function createTableInstance(instance) {
5060
5118
  function getTableInstance() {
5061
5119
  return inject(tableKey);
5062
5120
  }
5063
- const _hoisted_1$r = { class: "dt-table-action-btn" };
5064
- const _hoisted_2$j = ["color", "onClick"];
5065
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
5121
+ const componentMap = /* @__PURE__ */ new Map();
5122
+ componentMap.set("Input", Input);
5123
+ componentMap.set("InputNumber", InputNumber);
5124
+ componentMap.set("Select", Select);
5125
+ componentMap.set("TreeSelect", TreeSelect);
5126
+ componentMap.set("Switch", Switch);
5127
+ componentMap.set("Checkbox", Checkbox);
5128
+ componentMap.set("DatePicker", DatePicker);
5129
+ componentMap.set("TimePicker", TimePicker);
5130
+ const CellComponent = ({
5131
+ component = "Input",
5132
+ rule = true,
5133
+ ruleMessage,
5134
+ popoverVisible,
5135
+ getPopupContainer: getPopupContainer2
5136
+ }, { attrs }) => {
5137
+ const Comp = componentMap.get(component);
5138
+ const DefaultComp = h(Comp, attrs);
5139
+ if (!rule)
5140
+ return DefaultComp;
5141
+ return h(Popover, {
5142
+ overlayClassName: "edit-cell-rule-popover",
5143
+ visible: !!popoverVisible,
5144
+ ...getPopupContainer2 ? { getPopupContainer: getPopupContainer2 } : {}
5145
+ }, {
5146
+ default: () => DefaultComp,
5147
+ content: () => ruleMessage
5148
+ });
5149
+ };
5150
+ var _sfc_main$I = defineComponent({
5151
+ name: "EditableCell",
5152
+ components: {
5153
+ Spin,
5154
+ CellComponent
5155
+ },
5156
+ props: {
5157
+ value: {
5158
+ type: [String, Number, Boolean, Object],
5159
+ default: ""
5160
+ },
5161
+ record: {
5162
+ type: Object
5163
+ },
5164
+ column: {
5165
+ type: Object,
5166
+ default: () => ({})
5167
+ },
5168
+ index: Number
5169
+ },
5170
+ setup(props) {
5171
+ const table = getTableInstance();
5172
+ ref();
5173
+ const {
5174
+ editRule,
5175
+ align = "left"
5176
+ } = props.column;
5177
+ const ruleMessage = ref("");
5178
+ const ruleVisible = ref(false);
5179
+ const optionsRef = ref([]);
5180
+ const currentValueRef = ref(props.value);
5181
+ const getComponent = computed(() => {
5182
+ var _a;
5183
+ return ((_a = props.column) == null ? void 0 : _a.editComponent) || "Input";
5184
+ });
5185
+ const getRuleVisible = computed(() => {
5186
+ return unref(ruleMessage) && unref(ruleVisible);
5187
+ });
5188
+ const getWrapperClass = computed(() => {
5189
+ return `edit-cell-align-${align}`;
5190
+ });
5191
+ const getIsCheckComp = computed(() => {
5192
+ const component = unref(getComponent);
5193
+ return ["Checkbox", "Switch"].includes(component);
5194
+ });
5195
+ const createPlaceholderMessage = (component) => {
5196
+ if (component.includes("Input")) {
5197
+ return "\u8BF7\u8F93\u5165";
5198
+ }
5199
+ return "\u8BF7\u9009\u62E9";
5200
+ };
5201
+ const getComponentProps = computed(() => {
5202
+ var _a, _b, _c;
5203
+ const isCheckValue = unref(getIsCheckComp);
5204
+ const valueField = isCheckValue ? "checked" : "value";
5205
+ const val = unref(currentValueRef);
5206
+ const value = isCheckValue ? isNumber(val) && isBoolean(val) ? val : !!val : val;
5207
+ let compProps = (_b = (_a = props.column) == null ? void 0 : _a.editComponentProps) != null ? _b : {};
5208
+ const {
5209
+ record,
5210
+ column,
5211
+ index
5212
+ } = props;
5213
+ if (isFunction$1(compProps)) {
5214
+ compProps = (_c = compProps({
5215
+ text: val,
5216
+ record,
5217
+ column,
5218
+ index
5219
+ })) != null ? _c : {};
5220
+ }
5221
+ return {
5222
+ size: "small",
5223
+ getPopupContainer: () => document.body,
5224
+ placeholder: createPlaceholderMessage(unref(getComponent)),
5225
+ ...omit(compProps, "onChange"),
5226
+ [valueField]: value
5227
+ };
5228
+ });
5229
+ async function handleChange(e) {
5230
+ var _a, _b;
5231
+ const component = unref(getComponent);
5232
+ if (!e) {
5233
+ currentValueRef.value = e;
5234
+ } else if (component === "Checkbox") {
5235
+ currentValueRef.value = e.target.checked;
5236
+ } else if (component === "Switch") {
5237
+ currentValueRef.value = e;
5238
+ } else if ((e == null ? void 0 : e.target) && Reflect.has(e.target, "value")) {
5239
+ currentValueRef.value = e.target.value;
5240
+ } else if (isString(e) || isBoolean(e) || isNumber(e)) {
5241
+ currentValueRef.value = e;
5242
+ }
5243
+ const onChange = (_a = unref(getComponentProps)) == null ? void 0 : _a.onChange;
5244
+ if (onChange && isFunction$1(onChange))
5245
+ onChange(...arguments);
5246
+ (_b = table.emit) == null ? void 0 : _b.call(table, "edit-change", {
5247
+ column: props.column,
5248
+ value: unref(currentValueRef),
5249
+ record: toRaw(props.record)
5250
+ });
5251
+ handleSubmitRule();
5252
+ }
5253
+ async function handleSubmitRule() {
5254
+ const {
5255
+ column,
5256
+ record
5257
+ } = props;
5258
+ const {
5259
+ editRule: editRule2
5260
+ } = column;
5261
+ const currentValue = unref(currentValueRef);
5262
+ if (editRule2) {
5263
+ if (isBoolean(editRule2) && !currentValue && !isNumber(currentValue)) {
5264
+ ruleVisible.value = true;
5265
+ const component = unref(getComponent);
5266
+ ruleMessage.value = createPlaceholderMessage(component);
5267
+ return false;
5268
+ }
5269
+ if (isFunction$1(editRule2)) {
5270
+ const res = await editRule2(currentValue, record);
5271
+ if (!!res) {
5272
+ ruleMessage.value = res;
5273
+ ruleVisible.value = true;
5274
+ return false;
5275
+ }
5276
+ }
5277
+ }
5278
+ ruleMessage.value = "";
5279
+ return true;
5280
+ }
5281
+ function handleOptionsChange(options) {
5282
+ optionsRef.value = options;
5283
+ }
5284
+ return {
5285
+ props,
5286
+ getComponentProps,
5287
+ getRuleVisible,
5288
+ editRule,
5289
+ ruleMessage,
5290
+ getWrapperClass,
5291
+ handleChange,
5292
+ handleOptionsChange
5293
+ };
5294
+ }
5295
+ });
5296
+ const _hoisted_1$r = { class: "editable-cell" };
5297
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
5298
+ var _a;
5299
+ const _component_CellComponent = resolveComponent("CellComponent");
5300
+ return openBlock(), createElementBlock("div", _hoisted_1$r, [
5301
+ createVNode(_component_CellComponent, mergeProps({ ref: "elRef" }, _ctx.getComponentProps, {
5302
+ component: (_a = _ctx.column) == null ? void 0 : _a.editComponent,
5303
+ popoverVisible: _ctx.getRuleVisible,
5304
+ rule: _ctx.editRule,
5305
+ ruleMessage: _ctx.ruleMessage,
5306
+ class: _ctx.getWrapperClass,
5307
+ onChange: _ctx.handleChange,
5308
+ onOptionsChange: _ctx.handleOptionsChange
5309
+ }), null, 16, ["component", "popoverVisible", "rule", "ruleMessage", "class", "onChange", "onOptionsChange"])
5310
+ ]);
5311
+ }
5312
+ var EditableCell = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$3]]);
5313
+ function renderEditCell(column) {
5314
+ return ({ text: value, record, index }) => {
5315
+ record.onValid = async () => {
5316
+ if (isArray$1(record == null ? void 0 : record.validCbs)) {
5317
+ const validFns = ((record == null ? void 0 : record.validCbs) || []).map((fn) => fn());
5318
+ const res = await Promise.all(validFns);
5319
+ return res.every((item) => !!item);
5320
+ }
5321
+ return false;
5322
+ };
5323
+ record.onEdit = async (edit, submit = false) => {
5324
+ var _a, _b;
5325
+ if (!submit) {
5326
+ record.editable = edit;
5327
+ }
5328
+ if (!edit && submit) {
5329
+ if (!await record.onValid())
5330
+ return false;
5331
+ const res = await ((_a = record.onSubmitEdit) == null ? void 0 : _a.call(record));
5332
+ if (res) {
5333
+ record.editable = false;
5334
+ return true;
5335
+ }
5336
+ return false;
5337
+ }
5338
+ if (!edit && !submit) {
5339
+ (_b = record.onCancelEdit) == null ? void 0 : _b.call(record);
5340
+ }
5341
+ return true;
5342
+ };
5343
+ return h(EditableCell, {
5344
+ value,
5345
+ record,
5346
+ column,
5347
+ index
5348
+ });
5349
+ };
5350
+ }
5351
+ const _hoisted_1$q = { class: "dt-table-action-btn" };
5352
+ const _hoisted_2$i = ["color", "onClick"];
5353
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5066
5354
  __name: "TableActions",
5067
5355
  props: {
5068
5356
  fixed: {
@@ -5118,7 +5406,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
5118
5406
  return (_ctx, _cache) => {
5119
5407
  const _directive_icon = resolveDirective("icon");
5120
5408
  return props.expand ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.btns, (item) => {
5121
- return openBlock(), createElementBlock("span", _hoisted_1$r, [
5409
+ return openBlock(), createElementBlock("span", _hoisted_1$q, [
5122
5410
  item.ifShow ? (openBlock(), createBlock(unref(Tooltip), {
5123
5411
  key: 0,
5124
5412
  placement: "bottom"
@@ -5130,7 +5418,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
5130
5418
  withDirectives(createElementVNode("span", {
5131
5419
  color: item.color,
5132
5420
  onClick: ($event) => handleAction(item)
5133
- }, null, 8, _hoisted_2$j), [
5421
+ }, null, 8, _hoisted_2$i), [
5134
5422
  [_directive_icon, item.icon]
5135
5423
  ])
5136
5424
  ]),
@@ -5288,12 +5576,11 @@ function handleActionColumn(propsRef, columns) {
5288
5576
  columns.push({
5289
5577
  ...columnObj,
5290
5578
  customRender: ({ record, index }) => {
5291
- return h(_sfc_main$I, {
5579
+ return h(_sfc_main$H, omit({
5292
5580
  ...columnObj,
5293
5581
  record,
5294
- align: null,
5295
5582
  index
5296
- });
5583
+ }, "align"));
5297
5584
  }
5298
5585
  });
5299
5586
  }
@@ -5323,7 +5610,12 @@ function useColumns(propsRef, getPaginationRef) {
5323
5610
  const getViewColumns = computed(() => {
5324
5611
  const viewColumns = sortFixedColumn(unref(getColumnsRef));
5325
5612
  const columns = cloneDeep(viewColumns);
5326
- return columns.filter((column) => isIfShow(column));
5613
+ return columns.filter((column) => isIfShow(column)).map((column) => {
5614
+ if (column.edit) {
5615
+ column.customRender = renderEditCell(column);
5616
+ }
5617
+ return column;
5618
+ });
5327
5619
  });
5328
5620
  function isIfShow(column) {
5329
5621
  const ifShow = column.ifShow;
@@ -5398,8 +5690,8 @@ function useColumns(propsRef, getPaginationRef) {
5398
5690
  getCacheColumns
5399
5691
  };
5400
5692
  }
5401
- const _hoisted_1$q = /* @__PURE__ */ createElementVNode("span", null, "\u5217\u63A7\u5236", -1);
5402
- const _hoisted_2$i = /* @__PURE__ */ createTextVNode(" \u5217\u5C55\u793A ");
5693
+ const _hoisted_1$p = /* @__PURE__ */ createElementVNode("span", null, "\u5217\u63A7\u5236", -1);
5694
+ const _hoisted_2$h = /* @__PURE__ */ createTextVNode(" \u5217\u5C55\u793A ");
5403
5695
  const _hoisted_3$b = /* @__PURE__ */ createTextVNode(" \u5E8F\u5217\u53F7 ");
5404
5696
  const _hoisted_4$8 = /* @__PURE__ */ createTextVNode(" \u590D\u9009\u6846 ");
5405
5697
  const _hoisted_5$5 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
@@ -5409,7 +5701,7 @@ const _hoisted_6$2 = {
5409
5701
  };
5410
5702
  const _hoisted_7$1 = /* @__PURE__ */ createTextVNode("\u56FA\u5B9A\u5230\u5DE6\u4FA7");
5411
5703
  const _hoisted_8$1 = /* @__PURE__ */ createTextVNode("\u56FA\u5B9A\u5230\u53F3\u4FA7");
5412
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
5704
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5413
5705
  __name: "Column",
5414
5706
  emits: [
5415
5707
  "columns-change"
@@ -5588,7 +5880,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5588
5880
  const _directive_icon = resolveDirective("icon");
5589
5881
  return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5590
5882
  title: withCtx(() => [
5591
- _hoisted_1$q
5883
+ _hoisted_1$p
5592
5884
  ]),
5593
5885
  default: withCtx(() => [
5594
5886
  createVNode(unref(Popover), {
@@ -5609,7 +5901,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5609
5901
  onChange: onCheckAllChange
5610
5902
  }, {
5611
5903
  default: withCtx(() => [
5612
- _hoisted_2$i
5904
+ _hoisted_2$h
5613
5905
  ]),
5614
5906
  _: 1
5615
5907
  }, 8, ["indeterminate", "checked"]),
@@ -5741,10 +6033,10 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5741
6033
  };
5742
6034
  }
5743
6035
  });
5744
- const _hoisted_1$p = { key: 0 };
5745
- const _hoisted_2$h = { key: 0 };
6036
+ const _hoisted_1$o = { key: 0 };
6037
+ const _hoisted_2$g = { key: 0 };
5746
6038
  const _hoisted_3$a = { key: 1 };
5747
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
6039
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
5748
6040
  __name: "Fullscreen",
5749
6041
  setup(__props) {
5750
6042
  const table = getTableInstance();
@@ -5767,13 +6059,13 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5767
6059
  const _directive_icon = resolveDirective("icon");
5768
6060
  return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5769
6061
  title: withCtx(() => [
5770
- !unref(isFullscreen) ? (openBlock(), createElementBlock("span", _hoisted_1$p, "\u5168\u5C4F")) : createCommentVNode("", true)
6062
+ !unref(isFullscreen) ? (openBlock(), createElementBlock("span", _hoisted_1$o, "\u5168\u5C4F")) : createCommentVNode("", true)
5771
6063
  ]),
5772
6064
  default: withCtx(() => [
5773
6065
  createElementVNode("span", {
5774
6066
  onClick: _cache[0] || (_cache[0] = (...args) => unref(toggle) && unref(toggle)(...args))
5775
6067
  }, [
5776
- !unref(isFullscreen) ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$h, null, 512)), [
6068
+ !unref(isFullscreen) ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$g, null, 512)), [
5777
6069
  [_directive_icon, "ic:baseline-fullscreen"]
5778
6070
  ]) : withDirectives((openBlock(), createElementBlock("span", _hoisted_3$a, null, 512)), [
5779
6071
  [_directive_icon, "ic:baseline-fullscreen-exit"]
@@ -5785,11 +6077,11 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5785
6077
  };
5786
6078
  }
5787
6079
  });
5788
- const _hoisted_1$o = /* @__PURE__ */ createTextVNode("\u5BC6\u5EA6");
5789
- const _hoisted_2$g = /* @__PURE__ */ createElementVNode("span", null, "\u9ED8\u8BA4", -1);
6080
+ const _hoisted_1$n = /* @__PURE__ */ createTextVNode("\u5BC6\u5EA6");
6081
+ const _hoisted_2$f = /* @__PURE__ */ createElementVNode("span", null, "\u9ED8\u8BA4", -1);
5790
6082
  const _hoisted_3$9 = /* @__PURE__ */ createElementVNode("span", null, "\u4E2D\u7B49", -1);
5791
6083
  const _hoisted_4$7 = /* @__PURE__ */ createElementVNode("span", null, "\u7D27\u51D1", -1);
5792
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
6084
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5793
6085
  __name: "Size",
5794
6086
  setup(__props) {
5795
6087
  const table = getTableInstance();
@@ -5802,7 +6094,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
5802
6094
  const _directive_icon = resolveDirective("icon");
5803
6095
  return openBlock(), createBlock(unref(Tooltip), null, {
5804
6096
  title: withCtx(() => [
5805
- _hoisted_1$o
6097
+ _hoisted_1$n
5806
6098
  ]),
5807
6099
  default: withCtx(() => [
5808
6100
  createVNode(unref(Dropdown), {
@@ -5820,7 +6112,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
5820
6112
  default: withCtx(() => [
5821
6113
  createVNode(unref(MenuItem), { key: "default" }, {
5822
6114
  default: withCtx(() => [
5823
- _hoisted_2$g
6115
+ _hoisted_2$f
5824
6116
  ]),
5825
6117
  _: 1
5826
6118
  }),
@@ -5853,11 +6145,11 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
5853
6145
  };
5854
6146
  }
5855
6147
  });
5856
- const _hoisted_1$n = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA", -1);
5857
- const _hoisted_2$f = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u5F53\u524D\u9875", -1);
6148
+ const _hoisted_1$m = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA", -1);
6149
+ const _hoisted_2$e = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u5F53\u524D\u9875", -1);
5858
6150
  const _hoisted_3$8 = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u9009\u4E2D\u5217", -1);
5859
6151
  const _hoisted_4$6 = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u6240\u6709\u5217", -1);
5860
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
6152
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
5861
6153
  __name: "Download",
5862
6154
  setup(__props) {
5863
6155
  const table = getTableInstance();
@@ -5875,7 +6167,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5875
6167
  const _directive_icon = resolveDirective("icon");
5876
6168
  return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5877
6169
  title: withCtx(() => [
5878
- _hoisted_1$n
6170
+ _hoisted_1$m
5879
6171
  ]),
5880
6172
  default: withCtx(() => [
5881
6173
  createVNode(unref(Dropdown), {
@@ -5888,7 +6180,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5888
6180
  default: withCtx(() => [
5889
6181
  createVNode(unref(MenuItem), { key: "current" }, {
5890
6182
  default: withCtx(() => [
5891
- _hoisted_2$f
6183
+ _hoisted_2$e
5892
6184
  ]),
5893
6185
  _: 1
5894
6186
  }),
@@ -5921,13 +6213,13 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5921
6213
  };
5922
6214
  }
5923
6215
  });
5924
- const _sfc_main$D = defineComponent({
6216
+ const _sfc_main$C = defineComponent({
5925
6217
  name: "table-setting",
5926
6218
  components: {
5927
- ColumnSetting: _sfc_main$H,
5928
- FullscreenSetting: _sfc_main$G,
5929
- SizeSetting: _sfc_main$F,
5930
- Download: _sfc_main$E
6219
+ ColumnSetting: _sfc_main$G,
6220
+ FullscreenSetting: _sfc_main$F,
6221
+ SizeSetting: _sfc_main$E,
6222
+ Download: _sfc_main$D
5931
6223
  },
5932
6224
  props: {
5933
6225
  setting: {
@@ -5970,8 +6262,8 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
5970
6262
  _ctx.getSetting.fullscreen ? (openBlock(), createBlock(_component_FullscreenSetting, { key: 3 })) : createCommentVNode("", true)
5971
6263
  ], 64);
5972
6264
  }
5973
- var TableSettinCom = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$2]]);
5974
- const _sfc_main$C = defineComponent({
6265
+ var TableSettinCom = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$2]]);
6266
+ const _sfc_main$B = defineComponent({
5975
6267
  name: "table-header",
5976
6268
  components: {
5977
6269
  TableSettinCom,
@@ -5981,7 +6273,7 @@ const _sfc_main$C = defineComponent({
5981
6273
  },
5982
6274
  props: {
5983
6275
  tableTools: {
5984
- type: Object
6276
+ type: [Object, Boolean]
5985
6277
  },
5986
6278
  toolbar: {
5987
6279
  type: Array,
@@ -6011,10 +6303,13 @@ const _sfc_main$C = defineComponent({
6011
6303
  };
6012
6304
  }
6013
6305
  });
6014
- const _hoisted_1$m = { class: "dt-table-header" };
6015
- const _hoisted_2$e = { class: "dt-table-header-actions" };
6306
+ const _hoisted_1$l = { class: "dt-table-header" };
6307
+ const _hoisted_2$d = { class: "dt-table-header-actions" };
6016
6308
  const _hoisted_3$7 = { class: "dt-table-header-actions__left" };
6017
- const _hoisted_4$5 = { class: "dt-table-header-actions__right" };
6309
+ const _hoisted_4$5 = {
6310
+ key: 0,
6311
+ class: "dt-table-header-actions__right"
6312
+ };
6018
6313
  const _hoisted_5$4 = {
6019
6314
  key: 0,
6020
6315
  style: { "margin": "5px" }
@@ -6022,30 +6317,30 @@ const _hoisted_5$4 = {
6022
6317
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6023
6318
  const _component_FormButtons = resolveComponent("FormButtons");
6024
6319
  const _component_TableSettinCom = resolveComponent("TableSettinCom");
6025
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
6026
- createElementVNode("div", _hoisted_2$e, [
6320
+ return openBlock(), createElementBlock("div", _hoisted_1$l, [
6321
+ createElementVNode("div", _hoisted_2$d, [
6027
6322
  createElementVNode("div", _hoisted_3$7, [
6028
6323
  createVNode(_component_FormButtons, mergeProps(_ctx.getActionsProps, { onHandleMethod: _ctx.handleMethod }), null, 16, ["onHandleMethod"]),
6029
6324
  renderSlot(_ctx.$slots, "toolbar")
6030
6325
  ]),
6031
- createElementVNode("div", _hoisted_4$5, [
6326
+ _ctx.tableTools ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
6032
6327
  createVNode(_component_TableSettinCom, {
6033
6328
  setting: _ctx.tableTools,
6034
6329
  onColumnsChange: _ctx.handleColumnChange
6035
6330
  }, null, 8, ["setting", "onColumnsChange"])
6036
- ])
6331
+ ])) : createCommentVNode("", true)
6037
6332
  ]),
6038
6333
  _ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
6039
6334
  renderSlot(_ctx.$slots, "headerTop")
6040
6335
  ])) : createCommentVNode("", true)
6041
6336
  ]);
6042
6337
  }
6043
- var TableHeader = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$1]]);
6338
+ var TableHeader = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$1]]);
6044
6339
  function useTableHeader(propsRef, slots, handlers) {
6045
6340
  const getHeaderProps = computed(() => {
6046
6341
  const { tableSetting, toolbar } = unref(propsRef);
6047
6342
  const { getSlot } = useSlots();
6048
- const hideTitle = !slots.toolbar && !slots.headerTop && !tableSetting;
6343
+ const hideTitle = !toolbar && !slots.toolbar && !slots.headerTop && !tableSetting;
6049
6344
  return {
6050
6345
  title: hideTitle ? null : () => h(TableHeader, {
6051
6346
  tableTools: tableSetting,
@@ -6220,7 +6515,71 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
6220
6515
  filterSource
6221
6516
  };
6222
6517
  }
6223
- const _sfc_main$B = defineComponent({
6518
+ function useCustomRow(propsRef, { setSelectedRowKeys, getSelectRowKeys, clearSelectedRowKeys, emit }) {
6519
+ const customRow = (record, index) => {
6520
+ return {
6521
+ onClick: (e) => {
6522
+ e == null ? void 0 : e.stopPropagation();
6523
+ function handleClick() {
6524
+ var _a;
6525
+ const { rowSelection, rowKey, clickToRowSelect } = unref(propsRef);
6526
+ if (!rowSelection || !clickToRowSelect)
6527
+ return;
6528
+ const keys = getSelectRowKeys();
6529
+ const key = record[rowKey];
6530
+ if (!key)
6531
+ return;
6532
+ const isCheckbox = rowSelection.type === "checkbox";
6533
+ if (isCheckbox) {
6534
+ const tr = (_a = e.composedPath) == null ? void 0 : _a.call(e).find((dom) => dom.tagName === "TR");
6535
+ if (!tr)
6536
+ return;
6537
+ const checkBox = tr.querySelector("input[type=checkbox]");
6538
+ if (!checkBox || checkBox.hasAttribute("disabled"))
6539
+ return;
6540
+ if (!keys.includes(key)) {
6541
+ setSelectedRowKeys([...keys, key]);
6542
+ return;
6543
+ }
6544
+ const keyIndex = keys.findIndex((item) => item === key);
6545
+ keys.splice(keyIndex, 1);
6546
+ setSelectedRowKeys(keys);
6547
+ return;
6548
+ }
6549
+ const isRadio = rowSelection.type === "radio";
6550
+ if (isRadio) {
6551
+ if (!keys.includes(key)) {
6552
+ if (keys.length) {
6553
+ clearSelectedRowKeys();
6554
+ }
6555
+ setSelectedRowKeys([key]);
6556
+ return;
6557
+ }
6558
+ clearSelectedRowKeys();
6559
+ }
6560
+ }
6561
+ handleClick();
6562
+ emit("row-click", record, index, e);
6563
+ },
6564
+ onDblclick: (event) => {
6565
+ emit("row-dbClick", record, index, event);
6566
+ },
6567
+ onContextmenu: (event) => {
6568
+ emit("row-contextmenu", record, index, event);
6569
+ },
6570
+ onMouseenter: (event) => {
6571
+ emit("row-mouseenter", record, index, event);
6572
+ },
6573
+ onMouseleave: (event) => {
6574
+ emit("row-mouseleave", record, index, event);
6575
+ }
6576
+ };
6577
+ };
6578
+ return {
6579
+ customRow
6580
+ };
6581
+ }
6582
+ const _sfc_main$A = defineComponent({
6224
6583
  name: "dt-table",
6225
6584
  props: TableProps,
6226
6585
  components: {
@@ -6230,7 +6589,14 @@ const _sfc_main$B = defineComponent({
6230
6589
  emits: [
6231
6590
  "register",
6232
6591
  "columns-change",
6233
- "selection-change"
6592
+ "selection-change",
6593
+ "row-click",
6594
+ "row-dbClick",
6595
+ "row-contextmenu",
6596
+ "row-mouseenter",
6597
+ "row-mouseleave",
6598
+ "expanded-rows-change",
6599
+ "edit-change"
6234
6600
  ],
6235
6601
  setup(props, { emit, attrs, slots }) {
6236
6602
  const tableElRef = ref(null);
@@ -6254,7 +6620,8 @@ const _sfc_main$B = defineComponent({
6254
6620
  clearSelectedRowKeys,
6255
6621
  getRowSelection,
6256
6622
  getSelectRows,
6257
- getSelectRowKeys
6623
+ getSelectRowKeys,
6624
+ setSelectedRowKeys
6258
6625
  } = useRowSelection(getProps, emit);
6259
6626
  const { getScrollRef, filterSource } = useTableScroll(getProps, tableElRef, getColumnsRef, getRowSelectionRef);
6260
6627
  function setProps(props2) {
@@ -6270,6 +6637,7 @@ const _sfc_main$B = defineComponent({
6270
6637
  getCacheColumns,
6271
6638
  getSelectRows,
6272
6639
  getSelectRowKeys,
6640
+ emit,
6273
6641
  getSize: () => {
6274
6642
  return unref(getBind).size;
6275
6643
  }
@@ -6284,6 +6652,12 @@ const _sfc_main$B = defineComponent({
6284
6652
  setPagination,
6285
6653
  clearSelectedRowKeys
6286
6654
  });
6655
+ const { customRow } = useCustomRow(getProps, {
6656
+ setSelectedRowKeys,
6657
+ getSelectRowKeys,
6658
+ clearSelectedRowKeys,
6659
+ emit
6660
+ });
6287
6661
  const getBind = computed(() => {
6288
6662
  return {
6289
6663
  ...attrs,
@@ -6296,7 +6670,8 @@ const _sfc_main$B = defineComponent({
6296
6670
  rowSelection: unref(getRowSelectionRef),
6297
6671
  rowKey: unref(getProps).rowKey,
6298
6672
  columns: unref(getViewColumns),
6299
- tableLayout: "fixed"
6673
+ tableLayout: "fixed",
6674
+ customRow
6300
6675
  };
6301
6676
  });
6302
6677
  createTableInstance({ ...tableAction, tableElRef, getBind });
@@ -6353,9 +6728,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6353
6728
  })
6354
6729
  ]), 1040, ["rowClassName", "onChange", "onResizeColumn"]);
6355
6730
  }
6356
- var DtTable = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render]]);
6731
+ var DtTable = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render]]);
6357
6732
  function useFetch(api, baseUrl = "") {
6358
- function fetch(params = {}) {
6733
+ function fetch(params) {
6359
6734
  let type, header = {}, model = {};
6360
6735
  if (isString(api)) {
6361
6736
  api = baseUrl + api;
@@ -6368,7 +6743,8 @@ function useFetch(api, baseUrl = "") {
6368
6743
  model = api.model;
6369
6744
  }
6370
6745
  return new Promise((resolve, reject) => {
6371
- http[type || "post"](api, Object.assign({}, model, params), {
6746
+ let param = isObject(params) ? Object.assign({}, model, params) : params;
6747
+ http[type || "post"](api, param, {
6372
6748
  ...header,
6373
6749
  ...{ onlyData: false }
6374
6750
  }).then((data) => {
@@ -6493,7 +6869,7 @@ function useSource(opt) {
6493
6869
  }
6494
6870
  function onAdd(model) {
6495
6871
  const { fetch } = useFetch(add, baseUrl);
6496
- fetch(model).then((rsp) => {
6872
+ return fetch(model).then((rsp) => {
6497
6873
  message.success("\u65B0\u589E\u6210\u529F");
6498
6874
  search();
6499
6875
  });
@@ -6504,14 +6880,15 @@ function useSource(opt) {
6504
6880
  }
6505
6881
  function onUpdate(model) {
6506
6882
  const { fetch } = useFetch(update, baseUrl);
6507
- fetch(model).then((rsp) => {
6883
+ return fetch(model).then((rsp) => {
6508
6884
  message.success("\u66F4\u65B0\u6570\u636E\u6210\u529F");
6509
6885
  search();
6510
6886
  });
6511
6887
  }
6512
6888
  function onDeletes(ids) {
6513
6889
  const { fetch } = useFetch(deletes, baseUrl);
6514
- fetch(ids).then((rsp) => {
6890
+ fetch(toRaw(ids)).then((rsp) => {
6891
+ message.success(`${ids.length > 1 ? "\u6279\u91CF" : ""} \u5220\u9664\u6210\u529F\uFF01`);
6515
6892
  search();
6516
6893
  });
6517
6894
  }
@@ -6565,9 +6942,9 @@ const basicProps = {
6565
6942
  type: Array,
6566
6943
  default: []
6567
6944
  },
6568
- actions: {
6945
+ footer: {
6569
6946
  type: Array,
6570
- default: []
6947
+ default: void 0
6571
6948
  },
6572
6949
  canFullscreen: {
6573
6950
  type: Boolean,
@@ -6581,14 +6958,15 @@ const basicProps = {
6581
6958
  type: Object
6582
6959
  }
6583
6960
  };
6584
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
6961
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
6585
6962
  __name: "dialog",
6586
6963
  props: {
6587
6964
  ...basicProps,
6588
6965
  ...{
6589
6966
  onRegister: { type: Function },
6590
6967
  formProps: {
6591
- type: Object
6968
+ type: Object,
6969
+ default: () => ({})
6592
6970
  },
6593
6971
  formsVal: {
6594
6972
  type: Object
@@ -6597,9 +6975,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6597
6975
  },
6598
6976
  setup(__props) {
6599
6977
  const props = __props;
6600
- const [registerDialog] = useModal({
6978
+ const [registerDialog, { closeModal }] = useModal({
6601
6979
  ...omit(toRaw(props), [
6602
- "actions",
6603
6980
  "curd",
6604
6981
  "formProps",
6605
6982
  "formsVal",
@@ -6609,7 +6986,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6609
6986
  destroyOnClose: true
6610
6987
  });
6611
6988
  const [registerForm, { getFormValues, setFormValues }] = useForm({
6612
- ...props.formProps.value || {},
6989
+ ...props.formProps || {},
6613
6990
  schemas: props.schemas,
6614
6991
  mode: "dialog"
6615
6992
  });
@@ -6622,7 +6999,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6622
6999
  var _a;
6623
7000
  if (props.curd && isFunction((_a = props.curd) == null ? void 0 : _a.onAdd)) {
6624
7001
  let obj = Object.assign({}, props.formsVal.value || {}, getFormValues());
6625
- obj.id ? props.curd.onUpdate(obj) : props.curd.onAdd(obj);
7002
+ let pro = obj.id ? props.curd.onUpdate(obj) : props.curd.onAdd(obj);
7003
+ pro.then((rsp) => closeModal());
6626
7004
  }
6627
7005
  }
6628
7006
  return (_ctx, _cache) => {
@@ -6641,8 +7019,6 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6641
7019
  function useCurd(curdOpt) {
6642
7020
  const formsVal = ref();
6643
7021
  const [register, {
6644
- closeModal,
6645
- setModalProps,
6646
7022
  openModal
6647
7023
  }] = useModalOut();
6648
7024
  const {
@@ -6651,7 +7027,7 @@ function useCurd(curdOpt) {
6651
7027
  const DtCurdModal = () => {
6652
7028
  return h(createVNode("div", {
6653
7029
  "class": "curdModal"
6654
- }, [createVNode(_sfc_main$A, mergeProps(curdOpt, {
7030
+ }, [createVNode(_sfc_main$z, mergeProps(curdOpt, {
6655
7031
  "formsVal": formsVal,
6656
7032
  "formProps": curdOpt.formProps,
6657
7033
  "onRegister": register
@@ -6717,9 +7093,9 @@ function useCurd(curdOpt) {
6717
7093
  update
6718
7094
  };
6719
7095
  }
6720
- const _hoisted_1$l = { class: "iframe-page" };
6721
- const _hoisted_2$d = ["src"];
6722
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
7096
+ const _hoisted_1$k = { class: "iframe-page" };
7097
+ const _hoisted_2$c = ["src"];
7098
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
6723
7099
  __name: "index",
6724
7100
  props: {
6725
7101
  showLoading: {
@@ -6741,7 +7117,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
6741
7117
  iframeWin.postMessage(props.postMsg, props.src);
6742
7118
  }
6743
7119
  return (_ctx, _cache) => {
6744
- return openBlock(), createElementBlock("div", _hoisted_1$l, [
7120
+ return openBlock(), createElementBlock("div", _hoisted_1$k, [
6745
7121
  createVNode(unref(Spin), {
6746
7122
  spinning: loading.value,
6747
7123
  size: "large"
@@ -6753,7 +7129,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
6753
7129
  ref_key: "frameRef",
6754
7130
  ref: frameRef,
6755
7131
  onLoad: _cache[0] || (_cache[0] = ($event) => afterLoaded())
6756
- }, null, 40, _hoisted_2$d)
7132
+ }, null, 40, _hoisted_2$c)
6757
7133
  ]),
6758
7134
  _: 1
6759
7135
  }, 8, ["spinning"])
@@ -6784,8 +7160,7 @@ const basicUploadProps = {
6784
7160
  default: () => []
6785
7161
  },
6786
7162
  maxSize: {
6787
- type: Number,
6788
- default: 2
7163
+ type: Number
6789
7164
  },
6790
7165
  maxNumber: {
6791
7166
  type: Number,
@@ -6794,6 +7169,10 @@ const basicUploadProps = {
6794
7169
  defaultFiles: {
6795
7170
  type: Array,
6796
7171
  default: []
7172
+ },
7173
+ showView: {
7174
+ type: Boolean,
7175
+ default: false
6797
7176
  }
6798
7177
  };
6799
7178
  function useHelpers(acceptRef, helpTextRef, maxNumberRef, maxSizeRef) {
@@ -6812,8 +7191,29 @@ function useHelpers(acceptRef, helpTextRef, maxNumberRef, maxSizeRef) {
6812
7191
  return `.${item}`;
6813
7192
  }).join(",");
6814
7193
  });
7194
+ const getHelpText = computed(() => {
7195
+ const helpText = unref(helpTextRef);
7196
+ if (helpText) {
7197
+ return helpText;
7198
+ }
7199
+ const helpTexts = [];
7200
+ const accept = unref(acceptRef);
7201
+ if (accept.length > 0) {
7202
+ helpTexts.push(`\u652F\u6301${accept.join(",")}\u683C\u5F0F`);
7203
+ }
7204
+ const maxSize = unref(maxSizeRef);
7205
+ if (maxSize) {
7206
+ helpTexts.push(`\u4E0D\u8D85\u8FC7${maxSize}M`);
7207
+ }
7208
+ const maxNumber = unref(maxNumberRef);
7209
+ if (maxNumber && maxNumber !== Infinity) {
7210
+ helpTexts.push(`\u6700\u591A\u53EF\u9009\u62E9${maxNumber}\u4E2A\u6587\u4EF6`);
7211
+ }
7212
+ return helpTexts.join(",") || "\u8BF7\u4E0A\u4F20pptx\u3001doc\u3001jpg\u3001jpeg\u3001png\u3001bmp\u3001gif\u3001xls\u3001xlsx\u3001txt\u3001rar\u3001zip\u30017z\u3001tar\u3001gz\u683C\u5F0F\u6587\u4EF6";
7213
+ });
6815
7214
  return {
6816
- getStringAccept
7215
+ getStringAccept,
7216
+ getHelpText
6817
7217
  };
6818
7218
  }
6819
7219
  var sparkMd5 = { exports: {} };
@@ -7225,12 +7625,12 @@ var sparkMd5 = { exports: {} };
7225
7625
  return SparkMD5;
7226
7626
  });
7227
7627
  })(sparkMd5);
7228
- const _hoisted_1$k = { class: "file-header" };
7229
- const _hoisted_2$c = /* @__PURE__ */ createTextVNode(" \u6587\u4EF6\u4E0A\u4F20 ");
7230
- const _hoisted_3$6 = /* @__PURE__ */ createTextVNode(" \u6A21\u677F\u4E0B\u8F7D ");
7231
- const _hoisted_4$4 = { class: "file-type-tips ant-alert-info" };
7232
- const _hoisted_5$3 = /* @__PURE__ */ createElementVNode("i", null, "\u8BF7\u4E0A\u4F20pptx\u3001doc\u3001jpg\u3001jpeg\u3001png\u3001bmp\u3001gif\u3001xls\u3001xlsx\u3001txt\u3001rar\u3001zip\u30017z\u3001tar\u3001gz\u683C\u5F0F\u6587\u4EF6", -1);
7233
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
7628
+ const _hoisted_1$j = { class: "dt-file" };
7629
+ const _hoisted_2$b = { class: "file-header" };
7630
+ const _hoisted_3$6 = /* @__PURE__ */ createTextVNode(" \u6587\u4EF6\u4E0A\u4F20 ");
7631
+ const _hoisted_4$4 = /* @__PURE__ */ createTextVNode(" \u6A21\u677F\u4E0B\u8F7D ");
7632
+ const _hoisted_5$3 = { class: "file-type-tips ant-alert-info" };
7633
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7234
7634
  __name: "upload",
7235
7635
  props: basicUploadProps,
7236
7636
  setup(__props, { expose }) {
@@ -7238,22 +7638,25 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7238
7638
  const { message } = useMessage();
7239
7639
  const filesRef = ref([]);
7240
7640
  const historyFilesRef = ref([]);
7241
- const allFilesRef = ref([]);
7641
+ const allFilesRef = computed(() => {
7642
+ return [...historyFilesRef.value, ...filesRef.value];
7643
+ });
7242
7644
  const imgVisable = ref(false);
7645
+ const imgSrcRef = ref();
7243
7646
  const setImgVisible = (value) => imgVisable.value = value;
7244
7647
  const { accept, helpText, maxNumber, maxSize } = toRefs(props);
7245
- const { getStringAccept } = useHelpers(accept);
7246
- const [registerTable, {}] = useTable({
7648
+ const {
7649
+ getStringAccept,
7650
+ getHelpText
7651
+ } = useHelpers(accept, helpText, maxNumber, maxSize);
7652
+ const isImage = (fileType) => ["pdf", "jpg", "jpeg", "png", "bmp", "gif"].includes(fileType);
7653
+ const [registerTable] = useTable({
7247
7654
  tableSetting: false,
7248
7655
  pagination: false,
7249
7656
  dataSource: allFilesRef,
7250
7657
  columns: [
7251
7658
  { title: "\u6587\u4EF6\u540D\u79F0", dataIndex: "fileName" },
7252
- { title: "\u4E0A\u4F20\u72B6\u6001", dataIndex: "fileStatue", render(row) {
7253
- return h("span", {
7254
- style: `color: ${row.status === 0 ? "orange" : "green"}`
7255
- }, row.fileStatue);
7256
- } }
7659
+ { title: "\u4E0A\u4F20\u72B6\u6001", dataIndex: "fileStatue", className: "orange" }
7257
7660
  ],
7258
7661
  operations: {
7259
7662
  expand: true,
@@ -7262,28 +7665,40 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7262
7665
  title: "\u9884\u89C8",
7263
7666
  icon: "ic:baseline-remove-red-eye",
7264
7667
  ifShow(row) {
7265
- const supportFileTypes = ["pdf", "jpg", "jpeg", "png", "bmp", "gif"];
7266
- return supportFileTypes.includes(row.fileName.split(".").pop());
7668
+ if (!props.showView)
7669
+ return false;
7670
+ return isImage(row.fileName.split(".").pop());
7267
7671
  },
7268
- action: () => {
7269
- setImgVisible(true);
7672
+ action: ({ row }) => {
7673
+ if (isImage(row.fileName.split(".").pop())) {
7674
+ setImgVisible(true);
7675
+ }
7270
7676
  }
7271
7677
  },
7272
- { title: "\u7F16\u8F91", icon: "mdi:text-box-edit-outline" },
7273
- { title: "\u5220\u9664", icon: "mdi:delete-outline" }
7678
+ { title: "\u5220\u9664", icon: "mdi:delete-outline", action: ({ row }) => {
7679
+ if (!row.status)
7680
+ historyFilesRef.value = historyFilesRef.value.filter((it) => it.fileId !== row.fileId);
7681
+ else {
7682
+ filesRef.value = filesRef.value.filter((it) => it.fileId !== row.fileId);
7683
+ }
7684
+ } }
7274
7685
  ]
7275
7686
  }
7276
7687
  });
7277
- watchEffect(() => {
7278
- historyFilesRef.value = props.defaultFiles.map((file) => {
7279
- return {
7280
- ...file,
7281
- fileName: file.fileName,
7282
- status: 0,
7283
- fileStatue: "\u5386\u53F2\u4E0A\u4F20"
7284
- };
7285
- });
7286
- allFilesRef.value = [...historyFilesRef.value, ...filesRef.value];
7688
+ watch(() => props.defaultFiles, (v) => {
7689
+ if (v) {
7690
+ historyFilesRef.value = props.defaultFiles.map((file, index) => {
7691
+ return {
7692
+ ...file,
7693
+ fileId: file.id || index,
7694
+ fileName: file.fileName,
7695
+ status: 0,
7696
+ fileStatue: "\u5386\u53F2\u4E0A\u4F20"
7697
+ };
7698
+ });
7699
+ }
7700
+ }, {
7701
+ immediate: true
7287
7702
  });
7288
7703
  function beforeUpload(file) {
7289
7704
  const { maxSize: maxSize2 } = props;
@@ -7303,13 +7718,19 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7303
7718
  if (currentChunk < chunks) {
7304
7719
  loadNext();
7305
7720
  } else {
7306
- filesRef.value.push({
7721
+ let fileObj = {
7307
7722
  fileName: file.name,
7308
7723
  fileId: spark.end(),
7309
7724
  file,
7310
7725
  status: 1,
7311
7726
  fileStatue: "\u5F85\u4E0A\u4F20"
7312
- });
7727
+ };
7728
+ if (props.multiple) {
7729
+ filesRef.value.push(fileObj);
7730
+ } else {
7731
+ historyFilesRef.value = [];
7732
+ filesRef.value = [fileObj];
7733
+ }
7313
7734
  }
7314
7735
  };
7315
7736
  function loadNext() {
@@ -7323,8 +7744,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7323
7744
  });
7324
7745
  return (_ctx, _cache) => {
7325
7746
  const _directive_icon = resolveDirective("icon");
7326
- return openBlock(), createElementBlock(Fragment, null, [
7327
- createElementVNode("div", _hoisted_1$k, [
7747
+ return openBlock(), createElementBlock("div", _hoisted_1$j, [
7748
+ createElementVNode("div", _hoisted_2$b, [
7328
7749
  createElementVNode("div", null, [
7329
7750
  createVNode(unref(Upload), {
7330
7751
  accept: unref(getStringAccept),
@@ -7338,7 +7759,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7338
7759
  withDirectives(createElementVNode("span", null, null, 512), [
7339
7760
  [_directive_icon, "ic:baseline-file-upload"]
7340
7761
  ]),
7341
- _hoisted_2$c
7762
+ _hoisted_3$6
7342
7763
  ]),
7343
7764
  _: 1
7344
7765
  })
@@ -7354,18 +7775,18 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7354
7775
  withDirectives(createElementVNode("span", null, null, 512), [
7355
7776
  [_directive_icon, "ic:baseline-file-download"]
7356
7777
  ]),
7357
- _hoisted_3$6
7778
+ _hoisted_4$4
7358
7779
  ]),
7359
7780
  _: 1
7360
7781
  }, 8, ["onClick"])) : createCommentVNode("", true)
7361
7782
  ]),
7362
7783
  renderSlot(_ctx.$slots, "default")
7363
7784
  ]),
7364
- createElementVNode("div", _hoisted_4$4, [
7785
+ createElementVNode("div", _hoisted_5$3, [
7365
7786
  withDirectives(createElementVNode("span", null, null, 512), [
7366
7787
  [_directive_icon, "ant-design:info-circle-outlined"]
7367
7788
  ]),
7368
- _hoisted_5$3
7789
+ createElementVNode("i", null, toDisplayString(unref(getHelpText)), 1)
7369
7790
  ]),
7370
7791
  createVNode(unref(DtTable), { onRegister: unref(registerTable) }, null, 8, ["onRegister"]),
7371
7792
  createVNode(unref(Image), {
@@ -7375,52 +7796,9 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7375
7796
  visible: imgVisable.value,
7376
7797
  onVisibleChange: setImgVisible
7377
7798
  },
7378
- src: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
7379
- }, null, 8, ["preview"])
7380
- ], 64);
7381
- };
7382
- }
7383
- });
7384
- const _hoisted_1$j = { class: "dt-upload-wrap" };
7385
- const _hoisted_2$b = /* @__PURE__ */ createTextVNode(" 111 ");
7386
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
7387
- __name: "index",
7388
- emits: ["register"],
7389
- setup(__props, { emit: emites }) {
7390
- const uploadRef = ref(null);
7391
- const [register] = useModal({
7392
- width: "700px",
7393
- title: "\u6587\u4EF6\u4E0A\u4F20",
7394
- maskClosable: false
7395
- });
7396
- const defaultFiles = [
7397
- { fileName: "\u53EE\u549A\u53D1\u7968667.09.pdf", fileId: "1" }
7398
- ];
7399
- function handleSave() {
7400
- console.log(uploadRef.value.allFilesRef);
7401
- alert("s-s-s-");
7402
- }
7403
- return (_ctx, _cache) => {
7404
- return openBlock(), createBlock(unref(_sfc_main$K), {
7405
- onSave: _cache[0] || (_cache[0] = ($event) => handleSave()),
7406
- onRegister: unref(register)
7407
- }, {
7408
- default: withCtx(() => [
7409
- createElementVNode("div", _hoisted_1$j, [
7410
- createVNode(_sfc_main$y, {
7411
- ref_key: "uploadRef",
7412
- ref: uploadRef,
7413
- defaultFiles
7414
- }, {
7415
- default: withCtx(() => [
7416
- _hoisted_2$b
7417
- ]),
7418
- _: 1
7419
- }, 512)
7420
- ])
7421
- ]),
7422
- _: 1
7423
- }, 8, ["onRegister"]);
7799
+ src: imgSrcRef.value
7800
+ }, null, 8, ["preview", "src"])
7801
+ ]);
7424
7802
  };
7425
7803
  }
7426
7804
  });
@@ -8220,11 +8598,10 @@ var _sfc_main$v = /* @__PURE__ */ defineComponent({
8220
8598
  const dtComponents = [
8221
8599
  { name: "dt-base-router", component: DtBaseRouter },
8222
8600
  { name: "dt-icon", component: DtIcon },
8223
- { name: "dt-pick-icon", component: _sfc_main$V },
8601
+ { name: "dt-pick-icon", component: _sfc_main$W },
8224
8602
  { name: "dt-modal", component: _sfc_main$K },
8225
8603
  { name: "dt-form", component: DtForm },
8226
- { name: "dt-upload", component: _sfc_main$y },
8227
- { name: "dt-upload-modal", component: _sfc_main$x },
8604
+ { name: "dt-upload", component: _sfc_main$x },
8228
8605
  { name: "dt-tree", component: _sfc_main$v }
8229
8606
  ];
8230
8607
  function initComponents() {
@@ -9513,7 +9890,7 @@ var _sfc_main$b = defineComponent({
9513
9890
  }), null);
9514
9891
  }
9515
9892
  return () => {
9516
- return createVNode(Fragment, null, [renderHeader(), unref(getUseScroll) ? createVNode(_sfc_main$T, null, {
9893
+ return createVNode(Fragment, null, [renderHeader(), unref(getUseScroll) ? createVNode(_sfc_main$U, null, {
9517
9894
  default: () => renderMenu()
9518
9895
  }) : renderMenu()]);
9519
9896
  };
@@ -10357,7 +10734,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10357
10734
  }, {
10358
10735
  default: withCtx(() => [
10359
10736
  unref(getShowSidebar) ? (openBlock(), createBlock(_sfc_main$7, { key: 0 })) : createCommentVNode("", true),
10360
- createVNode(unref(_sfc_main$T), {
10737
+ createVNode(unref(_sfc_main$U), {
10361
10738
  ref_key: "wrapperRef",
10362
10739
  ref: wrapperRef,
10363
10740
  class: normalizeClass({ "fixedWrap": unref(getFixed) })
@@ -10390,4 +10767,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10390
10767
  };
10391
10768
  }
10392
10769
  });
10393
- export { DtBaseRouter, DtForm, DtIcon, _sfc_main$z as DtIframe, _sfc_main$K as DtModal, _sfc_main$V as DtPickIcon, DtTable, _sfc_main as DtTheme, _sfc_main$v as DtTree, _sfc_main$y as DtUpload, _sfc_main$x as DtUploadModal, FormButtons, authMounted, export2Excel, iconMounted, initComponents, initDirectives, useCurd, useForm, useModal, useModalOut, useSource, useTable };
10770
+ export { DtBaseRouter, DtForm, DtIcon, _sfc_main$y as DtIframe, _sfc_main$K as DtModal, _sfc_main$W as DtPickIcon, DtTable, _sfc_main as DtTheme, _sfc_main$v as DtTree, _sfc_main$x as DtUpload, FormButtons, authMounted, export2Excel, iconMounted, initComponents, initDirectives, useCurd, useForm, useModal, useModalOut, useSource, useTable };