@vue-ui-kit/ant 2.3.7 → 2.3.8

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.3.7",
3
+ "version": "2.3.8",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -158,12 +158,12 @@ export interface ColumnProps<D extends Recordable = Recordable>
158
158
  }
159
159
 
160
160
  export interface PButtonProps extends ButtonProps {
161
- content?: string;
161
+ content?: string | (() => any);
162
162
  icon?: string;
163
163
  }
164
164
 
165
165
  export interface ToolbarButtonProps extends PButtonProps {
166
- code: string;
166
+ code?: string;
167
167
  dropdowns?: ToolbarButtonProps[];
168
168
  }
169
169
  export interface ToolbarToolProps extends PButtonProps {
@@ -482,6 +482,16 @@
482
482
  }
483
483
  resetQueryFormData(props.manualFetch);
484
484
  });
485
+ const renderContent = (content: string | (() => any)) => {
486
+ if (isFunction(content)) {
487
+ return content();
488
+ } else {
489
+ return content;
490
+ }
491
+ };
492
+ const isStringContent = (content: any) => {
493
+ return isString(content);
494
+ };
485
495
  const passFields = ['align'];
486
496
  const passDefaultColumnProps = (columns: ColumnProps<D>[]) =>
487
497
  columns.map((c) => ({
@@ -537,8 +547,11 @@
537
547
  <a-dropdown v-if="btn.dropdowns && btn.dropdowns.length">
538
548
  <template #overlay>
539
549
  <a-menu @click="toolBtnMenuClick">
540
- <a-menu-item v-for="sub in btn.dropdowns" :key="sub.code"
541
- >{{ sub.content }}
550
+ <a-menu-item v-for="sub in btn.dropdowns" :key="sub.code">
551
+ <template v-if="sub.content && isStringContent(renderContent(sub.content))">
552
+ {{ renderContent(sub.content) }}
553
+ </template>
554
+ <component v-else-if="sub.content" :is="renderContent(sub.content)" />
542
555
  </a-menu-item>
543
556
  </a-menu>
544
557
  </template>
@@ -553,7 +566,10 @@
553
566
  :block="btn.block"
554
567
  >
555
568
  <Icon v-if="btn.icon" :icon="btn.icon" />
556
- {{ btn.content }}
569
+ <template v-if="btn.content && isStringContent(renderContent(btn.content))">
570
+ {{ renderContent(btn.content) }}
571
+ </template>
572
+ <component v-else-if="btn.content" :is="renderContent(btn.content)" />
557
573
  <DownOutlined />
558
574
  </a-button>
559
575
  </a-dropdown>
@@ -570,7 +586,10 @@
570
586
  @click="debounceToolBtnClick(btn.code)"
571
587
  >
572
588
  <Icon v-if="btn.icon" :icon="btn.icon" />
573
- {{ btn.content }}
589
+ <template v-if="btn.content && isStringContent(renderContent(btn.content))">
590
+ {{ renderContent(btn.content) }}
591
+ </template>
592
+ <component v-else-if="btn.content" :is="renderContent(btn.content)" />
574
593
  </a-button>
575
594
  <div v-else></div>
576
595
  </template>
@@ -592,7 +611,10 @@
592
611
  :loading="loading.toolbar || (!!tool.code && codeLoadings[tool.code])"
593
612
  >
594
613
  <Icon v-if="tool.icon" :icon="tool.icon" />
595
- {{ tool.content }}
614
+ <template v-if="tool.content && isStringContent(renderContent(tool.content))">
615
+ {{ renderContent(tool.content) }}
616
+ </template>
617
+ <component v-else-if="tool.content" :is="renderContent(tool.content)" />
596
618
  </a-button>
597
619
  </template>
598
620
  </span>