3h1-ui 2.13.2 → 2.13.4

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
@@ -8565,13 +8565,11 @@ function useFormEvents({
8565
8565
  value = handleInputNumberValue(schema == null ? void 0 : schema.component, value);
8566
8566
  if (hasKey && fields.includes(key2)) {
8567
8567
  if (itemIsDateType(key2)) {
8568
- console.log(1, key2);
8569
8568
  if (Array.isArray(value)) {
8570
8569
  const arr = [];
8571
8570
  for (const ele of value) {
8572
8571
  arr.push(ele ? ele : null);
8573
8572
  }
8574
- console.log("arr", arr);
8575
8573
  formModel[key2] = arr;
8576
8574
  } else {
8577
8575
  const { componentProps } = schema || {};
@@ -10614,7 +10612,6 @@ function useForm(props2) {
10614
10612
  const value = await form.validate(nameList);
10615
10613
  Object.keys(value).forEach((key2) => {
10616
10614
  if (value[key2] === void 0) {
10617
- console.log("key", key2);
10618
10615
  value[key2] = "";
10619
10616
  }
10620
10617
  });
@@ -16813,7 +16810,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
16813
16810
  await tableRef.value.setProps({
16814
16811
  searchInfo: { [unref(getTableProps).searchKey]: key2 }
16815
16812
  });
16816
- console.log("unref(getTableProps).searchKey", unref(getTableProps).searchKey);
16817
16813
  tableRef.value.reload();
16818
16814
  };
16819
16815
  const handleComfirm = () => {
@@ -16849,8 +16845,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
16849
16845
  };
16850
16846
  }
16851
16847
  });
16852
- const Modal_vue_vue_type_style_index_0_scoped_dbd84c9c_lang = "";
16853
- const Modal = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-dbd84c9c"]]);
16848
+ const Modal_vue_vue_type_style_index_0_scoped_4dc415ac_lang = "";
16849
+ const Modal = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-4dc415ac"]]);
16854
16850
  const _hoisted_1$9 = { class: "api-modal-select" };
16855
16851
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
16856
16852
  __name: "ApiModalSelect",
@@ -17006,6 +17002,10 @@ const basicProps$2 = {
17006
17002
  type: Array,
17007
17003
  default: () => [{ label: "a", field: "a" }]
17008
17004
  },
17005
+ labelAlign: {
17006
+ type: String,
17007
+ default: () => "right"
17008
+ },
17009
17009
  labelWidth: {
17010
17010
  type: Number,
17011
17011
  default: () => 80
@@ -17085,15 +17085,21 @@ const Description = /* @__PURE__ */ defineComponent({
17085
17085
  }
17086
17086
  }, [createVNode("span", {
17087
17087
  "style": {
17088
- width: `${getProps.value.labelWidth}px`
17088
+ width: `${getProps.value.labelWidth}px`,
17089
+ textAlign: getProps.value.labelAlign
17089
17090
  },
17090
17091
  "class": `${prefixCls2}-label`
17091
17092
  }, [slots[`${item.field}Label`] ? slots[`${item.field}Label`]() : item.label, ((_b = getProps.value) == null ? void 0 : _b.isShowColon) ? ":" : ""]), createVNode("span", {
17092
17093
  "class": `${prefixCls2}-value`
17093
17094
  }, [slots[`${item.field}Value`] ? slots[`${item.field}Value`]() : getProps.value.data[item.field], (item == null ? void 0 : item.isCopy) ? createVNode("span", {
17094
- "style": "cursor:pointer",
17095
+ "style": "cursor:pointer;margin-left:5px",
17095
17096
  "onClick": () => handleClick(getProps.value.data[item.field])
17096
- }, [createVNode(CopyOutlined$1, null, null)]) : null])]);
17097
+ }, [createVNode(CopyOutlined$1, {
17098
+ "style": {
17099
+ color: "#458ef9",
17100
+ marginLeft: "5px"
17101
+ }
17102
+ }, null)]) : null])]);
17097
17103
  }
17098
17104
  });
17099
17105
  });
@@ -21267,7 +21273,7 @@ const usePagination = () => {
21267
21273
  };
21268
21274
  return { page, setPage };
21269
21275
  };
21270
- const useTableData = (getProps, { setPage, params }) => {
21276
+ const useTableData = (getProps, { setPage, params, tableRef }) => {
21271
21277
  const dataSource = ref([]);
21272
21278
  const setTableData = (data) => {
21273
21279
  dataSource.value = data.map((item) => {
@@ -21286,6 +21292,14 @@ const useTableData = (getProps, { setPage, params }) => {
21286
21292
  setPage({ total: (res == null ? void 0 : res.total) || 0 });
21287
21293
  }
21288
21294
  };
21295
+ const addTableData = (list = [{}]) => {
21296
+ const temp = list.map((item) => {
21297
+ item._isEdit = true;
21298
+ return item;
21299
+ });
21300
+ dataSource.value.unshift(...temp);
21301
+ tableRef.value.loadData(dataSource.value);
21302
+ };
21289
21303
  onMounted(async () => {
21290
21304
  if (getProps.value.isImmediate) {
21291
21305
  await reload();
@@ -21295,7 +21309,8 @@ const useTableData = (getProps, { setPage, params }) => {
21295
21309
  dataSource,
21296
21310
  setTableData,
21297
21311
  reload,
21298
- getTableData
21312
+ getTableData,
21313
+ addTableData
21299
21314
  };
21300
21315
  };
21301
21316
  const componentMap = /* @__PURE__ */ new Map();
@@ -21344,7 +21359,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21344
21359
  default: null
21345
21360
  }
21346
21361
  },
21347
- emits: ["updateStatusEdit", "edit-ensure", "edit-cancel"],
21362
+ emits: [
21363
+ "updateStatusEdit",
21364
+ "edit-ensure",
21365
+ "edit-cancel",
21366
+ "row-remove"
21367
+ ],
21348
21368
  setup(__props, { emit }) {
21349
21369
  const props2 = __props;
21350
21370
  const getActions = computed(() => {
@@ -21356,6 +21376,16 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21356
21376
  },
21357
21377
  ifShow: props2.row._isEdit === false
21358
21378
  },
21379
+ {
21380
+ label: "删除",
21381
+ popConfirm: {
21382
+ title: "是否确认删除",
21383
+ confirm: () => {
21384
+ emit("row-remove", true);
21385
+ }
21386
+ },
21387
+ ifShow: props2.row._isEdit === false
21388
+ },
21359
21389
  {
21360
21390
  label: "确定",
21361
21391
  onClick: () => {
@@ -21377,6 +21407,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21377
21407
  return (_ctx, _cache) => {
21378
21408
  return openBlock(), createBlock(_sfc_main$m, {
21379
21409
  actions: unref(getActions),
21410
+ "show-count": 4,
21380
21411
  outside: true
21381
21412
  }, null, 8, ["actions"]);
21382
21413
  };
@@ -22090,7 +22121,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22090
22121
  "register",
22091
22122
  "selection-change",
22092
22123
  "row-ensure",
22093
- "row-cancel"
22124
+ "row-cancel",
22125
+ "row-remove"
22094
22126
  ],
22095
22127
  setup(__props, { emit: emits }) {
22096
22128
  const props2 = __props;
@@ -22114,7 +22146,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22114
22146
  innerProps.value = deepMergeObjects(innerProps.value, props22);
22115
22147
  };
22116
22148
  const attrs = useAttrs$2();
22117
- useSlots();
22149
+ const slots = useSlots();
22118
22150
  const getBindValues = computed(() => {
22119
22151
  return deepMergeObjects(basicProps, attrs, getProps.value);
22120
22152
  });
@@ -22135,6 +22167,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22135
22167
  rowProps: { gutter: 20 }
22136
22168
  };
22137
22169
  });
22170
+ const getFormSlotKeys = computed(() => {
22171
+ const keys2 = Object.keys(slots);
22172
+ return keys2.map((item) => item.startsWith("form-") ? item : null).filter((item) => !!item);
22173
+ });
22174
+ function replaceFormSlotKey(key2) {
22175
+ var _a2;
22176
+ if (!key2)
22177
+ return "";
22178
+ return ((_a2 = key2 == null ? void 0 : key2.replace) == null ? void 0 : _a2.call(key2, /form-/, "")) ?? "";
22179
+ }
22138
22180
  const [registerForm, formActions] = useForm();
22139
22181
  const formSearch = ref({});
22140
22182
  const handleSearchFormSubmit = (form) => {
@@ -22150,14 +22192,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22150
22192
  size: page.pageSize
22151
22193
  };
22152
22194
  });
22153
- const { dataSource, setTableData, reload, getTableData } = useTableData(
22154
- getProps,
22155
- {
22156
- setPage,
22157
- params
22158
- }
22159
- );
22160
22195
  const tableRef = ref();
22196
+ const { dataSource, setTableData, reload, getTableData, addTableData } = useTableData(getProps, {
22197
+ setPage,
22198
+ params,
22199
+ tableRef
22200
+ });
22161
22201
  const handleCheckboxChange = () => {
22162
22202
  const records = tableRef.value.getCheckboxRecords();
22163
22203
  emits("selection-change", records);
@@ -22185,6 +22225,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22185
22225
  const handleEditCancel = (row) => {
22186
22226
  emits("row-cancel", row);
22187
22227
  };
22228
+ const handleRowRemove = (row) => {
22229
+ emits("row-remove", row);
22230
+ };
22188
22231
  const getTreeExpandRecords = () => {
22189
22232
  return toRaw(tableRef.value.getTreeExpandRecords());
22190
22233
  };
@@ -22240,7 +22283,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22240
22283
  hideColumn,
22241
22284
  showColumn,
22242
22285
  resetColumn,
22243
- refreshColumn
22286
+ refreshColumn,
22287
+ addTableData
22244
22288
  };
22245
22289
  createTableContext({ ...tableAction });
22246
22290
  emits("register", tableAction, formActions);
@@ -22258,7 +22302,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22258
22302
  onReset: handleSearchFormSubmit,
22259
22303
  onAdvancedChange: _cache[0] || (_cache[0] = () => {
22260
22304
  })
22261
- }), null, 16, ["onRegister"])
22305
+ }), createSlots({ _: 2 }, [
22306
+ renderList(unref(getFormSlotKeys), (item) => {
22307
+ return {
22308
+ name: replaceFormSlotKey(item),
22309
+ fn: withCtx((data) => [
22310
+ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
22311
+ ])
22312
+ };
22313
+ })
22314
+ ]), 1040, ["onRegister"])
22262
22315
  ], 2)) : createCommentVNode("", true),
22263
22316
  unref(getProps).isShowToolbar ? (openBlock(), createElementBlock("div", {
22264
22317
  key: 1,
@@ -22320,14 +22373,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22320
22373
  }), {
22321
22374
  default: withCtx((config) => [
22322
22375
  renderSlot(_ctx.$slots, column.field, normalizeProps(guardReactiveProps(config)), () => {
22323
- var _a3, _b2;
22376
+ var _a3, _b2, _c2;
22324
22377
  return [
22325
- config.row._isEdit && (column == null ? void 0 : column.isEdit) ? (openBlock(), createBlock(unref(CellComponent), mergeProps({ key: 0 }, (column == null ? void 0 : column.editProps) || {}, {
22326
- value: config.row[column.field],
22327
- "onUpdate:value": ($event) => config.row[column.field] = $event
22328
- }), null, 16, ["value", "onUpdate:value"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
22329
- (column == null ? void 0 : column.isEdit) && ((_a3 = column == null ? void 0 : column.editProps) == null ? void 0 : _a3.component) === "Select" || ((_b2 = column == null ? void 0 : column.editProps) == null ? void 0 : _b2.component) === "ApiSelect" ? (openBlock(), createElementBlock("span", _hoisted_1, [
22330
- createVNode(unref(CellComponent), mergeProps((column == null ? void 0 : column.editProps) || {}, {
22378
+ config.row._isEdit && (column == null ? void 0 : column.isEdit) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
22379
+ ((_a3 = column == null ? void 0 : column.editComponentProps) == null ? void 0 : _a3.component) === "Switch" ? (openBlock(), createBlock(unref(CellComponent), mergeProps({ key: 0 }, (column == null ? void 0 : column.editComponentProps) || {}, {
22380
+ checked: config.row[column.field],
22381
+ "onUpdate:checked": ($event) => config.row[column.field] = $event
22382
+ }), null, 16, ["checked", "onUpdate:checked"])) : (openBlock(), createBlock(unref(CellComponent), mergeProps({ key: 1 }, (column == null ? void 0 : column.editComponentProps) || {}, {
22383
+ value: config.row[column.field],
22384
+ "onUpdate:value": ($event) => config.row[column.field] = $event
22385
+ }), null, 16, ["value", "onUpdate:value"]))
22386
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
22387
+ (column == null ? void 0 : column.isEdit) && ((_b2 = column == null ? void 0 : column.editComponentProps) == null ? void 0 : _b2.component) === "Select" || ((_c2 = column == null ? void 0 : column.editComponentProps) == null ? void 0 : _c2.component) === "ApiSelect" ? (openBlock(), createElementBlock("span", _hoisted_1, [
22388
+ createVNode(unref(CellComponent), mergeProps((column == null ? void 0 : column.editComponentProps) || {}, {
22331
22389
  value: config.row[column.field],
22332
22390
  "onUpdate:value": ($event) => config.row[column.field] = $event,
22333
22391
  bordered: false,
@@ -22370,8 +22428,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22370
22428
  onEditCancel: ($event) => handleEditCancel(config.row),
22371
22429
  onUpdateStatusEdit: (isEdit) => {
22372
22430
  config.row._isEdit = isEdit;
22373
- }
22374
- }, null, 8, ["row", "onEditEnsure", "onEditCancel", "onUpdateStatusEdit"])) : createCommentVNode("", true)
22431
+ },
22432
+ onRowRemove: ($event) => handleRowRemove(config.row)
22433
+ }, null, 8, ["row", "onEditEnsure", "onEditCancel", "onUpdateStatusEdit", "onRowRemove"])) : createCommentVNode("", true)
22375
22434
  ])
22376
22435
  ])
22377
22436
  ]),
@@ -22441,7 +22500,8 @@ function useTablePlus(tableProps) {
22441
22500
  clearTreeExpand: () => getTableInstance().clearTreeExpand(),
22442
22501
  setTreeExpand: (rows, checked) => getTableInstance().setTreeExpand(rows, checked),
22443
22502
  getVxeTableRef: () => getTableInstance().getVxeTableRef(),
22444
- setSelectRowByKeys: (keys2, checked) => getTableInstance().setSelectRowByKeys(keys2, checked)
22503
+ setSelectRowByKeys: (keys2, checked) => getTableInstance().setSelectRowByKeys(keys2, checked),
22504
+ addTableData: (list) => getTableInstance().addTableData(list)
22445
22505
  };
22446
22506
  return [register, methods2];
22447
22507
  }
package/es/style.css CHANGED
@@ -25696,13 +25696,13 @@ span.iconify {
25696
25696
  }
25697
25697
  .hide-scrollbar-y .ant-spin-nested-loading .ant-spin-container .ant-table .ant-table-content .ant-table-fixed-left .ant-table-body-outer .ant-table-body-inner {
25698
25698
  overflow-y: auto !important;
25699
- }.wrapper[data-v-dbd84c9c] {
25699
+ }.wrapper[data-v-4dc415ac] {
25700
25700
  display: flex;
25701
25701
  }
25702
- .tree[data-v-dbd84c9c] {
25702
+ .tree[data-v-4dc415ac] {
25703
25703
  flex: none;
25704
25704
  }
25705
- .table-wrapper[data-v-dbd84c9c] {
25705
+ .table-wrapper[data-v-4dc415ac] {
25706
25706
  flex: 1 1 0%;
25707
25707
  overflow: hidden;
25708
25708
  }[data-v-fb4fe18d] .ant-input-group-addon {
@@ -7,6 +7,10 @@ declare const _default: import("vue").DefineComponent<{
7
7
  field: string;
8
8
  }[];
9
9
  };
10
+ labelAlign: {
11
+ type: StringConstructor;
12
+ default: () => string;
13
+ };
10
14
  labelWidth: {
11
15
  type: import("vue").PropType<string | number>;
12
16
  default: () => number;
@@ -27,6 +31,10 @@ declare const _default: import("vue").DefineComponent<{
27
31
  field: string;
28
32
  }[];
29
33
  };
34
+ labelAlign: {
35
+ type: StringConstructor;
36
+ default: () => string;
37
+ };
30
38
  labelWidth: {
31
39
  type: import("vue").PropType<string | number>;
32
40
  default: () => number;
@@ -44,6 +52,7 @@ declare const _default: import("vue").DefineComponent<{
44
52
  }, {
45
53
  data: Record<string, any>;
46
54
  schema: Schema[];
55
+ labelAlign: string;
47
56
  labelWidth: string | number;
48
57
  isShowColon: boolean;
49
58
  }>;
@@ -6,6 +6,7 @@ export interface Schema {
6
6
  span: number;
7
7
  };
8
8
  component?: 'Divider' | 'Group';
9
+ isCopy?: boolean;
9
10
  }
10
11
  export declare const basicColProps = 24;
11
12
  export declare const basicProps: {
@@ -16,6 +17,10 @@ export declare const basicProps: {
16
17
  field: string;
17
18
  }[];
18
19
  };
20
+ labelAlign: {
21
+ type: StringConstructor;
22
+ default: () => string;
23
+ };
19
24
  labelWidth: {
20
25
  type: PropType<string | number>;
21
26
  default: () => number;
@@ -10,6 +10,7 @@ export interface DescriptionProps {
10
10
  data: Recordable;
11
11
  labelWidth?: number;
12
12
  isShowColon?: boolean;
13
+ labelAlign?: string;
13
14
  }
14
15
  export interface DescInstance {
15
16
  setDescProps(descProps: Partial<DescriptionProps>): void;
@@ -1,9 +1,11 @@
1
- export declare const useTableData: (getProps: any, { setPage, params }: {
1
+ export declare const useTableData: (getProps: any, { setPage, params, tableRef }: {
2
2
  setPage: any;
3
3
  params: any;
4
+ tableRef: any;
4
5
  }) => {
5
6
  dataSource: import("vue").Ref<any[]>;
6
7
  setTableData: (data: any) => void;
7
8
  reload: () => Promise<void>;
8
9
  getTableData: () => any[];
10
+ addTableData: (list?: {}[]) => void;
9
11
  };
package/lib/index.js CHANGED
@@ -8567,13 +8567,11 @@ function useFormEvents({
8567
8567
  value = handleInputNumberValue(schema == null ? void 0 : schema.component, value);
8568
8568
  if (hasKey && fields.includes(key2)) {
8569
8569
  if (itemIsDateType(key2)) {
8570
- console.log(1, key2);
8571
8570
  if (Array.isArray(value)) {
8572
8571
  const arr = [];
8573
8572
  for (const ele of value) {
8574
8573
  arr.push(ele ? ele : null);
8575
8574
  }
8576
- console.log("arr", arr);
8577
8575
  formModel[key2] = arr;
8578
8576
  } else {
8579
8577
  const { componentProps } = schema || {};
@@ -10616,7 +10614,6 @@ function useForm(props2) {
10616
10614
  const value = await form.validate(nameList);
10617
10615
  Object.keys(value).forEach((key2) => {
10618
10616
  if (value[key2] === void 0) {
10619
- console.log("key", key2);
10620
10617
  value[key2] = "";
10621
10618
  }
10622
10619
  });
@@ -16815,7 +16812,6 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
16815
16812
  await tableRef.value.setProps({
16816
16813
  searchInfo: { [vue.unref(getTableProps).searchKey]: key2 }
16817
16814
  });
16818
- console.log("unref(getTableProps).searchKey", vue.unref(getTableProps).searchKey);
16819
16815
  tableRef.value.reload();
16820
16816
  };
16821
16817
  const handleComfirm = () => {
@@ -16851,8 +16847,8 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
16851
16847
  };
16852
16848
  }
16853
16849
  });
16854
- const Modal_vue_vue_type_style_index_0_scoped_dbd84c9c_lang = "";
16855
- const Modal = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-dbd84c9c"]]);
16850
+ const Modal_vue_vue_type_style_index_0_scoped_4dc415ac_lang = "";
16851
+ const Modal = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-4dc415ac"]]);
16856
16852
  const _hoisted_1$9 = { class: "api-modal-select" };
16857
16853
  const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
16858
16854
  __name: "ApiModalSelect",
@@ -17008,6 +17004,10 @@ const basicProps$2 = {
17008
17004
  type: Array,
17009
17005
  default: () => [{ label: "a", field: "a" }]
17010
17006
  },
17007
+ labelAlign: {
17008
+ type: String,
17009
+ default: () => "right"
17010
+ },
17011
17011
  labelWidth: {
17012
17012
  type: Number,
17013
17013
  default: () => 80
@@ -17087,15 +17087,21 @@ const Description = /* @__PURE__ */ vue.defineComponent({
17087
17087
  }
17088
17088
  }, [vue.createVNode("span", {
17089
17089
  "style": {
17090
- width: `${getProps.value.labelWidth}px`
17090
+ width: `${getProps.value.labelWidth}px`,
17091
+ textAlign: getProps.value.labelAlign
17091
17092
  },
17092
17093
  "class": `${prefixCls2}-label`
17093
17094
  }, [slots[`${item.field}Label`] ? slots[`${item.field}Label`]() : item.label, ((_b = getProps.value) == null ? void 0 : _b.isShowColon) ? ":" : ""]), vue.createVNode("span", {
17094
17095
  "class": `${prefixCls2}-value`
17095
17096
  }, [slots[`${item.field}Value`] ? slots[`${item.field}Value`]() : getProps.value.data[item.field], (item == null ? void 0 : item.isCopy) ? vue.createVNode("span", {
17096
- "style": "cursor:pointer",
17097
+ "style": "cursor:pointer;margin-left:5px",
17097
17098
  "onClick": () => handleClick(getProps.value.data[item.field])
17098
- }, [vue.createVNode(CopyOutlined$1, null, null)]) : null])]);
17099
+ }, [vue.createVNode(CopyOutlined$1, {
17100
+ "style": {
17101
+ color: "#458ef9",
17102
+ marginLeft: "5px"
17103
+ }
17104
+ }, null)]) : null])]);
17099
17105
  }
17100
17106
  });
17101
17107
  });
@@ -21269,7 +21275,7 @@ const usePagination = () => {
21269
21275
  };
21270
21276
  return { page, setPage };
21271
21277
  };
21272
- const useTableData = (getProps, { setPage, params }) => {
21278
+ const useTableData = (getProps, { setPage, params, tableRef }) => {
21273
21279
  const dataSource = vue.ref([]);
21274
21280
  const setTableData = (data) => {
21275
21281
  dataSource.value = data.map((item) => {
@@ -21288,6 +21294,14 @@ const useTableData = (getProps, { setPage, params }) => {
21288
21294
  setPage({ total: (res == null ? void 0 : res.total) || 0 });
21289
21295
  }
21290
21296
  };
21297
+ const addTableData = (list = [{}]) => {
21298
+ const temp = list.map((item) => {
21299
+ item._isEdit = true;
21300
+ return item;
21301
+ });
21302
+ dataSource.value.unshift(...temp);
21303
+ tableRef.value.loadData(dataSource.value);
21304
+ };
21291
21305
  vue.onMounted(async () => {
21292
21306
  if (getProps.value.isImmediate) {
21293
21307
  await reload();
@@ -21297,7 +21311,8 @@ const useTableData = (getProps, { setPage, params }) => {
21297
21311
  dataSource,
21298
21312
  setTableData,
21299
21313
  reload,
21300
- getTableData
21314
+ getTableData,
21315
+ addTableData
21301
21316
  };
21302
21317
  };
21303
21318
  const componentMap = /* @__PURE__ */ new Map();
@@ -21346,7 +21361,12 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
21346
21361
  default: null
21347
21362
  }
21348
21363
  },
21349
- emits: ["updateStatusEdit", "edit-ensure", "edit-cancel"],
21364
+ emits: [
21365
+ "updateStatusEdit",
21366
+ "edit-ensure",
21367
+ "edit-cancel",
21368
+ "row-remove"
21369
+ ],
21350
21370
  setup(__props, { emit }) {
21351
21371
  const props2 = __props;
21352
21372
  const getActions = vue.computed(() => {
@@ -21358,6 +21378,16 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
21358
21378
  },
21359
21379
  ifShow: props2.row._isEdit === false
21360
21380
  },
21381
+ {
21382
+ label: "删除",
21383
+ popConfirm: {
21384
+ title: "是否确认删除",
21385
+ confirm: () => {
21386
+ emit("row-remove", true);
21387
+ }
21388
+ },
21389
+ ifShow: props2.row._isEdit === false
21390
+ },
21361
21391
  {
21362
21392
  label: "确定",
21363
21393
  onClick: () => {
@@ -21379,6 +21409,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
21379
21409
  return (_ctx, _cache) => {
21380
21410
  return vue.openBlock(), vue.createBlock(_sfc_main$m, {
21381
21411
  actions: vue.unref(getActions),
21412
+ "show-count": 4,
21382
21413
  outside: true
21383
21414
  }, null, 8, ["actions"]);
21384
21415
  };
@@ -22092,7 +22123,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22092
22123
  "register",
22093
22124
  "selection-change",
22094
22125
  "row-ensure",
22095
- "row-cancel"
22126
+ "row-cancel",
22127
+ "row-remove"
22096
22128
  ],
22097
22129
  setup(__props, { emit: emits }) {
22098
22130
  const props2 = __props;
@@ -22116,7 +22148,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22116
22148
  innerProps.value = utils.deepMergeObjects(innerProps.value, props22);
22117
22149
  };
22118
22150
  const attrs = vue.useAttrs();
22119
- vue.useSlots();
22151
+ const slots = vue.useSlots();
22120
22152
  const getBindValues = vue.computed(() => {
22121
22153
  return utils.deepMergeObjects(basicProps, attrs, getProps.value);
22122
22154
  });
@@ -22137,6 +22169,16 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22137
22169
  rowProps: { gutter: 20 }
22138
22170
  };
22139
22171
  });
22172
+ const getFormSlotKeys = vue.computed(() => {
22173
+ const keys2 = Object.keys(slots);
22174
+ return keys2.map((item) => item.startsWith("form-") ? item : null).filter((item) => !!item);
22175
+ });
22176
+ function replaceFormSlotKey(key2) {
22177
+ var _a2;
22178
+ if (!key2)
22179
+ return "";
22180
+ return ((_a2 = key2 == null ? void 0 : key2.replace) == null ? void 0 : _a2.call(key2, /form-/, "")) ?? "";
22181
+ }
22140
22182
  const [registerForm, formActions] = useForm();
22141
22183
  const formSearch = vue.ref({});
22142
22184
  const handleSearchFormSubmit = (form) => {
@@ -22152,14 +22194,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22152
22194
  size: page.pageSize
22153
22195
  };
22154
22196
  });
22155
- const { dataSource, setTableData, reload, getTableData } = useTableData(
22156
- getProps,
22157
- {
22158
- setPage,
22159
- params
22160
- }
22161
- );
22162
22197
  const tableRef = vue.ref();
22198
+ const { dataSource, setTableData, reload, getTableData, addTableData } = useTableData(getProps, {
22199
+ setPage,
22200
+ params,
22201
+ tableRef
22202
+ });
22163
22203
  const handleCheckboxChange = () => {
22164
22204
  const records = tableRef.value.getCheckboxRecords();
22165
22205
  emits("selection-change", records);
@@ -22187,6 +22227,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22187
22227
  const handleEditCancel = (row) => {
22188
22228
  emits("row-cancel", row);
22189
22229
  };
22230
+ const handleRowRemove = (row) => {
22231
+ emits("row-remove", row);
22232
+ };
22190
22233
  const getTreeExpandRecords = () => {
22191
22234
  return vue.toRaw(tableRef.value.getTreeExpandRecords());
22192
22235
  };
@@ -22242,7 +22285,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22242
22285
  hideColumn,
22243
22286
  showColumn,
22244
22287
  resetColumn,
22245
- refreshColumn
22288
+ refreshColumn,
22289
+ addTableData
22246
22290
  };
22247
22291
  createTableContext({ ...tableAction });
22248
22292
  emits("register", tableAction, formActions);
@@ -22260,7 +22304,16 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22260
22304
  onReset: handleSearchFormSubmit,
22261
22305
  onAdvancedChange: _cache[0] || (_cache[0] = () => {
22262
22306
  })
22263
- }), null, 16, ["onRegister"])
22307
+ }), vue.createSlots({ _: 2 }, [
22308
+ vue.renderList(vue.unref(getFormSlotKeys), (item) => {
22309
+ return {
22310
+ name: replaceFormSlotKey(item),
22311
+ fn: vue.withCtx((data) => [
22312
+ vue.renderSlot(_ctx.$slots, item, vue.normalizeProps(vue.guardReactiveProps(data || {})))
22313
+ ])
22314
+ };
22315
+ })
22316
+ ]), 1040, ["onRegister"])
22264
22317
  ], 2)) : vue.createCommentVNode("", true),
22265
22318
  vue.unref(getProps).isShowToolbar ? (vue.openBlock(), vue.createElementBlock("div", {
22266
22319
  key: 1,
@@ -22322,14 +22375,19 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22322
22375
  }), {
22323
22376
  default: vue.withCtx((config) => [
22324
22377
  vue.renderSlot(_ctx.$slots, column.field, vue.normalizeProps(vue.guardReactiveProps(config)), () => {
22325
- var _a3, _b2;
22378
+ var _a3, _b2, _c2;
22326
22379
  return [
22327
- config.row._isEdit && (column == null ? void 0 : column.isEdit) ? (vue.openBlock(), vue.createBlock(vue.unref(CellComponent), vue.mergeProps({ key: 0 }, (column == null ? void 0 : column.editProps) || {}, {
22328
- value: config.row[column.field],
22329
- "onUpdate:value": ($event) => config.row[column.field] = $event
22330
- }), null, 16, ["value", "onUpdate:value"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
22331
- (column == null ? void 0 : column.isEdit) && ((_a3 = column == null ? void 0 : column.editProps) == null ? void 0 : _a3.component) === "Select" || ((_b2 = column == null ? void 0 : column.editProps) == null ? void 0 : _b2.component) === "ApiSelect" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, [
22332
- vue.createVNode(vue.unref(CellComponent), vue.mergeProps((column == null ? void 0 : column.editProps) || {}, {
22380
+ config.row._isEdit && (column == null ? void 0 : column.isEdit) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
22381
+ ((_a3 = column == null ? void 0 : column.editComponentProps) == null ? void 0 : _a3.component) === "Switch" ? (vue.openBlock(), vue.createBlock(vue.unref(CellComponent), vue.mergeProps({ key: 0 }, (column == null ? void 0 : column.editComponentProps) || {}, {
22382
+ checked: config.row[column.field],
22383
+ "onUpdate:checked": ($event) => config.row[column.field] = $event
22384
+ }), null, 16, ["checked", "onUpdate:checked"])) : (vue.openBlock(), vue.createBlock(vue.unref(CellComponent), vue.mergeProps({ key: 1 }, (column == null ? void 0 : column.editComponentProps) || {}, {
22385
+ value: config.row[column.field],
22386
+ "onUpdate:value": ($event) => config.row[column.field] = $event
22387
+ }), null, 16, ["value", "onUpdate:value"]))
22388
+ ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
22389
+ (column == null ? void 0 : column.isEdit) && ((_b2 = column == null ? void 0 : column.editComponentProps) == null ? void 0 : _b2.component) === "Select" || ((_c2 = column == null ? void 0 : column.editComponentProps) == null ? void 0 : _c2.component) === "ApiSelect" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, [
22390
+ vue.createVNode(vue.unref(CellComponent), vue.mergeProps((column == null ? void 0 : column.editComponentProps) || {}, {
22333
22391
  value: config.row[column.field],
22334
22392
  "onUpdate:value": ($event) => config.row[column.field] = $event,
22335
22393
  bordered: false,
@@ -22372,8 +22430,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22372
22430
  onEditCancel: ($event) => handleEditCancel(config.row),
22373
22431
  onUpdateStatusEdit: (isEdit) => {
22374
22432
  config.row._isEdit = isEdit;
22375
- }
22376
- }, null, 8, ["row", "onEditEnsure", "onEditCancel", "onUpdateStatusEdit"])) : vue.createCommentVNode("", true)
22433
+ },
22434
+ onRowRemove: ($event) => handleRowRemove(config.row)
22435
+ }, null, 8, ["row", "onEditEnsure", "onEditCancel", "onUpdateStatusEdit", "onRowRemove"])) : vue.createCommentVNode("", true)
22377
22436
  ])
22378
22437
  ])
22379
22438
  ]),
@@ -22443,7 +22502,8 @@ function useTablePlus(tableProps) {
22443
22502
  clearTreeExpand: () => getTableInstance().clearTreeExpand(),
22444
22503
  setTreeExpand: (rows, checked) => getTableInstance().setTreeExpand(rows, checked),
22445
22504
  getVxeTableRef: () => getTableInstance().getVxeTableRef(),
22446
- setSelectRowByKeys: (keys2, checked) => getTableInstance().setSelectRowByKeys(keys2, checked)
22505
+ setSelectRowByKeys: (keys2, checked) => getTableInstance().setSelectRowByKeys(keys2, checked),
22506
+ addTableData: (list) => getTableInstance().addTableData(list)
22447
22507
  };
22448
22508
  return [register, methods2];
22449
22509
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "2.13.2",
3
+ "version": "2.13.4",
4
4
  "description": "",
5
5
  "module": "es/index.js",
6
6
  "main": "lib/index.js",