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/lib/index.js CHANGED
@@ -4542,9 +4542,16 @@ const _sfc_main$1q = vue.defineComponent({
4542
4542
  return prev2;
4543
4543
  }, []);
4544
4544
  });
4545
- vue.watchEffect(() => {
4546
- props2.immediate && !props2.alwaysLoad && fetch();
4547
- });
4545
+ vue.watch(
4546
+ () => props2.immediate && !props2.alwaysLoad,
4547
+ (val) => {
4548
+ if (val)
4549
+ fetch();
4550
+ },
4551
+ {
4552
+ immediate: true
4553
+ }
4554
+ );
4548
4555
  vue.watch(
4549
4556
  () => state.value,
4550
4557
  (v) => {
@@ -4588,6 +4595,7 @@ const _sfc_main$1q = vue.defineComponent({
4588
4595
  console.warn(error2);
4589
4596
  } finally {
4590
4597
  loading.value = false;
4598
+ isFirstLoad.value = false;
4591
4599
  }
4592
4600
  }
4593
4601
  async function handleFetch(visible) {
@@ -4603,8 +4611,9 @@ const _sfc_main$1q = vue.defineComponent({
4603
4611
  function emitChange() {
4604
4612
  emit("options-change", vue.unref(getOptions));
4605
4613
  }
4606
- function handleChange(_, ...args) {
4614
+ function handleChange(val, ...args) {
4607
4615
  emitData.value = args;
4616
+ emit("update:value", val);
4608
4617
  }
4609
4618
  const filterOption = (input, option) => {
4610
4619
  var _a2, _b, _c;
@@ -8072,24 +8081,28 @@ const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
8072
8081
  };
8073
8082
  }
8074
8083
  });
8075
- const _hoisted_1$t = { key: 0 };
8076
- const _hoisted_2$9 = { key: 1 };
8077
- const _hoisted_3$6 = {
8078
- key: 1,
8079
- class: "delete-wrapper"
8084
+ const _hoisted_1$t = { key: 1 };
8085
+ const _hoisted_2$9 = {
8086
+ key: 0,
8087
+ class: "table-children-required"
8080
8088
  };
8089
+ const _hoisted_3$6 = { class: "text-red-500" };
8081
8090
  const _hoisted_4$4 = {
8082
8091
  key: 0,
8083
- class: "delete-index"
8092
+ class: "table-children-delete-index"
8084
8093
  };
8085
8094
  const _hoisted_5$3 = ["onClick"];
8086
8095
  const _hoisted_6$1 = {
8087
8096
  key: 2,
8088
- class: ""
8097
+ class: "table-children-delete-index"
8089
8098
  };
8090
8099
  const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
8091
8100
  __name: "Table",
8092
8101
  props: {
8102
+ rowKey: {
8103
+ type: String,
8104
+ default: () => "uuid"
8105
+ },
8093
8106
  columns: {
8094
8107
  type: Array,
8095
8108
  default: () => []
@@ -8106,7 +8119,7 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
8106
8119
  emits: ["update:value", "change", "add", "remove"],
8107
8120
  setup(__props, { expose, emit }) {
8108
8121
  const props2 = __props;
8109
- const listFormRefs = vue.ref([]);
8122
+ const formActionType = vue.inject("formActionType");
8110
8123
  const emitData = vue.ref([]);
8111
8124
  const [state] = use.useRuleFormItem(props2, "value", "change", emitData);
8112
8125
  const getColumns = vue.computed(() => {
@@ -8119,18 +8132,124 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
8119
8132
  width: 50,
8120
8133
  align: "center"
8121
8134
  };
8122
- return [indexColumn, ...props2.columns];
8135
+ return [
8136
+ indexColumn,
8137
+ ...props2.columns.map((item) => ({
8138
+ ...item,
8139
+ type: item.type ? item.type : "input"
8140
+ }))
8141
+ ];
8123
8142
  });
8124
8143
  const plusClickEvent = () => {
8125
- state.value = [{}, ...state.value];
8144
+ state.value = [{ [props2.rowKey]: utils.buildUUID() }, ...vue.toRaw(state.value)];
8126
8145
  emit("add", state.value);
8127
8146
  };
8128
8147
  const rowClickEvent = (index2) => {
8129
- state.value = vue.unref(state).filter((item, i) => {
8130
- return index2 !== i;
8148
+ const tempState = state.value.filter((item) => {
8149
+ return item[props2.rowKey] !== index2;
8131
8150
  });
8151
+ tempState.forEach((item) => item[props2.rowKey] = utils.buildUUID());
8152
+ state.value = [...tempState];
8132
8153
  emit("remove", state.value, index2);
8133
8154
  };
8155
+ const getPopupContainer2 = () => document.body;
8156
+ const rulesRef = vue.reactive({});
8157
+ const getRules = ({ column: column2, record, index: index2, ...args }) => {
8158
+ var _a2, _b;
8159
+ const errKey = `${column2.dataIndex}-${record.uuid}Info`;
8160
+ if (!column2.required)
8161
+ return [];
8162
+ if ((_a2 = rulesRef[errKey]) == null ? void 0 : _a2.rules)
8163
+ return (_b = rulesRef[errKey]) == null ? void 0 : _b.rules;
8164
+ rulesRef[errKey] = {
8165
+ rules: [],
8166
+ show: false,
8167
+ msg: ""
8168
+ };
8169
+ if (!column2.rules && column2.required) {
8170
+ rulesRef[errKey].rules = [
8171
+ {
8172
+ required: true,
8173
+ validator: (rule, value) => {
8174
+ const prefix = column2.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
8175
+ const errMsg = `${prefix}${column2.title}`;
8176
+ if (value) {
8177
+ rulesRef[errKey].show = false;
8178
+ return Promise.resolve();
8179
+ }
8180
+ rulesRef[errKey].show = true;
8181
+ rulesRef[errKey].msg = errMsg;
8182
+ return Promise.reject(errMsg);
8183
+ }
8184
+ }
8185
+ ];
8186
+ return rulesRef[errKey].rules;
8187
+ }
8188
+ if (!isArray$3(column2.rules))
8189
+ return column2.rules;
8190
+ rulesRef[errKey].rules = cloneDeep(column2.rules);
8191
+ rulesRef[errKey].rules.forEach((item) => {
8192
+ if (!item.validator || !utils.isFunction(item.validator))
8193
+ return;
8194
+ const validator = item.validator;
8195
+ item.validator = async (rule, value) => {
8196
+ try {
8197
+ rulesRef[errKey].show = false;
8198
+ return await validator(
8199
+ rule,
8200
+ value,
8201
+ { column: column2, record, ...args },
8202
+ formActionType
8203
+ );
8204
+ } catch (error2) {
8205
+ rulesRef[errKey].show = true;
8206
+ rulesRef[errKey].msg = error2;
8207
+ return Promise.reject(error2);
8208
+ }
8209
+ };
8210
+ });
8211
+ return rulesRef[errKey].rules;
8212
+ };
8213
+ vue.watch(
8214
+ () => state.value,
8215
+ (v, old) => {
8216
+ if (!isEqual(vue.toRaw(v), vue.toRaw(old))) {
8217
+ emit(
8218
+ "update:value",
8219
+ vue.toRaw(v).map((ele) => {
8220
+ return {
8221
+ ...ele,
8222
+ [props2.rowKey]: ele[props2.rowKey] || utils.buildUUID()
8223
+ };
8224
+ })
8225
+ );
8226
+ }
8227
+ },
8228
+ {
8229
+ deep: true
8230
+ }
8231
+ );
8232
+ const isScroll = vue.ref(false);
8233
+ const timer = vue.ref();
8234
+ vue.onMounted(() => {
8235
+ window.addEventListener(
8236
+ "scroll",
8237
+ (e) => {
8238
+ clearTimeout(timer.value);
8239
+ timer.value = setTimeout(() => {
8240
+ isScroll.value = false;
8241
+ }, 500);
8242
+ if (isScroll.value)
8243
+ return;
8244
+ isScroll.value = true;
8245
+ },
8246
+ true
8247
+ );
8248
+ });
8249
+ vue.onUnmounted(() => {
8250
+ window.removeEventListener("scroll", () => {
8251
+ });
8252
+ });
8134
8253
  const loadKv = () => {
8135
8254
  const columns = props2.columns;
8136
8255
  let dicData = [];
@@ -8141,14 +8260,7 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
8141
8260
  }
8142
8261
  });
8143
8262
  };
8144
- loadKv();
8145
- vue.watch(
8146
- () => state.value,
8147
- (v) => {
8148
- emit("update:value", v);
8149
- }
8150
- // { immediate: true }
8151
- );
8263
+ const listFormRefs = vue.ref([]);
8152
8264
  const validate = async () => {
8153
8265
  try {
8154
8266
  for (let formRef of listFormRefs.value) {
@@ -8158,6 +8270,7 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
8158
8270
  throw new Error("校验失败");
8159
8271
  }
8160
8272
  };
8273
+ loadKv();
8161
8274
  expose({ validate });
8162
8275
  return (_ctx, _cache) => {
8163
8276
  return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Table), {
@@ -8169,81 +8282,109 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
8169
8282
  class: "table-children",
8170
8283
  align: "center"
8171
8284
  }, {
8172
- headerCell: vue.withCtx(({ column: column2 }) => [
8173
- column2.dataIndex === "index" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
8174
- __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("div", {
8175
- key: 0,
8176
- class: "shy-table-edit-icon-plus",
8177
- onClick: plusClickEvent
8178
- }, [
8179
- vue.createVNode(vue.unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
8180
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$9, "序号"))
8181
- ])) : vue.createCommentVNode("", true)
8182
- ]),
8183
- bodyCell: vue.withCtx(({ column: column2, record, index: index2 }) => [
8184
- column2.dataIndex !== "index" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Form), {
8185
- key: 0,
8186
- model: record,
8187
- ref: (el) => {
8188
- if (el)
8189
- listFormRefs.value.push(el);
8190
- }
8285
+ headerCell: vue.withCtx(({ column: column2 }) => {
8286
+ var _a2;
8287
+ return [
8288
+ column2.dataIndex === "index" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
8289
+ __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("div", {
8290
+ key: 0,
8291
+ class: "shy-table-edit-icon-plus",
8292
+ onClick: plusClickEvent
8293
+ }, [
8294
+ vue.createVNode(vue.unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
8295
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, "序号"))
8296
+ ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
8297
+ column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$9, "*")) : vue.createCommentVNode("", true),
8298
+ vue.createElementVNode("span", null, vue.toDisplayString(column2.title), 1)
8299
+ ], 64))
8300
+ ];
8301
+ }),
8302
+ bodyCell: vue.withCtx(({ column: column2, record, index: index2, ...args }) => [
8303
+ column2.dataIndex !== "index" && column2.type !== "text" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.FormItem), {
8304
+ required: column2.required,
8305
+ rules: getRules({ column: column2, record, index: index2, ...args }),
8306
+ name: [_ctx.$attrs.codeField, index2, column2.dataIndex],
8307
+ key: record[__props.rowKey]
8191
8308
  }, {
8192
- default: vue.withCtx(() => [
8193
- vue.createVNode(vue.unref(antDesignVue.FormItem), {
8194
- rules: (column2 == null ? void 0 : column2.rules) || [],
8195
- name: column2.dataIndex
8196
- }, {
8197
- default: vue.withCtx(() => [
8198
- column2.type === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), {
8199
- key: 0,
8200
- value: record[column2.dataIndex],
8201
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8202
- options: column2.dicData,
8203
- mode: column2.mode,
8204
- "max-tag-count": column2.maxTagCount,
8205
- "max-tag-text-length": column2.maxTagTextLength
8206
- }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.DatePicker), {
8207
- key: 1,
8208
- value: record[column2.dataIndex],
8209
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8210
- valueFormat: "YYYY-MM-DD HH:mm:ss"
8211
- }, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.InputNumber), {
8212
- key: 2,
8213
- value: record[column2.dataIndex],
8214
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8215
- min: column2.min,
8216
- max: column2.max,
8217
- precision: column2.precision ?? 2
8218
- }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
8219
- key: 3,
8220
- value: record[column2.dataIndex],
8221
- "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8222
- disabled: !props2.isShowAction
8223
- }, null, 8, ["value", "onUpdate:value", "disabled"]))
8224
- ]),
8225
- _: 2
8226
- }, 1032, ["rules", "name"])
8227
- ]),
8309
+ default: vue.withCtx(() => {
8310
+ var _a2;
8311
+ return [
8312
+ vue.createVNode(vue.unref(antDesignVue.Popover), {
8313
+ overlayClassName: "table-children-err-popover",
8314
+ visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
8315
+ }, {
8316
+ content: vue.withCtx(() => {
8317
+ var _a3;
8318
+ return [
8319
+ vue.createElementVNode("span", _hoisted_3$6, vue.toDisplayString((_a3 = rulesRef[`${column2.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a3.msg), 1)
8320
+ ];
8321
+ }),
8322
+ default: vue.withCtx(() => [
8323
+ column2.type === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), {
8324
+ key: 0,
8325
+ value: record[column2.dataIndex],
8326
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8327
+ options: column2.dicData,
8328
+ mode: column2.mode,
8329
+ "max-tag-count": column2.maxTagCount,
8330
+ "max-tag-text-length": column2.maxTagTextLength
8331
+ }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.DatePicker), {
8332
+ key: 1,
8333
+ value: record[column2.dataIndex],
8334
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8335
+ valueFormat: "YYYY-MM-DD HH:mm:ss"
8336
+ }, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.InputNumber), {
8337
+ key: 2,
8338
+ value: record[column2.dataIndex],
8339
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8340
+ min: column2.min,
8341
+ max: column2.max,
8342
+ precision: column2.precision ?? 2
8343
+ }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column2.type === "input" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
8344
+ key: 3,
8345
+ value: record[column2.dataIndex],
8346
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event,
8347
+ disabled: !props2.isShowAction
8348
+ }, null, 8, ["value", "onUpdate:value", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(componentMap$2).get(column2.type)), vue.mergeProps(
8349
+ {
8350
+ key: 4,
8351
+ allowClear: "",
8352
+ getPopupContainer: getPopupContainer2,
8353
+ style: { width: "100%" }
8354
+ },
8355
+ vue.unref(utils.isFunction)(column2.componentProps) ? column2.componentProps({ record, column: column2, index: index2, ...args }) : column2.componentProps,
8356
+ {
8357
+ value: record[column2.dataIndex],
8358
+ "onUpdate:value": ($event) => record[column2.dataIndex] = $event
8359
+ }
8360
+ ), null, 16, ["value", "onUpdate:value"]))
8361
+ ]),
8362
+ _: 2
8363
+ }, 1032, ["visible"])
8364
+ ];
8365
+ }),
8228
8366
  _: 2
8229
- }, 1032, ["model"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$6, [
8367
+ }, 1032, ["required", "rules", "name"])) : column2.dataIndex === "index" ? (vue.openBlock(), vue.createElementBlock("div", {
8368
+ class: "table-children-delete-wrapper",
8369
+ key: record[__props.rowKey]
8370
+ }, [
8230
8371
  __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$4, vue.toDisplayString(index2 + 1), 1)) : vue.createCommentVNode("", true),
8231
8372
  __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("div", {
8232
8373
  key: 1,
8233
- class: "delete-item",
8234
- onClick: ($event) => rowClickEvent(index2)
8374
+ class: "table-children-delete-item",
8375
+ onClick: ($event) => rowClickEvent(record[__props.rowKey])
8235
8376
  }, [
8236
8377
  vue.createVNode(vue.unref(DeleteFilled$1), { style: { color: "#fff" } })
8237
8378
  ], 8, _hoisted_5$3)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$1, vue.toDisplayString(index2 + 1), 1))
8238
- ]))
8379
+ ])) : vue.createCommentVNode("", true)
8239
8380
  ]),
8240
8381
  _: 1
8241
8382
  }, 8, ["columns", "data-source"]);
8242
8383
  };
8243
8384
  }
8244
8385
  });
8245
- const Table_vue_vue_type_style_index_0_scoped_cb71007d_lang = "";
8246
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-cb71007d"]]);
8386
+ const Table_vue_vue_type_style_index_0_scoped_9232fde4_lang = "";
8387
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-9232fde4"]]);
8247
8388
  const modal = "";
8248
8389
  const modalProps = {
8249
8390
  visible: { type: Boolean },
@@ -9258,10 +9399,8 @@ const _sfc_main$Z = vue.defineComponent({
9258
9399
  vue.watch(
9259
9400
  () => vue.unref(visibleRef),
9260
9401
  (v) => {
9261
- var _a2;
9262
9402
  emit("visible-change", v);
9263
9403
  emit("update:visible", v);
9264
- instance && ((_a2 = modalMethods.emitVisible) == null ? void 0 : _a2.call(modalMethods, v, instance.uid));
9265
9404
  vue.nextTick(() => {
9266
9405
  if (props2.scrollTop && v && vue.unref(modalWrapperRef)) {
9267
9406
  vue.unref(modalWrapperRef).scrollTop();
@@ -11139,6 +11278,9 @@ function createPlaceholderMessage$1(component) {
11139
11278
  if (component.includes("Transfer") || component.includes("Select") || component.includes("Cascader") || component.includes("Checkbox") || component.includes("Radio") || component.includes("Switch")) {
11140
11279
  return "请选择";
11141
11280
  }
11281
+ if (component.includes("Table")) {
11282
+ return "请至少添加一条";
11283
+ }
11142
11284
  return "";
11143
11285
  }
11144
11286
  const DATE_TYPE = ["DatePicker", "MonthPicker", "WeekPicker", "TimePicker"];
@@ -11414,7 +11556,9 @@ const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
11414
11556
  dynamicRules,
11415
11557
  required
11416
11558
  } = props2.schema;
11417
- emit("clearCurrValidate", vue.unref(getValues).field);
11559
+ if (props2.schema.component !== "Table") {
11560
+ emit("clearCurrValidate", vue.unref(getValues).field);
11561
+ }
11418
11562
  if (utils.isFunction(dynamicRules)) {
11419
11563
  return dynamicRules(vue.unref(getValues));
11420
11564
  }
@@ -11423,7 +11567,7 @@ const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
11423
11567
  rulesMessageJoinLabel: globalRulesMessageJoinLabel
11424
11568
  } = props2.formProps;
11425
11569
  const joinLabel = Reflect.has(props2.schema, "rulesMessageJoinLabel") ? rulesMessageJoinLabel : globalRulesMessageJoinLabel;
11426
- const defaultMsg = createPlaceholderMessage$1(component) + `${joinLabel ? label : ""}`;
11570
+ const defaultMsg = createPlaceholderMessage$1(component) + `${joinLabel ? label ? label : "" : ""}`;
11427
11571
  function validator(rule, value) {
11428
11572
  const msg = rule.message || defaultMsg;
11429
11573
  if (value === void 0 || utils.isNull(value)) {
@@ -12657,28 +12801,30 @@ const _sfc_main$M = vue.defineComponent({
12657
12801
  () => formModel,
12658
12802
  useDebounceFn$1((val) => {
12659
12803
  var _a2;
12804
+ if (isEqual(vue.toRaw(val), vue.toRaw(tempFormModel)))
12805
+ return;
12660
12806
  for (const key2 in val) {
12661
- if (val[key2] !== tempFormModel[key2]) {
12662
- (_a2 = vue.unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12663
- var _a3;
12664
- const isComponentProps = item.field === key2 && item.componentProps;
12665
- if (isComponentProps && !utils.isFunction(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12666
- item.componentProps.onModelChange(val[key2]);
12667
- } else if (isComponentProps && utils.isFunction(item.componentProps)) {
12668
- const modelProps = item.componentProps({
12669
- schema: item,
12670
- formModel,
12671
- formActionType,
12672
- tableAction: props2.tableAction
12673
- });
12674
- if (modelProps.onModelChange) {
12675
- modelProps.onModelChange(val[key2]);
12676
- }
12807
+ if (isEqual(vue.toRaw(val[key2]), vue.toRaw(tempFormModel[key2])))
12808
+ continue;
12809
+ (_a2 = vue.unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12810
+ var _a3;
12811
+ const isComponentProps = item.field === key2 && item.componentProps;
12812
+ if (isComponentProps && !utils.isFunction(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12813
+ item.componentProps.onModelChange(val[key2]);
12814
+ } else if (isComponentProps && utils.isFunction(item.componentProps)) {
12815
+ const modelProps = item.componentProps({
12816
+ schema: item,
12817
+ formModel,
12818
+ formActionType,
12819
+ tableAction: props2.tableAction
12820
+ });
12821
+ if (modelProps.onModelChange) {
12822
+ modelProps.onModelChange(val[key2]);
12677
12823
  }
12678
- });
12679
- }
12824
+ }
12825
+ });
12680
12826
  }
12681
- Object.assign(tempFormModel, formModel);
12827
+ Object.assign(tempFormModel, cloneDeep(formModel));
12682
12828
  vue.unref(getProps).submitOnChange && handleSubmit();
12683
12829
  }, 300),
12684
12830
  { deep: true }
@@ -12721,6 +12867,7 @@ const _sfc_main$M = vue.defineComponent({
12721
12867
  submit: handleSubmit,
12722
12868
  scrollToField
12723
12869
  };
12870
+ vue.provide("formActionType", formActionType);
12724
12871
  const clearCurrValidate = (field) => {
12725
12872
  clearValidate([field]);
12726
12873
  };
@@ -15181,7 +15328,8 @@ function handleColumnResize(propsRef, columns, wrapRef) {
15181
15328
  [0, 0]
15182
15329
  );
15183
15330
  const length2 = columns.length;
15184
- const colWidth = tableWidth ? (tableWidth - sumWidth - selectWidth) / (length2 - sumLength) : 100;
15331
+ const countWidth = tableWidth ? (tableWidth - sumWidth - selectWidth) / (length2 - sumLength) : 150;
15332
+ const colWidth = countWidth < 150 ? 150 : countWidth;
15185
15333
  columns.forEach((item) => {
15186
15334
  if (item.flag)
15187
15335
  return;
@@ -15234,7 +15382,7 @@ function handleIndexColumn(propsRef, getPaginationRef, columns) {
15234
15382
  return `${index2 + 1}`;
15235
15383
  }
15236
15384
  const { current = 1, pageSize = PAGE_SIZE } = getPagination;
15237
- return ((current < 1 ? 1 : current) - 1) * pageSize + index2 + 1;
15385
+ return vue.h("div", { class: "ant-table-cell-index full cursor-pointer" }, ((current < 1 ? 1 : current) - 1) * pageSize + index2 + 1);
15238
15386
  },
15239
15387
  ...isFixedLeft ? {
15240
15388
  fixed: "left"
@@ -15298,7 +15446,22 @@ function useColumns$1(propsRef, getPaginationRef, tableAction, wrapRef) {
15298
15446
  return columns.filter((column2) => {
15299
15447
  return hasPermission(column2.auth) && isIfShow(column2);
15300
15448
  }).map((column2) => {
15301
- const { slots, customRender, format: format2, edit, editRow, flag } = column2;
15449
+ var _a2, _b;
15450
+ const isSummaryCol = vue.unref(propsRef).showSummaryTotal && ((_b = (_a2 = vue.unref(propsRef).summaryTotalFields) == null ? void 0 : _a2.includes) == null ? void 0 : _b.call(
15451
+ _a2,
15452
+ column2.dataIndex
15453
+ ));
15454
+ const summaryFormat = (text) => {
15455
+ return text ? utils.isNumber(+text) && !isNaN(+text) ? Number.parseFloat((+text).toFixed(2)).toLocaleString("en-US") : text : "";
15456
+ };
15457
+ const {
15458
+ slots,
15459
+ customRender,
15460
+ format: format2 = isSummaryCol ? summaryFormat : void 0,
15461
+ edit,
15462
+ editRow,
15463
+ flag
15464
+ } = column2;
15302
15465
  if (!slots || !(slots == null ? void 0 : slots.title)) {
15303
15466
  column2.customTitle = column2.title;
15304
15467
  Reflect.deleteProperty(column2, "title");
@@ -15484,7 +15647,7 @@ function useDataSource(propsRef, {
15484
15647
  const obj = {};
15485
15648
  summaryTotalFields.forEach((field) => {
15486
15649
  const total = dataSourceRef.value.reduce((acc, cur) => {
15487
- return acc + (cur[field] || 0);
15650
+ return +acc + (+cur[field] || 0);
15488
15651
  }, 0);
15489
15652
  obj[field] = Number.parseFloat(total.toFixed(2)).toLocaleString("en-US");
15490
15653
  });
@@ -15500,7 +15663,9 @@ function useDataSource(propsRef, {
15500
15663
  immediate: true
15501
15664
  }
15502
15665
  );
15666
+ let oldSortInfoRef;
15503
15667
  function handleTableChange(pagination, filters, sorter) {
15668
+ const isChangeSorter = !eq(oldSortInfoRef, sorter.order);
15504
15669
  const { clearSelectOnPageChange, sortFn, filterFn } = vue.unref(propsRef);
15505
15670
  if (clearSelectOnPageChange) {
15506
15671
  clearSelectedRowKeys();
@@ -15518,6 +15683,10 @@ function useDataSource(propsRef, {
15518
15683
  searchState.filterInfo = filterInfo;
15519
15684
  params.filterInfo = filterInfo;
15520
15685
  }
15686
+ if (isChangeSorter && !vue.unref(propsRef).isSortFetch) {
15687
+ oldSortInfoRef = sorter.order;
15688
+ return;
15689
+ }
15521
15690
  fetch(params);
15522
15691
  }
15523
15692
  function setTableKey(items) {
@@ -16027,6 +16196,20 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef, getDa
16027
16196
  vue.nextTick(() => {
16028
16197
  debounceRedoHeight();
16029
16198
  });
16199
+ const table2 = vue.unref(tableElRef);
16200
+ if (!table2)
16201
+ return;
16202
+ const tableEl = table2.$el;
16203
+ if (!tableEl)
16204
+ return;
16205
+ const bodyEl2 = tableEl.querySelector(".ant-table-tbody");
16206
+ if (!bodyEl2)
16207
+ return;
16208
+ new Sortablejs(bodyEl2, {
16209
+ ghostClass: "bg-gray-100",
16210
+ handle: ".ant-table-cell .ant-table-cell-index",
16211
+ draggable: ".ant-table-row"
16212
+ });
16030
16213
  });
16031
16214
  const getScrollX = vue.computed(() => {
16032
16215
  var _a2;
@@ -17751,6 +17934,7 @@ const basicProps$3 = vue.reactive({
17751
17934
  }
17752
17935
  },
17753
17936
  inset: Boolean,
17937
+ isSortFetch: { type: Boolean, default: true },
17754
17938
  sortFn: {
17755
17939
  type: Function,
17756
17940
  default: DEFAULT_SORT_FN
@@ -19650,9 +19834,7 @@ const _sfc_main$i = vue.defineComponent({
19650
19834
  () => visibleRef.value,
19651
19835
  (visible) => {
19652
19836
  vue.nextTick(() => {
19653
- var _a2;
19654
19837
  emit("visible-change", visible);
19655
- instance && ((_a2 = drawerInstance.emitVisible) == null ? void 0 : _a2.call(drawerInstance, visible, instance.uid));
19656
19838
  });
19657
19839
  }
19658
19840
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "3.0.0-next.6",
3
+ "version": "3.0.0-next.7",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",