3h1-ui 3.0.0-next.6 → 3.0.0-next.7

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.
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { h, nextTick, createVNode, defineComponent, ref, computed, unref, watchEffect, watch, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createSlots, renderSlot, normalizeProps, guardReactiveProps, createElementVNode, onMounted, normalizeClass, createCommentVNode, normalizeStyle as normalizeStyle$1, Transition, toHandlers, useSlots, withDirectives, vShow, getCurrentInstance, inject, onUnmounted, provide, onBeforeUnmount, resolveDynamicComponent, reactive, toRef, toRefs, TransitionGroup, getCurrentScope, onScopeDispose, readonly, defineAsyncComponent, isRef, shallowRef, isVNode, toRaw, useAttrs as useAttrs$2, shallowReactive, withKeys, withModifiers, render as render$1, resolveDirective, pushScopeId, popScopeId, useCssVars, triggerRef, Comment, Text } from "vue";
2
- import { Radio, Select, Tree, TreeSelect, Cascader, Transfer, Input, Tooltip, Skeleton, Popover, Pagination as Pagination$1, Empty as Empty$3, Button as Button$1, Table as Table$1, Form, FormItem, DatePicker as DatePicker$1, InputNumber, Modal as Modal$2, Popconfirm, Menu, Dropdown, Divider as Divider$1, Image, Progress, Tag, Alert, Upload, Space, AutoComplete, Switch, Checkbox, Slider, Rate, TimePicker as TimePicker$1, Col, Row, MenuItem, MenuDivider, Spin, PageHeader, CheckboxGroup, TableSummaryRow, TableSummaryCell, TableSummary, Badge, FormItemRest, Drawer, Avatar, Descriptions, DescriptionsItem, theme } from "ant-design-vue";
3
- import { isFunction as isFunction$4, isString as isString$4, isArray as isArray$4, getSlot as getSlot$1, addClass as addClass$1, removeClass as removeClass$1, getPopupContainer as getPopupContainer$1, triggerWindowResize, off, on, addResizeListener, removeResizeListener, withInstall as withInstall$6, extendSlots as extendSlots$1, isBoolean, isNumber as isNumber$2, isDef as isDef$1, buildUUID, warn as warn$1, downloadByUrl, isObject as isObject$4, isNull, dateUtil, isNullOrUnDef, error as error$1, deepMerge as deepMerge$1, getDynamicProps, buildProps, createBEM, forEach as forEach$1, isClient as isClient$1, filter, treeToList, eachTree, isEmpty, isServer, formatToDate, isMap as isMap$2, findNodeAll, getViewportOffset, isNullAndUnDef, dataURLtoBlob, deepMergeObjects } from "@shy-plugins/utils";
1
+ import { h, nextTick, createVNode, defineComponent, ref, computed, unref, watchEffect, watch, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createSlots, renderSlot, normalizeProps, guardReactiveProps, createElementVNode, onMounted, normalizeClass, createCommentVNode, normalizeStyle as normalizeStyle$1, Transition, toHandlers, useSlots, withDirectives, vShow, getCurrentInstance, inject, onUnmounted, provide, onBeforeUnmount, resolveDynamicComponent, reactive, toRef, toRefs, TransitionGroup, getCurrentScope, onScopeDispose, readonly, defineAsyncComponent, isRef, toRaw, shallowRef, isVNode, useAttrs as useAttrs$2, shallowReactive, withKeys, withModifiers, render as render$1, resolveDirective, pushScopeId, popScopeId, useCssVars, triggerRef, Comment, Text } from "vue";
2
+ import { Radio, Select, Tree, TreeSelect, Cascader, Transfer, Input, Tooltip, Skeleton, Popover, Pagination as Pagination$1, Empty as Empty$3, Button as Button$1, Table as Table$1, FormItem, DatePicker as DatePicker$1, InputNumber, Modal as Modal$2, Popconfirm, Menu, Dropdown, Divider as Divider$1, Image, Progress, Tag, Alert, Upload, Space, AutoComplete, Switch, Checkbox, Slider, Rate, TimePicker as TimePicker$1, Col, Form, Row, MenuItem, MenuDivider, Spin, PageHeader, CheckboxGroup, TableSummaryRow, TableSummaryCell, TableSummary, Badge, FormItemRest, Drawer, Avatar, Descriptions, DescriptionsItem, theme } from "ant-design-vue";
3
+ import { isFunction as isFunction$4, isString as isString$4, isArray as isArray$4, getSlot as getSlot$1, addClass as addClass$1, removeClass as removeClass$1, getPopupContainer as getPopupContainer$1, triggerWindowResize, off, on, addResizeListener, removeResizeListener, buildUUID, withInstall as withInstall$6, extendSlots as extendSlots$1, isBoolean, isNumber as isNumber$2, isDef as isDef$1, warn as warn$1, downloadByUrl, isObject as isObject$4, isNull, dateUtil, isNullOrUnDef, error as error$1, deepMerge as deepMerge$1, getDynamicProps, buildProps, createBEM, forEach as forEach$1, isClient as isClient$1, filter, treeToList, eachTree, isEmpty, isServer, formatToDate, isMap as isMap$2, findNodeAll, getViewportOffset, isNullAndUnDef, dataURLtoBlob, deepMergeObjects } from "@shy-plugins/utils";
4
4
  import { useAttrs as useAttrs$1, useRuleFormItem, useTimeoutFn as useTimeoutFn$2, useScrollTo as useScrollTo$1, useIntersectionObserver, useCopyToClipboard, useMessage, usePagination as usePagination$2, useI18n as useI18n$1, useDesign as useDesign$1, useSortable, createContext as createContext$1, useContext as useContext$2, useBreakpoint, useContentHeight, useWindowSizeFn as useWindowSizeFn$1, onMountedOrActivated, useEventListener as useEventListener$1 } from "@shy-plugins/use";
5
5
  import { zxcvbn } from "@zxcvbn-ts/core";
6
6
  import Iconify from "@purge-icons/generated";
@@ -4518,9 +4518,16 @@ const _sfc_main$1q = defineComponent({
4518
4518
  return prev2;
4519
4519
  }, []);
4520
4520
  });
4521
- watchEffect(() => {
4522
- props2.immediate && !props2.alwaysLoad && fetch();
4523
- });
4521
+ watch(
4522
+ () => props2.immediate && !props2.alwaysLoad,
4523
+ (val) => {
4524
+ if (val)
4525
+ fetch();
4526
+ },
4527
+ {
4528
+ immediate: true
4529
+ }
4530
+ );
4524
4531
  watch(
4525
4532
  () => state.value,
4526
4533
  (v) => {
@@ -4564,6 +4571,7 @@ const _sfc_main$1q = defineComponent({
4564
4571
  console.warn(error2);
4565
4572
  } finally {
4566
4573
  loading.value = false;
4574
+ isFirstLoad.value = false;
4567
4575
  }
4568
4576
  }
4569
4577
  async function handleFetch(visible) {
@@ -4579,8 +4587,9 @@ const _sfc_main$1q = defineComponent({
4579
4587
  function emitChange() {
4580
4588
  emit("options-change", unref(getOptions));
4581
4589
  }
4582
- function handleChange(_, ...args) {
4590
+ function handleChange(val, ...args) {
4583
4591
  emitData.value = args;
4592
+ emit("update:value", val);
4584
4593
  }
4585
4594
  const filterOption = (input, option) => {
4586
4595
  var _a2, _b, _c;
@@ -8048,24 +8057,28 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
8048
8057
  };
8049
8058
  }
8050
8059
  });
8051
- const _hoisted_1$t = { key: 0 };
8052
- const _hoisted_2$9 = { key: 1 };
8053
- const _hoisted_3$6 = {
8054
- key: 1,
8055
- class: "delete-wrapper"
8060
+ const _hoisted_1$t = { key: 1 };
8061
+ const _hoisted_2$9 = {
8062
+ key: 0,
8063
+ class: "table-children-required"
8056
8064
  };
8065
+ const _hoisted_3$6 = { class: "text-red-500" };
8057
8066
  const _hoisted_4$4 = {
8058
8067
  key: 0,
8059
- class: "delete-index"
8068
+ class: "table-children-delete-index"
8060
8069
  };
8061
8070
  const _hoisted_5$3 = ["onClick"];
8062
8071
  const _hoisted_6$1 = {
8063
8072
  key: 2,
8064
- class: ""
8073
+ class: "table-children-delete-index"
8065
8074
  };
8066
8075
  const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8067
8076
  __name: "Table",
8068
8077
  props: {
8078
+ rowKey: {
8079
+ type: String,
8080
+ default: () => "uuid"
8081
+ },
8069
8082
  columns: {
8070
8083
  type: Array,
8071
8084
  default: () => []
@@ -8082,7 +8095,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8082
8095
  emits: ["update:value", "change", "add", "remove"],
8083
8096
  setup(__props, { expose, emit }) {
8084
8097
  const props2 = __props;
8085
- const listFormRefs = ref([]);
8098
+ const formActionType = inject("formActionType");
8086
8099
  const emitData = ref([]);
8087
8100
  const [state] = useRuleFormItem(props2, "value", "change", emitData);
8088
8101
  const getColumns = computed(() => {
@@ -8095,18 +8108,124 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8095
8108
  width: 50,
8096
8109
  align: "center"
8097
8110
  };
8098
- return [indexColumn, ...props2.columns];
8111
+ return [
8112
+ indexColumn,
8113
+ ...props2.columns.map((item) => ({
8114
+ ...item,
8115
+ type: item.type ? item.type : "input"
8116
+ }))
8117
+ ];
8099
8118
  });
8100
8119
  const plusClickEvent = () => {
8101
- state.value = [{}, ...state.value];
8120
+ state.value = [{ [props2.rowKey]: buildUUID() }, ...toRaw(state.value)];
8102
8121
  emit("add", state.value);
8103
8122
  };
8104
8123
  const rowClickEvent = (index2) => {
8105
- state.value = unref(state).filter((item, i) => {
8106
- return index2 !== i;
8124
+ const tempState = state.value.filter((item) => {
8125
+ return item[props2.rowKey] !== index2;
8107
8126
  });
8127
+ tempState.forEach((item) => item[props2.rowKey] = buildUUID());
8128
+ state.value = [...tempState];
8108
8129
  emit("remove", state.value, index2);
8109
8130
  };
8131
+ const getPopupContainer2 = () => document.body;
8132
+ const rulesRef = reactive({});
8133
+ const getRules = ({ column: column2, record, index: index2, ...args }) => {
8134
+ var _a2, _b;
8135
+ const errKey = `${column2.dataIndex}-${record.uuid}Info`;
8136
+ if (!column2.required)
8137
+ return [];
8138
+ if ((_a2 = rulesRef[errKey]) == null ? void 0 : _a2.rules)
8139
+ return (_b = rulesRef[errKey]) == null ? void 0 : _b.rules;
8140
+ rulesRef[errKey] = {
8141
+ rules: [],
8142
+ show: false,
8143
+ msg: ""
8144
+ };
8145
+ if (!column2.rules && column2.required) {
8146
+ rulesRef[errKey].rules = [
8147
+ {
8148
+ required: true,
8149
+ validator: (rule, value) => {
8150
+ const prefix = column2.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
8151
+ const errMsg = `${prefix}${column2.title}`;
8152
+ if (value) {
8153
+ rulesRef[errKey].show = false;
8154
+ return Promise.resolve();
8155
+ }
8156
+ rulesRef[errKey].show = true;
8157
+ rulesRef[errKey].msg = errMsg;
8158
+ return Promise.reject(errMsg);
8159
+ }
8160
+ }
8161
+ ];
8162
+ return rulesRef[errKey].rules;
8163
+ }
8164
+ if (!isArray$3(column2.rules))
8165
+ return column2.rules;
8166
+ rulesRef[errKey].rules = cloneDeep(column2.rules);
8167
+ rulesRef[errKey].rules.forEach((item) => {
8168
+ if (!item.validator || !isFunction$4(item.validator))
8169
+ return;
8170
+ const validator = item.validator;
8171
+ item.validator = async (rule, value) => {
8172
+ try {
8173
+ rulesRef[errKey].show = false;
8174
+ return await validator(
8175
+ rule,
8176
+ value,
8177
+ { column: column2, record, ...args },
8178
+ formActionType
8179
+ );
8180
+ } catch (error2) {
8181
+ rulesRef[errKey].show = true;
8182
+ rulesRef[errKey].msg = error2;
8183
+ return Promise.reject(error2);
8184
+ }
8185
+ };
8186
+ });
8187
+ return rulesRef[errKey].rules;
8188
+ };
8189
+ watch(
8190
+ () => state.value,
8191
+ (v, old) => {
8192
+ if (!isEqual(toRaw(v), toRaw(old))) {
8193
+ emit(
8194
+ "update:value",
8195
+ toRaw(v).map((ele) => {
8196
+ return {
8197
+ ...ele,
8198
+ [props2.rowKey]: ele[props2.rowKey] || buildUUID()
8199
+ };
8200
+ })
8201
+ );
8202
+ }
8203
+ },
8204
+ {
8205
+ deep: true
8206
+ }
8207
+ );
8208
+ const isScroll = ref(false);
8209
+ const timer = ref();
8210
+ onMounted(() => {
8211
+ window.addEventListener(
8212
+ "scroll",
8213
+ (e) => {
8214
+ clearTimeout(timer.value);
8215
+ timer.value = setTimeout(() => {
8216
+ isScroll.value = false;
8217
+ }, 500);
8218
+ if (isScroll.value)
8219
+ return;
8220
+ isScroll.value = true;
8221
+ },
8222
+ true
8223
+ );
8224
+ });
8225
+ onUnmounted(() => {
8226
+ window.removeEventListener("scroll", () => {
8227
+ });
8228
+ });
8110
8229
  const loadKv = () => {
8111
8230
  const columns = props2.columns;
8112
8231
  let dicData = [];
@@ -8117,14 +8236,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8117
8236
  }
8118
8237
  });
8119
8238
  };
8120
- loadKv();
8121
- watch(
8122
- () => state.value,
8123
- (v) => {
8124
- emit("update:value", v);
8125
- }
8126
- // { immediate: true }
8127
- );
8239
+ const listFormRefs = ref([]);
8128
8240
  const validate = async () => {
8129
8241
  try {
8130
8242
  for (let formRef of listFormRefs.value) {
@@ -8134,6 +8246,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8134
8246
  throw new Error("校验失败");
8135
8247
  }
8136
8248
  };
8249
+ loadKv();
8137
8250
  expose({ validate });
8138
8251
  return (_ctx, _cache) => {
8139
8252
  return openBlock(), createBlock(unref(Table$1), {
@@ -8145,81 +8258,109 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8145
8258
  class: "table-children",
8146
8259
  align: "center"
8147
8260
  }, {
8148
- headerCell: withCtx(({ column: column2 }) => [
8149
- column2.dataIndex === "index" ? (openBlock(), createElementBlock("div", _hoisted_1$t, [
8150
- __props.isShowAction ? (openBlock(), createElementBlock("div", {
8151
- key: 0,
8152
- class: "shy-table-edit-icon-plus",
8153
- onClick: plusClickEvent
8154
- }, [
8155
- createVNode(unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
8156
- ])) : (openBlock(), createElementBlock("div", _hoisted_2$9, "序号"))
8157
- ])) : createCommentVNode("", true)
8158
- ]),
8159
- bodyCell: withCtx(({ column: column2, record, index: index2 }) => [
8160
- column2.dataIndex !== "index" ? (openBlock(), createBlock(unref(Form), {
8161
- key: 0,
8162
- model: record,
8163
- ref: (el) => {
8164
- if (el)
8165
- listFormRefs.value.push(el);
8166
- }
8261
+ headerCell: withCtx(({ column: column2 }) => {
8262
+ var _a2;
8263
+ return [
8264
+ column2.dataIndex === "index" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
8265
+ __props.isShowAction ? (openBlock(), createElementBlock("div", {
8266
+ key: 0,
8267
+ class: "shy-table-edit-icon-plus",
8268
+ onClick: plusClickEvent
8269
+ }, [
8270
+ createVNode(unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
8271
+ ])) : (openBlock(), createElementBlock("div", _hoisted_1$t, "序号"))
8272
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
8273
+ column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("span", _hoisted_2$9, "*")) : createCommentVNode("", true),
8274
+ createElementVNode("span", null, toDisplayString(column2.title), 1)
8275
+ ], 64))
8276
+ ];
8277
+ }),
8278
+ bodyCell: withCtx(({ column: column2, record, index: index2, ...args }) => [
8279
+ column2.dataIndex !== "index" && column2.type !== "text" ? (openBlock(), createBlock(unref(FormItem), {
8280
+ required: column2.required,
8281
+ rules: getRules({ column: column2, record, index: index2, ...args }),
8282
+ name: [_ctx.$attrs.codeField, index2, column2.dataIndex],
8283
+ key: record[__props.rowKey]
8167
8284
  }, {
8168
- default: withCtx(() => [
8169
- createVNode(unref(FormItem), {
8170
- rules: (column2 == null ? void 0 : column2.rules) || [],
8171
- name: column2.dataIndex
8172
- }, {
8173
- default: withCtx(() => [
8174
- column2.type === "select" ? (openBlock(), createBlock(unref(Select), {
8175
- key: 0,
8176
- value: record[column2.dataIndex],
8177
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8178
- options: column2.dicData,
8179
- mode: column2.mode,
8180
- "max-tag-count": column2.maxTagCount,
8181
- "max-tag-text-length": column2.maxTagTextLength
8182
- }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (openBlock(), createBlock(unref(DatePicker$1), {
8183
- key: 1,
8184
- value: record[column2.dataIndex],
8185
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8186
- valueFormat: "YYYY-MM-DD HH:mm:ss"
8187
- }, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
8188
- key: 2,
8189
- value: record[column2.dataIndex],
8190
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8191
- min: column2.min,
8192
- max: column2.max,
8193
- precision: column2.precision ?? 2
8194
- }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : (openBlock(), createBlock(unref(Input), {
8195
- key: 3,
8196
- value: record[column2.dataIndex],
8197
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8198
- disabled: !props2.isShowAction
8199
- }, null, 8, ["value", "onUpdate:value", "disabled"]))
8200
- ]),
8201
- _: 2
8202
- }, 1032, ["rules", "name"])
8203
- ]),
8285
+ default: withCtx(() => {
8286
+ var _a2;
8287
+ return [
8288
+ createVNode(unref(Popover), {
8289
+ overlayClassName: "table-children-err-popover",
8290
+ visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
8291
+ }, {
8292
+ content: withCtx(() => {
8293
+ var _a3;
8294
+ return [
8295
+ createElementVNode("span", _hoisted_3$6, toDisplayString((_a3 = rulesRef[`${column2.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a3.msg), 1)
8296
+ ];
8297
+ }),
8298
+ default: withCtx(() => [
8299
+ column2.type === "select" ? (openBlock(), createBlock(unref(Select), {
8300
+ key: 0,
8301
+ value: record[column2.dataIndex],
8302
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8303
+ options: column2.dicData,
8304
+ mode: column2.mode,
8305
+ "max-tag-count": column2.maxTagCount,
8306
+ "max-tag-text-length": column2.maxTagTextLength
8307
+ }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (openBlock(), createBlock(unref(DatePicker$1), {
8308
+ key: 1,
8309
+ value: record[column2.dataIndex],
8310
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8311
+ valueFormat: "YYYY-MM-DD HH:mm:ss"
8312
+ }, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
8313
+ key: 2,
8314
+ value: record[column2.dataIndex],
8315
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8316
+ min: column2.min,
8317
+ max: column2.max,
8318
+ precision: column2.precision ?? 2
8319
+ }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column2.type === "input" ? (openBlock(), createBlock(unref(Input), {
8320
+ key: 3,
8321
+ value: record[column2.dataIndex],
8322
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8323
+ disabled: !props2.isShowAction
8324
+ }, null, 8, ["value", "onUpdate:value", "disabled"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(componentMap$2).get(column2.type)), mergeProps(
8325
+ {
8326
+ key: 4,
8327
+ allowClear: "",
8328
+ getPopupContainer: getPopupContainer2,
8329
+ style: { width: "100%" }
8330
+ },
8331
+ unref(isFunction$4)(column2.componentProps) ? column2.componentProps({ record, column: column2, index: index2, ...args }) : column2.componentProps,
8332
+ {
8333
+ value: record[column2.dataIndex],
8334
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event
8335
+ }
8336
+ ), null, 16, ["value", "onUpdate:value"]))
8337
+ ]),
8338
+ _: 2
8339
+ }, 1032, ["visible"])
8340
+ ];
8341
+ }),
8204
8342
  _: 2
8205
- }, 1032, ["model"])) : (openBlock(), createElementBlock("div", _hoisted_3$6, [
8343
+ }, 1032, ["required", "rules", "name"])) : column2.dataIndex === "index" ? (openBlock(), createElementBlock("div", {
8344
+ class: "table-children-delete-wrapper",
8345
+ key: record[__props.rowKey]
8346
+ }, [
8206
8347
  __props.isShowAction ? (openBlock(), createElementBlock("span", _hoisted_4$4, toDisplayString(index2 + 1), 1)) : createCommentVNode("", true),
8207
8348
  __props.isShowAction ? (openBlock(), createElementBlock("div", {
8208
8349
  key: 1,
8209
- class: "delete-item",
8210
- onClick: ($event) => rowClickEvent(index2)
8350
+ class: "table-children-delete-item",
8351
+ onClick: ($event) => rowClickEvent(record[__props.rowKey])
8211
8352
  }, [
8212
8353
  createVNode(unref(DeleteFilled$1), { style: { color: "#fff" } })
8213
8354
  ], 8, _hoisted_5$3)) : (openBlock(), createElementBlock("span", _hoisted_6$1, toDisplayString(index2 + 1), 1))
8214
- ]))
8355
+ ])) : createCommentVNode("", true)
8215
8356
  ]),
8216
8357
  _: 1
8217
8358
  }, 8, ["columns", "data-source"]);
8218
8359
  };
8219
8360
  }
8220
8361
  });
8221
- const Table_vue_vue_type_style_index_0_scoped_cb71007d_lang = "";
8222
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-cb71007d"]]);
8362
+ const Table_vue_vue_type_style_index_0_scoped_9232fde4_lang = "";
8363
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-9232fde4"]]);
8223
8364
  const modal = "";
8224
8365
  const modalProps = {
8225
8366
  visible: { type: Boolean },
@@ -9234,10 +9375,8 @@ const _sfc_main$Z = defineComponent({
9234
9375
  watch(
9235
9376
  () => unref(visibleRef),
9236
9377
  (v) => {
9237
- var _a2;
9238
9378
  emit("visible-change", v);
9239
9379
  emit("update:visible", v);
9240
- instance && ((_a2 = modalMethods.emitVisible) == null ? void 0 : _a2.call(modalMethods, v, instance.uid));
9241
9380
  nextTick(() => {
9242
9381
  if (props2.scrollTop && v && unref(modalWrapperRef)) {
9243
9382
  unref(modalWrapperRef).scrollTop();
@@ -11115,6 +11254,9 @@ function createPlaceholderMessage$1(component) {
11115
11254
  if (component.includes("Transfer") || component.includes("Select") || component.includes("Cascader") || component.includes("Checkbox") || component.includes("Radio") || component.includes("Switch")) {
11116
11255
  return "请选择";
11117
11256
  }
11257
+ if (component.includes("Table")) {
11258
+ return "请至少添加一条";
11259
+ }
11118
11260
  return "";
11119
11261
  }
11120
11262
  const DATE_TYPE = ["DatePicker", "MonthPicker", "WeekPicker", "TimePicker"];
@@ -11390,7 +11532,9 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
11390
11532
  dynamicRules,
11391
11533
  required
11392
11534
  } = props2.schema;
11393
- emit("clearCurrValidate", unref(getValues).field);
11535
+ if (props2.schema.component !== "Table") {
11536
+ emit("clearCurrValidate", unref(getValues).field);
11537
+ }
11394
11538
  if (isFunction$4(dynamicRules)) {
11395
11539
  return dynamicRules(unref(getValues));
11396
11540
  }
@@ -11399,7 +11543,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
11399
11543
  rulesMessageJoinLabel: globalRulesMessageJoinLabel
11400
11544
  } = props2.formProps;
11401
11545
  const joinLabel = Reflect.has(props2.schema, "rulesMessageJoinLabel") ? rulesMessageJoinLabel : globalRulesMessageJoinLabel;
11402
- const defaultMsg = createPlaceholderMessage$1(component) + `${joinLabel ? label : ""}`;
11546
+ const defaultMsg = createPlaceholderMessage$1(component) + `${joinLabel ? label ? label : "" : ""}`;
11403
11547
  function validator(rule, value) {
11404
11548
  const msg = rule.message || defaultMsg;
11405
11549
  if (value === void 0 || isNull(value)) {
@@ -12633,28 +12777,30 @@ const _sfc_main$M = defineComponent({
12633
12777
  () => formModel,
12634
12778
  useDebounceFn$1((val) => {
12635
12779
  var _a2;
12780
+ if (isEqual(toRaw(val), toRaw(tempFormModel)))
12781
+ return;
12636
12782
  for (const key2 in val) {
12637
- if (val[key2] !== tempFormModel[key2]) {
12638
- (_a2 = unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12639
- var _a3;
12640
- const isComponentProps = item.field === key2 && item.componentProps;
12641
- if (isComponentProps && !isFunction$4(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12642
- item.componentProps.onModelChange(val[key2]);
12643
- } else if (isComponentProps && isFunction$4(item.componentProps)) {
12644
- const modelProps = item.componentProps({
12645
- schema: item,
12646
- formModel,
12647
- formActionType,
12648
- tableAction: props2.tableAction
12649
- });
12650
- if (modelProps.onModelChange) {
12651
- modelProps.onModelChange(val[key2]);
12652
- }
12783
+ if (isEqual(toRaw(val[key2]), toRaw(tempFormModel[key2])))
12784
+ continue;
12785
+ (_a2 = unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12786
+ var _a3;
12787
+ const isComponentProps = item.field === key2 && item.componentProps;
12788
+ if (isComponentProps && !isFunction$4(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12789
+ item.componentProps.onModelChange(val[key2]);
12790
+ } else if (isComponentProps && isFunction$4(item.componentProps)) {
12791
+ const modelProps = item.componentProps({
12792
+ schema: item,
12793
+ formModel,
12794
+ formActionType,
12795
+ tableAction: props2.tableAction
12796
+ });
12797
+ if (modelProps.onModelChange) {
12798
+ modelProps.onModelChange(val[key2]);
12653
12799
  }
12654
- });
12655
- }
12800
+ }
12801
+ });
12656
12802
  }
12657
- Object.assign(tempFormModel, formModel);
12803
+ Object.assign(tempFormModel, cloneDeep(formModel));
12658
12804
  unref(getProps).submitOnChange && handleSubmit();
12659
12805
  }, 300),
12660
12806
  { deep: true }
@@ -12697,6 +12843,7 @@ const _sfc_main$M = defineComponent({
12697
12843
  submit: handleSubmit,
12698
12844
  scrollToField
12699
12845
  };
12846
+ provide("formActionType", formActionType);
12700
12847
  const clearCurrValidate = (field) => {
12701
12848
  clearValidate([field]);
12702
12849
  };
@@ -15157,7 +15304,8 @@ function handleColumnResize(propsRef, columns, wrapRef) {
15157
15304
  [0, 0]
15158
15305
  );
15159
15306
  const length2 = columns.length;
15160
- const colWidth = tableWidth ? (tableWidth - sumWidth - selectWidth) / (length2 - sumLength) : 100;
15307
+ const countWidth = tableWidth ? (tableWidth - sumWidth - selectWidth) / (length2 - sumLength) : 150;
15308
+ const colWidth = countWidth < 150 ? 150 : countWidth;
15161
15309
  columns.forEach((item) => {
15162
15310
  if (item.flag)
15163
15311
  return;
@@ -15210,7 +15358,7 @@ function handleIndexColumn(propsRef, getPaginationRef, columns) {
15210
15358
  return `${index2 + 1}`;
15211
15359
  }
15212
15360
  const { current = 1, pageSize = PAGE_SIZE } = getPagination;
15213
- return ((current < 1 ? 1 : current) - 1) * pageSize + index2 + 1;
15361
+ return h("div", { class: "ant-table-cell-index full cursor-pointer" }, ((current < 1 ? 1 : current) - 1) * pageSize + index2 + 1);
15214
15362
  },
15215
15363
  ...isFixedLeft ? {
15216
15364
  fixed: "left"
@@ -15274,7 +15422,22 @@ function useColumns$1(propsRef, getPaginationRef, tableAction, wrapRef) {
15274
15422
  return columns.filter((column2) => {
15275
15423
  return hasPermission(column2.auth) && isIfShow(column2);
15276
15424
  }).map((column2) => {
15277
- const { slots, customRender, format: format2, edit, editRow, flag } = column2;
15425
+ var _a2, _b;
15426
+ const isSummaryCol = unref(propsRef).showSummaryTotal && ((_b = (_a2 = unref(propsRef).summaryTotalFields) == null ? void 0 : _a2.includes) == null ? void 0 : _b.call(
15427
+ _a2,
15428
+ column2.dataIndex
15429
+ ));
15430
+ const summaryFormat = (text) => {
15431
+ return text ? isNumber$2(+text) && !isNaN(+text) ? Number.parseFloat((+text).toFixed(2)).toLocaleString("en-US") : text : "";
15432
+ };
15433
+ const {
15434
+ slots,
15435
+ customRender,
15436
+ format: format2 = isSummaryCol ? summaryFormat : void 0,
15437
+ edit,
15438
+ editRow,
15439
+ flag
15440
+ } = column2;
15278
15441
  if (!slots || !(slots == null ? void 0 : slots.title)) {
15279
15442
  column2.customTitle = column2.title;
15280
15443
  Reflect.deleteProperty(column2, "title");
@@ -15460,7 +15623,7 @@ function useDataSource(propsRef, {
15460
15623
  const obj = {};
15461
15624
  summaryTotalFields.forEach((field) => {
15462
15625
  const total = dataSourceRef.value.reduce((acc, cur) => {
15463
- return acc + (cur[field] || 0);
15626
+ return +acc + (+cur[field] || 0);
15464
15627
  }, 0);
15465
15628
  obj[field] = Number.parseFloat(total.toFixed(2)).toLocaleString("en-US");
15466
15629
  });
@@ -15476,7 +15639,9 @@ function useDataSource(propsRef, {
15476
15639
  immediate: true
15477
15640
  }
15478
15641
  );
15642
+ let oldSortInfoRef;
15479
15643
  function handleTableChange(pagination, filters, sorter) {
15644
+ const isChangeSorter = !eq(oldSortInfoRef, sorter.order);
15480
15645
  const { clearSelectOnPageChange, sortFn, filterFn } = unref(propsRef);
15481
15646
  if (clearSelectOnPageChange) {
15482
15647
  clearSelectedRowKeys();
@@ -15494,6 +15659,10 @@ function useDataSource(propsRef, {
15494
15659
  searchState.filterInfo = filterInfo;
15495
15660
  params.filterInfo = filterInfo;
15496
15661
  }
15662
+ if (isChangeSorter && !unref(propsRef).isSortFetch) {
15663
+ oldSortInfoRef = sorter.order;
15664
+ return;
15665
+ }
15497
15666
  fetch(params);
15498
15667
  }
15499
15668
  function setTableKey(items) {
@@ -16003,6 +16172,20 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef, getDa
16003
16172
  nextTick(() => {
16004
16173
  debounceRedoHeight();
16005
16174
  });
16175
+ const table2 = unref(tableElRef);
16176
+ if (!table2)
16177
+ return;
16178
+ const tableEl = table2.$el;
16179
+ if (!tableEl)
16180
+ return;
16181
+ const bodyEl2 = tableEl.querySelector(".ant-table-tbody");
16182
+ if (!bodyEl2)
16183
+ return;
16184
+ new Sortablejs(bodyEl2, {
16185
+ ghostClass: "bg-gray-100",
16186
+ handle: ".ant-table-cell .ant-table-cell-index",
16187
+ draggable: ".ant-table-row"
16188
+ });
16006
16189
  });
16007
16190
  const getScrollX = computed(() => {
16008
16191
  var _a2;
@@ -17727,6 +17910,7 @@ const basicProps$3 = reactive({
17727
17910
  }
17728
17911
  },
17729
17912
  inset: Boolean,
17913
+ isSortFetch: { type: Boolean, default: true },
17730
17914
  sortFn: {
17731
17915
  type: Function,
17732
17916
  default: DEFAULT_SORT_FN
@@ -19626,9 +19810,7 @@ const _sfc_main$i = defineComponent({
19626
19810
  () => visibleRef.value,
19627
19811
  (visible) => {
19628
19812
  nextTick(() => {
19629
- var _a2;
19630
19813
  emit("visible-change", visible);
19631
- instance && ((_a2 = drawerInstance.emitVisible) == null ? void 0 : _a2.call(drawerInstance, visible, instance.uid));
19632
19814
  });
19633
19815
  }
19634
19816
  );