@dt-frames/ui 2.0.18 → 2.0.19

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.
@@ -169,14 +169,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
169
169
  };
170
170
  }
171
171
  });
172
- const _export_sfc = (sfc, props) => {
173
- const target = sfc.__vccOpts || sfc;
174
- for (const [key, val] of props) {
175
- target[key] = val;
176
- }
177
- return target;
178
- };
179
- const RadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/radioButton.vue"]]);
180
172
  const _hoisted_1$1 = { class: "input-with-dialog" };
181
173
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
182
174
  __name: "formInputUseDialog",
@@ -213,15 +205,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
213
205
  key: 0,
214
206
  class: "i mdi:close-circle",
215
207
  onClick: clearProps
216
- })) : createCommentVNode("v-if", true)
208
+ })) : createCommentVNode("", true)
217
209
  ]);
218
210
  };
219
211
  }
220
212
  });
221
- const DtFormInputDialog = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/formInputUseDialog.vue"]]);
222
213
  const components = {
223
214
  Input: Input$1,
224
- InputWithDialog: DtFormInputDialog,
215
+ InputWithDialog: _sfc_main$3,
225
216
  InputTextArea: Input$1.TextArea,
226
217
  InputSearch: Input$1.Search,
227
218
  InputGroup: Input$1.Group,
@@ -230,7 +221,7 @@ const components = {
230
221
  TreeSelect,
231
222
  Radio,
232
223
  RadioGroup: Radio.Group,
233
- RadioButtonGroup,
224
+ RadioButtonGroup: _sfc_main$4,
234
225
  Checkbox,
235
226
  CheckboxGroup: Checkbox.Group,
236
227
  AutoComplete,
@@ -282,7 +273,6 @@ const _sfc_main$2 = {
282
273
  }
283
274
  },
284
275
  setup(props, {
285
- emit,
286
276
  slots
287
277
  }) {
288
278
  const {
@@ -359,7 +349,8 @@ const _sfc_main$2 = {
359
349
  name,
360
350
  colon = appConf.ui.form.colon,
361
351
  suffix,
362
- prefix
352
+ prefix,
353
+ description
363
354
  } = props.schema;
364
355
  const {
365
356
  labelCol,
@@ -399,7 +390,9 @@ const _sfc_main$2 = {
399
390
  "style": "flex:1; width: 100%;"
400
391
  }, [getContent()]), !!suffix && createVNode("span", {
401
392
  "class": "suffix px-2"
402
- }, [getSuffix()])])]
393
+ }, [getSuffix()])]), description && createVNode("div", {
394
+ "class": "opacity-50 text-12"
395
+ }, [description])]
403
396
  });
404
397
  }
405
398
  function renderLabel() {
@@ -409,7 +402,7 @@ const _sfc_main$2 = {
409
402
  subLabel,
410
403
  toolTipProps = {}
411
404
  } = props.schema;
412
- const renderLabel2 = subLabel ? createVNode("span", null, [createTextVNode(" "), label, createTextVNode(" "), createVNode("span", {
405
+ const renderLabel2 = subLabel ? createVNode("span", null, [" ", label, createTextVNode(" "), createVNode("span", {
413
406
  "class": "text-secondary opacity-50"
414
407
  }, [createTextVNode("("), subLabel, createTextVNode(")")])]) : label;
415
408
  const _toolTip = isFunction(toolTip) ? toolTip(unref(getValues).model) : toolTip;
@@ -452,8 +445,9 @@ const _sfc_main$2 = {
452
445
  } else if (isArray(name)) {
453
446
  name.map((key) => props.setFormModel(key, value));
454
447
  }
455
- if (_sProps && _sProps[eventKey])
448
+ if (_sProps && _sProps[eventKey]) {
456
449
  _sProps[eventKey](...args, formModel);
450
+ }
457
451
  }
458
452
  };
459
453
  for (let it in _sProps) {
@@ -474,10 +468,12 @@ const _sfc_main$2 = {
474
468
  disabled: itemDisabled = false
475
469
  } = unref(getComponentProps);
476
470
  let _disabled = !!gDisabled || itemDisabled;
477
- if (isBoolean(disabled))
471
+ if (isBoolean(disabled)) {
478
472
  _disabled = disabled;
479
- if (isFunction(disabled))
473
+ }
474
+ if (isFunction(disabled)) {
480
475
  _disabled = disabled(unref(getValues).model);
476
+ }
481
477
  return _disabled;
482
478
  });
483
479
  const getSize = () => {
@@ -496,10 +492,8 @@ const _sfc_main$2 = {
496
492
  disabled: unref(getDisable)
497
493
  };
498
494
  if (component === "Select") {
499
- {
500
- itemProps.showSearch = true;
501
- itemProps.optionFilterProp = "label";
502
- }
495
+ itemProps.showSearch = true;
496
+ itemProps.optionFilterProp = "label";
503
497
  }
504
498
  if (component !== "RangePicker") {
505
499
  itemProps.placeholder = unref(getComponentProps)?.placeholder || createPlaceholder(component);
@@ -544,8 +538,9 @@ const _sfc_main$2 = {
544
538
  dynamicRules,
545
539
  required
546
540
  } = props.schema;
547
- if (!component)
541
+ if (!component) {
548
542
  return [];
543
+ }
549
544
  if (isFunction(dynamicRules)) {
550
545
  return dynamicRules(unref(getValues).model);
551
546
  }
@@ -553,8 +548,9 @@ const _sfc_main$2 = {
553
548
  let rules = cloneDeep(defaultRules);
554
549
  const getRequired = isFunction(required) ? required(unref(getValues).model) : required;
555
550
  function validator(rule, value) {
556
- if (component === "Upload" && unref(uploadFiles).map((file) => file.fileId).includes(void 0))
551
+ if (component === "Upload" && unref(uploadFiles).map((file) => file.fileId).includes(void 0)) {
557
552
  return Promise.resolve();
553
+ }
558
554
  const msg = rule.message || defaultMsg;
559
555
  if (value === void 0 || isNull(value) || Array.isArray(value) && value.length === 0 || typeof value === "string" && value.trim() === "" || typeof value === "object" && Reflect.has(value, "checked") && Reflect.has(value, "halfChecked") && Array.isArray(value.checked) && Array.isArray(value.halfChecked) && value.checked.length === 0 && value.halfChecked.length === 0) {
560
556
  return Promise.reject(msg);
@@ -655,7 +651,6 @@ const _sfc_main$2 = {
655
651
  };
656
652
  }
657
653
  };
658
- const DtFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/FormItem.vue"]]);
659
654
  const _hoisted_1 = {
660
655
  key: 0,
661
656
  className: "preIcon pr-1"
@@ -822,18 +817,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
822
817
  icon: withCtx(() => [
823
818
  button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1, null, 512)), [
824
819
  [_directive_icon, button.preIcon]
825
- ]) : createCommentVNode("v-if", true)
820
+ ]) : createCommentVNode("", true)
826
821
  ]),
827
822
  default: withCtx(() => [
828
823
  createTextVNode(" " + toDisplayString(unref(t)(button.label)) + " ", 1),
829
824
  button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
830
825
  [_directive_icon, button.postIcon]
831
- ]) : createCommentVNode("v-if", true)
826
+ ]) : createCommentVNode("", true)
832
827
  ]),
833
828
  _: 2
834
829
  }, 1032, ["type", "class", "loading", "disabled", "onClick"])), [
835
830
  [_directive_auth, getAuth(button.auth)]
836
- ]) : createCommentVNode("v-if", true)
831
+ ]) : createCommentVNode("", true)
837
832
  ], 64);
838
833
  }), 256)),
839
834
  unref(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
@@ -843,24 +838,22 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
843
838
  onClick: toggleAdvanced
844
839
  }, {
845
840
  default: withCtx(() => [
846
- createCommentVNode(" \u6536\u8D77 | \u5C55\u5F00 "),
847
841
  createElementVNode("span", _hoisted_3, toDisplayString(advancedRef.value ? unref(t)("UI.ADVANCED") : unref(t)("UI.EXPAND")), 1),
848
842
  createElementVNode("span", {
849
843
  class: normalizeClass(unref(getAdvanceClass))
850
844
  }, _hoisted_5, 2)
851
845
  ]),
852
846
  _: 1
853
- })) : createCommentVNode("v-if", true)
847
+ })) : createCommentVNode("", true)
854
848
  ]),
855
849
  _: 1
856
850
  }, 8, ["style"])
857
851
  ]),
858
852
  _: 1
859
- }, 16)) : createCommentVNode("v-if", true);
853
+ }, 16)) : createCommentVNode("", true);
860
854
  };
861
855
  }
862
856
  });
863
- const DtFormButtons = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/FormButtons.vue"]]);
864
857
  const SEARCH_BTN_NAME = "UI.SEARCH";
865
858
  const RESET_BTN_NAME = "UI.RESET";
866
859
  const SEARCH_BTNS = [
@@ -961,22 +954,22 @@ function useFormEvents({
961
954
  schemaRef.value = schemaList;
962
955
  }
963
956
  function _removeSchemaByName(name, schemaList) {
964
- const index2 = schemaList.findIndex((schema) => schema.name === name);
965
- if (index2 !== -1) {
957
+ const index = schemaList.findIndex((schema) => schema.name === name);
958
+ if (index !== -1) {
966
959
  delete formModel[name];
967
- schemaList.splice(index2, 1);
960
+ schemaList.splice(index, 1);
968
961
  }
969
962
  }
970
963
  function appendFormItems(schema, prefixName, first = false) {
971
964
  const schemaList = cloneDeep(unref(getSchema));
972
- const index2 = schemaList.findIndex((schema2) => schema2.name === prefixName);
973
- if (!prefixName || index2 === -1 || first) {
965
+ const index = schemaList.findIndex((schema2) => schema2.name === prefixName);
966
+ if (!prefixName || index === -1 || first) {
974
967
  first ? schemaList.unshift(...schema) : schemaList.push(...schema);
975
968
  schemaRef.value = schemaList;
976
969
  return;
977
970
  }
978
- if (index2 !== -1) {
979
- schemaList.splice(index2 + 1, 0, ...schema);
971
+ if (index !== -1) {
972
+ schemaList.splice(index + 1, 0, ...schema);
980
973
  }
981
974
  schemaRef.value = schemaList;
982
975
  }
@@ -1102,7 +1095,7 @@ function useFormValues({
1102
1095
  if (isArray(defaultValue2)) {
1103
1096
  let vals = defaultValue2.map((it) => format ? dayjs(it, format) : dayjs(it));
1104
1097
  if (names.length > 1) {
1105
- names.map((key, index2) => obj[key] = vals[index2] ?? null);
1098
+ names.map((key, index) => obj[key] = vals[index] ?? null);
1106
1099
  } else {
1107
1100
  obj[names[0]] = vals;
1108
1101
  }
@@ -1111,11 +1104,11 @@ function useFormValues({
1111
1104
  }
1112
1105
  } else {
1113
1106
  if (names.length > 1) {
1114
- names.forEach((key, index2) => {
1115
- if (!defaultValue2 || defaultValue2.length - 1 < index2) {
1107
+ names.forEach((key, index) => {
1108
+ if (!defaultValue2 || defaultValue2.length - 1 < index) {
1116
1109
  obj[key] = null;
1117
1110
  } else {
1118
- obj[key] = defaultValue2[index2];
1111
+ obj[key] = defaultValue2[index];
1119
1112
  }
1120
1113
  });
1121
1114
  } else {
@@ -1124,7 +1117,7 @@ function useFormValues({
1124
1117
  }
1125
1118
  } else {
1126
1119
  names.map((it) => {
1127
- if (component === "TreeSelect" || (mode === "multiple" || treeCheckable) || component === "Select" && mode === "multiple") {
1120
+ if (component === "TreeSelect" && (mode === "multiple" || treeCheckable) || component === "Select" && mode === "multiple") {
1128
1121
  obj[it] = [];
1129
1122
  } else {
1130
1123
  obj[it] = null;
@@ -1153,8 +1146,8 @@ function useFormActions(opt) {
1153
1146
  } = unref(getProps);
1154
1147
  let schema = [...schemas];
1155
1148
  if (showAdvancedButton) {
1156
- schema = schemas.reduce((t, it, index2) => {
1157
- if (index2 > minShowColumn - 1)
1149
+ schema = schemas.reduce((t, it, index) => {
1150
+ if (index > minShowColumn - 1)
1158
1151
  it.isAdvanced = isAdvanced;
1159
1152
  t.push(it);
1160
1153
  return t;
@@ -1338,7 +1331,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1338
1331
  formModel[key] = value;
1339
1332
  const { validateTrigger } = unref(getBindValue);
1340
1333
  if (!validateTrigger || validateTrigger === "change") {
1341
- validateFields([key]).catch((err) => {
1334
+ validateFields([key]).catch(() => {
1342
1335
  });
1343
1336
  }
1344
1337
  }
@@ -1423,7 +1416,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1423
1416
  return {
1424
1417
  colspan,
1425
1418
  style: {
1426
- marginLeft: "auto"
1419
+ marginLeft: showAdvancedButton ? "auto" : ""
1427
1420
  },
1428
1421
  ...{
1429
1422
  showAdvancedButton,
@@ -1459,10 +1452,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1459
1452
  );
1460
1453
  watch(
1461
1454
  () => unref(getProps).model,
1462
- (v) => {
1455
+ () => {
1463
1456
  const { model } = unref(getProps);
1464
- if (!model || !Object.keys(model).length)
1457
+ if (!model || !Object.keys(model).length) {
1465
1458
  return;
1459
+ }
1466
1460
  setFormValues(model);
1467
1461
  },
1468
1462
  {
@@ -1487,14 +1481,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1487
1481
  } }), {
1488
1482
  default: withCtx(() => [
1489
1483
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getSchema), (schema) => {
1490
- return openBlock(), createBlock(unref(DtFormItem), {
1484
+ return openBlock(), createBlock(unref(_sfc_main$2), {
1491
1485
  key: schema.name,
1492
1486
  schema,
1493
- formProps: unref(getProps),
1494
- formModel,
1495
- defaultValues: defaultValue.value,
1496
- setFormModel,
1497
- formActionType: formActionMethods
1487
+ "form-props": unref(getProps),
1488
+ "form-model": formModel,
1489
+ "default-values": defaultValue.value,
1490
+ "set-form-model": setFormModel,
1491
+ "form-action-type": formActionMethods
1498
1492
  }, createSlots({ _: 2 }, [
1499
1493
  renderList(Object.keys(_ctx.$slots), (item) => {
1500
1494
  return {
@@ -1504,9 +1498,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1504
1498
  ])
1505
1499
  };
1506
1500
  })
1507
- ]), 1032, ["schema", "formProps", "formModel", "defaultValues"]);
1501
+ ]), 1032, ["schema", "form-props", "form-model", "default-values"]);
1508
1502
  }), 128)),
1509
- unref(getActionsProps).buttonList?.length ? (openBlock(), createBlock(unref(DtFormButtons), mergeProps({ key: 0 }, unref(getActionsProps), { onHandleMethod: unref(handleMethod) }), null, 16, ["onHandleMethod"])) : createCommentVNode("v-if", true)
1503
+ unref(getActionsProps).buttonList?.length ? (openBlock(), createBlock(unref(_sfc_main$1), mergeProps({ key: 0 }, unref(getActionsProps), { onHandleMethod: unref(handleMethod) }), null, 16, ["onHandleMethod"])) : createCommentVNode("", true)
1510
1504
  ]),
1511
1505
  _: 3
1512
1506
  }, 16)
@@ -1516,7 +1510,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1516
1510
  };
1517
1511
  }
1518
1512
  });
1519
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/index.vue"]]);
1520
1513
  function useForm(props) {
1521
1514
  const formRef = ref(null);
1522
1515
  const loadedRef = ref(false);
@@ -1588,7 +1581,7 @@ function useForm(props) {
1588
1581
  return [register, methods];
1589
1582
  }
1590
1583
  export {
1591
- index as DtForm,
1592
- DtFormButtons,
1584
+ _sfc_main as DtForm,
1585
+ _sfc_main$1 as DtFormButtons,
1593
1586
  useForm
1594
1587
  };
@@ -71,7 +71,7 @@ declare const _sfc_main: {
71
71
  type: NumberConstructor;
72
72
  };
73
73
  size: {
74
- type: PropType<"small" | "large" | "middle">;
74
+ type: PropType<"large" | "small" | "middle">;
75
75
  };
76
76
  disabled: {
77
77
  type: BooleanConstructor;
@@ -151,8 +151,7 @@ declare const _sfc_main: {
151
151
  type: PropType<FormActionType>;
152
152
  };
153
153
  };
154
- setup(props: any, { emit, slots }: {
155
- emit: any;
154
+ setup(props: any, { slots }: {
156
155
  slots: any;
157
156
  }): () => JSX.Element;
158
157
  };
@@ -1,7 +1,7 @@
1
- import { Recordable } from "@dt-frames/core";
2
- import { PropType, Ref } from "vue";
3
- import { ButtonProps, ColEx, FormSchema } from "./types/form.type";
4
- import { FormActionType } from "./types/actions.type";
1
+ import { Recordable } from '@dt-frames/core';
2
+ import { PropType, Ref } from 'vue';
3
+ import { ButtonProps, ColEx, FormSchema } from './types/form.type';
4
+ import { FormActionType } from './types/actions.type';
5
5
  export declare const BasicProps: {
6
6
  mode: {
7
7
  type: PropType<"search" | "dialog">;
@@ -41,7 +41,7 @@ export declare const BasicProps: {
41
41
  };
42
42
  rowProps: {
43
43
  type: PropType<Partial<import("vue").ExtractPropTypes<{
44
- align: PropType<"bottom" | "top" | "stretch" | "middle">;
44
+ align: PropType<"stretch" | "bottom" | "top" | "middle">;
45
45
  justify: PropType<"space-around" | "space-between" | "center" | "end" | "start">;
46
46
  prefixCls: StringConstructor;
47
47
  gutter: {
@@ -62,7 +62,7 @@ export declare const BasicProps: {
62
62
  type: NumberConstructor;
63
63
  };
64
64
  size: {
65
- type: PropType<"small" | "large" | "middle">;
65
+ type: PropType<"large" | "small" | "middle">;
66
66
  };
67
67
  disabled: {
68
68
  type: BooleanConstructor;
@@ -56,6 +56,7 @@ declare type Schema<ComponentType, T> = {
56
56
  wrapperCol?: Partial<ColEx>;
57
57
  isAdvanced?: boolean;
58
58
  extraName?: string[];
59
+ description: String;
59
60
  };
60
61
  export declare type FormSchema = Schema<'Input', Input> | Schema<'InputWithDialog', InputWithDialog> | Schema<'InputGroup', InputGroup> | Schema<'InputPassword', InputPassword> | Schema<'InputSearch', InputSearch> | Schema<'InputTextArea', InputTextArea> | Schema<'InputNumber', InputNumber> | Schema<'Select', Select> | Schema<'TreeSelect', TreeSelect> | Schema<'Radio', Radio> | Schema<'RadioButtonGroup', Radio> | Schema<'RadioGroup', RadioGroup> | Schema<'Checkbox', Checkbox> | Schema<'CheckboxGroup', CheckboxGroup> | Schema<'AutoComplete', Recordable> | Schema<'Cascader', Cascader> | Schema<'DatePicker', DatePicker> | Schema<'MonthPicker', DatePicker> | Schema<'RangePicker', RangePicker> | Schema<'WeekPicker', DatePicker> | Schema<'TimePicker', TimePicker> | Schema<'Switch', Switch> | Schema<'Slider', {
61
62
  disabled?: boolean;
@@ -135,6 +135,8 @@ function useSource(props) {
135
135
  const { t } = useI18n("UI");
136
136
  const { confirm, message } = useMessage();
137
137
  const { appConf } = useAppStore();
138
+ let okCode = appConf?.http?.okCode;
139
+ let _okCode = isArray(okCode) ? okCode : [okCode];
138
140
  const { baseUrl, api: orgApi, exportName, queryAfterUpdate, beforeUpdate, afterUpdate, authPrefix } = props;
139
141
  const pagination = ref({
140
142
  current: appConf?.ui?.table?.defaultPageNo || 1,
@@ -202,7 +204,7 @@ function useSource(props) {
202
204
  pagination.value = {
203
205
  current,
204
206
  pageSize: size || appConf?.ui?.table?.defaultPageSize,
205
- total: 100
207
+ total
206
208
  };
207
209
  }
208
210
  } catch (err) {
@@ -278,7 +280,7 @@ function useSource(props) {
278
280
  loading.onAdd.value = true;
279
281
  try {
280
282
  const result = await fetch(api.add, { ...model }, false);
281
- if (result?.code === appConf?.http?.okCode) {
283
+ if (_okCode.includes(result?.code)) {
282
284
  message.success(t("ADD_SUCCESS"));
283
285
  curdInstance && curdInstance.closeModal();
284
286
  if (queryAfterUpdate !== false)
@@ -294,7 +296,7 @@ function useSource(props) {
294
296
  loading.onUpdate.value = true;
295
297
  try {
296
298
  const result = await fetch(api.update, { ...model }, false);
297
- if (result?.code === appConf?.http?.okCode) {
299
+ if (_okCode.includes(result?.code)) {
298
300
  message.success(t("UPDATE_SUCCESS"));
299
301
  curdInstance && curdInstance.closeModal();
300
302
  if (queryAfterUpdate !== false)
@@ -332,7 +334,7 @@ function useSource(props) {
332
334
  iconType: "warning",
333
335
  onOk() {
334
336
  fetch(api.deletes, toRaw(_ids), false).then((rsp) => {
335
- if (rsp?.code === appConf?.http?.okCode) {
337
+ if (_okCode.includes(rsp?.code)) {
336
338
  message.success((isSingleDelete ? "" : t("MULTIFY")) + t("DELETE_SUCCESS"));
337
339
  !isSingleDelete && tableInstance.clearSelectedRowKeys();
338
340
  if (queryAfterUpdate !== false)
@@ -176,12 +176,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
176
176
  },
177
177
  btns: {
178
178
  type: Array,
179
- default: []
179
+ default: () => []
180
180
  },
181
181
  flag: {
182
182
  type: String
183
183
  },
184
184
  record: {
185
+ type: Object,
185
186
  default: {}
186
187
  },
187
188
  index: {
@@ -201,17 +202,17 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
201
202
  return auth;
202
203
  } else if (authPrefix && auth) {
203
204
  return `${authPrefix}:${auth}`;
204
- } else {
205
- return auth ?? null;
206
205
  }
206
+ return auth ?? null;
207
207
  };
208
208
  const { appConf } = useAppStore();
209
209
  const getExpandNum = computed(() => {
210
210
  return props2.expandNum || appConf?.ui?.table?.expandNum;
211
211
  });
212
212
  const showMore = computed(() => {
213
- if (!unref(getExpandNum))
213
+ if (!unref(getExpandNum)) {
214
214
  return false;
215
+ }
215
216
  let allAuths = DtCache.getLocal(CacheKey.AUTHS);
216
217
  let remainBtnNum = unref(actionBtns).length - unref(getExpandNum);
217
218
  let remainBtn = takeRight(unref(actionBtns), remainBtnNum);
@@ -280,7 +281,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
280
281
  ]) : createCommentVNode("v-if", true),
281
282
  index2 >= unref(getExpandNum) && index2 === actionBtns.value.length - 1 ? (openBlock(), createBlock(_component_ADropdown, {
282
283
  key: 1,
283
- getPopupContainer: getPopupContainer$1,
284
+ "get-popup-container": getPopupContainer$1,
284
285
  trigger: ["click"]
285
286
  }, {
286
287
  overlay: withCtx(() => [
@@ -308,7 +309,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
308
309
  })
309
310
  ]),
310
311
  default: withCtx(() => [
311
- unref(showMore) ? (openBlock(), createElementBlock("span", _hoisted_2$3, "\u66F4\u591A")) : createCommentVNode("v-if", true)
312
+ unref(showMore) ? (openBlock(), createElementBlock("span", _hoisted_2$3, " \u66F4\u591A ")) : createCommentVNode("v-if", true)
312
313
  ]),
313
314
  _: 1
314
315
  })) : createCommentVNode("v-if", true)
@@ -337,7 +338,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
337
338
  }), 256))
338
339
  ], 2)) : (openBlock(), createBlock(_component_ADropdown, {
339
340
  key: 1,
340
- getPopupContainer: getPopupContainer$1,
341
+ "get-popup-container": getPopupContainer$1,
341
342
  trigger: ["click"]
342
343
  }, {
343
344
  overlay: withCtx(() => [
@@ -605,8 +606,9 @@ function handleItem(item, ellipsis) {
605
606
  const { key, dataIndex, children } = item;
606
607
  item.align = item.align || align;
607
608
  if (ellipsis) {
608
- if (!key)
609
+ if (!key) {
609
610
  item.key = dataIndex && dataIndex.toString();
611
+ }
610
612
  if (!isBoolean(item.ellipsis)) {
611
613
  item = Object.assign(item, {
612
614
  ellipsis
@@ -618,8 +620,9 @@ function handleItem(item, ellipsis) {
618
620
  }
619
621
  }
620
622
  function handleChildren(children, ellipsis) {
621
- if (!children)
623
+ if (!children) {
622
624
  return;
625
+ }
623
626
  children.forEach((item) => {
624
627
  const { children: children2 } = item;
625
628
  handleItem(item, ellipsis);
@@ -642,8 +645,9 @@ function handleIndexColumn(propsRef, getPaginationRef, columns) {
642
645
  columns.splice(indIndex, 1);
643
646
  }
644
647
  });
645
- if (!pushIndexColumns)
648
+ if (!pushIndexColumns) {
646
649
  return;
650
+ }
647
651
  const isFixedLeft = columns.some((item) => item.fixed === "left");
648
652
  columns.unshift({
649
653
  flag: INDEX_FLAG,
@@ -651,8 +655,9 @@ function handleIndexColumn(propsRef, getPaginationRef, columns) {
651
655
  title: t("NUMBER"),
652
656
  align: "center",
653
657
  customRender: ({ index: index2, renderIndex, record }) => {
654
- if (virtual && record?.index)
658
+ if (virtual && record?.index) {
655
659
  return record?.index;
660
+ }
656
661
  const getPagination = unref(getPaginationRef);
657
662
  const { appConf } = useAppStore();
658
663
  const { defaultPageSize } = appConf.ui.table;
@@ -672,31 +677,40 @@ function handleActionColumn(propsRef, columns) {
672
677
  const { appConf } = useAppStore();
673
678
  const { getIsZH } = useHeader();
674
679
  const { t } = useI18n("UI");
675
- let defaultButtons = [
676
- { label: t("EDIT"), icon: "mdi:text-box-edit-outline", onClick: unref(propsRef).onOpenUpdateDialog },
677
- { label: t("DELETE"), icon: "mdi:delete-outline", onClick: unref(propsRef).onDelete, color: "#ed6f6f" }
680
+ const defaultButtons = [
681
+ {
682
+ label: t("EDIT"),
683
+ icon: "mdi:text-box-edit-outline",
684
+ onClick: unref(propsRef).onOpenUpdateDialog
685
+ },
686
+ {
687
+ label: t("DELETE"),
688
+ icon: "mdi:delete-outline",
689
+ onClick: unref(propsRef).onDelete,
690
+ color: "#ed6f6f"
691
+ }
678
692
  ];
679
693
  const { operations = defaultButtons, expandActions = false, authPrefix } = unref(propsRef);
680
- if (!operations || isObject(operations) && operations?.btns && !operations?.btns?.length || isArray(operations) && !operations.length)
694
+ if (!operations || isObject(operations) && operations?.btns && !operations?.btns?.length || isArray(operations) && !operations.length) {
681
695
  return;
696
+ }
682
697
  const hasIndex = columns.findIndex((column) => column.flag === ACTION_COLUMN);
683
698
  if (hasIndex === -1) {
684
- let column = isObject(operations) ? {
699
+ const column = isObject(operations) ? {
685
700
  expand: appConf?.ui?.table?.expandActions,
686
701
  btns: defaultButtons,
687
702
  ...operations
688
703
  } : isArray(operations) ? { expand: appConf?.ui?.table?.expandActions, btns: operations } : {};
689
- let expand = column.expand ? column.expand : expandActions;
690
- let expandNum = (isObject(operations) ? operations.expandNum : appConf?.ui?.table?.expandNum) || null;
691
- let allAuths = DtCache.getLocal(CacheKey.AUTHS);
704
+ const expand = column.expand ? column.expand : expandActions;
705
+ const expandNum = (isObject(operations) ? operations.expandNum : appConf?.ui?.table?.expandNum) || null;
706
+ const allAuths = DtCache.getLocal(CacheKey.AUTHS);
692
707
  const getAuth = (auth) => {
693
708
  if (auth && auth.includes(":")) {
694
709
  return auth;
695
710
  } else if (authPrefix && auth) {
696
711
  return `${authPrefix}:${auth}`;
697
- } else {
698
- return auth ?? null;
699
712
  }
713
+ return auth ?? null;
700
714
  };
701
715
  const getWidth = () => {
702
716
  let w = 0;
@@ -719,7 +733,7 @@ function handleActionColumn(propsRef, columns) {
719
733
  }
720
734
  return w;
721
735
  };
722
- let columnObj = {
736
+ const columnObj = {
723
737
  fixed: "right",
724
738
  title: t("ACTIONS"),
725
739
  align: "center",
@@ -733,12 +747,15 @@ function handleActionColumn(propsRef, columns) {
733
747
  customRender: ({ record, index: index2 }) => {
734
748
  return h(
735
749
  TableAction,
736
- omit({
737
- ...columnObj,
738
- authPrefix,
739
- record,
740
- index: index2
741
- }, "align")
750
+ omit(
751
+ {
752
+ ...columnObj,
753
+ authPrefix,
754
+ record,
755
+ index: index2
756
+ },
757
+ "align"
758
+ )
742
759
  );
743
760
  }
744
761
  });
@@ -748,9 +765,10 @@ function sortFixedColumn(columns) {
748
765
  const fixedLeftColumn = [];
749
766
  const fixedRightColumn = [];
750
767
  const defaultColumn = [];
751
- for (let column of columns) {
752
- if (column.defaultHidden)
768
+ for (const column of columns) {
769
+ if (column.defaultHidden) {
753
770
  continue;
771
+ }
754
772
  if (column.fixed === "left") {
755
773
  fixedLeftColumn.push(column);
756
774
  continue;
@@ -761,11 +779,7 @@ function sortFixedColumn(columns) {
761
779
  }
762
780
  defaultColumn.push(column);
763
781
  }
764
- return [
765
- ...fixedLeftColumn,
766
- ...defaultColumn,
767
- ...fixedRightColumn
768
- ];
782
+ return [...fixedLeftColumn, ...defaultColumn, ...fixedRightColumn];
769
783
  }
770
784
  function useColumns(propsRef, getPaginationRef, tableElRef) {
771
785
  const columnsRef = ref(unref(propsRef).columns);
@@ -810,7 +824,8 @@ function useColumns(propsRef, getPaginationRef, tableElRef) {
810
824
  }
811
825
  function addResize() {
812
826
  const { resizable, minWidth = 50, maxWidth = 700 } = unref(propsRef);
813
- let els = unref(tableElRef)?.$el.querySelectorAll(".__column"), allWidth = 0, columnAllWidth = 0, noWidthNum = 0, avgWidth = 0, scrollBarW = 10;
827
+ const els = unref(tableElRef)?.$el.querySelectorAll(".__column"), scrollBarW = 10;
828
+ let allWidth = 0, columnAllWidth = 0, noWidthNum = 0, avgWidth = 0;
814
829
  for (let i = 0; i < els?.length; i++) {
815
830
  allWidth += els[i].offsetWidth ?? 0;
816
831
  }
@@ -876,12 +891,12 @@ function useColumns(propsRef, getPaginationRef, tableElRef) {
876
891
  }
877
892
  }
878
893
  function setColumnsByDataIndex(dataIndex, value) {
879
- if (!dataIndex || !value)
894
+ if (!dataIndex || !value) {
880
895
  return;
896
+ }
881
897
  cacheColumns.forEach((item) => {
882
898
  if (item.dataIndex === dataIndex) {
883
899
  Object.assign(item, value);
884
- return;
885
900
  }
886
901
  });
887
902
  columnsRef.value = [...cacheColumns];
@@ -913,12 +928,14 @@ function useCustomRow(propsRef, { setSelectedRowKeys, getSelectedRowKeys, clearS
913
928
  e?.stopPropagation();
914
929
  function handleClick() {
915
930
  const { rowSelection, rowKey, clickToSelectRow } = unref(propsRef);
916
- if (!rowSelection || !clickToSelectRow)
931
+ if (!rowSelection) {
917
932
  return;
933
+ }
918
934
  const keys = getSelectedRowKeys();
919
935
  const key = record[rowKey];
920
- if (!key)
936
+ if (!key) {
921
937
  return;
938
+ }
922
939
  const isCheckbox = rowSelection.type === "checkbox";
923
940
  const isRadio = rowSelection.type === "radio";
924
941
  if (clickToSelectRow) {
@@ -929,17 +946,20 @@ function useCustomRow(propsRef, { setSelectedRowKeys, getSelectedRowKeys, clearS
929
946
  setSelectedRowKeys([...keys, key]);
930
947
  }
931
948
  }
932
- if (isRadio)
949
+ if (isRadio) {
933
950
  setSelectedRowKeys([key]);
951
+ }
934
952
  return;
935
953
  }
936
954
  if (isCheckbox) {
937
- const tr = e.composedPath?.().find((dom) => dom.tagName === "TR");
938
- if (!tr)
955
+ const td = e.composedPath?.().find((dom) => dom.tagName === "TD");
956
+ if (!td) {
939
957
  return;
940
- const checkBox = tr.querySelector("input[type=checkbox]");
941
- if (!checkBox || checkBox.hasAttribute("disabled"))
958
+ }
959
+ const checkBox = td.querySelector("input[type=checkbox]");
960
+ if (!checkBox || checkBox.hasAttribute("disabled")) {
942
961
  return;
962
+ }
943
963
  if (!keys.includes(key)) {
944
964
  setSelectedRowKeys([...keys, key]);
945
965
  return;
@@ -981,11 +1001,7 @@ function useCustomRow(propsRef, { setSelectedRowKeys, getSelectedRowKeys, clearS
981
1001
  customRow
982
1002
  };
983
1003
  }
984
- function useDataSource(propsRef, {
985
- getPaginationInfo,
986
- setPagination,
987
- clearSelectedRowKeys
988
- }) {
1004
+ function useDataSource(propsRef, { getPaginationInfo, setPagination, clearSelectedRowKeys }) {
989
1005
  const dataSourceRef = ref([]);
990
1006
  watch(
991
1007
  () => unref(propsRef).dataSource,
@@ -1026,15 +1042,18 @@ function useDataSource(propsRef, {
1026
1042
  }
1027
1043
  const { defSort, onTableChange } = unref(propsRef);
1028
1044
  const { appConf } = useAppStore();
1029
- onTableChange({
1030
- pagination: {
1031
- current: 1,
1032
- pageSize: appConf.ui.table.defaultPageSize
1045
+ onTableChange(
1046
+ {
1047
+ pagination: {
1048
+ current: 1,
1049
+ pageSize: appConf.ui.table.defaultPageSize
1050
+ },
1051
+ sort: defSort,
1052
+ filter: null,
1053
+ showBtnLoading: false
1033
1054
  },
1034
- sort: defSort,
1035
- filter: null,
1036
- showBtnLoading: false
1037
- }, false);
1055
+ false
1056
+ );
1038
1057
  function updateTableDataRecord(rowKey, record) {
1039
1058
  const row = findTableDataRecord(rowKey);
1040
1059
  if (row) {
@@ -1045,8 +1064,9 @@ function useDataSource(propsRef, {
1045
1064
  }
1046
1065
  }
1047
1066
  function findTableDataRecord(rowKey) {
1048
- if (!dataSourceRef.value || dataSourceRef.value.length == 0 || !rowKey)
1067
+ if (!dataSourceRef.value || dataSourceRef.value.length == 0 || !rowKey) {
1049
1068
  return;
1069
+ }
1050
1070
  const { childrenColumnName = "children" } = unref(propsRef);
1051
1071
  const findRow = (array) => {
1052
1072
  let ret;
@@ -1839,8 +1859,9 @@ function useRowSelection(propsRef, emit) {
1839
1859
  const selectedRowRef = ref([]);
1840
1860
  const getRowSelectionRef = computed(() => {
1841
1861
  const { rowSelection, showCheckboxColumn, checkStrictly } = unref(propsRef);
1842
- if (!rowSelection && !showCheckboxColumn)
1862
+ if (!rowSelection && !showCheckboxColumn) {
1843
1863
  return null;
1864
+ }
1844
1865
  if (isBoolean(showCheckboxColumn)) {
1845
1866
  if (showCheckboxColumn && rowSelection) {
1846
1867
  rowSelection.type = "checkbox";
@@ -1905,8 +1926,9 @@ function useRowSelection(propsRef, emit) {
1905
1926
  const { rowSelection } = unref(propsRef);
1906
1927
  if (rowSelection) {
1907
1928
  const { onChange } = rowSelection;
1908
- if (onChange && isFunction(onChange))
1929
+ if (onChange && isFunction(onChange)) {
1909
1930
  onChange(getSelectedRowKeys(), getSelectRows());
1931
+ }
1910
1932
  }
1911
1933
  emit("selection-change", {
1912
1934
  keys: getSelectedRowKeys(),
@@ -1938,7 +1960,7 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
1938
1960
  windowResizeFn(debounceRedoHeight, 280);
1939
1961
  watch(
1940
1962
  () => propsRef.value.dataSource,
1941
- (v) => {
1963
+ () => {
1942
1964
  debounceRedoHeight();
1943
1965
  },
1944
1966
  {
@@ -1947,8 +1969,8 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
1947
1969
  }
1948
1970
  );
1949
1971
  function redoHeight() {
1950
- const { virtual } = unref(propsRef);
1951
- virtual ? calcTableScroll() : filterSource.value = unref(propsRef)?.dataSource;
1972
+ const { virtual, dataSource } = unref(propsRef);
1973
+ virtual ? calcTableScroll() : filterSource.value = dataSource.map((row) => new Proxy(row, {}));
1952
1974
  }
1953
1975
  const getScrollX = computed(() => {
1954
1976
  let width = 0;
@@ -1965,7 +1987,7 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
1965
1987
  return tableWidth > width ? "100%" : width;
1966
1988
  });
1967
1989
  const hideScrollX = computed(() => {
1968
- let operations = unref(propsRef).operations;
1990
+ const operations = unref(propsRef).operations;
1969
1991
  return !operations || isObject(operations) && operations?.btns && !operations?.btns?.length || isArray(operations) && !operations.length;
1970
1992
  });
1971
1993
  const getScrollRef = computed(() => {
@@ -1990,15 +2012,15 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
1990
2012
  on(bodyEl, "scroll", fn);
1991
2013
  }
1992
2014
  function createScrollWrap(el, prefixH) {
1993
- let data = unref(propsRef)?.dataSource?.length;
2015
+ const data = unref(propsRef)?.dataSource?.length;
1994
2016
  const { getUiSize } = useHeader();
1995
2017
  const rowHeight = TABLE_SIZE_HEIGHT[unref(getUiSize)];
1996
- let scrollWrap = el.querySelector(".tableScrollWrap");
1997
- let wrapHeight = data * rowHeight - prefixH + "px";
2018
+ const scrollWrap = el.querySelector(".tableScrollWrap");
2019
+ const wrapHeight = data * rowHeight - prefixH + "px";
1998
2020
  if (scrollWrap) {
1999
2021
  scrollWrap.style.height = wrapHeight;
2000
2022
  } else {
2001
- let div = document.createElement("div");
2023
+ const div = document.createElement("div");
2002
2024
  div.className = "tableScrollWrap";
2003
2025
  div.style.height = wrapHeight;
2004
2026
  el.insertBefore(div, el.querySelector("table")[0]);
@@ -2009,10 +2031,10 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
2009
2031
  cancelAnimationFrame(unref(t));
2010
2032
  t.value = requestAnimationFrame(() => {
2011
2033
  const scrollTop = el.scrollTop;
2012
- let maxIndex = Math.round(scrollTop / itemH) + itemSize * 2;
2013
- let minIndex = Math.round(scrollTop / itemH) - itemSize;
2034
+ const maxIndex = Math.round(scrollTop / itemH) + itemSize * 2;
2035
+ const minIndex = Math.round(scrollTop / itemH) - itemSize;
2014
2036
  if (minIndex < 0) {
2015
- bodyEl.querySelector("table").style.transform = `translateY(0px)`;
2037
+ bodyEl.querySelector("table").style.transform = "translateY(0px)";
2016
2038
  filterSource.value = unref(propsRef)?.dataSource.slice(0, itemSize * 3);
2017
2039
  } else {
2018
2040
  bodyEl.querySelector("table").style.transform = `translateY(${minIndex * itemH}px)`;
@@ -2112,7 +2134,7 @@ const _sfc_main$1 = {
2112
2134
  }, [txt]);
2113
2135
  } else if (isVnode(render)) {
2114
2136
  renderText.value = createVNode(Fragment, null, [createTextVNode(" "), render, createTextVNode(" ")]);
2115
- } else if (render["setup"]) {
2137
+ } else if (render.setup) {
2116
2138
  renderText.value = createVNode(render, {
2117
2139
  ...record,
2118
2140
  text
@@ -2122,7 +2144,7 @@ const _sfc_main$1 = {
2122
2144
  let afterRenderData = render(record, index2, text);
2123
2145
  if (afterRenderData.__v_isRef) {
2124
2146
  renderText = afterRenderData;
2125
- } else if (afterRenderData["setup"]) {
2147
+ } else if (afterRenderData.setup) {
2126
2148
  renderText.value = createVNode(afterRenderData, {
2127
2149
  ...record,
2128
2150
  text
@@ -2280,11 +2302,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2280
2302
  });
2281
2303
  const { getRowClassName } = useRows(getProps);
2282
2304
  const tableCls = computed(() => {
2283
- return [
2284
- "dt-table",
2285
- "box-border",
2286
- { "dt-table-no-pagation": !unref(getProps).pagination }
2287
- ];
2305
+ return ["dt-table", "box-border", { "dt-table-no-pagation": !unref(getProps).pagination }];
2288
2306
  });
2289
2307
  const { getLoading, setLoading } = useLoading(getProps);
2290
2308
  const { getPaginationInfo, setPagination, getPagination } = usePagination(getProps);
@@ -2304,7 +2322,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2304
2322
  getSelectedRowKeys,
2305
2323
  setSelectedRowKeys
2306
2324
  } = useRowSelection(getProps, emits);
2307
- const { getScrollRef, filterSource } = useTableScroll(getProps, tableElRef, getColumnsRef, getRowSelectionRef);
2325
+ const { getScrollRef, filterSource } = useTableScroll(
2326
+ getProps,
2327
+ tableElRef,
2328
+ getColumnsRef,
2329
+ getRowSelectionRef
2330
+ );
2308
2331
  const handlers = {
2309
2332
  onColumnsChange: (data) => {
2310
2333
  emits("columns-change", data);
@@ -2312,7 +2335,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2312
2335
  }
2313
2336
  };
2314
2337
  const { getHeaderProps } = useTableHeader(getProps, slots, handlers);
2315
- const { customRow } = useCustomRow(getProps, { setSelectedRowKeys, getSelectedRowKeys, clearSelectedRowKeys, emits });
2338
+ const { customRow } = useCustomRow(getProps, {
2339
+ setSelectedRowKeys,
2340
+ getSelectedRowKeys,
2341
+ clearSelectedRowKeys,
2342
+ emits
2343
+ });
2316
2344
  const { handleTableChange, findTableDataRecord, updateTableDataRecord } = useDataSource(
2317
2345
  getProps,
2318
2346
  {
@@ -2322,6 +2350,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2322
2350
  }
2323
2351
  );
2324
2352
  const getBind = computed(() => {
2353
+ console.log(toRaw$1(unref(filterSource)));
2325
2354
  return {
2326
2355
  ...attrs,
2327
2356
  ...unref(getProps),
@@ -2380,8 +2409,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2380
2409
  unref(innerPropsRef)?.registerInstance(tableAction);
2381
2410
  }
2382
2411
  onMounted(() => {
2383
- if (unref(getProps).autoFetch)
2412
+ if (unref(getProps).autoFetch) {
2384
2413
  unref(getProps)?.onSearch({});
2414
+ }
2385
2415
  });
2386
2416
  return (_ctx, _cache) => {
2387
2417
  const _component_ATable = Table;
@@ -2389,7 +2419,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2389
2419
  ref_key: "tableElRef",
2390
2420
  ref: tableElRef
2391
2421
  }, unref(getBind), {
2392
- rowClassName: unref(getRowClassName),
2422
+ "row-class-name": unref(getRowClassName),
2393
2423
  onChange: unref(handleTableChange)
2394
2424
  }), createSlots({
2395
2425
  bodyCell: withCtx(({ column, record, index: index2 }) => [
@@ -2417,7 +2447,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2417
2447
  ])
2418
2448
  };
2419
2449
  })
2420
- ]), 1040, ["rowClassName", "onChange"]);
2450
+ ]), 1040, ["row-class-name", "onChange"]);
2421
2451
  };
2422
2452
  }
2423
2453
  });
@@ -55,6 +55,7 @@ export interface BasicColumn extends ColumnProps<Recordable> {
55
55
  export declare type ButtonType = {
56
56
  t?: string;
57
57
  label?: string | ((row: Recordable) => string);
58
+ enLabel?: string | ((row: Recordable) => string);
58
59
  icon?: string | ((row: Recordable) => string);
59
60
  auth?: string;
60
61
  color?: string;
@@ -315,6 +315,7 @@ function useTree(treeDataRef, getFieldNames, emit) {
315
315
  for (let index = 0; index < data.length; index++) {
316
316
  const item = data[index];
317
317
  const { key: keyField, children: childrenField } = unref(getFieldNames);
318
+ console.log(keyField, childrenField);
318
319
  const key = keyField ? item[keyField] : "";
319
320
  const children = childrenField ? item[childrenField] : [];
320
321
  res.push(key);
@@ -1135,6 +1136,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1135
1136
  emit("update:value", v);
1136
1137
  emit("change", v);
1137
1138
  });
1139
+ watchEffect(() => {
1140
+ activeKey.value = props.activeKey;
1141
+ });
1138
1142
  watchEffect(() => {
1139
1143
  treeDataRef.value = props.treeData;
1140
1144
  });
@@ -1182,8 +1186,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1182
1186
  showIcon: false,
1183
1187
  treeData: unref(treeData),
1184
1188
  onDrop: unref(onDrop)
1185
- }), null, 16, ["treeData", "onDrop"])], 512), [[vShow, !unref(getNotFound)]]), withDirectives(createVNode(_component_AEmpty, null, null, 512), [[vShow, unref(getNotFound)]])]),
1186
- _: 1
1189
+ }), createSlots({
1190
+ _: 2
1191
+ }, [_ctx.$slots.switcherIcon ? {
1192
+ name: "switcherIcon",
1193
+ fn: withCtx((data) => [renderSlot(_ctx.$slots, "switcherIcon", normalizeProps(guardReactiveProps(data || {})))]),
1194
+ key: "0"
1195
+ } : void 0]), 1040, ["treeData", "onDrop"])], 512), [[vShow, !unref(getNotFound)]]), withDirectives(createVNode(_component_AEmpty, null, null, 512), [[vShow, unref(getNotFound)]])]),
1196
+ _: 3
1187
1197
  }, 8, ["spinning", "tip"])], 2);
1188
1198
  };
1189
1199
  }
@@ -22,6 +22,12 @@
22
22
  overflow-y: auto;
23
23
  padding: 10px 0;
24
24
 
25
+ .ant-tree-switcher{
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ }
30
+
25
31
  .ant-tree-treenode{
26
32
  padding: 0;
27
33
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-frames/ui",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./src/index.ts",