@dt-frames/ui 1.0.10 → 1.0.11

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 (37) hide show
  1. package/es/components/curd/src/components/dialog.d.ts +1 -0
  2. package/es/components/forms/src/components/formIcon.d.ts +1 -1
  3. package/es/components/modal/src/types/modal.type.d.ts +1 -1
  4. package/es/components/source/src/hooks/useFetch.d.ts +2 -2
  5. package/es/components/source/src/hooks/useSource.d.ts +4 -4
  6. package/es/components/table/src/components/TableHeader.d.ts +2 -2
  7. package/es/components/table/src/components/editable/CellComponent.d.ts +14 -0
  8. package/es/components/table/src/components/editable/EditTableCell.d.ts +88 -0
  9. package/es/components/table/src/components/editable/componentMap.d.ts +4 -0
  10. package/es/components/table/src/components/editable/index.d.ts +9 -0
  11. package/es/components/table/src/index.d.ts +7 -3
  12. package/es/components/table/src/props.d.ts +1 -1
  13. package/es/components/table/src/types/table.type.d.ts +16 -0
  14. package/es/components/upload/src/index.d.ts +7 -3
  15. package/es/components/upload/src/upload.d.ts +7 -3
  16. package/es/index.js +318 -73
  17. package/es/style/components/table/index.less +6 -0
  18. package/es/style/theme/header/index.less +1 -1
  19. package/package.json +1 -1
  20. package/src/components/curd/src/components/dialog.vue +4 -2
  21. package/src/components/modal/src/hooks/useModal.ts +5 -3
  22. package/src/components/modal/src/index.vue +1 -1
  23. package/src/components/modal/src/types/modal.type.ts +1 -1
  24. package/src/components/source/src/hooks/useFetch.ts +6 -4
  25. package/src/components/source/src/hooks/useSource.ts +4 -3
  26. package/src/components/table/index.less +6 -0
  27. package/src/components/table/src/components/TableHeader.vue +2 -2
  28. package/src/components/table/src/components/editable/CellComponent.ts +57 -0
  29. package/src/components/table/src/components/editable/EditTableCell.vue +181 -0
  30. package/src/components/table/src/components/editable/componentMap.ts +18 -0
  31. package/src/components/table/src/components/editable/index.ts +58 -0
  32. package/src/components/table/src/hooks/useColumns.ts +15 -8
  33. package/src/components/table/src/hooks/useTableHeader.ts +2 -2
  34. package/src/components/table/src/index.vue +6 -1
  35. package/src/components/table/src/props.ts +1 -1
  36. package/src/components/table/src/types/table.type.ts +28 -1
  37. package/src/theme/header/index.less +1 -1
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
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";
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";
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
4
  import { isEqual, cloneDeep, upperFirst, set, uniqBy, omit, 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";
@@ -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"];
1877
+ const _hoisted_1$v = ["onClick"];
1878
1878
  const _hoisted_2$l = ["onClick"];
1879
- const _sfc_main$V = /* @__PURE__ */ defineComponent({
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", {
@@ -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,
@@ -2797,9 +2798,9 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
2797
2798
  ]),
2798
2799
  _: 1
2799
2800
  }),
2800
- createVNode(unref(_sfc_main$K), { onRegister: unref(register) }, {
2801
+ createVNode(unref(_sfc_main$L), { 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
  ]),
@@ -2834,11 +2835,11 @@ const components = {
2834
2835
  Slider,
2835
2836
  Rate,
2836
2837
  Divider,
2837
- Icon: _sfc_main$Q
2838
+ Icon: _sfc_main$R
2838
2839
  };
2839
- const componentMap = /* @__PURE__ */ new Map();
2840
+ const componentMap$1 = /* @__PURE__ */ new Map();
2840
2841
  for (let item in components) {
2841
- componentMap.set(item, components[item]);
2842
+ componentMap$1.set(item, components[item]);
2842
2843
  }
2843
2844
  function createPlaceholder(component) {
2844
2845
  if (component.includes("Input") || component.includes("Complete")) {
@@ -2942,7 +2943,7 @@ const FormItemProps = {
2942
2943
  function _isSlot(s) {
2943
2944
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
2944
2945
  }
2945
- var _sfc_main$P = defineComponent({
2946
+ var _sfc_main$Q = defineComponent({
2946
2947
  name: "FormItem",
2947
2948
  inheritAttrs: false,
2948
2949
  props: FormItemProps,
@@ -3184,7 +3185,7 @@ var _sfc_main$P = defineComponent({
3184
3185
  ...bindValue,
3185
3186
  ...on2
3186
3187
  };
3187
- const Comp = componentMap.get(component);
3188
+ const Comp = componentMap$1.get(component);
3188
3189
  if (!renderComponent) {
3189
3190
  return createVNode(Comp, compAttr, null);
3190
3191
  }
@@ -3329,7 +3330,7 @@ function initDirectives() {
3329
3330
  }
3330
3331
  };
3331
3332
  }
3332
- const _sfc_main$O = defineComponent({
3333
+ const _sfc_main$P = defineComponent({
3333
3334
  name: "form-buttons",
3334
3335
  props: {
3335
3336
  mode: {
@@ -3416,7 +3417,7 @@ const _sfc_main$O = defineComponent({
3416
3417
  };
3417
3418
  }
3418
3419
  });
3419
- const _hoisted_1$s = {
3420
+ const _hoisted_1$t = {
3420
3421
  key: 0,
3421
3422
  className: "preIcon"
3422
3423
  };
@@ -3425,7 +3426,7 @@ const _hoisted_2$k = {
3425
3426
  className: "preIcon"
3426
3427
  };
3427
3428
  const _hoisted_3$c = { class: "text" };
3428
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3429
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
3429
3430
  const _component_Button = resolveComponent("Button");
3430
3431
  const _component_DtIcon = resolveComponent("DtIcon");
3431
3432
  const _component_FormItem = resolveComponent("FormItem");
@@ -3452,7 +3453,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3452
3453
  onClick: ($event) => _ctx.handleBtnClick(button)
3453
3454
  }, {
3454
3455
  icon: withCtx(() => [
3455
- button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1$s, null, 512)), [
3456
+ button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1$t, null, 512)), [
3456
3457
  [_directive_icon, button.preIcon]
3457
3458
  ]) : createCommentVNode("", true)
3458
3459
  ]),
@@ -3492,7 +3493,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3492
3493
  _: 1
3493
3494
  }, 16)) : createCommentVNode("", true);
3494
3495
  }
3495
- var FormButtons = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$4]]);
3496
+ var FormButtons = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["render", _sfc_render$5]]);
3496
3497
  const isArray = Array.isArray;
3497
3498
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3498
3499
  var dayjs_min = { exports: {} };
@@ -3965,12 +3966,12 @@ function useFormActions(opt) {
3965
3966
  }
3966
3967
  return [handleMethod];
3967
3968
  }
3968
- const _sfc_main$N = defineComponent({
3969
+ const _sfc_main$O = defineComponent({
3969
3970
  name: "dt-form",
3970
3971
  components: {
3971
3972
  Form,
3972
3973
  Row,
3973
- FormItem: _sfc_main$P,
3974
+ FormItem: _sfc_main$Q,
3974
3975
  FormButtons
3975
3976
  },
3976
3977
  props: BasicProps$1,
@@ -4154,7 +4155,7 @@ const _sfc_main$N = defineComponent({
4154
4155
  };
4155
4156
  }
4156
4157
  });
4157
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
4158
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
4158
4159
  const _component_FormItem = resolveComponent("FormItem");
4159
4160
  const _component_FormButtons = resolveComponent("FormButtons");
4160
4161
  const _component_Row = resolveComponent("Row");
@@ -4199,7 +4200,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
4199
4200
  _: 3
4200
4201
  }, 16, ["class", "model", "layout"]);
4201
4202
  }
4202
- var DtForm = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$3]]);
4203
+ var DtForm = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$4]]);
4203
4204
  function useForm(props) {
4204
4205
  const formRef = ref(null);
4205
4206
  const loadedRef = ref(false);
@@ -4272,7 +4273,7 @@ function useForm(props) {
4272
4273
  };
4273
4274
  return [registerForm, methods];
4274
4275
  }
4275
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
4276
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4276
4277
  __name: "modalFooter",
4277
4278
  props: {
4278
4279
  showSave: {
@@ -4311,7 +4312,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4311
4312
  };
4312
4313
  }
4313
4314
  });
4314
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
4315
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4315
4316
  __name: "close-icon",
4316
4317
  props: {
4317
4318
  canFullscreen: { type: Boolean, default: true },
@@ -4376,7 +4377,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4376
4377
  };
4377
4378
  }
4378
4379
  });
4379
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
4380
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4380
4381
  __name: "index",
4381
4382
  props: basicProps$1,
4382
4383
  emits: ["visible-change", "height-change", "cancel", "save", "register", "update:visible"],
@@ -4459,7 +4460,6 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4459
4460
  }
4460
4461
  function handleSave() {
4461
4462
  emits("save");
4462
- handleCancel();
4463
4463
  }
4464
4464
  async function handleCancel(e = null) {
4465
4465
  var _a, _b;
@@ -4479,7 +4479,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4479
4479
  return (_ctx, _cache) => {
4480
4480
  return openBlock(), createBlock(unref(Modal), mergeProps(unref(getBindValue), { onCancel: handleCancel }), createSlots({
4481
4481
  default: withCtx(() => [
4482
- createVNode(_sfc_main$S, mergeProps({
4482
+ createVNode(_sfc_main$T, mergeProps({
4483
4483
  useWrapper: unref(getBindValue).useWrapper,
4484
4484
  footerOffset: _ctx.wrapperFooterOffset,
4485
4485
  fullScreen: unref(fullScreenRef),
@@ -4506,7 +4506,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4506
4506
  !_ctx.$slots.closeIcon ? {
4507
4507
  name: "closeIcon",
4508
4508
  fn: withCtx(() => [
4509
- createVNode(_sfc_main$L, {
4509
+ createVNode(_sfc_main$M, {
4510
4510
  canFullscreen: unref(getBindValue).canFullscreen,
4511
4511
  fullScreen: unref(fullScreenRef),
4512
4512
  onCancel: handleCancel,
@@ -4523,7 +4523,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4523
4523
  !_ctx.$slots.footer ? {
4524
4524
  name: "footer",
4525
4525
  fn: withCtx(() => [
4526
- createVNode(_sfc_main$M, {
4526
+ createVNode(_sfc_main$N, {
4527
4527
  showSave: unref(getBindValue).showSave,
4528
4528
  onHandleSave: handleSave,
4529
4529
  onHandleCancel: handleCancel
@@ -4988,7 +4988,7 @@ function useRowSelection(propsRef, emit) {
4988
4988
  setSelectedRowKeys
4989
4989
  };
4990
4990
  }
4991
- var _sfc_main$J = defineComponent({
4991
+ var _sfc_main$K = defineComponent({
4992
4992
  name: "TableFormat",
4993
4993
  props: {
4994
4994
  column: {
@@ -5060,6 +5060,236 @@ function createTableInstance(instance) {
5060
5060
  function getTableInstance() {
5061
5061
  return inject(tableKey);
5062
5062
  }
5063
+ const componentMap = /* @__PURE__ */ new Map();
5064
+ componentMap.set("Input", Input);
5065
+ componentMap.set("InputNumber", InputNumber);
5066
+ componentMap.set("Select", Select);
5067
+ componentMap.set("TreeSelect", TreeSelect);
5068
+ componentMap.set("Switch", Switch);
5069
+ componentMap.set("Checkbox", Checkbox);
5070
+ componentMap.set("DatePicker", DatePicker);
5071
+ componentMap.set("TimePicker", TimePicker);
5072
+ const CellComponent = ({
5073
+ component = "Input",
5074
+ rule = true,
5075
+ ruleMessage,
5076
+ popoverVisible,
5077
+ getPopupContainer: getPopupContainer2
5078
+ }, { attrs }) => {
5079
+ const Comp = componentMap.get(component);
5080
+ const DefaultComp = h(Comp, attrs);
5081
+ if (!rule)
5082
+ return DefaultComp;
5083
+ return h(Popover, {
5084
+ overlayClassName: "edit-cell-rule-popover",
5085
+ visible: !!popoverVisible,
5086
+ ...getPopupContainer2 ? { getPopupContainer: getPopupContainer2 } : {}
5087
+ }, {
5088
+ default: () => DefaultComp,
5089
+ content: () => ruleMessage
5090
+ });
5091
+ };
5092
+ var _sfc_main$J = defineComponent({
5093
+ name: "EditableCell",
5094
+ components: {
5095
+ Spin,
5096
+ CellComponent
5097
+ },
5098
+ props: {
5099
+ value: {
5100
+ type: [String, Number, Boolean, Object],
5101
+ default: ""
5102
+ },
5103
+ record: {
5104
+ type: Object
5105
+ },
5106
+ column: {
5107
+ type: Object,
5108
+ default: () => ({})
5109
+ },
5110
+ index: Number
5111
+ },
5112
+ setup(props) {
5113
+ const table = getTableInstance();
5114
+ ref();
5115
+ const {
5116
+ editRule,
5117
+ align = "left"
5118
+ } = props.column;
5119
+ const ruleMessage = ref("");
5120
+ const ruleVisible = ref(false);
5121
+ const optionsRef = ref([]);
5122
+ const currentValueRef = ref(props.value);
5123
+ const getComponent = computed(() => {
5124
+ var _a;
5125
+ return ((_a = props.column) == null ? void 0 : _a.editComponent) || "Input";
5126
+ });
5127
+ const getRuleVisible = computed(() => {
5128
+ return unref(ruleMessage) && unref(ruleVisible);
5129
+ });
5130
+ const getWrapperClass = computed(() => {
5131
+ return `edit-cell-align-${align}`;
5132
+ });
5133
+ const getIsCheckComp = computed(() => {
5134
+ const component = unref(getComponent);
5135
+ return ["Checkbox", "Switch"].includes(component);
5136
+ });
5137
+ const createPlaceholderMessage = (component) => {
5138
+ if (component.includes("Input")) {
5139
+ return "\u8BF7\u8F93\u5165";
5140
+ }
5141
+ return "\u8BF7\u9009\u62E9";
5142
+ };
5143
+ const getComponentProps = computed(() => {
5144
+ var _a, _b, _c;
5145
+ const isCheckValue = unref(getIsCheckComp);
5146
+ const valueField = isCheckValue ? "checked" : "value";
5147
+ const val = unref(currentValueRef);
5148
+ const value = isCheckValue ? isNumber(val) && isBoolean(val) ? val : !!val : val;
5149
+ let compProps = (_b = (_a = props.column) == null ? void 0 : _a.editComponentProps) != null ? _b : {};
5150
+ const {
5151
+ record,
5152
+ column,
5153
+ index
5154
+ } = props;
5155
+ if (isFunction$1(compProps)) {
5156
+ compProps = (_c = compProps({
5157
+ text: val,
5158
+ record,
5159
+ column,
5160
+ index
5161
+ })) != null ? _c : {};
5162
+ }
5163
+ return {
5164
+ size: "small",
5165
+ getPopupContainer: () => document.body,
5166
+ placeholder: createPlaceholderMessage(unref(getComponent)),
5167
+ ...omit(compProps, "onChange"),
5168
+ [valueField]: value
5169
+ };
5170
+ });
5171
+ async function handleChange(e) {
5172
+ var _a, _b;
5173
+ const component = unref(getComponent);
5174
+ if (!e) {
5175
+ currentValueRef.value = e;
5176
+ } else if (component === "Checkbox") {
5177
+ currentValueRef.value = e.target.checked;
5178
+ } else if (component === "Switch") {
5179
+ currentValueRef.value = e;
5180
+ } else if ((e == null ? void 0 : e.target) && Reflect.has(e.target, "value")) {
5181
+ currentValueRef.value = e.target.value;
5182
+ } else if (isString(e) || isBoolean(e) || isNumber(e)) {
5183
+ currentValueRef.value = e;
5184
+ }
5185
+ const onChange = (_a = unref(getComponentProps)) == null ? void 0 : _a.onChange;
5186
+ if (onChange && isFunction$1(onChange))
5187
+ onChange(...arguments);
5188
+ (_b = table.emit) == null ? void 0 : _b.call(table, "edit-change", {
5189
+ column: props.column,
5190
+ value: unref(currentValueRef),
5191
+ record: toRaw(props.record)
5192
+ });
5193
+ handleSubmitRule();
5194
+ }
5195
+ async function handleSubmitRule() {
5196
+ const {
5197
+ column,
5198
+ record
5199
+ } = props;
5200
+ const {
5201
+ editRule: editRule2
5202
+ } = column;
5203
+ const currentValue = unref(currentValueRef);
5204
+ if (editRule2) {
5205
+ if (isBoolean(editRule2) && !currentValue && !isNumber(currentValue)) {
5206
+ ruleVisible.value = true;
5207
+ const component = unref(getComponent);
5208
+ ruleMessage.value = createPlaceholderMessage(component);
5209
+ return false;
5210
+ }
5211
+ if (isFunction$1(editRule2)) {
5212
+ const res = await editRule2(currentValue, record);
5213
+ if (!!res) {
5214
+ ruleMessage.value = res;
5215
+ ruleVisible.value = true;
5216
+ return false;
5217
+ }
5218
+ }
5219
+ }
5220
+ ruleMessage.value = "";
5221
+ return true;
5222
+ }
5223
+ function handleOptionsChange(options) {
5224
+ optionsRef.value = options;
5225
+ }
5226
+ return {
5227
+ props,
5228
+ getComponentProps,
5229
+ getRuleVisible,
5230
+ editRule,
5231
+ ruleMessage,
5232
+ getWrapperClass,
5233
+ handleChange,
5234
+ handleOptionsChange
5235
+ };
5236
+ }
5237
+ });
5238
+ const _hoisted_1$s = { class: "editable-cell" };
5239
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
5240
+ var _a;
5241
+ const _component_CellComponent = resolveComponent("CellComponent");
5242
+ return openBlock(), createElementBlock("div", _hoisted_1$s, [
5243
+ createVNode(_component_CellComponent, mergeProps({ ref: "elRef" }, _ctx.getComponentProps, {
5244
+ component: (_a = _ctx.column) == null ? void 0 : _a.editComponent,
5245
+ popoverVisible: _ctx.getRuleVisible,
5246
+ rule: _ctx.editRule,
5247
+ ruleMessage: _ctx.ruleMessage,
5248
+ class: _ctx.getWrapperClass,
5249
+ onChange: _ctx.handleChange,
5250
+ onOptionsChange: _ctx.handleOptionsChange
5251
+ }), null, 16, ["component", "popoverVisible", "rule", "ruleMessage", "class", "onChange", "onOptionsChange"])
5252
+ ]);
5253
+ }
5254
+ var EditableCell = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$3]]);
5255
+ function renderEditCell(column) {
5256
+ return ({ text: value, record, index }) => {
5257
+ record.onValid = async () => {
5258
+ if (isArray$1(record == null ? void 0 : record.validCbs)) {
5259
+ const validFns = ((record == null ? void 0 : record.validCbs) || []).map((fn) => fn());
5260
+ const res = await Promise.all(validFns);
5261
+ return res.every((item) => !!item);
5262
+ }
5263
+ return false;
5264
+ };
5265
+ record.onEdit = async (edit, submit = false) => {
5266
+ var _a, _b;
5267
+ if (!submit) {
5268
+ record.editable = edit;
5269
+ }
5270
+ if (!edit && submit) {
5271
+ if (!await record.onValid())
5272
+ return false;
5273
+ const res = await ((_a = record.onSubmitEdit) == null ? void 0 : _a.call(record));
5274
+ if (res) {
5275
+ record.editable = false;
5276
+ return true;
5277
+ }
5278
+ return false;
5279
+ }
5280
+ if (!edit && !submit) {
5281
+ (_b = record.onCancelEdit) == null ? void 0 : _b.call(record);
5282
+ }
5283
+ return true;
5284
+ };
5285
+ return h(EditableCell, {
5286
+ value,
5287
+ record,
5288
+ column,
5289
+ index
5290
+ });
5291
+ };
5292
+ }
5063
5293
  const _hoisted_1$r = { class: "dt-table-action-btn" };
5064
5294
  const _hoisted_2$j = ["color", "onClick"];
5065
5295
  const _sfc_main$I = /* @__PURE__ */ defineComponent({
@@ -5288,12 +5518,11 @@ function handleActionColumn(propsRef, columns) {
5288
5518
  columns.push({
5289
5519
  ...columnObj,
5290
5520
  customRender: ({ record, index }) => {
5291
- return h(_sfc_main$I, {
5521
+ return h(_sfc_main$I, omit({
5292
5522
  ...columnObj,
5293
5523
  record,
5294
- align: null,
5295
5524
  index
5296
- });
5525
+ }, "align"));
5297
5526
  }
5298
5527
  });
5299
5528
  }
@@ -5323,7 +5552,12 @@ function useColumns(propsRef, getPaginationRef) {
5323
5552
  const getViewColumns = computed(() => {
5324
5553
  const viewColumns = sortFixedColumn(unref(getColumnsRef));
5325
5554
  const columns = cloneDeep(viewColumns);
5326
- return columns.filter((column) => isIfShow(column));
5555
+ return columns.filter((column) => isIfShow(column)).map((column) => {
5556
+ if (column.edit) {
5557
+ column.customRender = renderEditCell(column);
5558
+ }
5559
+ return column;
5560
+ });
5327
5561
  });
5328
5562
  function isIfShow(column) {
5329
5563
  const ifShow = column.ifShow;
@@ -6014,7 +6248,10 @@ const _sfc_main$C = defineComponent({
6014
6248
  const _hoisted_1$m = { class: "dt-table-header" };
6015
6249
  const _hoisted_2$e = { class: "dt-table-header-actions" };
6016
6250
  const _hoisted_3$7 = { class: "dt-table-header-actions__left" };
6017
- const _hoisted_4$5 = { class: "dt-table-header-actions__right" };
6251
+ const _hoisted_4$5 = {
6252
+ key: 0,
6253
+ class: "dt-table-header-actions__right"
6254
+ };
6018
6255
  const _hoisted_5$4 = {
6019
6256
  key: 0,
6020
6257
  style: { "margin": "5px" }
@@ -6028,12 +6265,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6028
6265
  createVNode(_component_FormButtons, mergeProps(_ctx.getActionsProps, { onHandleMethod: _ctx.handleMethod }), null, 16, ["onHandleMethod"]),
6029
6266
  renderSlot(_ctx.$slots, "toolbar")
6030
6267
  ]),
6031
- createElementVNode("div", _hoisted_4$5, [
6268
+ _ctx.tableTools ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
6032
6269
  createVNode(_component_TableSettinCom, {
6033
6270
  setting: _ctx.tableTools,
6034
6271
  onColumnsChange: _ctx.handleColumnChange
6035
6272
  }, null, 8, ["setting", "onColumnsChange"])
6036
- ])
6273
+ ])) : createCommentVNode("", true)
6037
6274
  ]),
6038
6275
  _ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
6039
6276
  renderSlot(_ctx.$slots, "headerTop")
@@ -6043,9 +6280,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6043
6280
  var TableHeader = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$1]]);
6044
6281
  function useTableHeader(propsRef, slots, handlers) {
6045
6282
  const getHeaderProps = computed(() => {
6046
- const { tableSetting, toolbar } = unref(propsRef);
6283
+ const { tableSetting, toolbar = [] } = unref(propsRef);
6047
6284
  const { getSlot } = useSlots();
6048
- const hideTitle = !slots.toolbar && !slots.headerTop && !tableSetting;
6285
+ const hideTitle = !toolbar.length && !slots.toolbar && !slots.headerTop && !tableSetting;
6049
6286
  return {
6050
6287
  title: hideTitle ? null : () => h(TableHeader, {
6051
6288
  tableTools: tableSetting,
@@ -6225,12 +6462,16 @@ const _sfc_main$B = defineComponent({
6225
6462
  props: TableProps,
6226
6463
  components: {
6227
6464
  Table,
6228
- TableRender: _sfc_main$J
6465
+ TableRender: _sfc_main$K
6229
6466
  },
6230
6467
  emits: [
6231
6468
  "register",
6232
6469
  "columns-change",
6233
- "selection-change"
6470
+ "selection-change",
6471
+ "row-click",
6472
+ "row-dbClick",
6473
+ "expanded-rows-change",
6474
+ "edit-change"
6234
6475
  ],
6235
6476
  setup(props, { emit, attrs, slots }) {
6236
6477
  const tableElRef = ref(null);
@@ -6270,6 +6511,7 @@ const _sfc_main$B = defineComponent({
6270
6511
  getCacheColumns,
6271
6512
  getSelectRows,
6272
6513
  getSelectRowKeys,
6514
+ emit,
6273
6515
  getSize: () => {
6274
6516
  return unref(getBind).size;
6275
6517
  }
@@ -6355,7 +6597,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6355
6597
  }
6356
6598
  var DtTable = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render]]);
6357
6599
  function useFetch(api, baseUrl = "") {
6358
- function fetch(params = {}) {
6600
+ function fetch(params) {
6359
6601
  let type, header = {}, model = {};
6360
6602
  if (isString(api)) {
6361
6603
  api = baseUrl + api;
@@ -6368,7 +6610,8 @@ function useFetch(api, baseUrl = "") {
6368
6610
  model = api.model;
6369
6611
  }
6370
6612
  return new Promise((resolve, reject) => {
6371
- http[type || "post"](api, Object.assign({}, model, params), {
6613
+ let param = isObject(params) ? Object.assign({}, model, params) : params;
6614
+ http[type || "post"](api, param, {
6372
6615
  ...header,
6373
6616
  ...{ onlyData: false }
6374
6617
  }).then((data) => {
@@ -6493,7 +6736,7 @@ function useSource(opt) {
6493
6736
  }
6494
6737
  function onAdd(model) {
6495
6738
  const { fetch } = useFetch(add, baseUrl);
6496
- fetch(model).then((rsp) => {
6739
+ return fetch(model).then((rsp) => {
6497
6740
  message.success("\u65B0\u589E\u6210\u529F");
6498
6741
  search();
6499
6742
  });
@@ -6504,14 +6747,15 @@ function useSource(opt) {
6504
6747
  }
6505
6748
  function onUpdate(model) {
6506
6749
  const { fetch } = useFetch(update, baseUrl);
6507
- fetch(model).then((rsp) => {
6750
+ return fetch(model).then((rsp) => {
6508
6751
  message.success("\u66F4\u65B0\u6570\u636E\u6210\u529F");
6509
6752
  search();
6510
6753
  });
6511
6754
  }
6512
6755
  function onDeletes(ids) {
6513
6756
  const { fetch } = useFetch(deletes, baseUrl);
6514
- fetch(ids).then((rsp) => {
6757
+ fetch(toRaw(ids)).then((rsp) => {
6758
+ message.success(`${ids.length > 1 ? "\u6279\u91CF" : ""} \u5220\u9664\u6210\u529F\uFF01`);
6515
6759
  search();
6516
6760
  });
6517
6761
  }
@@ -6597,7 +6841,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6597
6841
  },
6598
6842
  setup(__props) {
6599
6843
  const props = __props;
6600
- const [registerDialog] = useModal({
6844
+ const [registerDialog, { closeModal }] = useModal({
6601
6845
  ...omit(toRaw(props), [
6602
6846
  "actions",
6603
6847
  "curd",
@@ -6622,11 +6866,12 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6622
6866
  var _a;
6623
6867
  if (props.curd && isFunction((_a = props.curd) == null ? void 0 : _a.onAdd)) {
6624
6868
  let obj = Object.assign({}, props.formsVal.value || {}, getFormValues());
6625
- obj.id ? props.curd.onUpdate(obj) : props.curd.onAdd(obj);
6869
+ let pro = obj.id ? props.curd.onUpdate(obj) : props.curd.onAdd(obj);
6870
+ pro.then((rsp) => closeModal());
6626
6871
  }
6627
6872
  }
6628
6873
  return (_ctx, _cache) => {
6629
- return openBlock(), createBlock(unref(_sfc_main$K), {
6874
+ return openBlock(), createBlock(unref(_sfc_main$L), {
6630
6875
  onRegister: unref(registerDialog),
6631
6876
  onSave: handleSave
6632
6877
  }, {
@@ -7401,7 +7646,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7401
7646
  alert("s-s-s-");
7402
7647
  }
7403
7648
  return (_ctx, _cache) => {
7404
- return openBlock(), createBlock(unref(_sfc_main$K), {
7649
+ return openBlock(), createBlock(unref(_sfc_main$L), {
7405
7650
  onSave: _cache[0] || (_cache[0] = ($event) => handleSave()),
7406
7651
  onRegister: unref(register)
7407
7652
  }, {
@@ -8220,8 +8465,8 @@ var _sfc_main$v = /* @__PURE__ */ defineComponent({
8220
8465
  const dtComponents = [
8221
8466
  { name: "dt-base-router", component: DtBaseRouter },
8222
8467
  { name: "dt-icon", component: DtIcon },
8223
- { name: "dt-pick-icon", component: _sfc_main$V },
8224
- { name: "dt-modal", component: _sfc_main$K },
8468
+ { name: "dt-pick-icon", component: _sfc_main$W },
8469
+ { name: "dt-modal", component: _sfc_main$L },
8225
8470
  { name: "dt-form", component: DtForm },
8226
8471
  { name: "dt-upload", component: _sfc_main$y },
8227
8472
  { name: "dt-upload-modal", component: _sfc_main$x },
@@ -9513,7 +9758,7 @@ var _sfc_main$b = defineComponent({
9513
9758
  }), null);
9514
9759
  }
9515
9760
  return () => {
9516
- return createVNode(Fragment, null, [renderHeader(), unref(getUseScroll) ? createVNode(_sfc_main$T, null, {
9761
+ return createVNode(Fragment, null, [renderHeader(), unref(getUseScroll) ? createVNode(_sfc_main$U, null, {
9517
9762
  default: () => renderMenu()
9518
9763
  }) : renderMenu()]);
9519
9764
  };
@@ -10357,7 +10602,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10357
10602
  }, {
10358
10603
  default: withCtx(() => [
10359
10604
  unref(getShowSidebar) ? (openBlock(), createBlock(_sfc_main$7, { key: 0 })) : createCommentVNode("", true),
10360
- createVNode(unref(_sfc_main$T), {
10605
+ createVNode(unref(_sfc_main$U), {
10361
10606
  ref_key: "wrapperRef",
10362
10607
  ref: wrapperRef,
10363
10608
  class: normalizeClass({ "fixedWrap": unref(getFixed) })
@@ -10390,4 +10635,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10390
10635
  };
10391
10636
  }
10392
10637
  });
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 };
10638
+ export { DtBaseRouter, DtForm, DtIcon, _sfc_main$z as DtIframe, _sfc_main$L as DtModal, _sfc_main$W 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 };