@xiaohaih/json-form-vant 0.0.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/CHANGELOG.md +9 -0
- package/README.md +807 -0
- package/TODO.md +36 -0
- package/components/area/index.ts +6 -0
- package/components/area/index.vue +120 -0
- package/components/area/types.ts +84 -0
- package/components/cascader/index.ts +6 -0
- package/components/cascader/index.vue +146 -0
- package/components/cascader/types.ts +75 -0
- package/components/checkbox/index.ts +6 -0
- package/components/checkbox/index.vue +59 -0
- package/components/checkbox/types.ts +54 -0
- package/components/checkbox-group/index.ts +6 -0
- package/components/checkbox-group/index.vue +67 -0
- package/components/checkbox-group/types.ts +63 -0
- package/components/component-definition/components.ts +29 -0
- package/components/component-definition/definition.ts +25 -0
- package/components/component-definition/index.ts +4 -0
- package/components/custom-render/index.ts +6 -0
- package/components/custom-render/index.vue +66 -0
- package/components/custom-render/types.ts +43 -0
- package/components/date-picker/index.ts +6 -0
- package/components/date-picker/index.vue +130 -0
- package/components/date-picker/types.ts +91 -0
- package/components/date-time-picker-group/index.ts +6 -0
- package/components/date-time-picker-group/index.vue +158 -0
- package/components/date-time-picker-group/types.ts +115 -0
- package/components/datetime-picker/index.ts +6 -0
- package/components/datetime-picker/index.vue +128 -0
- package/components/datetime-picker/types.ts +78 -0
- package/components/dynamic-group/index.ts +10 -0
- package/components/dynamic-group/index.vue +140 -0
- package/components/dynamic-group/types.ts +68 -0
- package/components/group/assist.ts +99 -0
- package/components/group/index.ts +7 -0
- package/components/group/index.vue +117 -0
- package/components/group/types.ts +57 -0
- package/components/group/virtual-group.vue +38 -0
- package/components/index.ts +10 -0
- package/components/input/index.ts +6 -0
- package/components/input/index.vue +83 -0
- package/components/input/types.ts +43 -0
- package/components/input-slot/index.ts +6 -0
- package/components/input-slot/index.vue +148 -0
- package/components/input-slot/types.ts +34 -0
- package/components/number-keyboard/index.ts +6 -0
- package/components/number-keyboard/index.vue +81 -0
- package/components/number-keyboard/types.ts +57 -0
- package/components/password-input/index.ts +6 -0
- package/components/password-input/index.vue +103 -0
- package/components/password-input/types.ts +64 -0
- package/components/picker/index.ts +6 -0
- package/components/picker/index.vue +136 -0
- package/components/picker/types.ts +94 -0
- package/components/radio/index.ts +6 -0
- package/components/radio/index.vue +68 -0
- package/components/radio/types.ts +58 -0
- package/components/radio-group/index.ts +6 -0
- package/components/radio-group/index.vue +74 -0
- package/components/radio-group/types.ts +65 -0
- package/components/rate/index.ts +6 -0
- package/components/rate/index.vue +63 -0
- package/components/rate/types.ts +47 -0
- package/components/share.ts +78 -0
- package/components/signature/index.ts +6 -0
- package/components/signature/index.vue +65 -0
- package/components/signature/instance.vue +161 -0
- package/components/signature/types.ts +79 -0
- package/components/slider/index.ts +6 -0
- package/components/slider/index.vue +63 -0
- package/components/slider/types.ts +53 -0
- package/components/stepper/index.ts +6 -0
- package/components/stepper/index.vue +62 -0
- package/components/stepper/types.ts +47 -0
- package/components/switch/index.ts +6 -0
- package/components/switch/index.vue +61 -0
- package/components/switch/types.ts +51 -0
- package/components/time-picker/index.ts +6 -0
- package/components/time-picker/index.vue +130 -0
- package/components/time-picker/types.ts +91 -0
- package/components/tree-select/index.ts +6 -0
- package/components/tree-select/index.vue +160 -0
- package/components/tree-select/types.ts +77 -0
- package/components/upload/index.ts +6 -0
- package/components/upload/index.vue +109 -0
- package/components/upload/types.ts +85 -0
- package/components/use.ts +45 -0
- package/components/utils.ts +52 -0
- package/components/wrapper/index.ts +6 -0
- package/components/wrapper/index.vue +117 -0
- package/components/wrapper/types.ts +94 -0
- package/dist/components/area/index.d.ts +5 -0
- package/dist/components/area/index.vue.d.ts +1843 -0
- package/dist/components/area/types.d.ts +1434 -0
- package/dist/components/cascader/index.d.ts +5 -0
- package/dist/components/cascader/index.vue.d.ts +2467 -0
- package/dist/components/cascader/types.d.ts +1419 -0
- package/dist/components/checkbox/index.d.ts +5 -0
- package/dist/components/checkbox/index.vue.d.ts +1550 -0
- package/dist/components/checkbox/types.d.ts +1313 -0
- package/dist/components/checkbox-group/index.d.ts +5 -0
- package/dist/components/checkbox-group/index.vue.d.ts +1643 -0
- package/dist/components/checkbox-group/types.d.ts +1372 -0
- package/dist/components/component-definition/components.d.ts +30 -0
- package/dist/components/component-definition/index.d.ts +4 -0
- package/dist/components/custom-render/index.d.ts +5 -0
- package/dist/components/custom-render/index.vue.d.ts +1473 -0
- package/dist/components/custom-render/types.d.ts +1175 -0
- package/dist/components/date-picker/index.d.ts +5 -0
- package/dist/components/date-picker/index.vue.d.ts +1888 -0
- package/dist/components/date-picker/types.d.ts +1458 -0
- package/dist/components/date-time-picker-group/index.d.ts +5 -0
- package/dist/components/date-time-picker-group/index.vue.d.ts +2181 -0
- package/dist/components/date-time-picker-group/types.d.ts +1549 -0
- package/dist/components/dynamic-group/index.d.ts +5 -0
- package/dist/components/dynamic-group/index.vue.d.ts +457 -0
- package/dist/components/dynamic-group/types.d.ts +403 -0
- package/dist/components/group/assist.d.ts +58 -0
- package/dist/components/group/index.d.ts +6 -0
- package/dist/components/group/index.vue.d.ts +139 -0
- package/dist/components/group/types.d.ts +189 -0
- package/dist/components/group/virtual-group.vue.d.ts +42 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/input/index.d.ts +5 -0
- package/dist/components/input/index.vue.d.ts +2229 -0
- package/dist/components/input/types.d.ts +1258 -0
- package/dist/components/input-slot/index.d.ts +5 -0
- package/dist/components/input-slot/index.vue.d.ts +626 -0
- package/dist/components/input-slot/types.d.ts +311 -0
- package/dist/components/number-keyboard/index.d.ts +5 -0
- package/dist/components/number-keyboard/index.vue.d.ts +1643 -0
- package/dist/components/number-keyboard/types.d.ts +1324 -0
- package/dist/components/password-input/index.d.ts +5 -0
- package/dist/components/password-input/index.vue.d.ts +1715 -0
- package/dist/components/password-input/types.d.ts +1357 -0
- package/dist/components/picker/index.d.ts +5 -0
- package/dist/components/picker/index.vue.d.ts +1868 -0
- package/dist/components/picker/types.d.ts +1466 -0
- package/dist/components/radio/index.d.ts +5 -0
- package/dist/components/radio/index.vue.d.ts +1563 -0
- package/dist/components/radio/types.d.ts +1327 -0
- package/dist/components/radio-group/index.d.ts +5 -0
- package/dist/components/radio-group/index.vue.d.ts +1617 -0
- package/dist/components/radio-group/types.d.ts +1383 -0
- package/dist/components/rate/index.d.ts +5 -0
- package/dist/components/rate/index.vue.d.ts +1557 -0
- package/dist/components/rate/types.d.ts +1281 -0
- package/dist/components/share.d.ts +679 -0
- package/dist/components/signature/index.d.ts +5 -0
- package/dist/components/signature/index.vue.d.ts +3017 -0
- package/dist/components/signature/instance.vue.d.ts +1614 -0
- package/dist/components/signature/types.d.ts +1369 -0
- package/dist/components/slider/index.d.ts +5 -0
- package/dist/components/slider/index.vue.d.ts +1563 -0
- package/dist/components/slider/types.d.ts +1302 -0
- package/dist/components/stepper/index.d.ts +5 -0
- package/dist/components/stepper/index.vue.d.ts +1620 -0
- package/dist/components/stepper/types.d.ts +1281 -0
- package/dist/components/switch/index.d.ts +5 -0
- package/dist/components/switch/index.vue.d.ts +1529 -0
- package/dist/components/switch/types.d.ts +1296 -0
- package/dist/components/time-picker/index.d.ts +5 -0
- package/dist/components/time-picker/index.vue.d.ts +1936 -0
- package/dist/components/time-picker/types.d.ts +1458 -0
- package/dist/components/tree-select/index.d.ts +5 -0
- package/dist/components/tree-select/index.vue.d.ts +1802 -0
- package/dist/components/tree-select/types.d.ts +1411 -0
- package/dist/components/upload/index.d.ts +5 -0
- package/dist/components/upload/index.vue.d.ts +1697 -0
- package/dist/components/upload/types.d.ts +1376 -0
- package/dist/components/use.d.ts +53 -0
- package/dist/components/utils.d.ts +15 -0
- package/dist/components/wrapper/index.d.ts +5 -0
- package/dist/components/wrapper/index.vue.d.ts +1085 -0
- package/dist/components/wrapper/types.d.ts +541 -0
- package/dist/docs/.vitepress/config.d.ts +3 -0
- package/dist/docs/.vitepress/theme/index.d.ts +2 -0
- package/dist/index.cjs.js +5459 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.cjs.min.js +3568 -0
- package/dist/index.cjs.min.js.map +1 -0
- package/dist/index.esm.js +5264 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.esm.min.js +3559 -0
- package/dist/index.esm.min.js.map +1 -0
- package/dist/index.umd.js +5465 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/index.umd.min.js +3573 -0
- package/dist/index.umd.min.js.map +1 -0
- package/dist/src/assist.d.ts +32 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/interface.d.ts +129 -0
- package/dist/src/utils.d.ts +9 -0
- package/dist/src/version.d.ts +2 -0
- package/docs/.vitepress/config.ts +99 -0
- package/docs/.vitepress/theme/index.ts +5 -0
- package/docs/README.md +20 -0
- package/docs/index.md +25 -0
- package/env.d.ts +8 -0
- package/package.json +71 -0
- package/scripts/generate-version.mjs +26 -0
- package/scripts/postinstall.cjs +13 -0
- package/scripts/utils.cjs +67 -0
- package/src/assist.ts +40 -0
- package/src/index.ts +5 -0
- package/src/interface.ts +293 -0
- package/src/utils.ts +22 -0
- package/src/version.ts +2 -0
- package/tsconfig.app.json +41 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +24 -0
- package/tsdown.config.ts +12 -0
- package/vite.config.ts +93 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { emits2obj, PlainProps } from '@xiaohaih/json-form-core';
|
|
2
|
+
import { emits2props, plainProps } from '@xiaohaih/json-form-core';
|
|
3
|
+
import type { Picker as VanPicker, Popup as VanPopup } from 'vant';
|
|
4
|
+
import { Field as VanField } from 'vant';
|
|
5
|
+
import type { ExtractPublicPropTypes, PropType } from 'vue';
|
|
6
|
+
import type { ComponentEmit, ComponentExposed, ComponentProps } from 'vue-component-type-helpers';
|
|
7
|
+
import type { CommonProps, CommonSlots, CommonSlotsProps, ComponentType } from '../share';
|
|
8
|
+
import { commonProps } from '../share';
|
|
9
|
+
|
|
10
|
+
/** 组件传参 - 私有 */
|
|
11
|
+
export function pickerPropsGeneric<Query extends Record<string, any>, OptionQuery extends Record<string, any>>() {
|
|
12
|
+
return {
|
|
13
|
+
...commonProps as CommonProps<Query, OptionQuery>,
|
|
14
|
+
...plainProps as PlainProps<Query, OptionQuery>,
|
|
15
|
+
/** VanPicker 组件的属性 */
|
|
16
|
+
pickerProps: { type: Object as PropType<Partial<ComponentProps<typeof VanPicker>>> },
|
|
17
|
+
/** VanPicker 组件的事件 - 兼容 vue2 版本 */
|
|
18
|
+
pickerOn: { type: Object as PropType<Partial<ReturnType<typeof emits2obj<NonNullable<typeof VanPicker.emits>>>>>, default: () => ({}) },
|
|
19
|
+
/** VanPicker 组件的插槽 */
|
|
20
|
+
pickerSlots: { type: Object as PropType<{
|
|
21
|
+
/** 自定义整个顶部栏的内容 */
|
|
22
|
+
toolbar?: ComponentType<CommonSlotsProps<any, any>>;
|
|
23
|
+
/** 自定义标题内容 */
|
|
24
|
+
title?: ComponentType<CommonSlotsProps<any, any>>;
|
|
25
|
+
/** 自定义确认按钮内容 */
|
|
26
|
+
confirm?: ComponentType<CommonSlotsProps<any, any>>;
|
|
27
|
+
/** 自定义取消按钮内容 */
|
|
28
|
+
cancel?: ComponentType<CommonSlotsProps<any, any>>;
|
|
29
|
+
/** 自定义选项内容 */
|
|
30
|
+
option?: ComponentType<{ option: PickerOption; index: number } & CommonSlotsProps<any, any>>;
|
|
31
|
+
/** 自定义选项上方内容 */
|
|
32
|
+
columnsTop?: ComponentType<CommonSlotsProps<any, any>>;
|
|
33
|
+
/** 自定义选项下方内容 */
|
|
34
|
+
columnsBottom?: ComponentType<CommonSlotsProps<any, any>>;
|
|
35
|
+
/** 自定义空状态内容 */
|
|
36
|
+
empty?: ComponentType<CommonSlotsProps<any, any>>;
|
|
37
|
+
}> },
|
|
38
|
+
/** 是否展示右侧箭头并开启点击反馈 - Field 字段, 调整默认值 */
|
|
39
|
+
isLink: { type: Boolean, default: true },
|
|
40
|
+
/** 点击事件, 当传递了此事件时, 会忽略内部打开弹窗操作 */
|
|
41
|
+
onRowClick: { type: Function as PropType<(option: { open: () => void; close: () => void }, ev: MouseEvent) => void> },
|
|
42
|
+
/** 页面显示时多个值之间的分隔符 @default - */
|
|
43
|
+
separator: { type: String, default: '/' },
|
|
44
|
+
/** 是否显示全路径, 多列不生效 */
|
|
45
|
+
showAllLevels: { type: Boolean, default: true },
|
|
46
|
+
/** 对值进行格式化 - 显示在页面上的值 */
|
|
47
|
+
format: { type: Function as PropType<(option: {
|
|
48
|
+
source: any[];
|
|
49
|
+
value: any[];
|
|
50
|
+
columnsFieldNames: Record<'text' | 'value' | 'children', string>;
|
|
51
|
+
showAllLevels: boolean;
|
|
52
|
+
separator: string;
|
|
53
|
+
}) => any> },
|
|
54
|
+
/** 值触发方式 @default confirm */
|
|
55
|
+
valueTrigger: { type: String as PropType<'change' | 'confirm' | 'cancel'>, default: 'confirm' },
|
|
56
|
+
/** 弹窗组件的属性 */
|
|
57
|
+
popupProps: { type: Object as PropType<Partial<ComponentExposed<typeof VanPopup>>> },
|
|
58
|
+
/** 弹窗组件的事件 - 兼容 vue2 版本 */
|
|
59
|
+
popupOn: { type: Object as PropType<Partial<ReturnType<typeof emits2obj<NonNullable<typeof VanPopup.emits>>>>>, default: () => ({}) },
|
|
60
|
+
} as const;
|
|
61
|
+
}
|
|
62
|
+
/** 组件传参 - 私有 */
|
|
63
|
+
export const pickerPropsPrivate = pickerPropsGeneric();
|
|
64
|
+
/** 组件传参 - 外部调用 */
|
|
65
|
+
export const pickerProps = {
|
|
66
|
+
...VanField.props as unknown as {},
|
|
67
|
+
...pickerPropsPrivate,
|
|
68
|
+
};
|
|
69
|
+
export type PickerProps<Query extends Record<string, any>, OptionQuery extends Record<string, any>> = ExtractPublicPropTypes<ReturnType<typeof pickerPropsGeneric<Query, OptionQuery>>>;
|
|
70
|
+
|
|
71
|
+
/** 组件事件 - 私有 */
|
|
72
|
+
export function pickerEmitsGeneric<T>() {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
75
|
+
/** 组件事件 - 私有 */
|
|
76
|
+
export const pickerEmitsPrivate = pickerEmitsGeneric();
|
|
77
|
+
/** 组件事件 - 外部调用 */
|
|
78
|
+
export const pickerEmits = {
|
|
79
|
+
...VanField.emits,
|
|
80
|
+
...pickerEmitsPrivate,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type PickerEmits<T> = ReturnType<typeof pickerEmitsGeneric<T>>;
|
|
84
|
+
|
|
85
|
+
export interface PickerSlots extends CommonSlots<any> {
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** 选中时的参数 */
|
|
89
|
+
export interface PickerOption {
|
|
90
|
+
columnIndex: number;
|
|
91
|
+
selectedIndexes: number;
|
|
92
|
+
selectedOptions: Record<'text' | 'value', string>;
|
|
93
|
+
selectedValues: string[];
|
|
94
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VanField
|
|
3
|
+
v-if="!hide"
|
|
4
|
+
:name="field" :label="label"
|
|
5
|
+
:disabled="globalDisabled || disabled"
|
|
6
|
+
:readonly="globalReadonly || readonly"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
>
|
|
9
|
+
<template #input>
|
|
10
|
+
<VanRadio
|
|
11
|
+
:name="field" :model-value="checked"
|
|
12
|
+
:disabled="globalDisabled || disabled || globalReadonly || readonly"
|
|
13
|
+
v-bind="radioProps" v-on="radioOn"
|
|
14
|
+
@update:model-value="change"
|
|
15
|
+
>
|
|
16
|
+
<template v-for="(item, slotName) of radioSlots" :key="slotName" #[hyphenate(slotName)]="row">
|
|
17
|
+
<component :is="getNode(item)" v-bind="slotProps" v-bind.prop="row" />
|
|
18
|
+
</template>
|
|
19
|
+
</VanRadio>
|
|
20
|
+
</template>
|
|
21
|
+
<template v-for="(item, slotName) of slots" :key="slotName" #[hyphenate(slotName)]="row">
|
|
22
|
+
<component :is="getNode(item)" v-bind="slotProps" v-bind.prop="row" />
|
|
23
|
+
</template>
|
|
24
|
+
</VanField>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts">
|
|
28
|
+
import { getNode, hyphenate, usePlain } from '@xiaohaih/json-form-core';
|
|
29
|
+
import { Field as VanField, Radio as VanRadio, RadioGroup as VanRadioGroup } from 'vant';
|
|
30
|
+
import type { SlotsType } from 'vue';
|
|
31
|
+
import { computed, defineComponent } from 'vue';
|
|
32
|
+
import { pick } from '../../src/utils';
|
|
33
|
+
import { useCommonSetup, useTempChecked } from '../use';
|
|
34
|
+
import type { RadioSlots } from './types';
|
|
35
|
+
import { radioEmitsPrivate as emits, radioPropsPrivate as props } from './types';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @file 单选框
|
|
39
|
+
*/
|
|
40
|
+
export default defineComponent({
|
|
41
|
+
name: 'HRadio',
|
|
42
|
+
components: { VanField, VanRadio, VanRadioGroup },
|
|
43
|
+
inheritAttrs: false,
|
|
44
|
+
props,
|
|
45
|
+
emits,
|
|
46
|
+
slots: Object as SlotsType<RadioSlots>,
|
|
47
|
+
setup(props, ctx) {
|
|
48
|
+
const plain = usePlain(props);
|
|
49
|
+
const { slotProps } = useCommonSetup(props, ctx, plain);
|
|
50
|
+
|
|
51
|
+
/** 重写 change 事件 */
|
|
52
|
+
function change(value: string) {
|
|
53
|
+
props.cancelable ? plain.change(plain.checked.value === value ? undefined : value) : plain.change(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
hyphenate,
|
|
58
|
+
getNode,
|
|
59
|
+
...plain,
|
|
60
|
+
slotProps,
|
|
61
|
+
change,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style lang="scss" scoped>
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { emits2obj, PlainProps } from '@xiaohaih/json-form-core';
|
|
2
|
+
import { emits2props, plainProps } from '@xiaohaih/json-form-core';
|
|
3
|
+
import type { Radio, RadioProps as VantRadioProps } from 'vant';
|
|
4
|
+
import { Field as VanField, Radio as VanRadio } from 'vant';
|
|
5
|
+
import type { ExtractPublicPropTypes, PropType } from 'vue';
|
|
6
|
+
import { camelize } from 'vue';
|
|
7
|
+
import type { ComponentEmit, ComponentExposed, ComponentProps } from 'vue-component-type-helpers';
|
|
8
|
+
import type { CommonProps, CommonSlots, CommonSlotsProps, ComponentType } from '../share';
|
|
9
|
+
import { commonProps } from '../share';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/** 组件传参 - 私有 */
|
|
13
|
+
export function radioPropsGeneric<Query extends Record<string, any>, OptionQuery extends Record<string, any>>() {
|
|
14
|
+
return {
|
|
15
|
+
...commonProps as CommonProps<Query, OptionQuery>,
|
|
16
|
+
...plainProps as PlainProps<Query, OptionQuery>,
|
|
17
|
+
/** 输入框左侧文本 */
|
|
18
|
+
label: { type: String },
|
|
19
|
+
/** VanRadio 组件的属性 */
|
|
20
|
+
radioProps: { type: Object as PropType<Partial<ComponentProps<typeof VanRadio>>> },
|
|
21
|
+
/** VanRadio 组件的事件 - 兼容 vue2 版本 */
|
|
22
|
+
radioOn: { type: Object as PropType<Partial<ReturnType<typeof emits2obj<NonNullable<typeof VanRadio.emits>>>>>, default: () => ({}) },
|
|
23
|
+
/** VanRadio 组件的插槽 */
|
|
24
|
+
radioSlots: { type: Object as PropType<{
|
|
25
|
+
/** 自定义文本 */
|
|
26
|
+
default?: ComponentType<{ checked: boolean; disabled: boolean } & CommonSlotsProps<any, any>>;
|
|
27
|
+
/** 自定义图标 */
|
|
28
|
+
icon?: ComponentType<{ checked: boolean; disabled: boolean } & CommonSlotsProps<any, any>>;
|
|
29
|
+
}> },
|
|
30
|
+
/** 是否可取消选中 */
|
|
31
|
+
cancelable: { type: Boolean, default: true },
|
|
32
|
+
} as const;
|
|
33
|
+
}
|
|
34
|
+
/** 组件传参 - 私有 */
|
|
35
|
+
export const radioPropsPrivate = radioPropsGeneric();
|
|
36
|
+
/** 组件传参 - 外部调用 */
|
|
37
|
+
export const radioProps = {
|
|
38
|
+
...VanField.props as unknown as {},
|
|
39
|
+
...radioPropsPrivate,
|
|
40
|
+
};
|
|
41
|
+
export type RadioProps<Query extends Record<string, any>, OptionQuery extends Record<string, any>> = ExtractPublicPropTypes<ReturnType<typeof radioPropsGeneric<Query, OptionQuery>>>;
|
|
42
|
+
|
|
43
|
+
/** 组件事件 - 私有 */
|
|
44
|
+
export function radioEmitsGeneric<T>() {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
/** 组件事件 - 私有 */
|
|
48
|
+
export const radioEmitsPrivate = radioEmitsGeneric();
|
|
49
|
+
/** 组件事件 - 外部调用 */
|
|
50
|
+
export const radioEmits = {
|
|
51
|
+
...VanField.emits,
|
|
52
|
+
...radioEmitsPrivate,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type RadioEmits<T> = ReturnType<typeof radioEmitsGeneric<T>>;
|
|
56
|
+
|
|
57
|
+
export interface RadioSlots extends CommonSlots<any> {
|
|
58
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VanField
|
|
3
|
+
v-if="!hide"
|
|
4
|
+
:name="field" :label="label"
|
|
5
|
+
:model-value="(checked as string)"
|
|
6
|
+
:disabled="globalDisabled || disabled"
|
|
7
|
+
:readonly="globalReadonly || readonly"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
>
|
|
10
|
+
<template #input>
|
|
11
|
+
<VanRadioGroup
|
|
12
|
+
:name="field" :model-value="checked"
|
|
13
|
+
:disabled="globalDisabled || disabled || globalReadonly || readonly"
|
|
14
|
+
v-bind="radioGroupProps" v-on="radioGroupOn"
|
|
15
|
+
@update:model-value="change"
|
|
16
|
+
>
|
|
17
|
+
<template v-for="item of finalOption" :key="item[valueKey]">
|
|
18
|
+
<VanRadio :name="item[valueKey]" v-bind="radioProps" v-on="radioOn">
|
|
19
|
+
{{ item[labelKey] }}
|
|
20
|
+
<template v-for="(radioItem, slotName) of radioSlots" :key="slotName" #[hyphenate(slotName)]="row">
|
|
21
|
+
<component :is="getNode(radioItem)" v-bind="slotProps" :item="item" v-bind.prop="row" />
|
|
22
|
+
</template>
|
|
23
|
+
</VanRadio>
|
|
24
|
+
</template>
|
|
25
|
+
</VanRadioGroup>
|
|
26
|
+
</template>
|
|
27
|
+
<template v-for="(item, slotName) of slots" :key="slotName" #[hyphenate(slotName)]="row">
|
|
28
|
+
<component :is="getNode(item)" v-bind="slotProps" v-bind.prop="row" />
|
|
29
|
+
</template>
|
|
30
|
+
</VanField>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
import { getNode, hyphenate, usePlain } from '@xiaohaih/json-form-core';
|
|
35
|
+
import { Field as VanField, Radio as VanRadio, RadioGroup as VanRadioGroup } from 'vant';
|
|
36
|
+
import type { SlotsType } from 'vue';
|
|
37
|
+
import { computed, defineComponent } from 'vue';
|
|
38
|
+
import { pick } from '../../src/utils';
|
|
39
|
+
import { useCommonSetup, useTempChecked } from '../use';
|
|
40
|
+
import type { RadioGroupSlots } from './types';
|
|
41
|
+
import { radioGroupEmitsPrivate as emits, radioGroupPropsPrivate as props } from './types';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @file 单选框组
|
|
45
|
+
*/
|
|
46
|
+
export default defineComponent({
|
|
47
|
+
name: 'HRadioGroup',
|
|
48
|
+
components: { VanField, VanRadio, VanRadioGroup },
|
|
49
|
+
inheritAttrs: false,
|
|
50
|
+
props,
|
|
51
|
+
emits,
|
|
52
|
+
slots: Object as SlotsType<RadioGroupSlots>,
|
|
53
|
+
setup(props, ctx) {
|
|
54
|
+
const plain = usePlain(props);
|
|
55
|
+
const { slotProps } = useCommonSetup(props, ctx, plain);
|
|
56
|
+
|
|
57
|
+
/** 重写 change 事件 */
|
|
58
|
+
function change(value: string) {
|
|
59
|
+
props.cancelable ? plain.change(plain.checked.value === value ? undefined : value) : plain.change(value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
hyphenate,
|
|
64
|
+
getNode,
|
|
65
|
+
...plain,
|
|
66
|
+
slotProps,
|
|
67
|
+
change,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style lang="scss" scoped>
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { emits2obj, PlainProps } from '@xiaohaih/json-form-core';
|
|
2
|
+
import { emits2props, plainProps } from '@xiaohaih/json-form-core';
|
|
3
|
+
import type { Radio as VanRadio } from 'vant';
|
|
4
|
+
import { Field as VanField, RadioGroup as VanRadioGroup } from 'vant';
|
|
5
|
+
import type { ExtractPublicPropTypes, PropType } from 'vue';
|
|
6
|
+
import { camelize } from 'vue';
|
|
7
|
+
import type { ComponentEmit, ComponentExposed, ComponentProps } from 'vue-component-type-helpers';
|
|
8
|
+
import type { CommonProps, CommonSlots, CommonSlotsProps, ComponentType } from '../share';
|
|
9
|
+
import { commonProps } from '../share';
|
|
10
|
+
|
|
11
|
+
/** 组件传参 - 私有 */
|
|
12
|
+
export function radioGroupPropsGeneric<Query extends Record<string, any>, OptionQuery extends Record<string, any>>() {
|
|
13
|
+
return {
|
|
14
|
+
...commonProps as CommonProps<Query, OptionQuery>,
|
|
15
|
+
...plainProps as PlainProps<Query, OptionQuery>,
|
|
16
|
+
/** 输入框左侧文本 */
|
|
17
|
+
label: { type: String },
|
|
18
|
+
/** VanRadioGroup 组件的属性 */
|
|
19
|
+
radioGroupProps: { type: Object as PropType<Partial<ComponentProps<typeof VanRadioGroup>>> },
|
|
20
|
+
/** VanRadioGroup 组件的事件 - 兼容 vue2 版本 */
|
|
21
|
+
radioGroupOn: { type: Object as PropType<Partial<ReturnType<typeof emits2obj<NonNullable<typeof VanRadioGroup.emits>>>>>, default: () => ({}) },
|
|
22
|
+
/** 显示的标签 */
|
|
23
|
+
labelKey: { type: String, default: 'label' },
|
|
24
|
+
/** 提交的值 */
|
|
25
|
+
valueKey: { type: String, default: 'value' },
|
|
26
|
+
/** 是否可取消选中 */
|
|
27
|
+
cancelable: { type: Boolean },
|
|
28
|
+
/** VanRadio 组件的属性 */
|
|
29
|
+
radioProps: { type: Object as PropType<Partial<ComponentProps<typeof VanRadio>>> },
|
|
30
|
+
/** VanRadio 组件的事件 - 兼容 vue2 版本 */
|
|
31
|
+
radioOn: { type: Object as PropType<Partial<ReturnType<typeof emits2obj<NonNullable<typeof VanRadio.emits>>>>>, default: () => ({}) },
|
|
32
|
+
/** VanRadio 组件的插槽 */
|
|
33
|
+
radioSlots: { type: Object as PropType<{
|
|
34
|
+
/** 自定义文本 */
|
|
35
|
+
default?: ComponentType<{ checked: boolean; disabled: boolean; item: any } & CommonSlotsProps<any, any>>;
|
|
36
|
+
/** 自定义图标 */
|
|
37
|
+
icon?: ComponentType<{ checked: boolean; disabled: boolean; item: any } & CommonSlotsProps<any, any>>;
|
|
38
|
+
}> },
|
|
39
|
+
} as const;
|
|
40
|
+
}
|
|
41
|
+
/** 组件传参 - 私有 */
|
|
42
|
+
export const radioGroupPropsPrivate = radioGroupPropsGeneric();
|
|
43
|
+
/** 组件传参 - 外部调用 */
|
|
44
|
+
export const radioGroupProps = {
|
|
45
|
+
...VanField.props as unknown as {},
|
|
46
|
+
...radioGroupPropsPrivate,
|
|
47
|
+
};
|
|
48
|
+
export type RadioGroupProps<Query extends Record<string, any>, OptionQuery extends Record<string, any>> = ExtractPublicPropTypes<ReturnType<typeof radioGroupPropsGeneric<Query, OptionQuery>>>;
|
|
49
|
+
|
|
50
|
+
/** 组件事件 - 私有 */
|
|
51
|
+
export function radioGroupEmitsGeneric<T>() {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
/** 组件事件 - 私有 */
|
|
55
|
+
export const radioGroupEmitsPrivate = radioGroupEmitsGeneric();
|
|
56
|
+
/** 组件事件 - 外部调用 */
|
|
57
|
+
export const radioGroupEmits = {
|
|
58
|
+
...VanField.emits,
|
|
59
|
+
...radioGroupEmitsPrivate,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type RadioGroupEmits<T> = ReturnType<typeof radioGroupEmitsGeneric<T>>;
|
|
63
|
+
|
|
64
|
+
export interface RadioGroupSlots extends CommonSlots<any> {
|
|
65
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VanField
|
|
3
|
+
v-if="!hide"
|
|
4
|
+
:name="field"
|
|
5
|
+
:model-value="checked"
|
|
6
|
+
:disabled="globalDisabled || disabled"
|
|
7
|
+
:readonly="globalReadonly || readonly"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
>
|
|
10
|
+
<template #input>
|
|
11
|
+
<VanRate
|
|
12
|
+
:disabled="globalDisabled || disabled"
|
|
13
|
+
:readonly="globalReadonly || readonly"
|
|
14
|
+
:model-value="(checked as number)"
|
|
15
|
+
v-bind="rateProps" v-on="rateOn"
|
|
16
|
+
@update:model-value="change"
|
|
17
|
+
>
|
|
18
|
+
<template v-for="(item, slotName) of rateSlots" :key="slotName" #[hyphenate(slotName)]="row">
|
|
19
|
+
<component :is="getNode(item)" v-bind="slotProps" v-bind.prop="row" />
|
|
20
|
+
</template>
|
|
21
|
+
</VanRate>
|
|
22
|
+
</template>
|
|
23
|
+
<template v-for="(item, slotName) of slots" :key="slotName" #[hyphenate(slotName)]="row">
|
|
24
|
+
<component :is="getNode(item)" v-bind="slotProps" v-bind.prop="row" />
|
|
25
|
+
</template>
|
|
26
|
+
</VanField>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import { getNode, hyphenate, usePlain } from '@xiaohaih/json-form-core';
|
|
31
|
+
import { Field as VanField, Rate as VanRate } from 'vant';
|
|
32
|
+
import type { SlotsType } from 'vue';
|
|
33
|
+
import { defineComponent } from 'vue';
|
|
34
|
+
import { useCommonSetup } from '../use';
|
|
35
|
+
import type { RateSlots } from './types';
|
|
36
|
+
import { rateEmitsPrivate as emits, ratePropsPrivate as props } from './types';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @file 评分
|
|
40
|
+
*/
|
|
41
|
+
export default defineComponent({
|
|
42
|
+
name: 'HRate',
|
|
43
|
+
components: { VanField, VanRate },
|
|
44
|
+
inheritAttrs: false,
|
|
45
|
+
props,
|
|
46
|
+
emits,
|
|
47
|
+
slots: Object as SlotsType<RateSlots>,
|
|
48
|
+
setup(props, ctx) {
|
|
49
|
+
const plain = usePlain(props);
|
|
50
|
+
const { slotProps } = useCommonSetup(props, ctx, plain);
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
hyphenate,
|
|
54
|
+
getNode,
|
|
55
|
+
...plain,
|
|
56
|
+
slotProps,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style lang="scss" scoped>
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { emits2obj, PlainProps } from '@xiaohaih/json-form-core';
|
|
2
|
+
import { emits2props, plainProps } from '@xiaohaih/json-form-core';
|
|
3
|
+
import { Field as VanField, Rate as VanRate } from 'vant';
|
|
4
|
+
import type { ExtractPublicPropTypes, PropType } from 'vue';
|
|
5
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
6
|
+
import type { CommonProps, CommonSlots, CommonSlotsProps, ComponentType } from '../share';
|
|
7
|
+
import { commonProps } from '../share';
|
|
8
|
+
|
|
9
|
+
/** 组件传参 - 私有 */
|
|
10
|
+
export function ratePropsGeneric<Query extends Record<string, any>, OptionQuery extends Record<string, any>>() {
|
|
11
|
+
return {
|
|
12
|
+
...commonProps as CommonProps<Query, OptionQuery>,
|
|
13
|
+
...plainProps as PlainProps<Query, OptionQuery>,
|
|
14
|
+
/** VanRate 组件的属性 */
|
|
15
|
+
rateProps: { type: Object as PropType<Partial<ComponentProps<typeof VanRate>>> },
|
|
16
|
+
/** VanRate 组件的事件 - 兼容 vue2 版本 */
|
|
17
|
+
rateOn: { type: Object as PropType<Partial<ReturnType<typeof emits2obj<NonNullable<typeof VanRate.emits>>>>>, default: () => ({}) },
|
|
18
|
+
/** VanRate 组件的插槽 */
|
|
19
|
+
rateSlots: { type: Object as PropType<{
|
|
20
|
+
}> },
|
|
21
|
+
} as const;
|
|
22
|
+
}
|
|
23
|
+
/** 组件传参 - 私有 */
|
|
24
|
+
export const ratePropsPrivate = ratePropsGeneric();
|
|
25
|
+
/** 组件传参 - 外部调用 */
|
|
26
|
+
export const rateProps = {
|
|
27
|
+
...VanField.props as unknown as {},
|
|
28
|
+
...ratePropsPrivate,
|
|
29
|
+
};
|
|
30
|
+
export type RateProps<Query extends Record<string, any>, OptionQuery extends Record<string, any>> = ExtractPublicPropTypes<ReturnType<typeof ratePropsGeneric<Query, OptionQuery>>>;
|
|
31
|
+
|
|
32
|
+
/** 组件事件 - 私有 */
|
|
33
|
+
export function rateEmitsGeneric<T>() {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
/** 组件事件 - 私有 */
|
|
37
|
+
export const rateEmitsPrivate = rateEmitsGeneric();
|
|
38
|
+
/** 组件事件 - 外部调用 */
|
|
39
|
+
export const rateEmits = {
|
|
40
|
+
...VanField.emits,
|
|
41
|
+
...rateEmitsPrivate,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type RateEmits<T> = ReturnType<typeof rateEmitsGeneric<T>>;
|
|
45
|
+
|
|
46
|
+
export interface RateSlots extends CommonSlots<any> {
|
|
47
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Obj2Props, usePlain } from '@xiaohaih/json-form-core';
|
|
2
|
+
import { Field as VanField } from 'vant';
|
|
3
|
+
import type { AsyncComponentOptions, Component, ComponentOptions, ComponentPublicInstance, DefineComponent, ExtractPropTypes, PropType, Raw, VNode } from 'vue';
|
|
4
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
5
|
+
|
|
6
|
+
export interface SlotQuery {
|
|
7
|
+
/** 是否禁用 */
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
/** 绑定的值 */
|
|
10
|
+
modelValue: any;
|
|
11
|
+
/** 内部设置的类名 */
|
|
12
|
+
class: string;
|
|
13
|
+
/** 组件内部信息 */
|
|
14
|
+
extraOption: {
|
|
15
|
+
/** 表单信息值 */
|
|
16
|
+
query: Record<string, any>;
|
|
17
|
+
/** 触发外部搜索事件 */
|
|
18
|
+
search: () => void;
|
|
19
|
+
/** 触发内部搜索事件 */
|
|
20
|
+
insideSearch: () => void;
|
|
21
|
+
};
|
|
22
|
+
[index: string]: string | number | boolean | ((...args: any[]) => any) | Record<string, any> | any[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const vantFieldProps = VanField.props as unknown as Obj2Props<ComponentProps<typeof VanField>>;
|
|
26
|
+
/** 公共属性 - 泛型 */
|
|
27
|
+
export function commonPropsGeneric<Query extends Record<string, any>, OptionQuery = Record<string, any>>() {
|
|
28
|
+
return {
|
|
29
|
+
/** field 组件属性 */
|
|
30
|
+
...{} as typeof vantFieldProps,
|
|
31
|
+
/** 是否禁用 */
|
|
32
|
+
disabled: { type: Boolean as PropType<boolean>, default: undefined },
|
|
33
|
+
/** 是否只读 */
|
|
34
|
+
readonly: { type: Boolean as PropType<boolean>, default: undefined },
|
|
35
|
+
/** 是否隐藏表单项 */
|
|
36
|
+
hide: { type: Boolean as PropType<boolean>, default: undefined },
|
|
37
|
+
/** field 组件自身的插槽 */
|
|
38
|
+
slots: { type: Object as PropType<CommonSlots> },
|
|
39
|
+
} as const;
|
|
40
|
+
}
|
|
41
|
+
/** 公共属性 */
|
|
42
|
+
export const commonProps = commonPropsGeneric();
|
|
43
|
+
export type CommonProps<Query extends Record<string, any>, OptionQuery> = ReturnType<typeof commonPropsGeneric<Query, OptionQuery>>;
|
|
44
|
+
|
|
45
|
+
/** 通用插槽 */
|
|
46
|
+
export interface CommonSlots<T = Record<string, any>> {
|
|
47
|
+
/** 自定义输入框左侧文本 */
|
|
48
|
+
label?: ComponentType<CommonSlotsProps<any, any> & T>;
|
|
49
|
+
/** 自定义输入框,使用此插槽后,与输入框相关的属性和事件将失效 */
|
|
50
|
+
input?: ComponentType<CommonSlotsProps<any, any> & T>;
|
|
51
|
+
/** 自定义输入框头部图标 */
|
|
52
|
+
leftIcon?: ComponentType<CommonSlotsProps<any, any> & T>;
|
|
53
|
+
/** 自定义输入框尾部图标 */
|
|
54
|
+
rightIcon?: ComponentType<CommonSlotsProps<any, any> & T>;
|
|
55
|
+
/** 自定义输入框尾部按钮 */
|
|
56
|
+
button?: ComponentType<CommonSlotsProps<any, any> & T>;
|
|
57
|
+
/** 自定义底部错误提示文案 */
|
|
58
|
+
errorMessage?: ComponentType<{ message: string } & CommonSlotsProps<any, any> & T>;
|
|
59
|
+
/** 自定义输入框最右侧的额外内容 */
|
|
60
|
+
extra?: ComponentType<CommonSlotsProps<any, any> & T>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 插槽通用参数 */
|
|
64
|
+
export interface CommonSlotsProps<Query extends Record<string, any>, Options extends Record<string, any>> {
|
|
65
|
+
props: Record<string, any>;
|
|
66
|
+
plain: ReturnType<typeof usePlain<Query, Options>>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 支持的组件格式 */
|
|
70
|
+
export type ComponentType<Props = Record<string, any>, Context = any>
|
|
71
|
+
= | DefineComponent | Raw<DefineComponent>
|
|
72
|
+
| ((props: Props, ctx?: Context) => any)
|
|
73
|
+
| ComponentOptions
|
|
74
|
+
| ComponentPublicInstance
|
|
75
|
+
| (() => Promise<Component | { default: Component }>)
|
|
76
|
+
| AsyncComponentOptions
|
|
77
|
+
| string | number
|
|
78
|
+
| { [key: string]: any };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VanField
|
|
3
|
+
v-if="renderField && !hide"
|
|
4
|
+
:name="field"
|
|
5
|
+
:disabled="finalDisabled"
|
|
6
|
+
:readonly="finalReadonly"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
>
|
|
9
|
+
<template #input>
|
|
10
|
+
<HSignaturePure v-bind="allAttrs" @load="load" />
|
|
11
|
+
</template>
|
|
12
|
+
<template v-for="(item, slotName) of slots" :key="slotName" #[hyphenate(slotName)]="row">
|
|
13
|
+
<component :is="getNode(item)" v-if="plain" :plain="plain" :props="$props" v-bind="row" />
|
|
14
|
+
</template>
|
|
15
|
+
</VanField>
|
|
16
|
+
<HSignaturePure v-else-if="!hide" v-bind="allAttrs" />
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import type { usePlain } from '@xiaohaih/json-form-core';
|
|
21
|
+
import { getNode, getProvideValue, hyphenate } from '@xiaohaih/json-form-core';
|
|
22
|
+
import type { SignatureInstance } from 'vant';
|
|
23
|
+
import { Field as VanField, Signature as VanSignature } from 'vant';
|
|
24
|
+
import type { SlotsType } from 'vue';
|
|
25
|
+
import { computed, defineComponent, inject, nextTick, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from 'vue';
|
|
26
|
+
import { useCommonSetup } from '../use';
|
|
27
|
+
import HSignaturePure from './instance.vue';
|
|
28
|
+
import type { SignatureSlots, SubmitOption } from './types';
|
|
29
|
+
import { signatureEmitsPrivate as emits, signaturePropsPrivate as props } from './types';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @file 签名
|
|
33
|
+
*/
|
|
34
|
+
export default defineComponent({
|
|
35
|
+
name: 'HSignature',
|
|
36
|
+
components: { VanField, VanSignature, HSignaturePure },
|
|
37
|
+
inheritAttrs: false,
|
|
38
|
+
props,
|
|
39
|
+
emits,
|
|
40
|
+
setup(props, ctx) {
|
|
41
|
+
const allAttrs = computed(() => ({ ...props, ...ctx.attrs }));
|
|
42
|
+
const wrapperProvide = getProvideValue();
|
|
43
|
+
const finalDisabled = computed(() => props.disabled || wrapperProvide?.disabled?.value);
|
|
44
|
+
const finalReadonly = computed(() => props.readonly || wrapperProvide?.readonly?.value);
|
|
45
|
+
|
|
46
|
+
const plain = ref<ReturnType<typeof usePlain> | null>(null);
|
|
47
|
+
function load(_plain: ReturnType<typeof usePlain>) {
|
|
48
|
+
plain.value = _plain;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
hyphenate,
|
|
53
|
+
getNode,
|
|
54
|
+
allAttrs,
|
|
55
|
+
finalDisabled,
|
|
56
|
+
finalReadonly,
|
|
57
|
+
plain,
|
|
58
|
+
load,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss" scoped>
|
|
65
|
+
</style>
|