@vue-ui-kit/ant 2.3.7 → 2.3.9

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.9",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -76,7 +76,7 @@
76
76
  "ts-patch": "^3.2.1",
77
77
  "typescript-transform-paths": "^3.5.0",
78
78
  "vite": "^5.4.2",
79
- "vite-plugin-dts": "^4.1.0",
79
+ "vite-plugin-dts": "^5.0.0-beta.6",
80
80
  "vue": "^3.4.38"
81
81
  }
82
82
  }
@@ -3,7 +3,6 @@ import { ButtonProps } from 'ant-design-vue/lib/button';
3
3
  import { ColProps } from 'ant-design-vue/lib/grid/Col';
4
4
  import { FormProps } from 'ant-design-vue/lib/form/Form';
5
5
  import { TableColumnType, TableProps, TooltipProps } from 'ant-design-vue';
6
- import { ButtonType } from 'ant-design-vue/lib/button/buttonTypes';
7
6
  import type { ConfigType, Column as EVirtColumn } from 'e-virt-table';
8
7
  import EVirtTable from 'e-virt-table';
9
8
 
@@ -157,13 +156,14 @@ export interface ColumnProps<D extends Recordable = Recordable>
157
156
  cellRender?: CellRender;
158
157
  }
159
158
 
160
- export interface PButtonProps extends ButtonProps {
161
- content?: string;
159
+ export interface PButtonProps extends Omit<ButtonProps, 'type'> {
160
+ content?: string | (() => any);
162
161
  icon?: string;
162
+ type?: 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>
@@ -28,8 +28,9 @@ import TableInput from '@/renders/TableInput.vue';
28
28
  import Icon from '@/renders/Icon';
29
29
  import { computed, ref, Ref } from 'vue';
30
30
 
31
- interface BtnOptions extends ButtonProps {
31
+ interface BtnOptions extends Omit<ButtonProps, 'type'> {
32
32
  content?: string;
33
+ type?: string;
33
34
  getContent?: (p: RenderTableParams) => string;
34
35
  dynamicClassName?: (p: RenderTableParams) => string;
35
36
  dropdowns?: BtnOptions[];
@@ -1,29 +0,0 @@
1
- interface Props {
2
- /** 是否默认折叠 */
3
- defaultCollapsed?: boolean;
4
- title?: string;
5
- /** 是否可以折叠 */
6
- collapsible?: boolean;
7
- }
8
- declare function __VLS_template(): {
9
- attrs: Partial<{}>;
10
- slots: any;
11
- refs: {};
12
- rootEl: any;
13
- };
14
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
- declare const __VLS_component: import('vue').DefineComponent<Props, {
16
- collapse: () => void;
17
- expand: () => void;
18
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
19
- title: string;
20
- defaultCollapsed: boolean;
21
- collapsible: boolean;
22
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
23
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
24
- export default _default;
25
- type __VLS_WithTemplateSlots<T, S> = T & {
26
- new (): {
27
- $slots: S;
28
- };
29
- };