@vue-ui-kit/ant 2.4.6 → 2.5.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/dist/cjs/index.js +16 -4
- package/dist/es/index.js +2488 -1855
- package/dist/index.d.ts +3049 -761
- package/dist/style.css +3 -0
- package/dist/style.scss +464 -461
- package/package.json +85 -82
- package/src/declarations/antProxy.ts +48 -0
- package/src/index.ts +5 -1
- package/src/packages/components/PCanvasGrid.vue +147 -42
- package/src/packages/components/PDescription.vue +50 -0
- package/src/packages/components/PDescriptionContent.tsx +46 -0
- package/src/packages/components/PGrid.vue +3 -0
- package/src/packages/renders/Icon.ts +3 -3
- package/src/packages/store/renderStore.tsx +51 -2
- package/src/packages/styles/index.scss +464 -461
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createVNode } from 'vue';
|
|
1
|
+
import { createVNode, type VNode } from 'vue';
|
|
2
2
|
import * as $Icon from '@ant-design/icons-vue';
|
|
3
3
|
import { getUIKitConfig } from '@/utils/config';
|
|
4
4
|
|
|
5
|
-
const Icon = (props: { icon: string }) => {
|
|
5
|
+
const Icon = (props: { icon: string }): VNode | null => {
|
|
6
6
|
const { icon } = props;
|
|
7
7
|
const customRender = getUIKitConfig().icon?.render;
|
|
8
8
|
if (customRender) {
|
|
9
9
|
const custom = customRender(icon);
|
|
10
|
-
if (custom) return custom;
|
|
10
|
+
if (custom) return custom as VNode;
|
|
11
11
|
}
|
|
12
12
|
const antIcon: { [key: string]: any } = $Icon;
|
|
13
13
|
if (antIcon[icon]) return createVNode(antIcon[icon]);
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
RenderFormParams,
|
|
3
|
+
RenderOptions,
|
|
4
|
+
RenderReadonlyParams,
|
|
5
|
+
RenderTableParams,
|
|
6
|
+
} from '#/antProxy';
|
|
2
7
|
import {
|
|
3
8
|
Button,
|
|
4
9
|
Dropdown,
|
|
@@ -49,6 +54,11 @@ export interface RenderWorkshop {
|
|
|
49
54
|
params: RenderTableParams,
|
|
50
55
|
defaultHandler: Recordable,
|
|
51
56
|
) => any;
|
|
57
|
+
renderReadonly?: (
|
|
58
|
+
options: RenderOptions,
|
|
59
|
+
params: RenderReadonlyParams,
|
|
60
|
+
defaultHandler: Recordable,
|
|
61
|
+
) => any;
|
|
52
62
|
renderEdit?: (
|
|
53
63
|
model: Ref<any>,
|
|
54
64
|
options: RenderOptions,
|
|
@@ -191,6 +201,21 @@ const renderBasic = (name: string) => {
|
|
|
191
201
|
<DynamicComponent is={name} {...props} />
|
|
192
202
|
);
|
|
193
203
|
},
|
|
204
|
+
renderReadonly(
|
|
205
|
+
{ props = {}, attrs = {} }: RenderOptions,
|
|
206
|
+
{ data, field }: RenderReadonlyParams,
|
|
207
|
+
) {
|
|
208
|
+
return field ? (
|
|
209
|
+
<DynamicComponent
|
|
210
|
+
is={name}
|
|
211
|
+
v-model:value={data[field]}
|
|
212
|
+
{...attrs}
|
|
213
|
+
{...merge({}, antDefaultProps[name], { disabled: true }, props)}
|
|
214
|
+
/>
|
|
215
|
+
) : (
|
|
216
|
+
<DynamicComponent is={name} {...merge({}, { disabled: true }, props)} />
|
|
217
|
+
);
|
|
218
|
+
},
|
|
194
219
|
renderEdit(
|
|
195
220
|
model: Ref<any>,
|
|
196
221
|
{ props = antDefaultProps[name] ?? {}, attrs = {}, events = {} }: RenderOptions,
|
|
@@ -516,6 +541,15 @@ const renders: RenderFactory = {
|
|
|
516
541
|
/>
|
|
517
542
|
) : null;
|
|
518
543
|
},
|
|
544
|
+
renderReadonly({ props = {}, options }: RenderOptions, { data, field }: RenderReadonlyParams) {
|
|
545
|
+
return valued(field) ? (
|
|
546
|
+
<RadioGroup
|
|
547
|
+
v-model:value={data[field!]}
|
|
548
|
+
{...merge({}, { disabled: true }, props)}
|
|
549
|
+
options={props.options ?? options ?? []}
|
|
550
|
+
/>
|
|
551
|
+
) : null;
|
|
552
|
+
},
|
|
519
553
|
},
|
|
520
554
|
$autoComplete: {
|
|
521
555
|
renderItemContent(
|
|
@@ -559,6 +593,11 @@ const renders: RenderFactory = {
|
|
|
559
593
|
/>
|
|
560
594
|
) : null;
|
|
561
595
|
},
|
|
596
|
+
renderReadonly({ props = {} }: RenderOptions, { data, field }: RenderReadonlyParams) {
|
|
597
|
+
return valued(field) ? (
|
|
598
|
+
<Switch v-model:checked={data[field!]} {...merge({}, { disabled: true }, props)} />
|
|
599
|
+
) : null;
|
|
600
|
+
},
|
|
562
601
|
},
|
|
563
602
|
$checkbox: {
|
|
564
603
|
renderItemContent(
|
|
@@ -588,6 +627,15 @@ const renders: RenderFactory = {
|
|
|
588
627
|
/>
|
|
589
628
|
) : null;
|
|
590
629
|
},
|
|
630
|
+
renderReadonly({ props = {}, options }: RenderOptions, { data, field }: RenderReadonlyParams) {
|
|
631
|
+
return valued(field) ? (
|
|
632
|
+
<CheckboxGroup
|
|
633
|
+
v-model:value={data[field!]}
|
|
634
|
+
{...merge({}, { disabled: true }, props)}
|
|
635
|
+
options={props.options ?? options ?? []}
|
|
636
|
+
/>
|
|
637
|
+
) : null;
|
|
638
|
+
},
|
|
591
639
|
},
|
|
592
640
|
$paragraph: {
|
|
593
641
|
renderDefault({ props = {} }: RenderOptions, { row, field }: RenderTableParams) {
|
|
@@ -690,7 +738,7 @@ const renders: RenderFactory = {
|
|
|
690
738
|
};
|
|
691
739
|
export const addRender = (
|
|
692
740
|
name: string,
|
|
693
|
-
{ renderItemContent, renderDefault, renderEdit }: RenderWorkshop,
|
|
741
|
+
{ renderItemContent, renderDefault, renderReadonly, renderEdit }: RenderWorkshop,
|
|
694
742
|
) => {
|
|
695
743
|
if (renders.hasOwnProperty(name)) {
|
|
696
744
|
console.warn(`render ${name} already exists, you are trying to override it`);
|
|
@@ -698,6 +746,7 @@ export const addRender = (
|
|
|
698
746
|
renders[name] = {
|
|
699
747
|
renderItemContent,
|
|
700
748
|
renderDefault,
|
|
749
|
+
renderReadonly,
|
|
701
750
|
renderEdit,
|
|
702
751
|
};
|
|
703
752
|
};
|