3h1-ui 2.15.0 → 2.15.3

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
@@ -7278,7 +7278,7 @@ const _hoisted_5$4 = {
7278
7278
  key: 0,
7279
7279
  class: "flex py-2 items-center justify-center"
7280
7280
  };
7281
- const _hoisted_6$1 = {
7281
+ const _hoisted_6$2 = {
7282
7282
  key: 1,
7283
7283
  class: "p-5"
7284
7284
  };
@@ -7420,7 +7420,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
7420
7420
  onChange: handlePageChange
7421
7421
  }, null, 8, ["pageSize", "total"])
7422
7422
  ])) : createCommentVNode("", true)
7423
- ])) : (openBlock(), createElementBlock("div", _hoisted_6$1, [
7423
+ ])) : (openBlock(), createElementBlock("div", _hoisted_6$2, [
7424
7424
  createVNode(unref(AEmpty))
7425
7425
  ]))
7426
7426
  ]),
@@ -7615,12 +7615,13 @@ const _hoisted_2$9 = {
7615
7615
  key: 0,
7616
7616
  class: "table-children-required"
7617
7617
  };
7618
- const _hoisted_3$6 = {
7618
+ const _hoisted_3$6 = { class: "text-red-500" };
7619
+ const _hoisted_4$4 = {
7619
7620
  key: 0,
7620
7621
  class: "table-children-delete-index"
7621
7622
  };
7622
- const _hoisted_4$4 = ["onClick"];
7623
- const _hoisted_5$3 = {
7623
+ const _hoisted_5$3 = ["onClick"];
7624
+ const _hoisted_6$1 = {
7624
7625
  key: 2,
7625
7626
  class: "table-children-delete-index"
7626
7627
  };
@@ -7647,7 +7648,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7647
7648
  emits: ["update:value", "change", "add", "remove"],
7648
7649
  setup(__props, { expose, emit }) {
7649
7650
  const props2 = __props;
7650
- const listFormRefs = ref([]);
7651
+ const formActionType = inject("formActionType");
7651
7652
  const emitData = ref([]);
7652
7653
  const [state] = useRuleFormItem(props2, "value", "change", emitData);
7653
7654
  const getColumns = computed(() => {
@@ -7681,17 +7682,63 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7681
7682
  emit("remove", state.value, index2);
7682
7683
  };
7683
7684
  const getPopupContainer2 = () => document.body;
7684
- const loadKv = () => {
7685
- const columns = props2.columns;
7686
- let dicData = [];
7687
- columns.forEach(async (column) => {
7688
- if (column == null ? void 0 : column.api) {
7689
- dicData = await column.api();
7690
- column.dicData = dicData;
7691
- }
7685
+ const rulesRef = reactive({});
7686
+ const getRules = ({ column, record, index: index2, ...args }) => {
7687
+ var _a2, _b;
7688
+ const errKey = `${column.dataIndex}-${record.uuid}Info`;
7689
+ if (!column.required)
7690
+ return [];
7691
+ if ((_a2 = rulesRef[errKey]) == null ? void 0 : _a2.rules)
7692
+ return (_b = rulesRef[errKey]) == null ? void 0 : _b.rules;
7693
+ rulesRef[errKey] = {
7694
+ rules: [],
7695
+ show: false,
7696
+ msg: ""
7697
+ };
7698
+ if (!column.rules && column.required) {
7699
+ rulesRef[errKey].rules = [
7700
+ {
7701
+ required: true,
7702
+ validator: (rule, value) => {
7703
+ const prefix = column.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
7704
+ const errMsg = `${prefix}${column.title}`;
7705
+ if (value) {
7706
+ rulesRef[errKey].show = false;
7707
+ return Promise.resolve();
7708
+ }
7709
+ rulesRef[errKey].show = true;
7710
+ rulesRef[errKey].msg = errMsg;
7711
+ return Promise.reject(errMsg);
7712
+ }
7713
+ }
7714
+ ];
7715
+ return rulesRef[errKey].rules;
7716
+ }
7717
+ if (!isArray$2(column.rules))
7718
+ return column.rules;
7719
+ rulesRef[errKey].rules = cloneDeep(column.rules);
7720
+ rulesRef[errKey].rules.forEach((item) => {
7721
+ if (!item.validator || !isFunction$4(item.validator))
7722
+ return;
7723
+ const validator = item.validator;
7724
+ item.validator = async (rule, value) => {
7725
+ try {
7726
+ rulesRef[errKey].show = false;
7727
+ return await validator(
7728
+ rule,
7729
+ value,
7730
+ { column, record, ...args },
7731
+ formActionType
7732
+ );
7733
+ } catch (error2) {
7734
+ rulesRef[errKey].show = true;
7735
+ rulesRef[errKey].msg = error2;
7736
+ return Promise.reject(error2);
7737
+ }
7738
+ };
7692
7739
  });
7740
+ return rulesRef[errKey].rules;
7693
7741
  };
7694
- loadKv();
7695
7742
  watch(
7696
7743
  () => state.value,
7697
7744
  (v, old) => {
@@ -7711,6 +7758,17 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7711
7758
  deep: true
7712
7759
  }
7713
7760
  );
7761
+ const loadKv = () => {
7762
+ const columns = props2.columns;
7763
+ let dicData = [];
7764
+ columns.forEach(async (column) => {
7765
+ if (column == null ? void 0 : column.api) {
7766
+ dicData = await column.api();
7767
+ column.dicData = dicData;
7768
+ }
7769
+ });
7770
+ };
7771
+ const listFormRefs = ref([]);
7714
7772
  const validate = async () => {
7715
7773
  try {
7716
7774
  for (let formRef of listFormRefs.value) {
@@ -7720,6 +7778,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7720
7778
  throw new Error("校验失败");
7721
7779
  }
7722
7780
  };
7781
+ loadKv();
7723
7782
  expose({ validate });
7724
7783
  return (_ctx, _cache) => {
7725
7784
  return openBlock(), createBlock(unref(Table$1), {
@@ -7751,63 +7810,80 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7751
7810
  bodyCell: withCtx(({ column, record, index: index2, ...args }) => [
7752
7811
  column.dataIndex !== "index" && column.type !== "text" ? (openBlock(), createBlock(unref(FormItem), {
7753
7812
  required: column.required,
7754
- rules: (column == null ? void 0 : column.rules) || [],
7813
+ rules: getRules({ column, record, index: index2, ...args }),
7755
7814
  name: [_ctx.$attrs.codeField, index2, column.dataIndex],
7756
7815
  key: record[__props.rowKey]
7757
7816
  }, {
7758
- default: withCtx(() => [
7759
- column.type === "select" ? (openBlock(), createBlock(unref(Select), {
7760
- key: 0,
7761
- value: record[column.dataIndex],
7762
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7763
- options: column.dicData,
7764
- mode: column.mode,
7765
- "max-tag-count": column.maxTagCount,
7766
- "max-tag-text-length": column.maxTagTextLength
7767
- }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column.type === "datePicker" ? (openBlock(), createBlock(unref(DatePicker), {
7768
- key: 1,
7769
- value: record[column.dataIndex],
7770
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7771
- valueFormat: "YYYY-MM-DD HH:mm:ss"
7772
- }, null, 8, ["value", "onUpdate:value"])) : column.type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
7773
- key: 2,
7774
- value: record[column.dataIndex],
7775
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7776
- min: column.min,
7777
- max: column.max,
7778
- precision: column.precision ?? 2
7779
- }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column.type === "input" ? (openBlock(), createBlock(unref(Input), {
7780
- key: 3,
7781
- value: record[column.dataIndex],
7782
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7783
- disabled: !props2.isShowAction
7784
- }, null, 8, ["value", "onUpdate:value", "disabled"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(componentMap$2).get(column.type)), mergeProps(
7785
- {
7786
- key: 4,
7787
- allowClear: "",
7788
- getPopupContainer: getPopupContainer2,
7789
- style: { width: "100%" }
7790
- },
7791
- unref(isFunction$4)(column.componentProps) ? column.componentProps({ record, column, index: index2, ...args }) : column.componentProps,
7792
- {
7793
- value: record[column.dataIndex],
7794
- "onUpdate:value": ($event) => record[column.dataIndex] = $event
7795
- }
7796
- ), null, 16, ["value", "onUpdate:value"]))
7797
- ]),
7817
+ default: withCtx(() => {
7818
+ var _a2;
7819
+ return [
7820
+ createVNode(unref(Popover), {
7821
+ overlayClassName: "table-children-err-popover",
7822
+ visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a2.show)
7823
+ }, {
7824
+ content: withCtx(() => {
7825
+ var _a3;
7826
+ return [
7827
+ createElementVNode("span", _hoisted_3$6, toDisplayString((_a3 = rulesRef[`${column.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a3.msg), 1)
7828
+ ];
7829
+ }),
7830
+ default: withCtx(() => [
7831
+ column.type === "select" ? (openBlock(), createBlock(unref(Select), {
7832
+ key: 0,
7833
+ value: record[column.dataIndex],
7834
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7835
+ options: column.dicData,
7836
+ mode: column.mode,
7837
+ "max-tag-count": column.maxTagCount,
7838
+ "max-tag-text-length": column.maxTagTextLength
7839
+ }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column.type === "datePicker" ? (openBlock(), createBlock(unref(DatePicker), {
7840
+ key: 1,
7841
+ value: record[column.dataIndex],
7842
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7843
+ valueFormat: "YYYY-MM-DD HH:mm:ss"
7844
+ }, null, 8, ["value", "onUpdate:value"])) : column.type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
7845
+ key: 2,
7846
+ value: record[column.dataIndex],
7847
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7848
+ min: column.min,
7849
+ max: column.max,
7850
+ precision: column.precision ?? 2
7851
+ }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column.type === "input" ? (openBlock(), createBlock(unref(Input), {
7852
+ key: 3,
7853
+ value: record[column.dataIndex],
7854
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7855
+ disabled: !props2.isShowAction
7856
+ }, null, 8, ["value", "onUpdate:value", "disabled"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(componentMap$2).get(column.type)), mergeProps(
7857
+ {
7858
+ key: 4,
7859
+ allowClear: "",
7860
+ getPopupContainer: getPopupContainer2,
7861
+ style: { width: "100%" }
7862
+ },
7863
+ unref(isFunction$4)(column.componentProps) ? column.componentProps({ record, column, index: index2, ...args }) : column.componentProps,
7864
+ {
7865
+ value: record[column.dataIndex],
7866
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event
7867
+ }
7868
+ ), null, 16, ["value", "onUpdate:value"]))
7869
+ ]),
7870
+ _: 2
7871
+ }, 1032, ["visible"])
7872
+ ];
7873
+ }),
7798
7874
  _: 2
7799
7875
  }, 1032, ["required", "rules", "name"])) : column.dataIndex === "index" ? (openBlock(), createElementBlock("div", {
7800
7876
  class: "table-children-delete-wrapper",
7801
7877
  key: record[__props.rowKey]
7802
7878
  }, [
7803
- __props.isShowAction ? (openBlock(), createElementBlock("span", _hoisted_3$6, toDisplayString(index2 + 1), 1)) : createCommentVNode("", true),
7879
+ __props.isShowAction ? (openBlock(), createElementBlock("span", _hoisted_4$4, toDisplayString(index2 + 1), 1)) : createCommentVNode("", true),
7804
7880
  __props.isShowAction ? (openBlock(), createElementBlock("div", {
7805
7881
  key: 1,
7806
7882
  class: "table-children-delete-item",
7807
7883
  onClick: ($event) => rowClickEvent(record[__props.rowKey])
7808
7884
  }, [
7809
7885
  createVNode(unref(DeleteFilled$1), { style: { color: "#fff" } })
7810
- ], 8, _hoisted_4$4)) : (openBlock(), createElementBlock("span", _hoisted_5$3, toDisplayString(index2 + 1), 1))
7886
+ ], 8, _hoisted_5$3)) : (openBlock(), createElementBlock("span", _hoisted_6$1, toDisplayString(index2 + 1), 1))
7811
7887
  ])) : createCommentVNode("", true)
7812
7888
  ]),
7813
7889
  _: 1
@@ -7815,8 +7891,8 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7815
7891
  };
7816
7892
  }
7817
7893
  });
7818
- const Table_vue_vue_type_style_index_0_scoped_d996cbc3_lang = "";
7819
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-d996cbc3"]]);
7894
+ const Table_vue_vue_type_style_index_0_scoped_9cf892ac_lang = "";
7895
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-9cf892ac"]]);
7820
7896
  const modal = "";
7821
7897
  useI18n$1();
7822
7898
  const modalProps = {
@@ -12234,28 +12310,30 @@ const _sfc_main$M = defineComponent({
12234
12310
  () => formModel,
12235
12311
  useDebounceFn$1((val) => {
12236
12312
  var _a2;
12313
+ if (isEqual(toRaw(val), toRaw(tempFormModel)))
12314
+ return;
12237
12315
  for (const key2 in val) {
12238
- if (val[key2] !== tempFormModel[key2]) {
12239
- (_a2 = unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12240
- var _a3;
12241
- const isComponentProps = item.field === key2 && item.componentProps;
12242
- if (isComponentProps && !isFunction$4(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12243
- item.componentProps.onModelChange(val[key2]);
12244
- } else if (isComponentProps && isFunction$4(item.componentProps)) {
12245
- const modelProps = item.componentProps({
12246
- schema: item,
12247
- formModel,
12248
- formActionType,
12249
- tableAction: props2.tableAction
12250
- });
12251
- if (modelProps.onModelChange) {
12252
- modelProps.onModelChange(val[key2]);
12253
- }
12316
+ if (isEqual(toRaw(val[key2]), toRaw(tempFormModel[key2])))
12317
+ continue;
12318
+ (_a2 = unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12319
+ var _a3;
12320
+ const isComponentProps = item.field === key2 && item.componentProps;
12321
+ if (isComponentProps && !isFunction$4(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12322
+ item.componentProps.onModelChange(val[key2]);
12323
+ } else if (isComponentProps && isFunction$4(item.componentProps)) {
12324
+ const modelProps = item.componentProps({
12325
+ schema: item,
12326
+ formModel,
12327
+ formActionType,
12328
+ tableAction: props2.tableAction
12329
+ });
12330
+ if (modelProps.onModelChange) {
12331
+ modelProps.onModelChange(val[key2]);
12254
12332
  }
12255
- });
12256
- }
12333
+ }
12334
+ });
12257
12335
  }
12258
- Object.assign(tempFormModel, formModel);
12336
+ Object.assign(tempFormModel, cloneDeep(formModel));
12259
12337
  unref(getProps).submitOnChange && handleSubmit();
12260
12338
  }, 300),
12261
12339
  { deep: true }
@@ -12298,6 +12376,7 @@ const _sfc_main$M = defineComponent({
12298
12376
  submit: handleSubmit,
12299
12377
  scrollToField
12300
12378
  };
12379
+ provide("formActionType", formActionType);
12301
12380
  const clearCurrValidate = (field) => {
12302
12381
  clearValidate([field]);
12303
12382
  };
package/es/style.css CHANGED
@@ -431,6 +431,10 @@ ul {
431
431
  .resize {
432
432
  resize: both;
433
433
  }
434
+ .text-red-500 {
435
+ --tw-text-opacity: 1;
436
+ color: rgba(239, 68, 68, var(--tw-text-opacity));
437
+ }
434
438
  .truncate {
435
439
  overflow: hidden;
436
440
  -o-text-overflow: ellipsis;
@@ -24875,40 +24879,40 @@ span.iconify {
24875
24879
  .shy-tinymce-container textarea {
24876
24880
  z-index: -1;
24877
24881
  visibility: hidden;
24878
- }.shy-table-edit-icon-plus[data-v-d996cbc3] {
24882
+ }.shy-table-edit-icon-plus[data-v-9cf892ac] {
24879
24883
  width: 30px;
24880
24884
  height: 30px;
24881
24885
  font-size: 30px;
24882
24886
  cursor: pointer;
24883
24887
  display: flex;
24884
24888
  }
24885
- .table-children[data-v-d996cbc3] .ant-form-item {
24889
+ .table-children[data-v-9cf892ac] .ant-form-item {
24886
24890
  margin-bottom: 0 !important;
24887
24891
  }
24888
- .table-children-required[data-v-d996cbc3] {
24892
+ .table-children-required[data-v-9cf892ac] {
24889
24893
  color: #ff4d4f;
24890
24894
  margin-right: 4px;
24891
24895
  }
24892
- .table-children[data-v-d996cbc3] .ant-table-cell {
24896
+ .table-children[data-v-9cf892ac] .ant-table-cell {
24893
24897
  padding: 8px !important;
24894
24898
  }
24895
- .table-children[data-v-d996cbc3] .ant-table-cell .ant-form-item-explain {
24899
+ .table-children[data-v-9cf892ac] .ant-table-cell .ant-form-item-explain {
24896
24900
  display: none;
24897
24901
  }
24898
- .table-children-delete-wrapper[data-v-d996cbc3] {
24902
+ .table-children-delete-wrapper[data-v-9cf892ac] {
24899
24903
  display: flex;
24900
24904
  height: 100%;
24901
24905
  justify-content: center;
24902
24906
  }
24903
- .table-children-delete-wrapper:hover .table-children-delete-item[data-v-d996cbc3] {
24907
+ .table-children-delete-wrapper:hover .table-children-delete-item[data-v-9cf892ac] {
24904
24908
  display: flex;
24905
24909
  justify-content: center;
24906
24910
  align-items: center;
24907
24911
  }
24908
- .table-children-delete-wrapper:hover .table-children-delete-index[data-v-d996cbc3] {
24912
+ .table-children-delete-wrapper:hover .table-children-delete-index[data-v-9cf892ac] {
24909
24913
  display: none;
24910
24914
  }
24911
- .table-children-delete-item[data-v-d996cbc3] {
24915
+ .table-children-delete-item[data-v-9cf892ac] {
24912
24916
  background-color: red;
24913
24917
  border-radius: 50%;
24914
24918
  width: 30px;
@@ -24917,7 +24921,7 @@ span.iconify {
24917
24921
  display: none;
24918
24922
  cursor: pointer;
24919
24923
  }
24920
- .table-children-delete-index[data-v-d996cbc3] {
24924
+ .table-children-delete-index[data-v-9cf892ac] {
24921
24925
  user-select: none;
24922
24926
  display: inline-block;
24923
24927
  }@media screen and (max-height: 600px) {
@@ -25278,6 +25282,9 @@ span.iconify {
25278
25282
  height: 14px;
25279
25283
  content: '';
25280
25284
  background: #2991ff;
25285
+ }
25286
+ .table-children-err-popover .ant-popover-inner-content {
25287
+ padding: 6px 16px;
25281
25288
  }.shy-search[data-v-a0f20f9d] {
25282
25289
  position: relative;
25283
25290
  display: flex;
package/lib/index.js CHANGED
@@ -7302,7 +7302,7 @@ const _hoisted_5$4 = {
7302
7302
  key: 0,
7303
7303
  class: "flex py-2 items-center justify-center"
7304
7304
  };
7305
- const _hoisted_6$1 = {
7305
+ const _hoisted_6$2 = {
7306
7306
  key: 1,
7307
7307
  class: "p-5"
7308
7308
  };
@@ -7444,7 +7444,7 @@ const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
7444
7444
  onChange: handlePageChange
7445
7445
  }, null, 8, ["pageSize", "total"])
7446
7446
  ])) : vue.createCommentVNode("", true)
7447
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
7447
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$2, [
7448
7448
  vue.createVNode(vue.unref(AEmpty))
7449
7449
  ]))
7450
7450
  ]),
@@ -7639,12 +7639,13 @@ const _hoisted_2$9 = {
7639
7639
  key: 0,
7640
7640
  class: "table-children-required"
7641
7641
  };
7642
- const _hoisted_3$6 = {
7642
+ const _hoisted_3$6 = { class: "text-red-500" };
7643
+ const _hoisted_4$4 = {
7643
7644
  key: 0,
7644
7645
  class: "table-children-delete-index"
7645
7646
  };
7646
- const _hoisted_4$4 = ["onClick"];
7647
- const _hoisted_5$3 = {
7647
+ const _hoisted_5$3 = ["onClick"];
7648
+ const _hoisted_6$1 = {
7648
7649
  key: 2,
7649
7650
  class: "table-children-delete-index"
7650
7651
  };
@@ -7671,7 +7672,7 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7671
7672
  emits: ["update:value", "change", "add", "remove"],
7672
7673
  setup(__props, { expose, emit }) {
7673
7674
  const props2 = __props;
7674
- const listFormRefs = vue.ref([]);
7675
+ const formActionType = vue.inject("formActionType");
7675
7676
  const emitData = vue.ref([]);
7676
7677
  const [state] = use.useRuleFormItem(props2, "value", "change", emitData);
7677
7678
  const getColumns = vue.computed(() => {
@@ -7705,17 +7706,63 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7705
7706
  emit("remove", state.value, index2);
7706
7707
  };
7707
7708
  const getPopupContainer2 = () => document.body;
7708
- const loadKv = () => {
7709
- const columns = props2.columns;
7710
- let dicData = [];
7711
- columns.forEach(async (column) => {
7712
- if (column == null ? void 0 : column.api) {
7713
- dicData = await column.api();
7714
- column.dicData = dicData;
7715
- }
7709
+ const rulesRef = vue.reactive({});
7710
+ const getRules = ({ column, record, index: index2, ...args }) => {
7711
+ var _a2, _b;
7712
+ const errKey = `${column.dataIndex}-${record.uuid}Info`;
7713
+ if (!column.required)
7714
+ return [];
7715
+ if ((_a2 = rulesRef[errKey]) == null ? void 0 : _a2.rules)
7716
+ return (_b = rulesRef[errKey]) == null ? void 0 : _b.rules;
7717
+ rulesRef[errKey] = {
7718
+ rules: [],
7719
+ show: false,
7720
+ msg: ""
7721
+ };
7722
+ if (!column.rules && column.required) {
7723
+ rulesRef[errKey].rules = [
7724
+ {
7725
+ required: true,
7726
+ validator: (rule, value) => {
7727
+ const prefix = column.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
7728
+ const errMsg = `${prefix}${column.title}`;
7729
+ if (value) {
7730
+ rulesRef[errKey].show = false;
7731
+ return Promise.resolve();
7732
+ }
7733
+ rulesRef[errKey].show = true;
7734
+ rulesRef[errKey].msg = errMsg;
7735
+ return Promise.reject(errMsg);
7736
+ }
7737
+ }
7738
+ ];
7739
+ return rulesRef[errKey].rules;
7740
+ }
7741
+ if (!isArray$2(column.rules))
7742
+ return column.rules;
7743
+ rulesRef[errKey].rules = cloneDeep(column.rules);
7744
+ rulesRef[errKey].rules.forEach((item) => {
7745
+ if (!item.validator || !utils.isFunction(item.validator))
7746
+ return;
7747
+ const validator = item.validator;
7748
+ item.validator = async (rule, value) => {
7749
+ try {
7750
+ rulesRef[errKey].show = false;
7751
+ return await validator(
7752
+ rule,
7753
+ value,
7754
+ { column, record, ...args },
7755
+ formActionType
7756
+ );
7757
+ } catch (error2) {
7758
+ rulesRef[errKey].show = true;
7759
+ rulesRef[errKey].msg = error2;
7760
+ return Promise.reject(error2);
7761
+ }
7762
+ };
7716
7763
  });
7764
+ return rulesRef[errKey].rules;
7717
7765
  };
7718
- loadKv();
7719
7766
  vue.watch(
7720
7767
  () => state.value,
7721
7768
  (v, old) => {
@@ -7735,6 +7782,17 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7735
7782
  deep: true
7736
7783
  }
7737
7784
  );
7785
+ const loadKv = () => {
7786
+ const columns = props2.columns;
7787
+ let dicData = [];
7788
+ columns.forEach(async (column) => {
7789
+ if (column == null ? void 0 : column.api) {
7790
+ dicData = await column.api();
7791
+ column.dicData = dicData;
7792
+ }
7793
+ });
7794
+ };
7795
+ const listFormRefs = vue.ref([]);
7738
7796
  const validate = async () => {
7739
7797
  try {
7740
7798
  for (let formRef of listFormRefs.value) {
@@ -7744,6 +7802,7 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7744
7802
  throw new Error("校验失败");
7745
7803
  }
7746
7804
  };
7805
+ loadKv();
7747
7806
  expose({ validate });
7748
7807
  return (_ctx, _cache) => {
7749
7808
  return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Table), {
@@ -7775,63 +7834,80 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7775
7834
  bodyCell: vue.withCtx(({ column, record, index: index2, ...args }) => [
7776
7835
  column.dataIndex !== "index" && column.type !== "text" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.FormItem), {
7777
7836
  required: column.required,
7778
- rules: (column == null ? void 0 : column.rules) || [],
7837
+ rules: getRules({ column, record, index: index2, ...args }),
7779
7838
  name: [_ctx.$attrs.codeField, index2, column.dataIndex],
7780
7839
  key: record[__props.rowKey]
7781
7840
  }, {
7782
- default: vue.withCtx(() => [
7783
- column.type === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), {
7784
- key: 0,
7785
- value: record[column.dataIndex],
7786
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7787
- options: column.dicData,
7788
- mode: column.mode,
7789
- "max-tag-count": column.maxTagCount,
7790
- "max-tag-text-length": column.maxTagTextLength
7791
- }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column.type === "datePicker" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.DatePicker), {
7792
- key: 1,
7793
- value: record[column.dataIndex],
7794
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7795
- valueFormat: "YYYY-MM-DD HH:mm:ss"
7796
- }, null, 8, ["value", "onUpdate:value"])) : column.type === "number" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.InputNumber), {
7797
- key: 2,
7798
- value: record[column.dataIndex],
7799
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7800
- min: column.min,
7801
- max: column.max,
7802
- precision: column.precision ?? 2
7803
- }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column.type === "input" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
7804
- key: 3,
7805
- value: record[column.dataIndex],
7806
- "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7807
- disabled: !props2.isShowAction
7808
- }, null, 8, ["value", "onUpdate:value", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(componentMap$2).get(column.type)), vue.mergeProps(
7809
- {
7810
- key: 4,
7811
- allowClear: "",
7812
- getPopupContainer: getPopupContainer2,
7813
- style: { width: "100%" }
7814
- },
7815
- vue.unref(utils.isFunction)(column.componentProps) ? column.componentProps({ record, column, index: index2, ...args }) : column.componentProps,
7816
- {
7817
- value: record[column.dataIndex],
7818
- "onUpdate:value": ($event) => record[column.dataIndex] = $event
7819
- }
7820
- ), null, 16, ["value", "onUpdate:value"]))
7821
- ]),
7841
+ default: vue.withCtx(() => {
7842
+ var _a2;
7843
+ return [
7844
+ vue.createVNode(vue.unref(antDesignVue.Popover), {
7845
+ overlayClassName: "table-children-err-popover",
7846
+ visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a2.show)
7847
+ }, {
7848
+ content: vue.withCtx(() => {
7849
+ var _a3;
7850
+ return [
7851
+ vue.createElementVNode("span", _hoisted_3$6, vue.toDisplayString((_a3 = rulesRef[`${column.dataIndex}-${record.uuid}Info`]) == null ? void 0 : _a3.msg), 1)
7852
+ ];
7853
+ }),
7854
+ default: vue.withCtx(() => [
7855
+ column.type === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), {
7856
+ key: 0,
7857
+ value: record[column.dataIndex],
7858
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7859
+ options: column.dicData,
7860
+ mode: column.mode,
7861
+ "max-tag-count": column.maxTagCount,
7862
+ "max-tag-text-length": column.maxTagTextLength
7863
+ }, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column.type === "datePicker" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.DatePicker), {
7864
+ key: 1,
7865
+ value: record[column.dataIndex],
7866
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7867
+ valueFormat: "YYYY-MM-DD HH:mm:ss"
7868
+ }, null, 8, ["value", "onUpdate:value"])) : column.type === "number" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.InputNumber), {
7869
+ key: 2,
7870
+ value: record[column.dataIndex],
7871
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7872
+ min: column.min,
7873
+ max: column.max,
7874
+ precision: column.precision ?? 2
7875
+ }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column.type === "input" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
7876
+ key: 3,
7877
+ value: record[column.dataIndex],
7878
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7879
+ disabled: !props2.isShowAction
7880
+ }, null, 8, ["value", "onUpdate:value", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(componentMap$2).get(column.type)), vue.mergeProps(
7881
+ {
7882
+ key: 4,
7883
+ allowClear: "",
7884
+ getPopupContainer: getPopupContainer2,
7885
+ style: { width: "100%" }
7886
+ },
7887
+ vue.unref(utils.isFunction)(column.componentProps) ? column.componentProps({ record, column, index: index2, ...args }) : column.componentProps,
7888
+ {
7889
+ value: record[column.dataIndex],
7890
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event
7891
+ }
7892
+ ), null, 16, ["value", "onUpdate:value"]))
7893
+ ]),
7894
+ _: 2
7895
+ }, 1032, ["visible"])
7896
+ ];
7897
+ }),
7822
7898
  _: 2
7823
7899
  }, 1032, ["required", "rules", "name"])) : column.dataIndex === "index" ? (vue.openBlock(), vue.createElementBlock("div", {
7824
7900
  class: "table-children-delete-wrapper",
7825
7901
  key: record[__props.rowKey]
7826
7902
  }, [
7827
- __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$6, vue.toDisplayString(index2 + 1), 1)) : vue.createCommentVNode("", true),
7903
+ __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$4, vue.toDisplayString(index2 + 1), 1)) : vue.createCommentVNode("", true),
7828
7904
  __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("div", {
7829
7905
  key: 1,
7830
7906
  class: "table-children-delete-item",
7831
7907
  onClick: ($event) => rowClickEvent(record[__props.rowKey])
7832
7908
  }, [
7833
7909
  vue.createVNode(vue.unref(DeleteFilled$1), { style: { color: "#fff" } })
7834
- ], 8, _hoisted_4$4)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$3, vue.toDisplayString(index2 + 1), 1))
7910
+ ], 8, _hoisted_5$3)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$1, vue.toDisplayString(index2 + 1), 1))
7835
7911
  ])) : vue.createCommentVNode("", true)
7836
7912
  ]),
7837
7913
  _: 1
@@ -7839,8 +7915,8 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7839
7915
  };
7840
7916
  }
7841
7917
  });
7842
- const Table_vue_vue_type_style_index_0_scoped_d996cbc3_lang = "";
7843
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-d996cbc3"]]);
7918
+ const Table_vue_vue_type_style_index_0_scoped_9cf892ac_lang = "";
7919
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-9cf892ac"]]);
7844
7920
  const modal = "";
7845
7921
  use.useI18n();
7846
7922
  const modalProps = {
@@ -12258,28 +12334,30 @@ const _sfc_main$M = vue.defineComponent({
12258
12334
  () => formModel,
12259
12335
  useDebounceFn$1((val) => {
12260
12336
  var _a2;
12337
+ if (isEqual(vue.toRaw(val), vue.toRaw(tempFormModel)))
12338
+ return;
12261
12339
  for (const key2 in val) {
12262
- if (val[key2] !== tempFormModel[key2]) {
12263
- (_a2 = vue.unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12264
- var _a3;
12265
- const isComponentProps = item.field === key2 && item.componentProps;
12266
- if (isComponentProps && !utils.isFunction(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12267
- item.componentProps.onModelChange(val[key2]);
12268
- } else if (isComponentProps && utils.isFunction(item.componentProps)) {
12269
- const modelProps = item.componentProps({
12270
- schema: item,
12271
- formModel,
12272
- formActionType,
12273
- tableAction: props2.tableAction
12274
- });
12275
- if (modelProps.onModelChange) {
12276
- modelProps.onModelChange(val[key2]);
12277
- }
12340
+ if (isEqual(vue.toRaw(val[key2]), vue.toRaw(tempFormModel[key2])))
12341
+ continue;
12342
+ (_a2 = vue.unref(getProps).schemas) == null ? void 0 : _a2.forEach((item) => {
12343
+ var _a3;
12344
+ const isComponentProps = item.field === key2 && item.componentProps;
12345
+ if (isComponentProps && !utils.isFunction(item.componentProps) && ((_a3 = item.componentProps) == null ? void 0 : _a3.onModelChange)) {
12346
+ item.componentProps.onModelChange(val[key2]);
12347
+ } else if (isComponentProps && utils.isFunction(item.componentProps)) {
12348
+ const modelProps = item.componentProps({
12349
+ schema: item,
12350
+ formModel,
12351
+ formActionType,
12352
+ tableAction: props2.tableAction
12353
+ });
12354
+ if (modelProps.onModelChange) {
12355
+ modelProps.onModelChange(val[key2]);
12278
12356
  }
12279
- });
12280
- }
12357
+ }
12358
+ });
12281
12359
  }
12282
- Object.assign(tempFormModel, formModel);
12360
+ Object.assign(tempFormModel, cloneDeep(formModel));
12283
12361
  vue.unref(getProps).submitOnChange && handleSubmit();
12284
12362
  }, 300),
12285
12363
  { deep: true }
@@ -12322,6 +12400,7 @@ const _sfc_main$M = vue.defineComponent({
12322
12400
  submit: handleSubmit,
12323
12401
  scrollToField
12324
12402
  };
12403
+ vue.provide("formActionType", formActionType);
12325
12404
  const clearCurrValidate = (field) => {
12326
12405
  clearValidate([field]);
12327
12406
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "2.15.0",
3
+ "version": "2.15.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -29,8 +29,8 @@
29
29
  "vue-json-pretty": "^2.2.3",
30
30
  "vxe-table": "^4.3.6",
31
31
  "xe-utils": "^3.5.7",
32
- "@shy-plugins/tinymce": "^1.0.6",
33
32
  "@shy-plugins/use": "1.0.9",
33
+ "@shy-plugins/tinymce": "^1.0.6",
34
34
  "@shy-plugins/utils": "1.1.1"
35
35
  },
36
36
  "types": "es/ui/index.d.ts",