3h1-ui 2.14.93 → 2.14.94

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
@@ -4071,9 +4071,16 @@ const _sfc_main$1q = defineComponent({
4071
4071
  return prev;
4072
4072
  }, []);
4073
4073
  });
4074
- watchEffect(() => {
4075
- props2.immediate && !props2.alwaysLoad && fetch();
4076
- });
4074
+ watch(
4075
+ () => props2.immediate && !props2.alwaysLoad,
4076
+ (val) => {
4077
+ if (val)
4078
+ fetch();
4079
+ },
4080
+ {
4081
+ immediate: true
4082
+ }
4083
+ );
4077
4084
  watch(
4078
4085
  () => state.value,
4079
4086
  (v) => {
@@ -4132,8 +4139,9 @@ const _sfc_main$1q = defineComponent({
4132
4139
  function emitChange() {
4133
4140
  emit("options-change", unref(getOptions));
4134
4141
  }
4135
- function handleChange(_, ...args) {
4142
+ function handleChange(val, ...args) {
4136
4143
  emitData.value = args;
4144
+ emit("update:value", val);
4137
4145
  }
4138
4146
  const filterOption = (input, option) => {
4139
4147
  var _a2, _b, _c;
@@ -7618,6 +7626,10 @@ const _hoisted_5$3 = {
7618
7626
  const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7619
7627
  __name: "Table",
7620
7628
  props: {
7629
+ rowKey: {
7630
+ type: String,
7631
+ default: () => "uuid"
7632
+ },
7621
7633
  columns: {
7622
7634
  type: Array,
7623
7635
  default: () => []
@@ -7647,20 +7659,27 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7647
7659
  width: 50,
7648
7660
  align: "center"
7649
7661
  };
7650
- return [indexColumn, ...props2.columns];
7662
+ return [
7663
+ indexColumn,
7664
+ ...props2.columns.map((item) => ({
7665
+ ...item,
7666
+ type: item.type ? item.type : "input"
7667
+ }))
7668
+ ];
7651
7669
  });
7652
7670
  const plusClickEvent = () => {
7653
- state.value = [{ uuid: buildUUID() }, ...state.value];
7671
+ state.value = [{ [props2.rowKey]: buildUUID() }, ...state.value];
7654
7672
  emit("add", state.value);
7655
7673
  };
7656
7674
  const rowClickEvent = (index2) => {
7657
7675
  const tempState = state.value.filter((item) => {
7658
- return item["uuid"] !== index2;
7676
+ return item[props2.rowKey] !== index2;
7659
7677
  });
7660
- tempState.forEach((item) => item["uuid"] = buildUUID());
7678
+ tempState.forEach((item) => item[props2.rowKey] = buildUUID());
7661
7679
  state.value = [...tempState];
7662
7680
  emit("remove", state.value, index2);
7663
7681
  };
7682
+ const getPopupContainer2 = () => document.body;
7664
7683
  const loadKv = () => {
7665
7684
  const columns = props2.columns;
7666
7685
  let dicData = [];
@@ -7682,6 +7701,20 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7682
7701
  }
7683
7702
  // { immediate: true }
7684
7703
  );
7704
+ watch(
7705
+ () => props2.value,
7706
+ (v) => {
7707
+ if (v.length) {
7708
+ state.value = v.map((ele) => ({
7709
+ ...ele,
7710
+ [props2.rowKey]: buildUUID()
7711
+ }));
7712
+ }
7713
+ },
7714
+ {
7715
+ immediate: true
7716
+ }
7717
+ );
7685
7718
  const validate = async () => {
7686
7719
  try {
7687
7720
  for (let formRef of listFormRefs.value) {
@@ -7702,26 +7735,29 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7702
7735
  class: "table-children",
7703
7736
  align: "center"
7704
7737
  }, {
7705
- headerCell: withCtx(({ column }) => [
7706
- column.dataIndex === "index" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7707
- __props.isShowAction ? (openBlock(), createElementBlock("div", {
7708
- key: 0,
7709
- class: "shy-table-edit-icon-plus",
7710
- onClick: plusClickEvent
7711
- }, [
7712
- createVNode(unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
7713
- ])) : (openBlock(), createElementBlock("div", _hoisted_1$t, "序号"))
7714
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7715
- column.required ? (openBlock(), createElementBlock("span", _hoisted_2$9, "*")) : createCommentVNode("", true),
7716
- createElementVNode("span", null, toDisplayString(column.title), 1)
7717
- ], 64))
7718
- ]),
7719
- bodyCell: withCtx(({ column, record, index: index2 }) => [
7720
- column.dataIndex !== "index" ? (openBlock(), createBlock(unref(FormItem), {
7738
+ headerCell: withCtx(({ column }) => {
7739
+ var _a2;
7740
+ return [
7741
+ column.dataIndex === "index" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7742
+ __props.isShowAction ? (openBlock(), createElementBlock("div", {
7743
+ key: 0,
7744
+ class: "shy-table-edit-icon-plus",
7745
+ onClick: plusClickEvent
7746
+ }, [
7747
+ createVNode(unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
7748
+ ])) : (openBlock(), createElementBlock("div", _hoisted_1$t, "序号"))
7749
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7750
+ column.required || ((_a2 = column == null ? void 0 : column.rules) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("span", _hoisted_2$9, "*")) : createCommentVNode("", true),
7751
+ createElementVNode("span", null, toDisplayString(column.title), 1)
7752
+ ], 64))
7753
+ ];
7754
+ }),
7755
+ bodyCell: withCtx(({ column, record, index: index2, ...args }) => [
7756
+ column.dataIndex !== "index" && column.type !== "text" ? (openBlock(), createBlock(unref(FormItem), {
7721
7757
  required: column.required,
7722
7758
  rules: (column == null ? void 0 : column.rules) || [],
7723
7759
  name: [_ctx.$attrs.codeField, index2, column.dataIndex],
7724
- key: record["uuid"]
7760
+ key: record[__props.rowKey]
7725
7761
  }, {
7726
7762
  default: withCtx(() => [
7727
7763
  column.type === "select" ? (openBlock(), createBlock(unref(Select), {
@@ -7744,35 +7780,47 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7744
7780
  min: column.min,
7745
7781
  max: column.max,
7746
7782
  precision: column.precision ?? 2
7747
- }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : (openBlock(), createBlock(unref(Input), {
7783
+ }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column.type === "input" ? (openBlock(), createBlock(unref(Input), {
7748
7784
  key: 3,
7749
7785
  value: record[column.dataIndex],
7750
7786
  "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7751
7787
  disabled: !props2.isShowAction
7752
- }, null, 8, ["value", "onUpdate:value", "disabled"]))
7788
+ }, null, 8, ["value", "onUpdate:value", "disabled"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(componentMap$2).get(column.type)), mergeProps(
7789
+ {
7790
+ key: 4,
7791
+ allowClear: "",
7792
+ getPopupContainer: getPopupContainer2,
7793
+ style: { width: "100%" }
7794
+ },
7795
+ unref(isFunction$4)(column.componentProps) ? column.componentProps({ record, column, index: index2, ...args }) : column.componentProps,
7796
+ {
7797
+ value: record[column.dataIndex],
7798
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event
7799
+ }
7800
+ ), null, 16, ["value", "onUpdate:value"]))
7753
7801
  ]),
7754
7802
  _: 2
7755
- }, 1032, ["required", "rules", "name"])) : (openBlock(), createElementBlock("div", {
7803
+ }, 1032, ["required", "rules", "name"])) : column.dataIndex === "index" ? (openBlock(), createElementBlock("div", {
7756
7804
  class: "table-children-delete-wrapper",
7757
- key: record["uuid"]
7805
+ key: record[__props.rowKey]
7758
7806
  }, [
7759
7807
  __props.isShowAction ? (openBlock(), createElementBlock("span", _hoisted_3$6, toDisplayString(index2 + 1), 1)) : createCommentVNode("", true),
7760
7808
  __props.isShowAction ? (openBlock(), createElementBlock("div", {
7761
7809
  key: 1,
7762
7810
  class: "table-children-delete-item",
7763
- onClick: ($event) => rowClickEvent(record["uuid"])
7811
+ onClick: ($event) => rowClickEvent(record[__props.rowKey])
7764
7812
  }, [
7765
7813
  createVNode(unref(DeleteFilled$1), { style: { color: "#fff" } })
7766
7814
  ], 8, _hoisted_4$4)) : (openBlock(), createElementBlock("span", _hoisted_5$3, toDisplayString(index2 + 1), 1))
7767
- ]))
7815
+ ])) : createCommentVNode("", true)
7768
7816
  ]),
7769
7817
  _: 1
7770
7818
  }, 8, ["columns", "data-source"]);
7771
7819
  };
7772
7820
  }
7773
7821
  });
7774
- const Table_vue_vue_type_style_index_0_scoped_9368e785_lang = "";
7775
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-9368e785"]]);
7822
+ const Table_vue_vue_type_style_index_0_scoped_ad73d9b9_lang = "";
7823
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-ad73d9b9"]]);
7776
7824
  const modal = "";
7777
7825
  useI18n$1();
7778
7826
  const modalProps = {
@@ -14829,7 +14877,22 @@ function useColumns$1(propsRef, getPaginationRef, tableAction, wrapRef) {
14829
14877
  return columns.filter((column) => {
14830
14878
  return hasPermission(column.auth) && isIfShow(column);
14831
14879
  }).map((column) => {
14832
- const { slots, customRender, format, edit, editRow, flag } = column;
14880
+ var _a2, _b;
14881
+ const isSummaryCol = unref(propsRef).showSummaryTotal && ((_b = (_a2 = unref(propsRef).summaryTotalFields) == null ? void 0 : _a2.includes) == null ? void 0 : _b.call(
14882
+ _a2,
14883
+ column.dataIndex
14884
+ ));
14885
+ const summaryFormat = (text) => {
14886
+ return text ? isNumber$2(+text) && !isNaN(+text) ? Number.parseFloat((+text).toFixed(2)).toLocaleString("en-US") : text : "";
14887
+ };
14888
+ const {
14889
+ slots,
14890
+ customRender,
14891
+ format = isSummaryCol ? summaryFormat : void 0,
14892
+ edit,
14893
+ editRow,
14894
+ flag
14895
+ } = column;
14833
14896
  if (!slots || !(slots == null ? void 0 : slots.title)) {
14834
14897
  column.customTitle = column.title;
14835
14898
  Reflect.deleteProperty(column, "title");
@@ -15015,7 +15078,7 @@ function useDataSource(propsRef, {
15015
15078
  const obj = {};
15016
15079
  summaryTotalFields.forEach((field) => {
15017
15080
  const total = dataSourceRef.value.reduce((acc, cur) => {
15018
- return acc + (cur[field] || 0);
15081
+ return +acc + (+cur[field] || 0);
15019
15082
  }, 0);
15020
15083
  obj[field] = Number.parseFloat(total.toFixed(2)).toLocaleString("en-US");
15021
15084
  });
@@ -15031,7 +15094,9 @@ function useDataSource(propsRef, {
15031
15094
  immediate: true
15032
15095
  }
15033
15096
  );
15097
+ let oldSortInfoRef;
15034
15098
  function handleTableChange(pagination, filters, sorter) {
15099
+ const isChangeSorter = !eq(oldSortInfoRef, sorter.order);
15035
15100
  const { clearSelectOnPageChange, sortFn, filterFn } = unref(propsRef);
15036
15101
  if (clearSelectOnPageChange) {
15037
15102
  clearSelectedRowKeys();
@@ -15049,6 +15114,10 @@ function useDataSource(propsRef, {
15049
15114
  searchState.filterInfo = filterInfo;
15050
15115
  params.filterInfo = filterInfo;
15051
15116
  }
15117
+ if (isChangeSorter && !unref(propsRef).isSortFetch) {
15118
+ oldSortInfoRef = sorter.order;
15119
+ return;
15120
+ }
15052
15121
  fetch(params);
15053
15122
  }
15054
15123
  function setTableKey(items) {
@@ -15558,6 +15627,19 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef, getDa
15558
15627
  nextTick(() => {
15559
15628
  debounceRedoHeight();
15560
15629
  });
15630
+ const table2 = unref(tableElRef);
15631
+ if (!table2)
15632
+ return;
15633
+ const tableEl = table2.$el;
15634
+ if (!tableEl)
15635
+ return;
15636
+ const bodyEl2 = tableEl.querySelector(".ant-table-tbody");
15637
+ if (!bodyEl2)
15638
+ return;
15639
+ new Sortablejs(bodyEl2, {
15640
+ ghostClass: "bg-gray-100",
15641
+ draggable: ".ant-table-row"
15642
+ });
15561
15643
  });
15562
15644
  const getScrollX = computed(() => {
15563
15645
  var _a2;
@@ -17282,6 +17364,7 @@ const basicProps$3 = reactive({
17282
17364
  }
17283
17365
  },
17284
17366
  inset: Boolean,
17367
+ isSortFetch: { type: Boolean, default: true },
17285
17368
  sortFn: {
17286
17369
  type: Function,
17287
17370
  default: DEFAULT_SORT_FN
package/es/style.css CHANGED
@@ -265,6 +265,10 @@ ul {
265
265
  max-width: 1600px;
266
266
  }
267
267
  }
268
+ .bg-gray-100 {
269
+ --tw-bg-opacity: 1;
270
+ background-color: rgba(243, 244, 246, var(--tw-bg-opacity));
271
+ }
268
272
  .border-primary {
269
273
  --tw-border-opacity: 1;
270
274
  border-color: rgba(24, 144, 255, var(--tw-border-opacity));
@@ -24871,40 +24875,40 @@ span.iconify {
24871
24875
  .shy-tinymce-container textarea {
24872
24876
  z-index: -1;
24873
24877
  visibility: hidden;
24874
- }.shy-table-edit-icon-plus[data-v-9368e785] {
24878
+ }.shy-table-edit-icon-plus[data-v-ad73d9b9] {
24875
24879
  width: 30px;
24876
24880
  height: 30px;
24877
24881
  font-size: 30px;
24878
24882
  cursor: pointer;
24879
24883
  display: flex;
24880
24884
  }
24881
- .table-children[data-v-9368e785] .ant-form-item {
24885
+ .table-children[data-v-ad73d9b9] .ant-form-item {
24882
24886
  margin-bottom: 0 !important;
24883
24887
  }
24884
- .table-children-required[data-v-9368e785] {
24888
+ .table-children-required[data-v-ad73d9b9] {
24885
24889
  color: #ff4d4f;
24886
24890
  margin-right: 4px;
24887
24891
  }
24888
- .table-children[data-v-9368e785] .ant-table-cell {
24892
+ .table-children[data-v-ad73d9b9] .ant-table-cell {
24889
24893
  padding: 8px !important;
24890
24894
  }
24891
- .table-children[data-v-9368e785] .ant-table-cell .ant-form-item-explain {
24895
+ .table-children[data-v-ad73d9b9] .ant-table-cell .ant-form-item-explain {
24892
24896
  display: none;
24893
24897
  }
24894
- .table-children-delete-wrapper[data-v-9368e785] {
24898
+ .table-children-delete-wrapper[data-v-ad73d9b9] {
24895
24899
  display: flex;
24896
24900
  height: 100%;
24897
24901
  justify-content: center;
24898
24902
  }
24899
- .table-children-delete-wrapper:hover .table-children-delete-item[data-v-9368e785] {
24903
+ .table-children-delete-wrapper:hover .table-children-delete-item[data-v-ad73d9b9] {
24900
24904
  display: flex;
24901
24905
  justify-content: center;
24902
24906
  align-items: center;
24903
24907
  }
24904
- .table-children-delete-wrapper:hover .table-children-delete-index[data-v-9368e785] {
24908
+ .table-children-delete-wrapper:hover .table-children-delete-index[data-v-ad73d9b9] {
24905
24909
  display: none;
24906
24910
  }
24907
- .table-children-delete-item[data-v-9368e785] {
24911
+ .table-children-delete-item[data-v-ad73d9b9] {
24908
24912
  background-color: red;
24909
24913
  border-radius: 50%;
24910
24914
  width: 30px;
@@ -24913,7 +24917,7 @@ span.iconify {
24913
24917
  display: none;
24914
24918
  cursor: pointer;
24915
24919
  }
24916
- .table-children-delete-index[data-v-9368e785] {
24920
+ .table-children-delete-index[data-v-ad73d9b9] {
24917
24921
  user-select: none;
24918
24922
  display: inline-block;
24919
24923
  }@media screen and (max-height: 600px) {
package/lib/index.js CHANGED
@@ -4095,9 +4095,16 @@ const _sfc_main$1q = vue.defineComponent({
4095
4095
  return prev;
4096
4096
  }, []);
4097
4097
  });
4098
- vue.watchEffect(() => {
4099
- props2.immediate && !props2.alwaysLoad && fetch();
4100
- });
4098
+ vue.watch(
4099
+ () => props2.immediate && !props2.alwaysLoad,
4100
+ (val) => {
4101
+ if (val)
4102
+ fetch();
4103
+ },
4104
+ {
4105
+ immediate: true
4106
+ }
4107
+ );
4101
4108
  vue.watch(
4102
4109
  () => state.value,
4103
4110
  (v) => {
@@ -4156,8 +4163,9 @@ const _sfc_main$1q = vue.defineComponent({
4156
4163
  function emitChange() {
4157
4164
  emit("options-change", vue.unref(getOptions));
4158
4165
  }
4159
- function handleChange(_, ...args) {
4166
+ function handleChange(val, ...args) {
4160
4167
  emitData.value = args;
4168
+ emit("update:value", val);
4161
4169
  }
4162
4170
  const filterOption = (input, option) => {
4163
4171
  var _a2, _b, _c;
@@ -7642,6 +7650,10 @@ const _hoisted_5$3 = {
7642
7650
  const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7643
7651
  __name: "Table",
7644
7652
  props: {
7653
+ rowKey: {
7654
+ type: String,
7655
+ default: () => "uuid"
7656
+ },
7645
7657
  columns: {
7646
7658
  type: Array,
7647
7659
  default: () => []
@@ -7671,20 +7683,27 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7671
7683
  width: 50,
7672
7684
  align: "center"
7673
7685
  };
7674
- return [indexColumn, ...props2.columns];
7686
+ return [
7687
+ indexColumn,
7688
+ ...props2.columns.map((item) => ({
7689
+ ...item,
7690
+ type: item.type ? item.type : "input"
7691
+ }))
7692
+ ];
7675
7693
  });
7676
7694
  const plusClickEvent = () => {
7677
- state.value = [{ uuid: utils.buildUUID() }, ...state.value];
7695
+ state.value = [{ [props2.rowKey]: utils.buildUUID() }, ...state.value];
7678
7696
  emit("add", state.value);
7679
7697
  };
7680
7698
  const rowClickEvent = (index2) => {
7681
7699
  const tempState = state.value.filter((item) => {
7682
- return item["uuid"] !== index2;
7700
+ return item[props2.rowKey] !== index2;
7683
7701
  });
7684
- tempState.forEach((item) => item["uuid"] = utils.buildUUID());
7702
+ tempState.forEach((item) => item[props2.rowKey] = utils.buildUUID());
7685
7703
  state.value = [...tempState];
7686
7704
  emit("remove", state.value, index2);
7687
7705
  };
7706
+ const getPopupContainer2 = () => document.body;
7688
7707
  const loadKv = () => {
7689
7708
  const columns = props2.columns;
7690
7709
  let dicData = [];
@@ -7706,6 +7725,20 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7706
7725
  }
7707
7726
  // { immediate: true }
7708
7727
  );
7728
+ vue.watch(
7729
+ () => props2.value,
7730
+ (v) => {
7731
+ if (v.length) {
7732
+ state.value = v.map((ele) => ({
7733
+ ...ele,
7734
+ [props2.rowKey]: utils.buildUUID()
7735
+ }));
7736
+ }
7737
+ },
7738
+ {
7739
+ immediate: true
7740
+ }
7741
+ );
7709
7742
  const validate = async () => {
7710
7743
  try {
7711
7744
  for (let formRef of listFormRefs.value) {
@@ -7726,26 +7759,29 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7726
7759
  class: "table-children",
7727
7760
  align: "center"
7728
7761
  }, {
7729
- headerCell: vue.withCtx(({ column }) => [
7730
- column.dataIndex === "index" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
7731
- __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("div", {
7732
- key: 0,
7733
- class: "shy-table-edit-icon-plus",
7734
- onClick: plusClickEvent
7735
- }, [
7736
- vue.createVNode(vue.unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
7737
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, "序号"))
7738
- ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
7739
- column.required ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$9, "*")) : vue.createCommentVNode("", true),
7740
- vue.createElementVNode("span", null, vue.toDisplayString(column.title), 1)
7741
- ], 64))
7742
- ]),
7743
- bodyCell: vue.withCtx(({ column, record, index: index2 }) => [
7744
- column.dataIndex !== "index" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.FormItem), {
7762
+ headerCell: vue.withCtx(({ column }) => {
7763
+ var _a2;
7764
+ return [
7765
+ column.dataIndex === "index" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
7766
+ __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("div", {
7767
+ key: 0,
7768
+ class: "shy-table-edit-icon-plus",
7769
+ onClick: plusClickEvent
7770
+ }, [
7771
+ vue.createVNode(vue.unref(PlusCircleFilled$1), { style: { color: "#006eff" } })
7772
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, "序号"))
7773
+ ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
7774
+ column.required || ((_a2 = column == null ? void 0 : column.rules) == null ? void 0 : _a2.length) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$9, "*")) : vue.createCommentVNode("", true),
7775
+ vue.createElementVNode("span", null, vue.toDisplayString(column.title), 1)
7776
+ ], 64))
7777
+ ];
7778
+ }),
7779
+ bodyCell: vue.withCtx(({ column, record, index: index2, ...args }) => [
7780
+ column.dataIndex !== "index" && column.type !== "text" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.FormItem), {
7745
7781
  required: column.required,
7746
7782
  rules: (column == null ? void 0 : column.rules) || [],
7747
7783
  name: [_ctx.$attrs.codeField, index2, column.dataIndex],
7748
- key: record["uuid"]
7784
+ key: record[__props.rowKey]
7749
7785
  }, {
7750
7786
  default: vue.withCtx(() => [
7751
7787
  column.type === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), {
@@ -7768,35 +7804,47 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
7768
7804
  min: column.min,
7769
7805
  max: column.max,
7770
7806
  precision: column.precision ?? 2
7771
- }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
7807
+ }, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column.type === "input" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
7772
7808
  key: 3,
7773
7809
  value: record[column.dataIndex],
7774
7810
  "onUpdate:value": ($event) => record[column.dataIndex] = $event,
7775
7811
  disabled: !props2.isShowAction
7776
- }, null, 8, ["value", "onUpdate:value", "disabled"]))
7812
+ }, null, 8, ["value", "onUpdate:value", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(componentMap$2).get(column.type)), vue.mergeProps(
7813
+ {
7814
+ key: 4,
7815
+ allowClear: "",
7816
+ getPopupContainer: getPopupContainer2,
7817
+ style: { width: "100%" }
7818
+ },
7819
+ vue.unref(utils.isFunction)(column.componentProps) ? column.componentProps({ record, column, index: index2, ...args }) : column.componentProps,
7820
+ {
7821
+ value: record[column.dataIndex],
7822
+ "onUpdate:value": ($event) => record[column.dataIndex] = $event
7823
+ }
7824
+ ), null, 16, ["value", "onUpdate:value"]))
7777
7825
  ]),
7778
7826
  _: 2
7779
- }, 1032, ["required", "rules", "name"])) : (vue.openBlock(), vue.createElementBlock("div", {
7827
+ }, 1032, ["required", "rules", "name"])) : column.dataIndex === "index" ? (vue.openBlock(), vue.createElementBlock("div", {
7780
7828
  class: "table-children-delete-wrapper",
7781
- key: record["uuid"]
7829
+ key: record[__props.rowKey]
7782
7830
  }, [
7783
7831
  __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$6, vue.toDisplayString(index2 + 1), 1)) : vue.createCommentVNode("", true),
7784
7832
  __props.isShowAction ? (vue.openBlock(), vue.createElementBlock("div", {
7785
7833
  key: 1,
7786
7834
  class: "table-children-delete-item",
7787
- onClick: ($event) => rowClickEvent(record["uuid"])
7835
+ onClick: ($event) => rowClickEvent(record[__props.rowKey])
7788
7836
  }, [
7789
7837
  vue.createVNode(vue.unref(DeleteFilled$1), { style: { color: "#fff" } })
7790
7838
  ], 8, _hoisted_4$4)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$3, vue.toDisplayString(index2 + 1), 1))
7791
- ]))
7839
+ ])) : vue.createCommentVNode("", true)
7792
7840
  ]),
7793
7841
  _: 1
7794
7842
  }, 8, ["columns", "data-source"]);
7795
7843
  };
7796
7844
  }
7797
7845
  });
7798
- const Table_vue_vue_type_style_index_0_scoped_9368e785_lang = "";
7799
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-9368e785"]]);
7846
+ const Table_vue_vue_type_style_index_0_scoped_ad73d9b9_lang = "";
7847
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-ad73d9b9"]]);
7800
7848
  const modal = "";
7801
7849
  use.useI18n();
7802
7850
  const modalProps = {
@@ -14853,7 +14901,22 @@ function useColumns$1(propsRef, getPaginationRef, tableAction, wrapRef) {
14853
14901
  return columns.filter((column) => {
14854
14902
  return hasPermission(column.auth) && isIfShow(column);
14855
14903
  }).map((column) => {
14856
- const { slots, customRender, format, edit, editRow, flag } = column;
14904
+ var _a2, _b;
14905
+ const isSummaryCol = vue.unref(propsRef).showSummaryTotal && ((_b = (_a2 = vue.unref(propsRef).summaryTotalFields) == null ? void 0 : _a2.includes) == null ? void 0 : _b.call(
14906
+ _a2,
14907
+ column.dataIndex
14908
+ ));
14909
+ const summaryFormat = (text) => {
14910
+ return text ? utils.isNumber(+text) && !isNaN(+text) ? Number.parseFloat((+text).toFixed(2)).toLocaleString("en-US") : text : "";
14911
+ };
14912
+ const {
14913
+ slots,
14914
+ customRender,
14915
+ format = isSummaryCol ? summaryFormat : void 0,
14916
+ edit,
14917
+ editRow,
14918
+ flag
14919
+ } = column;
14857
14920
  if (!slots || !(slots == null ? void 0 : slots.title)) {
14858
14921
  column.customTitle = column.title;
14859
14922
  Reflect.deleteProperty(column, "title");
@@ -15039,7 +15102,7 @@ function useDataSource(propsRef, {
15039
15102
  const obj = {};
15040
15103
  summaryTotalFields.forEach((field) => {
15041
15104
  const total = dataSourceRef.value.reduce((acc, cur) => {
15042
- return acc + (cur[field] || 0);
15105
+ return +acc + (+cur[field] || 0);
15043
15106
  }, 0);
15044
15107
  obj[field] = Number.parseFloat(total.toFixed(2)).toLocaleString("en-US");
15045
15108
  });
@@ -15055,7 +15118,9 @@ function useDataSource(propsRef, {
15055
15118
  immediate: true
15056
15119
  }
15057
15120
  );
15121
+ let oldSortInfoRef;
15058
15122
  function handleTableChange(pagination, filters, sorter) {
15123
+ const isChangeSorter = !eq(oldSortInfoRef, sorter.order);
15059
15124
  const { clearSelectOnPageChange, sortFn, filterFn } = vue.unref(propsRef);
15060
15125
  if (clearSelectOnPageChange) {
15061
15126
  clearSelectedRowKeys();
@@ -15073,6 +15138,10 @@ function useDataSource(propsRef, {
15073
15138
  searchState.filterInfo = filterInfo;
15074
15139
  params.filterInfo = filterInfo;
15075
15140
  }
15141
+ if (isChangeSorter && !vue.unref(propsRef).isSortFetch) {
15142
+ oldSortInfoRef = sorter.order;
15143
+ return;
15144
+ }
15076
15145
  fetch(params);
15077
15146
  }
15078
15147
  function setTableKey(items) {
@@ -15582,6 +15651,19 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef, getDa
15582
15651
  vue.nextTick(() => {
15583
15652
  debounceRedoHeight();
15584
15653
  });
15654
+ const table2 = vue.unref(tableElRef);
15655
+ if (!table2)
15656
+ return;
15657
+ const tableEl = table2.$el;
15658
+ if (!tableEl)
15659
+ return;
15660
+ const bodyEl2 = tableEl.querySelector(".ant-table-tbody");
15661
+ if (!bodyEl2)
15662
+ return;
15663
+ new Sortablejs(bodyEl2, {
15664
+ ghostClass: "bg-gray-100",
15665
+ draggable: ".ant-table-row"
15666
+ });
15585
15667
  });
15586
15668
  const getScrollX = vue.computed(() => {
15587
15669
  var _a2;
@@ -17306,6 +17388,7 @@ const basicProps$3 = vue.reactive({
17306
17388
  }
17307
17389
  },
17308
17390
  inset: Boolean,
17391
+ isSortFetch: { type: Boolean, default: true },
17309
17392
  sortFn: {
17310
17393
  type: Function,
17311
17394
  default: DEFAULT_SORT_FN
package/lib/style.css CHANGED
@@ -265,6 +265,10 @@ ul {
265
265
  max-width: 1600px;
266
266
  }
267
267
  }
268
+ .bg-gray-100 {
269
+ --tw-bg-opacity: 1;
270
+ background-color: rgba(243, 244, 246, var(--tw-bg-opacity));
271
+ }
268
272
  .border-primary {
269
273
  --tw-border-opacity: 1;
270
274
  border-color: rgba(24, 144, 255, var(--tw-border-opacity));
@@ -24871,40 +24875,40 @@ span.iconify {
24871
24875
  .shy-tinymce-container textarea {
24872
24876
  z-index: -1;
24873
24877
  visibility: hidden;
24874
- }.shy-table-edit-icon-plus[data-v-9368e785] {
24878
+ }.shy-table-edit-icon-plus[data-v-ad73d9b9] {
24875
24879
  width: 30px;
24876
24880
  height: 30px;
24877
24881
  font-size: 30px;
24878
24882
  cursor: pointer;
24879
24883
  display: flex;
24880
24884
  }
24881
- .table-children[data-v-9368e785] .ant-form-item {
24885
+ .table-children[data-v-ad73d9b9] .ant-form-item {
24882
24886
  margin-bottom: 0 !important;
24883
24887
  }
24884
- .table-children-required[data-v-9368e785] {
24888
+ .table-children-required[data-v-ad73d9b9] {
24885
24889
  color: #ff4d4f;
24886
24890
  margin-right: 4px;
24887
24891
  }
24888
- .table-children[data-v-9368e785] .ant-table-cell {
24892
+ .table-children[data-v-ad73d9b9] .ant-table-cell {
24889
24893
  padding: 8px !important;
24890
24894
  }
24891
- .table-children[data-v-9368e785] .ant-table-cell .ant-form-item-explain {
24895
+ .table-children[data-v-ad73d9b9] .ant-table-cell .ant-form-item-explain {
24892
24896
  display: none;
24893
24897
  }
24894
- .table-children-delete-wrapper[data-v-9368e785] {
24898
+ .table-children-delete-wrapper[data-v-ad73d9b9] {
24895
24899
  display: flex;
24896
24900
  height: 100%;
24897
24901
  justify-content: center;
24898
24902
  }
24899
- .table-children-delete-wrapper:hover .table-children-delete-item[data-v-9368e785] {
24903
+ .table-children-delete-wrapper:hover .table-children-delete-item[data-v-ad73d9b9] {
24900
24904
  display: flex;
24901
24905
  justify-content: center;
24902
24906
  align-items: center;
24903
24907
  }
24904
- .table-children-delete-wrapper:hover .table-children-delete-index[data-v-9368e785] {
24908
+ .table-children-delete-wrapper:hover .table-children-delete-index[data-v-ad73d9b9] {
24905
24909
  display: none;
24906
24910
  }
24907
- .table-children-delete-item[data-v-9368e785] {
24911
+ .table-children-delete-item[data-v-ad73d9b9] {
24908
24912
  background-color: red;
24909
24913
  border-radius: 50%;
24910
24914
  width: 30px;
@@ -24913,7 +24917,7 @@ span.iconify {
24913
24917
  display: none;
24914
24918
  cursor: pointer;
24915
24919
  }
24916
- .table-children-delete-index[data-v-9368e785] {
24920
+ .table-children-delete-index[data-v-ad73d9b9] {
24917
24921
  user-select: none;
24918
24922
  display: inline-block;
24919
24923
  }@media screen and (max-height: 600px) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "2.14.93",
3
+ "version": "2.14.94",
4
4
  "description": "",
5
5
  "module": "es/index.js",
6
6
  "main": "lib/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",