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,159 @@
export declare const ElSegmented: import("element-plus/es/utils").SFCWithInstall<{
new (...args: any[]): {
$: import("vue").ComponentInternalInstance;
$data: {};
$props: Partial<{
disabled: boolean;
direction: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown>;
block: boolean;
props: import("./src/segmented").Props;
modelValue: import("element-plus/es/utils").EpPropMergeType<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
options: import("./src/types.js").Option[];
validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
ariaLabel: StringConstructor;
direction: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown, string, boolean>;
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]) | ((new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]))[], unknown, unknown, () => never[], boolean>;
modelValue: import("element-plus/es/utils").EpPropFinalized<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown, undefined, boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props) | ((new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props))[], unknown, unknown, () => Required<import("./src/segmented").Props>, boolean>;
block: BooleanConstructor;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: BooleanConstructor;
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
id: StringConstructor;
name: StringConstructor;
}>> & {
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
onChange?: ((val: any) => any) | undefined;
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "direction" | "block" | "props" | "modelValue" | "options" | "validateEvent">;
$attrs: {
[x: string]: unknown;
};
$refs: {
[x: string]: unknown;
};
$slots: import("vue").Slots;
$root: import("vue").ComponentPublicInstance | null;
$parent: import("vue").ComponentPublicInstance | null;
$emit: ((event: "update:modelValue", val: any) => void) & ((event: "change", val: any) => void);
$el: any;
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
ariaLabel: StringConstructor;
direction: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown, string, boolean>;
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]) | ((new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]))[], unknown, unknown, () => never[], boolean>;
modelValue: import("element-plus/es/utils").EpPropFinalized<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown, undefined, boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props) | ((new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props))[], unknown, unknown, () => Required<import("./src/segmented").Props>, boolean>;
block: BooleanConstructor;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: BooleanConstructor;
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
id: StringConstructor;
name: StringConstructor;
}>> & {
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
onChange?: ((val: any) => any) | undefined;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
"update:modelValue": (val: any) => void;
change: (val: any) => void;
}, string, {
disabled: boolean;
direction: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown>;
block: boolean;
props: import("./src/segmented").Props;
modelValue: import("element-plus/es/utils").EpPropMergeType<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
options: import("./src/types.js").Option[];
validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
}> & {
beforeCreate?: (() => void) | (() => void)[];
created?: (() => void) | (() => void)[];
beforeMount?: (() => void) | (() => void)[];
mounted?: (() => void) | (() => void)[];
beforeUpdate?: (() => void) | (() => void)[];
updated?: (() => void) | (() => void)[];
activated?: (() => void) | (() => void)[];
deactivated?: (() => void) | (() => void)[];
beforeDestroy?: (() => void) | (() => void)[];
beforeUnmount?: (() => void) | (() => void)[];
destroyed?: (() => void) | (() => void)[];
unmounted?: (() => void) | (() => void)[];
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
};
$forceUpdate: () => void;
$nextTick: typeof import("vue").nextTick;
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
} & Readonly<import("vue").ExtractPropTypes<{
ariaLabel: StringConstructor;
direction: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown, string, boolean>;
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]) | ((new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]))[], unknown, unknown, () => never[], boolean>;
modelValue: import("element-plus/es/utils").EpPropFinalized<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown, undefined, boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props) | ((new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props))[], unknown, unknown, () => Required<import("./src/segmented").Props>, boolean>;
block: BooleanConstructor;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: BooleanConstructor;
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
id: StringConstructor;
name: StringConstructor;
}>> & {
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
onChange?: ((val: any) => any) | undefined;
} & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
__isFragment?: never;
__isTeleport?: never;
__isSuspense?: never;
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
ariaLabel: StringConstructor;
direction: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown, string, boolean>;
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]) | ((new (...args: any[]) => import("./src/types.js").Option[]) | (() => import("./src/types.js").Option[]))[], unknown, unknown, () => never[], boolean>;
modelValue: import("element-plus/es/utils").EpPropFinalized<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown, undefined, boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props) | ((new (...args: any[]) => import("./src/segmented").Props) | (() => import("./src/segmented").Props))[], unknown, unknown, () => Required<import("./src/segmented").Props>, boolean>;
block: BooleanConstructor;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: BooleanConstructor;
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
id: StringConstructor;
name: StringConstructor;
}>> & {
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
onChange?: ((val: any) => any) | undefined;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
"update:modelValue": (val: any) => void;
change: (val: any) => void;
}, string, {
disabled: boolean;
direction: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown>;
block: boolean;
props: import("./src/segmented").Props;
modelValue: import("element-plus/es/utils").EpPropMergeType<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
options: import("./src/types.js").Option[];
validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
$slots: {
default?(_: {
item: any;
}): any;
};
})> & Record<string, any>;
export default ElSegmented;
export * from './src/segmented';

View File

@@ -0,0 +1,16 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var segmented$1 = require('./src/segmented2.js');
var segmented = require('./src/segmented.js');
var install = require('../../utils/vue/install.js');
const ElSegmented = install.withInstall(segmented$1["default"]);
exports.defaultProps = segmented.defaultProps;
exports.segmentedEmits = segmented.segmentedEmits;
exports.segmentedProps = segmented.segmentedProps;
exports.ElSegmented = ElSegmented;
exports["default"] = ElSegmented;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/components/segmented/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Segmented from './src/segmented.vue'\n\nexport const ElSegmented = withInstall(Segmented)\nexport default ElSegmented\n\nexport * from './src/segmented'\n"],"names":["withInstall","Segmented"],"mappings":";;;;;;;;AAEY,MAAC,WAAW,GAAGA,mBAAW,CAACC,sBAAS;;;;;;;;"}

View File

@@ -0,0 +1,35 @@
import type { Option } from './types';
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Segmented from './segmented.vue';
export interface Props {
label?: string;
value?: string;
disabled?: string;
}
export declare const defaultProps: Required<Props>;
export declare const segmentedProps: {
ariaLabel: StringConstructor;
direction: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown, string, boolean>;
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => Option[]) | (() => Option[]) | ((new (...args: any[]) => Option[]) | (() => Option[]))[], unknown, unknown, () => never[], boolean>;
modelValue: import("element-plus/es/utils").EpPropFinalized<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown, undefined, boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => Props) | (() => Props) | ((new (...args: any[]) => Props) | (() => Props))[], unknown, unknown, () => Required<Props>, boolean>;
block: BooleanConstructor;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: BooleanConstructor;
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
id: StringConstructor;
name: StringConstructor;
};
export type SegmentedProps = ExtractPropTypes<typeof segmentedProps>;
export type SegmentedPropsPublic = __ExtractPublicPropTypes<typeof segmentedProps>;
export declare const segmentedEmits: {
"update:modelValue": (val: any) => val is string | number | boolean;
change: (val: any) => val is string | number | boolean;
};
export type SegmentedEmits = typeof segmentedEmits;
export type SegmentedInstance = InstanceType<typeof Segmented> & unknown;

View File

@@ -0,0 +1,53 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var runtime = require('../../../utils/vue/props/runtime.js');
var index = require('../../../hooks/use-size/index.js');
var index$1 = require('../../../hooks/use-aria/index.js');
var event = require('../../../constants/event.js');
var shared = require('@vue/shared');
var types = require('../../../utils/types.js');
const defaultProps = {
label: "label",
value: "value",
disabled: "disabled"
};
const segmentedProps = runtime.buildProps({
direction: {
type: runtime.definePropType(String),
default: "horizontal"
},
options: {
type: runtime.definePropType(Array),
default: () => []
},
modelValue: {
type: [String, Number, Boolean],
default: void 0
},
props: {
type: runtime.definePropType(Object),
default: () => defaultProps
},
block: Boolean,
size: index.useSizeProp,
disabled: Boolean,
validateEvent: {
type: Boolean,
default: true
},
id: String,
name: String,
...index$1.useAriaProps(["ariaLabel"])
});
const segmentedEmits = {
[event.UPDATE_MODEL_EVENT]: (val) => shared.isString(val) || types.isNumber(val) || types.isBoolean(val),
[event.CHANGE_EVENT]: (val) => shared.isString(val) || types.isNumber(val) || types.isBoolean(val)
};
exports.defaultProps = defaultProps;
exports.segmentedEmits = segmentedEmits;
exports.segmentedProps = segmentedProps;
//# sourceMappingURL=segmented.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"segmented.js","sources":["../../../../../../packages/components/segmented/src/segmented.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isBoolean,\n isNumber,\n isString,\n} from '@element-plus/utils'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\n\nimport type { Option } from './types'\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Segmented from './segmented.vue'\n\nexport interface Props {\n label?: string\n value?: string\n disabled?: string\n}\n\nexport const defaultProps: Required<Props> = {\n label: 'label',\n value: 'value',\n disabled: 'disabled',\n}\n\nexport const segmentedProps = buildProps({\n direction: {\n type: definePropType<'vertical' | 'horizontal'>(String),\n default: 'horizontal',\n },\n /**\n * @description options of segmented\n */\n options: {\n type: definePropType<Option[]>(Array),\n default: () => [],\n },\n /**\n * @description binding value\n */\n modelValue: {\n type: [String, Number, Boolean],\n default: undefined,\n },\n /**\n * @description configuration options, see the following table\n */\n props: {\n type: definePropType<Props>(Object),\n default: () => defaultProps,\n },\n /**\n * @description fit width of parent content\n */\n block: Boolean,\n /**\n * @description size of component\n */\n size: useSizeProp,\n /**\n * @description whether segmented is disabled\n */\n disabled: Boolean,\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n /**\n * @description native input id\n */\n id: String,\n /**\n * @description native `name` attribute\n */\n name: String,\n ...useAriaProps(['ariaLabel']),\n})\n\nexport type SegmentedProps = ExtractPropTypes<typeof segmentedProps>\nexport type SegmentedPropsPublic = __ExtractPublicPropTypes<\n typeof segmentedProps\n>\n\nexport const segmentedEmits = {\n [UPDATE_MODEL_EVENT]: (val: any) =>\n isString(val) || isNumber(val) || isBoolean(val),\n [CHANGE_EVENT]: (val: any) =>\n isString(val) || isNumber(val) || isBoolean(val),\n}\nexport type SegmentedEmits = typeof segmentedEmits\n\nexport type SegmentedInstance = InstanceType<typeof Segmented> & unknown\n"],"names":["buildProps","definePropType","useSizeProp","useAriaProps","UPDATE_MODEL_EVENT","isString","isNumber","isBoolean","CHANGE_EVENT"],"mappings":";;;;;;;;;;;AASY,MAAC,YAAY,GAAG;AAC5B,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,QAAQ,EAAE,UAAU;AACtB,EAAE;AACU,MAAC,cAAc,GAAGA,kBAAU,CAAC;AACzC,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAEC,sBAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,YAAY;AACzB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAEA,sBAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAEA,sBAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,MAAM,YAAY;AAC/B,GAAG;AACH,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,IAAI,EAAEC,iBAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,EAAE,EAAE,MAAM;AACZ,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,GAAGC,oBAAY,CAAC,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC,EAAE;AACS,MAAC,cAAc,GAAG;AAC9B,EAAE,CAACC,wBAAkB,GAAG,CAAC,GAAG,KAAKC,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC,IAAIC,eAAS,CAAC,GAAG,CAAC;AACjF,EAAE,CAACC,kBAAY,GAAG,CAAC,GAAG,KAAKH,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC,IAAIC,eAAS,CAAC,GAAG,CAAC;AAC3E;;;;;;"}

View File

@@ -0,0 +1,62 @@
import type { Option } from './types';
declare function __VLS_template(): {
default?(_: {
item: any;
}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
ariaLabel: StringConstructor;
direction: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown, string, boolean>;
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => Option[]) | (() => Option[]) | ((new (...args: any[]) => Option[]) | (() => Option[]))[], unknown, unknown, () => never[], boolean>;
modelValue: import("element-plus/es/utils").EpPropFinalized<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown, undefined, boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./segmented").Props) | (() => import("./segmented").Props) | ((new (...args: any[]) => import("./segmented").Props) | (() => import("./segmented").Props))[], unknown, unknown, () => Required<import("./segmented").Props>, boolean>;
block: BooleanConstructor;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: BooleanConstructor;
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
id: StringConstructor;
name: StringConstructor;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
"update:modelValue": (val: any) => void;
change: (val: any) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
ariaLabel: StringConstructor;
direction: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown, string, boolean>;
options: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => Option[]) | (() => Option[]) | ((new (...args: any[]) => Option[]) | (() => Option[]))[], unknown, unknown, () => never[], boolean>;
modelValue: import("element-plus/es/utils").EpPropFinalized<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown, undefined, boolean>;
props: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./segmented").Props) | (() => import("./segmented").Props) | ((new (...args: any[]) => import("./segmented").Props) | (() => import("./segmented").Props))[], unknown, unknown, () => Required<import("./segmented").Props>, boolean>;
block: BooleanConstructor;
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
disabled: BooleanConstructor;
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
id: StringConstructor;
name: StringConstructor;
}>> & {
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
onChange?: ((val: any) => any) | undefined;
}, {
disabled: boolean;
direction: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown>;
block: boolean;
props: import("./segmented").Props;
modelValue: import("element-plus/es/utils").EpPropMergeType<(BooleanConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
options: Option[];
validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
}>;
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,179 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
var segmented = require('./segmented.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
var index = require('../../../hooks/use-namespace/index.js');
var index$1 = require('../../../hooks/use-id/index.js');
var useFormCommonProps = require('../../form/src/hooks/use-form-common-props.js');
var useFormItem = require('../../form/src/hooks/use-form-item.js');
var shared = require('@vue/shared');
var error = require('../../../utils/error.js');
var event = require('../../../constants/event.js');
const __default__ = vue.defineComponent({
name: "ElSegmented"
});
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: segmented.segmentedProps,
emits: segmented.segmentedEmits,
setup(__props, { emit }) {
const props = __props;
const ns = index.useNamespace("segmented");
const segmentedId = index$1.useId();
const segmentedSize = useFormCommonProps.useFormSize();
const _disabled = useFormCommonProps.useFormDisabled();
const { formItem } = useFormItem.useFormItem();
const { inputId, isLabeledByFormItem } = useFormItem.useFormItemInputId(props, {
formItemContext: formItem
});
const segmentedRef = vue.ref(null);
const activeElement = core.useActiveElement();
const state = vue.reactive({
isInit: false,
width: 0,
height: 0,
translateX: 0,
translateY: 0,
focusVisible: false
});
const handleChange = (item) => {
const value = getValue(item);
emit(event.UPDATE_MODEL_EVENT, value);
emit(event.CHANGE_EVENT, value);
};
const aliasProps = vue.computed(() => ({ ...segmented.defaultProps, ...props.props }));
const intoAny = (item) => item;
const getValue = (item) => {
return shared.isObject(item) ? item[aliasProps.value.value] : item;
};
const getLabel = (item) => {
return shared.isObject(item) ? item[aliasProps.value.label] : item;
};
const getDisabled = (item) => {
return !!(_disabled.value || (shared.isObject(item) ? item[aliasProps.value.disabled] : false));
};
const getSelected = (item) => {
return props.modelValue === getValue(item);
};
const getOption = (value) => {
return props.options.find((item) => getValue(item) === value);
};
const getItemCls = (item) => {
return [
ns.e("item"),
ns.is("selected", getSelected(item)),
ns.is("disabled", getDisabled(item))
];
};
const updateSelect = () => {
if (!segmentedRef.value)
return;
const selectedItem = segmentedRef.value.querySelector(".is-selected");
const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
if (!selectedItem || !selectedItemInput) {
state.width = 0;
state.height = 0;
state.translateX = 0;
state.translateY = 0;
state.focusVisible = false;
return;
}
state.isInit = true;
if (props.direction === "vertical") {
state.height = selectedItem.offsetHeight;
state.translateY = selectedItem.offsetTop;
} else {
state.width = selectedItem.offsetWidth;
state.translateX = selectedItem.offsetLeft;
}
try {
state.focusVisible = selectedItemInput.matches(":focus-visible");
} catch (e) {
}
};
const segmentedCls = vue.computed(() => [
ns.b(),
ns.m(segmentedSize.value),
ns.is("block", props.block)
]);
const selectedStyle = vue.computed(() => ({
width: props.direction === "vertical" ? "100%" : `${state.width}px`,
height: props.direction === "vertical" ? `${state.height}px` : "100%",
transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
display: state.isInit ? "block" : "none"
}));
const selectedCls = vue.computed(() => [
ns.e("item-selected"),
ns.is("disabled", getDisabled(getOption(props.modelValue))),
ns.is("focus-visible", state.focusVisible)
]);
const name = vue.computed(() => {
return props.name || segmentedId.value;
});
core.useResizeObserver(segmentedRef, updateSelect);
vue.watch(activeElement, updateSelect);
vue.watch(() => props.modelValue, () => {
var _a;
updateSelect();
if (props.validateEvent) {
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => error.debugWarn());
}
}, {
flush: "post"
});
return (_ctx, _cache) => {
return _ctx.options.length ? (vue.openBlock(), vue.createElementBlock("div", {
key: 0,
id: vue.unref(inputId),
ref_key: "segmentedRef",
ref: segmentedRef,
class: vue.normalizeClass(vue.unref(segmentedCls)),
role: "radiogroup",
"aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
"aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
}, [
vue.createElementVNode("div", {
class: vue.normalizeClass([vue.unref(ns).e("group"), vue.unref(ns).m(props.direction)])
}, [
vue.createElementVNode("div", {
style: vue.normalizeStyle(vue.unref(selectedStyle)),
class: vue.normalizeClass(vue.unref(selectedCls))
}, null, 6),
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
return vue.openBlock(), vue.createElementBlock("label", {
key: index,
class: vue.normalizeClass(getItemCls(item))
}, [
vue.createElementVNode("input", {
class: vue.normalizeClass(vue.unref(ns).e("item-input")),
type: "radio",
name: vue.unref(name),
disabled: getDisabled(item),
checked: getSelected(item),
onChange: ($event) => handleChange(item)
}, null, 42, ["name", "disabled", "checked", "onChange"]),
vue.createElementVNode("div", {
class: vue.normalizeClass(vue.unref(ns).e("item-label"))
}, [
vue.renderSlot(_ctx.$slots, "default", {
item: intoAny(item)
}, () => [
vue.createTextVNode(vue.toDisplayString(getLabel(item)), 1)
])
], 2)
], 2);
}), 128))
], 2)
], 10, ["id", "aria-label", "aria-labelledby"])) : vue.createCommentVNode("v-if", true);
};
}
});
var Segmented = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "segmented.vue"]]);
exports["default"] = Segmented;
//# sourceMappingURL=segmented2.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export type Option = Record<string, any> | string | number | boolean;

View File

@@ -0,0 +1,3 @@
'use strict';
//# sourceMappingURL=types.js.map

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
'use strict';
require('../../base/style/css.js');
require('element-plus/theme-chalk/el-segmented.css');
//# sourceMappingURL=css.js.map

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
'use strict';
require('../../base/style/index.js');
require('element-plus/theme-chalk/src/segmented.scss');
//# sourceMappingURL=index.js.map

View File

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