完全跑通1.0版本
This commit is contained in:
8
frontend/node_modules/element-plus/es/components/switch/index.d.ts
generated
vendored
Normal file
8
frontend/node_modules/element-plus/es/components/switch/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SFCWithInstall } from "../../utils/vue/typescript.js";
|
||||
import { SwitchEmits, SwitchInstance, SwitchProps, SwitchPropsPublic, switchEmits, switchProps } from "./src/switch.js";
|
||||
import _default from "./src/switch.vue.js";
|
||||
|
||||
//#region ../../packages/components/switch/index.d.ts
|
||||
declare const ElSwitch: SFCWithInstall<typeof _default>;
|
||||
//#endregion
|
||||
export { ElSwitch, ElSwitch as default, SwitchEmits, SwitchInstance, SwitchProps, SwitchPropsPublic, switchEmits, switchProps };
|
||||
9
frontend/node_modules/element-plus/es/components/switch/index.mjs
generated
vendored
Normal file
9
frontend/node_modules/element-plus/es/components/switch/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { withInstall } from "../../utils/vue/install.mjs";
|
||||
import { switchEmits, switchProps } from "./src/switch.mjs";
|
||||
import switch_default from "./src/switch2.mjs";
|
||||
//#region ../../packages/components/switch/index.ts
|
||||
const ElSwitch = withInstall(switch_default);
|
||||
//#endregion
|
||||
export { ElSwitch, ElSwitch as default, switchEmits, switchProps };
|
||||
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/switch/index.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/switch/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","names":["Switch"],"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"],"mappings":";;;;AAKA,MAAa,WAA0C,YAAYA,eAAO"}
|
||||
163
frontend/node_modules/element-plus/es/components/switch/src/switch.d.ts
generated
vendored
Normal file
163
frontend/node_modules/element-plus/es/components/switch/src/switch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
import { IconPropType } from "../../../utils/vue/icon.js";
|
||||
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
|
||||
import { ComponentSize } from "../../../constants/size.js";
|
||||
import _default from "./switch.vue.js";
|
||||
import * as _$vue from "vue";
|
||||
import { ExtractPublicPropTypes, PropType } from "vue";
|
||||
|
||||
//#region ../../packages/components/switch/src/switch.d.ts
|
||||
interface SwitchProps {
|
||||
/**
|
||||
* @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type
|
||||
*/
|
||||
modelValue?: boolean | string | number;
|
||||
/**
|
||||
* @description whether Switch is disabled
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* @description whether Switch is in loading state
|
||||
*/
|
||||
loading?: boolean;
|
||||
/**
|
||||
* @description size of Switch
|
||||
*/
|
||||
size?: ComponentSize;
|
||||
/**
|
||||
* @description width of Switch
|
||||
*/
|
||||
width?: string | number;
|
||||
/**
|
||||
* @description whether icon or text is displayed inside dot, only the first character will be rendered for text
|
||||
*/
|
||||
inlinePrompt?: boolean;
|
||||
/**
|
||||
* @description component of the icon displayed in action when in `off` state
|
||||
*/
|
||||
inactiveActionIcon?: IconPropType;
|
||||
/**
|
||||
* @description component of the icon displayed in action when in `on` state
|
||||
*/
|
||||
activeActionIcon?: IconPropType;
|
||||
/**
|
||||
* @description component of the icon displayed when in `on` state, overrides `active-text`
|
||||
*/
|
||||
activeIcon?: IconPropType;
|
||||
/**
|
||||
* @description component of the icon displayed when in `off` state, overrides `inactive-text`
|
||||
*/
|
||||
inactiveIcon?: IconPropType;
|
||||
/**
|
||||
* @description text displayed when in `on` state
|
||||
*/
|
||||
activeText?: string;
|
||||
/**
|
||||
* @description text displayed when in `off` state
|
||||
*/
|
||||
inactiveText?: string;
|
||||
/**
|
||||
* @description switch value when in `on` state
|
||||
*/
|
||||
activeValue?: boolean | string | number;
|
||||
/**
|
||||
* @description switch value when in `off` state
|
||||
*/
|
||||
inactiveValue?: boolean | string | number;
|
||||
/**
|
||||
* @description input name of Switch
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* @description whether to trigger form validation
|
||||
*/
|
||||
validateEvent?: boolean;
|
||||
/**
|
||||
* @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching
|
||||
*/
|
||||
beforeChange?: () => Promise<boolean> | boolean;
|
||||
/**
|
||||
* @description id for input
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* @description tabindex for input
|
||||
*/
|
||||
tabindex?: string | number;
|
||||
/**
|
||||
* @description native `aria-label` attribute
|
||||
*/
|
||||
ariaLabel?: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `SwitchProps` instead.
|
||||
*/
|
||||
declare const switchProps: {
|
||||
readonly ariaLabel: StringConstructor;
|
||||
readonly modelValue: EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
|
||||
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
||||
readonly loading: BooleanConstructor;
|
||||
readonly size: {
|
||||
readonly type: PropType<EpPropMergeType<(new (...args: any[]) => "" | "default" | "small" | "large") | (() => "" | "default" | "small" | "large") | (((new (...args: any[]) => "" | "default" | "small" | "large") | (() => "" | "default" | "small" | "large")) | null)[], unknown, "" | "default" | "small" | "large">>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly width: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
||||
readonly inlinePrompt: BooleanConstructor;
|
||||
readonly inactiveActionIcon: {
|
||||
readonly type: PropType<EpPropMergeType<(new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component) | (((new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component)) | null)[], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly activeActionIcon: {
|
||||
readonly type: PropType<EpPropMergeType<(new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component) | (((new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component)) | null)[], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly activeIcon: {
|
||||
readonly type: PropType<EpPropMergeType<(new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component) | (((new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component)) | null)[], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly inactiveIcon: {
|
||||
readonly type: PropType<EpPropMergeType<(new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component) | (((new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component)) | null)[], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly activeText: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly inactiveText: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly activeValue: EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
|
||||
readonly inactiveValue: EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
|
||||
readonly name: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly validateEvent: 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<EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `SwitchProps` instead.
|
||||
*/
|
||||
type SwitchPropsPublic = ExtractPublicPropTypes<typeof switchProps>;
|
||||
declare const switchEmits: {
|
||||
"update:modelValue": (val: boolean | string | number) => boolean;
|
||||
change: (val: boolean | string | number) => boolean;
|
||||
input: (val: boolean | string | number) => boolean;
|
||||
};
|
||||
type SwitchEmits = typeof switchEmits;
|
||||
type SwitchInstance = InstanceType<typeof _default> & unknown;
|
||||
//#endregion
|
||||
export { SwitchEmits, SwitchInstance, SwitchProps, SwitchPropsPublic, switchEmits, switchProps };
|
||||
140
frontend/node_modules/element-plus/es/components/switch/src/switch.mjs
generated
vendored
Normal file
140
frontend/node_modules/element-plus/es/components/switch/src/switch.mjs
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
import { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
|
||||
import { isBoolean, isNumber, isString } from "../../../utils/types.mjs";
|
||||
import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
|
||||
import { iconPropType } from "../../../utils/vue/icon.mjs";
|
||||
import { isValidComponentSize } from "../../../utils/vue/validator.mjs";
|
||||
import { useAriaProps } from "../../../hooks/use-aria/index.mjs";
|
||||
//#region ../../packages/components/switch/src/switch.ts
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `SwitchProps` instead.
|
||||
*/
|
||||
const switchProps = buildProps({
|
||||
/**
|
||||
* @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type
|
||||
*/
|
||||
modelValue: {
|
||||
type: [
|
||||
Boolean,
|
||||
String,
|
||||
Number
|
||||
],
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* @description whether Switch is disabled
|
||||
*/
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: void 0
|
||||
},
|
||||
/**
|
||||
* @description whether Switch is in loading state
|
||||
*/
|
||||
loading: Boolean,
|
||||
/**
|
||||
* @description size of Switch
|
||||
*/
|
||||
size: {
|
||||
type: String,
|
||||
validator: isValidComponentSize
|
||||
},
|
||||
/**
|
||||
* @description width of Switch
|
||||
*/
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
/**
|
||||
* @description whether icon or text is displayed inside dot, only the first character will be rendered for text
|
||||
*/
|
||||
inlinePrompt: Boolean,
|
||||
/**
|
||||
* @description component of the icon displayed in action when in `off` state
|
||||
*/
|
||||
inactiveActionIcon: { type: iconPropType },
|
||||
/**
|
||||
* @description component of the icon displayed in action when in `on` state
|
||||
*/
|
||||
activeActionIcon: { type: iconPropType },
|
||||
/**
|
||||
* @description component of the icon displayed when in `on` state, overrides `active-text`
|
||||
*/
|
||||
activeIcon: { type: iconPropType },
|
||||
/**
|
||||
* @description component of the icon displayed when in `off` state, overrides `inactive-text`
|
||||
*/
|
||||
inactiveIcon: { type: iconPropType },
|
||||
/**
|
||||
* @description text displayed when in `on` state
|
||||
*/
|
||||
activeText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
/**
|
||||
* @description text displayed when in `off` state
|
||||
*/
|
||||
inactiveText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
/**
|
||||
* @description switch value when in `on` state
|
||||
*/
|
||||
activeValue: {
|
||||
type: [
|
||||
Boolean,
|
||||
String,
|
||||
Number
|
||||
],
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* @description switch value when in `off` state
|
||||
*/
|
||||
inactiveValue: {
|
||||
type: [
|
||||
Boolean,
|
||||
String,
|
||||
Number
|
||||
],
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* @description input name of Switch
|
||||
*/
|
||||
name: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
/**
|
||||
* @description whether to trigger form validation
|
||||
*/
|
||||
validateEvent: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching
|
||||
*/
|
||||
beforeChange: { type: definePropType(Function) },
|
||||
/**
|
||||
* @description id for input
|
||||
*/
|
||||
id: String,
|
||||
/**
|
||||
* @description tabindex for input
|
||||
*/
|
||||
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)
|
||||
};
|
||||
//#endregion
|
||||
export { switchEmits, switchProps };
|
||||
|
||||
//# sourceMappingURL=switch.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/switch/src/switch.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/switch/src/switch.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
55
frontend/node_modules/element-plus/es/components/switch/src/switch.vue.d.ts
generated
vendored
Normal file
55
frontend/node_modules/element-plus/es/components/switch/src/switch.vue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import { SwitchProps } from "./switch.js";
|
||||
import * as _$vue from "vue";
|
||||
|
||||
//#region ../../packages/components/switch/src/switch.vue.d.ts
|
||||
declare var __VLS_1: {}, __VLS_14: {}, __VLS_27: {}, __VLS_51: {}, __VLS_64: {}, __VLS_77: {};
|
||||
type __VLS_Slots = {} & {
|
||||
inactive?: (props: typeof __VLS_1) => any;
|
||||
} & {
|
||||
inactive?: (props: typeof __VLS_14) => any;
|
||||
} & {
|
||||
active?: (props: typeof __VLS_27) => any;
|
||||
} & {
|
||||
'active-action'?: (props: typeof __VLS_51) => any;
|
||||
} & {
|
||||
'inactive-action'?: (props: typeof __VLS_64) => any;
|
||||
} & {
|
||||
active?: (props: typeof __VLS_77) => any;
|
||||
};
|
||||
declare const __VLS_base: _$vue.DefineComponent<SwitchProps, {
|
||||
/**
|
||||
* @description manual focus to the switch component
|
||||
**/
|
||||
focus: () => void;
|
||||
/**
|
||||
* @description whether Switch is checked
|
||||
*/
|
||||
checked: _$vue.ComputedRef<boolean>;
|
||||
}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
|
||||
change: (val: string | number | boolean) => void;
|
||||
"update:modelValue": (val: string | number | boolean) => void;
|
||||
input: (val: string | number | boolean) => void;
|
||||
}, string, _$vue.PublicProps, Readonly<SwitchProps> & Readonly<{
|
||||
"onUpdate:modelValue"?: ((val: string | number | boolean) => any) | undefined;
|
||||
onChange?: ((val: string | number | boolean) => any) | undefined;
|
||||
onInput?: ((val: string | number | boolean) => any) | undefined;
|
||||
}>, {
|
||||
name: string;
|
||||
disabled: boolean;
|
||||
modelValue: boolean | string | number;
|
||||
validateEvent: boolean;
|
||||
width: string | number;
|
||||
activeText: string;
|
||||
inactiveText: string;
|
||||
activeValue: boolean | string | number;
|
||||
inactiveValue: boolean | string | number;
|
||||
}, {}, {}, {}, 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 };
|
||||
202
frontend/node_modules/element-plus/es/components/switch/src/switch.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
202
frontend/node_modules/element-plus/es/components/switch/src/switch.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
import { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
|
||||
import { isBoolean, isPromise } from "../../../utils/types.mjs";
|
||||
import { debugWarn, throwError } from "../../../utils/error.mjs";
|
||||
import { addUnit } from "../../../utils/dom/style.mjs";
|
||||
import { NOOP } from "../../../utils/functions.mjs";
|
||||
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
|
||||
import { ElIcon } from "../../icon/index.mjs";
|
||||
import { useFormDisabled, useFormSize } from "../../form/src/hooks/use-form-common-props.mjs";
|
||||
import { useFormItem, useFormItemInputId } from "../../form/src/hooks/use-form-item.mjs";
|
||||
import { switchEmits, switchProps } from "./switch.mjs";
|
||||
import { Loading } from "@element-plus/icons-vue";
|
||||
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, unref, watch, withCtx, withKeys, withModifiers } from "vue";
|
||||
//#region ../../packages/components/switch/src/switch.vue?vue&type=script&setup=true&lang.ts
|
||||
const _hoisted_1 = [
|
||||
"id",
|
||||
"aria-checked",
|
||||
"aria-disabled",
|
||||
"aria-label",
|
||||
"name",
|
||||
"true-value",
|
||||
"false-value",
|
||||
"disabled",
|
||||
"tabindex"
|
||||
];
|
||||
const _hoisted_2 = ["aria-hidden"];
|
||||
const _hoisted_3 = { key: 1 };
|
||||
const _hoisted_4 = { key: 1 };
|
||||
const _hoisted_5 = ["aria-hidden"];
|
||||
const COMPONENT_NAME = "ElSwitch";
|
||||
var switch_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
||||
name: COMPONENT_NAME,
|
||||
__name: "switch",
|
||||
props: switchProps,
|
||||
emits: switchEmits,
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const { formItem } = useFormItem();
|
||||
const switchSize = useFormSize();
|
||||
const ns = useNamespace("switch");
|
||||
const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
|
||||
const switchDisabled = useFormDisabled(computed(() => {
|
||||
if (props.loading) return true;
|
||||
}));
|
||||
const isControlled = ref(props.modelValue !== false);
|
||||
const input = shallowRef();
|
||||
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) => {
|
||||
input.value.checked = val;
|
||||
if (props.validateEvent) formItem?.validate?.("change").catch(NOOP);
|
||||
});
|
||||
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();
|
||||
if (![isPromise(shouldChange), isBoolean(shouldChange)].includes(true)) throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
|
||||
if (isPromise(shouldChange)) shouldChange.then((result) => {
|
||||
if (result) handleChange();
|
||||
}).catch((e) => {
|
||||
debugWarn(COMPONENT_NAME, `some error occurred: ${e}`);
|
||||
});
|
||||
else if (shouldChange) handleChange();
|
||||
};
|
||||
const focus = () => {
|
||||
input.value?.focus?.();
|
||||
};
|
||||
onMounted(() => {
|
||||
input.value.checked = checked.value;
|
||||
});
|
||||
__expose({
|
||||
/**
|
||||
* @description manual focus to the switch component
|
||||
**/
|
||||
focus,
|
||||
/**
|
||||
* @description whether Switch is checked
|
||||
*/
|
||||
checked
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(switchKls.value),
|
||||
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": checked.value,
|
||||
"aria-disabled": unref(switchDisabled),
|
||||
"aria-label": __props.ariaLabel,
|
||||
name: __props.name,
|
||||
"true-value": __props.activeValue,
|
||||
"false-value": __props.inactiveValue,
|
||||
disabled: unref(switchDisabled),
|
||||
tabindex: __props.tabindex,
|
||||
onChange: handleChange,
|
||||
onKeydown: withKeys(switchValue, ["enter"])
|
||||
}, null, 42, _hoisted_1),
|
||||
!__props.inlinePrompt && (__props.inactiveIcon || __props.inactiveText || _ctx.$slots.inactive) ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass(labelLeftKls.value)
|
||||
}, [renderSlot(_ctx.$slots, "inactive", {}, () => [__props.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
||||
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveIcon)))]),
|
||||
_: 1
|
||||
})) : createCommentVNode("v-if", true), !__props.inactiveIcon && __props.inactiveText ? (openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
"aria-hidden": checked.value
|
||||
}, toDisplayString(__props.inactiveText), 9, _hoisted_2)) : createCommentVNode("v-if", true)])], 2)) : createCommentVNode("v-if", true),
|
||||
createElementVNode("span", {
|
||||
class: normalizeClass(unref(ns).e("core")),
|
||||
style: normalizeStyle(coreStyle.value)
|
||||
}, [__props.inlinePrompt ? (openBlock(), createElementBlock("div", {
|
||||
key: 0,
|
||||
class: normalizeClass(unref(ns).e("inner"))
|
||||
}, [!checked.value ? (openBlock(), createElementBlock("div", {
|
||||
key: 0,
|
||||
class: normalizeClass(unref(ns).e("inner-wrapper"))
|
||||
}, [renderSlot(_ctx.$slots, "inactive", {}, () => [__props.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
||||
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveIcon)))]),
|
||||
_: 1
|
||||
})) : createCommentVNode("v-if", true), !__props.inactiveIcon && __props.inactiveText ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.inactiveText), 1)) : createCommentVNode("v-if", true)])], 2)) : (openBlock(), createElementBlock("div", {
|
||||
key: 1,
|
||||
class: normalizeClass(unref(ns).e("inner-wrapper"))
|
||||
}, [renderSlot(_ctx.$slots, "active", {}, () => [__props.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
||||
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeIcon)))]),
|
||||
_: 1
|
||||
})) : createCommentVNode("v-if", true), !__props.activeIcon && __props.activeText ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.activeText), 1)) : createCommentVNode("v-if", true)])], 2))], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("action")) }, [__props.loading ? (openBlock(), createBlock(unref(ElIcon), {
|
||||
key: 0,
|
||||
class: normalizeClass(unref(ns).is("loading"))
|
||||
}, {
|
||||
default: withCtx(() => [createVNode(unref(Loading))]),
|
||||
_: 1
|
||||
}, 8, ["class"])) : checked.value ? renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [__props.activeActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
||||
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeActionIcon)))]),
|
||||
_: 1
|
||||
})) : createCommentVNode("v-if", true)]) : !checked.value ? renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [__props.inactiveActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
||||
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveActionIcon)))]),
|
||||
_: 1
|
||||
})) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true)], 2)], 6),
|
||||
!__props.inlinePrompt && (__props.activeIcon || __props.activeText || _ctx.$slots.active) ? (openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
class: normalizeClass(labelRightKls.value)
|
||||
}, [renderSlot(_ctx.$slots, "active", {}, () => [__props.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
||||
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeIcon)))]),
|
||||
_: 1
|
||||
})) : createCommentVNode("v-if", true), !__props.activeIcon && __props.activeText ? (openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
"aria-hidden": !checked.value
|
||||
}, toDisplayString(__props.activeText), 9, _hoisted_5)) : createCommentVNode("v-if", true)])], 2)) : createCommentVNode("v-if", true)
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
export { switch_vue_vue_type_script_setup_true_lang_default as default };
|
||||
|
||||
//# sourceMappingURL=switch.vue_vue_type_script_setup_true_lang.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/switch/src/switch.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/switch/src/switch.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
frontend/node_modules/element-plus/es/components/switch/src/switch2.mjs
generated
vendored
Normal file
7
frontend/node_modules/element-plus/es/components/switch/src/switch2.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import switch_vue_vue_type_script_setup_true_lang_default from "./switch.vue_vue_type_script_setup_true_lang.mjs";
|
||||
//#region ../../packages/components/switch/src/switch.vue
|
||||
var switch_default = switch_vue_vue_type_script_setup_true_lang_default;
|
||||
//#endregion
|
||||
export { switch_default as default };
|
||||
|
||||
//# sourceMappingURL=switch2.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/switch/src/switch2.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/switch/src/switch2.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
frontend/node_modules/element-plus/es/components/switch/style/css.mjs
generated
vendored
Normal file
2
frontend/node_modules/element-plus/es/components/switch/style/css.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import "../../base/style/css.mjs";
|
||||
import "element-plus/theme-chalk/el-switch.css";
|
||||
2
frontend/node_modules/element-plus/es/components/switch/style/index.mjs
generated
vendored
Normal file
2
frontend/node_modules/element-plus/es/components/switch/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import "../../base/style/index.mjs";
|
||||
import "element-plus/theme-chalk/src/switch.scss";
|
||||
Reference in New Issue
Block a user