@vue-ui-kit/ant 2.2.0 → 2.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -117,7 +117,14 @@ export interface GroupMenuItem<F extends Recordable = Recordable> {
117
117
  export interface PFormGroupProps<F extends Recordable = Recordable> {
118
118
  getFormSetting: (data: Partial<F>) => PFormProps<Partial<F>>;
119
119
  title?: string;
120
- tabLabel?: string | ((data: Partial<F>) => string);
120
+ tabLabel?: string;
121
+ /**
122
+ * 获取完整标签页标签
123
+ * @param data 数据
124
+ * @param idx 实际索引
125
+ * @returns 标签页标签
126
+ */
127
+ getTabLabel?: (data: Partial<F>, idx: number) => string;
121
128
  editAble?: boolean;
122
129
  showAdd?: boolean;
123
130
  /* 是否启用折叠 */
@@ -73,8 +73,11 @@
73
73
  blockInstance.value[activeKey.value]?.$form?.validate();
74
74
  });
75
75
  };
76
- const getTabLabel = (data: Partial<F>) => {
77
- return typeof props.tabLabel === 'function' ? props.tabLabel(data) : props.tabLabel;
76
+ const calculateTabLabel = (data: Partial<F>, idx: number) => {
77
+ return (
78
+ props.getTabLabel?.(data, idx) ??
79
+ `${props.tabLabel} ${props.keepSerial ? idx + 1 : (data.__index ?? 0) + 1}`
80
+ );
78
81
  };
79
82
  watch(
80
83
  () => model.value,
@@ -283,7 +286,7 @@
283
286
  <a-tab-pane
284
287
  v-for="(item, idx) in model"
285
288
  :key="idx"
286
- :tab="`${getTabLabel(item)} ${keepSerial ? idx + 1 : (item.__index ?? 0) + 1}`"
289
+ :tab="calculateTabLabel(item, idx)"
287
290
  :force-render="fr"
288
291
  >
289
292
  <template #closeIcon>