This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import Switch from './src/switch.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElSwitch: SFCWithInstall<typeof Switch>;
export default ElSwitch;
export * from './src/switch';

View File

@@ -0,0 +1,8 @@
import Switch from './src/switch2.mjs';
export { switchEmits, switchProps } from './src/switch.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElSwitch = withInstall(Switch);
export { ElSwitch, ElSwitch as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/switch/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Switch from './src/switch.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElSwitch: SFCWithInstall<typeof Switch> = withInstall(Switch)\nexport default ElSwitch\n\nexport * from './src/switch'\n"],"names":[],"mappings":";;;;AAEY,MAAC,QAAQ,GAAG,WAAW,CAAC,MAAM;;;;"}

View File

@@ -0,0 +1,68 @@
import type Switch from './switch.vue';
import type { ExtractPropTypes, PropType, __ExtractPublicPropTypes } from 'vue';
export declare const switchProps: {
readonly ariaLabel: StringConstructor;
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
readonly disabled: BooleanConstructor;
readonly loading: BooleanConstructor;
readonly size: {
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large") | ((new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large"))[], unknown, "" | "small" | "default" | "large">>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
readonly inlinePrompt: BooleanConstructor;
readonly inactiveActionIcon: {
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeActionIcon: {
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeIcon: {
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly inactiveIcon: {
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly inactiveText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
readonly inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
readonly name: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly beforeChange: {
readonly type: PropType<() => Promise<boolean> | boolean>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly id: StringConstructor;
readonly tabindex: {
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type SwitchProps = ExtractPropTypes<typeof switchProps>;
export type SwitchPropsPublic = __ExtractPublicPropTypes<typeof switchProps>;
export declare const switchEmits: {
"update:modelValue": (val: boolean | string | number) => boolean;
change: (val: boolean | string | number) => boolean;
input: (val: boolean | string | number) => boolean;
};
export type SwitchEmits = typeof switchEmits;
export type SwitchInstance = InstanceType<typeof Switch> & unknown;

View File

@@ -0,0 +1,77 @@
import { isValidComponentSize } from '../../../utils/vue/validator.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { iconPropType } from '../../../utils/vue/icon.mjs';
import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
import { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from '../../../constants/event.mjs';
import { isBoolean, isNumber } from '../../../utils/types.mjs';
import { isString } from '@vue/shared';
const switchProps = buildProps({
modelValue: {
type: [Boolean, String, Number],
default: false
},
disabled: Boolean,
loading: Boolean,
size: {
type: String,
validator: isValidComponentSize
},
width: {
type: [String, Number],
default: ""
},
inlinePrompt: Boolean,
inactiveActionIcon: {
type: iconPropType
},
activeActionIcon: {
type: iconPropType
},
activeIcon: {
type: iconPropType
},
inactiveIcon: {
type: iconPropType
},
activeText: {
type: String,
default: ""
},
inactiveText: {
type: String,
default: ""
},
activeValue: {
type: [Boolean, String, Number],
default: true
},
inactiveValue: {
type: [Boolean, String, Number],
default: false
},
name: {
type: String,
default: ""
},
validateEvent: {
type: Boolean,
default: true
},
beforeChange: {
type: definePropType(Function)
},
id: String,
tabindex: {
type: [String, Number]
},
...useAriaProps(["ariaLabel"])
});
const switchEmits = {
[UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
[CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
[INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
};
export { switchEmits, switchProps };
//# sourceMappingURL=switch.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,153 @@
declare function __VLS_template(): {
"active-action"?(_: {}): any;
"inactive-action"?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly ariaLabel: StringConstructor;
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
readonly disabled: BooleanConstructor;
readonly loading: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large") | ((new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large"))[], unknown, "" | "small" | "default" | "large">>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
readonly inlinePrompt: BooleanConstructor;
readonly inactiveActionIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeActionIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly inactiveIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly inactiveText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
readonly inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
readonly name: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly beforeChange: {
readonly type: import("vue").PropType<() => Promise<boolean> | boolean>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly id: StringConstructor;
readonly tabindex: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}, {
/**
* @description manual focus to the switch component
**/
focus: () => void;
/**
* @description whether Switch is checked
*/
checked: import("vue").ComputedRef<boolean>;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
"update:modelValue": (val: string | number | boolean) => void;
change: (val: string | number | boolean) => void;
input: (val: string | number | boolean) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly ariaLabel: StringConstructor;
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
readonly disabled: BooleanConstructor;
readonly loading: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large") | ((new (...args: any[]) => "" | "small" | "default" | "large") | (() => "" | "small" | "default" | "large"))[], unknown, "" | "small" | "default" | "large">>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
readonly inlinePrompt: BooleanConstructor;
readonly inactiveActionIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeActionIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly inactiveIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly activeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly inactiveText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
readonly inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
readonly name: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly beforeChange: {
readonly type: import("vue").PropType<() => Promise<boolean> | boolean>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly id: StringConstructor;
readonly tabindex: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}>> & {
"onUpdate:modelValue"?: ((val: string | number | boolean) => any) | undefined;
onChange?: ((val: string | number | boolean) => any) | undefined;
onInput?: ((val: string | number | boolean) => any) | undefined;
}, {
readonly disabled: boolean;
readonly width: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
readonly name: string;
readonly loading: boolean;
readonly modelValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
readonly validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly activeText: string;
readonly inactiveText: string;
readonly activeValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
readonly inactiveValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
readonly inlinePrompt: boolean;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,232 @@
import { defineComponent, computed, ref, watch, onMounted, openBlock, createElementBlock, normalizeClass, unref, withModifiers, createElementVNode, withKeys, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, toDisplayString, normalizeStyle, createVNode, renderSlot, nextTick } from 'vue';
import { ElIcon } from '../../icon/index.mjs';
import { Loading } from '@element-plus/icons-vue';
import { switchProps, switchEmits } from './switch.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useFormItem, useFormItemInputId } from '../../form/src/hooks/use-form-item.mjs';
import { useFormSize, useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { addUnit } from '../../../utils/dom/style.mjs';
import { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from '../../../constants/event.mjs';
import { debugWarn, throwError } from '../../../utils/error.mjs';
import { isPromise } from '@vue/shared';
import { isBoolean } from '../../../utils/types.mjs';
const COMPONENT_NAME = "ElSwitch";
const __default__ = defineComponent({
name: COMPONENT_NAME
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: switchProps,
emits: switchEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { formItem } = useFormItem();
const switchSize = useFormSize();
const ns = useNamespace("switch");
const { inputId } = useFormItemInputId(props, {
formItemContext: formItem
});
const switchDisabled = useFormDisabled(computed(() => props.loading));
const isControlled = ref(props.modelValue !== false);
const input = ref();
const core = ref();
const switchKls = computed(() => [
ns.b(),
ns.m(switchSize.value),
ns.is("disabled", switchDisabled.value),
ns.is("checked", checked.value)
]);
const labelLeftKls = computed(() => [
ns.e("label"),
ns.em("label", "left"),
ns.is("active", !checked.value)
]);
const labelRightKls = computed(() => [
ns.e("label"),
ns.em("label", "right"),
ns.is("active", checked.value)
]);
const coreStyle = computed(() => ({
width: addUnit(props.width)
}));
watch(() => props.modelValue, () => {
isControlled.value = true;
});
const actualValue = computed(() => {
return isControlled.value ? props.modelValue : false;
});
const checked = computed(() => actualValue.value === props.activeValue);
if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
emit(UPDATE_MODEL_EVENT, props.inactiveValue);
emit(CHANGE_EVENT, props.inactiveValue);
emit(INPUT_EVENT, props.inactiveValue);
}
watch(checked, (val) => {
var _a;
input.value.checked = val;
if (props.validateEvent) {
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
}
});
const handleChange = () => {
const val = checked.value ? props.inactiveValue : props.activeValue;
emit(UPDATE_MODEL_EVENT, val);
emit(CHANGE_EVENT, val);
emit(INPUT_EVENT, val);
nextTick(() => {
input.value.checked = checked.value;
});
};
const switchValue = () => {
if (switchDisabled.value)
return;
const { beforeChange } = props;
if (!beforeChange) {
handleChange();
return;
}
const shouldChange = beforeChange();
const isPromiseOrBool = [
isPromise(shouldChange),
isBoolean(shouldChange)
].includes(true);
if (!isPromiseOrBool) {
throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
}
if (isPromise(shouldChange)) {
shouldChange.then((result) => {
if (result) {
handleChange();
}
}).catch((e) => {
});
} else if (shouldChange) {
handleChange();
}
};
const focus = () => {
var _a, _b;
(_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
};
onMounted(() => {
input.value.checked = checked.value;
});
expose({
focus,
checked
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(switchKls)),
onClick: withModifiers(switchValue, ["prevent"])
}, [
createElementVNode("input", {
id: unref(inputId),
ref_key: "input",
ref: input,
class: normalizeClass(unref(ns).e("input")),
type: "checkbox",
role: "switch",
"aria-checked": unref(checked),
"aria-disabled": unref(switchDisabled),
"aria-label": _ctx.ariaLabel,
name: _ctx.name,
"true-value": _ctx.activeValue,
"false-value": _ctx.inactiveValue,
disabled: unref(switchDisabled),
tabindex: _ctx.tabindex,
onChange: handleChange,
onKeydown: withKeys(switchValue, ["enter"])
}, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
!_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(labelLeftKls))
}, [
_ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
]),
_: 1
})) : createCommentVNode("v-if", true),
!_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
key: 1,
"aria-hidden": unref(checked)
}, toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true),
createElementVNode("span", {
ref_key: "core",
ref: core,
class: normalizeClass(unref(ns).e("core")),
style: normalizeStyle(unref(coreStyle))
}, [
_ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).e("inner"))
}, [
_ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).is("icon"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
]),
_: 1
}, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(unref(ns).is("text")),
"aria-hidden": !unref(checked)
}, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).e("action"))
}, [
_ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).is("loading"))
}, {
default: withCtx(() => [
createVNode(unref(Loading))
]),
_: 1
}, 8, ["class"])) : unref(checked) ? renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
_ctx.activeActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.activeActionIcon)))
]),
_: 1
})) : createCommentVNode("v-if", true)
]) : !unref(checked) ? renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
_ctx.inactiveActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveActionIcon)))
]),
_: 1
})) : createCommentVNode("v-if", true)
]) : createCommentVNode("v-if", true)
], 2)
], 6),
!_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(unref(labelRightKls))
}, [
_ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
]),
_: 1
})) : createCommentVNode("v-if", true),
!_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
key: 1,
"aria-hidden": !unref(checked)
}, toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true)
], 10, ["onClick"]);
};
}
});
var Switch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "switch.vue"]]);
export { Switch as default };
//# sourceMappingURL=switch2.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/theme-chalk/el-switch.css';

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-switch.css';
//# sourceMappingURL=css.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style';
import 'element-plus/theme-chalk/src/switch.scss';

View File

@@ -0,0 +1,3 @@
import '../../base/style/index.mjs';
import 'element-plus/theme-chalk/src/switch.scss';
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}