fix(api): use bcrypt directly instead of passlib for compatibility

This commit is contained in:
bwstudio
2026-05-21 22:18:36 +08:00
parent 7f51d200f1
commit 4651781bc3
23511 changed files with 2587254 additions and 8 deletions
+10
View File
@@ -0,0 +1,10 @@
import { RadioGroupProps } from "./radio-group.js";
import { InjectionKey } from "vue";
//#region ../../packages/components/radio/src/constants.d.ts
interface RadioGroupContext extends RadioGroupProps {
changeEvent: (val: RadioGroupProps['modelValue']) => void;
}
declare const radioGroupKey: InjectionKey<RadioGroupContext>;
//#endregion
export { RadioGroupContext, radioGroupKey };
+7
View File
@@ -0,0 +1,7 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region ../../packages/components/radio/src/constants.ts
const radioGroupKey = Symbol("radioGroupKey");
//#endregion
exports.radioGroupKey = radioGroupKey;
//# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
{"version":3,"file":"constants.js","names":[],"sources":["../../../../../../packages/components/radio/src/constants.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\nimport type { RadioGroupProps } from './radio-group'\n\nexport interface RadioGroupContext extends RadioGroupProps {\n changeEvent: (val: RadioGroupProps['modelValue']) => void\n}\n\nexport const radioGroupKey: InjectionKey<RadioGroupContext> =\n Symbol('radioGroupKey')\n"],"mappings":";;AAOA,MAAa,gBACX,OAAO,gBAAgB"}
@@ -0,0 +1,41 @@
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import { RadioPropsBase } from "./radio.js";
import _default from "./radio-button.vue.js";
import * as _$vue from "vue";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/radio/src/radio-button.d.ts
interface RadioButtonProps extends RadioPropsBase {}
/**
* @deprecated Removed after 3.0.0, Use `RadioButtonProps` instead.
*/
declare const radioButtonProps: {
readonly modelValue: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
readonly size: {
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly label: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
readonly value: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
readonly name: EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `RadioButtonProps` instead.
*/
type RadioButtonPropsPublic = ExtractPublicPropTypes<typeof radioButtonProps>;
type RadioButtonInstance = InstanceType<typeof _default> & unknown;
/**
* @description default values for RadioButtonProps
*/
declare const radioButtonPropsDefaults: {
readonly modelValue: undefined;
readonly disabled: undefined;
readonly label: undefined;
readonly value: undefined;
readonly name: undefined;
};
//#endregion
export { RadioButtonInstance, RadioButtonProps, RadioButtonPropsPublic, radioButtonProps, radioButtonPropsDefaults };
+23
View File
@@ -0,0 +1,23 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_runtime = require("../../../utils/vue/props/runtime.js");
const require_radio = require("./radio.js");
//#region ../../packages/components/radio/src/radio-button.ts
/**
* @deprecated Removed after 3.0.0, Use `RadioButtonProps` instead.
*/
const radioButtonProps = require_runtime.buildProps({ ...require_radio.radioPropsBase });
/**
* @description default values for RadioButtonProps
*/
const radioButtonPropsDefaults = {
modelValue: void 0,
disabled: void 0,
label: void 0,
value: void 0,
name: void 0
};
//#endregion
exports.radioButtonProps = radioButtonProps;
exports.radioButtonPropsDefaults = radioButtonPropsDefaults;
//# sourceMappingURL=radio-button.js.map
@@ -0,0 +1 @@
{"version":3,"file":"radio-button.js","names":["buildProps","radioPropsBase"],"sources":["../../../../../../packages/components/radio/src/radio-button.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport { radioPropsBase } from './radio'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { RadioPropsBase } from './radio'\nimport type RadioButton from './radio-button.vue'\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface RadioButtonProps extends RadioPropsBase {}\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioButtonProps` instead.\n */\nexport const radioButtonProps = buildProps({\n ...radioPropsBase,\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioButtonProps` instead.\n */\nexport type RadioButtonPropsPublic = ExtractPublicPropTypes<\n typeof radioButtonProps\n>\nexport type RadioButtonInstance = InstanceType<typeof RadioButton> & unknown\n\n/**\n * @description default values for RadioButtonProps\n */\nexport const radioButtonPropsDefaults = {\n modelValue: undefined,\n disabled: undefined,\n label: undefined,\n value: undefined,\n name: undefined,\n} as const\n"],"mappings":";;;;;;;AAaA,MAAa,mBAAmBA,gBAAAA,WAAW,EACzC,GAAGC,cAAAA,gBACJ,CAAU;;;;AAaX,MAAa,2BAA2B;CACtC,YAAY,KAAA;CACZ,UAAU,KAAA;CACV,OAAO,KAAA;CACP,OAAO,KAAA;CACP,MAAM,KAAA;CACP"}
@@ -0,0 +1,24 @@
import { RadioButtonProps } from "./radio-button.js";
import * as _$vue from "vue";
//#region ../../packages/components/radio/src/radio-button.vue.d.ts
declare var __VLS_1: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_1) => any;
};
declare const __VLS_base: _$vue.DefineComponent<RadioButtonProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<RadioButtonProps> & Readonly<{}>, {
name: string;
label: string | number | boolean;
disabled: boolean;
modelValue: string | number | boolean;
value: string | number | boolean;
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};
//#endregion
export { _default as default };
@@ -0,0 +1,58 @@
require("../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../hooks/use-namespace/index.js");
const require_use_radio = require("./use-radio.js");
const require_radio_button = require("./radio-button.js");
let vue = require("vue");
//#region ../../packages/components/radio/src/radio-button.vue?vue&type=script&setup=true&lang.ts
const _hoisted_1 = [
"value",
"name",
"disabled"
];
var radio_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
name: "ElRadioButton",
__name: "radio-button",
props: require_radio_button.radioButtonProps,
setup(__props) {
const props = __props;
const ns = require_index.useNamespace("radio");
const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = require_use_radio.useRadio(props);
const activeStyle = (0, vue.computed)(() => {
return {
backgroundColor: radioGroup?.fill || "",
borderColor: radioGroup?.fill || "",
boxShadow: radioGroup?.fill ? `-1px 0 0 0 ${radioGroup.fill}` : "",
color: radioGroup?.textColor || ""
};
});
return (_ctx, _cache) => {
return (0, vue.openBlock)(), (0, vue.createElementBlock)("label", { class: (0, vue.normalizeClass)([
(0, vue.unref)(ns).b("button"),
(0, vue.unref)(ns).is("active", (0, vue.unref)(modelValue) === (0, vue.unref)(actualValue)),
(0, vue.unref)(ns).is("disabled", (0, vue.unref)(disabled)),
(0, vue.unref)(ns).is("focus", (0, vue.unref)(focus)),
(0, vue.unref)(ns).bm("button", (0, vue.unref)(size))
]) }, [(0, vue.withDirectives)((0, vue.createElementVNode)("input", {
ref_key: "radioRef",
ref: radioRef,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => (0, vue.isRef)(modelValue) ? modelValue.value = $event : null),
class: (0, vue.normalizeClass)((0, vue.unref)(ns).be("button", "original-radio")),
value: (0, vue.unref)(actualValue),
type: "radio",
name: __props.name || (0, vue.unref)(radioGroup)?.name,
disabled: (0, vue.unref)(disabled),
onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
onClick: _cache[3] || (_cache[3] = (0, vue.withModifiers)(() => {}, ["stop"]))
}, null, 42, _hoisted_1), [[vue.vModelRadio, (0, vue.unref)(modelValue)]]), (0, vue.createElementVNode)("span", {
class: (0, vue.normalizeClass)((0, vue.unref)(ns).be("button", "inner")),
style: (0, vue.normalizeStyle)((0, vue.unref)(modelValue) === (0, vue.unref)(actualValue) ? activeStyle.value : {}),
onKeydown: _cache[4] || (_cache[4] = (0, vue.withModifiers)(() => {}, ["stop"]))
}, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.label), 1)])], 38)], 2);
};
}
});
//#endregion
exports.default = radio_button_vue_vue_type_script_setup_true_lang_default;
//# sourceMappingURL=radio-button.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
{"version":3,"file":"radio-button.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/radio/src/radio-button.vue"],"sourcesContent":["<template>\n <label\n :class=\"[\n ns.b('button'),\n ns.is('active', modelValue === actualValue),\n ns.is('disabled', disabled),\n ns.is('focus', focus),\n ns.bm('button', size),\n ]\"\n >\n <input\n ref=\"radioRef\"\n v-model=\"modelValue\"\n :class=\"ns.be('button', 'original-radio')\"\n :value=\"actualValue\"\n type=\"radio\"\n :name=\"name || radioGroup?.name\"\n :disabled=\"disabled\"\n @focus=\"focus = true\"\n @blur=\"focus = false\"\n @click.stop\n />\n <span\n :class=\"ns.be('button', 'inner')\"\n :style=\"modelValue === actualValue ? activeStyle : {}\"\n @keydown.stop\n >\n <slot>\n {{ label }}\n </slot>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useRadio } from './use-radio'\nimport { radioButtonPropsDefaults } from './radio-button'\n\nimport type { RadioButtonProps } from './radio-button'\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElRadioButton',\n})\n\nconst props = withDefaults(\n defineProps<RadioButtonProps>(),\n radioButtonPropsDefaults\n)\n\nconst ns = useNamespace('radio')\nconst { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } =\n useRadio(props)\n\nconst activeStyle = computed<CSSProperties>(() => {\n return {\n backgroundColor: radioGroup?.fill || '',\n borderColor: radioGroup?.fill || '',\n boxShadow: radioGroup?.fill ? `-1px 0 0 0 ${radioGroup.fill}` : '',\n color: radioGroup?.textColor || '',\n }\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;EA+CA,MAAM,QAAQ;EAKd,MAAM,KAAK,cAAA,aAAa,QAAO;EAC/B,MAAM,EAAE,UAAU,OAAO,MAAM,UAAU,YAAY,YAAY,gBAC/D,kBAAA,SAAS,MAAK;EAEhB,MAAM,eAAA,GAAA,IAAA,gBAA4C;GAChD,OAAO;IACL,iBAAiB,YAAY,QAAQ;IACrC,aAAa,YAAY,QAAQ;IACjC,WAAW,YAAY,OAAO,cAAc,WAAW,SAAS;IAChE,OAAO,YAAY,aAAa;IAClC;IACD;;4DAhCS,SAAA,EA7BL,QAAA,GAAA,IAAA,gBAAK;mBAAU,GAAE,CAAC,EAAC,SAAA;mBAAkB,GAAE,CAAC,GAAE,WAAA,GAAA,IAAA,OAAW,WAAU,MAAA,GAAA,IAAA,OAAK,YAAW,CAAA;mBAAS,GAAE,CAAC,GAAE,aAAA,GAAA,IAAA,OAAa,SAAQ,CAAA;mBAAS,GAAE,CAAC,GAAE,UAAA,GAAA,IAAA,OAAU,MAAK,CAAA;mBAAS,GAAE,CAAC,GAAE,WAAA,GAAA,IAAA,OAAW,KAAI,CAAA;8DAmB3K,SAAA;aAVI;IAAJ,KAAI;8FACK,WAAU,QAAA,SAAA;IAClB,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,GAAE,UAAA,iBAAA,CAAA;IACZ,QAAA,GAAA,IAAA,OAAO,YAAW;IACnB,MAAK;IACJ,MAAM,QAAA,SAAA,GAAA,IAAA,OAAQ,WAAU,EAAE;IAC1B,WAAA,GAAA,IAAA,OAAU,SAAQ;IAClB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,QAAK;IACZ,QAAI,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,QAAK;IACX,SAAK,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,qBAAN,IAAW,CAAA,OAAA,CAAA;+DARF,WAAU,CAAA,CAAA,CAAA,GAAA,GAAA,IAAA,oBAkBd,QAAA;IAPJ,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,GAAE,UAAA,QAAA,CAAA;IACZ,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,WAAU,MAAA,GAAA,IAAA,OAAK,YAAW,GAAG,YAAA,QAAW,EAAA,CAAA;IAC/C,WAAO,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,qBAAR,IAAa,CAAA,OAAA,CAAA;2BAIN,KAAA,QAAA,WAAA,EAAA,QAAA,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,iBADF,QAAA,MAAK,EAAA,EAAA,CAAA,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,EAAA"}
@@ -0,0 +1,10 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region ../../packages/components/radio/src/radio-button.vue
var radio_button_default = require("./radio-button.vue_vue_type_script_setup_true_lang.js").default;
//#endregion
exports.default = radio_button_default;
//# sourceMappingURL=radio-button2.js.map
@@ -0,0 +1 @@
{"version":3,"file":"radio-button2.js","names":[],"sources":["../../../../../../packages/components/radio/src/radio-button.vue"],"sourcesContent":["<template>\n <label\n :class=\"[\n ns.b('button'),\n ns.is('active', modelValue === actualValue),\n ns.is('disabled', disabled),\n ns.is('focus', focus),\n ns.bm('button', size),\n ]\"\n >\n <input\n ref=\"radioRef\"\n v-model=\"modelValue\"\n :class=\"ns.be('button', 'original-radio')\"\n :value=\"actualValue\"\n type=\"radio\"\n :name=\"name || radioGroup?.name\"\n :disabled=\"disabled\"\n @focus=\"focus = true\"\n @blur=\"focus = false\"\n @click.stop\n />\n <span\n :class=\"ns.be('button', 'inner')\"\n :style=\"modelValue === actualValue ? activeStyle : {}\"\n @keydown.stop\n >\n <slot>\n {{ label }}\n </slot>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useRadio } from './use-radio'\nimport { radioButtonPropsDefaults } from './radio-button'\n\nimport type { RadioButtonProps } from './radio-button'\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElRadioButton',\n})\n\nconst props = withDefaults(\n defineProps<RadioButtonProps>(),\n radioButtonPropsDefaults\n)\n\nconst ns = useNamespace('radio')\nconst { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } =\n useRadio(props)\n\nconst activeStyle = computed<CSSProperties>(() => {\n return {\n backgroundColor: radioGroup?.fill || '',\n borderColor: radioGroup?.fill || '',\n boxShadow: radioGroup?.fill ? `-1px 0 0 0 ${radioGroup.fill}` : '',\n color: radioGroup?.textColor || '',\n }\n})\n</script>\n"],"mappings":""}
+117
View File
@@ -0,0 +1,117 @@
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import { ComponentSize } from "../../../constants/size.js";
import _default from "./radio-group.vue.js";
import * as _$vue from "vue";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/radio/src/radio-group.d.ts
type radioOptionProp = {
value?: string;
label?: string;
disabled?: string;
};
declare const radioDefaultProps: Required<radioOptionProp>;
type radioOption = Record<string, any>;
interface RadioGroupProps {
/**
* @description native `id` attribute
*/
id?: string;
/**
* @description the size of radio buttons or bordered radios
*/
size?: ComponentSize;
/**
* @description whether the nesting radios are disabled
*/
disabled?: boolean;
/**
* @description binding value
*/
modelValue?: string | number | boolean;
/**
* @description border and background color when button is active
*/
fill?: string;
/**
* @description font color when button is active
*/
textColor?: string;
/**
* @description native `name` attribute
*/
name?: string;
/**
* @description whether to trigger form validation
*/
validateEvent?: boolean;
/**
* @description radio options
*/
options?: radioOption[];
/**
* @description custom prop names for options
*/
props?: radioOptionProp;
/**
* @description radio type
*/
type?: 'radio' | 'button';
/**
* @description native `aria-label` attribute
*/
ariaLabel?: string;
}
/**
* @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.
*/
declare const radioGroupProps: {
readonly ariaLabel: StringConstructor;
readonly id: EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
readonly size: {
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly modelValue: EpPropFinalized<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown, undefined, boolean>;
readonly fill: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly textColor: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly name: EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
readonly validateEvent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly options: {
readonly type: _$vue.PropType<radioOption[]>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly props: EpPropFinalized<(new (...args: any[]) => radioOptionProp) | (() => radioOptionProp) | (((new (...args: any[]) => radioOptionProp) | (() => radioOptionProp)) | null)[], unknown, unknown, () => Required<radioOptionProp>, boolean>;
readonly type: EpPropFinalized<StringConstructor, "button" | "radio", unknown, "radio", boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.
*/
type RadioGroupPropsPublic = ExtractPublicPropTypes<typeof radioGroupProps>;
declare const radioGroupEmits: {
"update:modelValue": (val: string | number | boolean | undefined) => val is string | number | boolean;
change: (val: string | number | boolean | undefined) => val is string | number | boolean;
};
type RadioGroupEmits = typeof radioGroupEmits;
type RadioGroupInstance = InstanceType<typeof _default> & unknown;
/**
* @description default values for RadioGroupProps
*/
declare const radioGroupPropsDefaults: {
readonly id: undefined;
readonly disabled: undefined;
readonly modelValue: undefined;
readonly fill: "";
readonly textColor: "";
readonly name: undefined;
readonly validateEvent: true;
readonly props: () => Required<radioOptionProp>;
readonly type: "radio";
};
//#endregion
export { RadioGroupEmits, RadioGroupInstance, RadioGroupProps, RadioGroupPropsPublic, radioDefaultProps, radioGroupEmits, radioGroupProps, radioGroupPropsDefaults, radioOption, radioOptionProp };
+106
View File
@@ -0,0 +1,106 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_runtime = require("../../../utils/vue/props/runtime.js");
const require_index = require("../../../hooks/use-size/index.js");
const require_index$1 = require("../../../hooks/use-aria/index.js");
const require_radio = require("./radio.js");
//#region ../../packages/components/radio/src/radio-group.ts
const radioDefaultProps = {
label: "label",
value: "value",
disabled: "disabled"
};
/**
* @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.
*/
const radioGroupProps = require_runtime.buildProps({
/**
* @description native `id` attribute
*/
id: {
type: String,
default: void 0
},
/**
* @description the size of radio buttons or bordered radios
*/
size: require_index.useSizeProp,
/**
* @description whether the nesting radios are disabled
*/
disabled: {
type: Boolean,
default: void 0
},
/**
* @description binding value
*/
modelValue: {
type: [
String,
Number,
Boolean
],
default: void 0
},
/**
* @description border and background color when button is active
*/
fill: {
type: String,
default: ""
},
/**
* @description font color when button is active
*/
textColor: {
type: String,
default: ""
},
/**
* @description native `name` attribute
*/
name: {
type: String,
default: void 0
},
/**
* @description whether to trigger form validation
*/
validateEvent: {
type: Boolean,
default: true
},
options: { type: require_runtime.definePropType(Array) },
props: {
type: require_runtime.definePropType(Object),
default: () => radioDefaultProps
},
type: {
type: String,
values: ["radio", "button"],
default: "radio"
},
...require_index$1.useAriaProps(["ariaLabel"])
});
const radioGroupEmits = require_radio.radioEmits;
/**
* @description default values for RadioGroupProps
*/
const radioGroupPropsDefaults = {
id: void 0,
disabled: void 0,
modelValue: void 0,
fill: "",
textColor: "",
name: void 0,
validateEvent: true,
props: () => radioDefaultProps,
type: "radio"
};
//#endregion
exports.radioDefaultProps = radioDefaultProps;
exports.radioGroupEmits = radioGroupEmits;
exports.radioGroupProps = radioGroupProps;
exports.radioGroupPropsDefaults = radioGroupPropsDefaults;
//# sourceMappingURL=radio-group.js.map
@@ -0,0 +1 @@
{"version":3,"file":"radio-group.js","names":["buildProps","useSizeProp","definePropType","useAriaProps","radioEmits"],"sources":["../../../../../../packages/components/radio/src/radio-group.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { radioEmits } from './radio'\n\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type RadioGroup from './radio-group.vue'\n\nexport type radioOptionProp = {\n value?: string\n label?: string\n disabled?: string\n}\n\nexport const radioDefaultProps: Required<radioOptionProp> = {\n label: 'label',\n value: 'value',\n disabled: 'disabled',\n}\n\nexport type radioOption = Record<string, any>\n\nexport interface RadioGroupProps {\n /**\n * @description native `id` attribute\n */\n id?: string\n /**\n * @description the size of radio buttons or bordered radios\n */\n size?: ComponentSize\n /**\n * @description whether the nesting radios are disabled\n */\n disabled?: boolean\n /**\n * @description binding value\n */\n modelValue?: string | number | boolean\n /**\n * @description border and background color when button is active\n */\n fill?: string\n /**\n * @description font color when button is active\n */\n textColor?: string\n /**\n * @description native `name` attribute\n */\n name?: string\n /**\n * @description whether to trigger form validation\n */\n validateEvent?: boolean\n /**\n * @description radio options\n */\n options?: radioOption[]\n /**\n * @description custom prop names for options\n */\n props?: radioOptionProp\n /**\n * @description radio type\n */\n type?: 'radio' | 'button'\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.\n */\nexport const radioGroupProps = buildProps({\n /**\n * @description native `id` attribute\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description the size of radio buttons or bordered radios\n */\n size: useSizeProp,\n /**\n * @description whether the nesting radios are disabled\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description binding value\n */\n modelValue: {\n type: [String, Number, Boolean],\n default: undefined,\n },\n /**\n * @description border and background color when button is active\n */\n fill: {\n type: String,\n default: '',\n },\n /**\n * @description font color when button is active\n */\n textColor: {\n type: String,\n default: '',\n },\n /**\n * @description native `name` attribute\n */\n name: {\n type: String,\n default: undefined,\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n options: {\n type: definePropType<radioOption[]>(Array),\n },\n props: {\n type: definePropType<radioOptionProp>(Object),\n default: () => radioDefaultProps,\n },\n type: {\n type: String,\n values: ['radio', 'button'] as const,\n default: 'radio',\n },\n ...useAriaProps(['ariaLabel']),\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.\n */\nexport type RadioGroupPropsPublic = ExtractPublicPropTypes<\n typeof radioGroupProps\n>\n\nexport const radioGroupEmits = radioEmits\nexport type RadioGroupEmits = typeof radioGroupEmits\nexport type RadioGroupInstance = InstanceType<typeof RadioGroup> & unknown\n\n/**\n * @description default values for RadioGroupProps\n */\nexport const radioGroupPropsDefaults = {\n id: undefined,\n disabled: undefined,\n modelValue: undefined,\n fill: '',\n textColor: '',\n name: undefined,\n validateEvent: true,\n props: () => radioDefaultProps,\n type: 'radio',\n} as const\n"],"mappings":";;;;;;AAcA,MAAa,oBAA+C;CAC1D,OAAO;CACP,OAAO;CACP,UAAU;CACX;;;;AA0DD,MAAa,kBAAkBA,gBAAAA,WAAW;;;;CAIxC,IAAI;EACF,MAAM;EACN,SAAS,KAAA;EACV;;;;CAID,MAAMC,cAAAA;;;;CAIN,UAAU;EACR,MAAM;EACN,SAAS,KAAA;EACV;;;;CAID,YAAY;EACV,MAAM;GAAC;GAAQ;GAAQ;GAAQ;EAC/B,SAAS,KAAA;EACV;;;;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;;;;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;;;;CAID,MAAM;EACJ,MAAM;EACN,SAAS,KAAA;EACV;;;;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CACD,SAAS,EACP,MAAMC,gBAAAA,eAA8B,MAAM,EAC3C;CACD,OAAO;EACL,MAAMA,gBAAAA,eAAgC,OAAO;EAC7C,eAAe;EAChB;CACD,MAAM;EACJ,MAAM;EACN,QAAQ,CAAC,SAAS,SAAS;EAC3B,SAAS;EACV;CACD,GAAGC,gBAAAA,aAAa,CAAC,YAAY,CAAC;CAC/B,CAAU;AASX,MAAa,kBAAkBC,cAAAA;;;;AAO/B,MAAa,0BAA0B;CACrC,IAAI,KAAA;CACJ,UAAU,KAAA;CACV,YAAY,KAAA;CACZ,MAAM;CACN,WAAW;CACX,MAAM,KAAA;CACN,eAAe;CACf,aAAa;CACb,MAAM;CACP"}
@@ -0,0 +1,34 @@
import { RadioGroupProps, radioOptionProp } from "./radio-group.js";
import * as _$vue from "vue";
//#region ../../packages/components/radio/src/radio-group.vue.d.ts
declare var __VLS_1: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_1) => any;
};
declare const __VLS_base: _$vue.DefineComponent<RadioGroupProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
change: (val: string | number | boolean | undefined) => void;
"update:modelValue": (val: string | number | boolean | undefined) => void;
}, string, _$vue.PublicProps, Readonly<RadioGroupProps> & Readonly<{
"onUpdate:modelValue"?: ((val: string | number | boolean | undefined) => any) | undefined;
onChange?: ((val: string | number | boolean | undefined) => any) | undefined;
}>, {
name: string;
fill: string;
type: "radio" | "button";
disabled: boolean;
modelValue: string | number | boolean;
props: radioOptionProp;
id: string;
validateEvent: boolean;
textColor: string;
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};
//#endregion
export { _default as default };
@@ -0,0 +1,91 @@
require("../../../_virtual/_rolldown/runtime.js");
const require_event = require("../../../constants/event.js");
const require_index = require("../../../hooks/use-namespace/index.js");
const require_index$1 = require("../../../hooks/use-id/index.js");
const require_use_form_item = require("../../form/src/hooks/use-form-item.js");
const require_constants = require("./constants.js");
const require_radio = require("./radio2.js");
const require_radio_button = require("./radio-button2.js");
const require_radio_group = require("./radio-group.js");
let lodash_unified = require("lodash-unified");
let vue = require("vue");
let _vue_shared = require("@vue/shared");
//#region ../../packages/components/radio/src/radio-group.vue?vue&type=script&setup=true&lang.ts
const _hoisted_1 = [
"id",
"aria-label",
"aria-labelledby"
];
var radio_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
name: "ElRadioGroup",
__name: "radio-group",
props: require_radio_group.radioGroupProps,
emits: require_radio_group.radioGroupEmits,
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const ns = require_index.useNamespace("radio");
const radioId = require_index$1.useId();
const radioGroupRef = (0, vue.ref)();
const { formItem } = require_use_form_item.useFormItem();
const { inputId: groupId, isLabeledByFormItem } = require_use_form_item.useFormItemInputId(props, { formItemContext: formItem });
const changeEvent = (value) => {
emit(require_event.UPDATE_MODEL_EVENT, value);
(0, vue.nextTick)(() => emit(require_event.CHANGE_EVENT, value));
};
(0, vue.onMounted)(() => {
const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
const firstLabel = radios[0];
if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) firstLabel.tabIndex = 0;
});
const name = (0, vue.computed)(() => {
return props.name || radioId.value;
});
const aliasProps = (0, vue.computed)(() => ({
...require_radio_group.radioDefaultProps,
...props.props
}));
const getOptionProps = (option) => {
const { label, value, disabled } = aliasProps.value;
const base = {
label: option[label],
value: option[value],
disabled: option[disabled]
};
return {
...(0, lodash_unified.omit)(option, [
label,
value,
disabled
]),
...base
};
};
const optionComponent = (0, vue.computed)(() => props.type === "button" ? require_radio_button.default : require_radio.default);
(0, vue.provide)(require_constants.radioGroupKey, (0, vue.reactive)({
...(0, vue.toRefs)(props),
changeEvent,
name
}));
(0, vue.watch)(() => props.modelValue, (newVal, oldValue) => {
if (props.validateEvent && !(0, lodash_unified.isEqual)(newVal, oldValue)) formItem?.validate("change").catch(_vue_shared.NOOP);
});
return (_ctx, _cache) => {
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
id: (0, vue.unref)(groupId),
ref_key: "radioGroupRef",
ref: radioGroupRef,
class: (0, vue.normalizeClass)((0, vue.unref)(ns).b("group")),
role: "radiogroup",
"aria-label": !(0, vue.unref)(isLabeledByFormItem) ? __props.ariaLabel || "radio-group" : void 0,
"aria-labelledby": (0, vue.unref)(isLabeledByFormItem) ? (0, vue.unref)(formItem).labelId : void 0
}, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.options, (item, index) => {
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(optionComponent.value), (0, vue.mergeProps)({ key: index }, { ref_for: true }, getOptionProps(item)), null, 16);
}), 128))])], 10, _hoisted_1);
};
}
});
//#endregion
exports.default = radio_group_vue_vue_type_script_setup_true_lang_default;
//# sourceMappingURL=radio-group.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
{"version":3,"file":"radio-group.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/radio/src/radio-group.vue"],"sourcesContent":["<template>\n <div\n :id=\"groupId\"\n ref=\"radioGroupRef\"\n :class=\"ns.b('group')\"\n role=\"radiogroup\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'radio-group' : undefined\"\n :aria-labelledby=\"isLabeledByFormItem ? formItem!.labelId : undefined\"\n >\n <slot>\n <component\n :is=\"optionComponent\"\n v-for=\"(item, index) in options\"\n :key=\"index\"\n v-bind=\"getOptionProps(item)\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n toRefs,\n watch,\n} from 'vue'\nimport { useFormItem, useFormItemInputId } from '@element-plus/components/form'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useId, useNamespace } from '@element-plus/hooks'\nimport { NOOP } from '@element-plus/utils'\nimport {\n type RadioGroupProps,\n radioDefaultProps,\n radioGroupEmits,\n radioGroupPropsDefaults,\n} from './radio-group'\nimport { radioGroupKey } from './constants'\nimport { isEqual, omit } from 'lodash-unified'\nimport ElRadio from './radio.vue'\nimport ElRadioButton from './radio-button.vue'\n\ndefineOptions({\n name: 'ElRadioGroup',\n})\n\nconst props = withDefaults(\n defineProps<RadioGroupProps>(),\n radioGroupPropsDefaults\n)\nconst emit = defineEmits(radioGroupEmits)\n\nconst ns = useNamespace('radio')\nconst radioId = useId()\nconst radioGroupRef = ref<HTMLDivElement>()\nconst { formItem } = useFormItem()\nconst { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst changeEvent = (value: RadioGroupProps['modelValue']) => {\n emit(UPDATE_MODEL_EVENT, value)\n nextTick(() => emit(CHANGE_EVENT, value))\n}\n\nonMounted(() => {\n const radios =\n radioGroupRef.value!.querySelectorAll<HTMLInputElement>('[type=radio]')\n const firstLabel = radios[0]\n if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {\n firstLabel.tabIndex = 0\n }\n})\n\nconst name = computed(() => {\n return props.name || radioId.value\n})\n\nconst aliasProps = computed(() => ({\n ...radioDefaultProps,\n ...props.props,\n}))\nconst getOptionProps = (option: Record<string, any>) => {\n const { label, value, disabled } = aliasProps.value\n const base = {\n label: option[label],\n value: option[value],\n disabled: option[disabled],\n }\n return { ...omit(option, [label, value, disabled]), ...base }\n}\n\nconst optionComponent = computed(() =>\n props.type === 'button' ? ElRadioButton : ElRadio\n)\n\nprovide(\n radioGroupKey,\n reactive({\n ...toRefs(props),\n changeEvent,\n name,\n })\n)\n\nwatch(\n () => props.modelValue,\n (newVal, oldValue) => {\n if (props.validateEvent && !isEqual(newVal, oldValue)) {\n formItem?.validate('change').catch(NOOP)\n }\n }\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAkDA,MAAM,QAAQ;EAId,MAAM,OAAO;EAEb,MAAM,KAAK,cAAA,aAAa,QAAO;EAC/B,MAAM,UAAU,gBAAA,OAAM;EACtB,MAAM,iBAAA,GAAA,IAAA,MAAoC;EAC1C,MAAM,EAAE,aAAa,sBAAA,aAAY;EACjC,MAAM,EAAE,SAAS,SAAS,wBAAwB,sBAAA,mBAAmB,OAAO,EAC1E,iBAAiB,UAClB,CAAA;EAED,MAAM,eAAe,UAAyC;GAC5D,KAAK,cAAA,oBAAoB,MAAK;GAC9B,CAAA,GAAA,IAAA,gBAAe,KAAK,cAAA,cAAc,MAAM,CAAA;;EAG1C,CAAA,GAAA,IAAA,iBAAgB;GACd,MAAM,SACJ,cAAc,MAAO,iBAAmC,eAAc;GACxE,MAAM,aAAa,OAAO;GAC1B,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,UAAU,MAAM,QAAQ,IAAI,YACxD,WAAW,WAAW;IAEzB;EAED,MAAM,QAAA,GAAA,IAAA,gBAAsB;GAC1B,OAAO,MAAM,QAAQ,QAAQ;IAC9B;EAED,MAAM,cAAA,GAAA,IAAA,iBAA6B;GACjC,GAAG,oBAAA;GACH,GAAG,MAAM;GACV,EAAC;EACF,MAAM,kBAAkB,WAAgC;GACtD,MAAM,EAAE,OAAO,OAAO,aAAa,WAAW;GAC9C,MAAM,OAAO;IACX,OAAO,OAAO;IACd,OAAO,OAAO;IACd,UAAU,OAAO;IACnB;GACA,OAAO;IAAE,IAAA,GAAA,eAAA,MAAQ,QAAQ;KAAC;KAAO;KAAO;KAAS,CAAC;IAAE,GAAG;IAAK;;EAG9D,MAAM,mBAAA,GAAA,IAAA,gBACJ,MAAM,SAAS,WAAW,qBAAA,UAAgB,cAAA,QAC5C;EAEA,CAAA,GAAA,IAAA,SACE,kBAAA,gBAAA,GAAA,IAAA,UACS;GACP,IAAA,GAAA,IAAA,QAAU,MAAM;GAChB;GACA;GACD,CAAA,CACH;EAEA,CAAA,GAAA,IAAA,aACQ,MAAM,aACX,QAAQ,aAAa;GACpB,IAAI,MAAM,iBAAiB,EAAA,GAAA,eAAA,SAAS,QAAQ,SAAS,EACnD,UAAU,SAAS,SAAS,CAAC,MAAM,YAAA,KAAI;IAG7C;;4DAnGQ,OAAA;IAfH,KAAA,GAAA,IAAA,OAAI,QAAO;aACR;IAAJ,KAAI;IACH,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,QAAA,CAAA;IACZ,MAAK;IACJ,cAAU,EAAA,GAAA,IAAA,OAAG,oBAAmB,GAAG,QAAA,aAAS,gBAAoB,KAAA;IAChE,oBAAA,GAAA,IAAA,OAAiB,oBAAmB,IAAA,GAAA,IAAA,OAAG,SAAQ,CAAE,UAAU,KAAA;2BASrD,KAAA,QAAA,WAAA,EAAA,QAAA,GAAA,GAAA,IAAA,WAAA,KAAA,GAAA,GAAA,IAAA,oBADH,IAAA,UAAA,OAAA,GAAA,IAAA,YAHwB,QAAA,UAAhB,MAAM,UAAK;uFADd,gBAAA,MAAe,GAAA,GAAA,IAAA,YAIpB,EAFC,KAAK,OAAK,EAAA,EAAA,SAAA,MAAA,EACH,eAAe,KAAI,CAAA,EAAA,MAAA,GAAA"}
+10
View File
@@ -0,0 +1,10 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region ../../packages/components/radio/src/radio-group.vue
var radio_group_default = require("./radio-group.vue_vue_type_script_setup_true_lang.js").default;
//#endregion
exports.default = radio_group_default;
//# sourceMappingURL=radio-group2.js.map
@@ -0,0 +1 @@
{"version":3,"file":"radio-group2.js","names":[],"sources":["../../../../../../packages/components/radio/src/radio-group.vue"],"sourcesContent":["<template>\n <div\n :id=\"groupId\"\n ref=\"radioGroupRef\"\n :class=\"ns.b('group')\"\n role=\"radiogroup\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'radio-group' : undefined\"\n :aria-labelledby=\"isLabeledByFormItem ? formItem!.labelId : undefined\"\n >\n <slot>\n <component\n :is=\"optionComponent\"\n v-for=\"(item, index) in options\"\n :key=\"index\"\n v-bind=\"getOptionProps(item)\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n toRefs,\n watch,\n} from 'vue'\nimport { useFormItem, useFormItemInputId } from '@element-plus/components/form'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useId, useNamespace } from '@element-plus/hooks'\nimport { NOOP } from '@element-plus/utils'\nimport {\n type RadioGroupProps,\n radioDefaultProps,\n radioGroupEmits,\n radioGroupPropsDefaults,\n} from './radio-group'\nimport { radioGroupKey } from './constants'\nimport { isEqual, omit } from 'lodash-unified'\nimport ElRadio from './radio.vue'\nimport ElRadioButton from './radio-button.vue'\n\ndefineOptions({\n name: 'ElRadioGroup',\n})\n\nconst props = withDefaults(\n defineProps<RadioGroupProps>(),\n radioGroupPropsDefaults\n)\nconst emit = defineEmits(radioGroupEmits)\n\nconst ns = useNamespace('radio')\nconst radioId = useId()\nconst radioGroupRef = ref<HTMLDivElement>()\nconst { formItem } = useFormItem()\nconst { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst changeEvent = (value: RadioGroupProps['modelValue']) => {\n emit(UPDATE_MODEL_EVENT, value)\n nextTick(() => emit(CHANGE_EVENT, value))\n}\n\nonMounted(() => {\n const radios =\n radioGroupRef.value!.querySelectorAll<HTMLInputElement>('[type=radio]')\n const firstLabel = radios[0]\n if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {\n firstLabel.tabIndex = 0\n }\n})\n\nconst name = computed(() => {\n return props.name || radioId.value\n})\n\nconst aliasProps = computed(() => ({\n ...radioDefaultProps,\n ...props.props,\n}))\nconst getOptionProps = (option: Record<string, any>) => {\n const { label, value, disabled } = aliasProps.value\n const base = {\n label: option[label],\n value: option[value],\n disabled: option[disabled],\n }\n return { ...omit(option, [label, value, disabled]), ...base }\n}\n\nconst optionComponent = computed(() =>\n props.type === 'button' ? ElRadioButton : ElRadio\n)\n\nprovide(\n radioGroupKey,\n reactive({\n ...toRefs(props),\n changeEvent,\n name,\n })\n)\n\nwatch(\n () => props.modelValue,\n (newVal, oldValue) => {\n if (props.validateEvent && !isEqual(newVal, oldValue)) {\n formItem?.validate('change').catch(NOOP)\n }\n }\n)\n</script>\n"],"mappings":""}
+95
View File
@@ -0,0 +1,95 @@
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import { ComponentSize } from "../../../constants/size.js";
import _default from "./radio.vue.js";
import * as _$vue from "vue";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/radio/src/radio.d.ts
interface RadioPropsBase {
/**
* @description binding value
*/
modelValue?: string | number | boolean;
/**
* @description size of the Radio
*/
size?: ComponentSize;
/**
* @description whether Radio is disabled
*/
disabled?: boolean;
/**
* @description the label of Radio
*/
label?: string | number | boolean;
/**
* @description the value of Radio
*/
value?: string | number | boolean;
/**
* @description native `name` attribute
*/
name?: string;
}
interface RadioProps extends RadioPropsBase {
/**
* @description whether to add a border around Radio
*/
border?: boolean;
}
/**
* @deprecated Removed after 3.0.0, Use `RadioPropsBase` instead.
*/
declare const radioPropsBase: {
modelValue: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
size: {
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
label: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
value: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
name: EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `RadioProps` instead.
*/
declare const radioProps: {
readonly border: BooleanConstructor;
readonly modelValue: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
readonly size: {
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly label: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
readonly value: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
readonly name: EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
};
declare const radioEmits: {
"update:modelValue": (val: string | number | boolean | undefined) => val is string | number | boolean;
change: (val: string | number | boolean | undefined) => val is string | number | boolean;
};
/**
* @deprecated Removed after 3.0.0, Use `RadioProps` instead.
*/
type RadioPropsPublic = ExtractPublicPropTypes<typeof radioProps>;
type RadioEmits = typeof radioEmits;
type RadioInstance = InstanceType<typeof _default> & unknown;
/**
* @description default values for RadioProps
*/
declare const radioPropsDefaults: {
readonly modelValue: undefined;
readonly disabled: undefined;
readonly label: undefined;
readonly value: undefined;
readonly name: undefined;
readonly border: false;
};
//#endregion
export { RadioEmits, RadioInstance, RadioProps, RadioPropsBase, RadioPropsPublic, radioEmits, radioProps, radioPropsBase, radioPropsDefaults };
+96
View File
@@ -0,0 +1,96 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.js");
const require_event = require("../../../constants/event.js");
const require_types = require("../../../utils/types.js");
const require_runtime$1 = require("../../../utils/vue/props/runtime.js");
const require_index = require("../../../hooks/use-size/index.js");
let _vue_shared = require("@vue/shared");
//#region ../../packages/components/radio/src/radio.ts
/**
* @deprecated Removed after 3.0.0, Use `RadioPropsBase` instead.
*/
const radioPropsBase = require_runtime$1.buildProps({
/**
* @description binding value
*/
modelValue: {
type: [
String,
Number,
Boolean
],
default: void 0
},
/**
* @description size of the Radio
*/
size: require_index.useSizeProp,
/**
* @description whether Radio is disabled
*/
disabled: {
type: Boolean,
default: void 0
},
/**
* @description the label of Radio
*/
label: {
type: [
String,
Number,
Boolean
],
default: void 0
},
/**
* @description the value of Radio
*/
value: {
type: [
String,
Number,
Boolean
],
default: void 0
},
/**
* @description native `name` attribute
*/
name: {
type: String,
default: void 0
}
});
/**
* @deprecated Removed after 3.0.0, Use `RadioProps` instead.
*/
const radioProps = require_runtime$1.buildProps({
...radioPropsBase,
/**
* @description whether to add a border around Radio
*/
border: Boolean
});
const radioEmits = {
[require_event.UPDATE_MODEL_EVENT]: (val) => (0, _vue_shared.isString)(val) || require_types.isNumber(val) || require_types.isBoolean(val),
[require_event.CHANGE_EVENT]: (val) => (0, _vue_shared.isString)(val) || require_types.isNumber(val) || require_types.isBoolean(val)
};
/**
* @description default values for RadioProps
*/
const radioPropsDefaults = {
modelValue: void 0,
disabled: void 0,
label: void 0,
value: void 0,
name: void 0,
border: false
};
//#endregion
exports.radioEmits = radioEmits;
exports.radioProps = radioProps;
exports.radioPropsBase = radioPropsBase;
exports.radioPropsDefaults = radioPropsDefaults;
//# sourceMappingURL=radio.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"radio.js","names":["buildProps","useSizeProp","UPDATE_MODEL_EVENT","isNumber","isBoolean","CHANGE_EVENT"],"sources":["../../../../../../packages/components/radio/src/radio.ts"],"sourcesContent":["import { buildProps, isBoolean, isNumber, isString } from '@element-plus/utils'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useSizeProp } from '@element-plus/hooks'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type Radio from './radio.vue'\n\nexport interface RadioPropsBase {\n /**\n * @description binding value\n */\n modelValue?: string | number | boolean\n /**\n * @description size of the Radio\n */\n size?: ComponentSize\n /**\n * @description whether Radio is disabled\n */\n disabled?: boolean\n /**\n * @description the label of Radio\n */\n label?: string | number | boolean\n /**\n * @description the value of Radio\n */\n value?: string | number | boolean\n /**\n * @description native `name` attribute\n */\n name?: string\n}\n\nexport interface RadioProps extends RadioPropsBase {\n /**\n * @description whether to add a border around Radio\n */\n border?: boolean\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioPropsBase` instead.\n */\nexport const radioPropsBase = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: [String, Number, Boolean],\n default: undefined,\n },\n /**\n * @description size of the Radio\n */\n size: useSizeProp,\n /**\n * @description whether Radio is disabled\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description the label of Radio\n */\n label: {\n type: [String, Number, Boolean],\n default: undefined,\n },\n /**\n * @description the value of Radio\n */\n value: {\n type: [String, Number, Boolean],\n default: undefined,\n },\n /**\n * @description native `name` attribute\n */\n name: {\n type: String,\n default: undefined,\n },\n})\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioProps` instead.\n */\nexport const radioProps = buildProps({\n ...radioPropsBase,\n /**\n * @description whether to add a border around Radio\n */\n border: Boolean,\n} as const)\n\nexport const radioEmits = {\n [UPDATE_MODEL_EVENT]: (val: string | number | boolean | undefined) =>\n isString(val) || isNumber(val) || isBoolean(val),\n [CHANGE_EVENT]: (val: string | number | boolean | undefined) =>\n isString(val) || isNumber(val) || isBoolean(val),\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioProps` instead.\n */\nexport type RadioPropsPublic = ExtractPublicPropTypes<typeof radioProps>\nexport type RadioEmits = typeof radioEmits\nexport type RadioInstance = InstanceType<typeof Radio> & unknown\n\n/**\n * @description default values for RadioProps\n */\nexport const radioPropsDefaults = {\n modelValue: undefined,\n disabled: undefined,\n label: undefined,\n value: undefined,\n name: undefined,\n border: false,\n} as const\n"],"mappings":";;;;;;;;;;;AA6CA,MAAa,iBAAiBA,kBAAAA,WAAW;;;;CAIvC,YAAY;EACV,MAAM;GAAC;GAAQ;GAAQ;GAAQ;EAC/B,SAAS,KAAA;EACV;;;;CAID,MAAMC,cAAAA;;;;CAIN,UAAU;EACR,MAAM;EACN,SAAS,KAAA;EACV;;;;CAID,OAAO;EACL,MAAM;GAAC;GAAQ;GAAQ;GAAQ;EAC/B,SAAS,KAAA;EACV;;;;CAID,OAAO;EACL,MAAM;GAAC;GAAQ;GAAQ;GAAQ;EAC/B,SAAS,KAAA;EACV;;;;CAID,MAAM;EACJ,MAAM;EACN,SAAS,KAAA;EACV;CACF,CAAC;;;;AAKF,MAAa,aAAaD,kBAAAA,WAAW;CACnC,GAAG;;;;CAIH,QAAQ;CACT,CAAU;AAEX,MAAa,aAAa;EACvBE,cAAAA,sBAAsB,SAAA,GAAA,YAAA,UACZ,IAAI,IAAIC,cAAAA,SAAS,IAAI,IAAIC,cAAAA,UAAU,IAAI;EACjDC,cAAAA,gBAAgB,SAAA,GAAA,YAAA,UACN,IAAI,IAAIF,cAAAA,SAAS,IAAI,IAAIC,cAAAA,UAAU,IAAI;CACnD;;;;AAYD,MAAa,qBAAqB;CAChC,YAAY,KAAA;CACZ,UAAU,KAAA;CACV,OAAO,KAAA;CACP,OAAO,KAAA;CACP,MAAM,KAAA;CACN,QAAQ;CACT"}
+31
View File
@@ -0,0 +1,31 @@
import { RadioProps } from "./radio.js";
import * as _$vue from "vue";
//#region ../../packages/components/radio/src/radio.vue.d.ts
declare var __VLS_1: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_1) => any;
};
declare const __VLS_base: _$vue.DefineComponent<RadioProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
change: (val: string | number | boolean | undefined) => void;
"update:modelValue": (val: string | number | boolean | undefined) => void;
}, string, _$vue.PublicProps, Readonly<RadioProps> & Readonly<{
"onUpdate:modelValue"?: ((val: string | number | boolean | undefined) => any) | undefined;
onChange?: ((val: string | number | boolean | undefined) => any) | undefined;
}>, {
name: string;
label: string | number | boolean;
disabled: boolean;
modelValue: string | number | boolean;
value: string | number | boolean;
border: boolean;
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};
//#endregion
export { _default as default };
@@ -0,0 +1,63 @@
require("../../../_virtual/_rolldown/runtime.js");
const require_event = require("../../../constants/event.js");
const require_index = require("../../../hooks/use-namespace/index.js");
const require_radio = require("./radio.js");
const require_use_radio = require("./use-radio.js");
let vue = require("vue");
//#region ../../packages/components/radio/src/radio.vue?vue&type=script&setup=true&lang.ts
const _hoisted_1 = [
"value",
"name",
"disabled",
"checked"
];
var radio_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
name: "ElRadio",
__name: "radio",
props: require_radio.radioProps,
emits: require_radio.radioEmits,
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const ns = require_index.useNamespace("radio");
const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = require_use_radio.useRadio(props, emit);
function handleChange() {
(0, vue.nextTick)(() => emit(require_event.CHANGE_EVENT, modelValue.value));
}
return (_ctx, _cache) => {
return (0, vue.openBlock)(), (0, vue.createElementBlock)("label", { class: (0, vue.normalizeClass)([
(0, vue.unref)(ns).b(),
(0, vue.unref)(ns).is("disabled", (0, vue.unref)(disabled)),
(0, vue.unref)(ns).is("focus", (0, vue.unref)(focus)),
(0, vue.unref)(ns).is("bordered", __props.border),
(0, vue.unref)(ns).is("checked", (0, vue.unref)(modelValue) === (0, vue.unref)(actualValue)),
(0, vue.unref)(ns).m((0, vue.unref)(size))
]) }, [(0, vue.createElementVNode)("span", { class: (0, vue.normalizeClass)([
(0, vue.unref)(ns).e("input"),
(0, vue.unref)(ns).is("disabled", (0, vue.unref)(disabled)),
(0, vue.unref)(ns).is("checked", (0, vue.unref)(modelValue) === (0, vue.unref)(actualValue))
]) }, [(0, vue.withDirectives)((0, vue.createElementVNode)("input", {
ref_key: "radioRef",
ref: radioRef,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => (0, vue.isRef)(modelValue) ? modelValue.value = $event : null),
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("original")),
value: (0, vue.unref)(actualValue),
name: __props.name || (0, vue.unref)(radioGroup)?.name,
disabled: (0, vue.unref)(disabled),
checked: (0, vue.unref)(modelValue) === (0, vue.unref)(actualValue),
type: "radio",
onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
onChange: handleChange,
onClick: _cache[3] || (_cache[3] = (0, vue.withModifiers)(() => {}, ["stop"]))
}, null, 42, _hoisted_1), [[vue.vModelRadio, (0, vue.unref)(modelValue)]]), (0, vue.createElementVNode)("span", { class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("inner")) }, null, 2)], 2), (0, vue.createElementVNode)("span", {
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("label")),
onKeydown: _cache[4] || (_cache[4] = (0, vue.withModifiers)(() => {}, ["stop"]))
}, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.label), 1)])], 34)], 2);
};
}
});
//#endregion
exports.default = radio_vue_vue_type_script_setup_true_lang_default;
//# sourceMappingURL=radio.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
{"version":3,"file":"radio.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/radio/src/radio.vue"],"sourcesContent":["<template>\n <label\n :class=\"[\n ns.b(),\n ns.is('disabled', disabled),\n ns.is('focus', focus),\n ns.is('bordered', border),\n ns.is('checked', modelValue === actualValue),\n ns.m(size),\n ]\"\n >\n <span\n :class=\"[\n ns.e('input'),\n ns.is('disabled', disabled),\n ns.is('checked', modelValue === actualValue),\n ]\"\n >\n <input\n ref=\"radioRef\"\n v-model=\"modelValue\"\n :class=\"ns.e('original')\"\n :value=\"actualValue\"\n :name=\"name || radioGroup?.name\"\n :disabled=\"disabled\"\n :checked=\"modelValue === actualValue\"\n type=\"radio\"\n @focus=\"focus = true\"\n @blur=\"focus = false\"\n @change=\"handleChange\"\n @click.stop\n />\n <span :class=\"ns.e('inner')\" />\n </span>\n <span :class=\"ns.e('label')\" @keydown.stop>\n <slot>\n {{ label }}\n </slot>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup>\nimport { nextTick } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { type RadioProps, radioEmits, radioPropsDefaults } from './radio'\nimport { useRadio } from './use-radio'\n\ndefineOptions({\n name: 'ElRadio',\n})\n\nconst props = withDefaults(defineProps<RadioProps>(), radioPropsDefaults)\nconst emit = defineEmits(radioEmits)\n\nconst ns = useNamespace('radio')\nconst { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } =\n useRadio(props, emit)\n\nfunction handleChange() {\n nextTick(() => emit(CHANGE_EVENT, modelValue.value))\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAqDA,MAAM,QAAQ;EACd,MAAM,OAAO;EAEb,MAAM,KAAK,cAAA,aAAa,QAAO;EAC/B,MAAM,EAAE,UAAU,YAAY,OAAO,MAAM,UAAU,YAAY,gBAC/D,kBAAA,SAAS,OAAO,KAAI;EAEtB,SAAS,eAAe;GACtB,CAAA,GAAA,IAAA,gBAAe,KAAK,cAAA,cAAc,WAAW,MAAM,CAAA;;;4DAtB3C,SAAA,EArCL,QAAA,GAAA,IAAA,gBAAK;mBAAU,GAAE,CAAC,GAAC;mBAAU,GAAE,CAAC,GAAE,aAAA,GAAA,IAAA,OAAa,SAAQ,CAAA;mBAAS,GAAE,CAAC,GAAE,UAAA,GAAA,IAAA,OAAU,MAAK,CAAA;mBAAS,GAAE,CAAC,GAAE,YAAa,QAAA,OAAM;mBAAS,GAAE,CAAC,GAAE,YAAA,GAAA,IAAA,OAAY,WAAU,MAAA,GAAA,IAAA,OAAK,YAAW,CAAA;mBAAS,GAAE,CAAC,GAAA,GAAA,IAAA,OAAE,KAAI,CAAA;sCA+BrL,QAAA,EArBJ,QAAA,GAAA,IAAA,gBAAK;mBAAY,GAAE,CAAC,EAAC,QAAA;mBAAmB,GAAE,CAAC,GAAE,aAAA,GAAA,IAAA,OAAa,SAAQ,CAAA;mBAAW,GAAE,CAAC,GAAE,YAAA,GAAA,IAAA,OAAY,WAAU,MAAA,GAAA,IAAA,OAAK,YAAW,CAAA;8DAmBvH,SAAA;aAZI;IAAJ,KAAI;8FACK,WAAU,QAAA,SAAA;IAClB,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,WAAA,CAAA;IACX,QAAA,GAAA,IAAA,OAAO,YAAW;IAClB,MAAM,QAAA,SAAA,GAAA,IAAA,OAAQ,WAAU,EAAE;IAC1B,WAAA,GAAA,IAAA,OAAU,SAAQ;IAClB,UAAA,GAAA,IAAA,OAAS,WAAU,MAAA,GAAA,IAAA,OAAK,YAAW;IACpC,MAAK;IACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,QAAK;IACZ,QAAI,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,QAAK;IACX,UAAQ;IACR,SAAK,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,qBAAN,IAAW,CAAA,OAAA,CAAA;+DAVF,WAAU,CAAA,CAAA,CAAA,GAAA,GAAA,IAAA,oBAYU,QAAA,EAAxB,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,QAAA,CAAA,EAAA,EAAA,MAAA,EAAA,CAAA,EAAA,EAAA,GAAA,GAAA,IAAA,oBAMb,QAAA;IAJA,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,QAAA,CAAA;IAAY,WAAO,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,qBAAR,IAAa,CAAA,OAAA,CAAA;2BAGjC,KAAA,QAAA,WAAA,EAAA,QAAA,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,iBADF,QAAA,MAAK,EAAA,EAAA,CAAA,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,EAAA"}
+10
View File
@@ -0,0 +1,10 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region ../../packages/components/radio/src/radio.vue
var radio_default = require("./radio.vue_vue_type_script_setup_true_lang.js").default;
//#endregion
exports.default = radio_default;
//# sourceMappingURL=radio2.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"radio2.js","names":[],"sources":["../../../../../../packages/components/radio/src/radio.vue"],"sourcesContent":["<template>\n <label\n :class=\"[\n ns.b(),\n ns.is('disabled', disabled),\n ns.is('focus', focus),\n ns.is('bordered', border),\n ns.is('checked', modelValue === actualValue),\n ns.m(size),\n ]\"\n >\n <span\n :class=\"[\n ns.e('input'),\n ns.is('disabled', disabled),\n ns.is('checked', modelValue === actualValue),\n ]\"\n >\n <input\n ref=\"radioRef\"\n v-model=\"modelValue\"\n :class=\"ns.e('original')\"\n :value=\"actualValue\"\n :name=\"name || radioGroup?.name\"\n :disabled=\"disabled\"\n :checked=\"modelValue === actualValue\"\n type=\"radio\"\n @focus=\"focus = true\"\n @blur=\"focus = false\"\n @change=\"handleChange\"\n @click.stop\n />\n <span :class=\"ns.e('inner')\" />\n </span>\n <span :class=\"ns.e('label')\" @keydown.stop>\n <slot>\n {{ label }}\n </slot>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup>\nimport { nextTick } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { type RadioProps, radioEmits, radioPropsDefaults } from './radio'\nimport { useRadio } from './use-radio'\n\ndefineOptions({\n name: 'ElRadio',\n})\n\nconst props = withDefaults(defineProps<RadioProps>(), radioPropsDefaults)\nconst emit = defineEmits(radioEmits)\n\nconst ns = useNamespace('radio')\nconst { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } =\n useRadio(props, emit)\n\nfunction handleChange() {\n nextTick(() => emit(CHANGE_EVENT, modelValue.value))\n}\n</script>\n"],"mappings":""}
+20
View File
@@ -0,0 +1,20 @@
import { RadioEmits, RadioProps } from "./radio.js";
import { RadioButtonProps } from "./radio-button.js";
import { RadioGroupContext } from "./constants.js";
import * as _$vue from "vue";
import { SetupContext } from "vue";
//#region ../../packages/components/radio/src/use-radio.d.ts
declare const useRadio: (props: RadioProps | RadioButtonProps, emit?: SetupContext<RadioEmits>["emit"]) => {
radioRef: _$vue.Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
isGroup: _$vue.ComputedRef<boolean>;
radioGroup: RadioGroupContext | undefined;
focus: _$vue.Ref<boolean, boolean>;
size: _$vue.ComputedRef<"" | "default" | "small" | "large">;
disabled: _$vue.ComputedRef<boolean>;
tabIndex: _$vue.ComputedRef<0 | -1>;
modelValue: _$vue.WritableComputedRef<string | number | boolean | undefined, string | number | boolean | undefined>;
actualValue: _$vue.ComputedRef<string | number | boolean | undefined>;
};
//#endregion
export { useRadio };
+56
View File
@@ -0,0 +1,56 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.js");
require("../../../constants/event.js");
const require_types = require("../../../utils/types.js");
const require_index = require("../../../hooks/use-deprecated/index.js");
const require_use_form_common_props = require("../../form/src/hooks/use-form-common-props.js");
const require_constants = require("./constants.js");
let vue = require("vue");
//#region ../../packages/components/radio/src/use-radio.ts
const useRadio = (props, emit) => {
const radioRef = (0, vue.ref)();
const radioGroup = (0, vue.inject)(require_constants.radioGroupKey, void 0);
const isGroup = (0, vue.computed)(() => !!radioGroup);
const actualValue = (0, vue.computed)(() => {
if (!require_types.isPropAbsent(props.value)) return props.value;
return props.label;
});
const modelValue = (0, vue.computed)({
get() {
return isGroup.value ? radioGroup.modelValue : props.modelValue;
},
set(val) {
if (isGroup.value) radioGroup.changeEvent(val);
else emit && emit("update:modelValue", val);
radioRef.value.checked = props.modelValue === actualValue.value;
}
});
const size = require_use_form_common_props.useFormSize((0, vue.computed)(() => radioGroup?.size));
const disabled = require_use_form_common_props.useFormDisabled((0, vue.computed)(() => radioGroup?.disabled));
const focus = (0, vue.ref)(false);
const tabIndex = (0, vue.computed)(() => {
return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
});
require_index.useDeprecated({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-radio",
ref: "https://element-plus.org/en-US/component/radio.html"
}, (0, vue.computed)(() => isGroup.value && require_types.isPropAbsent(props.value)));
return {
radioRef,
isGroup,
radioGroup,
focus,
size,
disabled,
tabIndex,
modelValue,
actualValue
};
};
//#endregion
exports.useRadio = useRadio;
//# sourceMappingURL=use-radio.js.map
@@ -0,0 +1 @@
{"version":3,"file":"use-radio.js","names":["radioGroupKey","isPropAbsent","useFormSize","useFormDisabled"],"sources":["../../../../../../packages/components/radio/src/use-radio.ts"],"sourcesContent":["import { computed, inject, ref } from 'vue'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useFormDisabled, useFormSize } from '@element-plus/components/form'\nimport { useDeprecated } from '@element-plus/hooks'\nimport { isPropAbsent } from '@element-plus/utils'\nimport { radioGroupKey } from './constants'\n\nimport type { RadioButtonProps } from './radio-button'\nimport type { SetupContext } from 'vue'\nimport type { RadioEmits, RadioProps } from './radio'\n\nexport const useRadio = (\n props: RadioProps | RadioButtonProps,\n emit?: SetupContext<RadioEmits>['emit']\n) => {\n const radioRef = ref<HTMLInputElement>()\n const radioGroup = inject(radioGroupKey, undefined)\n const isGroup = computed(() => !!radioGroup)\n const actualValue = computed(() => {\n // In version 2.x, if there's no props.value, props.label will act as props.value\n // In version 3.x, remove this computed value, use props.value instead.\n if (!isPropAbsent(props.value)) {\n return props.value\n }\n return props.label\n })\n const modelValue = computed<RadioProps['modelValue']>({\n get() {\n return isGroup.value ? radioGroup!.modelValue : props.modelValue!\n },\n set(val) {\n if (isGroup.value) {\n radioGroup!.changeEvent(val)\n } else {\n emit && emit(UPDATE_MODEL_EVENT, val)\n }\n radioRef.value!.checked = props.modelValue === actualValue.value\n },\n })\n\n const size = useFormSize(computed(() => radioGroup?.size))\n const disabled = useFormDisabled(computed(() => radioGroup?.disabled))\n const focus = ref(false)\n const tabIndex = computed(() => {\n return disabled.value ||\n (isGroup.value && modelValue.value !== actualValue.value)\n ? -1\n : 0\n })\n\n useDeprecated(\n {\n from: 'label act as value',\n replacement: 'value',\n version: '3.0.0',\n scope: 'el-radio',\n ref: 'https://element-plus.org/en-US/component/radio.html',\n },\n computed(() => isGroup.value && isPropAbsent(props.value))\n )\n\n return {\n radioRef,\n isGroup,\n radioGroup,\n focus,\n size,\n disabled,\n tabIndex,\n modelValue,\n actualValue,\n }\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,YACX,OACA,SACG;CACH,MAAM,YAAA,GAAA,IAAA,MAAkC;CACxC,MAAM,cAAA,GAAA,IAAA,QAAoBA,kBAAAA,eAAe,KAAA,EAAU;CACnD,MAAM,WAAA,GAAA,IAAA,gBAAyB,CAAC,CAAC,WAAW;CAC5C,MAAM,eAAA,GAAA,IAAA,gBAA6B;EAGjC,IAAI,CAACC,cAAAA,aAAa,MAAM,MAAM,EAC5B,OAAO,MAAM;EAEf,OAAO,MAAM;GACb;CACF,MAAM,cAAA,GAAA,IAAA,UAAgD;EACpD,MAAM;GACJ,OAAO,QAAQ,QAAQ,WAAY,aAAa,MAAM;;EAExD,IAAI,KAAK;GACP,IAAI,QAAQ,OACV,WAAY,YAAY,IAAI;QAE5B,QAAQ,KAAA,qBAAyB,IAAI;GAEvC,SAAS,MAAO,UAAU,MAAM,eAAe,YAAY;;EAE9D,CAAC;CAEF,MAAM,OAAOC,8BAAAA,aAAAA,GAAAA,IAAAA,gBAA2B,YAAY,KAAK,CAAC;CAC1D,MAAM,WAAWC,8BAAAA,iBAAAA,GAAAA,IAAAA,gBAA+B,YAAY,SAAS,CAAC;CACtE,MAAM,SAAA,GAAA,IAAA,KAAY,MAAM;CACxB,MAAM,YAAA,GAAA,IAAA,gBAA0B;EAC9B,OAAO,SAAS,SACb,QAAQ,SAAS,WAAW,UAAU,YAAY,QACjD,KACA;GACJ;CAEF,cAAA,cACE;EACE,MAAM;EACN,aAAa;EACb,SAAS;EACT,OAAO;EACP,KAAK;EACN,GAAA,GAAA,IAAA,gBACc,QAAQ,SAASF,cAAAA,aAAa,MAAM,MAAM,CAAC,CAC3D;CAED,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}