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,10 @@
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
export { _export_sfc as default };
//# sourceMappingURL=plugin-vue_export-helper.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"plugin-vue_export-helper.mjs","sources":["../../../../internal/build/plugin-vue:export-helper"],"sourcesContent":["\nexport default (sfc, props) => {\n const target = sfc.__vccOpts || sfc;\n for (const [key, val] of props) {\n target[key] = val;\n }\n return target;\n}\n"],"names":[],"mappings":"AACA,kBAAe,CAAC,GAAG,EAAE,KAAK,KAAK;AAC/B,EAAE,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC;AACtC,EAAE,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,KAAK,EAAE;AAClC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACtB,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}

3
node_modules/element-plus/es/component.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { Plugin } from 'vue';
declare const _default: Plugin[];
export default _default;

196
node_modules/element-plus/es/component.mjs generated vendored Normal file
View File

@@ -0,0 +1,196 @@
import { ElAffix } from './components/affix/index.mjs';
import { ElAlert } from './components/alert/index.mjs';
import { ElAutocomplete } from './components/autocomplete/index.mjs';
import { ElAvatar } from './components/avatar/index.mjs';
import { ElBacktop } from './components/backtop/index.mjs';
import { ElBadge } from './components/badge/index.mjs';
import { ElBreadcrumb, ElBreadcrumbItem } from './components/breadcrumb/index.mjs';
import { ElButton, ElButtonGroup } from './components/button/index.mjs';
import { ElCalendar } from './components/calendar/index.mjs';
import { ElCard } from './components/card/index.mjs';
import { ElCarousel, ElCarouselItem } from './components/carousel/index.mjs';
import { ElCascader } from './components/cascader/index.mjs';
import { ElCascaderPanel } from './components/cascader-panel/index.mjs';
import { ElCheckTag } from './components/check-tag/index.mjs';
import { ElCheckbox, ElCheckboxButton, ElCheckboxGroup } from './components/checkbox/index.mjs';
import { ElCol } from './components/col/index.mjs';
import { ElCollapse, ElCollapseItem } from './components/collapse/index.mjs';
import { ElCollapseTransition } from './components/collapse-transition/index.mjs';
import { ElColorPickerPanel } from './components/color-picker-panel/index.mjs';
import { ElColorPicker } from './components/color-picker/index.mjs';
import { ElConfigProvider } from './components/config-provider/index.mjs';
import { ElContainer, ElAside, ElFooter, ElHeader, ElMain } from './components/container/index.mjs';
import { ElDatePicker } from './components/date-picker/index.mjs';
import { ElDatePickerPanel } from './components/date-picker-panel/index.mjs';
import { ElDescriptions, ElDescriptionsItem } from './components/descriptions/index.mjs';
import { ElDialog } from './components/dialog/index.mjs';
import { ElDivider } from './components/divider/index.mjs';
import { ElDrawer } from './components/drawer/index.mjs';
import { ElDropdown, ElDropdownItem, ElDropdownMenu } from './components/dropdown/index.mjs';
import { ElEmpty } from './components/empty/index.mjs';
import { ElForm, ElFormItem } from './components/form/index.mjs';
import { ElIcon } from './components/icon/index.mjs';
import { ElImage } from './components/image/index.mjs';
import { ElImageViewer } from './components/image-viewer/index.mjs';
import { ElInput } from './components/input/index.mjs';
import { ElInputNumber } from './components/input-number/index.mjs';
import { ElInputTag } from './components/input-tag/index.mjs';
import { ElLink } from './components/link/index.mjs';
import { ElMenu, ElMenuItem, ElMenuItemGroup, ElSubMenu } from './components/menu/index.mjs';
import { ElPageHeader } from './components/page-header/index.mjs';
import { ElPagination } from './components/pagination/index.mjs';
import { ElPopconfirm } from './components/popconfirm/index.mjs';
import { ElPopover } from './components/popover/index.mjs';
import { ElPopper } from './components/popper/index.mjs';
import { ElProgress } from './components/progress/index.mjs';
import { ElRadio, ElRadioButton, ElRadioGroup } from './components/radio/index.mjs';
import { ElRate } from './components/rate/index.mjs';
import { ElResult } from './components/result/index.mjs';
import { ElRow } from './components/row/index.mjs';
import { ElScrollbar } from './components/scrollbar/index.mjs';
import { ElSelect, ElOption, ElOptionGroup } from './components/select/index.mjs';
import { ElSelectV2 } from './components/select-v2/index.mjs';
import { ElSkeleton, ElSkeletonItem } from './components/skeleton/index.mjs';
import { ElSlider } from './components/slider/index.mjs';
import { ElSpace } from './components/space/index.mjs';
import { ElStatistic } from './components/statistic/index.mjs';
import { ElCountdown } from './components/countdown/index.mjs';
import { ElSteps, ElStep } from './components/steps/index.mjs';
import { ElSwitch } from './components/switch/index.mjs';
import { ElTable, ElTableColumn } from './components/table/index.mjs';
import { ElAutoResizer, ElTableV2 } from './components/table-v2/index.mjs';
import { ElTabs, ElTabPane } from './components/tabs/index.mjs';
import { ElTag } from './components/tag/index.mjs';
import { ElText } from './components/text/index.mjs';
import { ElTimePicker } from './components/time-picker/index.mjs';
import { ElTimeSelect } from './components/time-select/index.mjs';
import { ElTimeline, ElTimelineItem } from './components/timeline/index.mjs';
import { ElTooltip } from './components/tooltip/index.mjs';
import { ElTooltipV2 } from './components/tooltip-v2/index.mjs';
import { ElTransfer } from './components/transfer/index.mjs';
import { ElTree } from './components/tree/index.mjs';
import { ElTreeSelect } from './components/tree-select/index.mjs';
import { ElTreeV2 } from './components/tree-v2/index.mjs';
import { ElUpload } from './components/upload/index.mjs';
import { ElWatermark } from './components/watermark/index.mjs';
import { ElTour, ElTourStep } from './components/tour/index.mjs';
import { ElAnchor, ElAnchorLink } from './components/anchor/index.mjs';
import { ElSegmented } from './components/segmented/index.mjs';
import { ElMention } from './components/mention/index.mjs';
import { ElSplitter, ElSplitterPanel } from './components/splitter/index.mjs';
var Components = [
ElAffix,
ElAlert,
ElAutocomplete,
ElAutoResizer,
ElAvatar,
ElBacktop,
ElBadge,
ElBreadcrumb,
ElBreadcrumbItem,
ElButton,
ElButtonGroup,
ElCalendar,
ElCard,
ElCarousel,
ElCarouselItem,
ElCascader,
ElCascaderPanel,
ElCheckTag,
ElCheckbox,
ElCheckboxButton,
ElCheckboxGroup,
ElCol,
ElCollapse,
ElCollapseItem,
ElCollapseTransition,
ElColorPickerPanel,
ElColorPicker,
ElConfigProvider,
ElContainer,
ElAside,
ElFooter,
ElHeader,
ElMain,
ElDatePicker,
ElDatePickerPanel,
ElDescriptions,
ElDescriptionsItem,
ElDialog,
ElDivider,
ElDrawer,
ElDropdown,
ElDropdownItem,
ElDropdownMenu,
ElEmpty,
ElForm,
ElFormItem,
ElIcon,
ElImage,
ElImageViewer,
ElInput,
ElInputNumber,
ElInputTag,
ElLink,
ElMenu,
ElMenuItem,
ElMenuItemGroup,
ElSubMenu,
ElPageHeader,
ElPagination,
ElPopconfirm,
ElPopover,
ElPopper,
ElProgress,
ElRadio,
ElRadioButton,
ElRadioGroup,
ElRate,
ElResult,
ElRow,
ElScrollbar,
ElSelect,
ElOption,
ElOptionGroup,
ElSelectV2,
ElSkeleton,
ElSkeletonItem,
ElSlider,
ElSpace,
ElStatistic,
ElCountdown,
ElSteps,
ElStep,
ElSwitch,
ElTable,
ElTableColumn,
ElTableV2,
ElTabs,
ElTabPane,
ElTag,
ElText,
ElTimePicker,
ElTimeSelect,
ElTimeline,
ElTimelineItem,
ElTooltip,
ElTooltipV2,
ElTransfer,
ElTree,
ElTreeSelect,
ElTreeV2,
ElUpload,
ElWatermark,
ElTour,
ElTourStep,
ElAnchor,
ElAnchorLink,
ElSegmented,
ElMention,
ElSplitter,
ElSplitterPanel
];
export { Components as default };
//# sourceMappingURL=component.mjs.map

1
node_modules/element-plus/es/component.mjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -0,0 +1,8 @@
import Affix from './src/affix2.mjs';
export { affixEmits, affixProps } from './src/affix.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElAffix = withInstall(Affix);
export { ElAffix, ElAffix as default };
//# sourceMappingURL=index.mjs.map

View File

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

View File

@@ -0,0 +1,20 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type { ZIndexProperty } from 'csstype';
import type Affix from './affix.vue';
export declare const affixProps: {
readonly zIndex: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => ZIndexProperty) | ((new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => ZIndexProperty))[], unknown, unknown, 100, boolean>;
readonly target: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly position: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "top" | "bottom", unknown, "top", boolean>;
};
export type AffixProps = ExtractPropTypes<typeof affixProps>;
export type AffixPropsPublic = __ExtractPublicPropTypes<typeof affixProps>;
export declare const affixEmits: {
scroll: ({ scrollTop, fixed }: {
scrollTop: number;
fixed: boolean;
}) => boolean;
change: (fixed: boolean) => boolean;
};
export type AffixEmits = typeof affixEmits;
export type AffixInstance = InstanceType<typeof Affix> & unknown;

View File

@@ -0,0 +1,30 @@
import { CHANGE_EVENT } from '../../../constants/event.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { isNumber, isBoolean } from '../../../utils/types.mjs';
const affixProps = buildProps({
zIndex: {
type: definePropType([Number, String]),
default: 100
},
target: {
type: String,
default: ""
},
offset: {
type: Number,
default: 0
},
position: {
type: String,
values: ["top", "bottom"],
default: "top"
}
});
const affixEmits = {
scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
[CHANGE_EVENT]: (fixed) => isBoolean(fixed)
};
export { affixEmits, affixProps };
//# sourceMappingURL=affix.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"affix.mjs","sources":["../../../../../../packages/components/affix/src/affix.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isBoolean,\n isNumber,\n} from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type { ZIndexProperty } from 'csstype'\nimport type Affix from './affix.vue'\n\nexport const affixProps = buildProps({\n /**\n * @description affix element zIndex value\n * */\n zIndex: {\n type: definePropType<ZIndexProperty>([Number, String]),\n default: 100,\n },\n /**\n * @description target container. (CSS selector)\n */\n target: {\n type: String,\n default: '',\n },\n /**\n * @description offset distance\n * */\n offset: {\n type: Number,\n default: 0,\n },\n /**\n * @description position of affix\n * */\n position: {\n type: String,\n values: ['top', 'bottom'],\n default: 'top',\n },\n} as const)\nexport type AffixProps = ExtractPropTypes<typeof affixProps>\nexport type AffixPropsPublic = __ExtractPublicPropTypes<typeof affixProps>\n\nexport const affixEmits = {\n scroll: ({ scrollTop, fixed }: { scrollTop: number; fixed: boolean }) =>\n isNumber(scrollTop) && isBoolean(fixed),\n [CHANGE_EVENT]: (fixed: boolean) => isBoolean(fixed),\n}\nexport type AffixEmits = typeof affixEmits\n\nexport type AffixInstance = InstanceType<typeof Affix> & unknown\n"],"names":[],"mappings":";;;;AAOY,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC7B,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,UAAU,GAAG;AAC1B,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC;AAC3E,EAAE,CAAC,YAAY,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK,CAAC;AAC7C;;;;"}

View File

@@ -0,0 +1,44 @@
declare function __VLS_template(): {
default?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly zIndex: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => import("csstype").ZIndexProperty) | ((new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => import("csstype").ZIndexProperty))[], unknown, unknown, 100, boolean>;
readonly target: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly position: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "top" | "bottom", unknown, "top", boolean>;
}, {
/** @description update affix status */
update: () => void;
/** @description update rootRect info */
updateRoot: () => Promise<void>;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
scroll: (args_0: {
scrollTop: number;
fixed: boolean;
}) => void;
change: (fixed: boolean) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly zIndex: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => import("csstype").ZIndexProperty) | ((new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => import("csstype").ZIndexProperty))[], unknown, unknown, 100, boolean>;
readonly target: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly position: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "top" | "bottom", unknown, "top", boolean>;
}>> & {
onScroll?: ((args_0: {
scrollTop: number;
fixed: boolean;
}) => any) | undefined;
onChange?: ((fixed: boolean) => any) | undefined;
}, {
readonly position: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "top" | "bottom", unknown>;
readonly zIndex: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => import("csstype").ZIndexProperty) | ((new (...args: any[]) => number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "auto") | (() => import("csstype").ZIndexProperty))[], unknown, unknown>;
readonly offset: number;
readonly target: string;
}>;
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,135 @@
import { defineComponent, shallowRef, ref, computed, watch, onMounted, watchEffect, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createElementVNode, renderSlot, nextTick } from 'vue';
import { useWindowSize, useElementBounding, useEventListener } from '@vueuse/core';
import { affixProps, affixEmits } from './affix.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { getScrollContainer } from '../../../utils/dom/scroll.mjs';
import { addUnit } from '../../../utils/dom/style.mjs';
import { CHANGE_EVENT } from '../../../constants/event.mjs';
import { throwError } from '../../../utils/error.mjs';
const COMPONENT_NAME = "ElAffix";
const __default__ = defineComponent({
name: COMPONENT_NAME
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: affixProps,
emits: affixEmits,
setup(__props, { expose, emit }) {
const props = __props;
const ns = useNamespace("affix");
const target = shallowRef();
const root = shallowRef();
const scrollContainer = shallowRef();
const { height: windowHeight } = useWindowSize();
const {
height: rootHeight,
width: rootWidth,
top: rootTop,
bottom: rootBottom,
update: updateRoot
} = useElementBounding(root, { windowScroll: false });
const targetRect = useElementBounding(target);
const fixed = ref(false);
const scrollTop = ref(0);
const transform = ref(0);
const rootStyle = computed(() => {
return {
height: fixed.value ? `${rootHeight.value}px` : "",
width: fixed.value ? `${rootWidth.value}px` : ""
};
});
const affixStyle = computed(() => {
if (!fixed.value)
return {};
const offset = props.offset ? addUnit(props.offset) : 0;
return {
height: `${rootHeight.value}px`,
width: `${rootWidth.value}px`,
top: props.position === "top" ? offset : "",
bottom: props.position === "bottom" ? offset : "",
transform: transform.value ? `translateY(${transform.value}px)` : "",
zIndex: props.zIndex
};
});
const update = () => {
if (!scrollContainer.value)
return;
scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
const { position, target: target2, offset } = props;
const rootHeightOffset = offset + rootHeight.value;
if (position === "top") {
if (target2) {
const difference = targetRect.bottom.value - rootHeightOffset;
fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
transform.value = difference < 0 ? difference : 0;
} else {
fixed.value = offset > rootTop.value;
}
} else if (target2) {
const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
transform.value = difference < 0 ? -difference : 0;
} else {
fixed.value = windowHeight.value - offset < rootBottom.value;
}
};
const updateRootRect = async () => {
if (!fixed.value) {
updateRoot();
return;
}
fixed.value = false;
await nextTick();
updateRoot();
fixed.value = true;
};
const handleScroll = async () => {
updateRoot();
await nextTick();
emit("scroll", {
scrollTop: scrollTop.value,
fixed: fixed.value
});
};
watch(fixed, (val) => emit(CHANGE_EVENT, val));
onMounted(() => {
var _a;
if (props.target) {
target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
if (!target.value)
throwError(COMPONENT_NAME, `Target does not exist: ${props.target}`);
} else {
target.value = document.documentElement;
}
scrollContainer.value = getScrollContainer(root.value, true);
updateRoot();
});
useEventListener(scrollContainer, "scroll", handleScroll);
watchEffect(update);
expose({
update,
updateRoot: updateRootRect
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "root",
ref: root,
class: normalizeClass(unref(ns).b()),
style: normalizeStyle(unref(rootStyle))
}, [
createElementVNode("div", {
class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
style: normalizeStyle(unref(affixStyle))
}, [
renderSlot(_ctx.$slots, "default")
], 6)
], 6);
};
}
});
var Affix = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "affix.vue"]]);
export { Affix as default };
//# sourceMappingURL=affix2.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-affix.css';

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-affix.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/affix.scss';

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
import Alert from './src/alert.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElAlert: SFCWithInstall<typeof Alert>;
export default ElAlert;
export * from './src/alert';
export type { AlertInstance } from './src/instance';

View File

@@ -0,0 +1,8 @@
import Alert from './src/alert.mjs';
export { alertEffects, alertEmits, alertProps } from './src/alert2.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElAlert = withInstall(Alert);
export { ElAlert, ElAlert as default };
//# sourceMappingURL=index.mjs.map

View File

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

View File

@@ -0,0 +1,22 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
export declare const alertEffects: readonly ["light", "dark"];
export declare const alertProps: {
readonly showAfter: NumberConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly autoClose: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown, "info", boolean>;
readonly closable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "dark" | "light", unknown, "light", boolean>;
};
export type AlertProps = ExtractPropTypes<typeof alertProps>;
export type AlertPropsPublic = __ExtractPublicPropTypes<typeof alertProps>;
export declare const alertEmits: {
open: () => boolean;
close: (evt?: Event) => boolean;
};
export type AlertEmits = typeof alertEmits;

View File

@@ -0,0 +1,113 @@
import { defineComponent, useSlots, ref, computed, toRef, openBlock, createBlock, Transition, unref, withCtx, withDirectives, createElementVNode, normalizeClass, renderSlot, resolveDynamicComponent, createCommentVNode, createElementBlock, createTextVNode, toDisplayString, Fragment, createVNode, vShow } from 'vue';
import { ElIcon } from '../../icon/index.mjs';
import { alertProps, alertEmits } from './alert2.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useDelayedToggle } from '../../../hooks/use-delayed-toggle/index.mjs';
import { TypeComponentsMap, TypeComponents } from '../../../utils/vue/icon.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { isUndefined } from '../../../utils/types.mjs';
import { isClient } from '@vueuse/core';
const __default__ = defineComponent({
name: "ElAlert"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: alertProps,
emits: alertEmits,
setup(__props, { emit }) {
const props = __props;
const { Close } = TypeComponents;
const slots = useSlots();
const ns = useNamespace("alert");
const visible = ref(isUndefined(props.showAfter));
const iconComponent = computed(() => TypeComponentsMap[props.type]);
const hasDesc = computed(() => !!(props.description || slots.default));
const open = () => {
visible.value = true;
emit("open");
};
const close = (event) => {
visible.value = false;
emit("close", event);
};
const { onOpen, onClose } = useDelayedToggle({
showAfter: toRef(props, "showAfter", 0),
hideAfter: toRef(props, "hideAfter"),
autoClose: toRef(props, "autoClose"),
open,
close
});
if (isClient) {
onOpen();
}
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, {
name: unref(ns).b("fade"),
persisted: ""
}, {
default: withCtx(() => [
withDirectives(createElementVNode("div", {
class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.type), unref(ns).is("center", _ctx.center), unref(ns).is(_ctx.effect)]),
role: "alert"
}, [
_ctx.showIcon && (_ctx.$slots.icon || unref(iconComponent)) ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass([unref(ns).e("icon"), { [unref(ns).is("big")]: unref(hasDesc) }])
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "icon", {}, () => [
(openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
])
]),
_: 3
}, 8, ["class"])) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).e("content"))
}, [
_ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass([unref(ns).e("title"), { "with-description": unref(hasDesc) }])
}, [
renderSlot(_ctx.$slots, "title", {}, () => [
createTextVNode(toDisplayString(_ctx.title), 1)
])
], 2)) : createCommentVNode("v-if", true),
unref(hasDesc) ? (openBlock(), createElementBlock("p", {
key: 1,
class: normalizeClass(unref(ns).e("description"))
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.description), 1)
])
], 2)) : createCommentVNode("v-if", true),
_ctx.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
_ctx.closeText ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
onClick: close
}, toDisplayString(_ctx.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass(unref(ns).e("close-btn")),
onClick: unref(onClose)
}, {
default: withCtx(() => [
createVNode(unref(Close))
]),
_: 1
}, 8, ["class", "onClick"]))
], 64)) : createCommentVNode("v-if", true)
], 2)
], 2), [
[vShow, visible.value]
])
]),
_: 3
}, 8, ["name"]);
};
}
});
var Alert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "alert.vue"]]);
export { Alert as default };
//# sourceMappingURL=alert.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"alert.mjs","sources":["../../../../../../packages/components/alert/src/alert.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"visible\"\n :class=\"[ns.b(), ns.m(type), ns.is('center', center), ns.is(effect)]\"\n role=\"alert\"\n >\n <el-icon\n v-if=\"showIcon && ($slots.icon || iconComponent)\"\n :class=\"[ns.e('icon'), { [ns.is('big')]: hasDesc }]\"\n >\n <slot name=\"icon\">\n <component :is=\"iconComponent\" />\n </slot>\n </el-icon>\n\n <div :class=\"ns.e('content')\">\n <span\n v-if=\"title || $slots.title\"\n :class=\"[ns.e('title'), { 'with-description': hasDesc }]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </span>\n <p v-if=\"hasDesc\" :class=\"ns.e('description')\">\n <slot>\n {{ description }}\n </slot>\n </p>\n <template v-if=\"closable\">\n <div\n v-if=\"closeText\"\n :class=\"[ns.e('close-btn'), ns.is('customed')]\"\n @click=\"close\"\n >\n {{ closeText }}\n </div>\n <el-icon v-else :class=\"ns.e('close-btn')\" @click=\"onClose\">\n <Close />\n </el-icon>\n </template>\n </div>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, toRef, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n TypeComponents,\n TypeComponentsMap,\n isClient,\n isUndefined,\n} from '@element-plus/utils'\nimport { useDelayedToggle, useNamespace } from '@element-plus/hooks'\nimport { alertEmits, alertProps } from './alert'\n\nconst { Close } = TypeComponents\n\ndefineOptions({\n name: 'ElAlert',\n})\n\nconst props = defineProps(alertProps)\nconst emit = defineEmits(alertEmits)\nconst slots = useSlots()\n\nconst ns = useNamespace('alert')\n\nconst visible = ref(isUndefined(props.showAfter))\n\nconst iconComponent = computed(() => TypeComponentsMap[props.type])\n\nconst hasDesc = computed(() => !!(props.description || slots.default))\n\nconst open = () => {\n visible.value = true\n emit('open')\n}\n\nconst close = (event?: Event) => {\n visible.value = false\n emit('close', event)\n}\n\nconst { onOpen, onClose } = useDelayedToggle({\n showAfter: toRef(props, 'showAfter', 0),\n hideAfter: toRef(props, 'hideAfter'),\n autoClose: toRef(props, 'autoClose'),\n open,\n close,\n})\n\nif (isClient) {\n onOpen()\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;mCA2Dc,CAAA;AAAA,EACZ,IAAM,EAAA,SAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAJA,IAAM,MAAA,EAAE,OAAU,GAAA,cAAA,CAAA;AAQlB,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,EAAA,GAAK,aAAa,OAAO,CAAA,CAAA;AAE/B,IAAA,MAAM,OAAU,GAAA,GAAA,CAAI,WAAY,CAAA,KAAA,CAAM,SAAS,CAAC,CAAA,CAAA;AAEhD,IAAA,MAAM,gBAAgB,QAAS,CAAA,MAAM,iBAAkB,CAAA,KAAA,CAAM,IAAI,CAAC,CAAA,CAAA;AAElE,IAAM,MAAA,OAAA,GAAU,SAAS,MAAM,CAAC,EAAE,KAAM,CAAA,WAAA,IAAe,MAAM,OAAQ,CAAA,CAAA,CAAA;AAErE,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA,CAAA;AAChB,MAAA,IAAA,CAAK,MAAM,CAAA,CAAA;AAAA,KACb,CAAA;AAEA,IAAM,MAAA,KAAA,GAAQ,CAAC,KAAkB,KAAA;AAC/B,MAAA,OAAA,CAAQ,KAAQ,GAAA,KAAA,CAAA;AAChB,MAAA,IAAA,CAAK,SAAS,KAAK,CAAA,CAAA;AAAA,KACrB,CAAA;AAEA,IAAA,MAAM,EAAE,MAAA,EAAQ,OAAQ,EAAA,GAAI,gBAAiB,CAAA;AAAA,MAC3C,SAAW,EAAA,KAAA,CAAM,KAAO,EAAA,WAAA,EAAa,CAAC,CAAA;AAAA,MACtC,SAAA,EAAW,KAAM,CAAA,KAAA,EAAO,WAAW,CAAA;AAAA,MACnC,SAAA,EAAW,KAAM,CAAA,KAAA,EAAO,WAAW,CAAA;AAAA,MACnC,IAAA;AAAA,MACA,KAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,IAAI,QAAU,EAAA;AACZ,MAAO,MAAA,EAAA,CAAA;AAAA,KACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,54 @@
declare function __VLS_template(): {
icon?(_: {}): any;
title?(_: {}): any;
default?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly showAfter: NumberConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly autoClose: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown, "info", boolean>;
readonly closable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "dark" | "light", unknown, "light", boolean>;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
open: () => void;
close: (evt?: Event | undefined) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly showAfter: NumberConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly autoClose: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown, "info", boolean>;
readonly closable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "dark" | "light", unknown, "light", boolean>;
}>> & {
onOpen?: (() => any) | undefined;
onClose?: ((evt?: Event | undefined) => any) | undefined;
}, {
readonly title: string;
readonly center: boolean;
readonly type: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown>;
readonly description: string;
readonly effect: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "dark" | "light", unknown>;
readonly hideAfter: number;
readonly autoClose: number;
readonly closable: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly closeText: string;
readonly showIcon: 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,46 @@
import { useDelayedToggleProps } from '../../../hooks/use-delayed-toggle/index.mjs';
import { TypeComponentsMap } from '../../../utils/vue/icon.mjs';
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
import { keysOf } from '../../../utils/objects.mjs';
import { isUndefined } from '../../../utils/types.mjs';
const alertEffects = ["light", "dark"];
const alertProps = buildProps({
title: {
type: String,
default: ""
},
description: {
type: String,
default: ""
},
type: {
type: String,
values: keysOf(TypeComponentsMap),
default: "info"
},
closable: {
type: Boolean,
default: true
},
closeText: {
type: String,
default: ""
},
showIcon: Boolean,
center: Boolean,
effect: {
type: String,
values: alertEffects,
default: "light"
},
...useDelayedToggleProps,
showAfter: Number
});
const alertEmits = {
open: () => true,
close: (evt) => isUndefined(evt) || evt instanceof Event
};
export { alertEffects, alertEmits, alertProps };
//# sourceMappingURL=alert2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"alert2.mjs","sources":["../../../../../../packages/components/alert/src/alert.ts"],"sourcesContent":["import { useDelayedToggleProps } from '@element-plus/hooks'\nimport {\n TypeComponentsMap,\n buildProps,\n isUndefined,\n keysOf,\n} from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\n\nexport const alertEffects = ['light', 'dark'] as const\n\nexport const alertProps = buildProps({\n /**\n * @description alert title.\n */\n title: {\n type: String,\n default: '',\n },\n description: {\n type: String,\n default: '',\n },\n /**\n * @description alert type.\n */\n type: {\n type: String,\n values: keysOf(TypeComponentsMap),\n default: 'info',\n },\n /**\n * @description whether alert can be dismissed.\n */\n closable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description text for replacing x button\n */\n closeText: {\n type: String,\n default: '',\n },\n /**\n * @description whether show icon\n */\n showIcon: Boolean,\n /**\n * @description should content be placed in center.\n */\n center: Boolean,\n effect: {\n type: String,\n values: alertEffects,\n default: 'light',\n },\n ...useDelayedToggleProps,\n /**\n * @description delay of appearance, in millisecond\n */\n showAfter: Number,\n} as const)\nexport type AlertProps = ExtractPropTypes<typeof alertProps>\nexport type AlertPropsPublic = __ExtractPublicPropTypes<typeof alertProps>\n\nexport const alertEmits = {\n open: () => true,\n close: (evt?: Event) => isUndefined(evt) || evt instanceof Event,\n}\nexport type AlertEmits = typeof alertEmits\n"],"names":[],"mappings":";;;;;;AAOY,MAAC,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE;AAClC,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC;AACrC,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,YAAY;AACxB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,GAAG,qBAAqB;AAC1B,EAAE,SAAS,EAAE,MAAM;AACnB,CAAC,EAAE;AACS,MAAC,UAAU,GAAG;AAC1B,EAAE,IAAI,EAAE,MAAM,IAAI;AAClB,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,YAAY,KAAK;AAC1D;;;;"}

View File

@@ -0,0 +1,2 @@
import type Alert from './alert.vue';
export type AlertInstance = InstanceType<typeof Alert> & unknown;

View File

@@ -0,0 +1,2 @@
//# sourceMappingURL=instance.mjs.map

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-alert.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/alert.scss';

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-anchor-link.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/anchor-link.scss';

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
import Anchor from './src/anchor.vue';
import AnchorLink from './src/anchor-link.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElAnchor: SFCWithInstall<typeof Anchor> & {
AnchorLink: typeof AnchorLink;
};
export declare const ElAnchorLink: SFCWithInstall<typeof AnchorLink>;
export default ElAnchor;
export * from './src/anchor';

View File

@@ -0,0 +1,12 @@
import Anchor from './src/anchor2.mjs';
import AnchorLink from './src/anchor-link2.mjs';
export { anchorEmits, anchorProps } from './src/anchor.mjs';
import { withInstall, withNoopInstall } from '../../utils/vue/install.mjs';
const ElAnchor = withInstall(Anchor, {
AnchorLink
});
const ElAnchorLink = withNoopInstall(AnchorLink);
export { ElAnchor, ElAnchorLink, ElAnchor as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/anchor/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from '@element-plus/utils'\nimport Anchor from './src/anchor.vue'\nimport AnchorLink from './src/anchor-link.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElAnchor: SFCWithInstall<typeof Anchor> & {\n AnchorLink: typeof AnchorLink\n} = withInstall(Anchor, {\n AnchorLink,\n})\nexport const ElAnchorLink: SFCWithInstall<typeof AnchorLink> =\n withNoopInstall(AnchorLink)\nexport default ElAnchor\n\nexport * from './src/anchor'\n"],"names":[],"mappings":";;;;;AAGY,MAAC,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE;AAC5C,EAAE,UAAU;AACZ,CAAC,EAAE;AACS,MAAC,YAAY,GAAG,eAAe,CAAC,UAAU;;;;"}

View File

@@ -0,0 +1,7 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
export declare const anchorLinkProps: {
title: StringConstructor;
href: StringConstructor;
};
export type AnchorLinkProps = ExtractPropTypes<typeof anchorLinkProps>;
export type AnchorLinkPropsPublic = __ExtractPublicPropTypes<typeof anchorLinkProps>;

View File

@@ -0,0 +1,9 @@
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
const anchorLinkProps = buildProps({
title: String,
href: String
});
export { anchorLinkProps };
//# sourceMappingURL=anchor-link.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"anchor-link.mjs","sources":["../../../../../../packages/components/anchor/src/anchor-link.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\n\nexport const anchorLinkProps = buildProps({\n /**\n * @description the text content of the anchor link\n */\n title: String,\n /**\n * @description The address of the anchor link\n */\n href: String,\n})\n\nexport type AnchorLinkProps = ExtractPropTypes<typeof anchorLinkProps>\nexport type AnchorLinkPropsPublic = __ExtractPublicPropTypes<\n typeof anchorLinkProps\n>\n"],"names":[],"mappings":";;AACY,MAAC,eAAe,GAAG,UAAU,CAAC;AAC1C,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,IAAI,EAAE,MAAM;AACd,CAAC;;;;"}

View File

@@ -0,0 +1,18 @@
declare function __VLS_template(): {
default?(_: {}): any;
"sub-link"?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
title: StringConstructor;
href: StringConstructor;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
title: StringConstructor;
href: StringConstructor;
}>>, {}>;
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,85 @@
import { defineComponent, ref, inject, computed, watch, nextTick, onMounted, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
import { anchorLinkProps } from './anchor-link.mjs';
import { anchorKey } from './constants.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
const __default__ = defineComponent({
name: "ElAnchorLink"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: anchorLinkProps,
setup(__props) {
const props = __props;
const linkRef = ref(null);
const {
ns,
direction,
currentAnchor,
addLink,
removeLink,
handleClick: contextHandleClick
} = inject(anchorKey);
const cls = computed(() => [
ns.e("link"),
ns.is("active", currentAnchor.value === props.href)
]);
const handleClick = (e) => {
contextHandleClick(e, props.href);
};
watch(() => props.href, (val, oldVal) => {
nextTick(() => {
if (oldVal)
removeLink(oldVal);
if (val) {
addLink({
href: val,
el: linkRef.value
});
}
});
});
onMounted(() => {
const { href } = props;
if (href) {
addLink({
href,
el: linkRef.value
});
}
});
onBeforeUnmount(() => {
const { href } = props;
if (href) {
removeLink(href);
}
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(ns).e("item"))
}, [
createElementVNode("a", {
ref_key: "linkRef",
ref: linkRef,
class: normalizeClass(unref(cls)),
href: _ctx.href,
onClick: handleClick
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.title), 1)
])
], 10, ["href"]),
_ctx.$slots["sub-link"] && unref(direction) === "vertical" ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).e("list"))
}, [
renderSlot(_ctx.$slots, "sub-link")
], 2)) : createCommentVNode("v-if", true)
], 2);
};
}
});
var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "anchor-link.vue"]]);
export { AnchorLink as default };
//# sourceMappingURL=anchor-link2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"anchor-link2.mjs","sources":["../../../../../../packages/components/anchor/src/anchor-link.vue"],"sourcesContent":["<template>\n <div :class=\"ns.e('item')\">\n <a ref=\"linkRef\" :class=\"cls\" :href=\"href\" @click=\"handleClick\">\n <slot>{{ title }}</slot>\n </a>\n <div\n v-if=\"$slots['sub-link'] && direction === 'vertical'\"\n :class=\"ns.e('list')\"\n >\n <slot name=\"sub-link\" />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n inject,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n} from 'vue'\nimport { anchorLinkProps } from './anchor-link'\nimport { anchorKey } from './constants'\n\ndefineOptions({\n name: 'ElAnchorLink',\n})\n\nconst props = defineProps(anchorLinkProps)\n\nconst linkRef = ref<HTMLElement | null>(null)\n\nconst {\n ns,\n direction,\n currentAnchor,\n addLink,\n removeLink,\n handleClick: contextHandleClick,\n} = inject(anchorKey)!\n\nconst cls = computed(() => [\n ns.e('link'),\n ns.is('active', currentAnchor.value === props.href),\n])\n\nconst handleClick = (e: MouseEvent) => {\n contextHandleClick(e, props.href)\n}\n\nwatch(\n () => props.href,\n (val, oldVal) => {\n nextTick(() => {\n if (oldVal) removeLink(oldVal)\n if (val) {\n addLink({\n href: val,\n el: linkRef.value!,\n })\n }\n })\n }\n)\n\nonMounted(() => {\n const { href } = props\n if (href) {\n addLink({\n href,\n el: linkRef.value!,\n })\n }\n})\n\nonBeforeUnmount(() => {\n const { href } = props\n if (href) {\n removeLink(href)\n }\n})\n</script>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;;;;mCA2Bc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAIA,IAAM,MAAA,OAAA,GAAU,IAAwB,IAAI,CAAA,CAAA;AAE5C,IAAM,MAAA;AAAA,MACJ,EAAA;AAAA,MACA,SAAA;AAAA,MACA,aAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAa,EAAA,kBAAA;AAAA,KACf,GAAI,OAAO,SAAS,CAAA,CAAA;AAEpB,IAAM,MAAA,GAAA,GAAM,SAAS,MAAM;AAAA,MACzB,EAAA,CAAG,EAAE,MAAM,CAAA;AAAA,MACX,GAAG,EAAG,CAAA,QAAA,EAAU,aAAc,CAAA,KAAA,KAAU,MAAM,IAAI,CAAA;AAAA,KACnD,CAAA,CAAA;AAED,IAAM,MAAA,WAAA,GAAc,CAAC,CAAkB,KAAA;AACrC,MAAmB,kBAAA,CAAA,CAAA,EAAG,MAAM,IAAI,CAAA,CAAA;AAAA,KAClC,CAAA;AAEA,IAAA,KAAA,CAAA,MAAA,KAAA,CAAA,IAAA,EAAA,CAAA,GAAA,EAAA,MAAA,KAAA;AAAA,MACE,QAAY,CAAA,MAAA;AAAA,YACN,MAAW;AACf,UAAA,UAAe,CAAA,MAAA,CAAA,CAAA;AACb,QAAI,IAAA,GAAA,EAAA;AACJ,UAAA,OAAS,CAAA;AACP,YAAQ,IAAA,EAAA,GAAA;AAAA,YAAA,EACN,EAAM,OAAA,CAAA,KAAA;AAAA,WAAA,CAAA,CAAA;AACM,SAAA;AACb,OACH,CAAA,CAAA;AAAA,KAAA,CAAA,CAAA;AACD,IACH,SAAA,CAAA,MAAA;AAAA,MACF,MAAA,EAAA,IAAA,EAAA,GAAA,KAAA,CAAA;AAEA,MAAA,IAAA,IAAU,EAAM;AACd,QAAM;AACN,UAAI,IAAM;AACR,UAAQ,EAAA,EAAA,OAAA,CAAA,KAAA;AAAA,SACN,CAAA,CAAA;AAAA,OAAA;AACY,KAAA,CAAA,CAAA;AACb,IACH,eAAA,CAAA,MAAA;AAAA,MACD,MAAA,EAAA,IAAA,EAAA,GAAA,KAAA,CAAA;AAED,MAAA,IAAA,IAAA,EAAA;AACE,QAAM,WAAO,IAAI,CAAA,CAAA;AACjB,OAAA;AACE,KAAA,CAAA,CAAA;AAAe,IACjB,OAAA,CAAA,IAAA,EAAA,MAAA,KAAA;AAAA,MACD,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,25 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Anchor from './anchor.vue';
export declare const anchorProps: {
container: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | HTMLElement | Window) | (() => string | HTMLElement | Window | null) | ((new (...args: any[]) => string | HTMLElement | Window) | (() => string | HTMLElement | Window | null))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
bound: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
duration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
marker: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
type: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "default" | "underline") | (() => "default" | "underline") | ((new (...args: any[]) => "default" | "underline") | (() => "default" | "underline"))[], unknown, unknown, string, boolean>;
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>;
selectScrollTop: BooleanConstructor;
};
export type AnchorProps = ExtractPropTypes<typeof anchorProps>;
export type AnchorPropsPublic = __ExtractPublicPropTypes<typeof anchorProps>;
export type AnchorInstance = InstanceType<typeof Anchor> & unknown;
export declare const anchorEmits: {
change: (href: string) => boolean;
click: (e: MouseEvent, href?: string) => boolean;
};
export type AnchorEmits = typeof anchorEmits;

View File

@@ -0,0 +1,44 @@
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { isString } from '@vue/shared';
import { isUndefined } from '../../../utils/types.mjs';
const anchorProps = buildProps({
container: {
type: definePropType([
String,
Object
])
},
offset: {
type: Number,
default: 0
},
bound: {
type: Number,
default: 15
},
duration: {
type: Number,
default: 300
},
marker: {
type: Boolean,
default: true
},
type: {
type: definePropType(String),
default: "default"
},
direction: {
type: definePropType(String),
default: "vertical"
},
selectScrollTop: Boolean
});
const anchorEmits = {
change: (href) => isString(href),
click: (e, href) => e instanceof MouseEvent && (isString(href) || isUndefined(href))
};
export { anchorEmits, anchorProps };
//# sourceMappingURL=anchor.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"anchor.mjs","sources":["../../../../../../packages/components/anchor/src/anchor.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isString,\n isUndefined,\n} from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Anchor from './anchor.vue'\n\nexport const anchorProps = buildProps({\n /**\n * @description scroll container\n */\n container: {\n type: definePropType<string | HTMLElement | Window | null>([\n String,\n Object,\n ]),\n },\n /**\n * @description Set the offset of the anchor scroll\n */\n offset: {\n type: Number,\n default: 0,\n },\n /**\n * @description The offset of the element starting to trigger the anchor\n */\n bound: {\n type: Number,\n default: 15,\n },\n /**\n * @description Set the scroll duration of the container when the anchor is clicked, in milliseconds\n */\n duration: {\n type: Number,\n default: 300,\n },\n /**\n * @description Whether to show the marker\n */\n marker: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Set Anchor type\n */\n type: {\n type: definePropType<'default' | 'underline'>(String),\n default: 'default',\n },\n /**\n * @description Set Anchor direction\n */\n direction: {\n type: definePropType<'vertical' | 'horizontal'>(String),\n default: 'vertical',\n },\n /**\n * @description Scroll whether link is selected at the top\n */\n selectScrollTop: Boolean,\n})\n\nexport type AnchorProps = ExtractPropTypes<typeof anchorProps>\nexport type AnchorPropsPublic = __ExtractPublicPropTypes<typeof anchorProps>\nexport type AnchorInstance = InstanceType<typeof Anchor> & unknown\n\nexport const anchorEmits = {\n change: (href: string) => isString(href),\n click: (e: MouseEvent, href?: string) =>\n e instanceof MouseEvent && (isString(href) || isUndefined(href)),\n}\nexport type AnchorEmits = typeof anchorEmits\n"],"names":[],"mappings":";;;;AAMY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC;AACzB,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,KAAK,CAAC;AACN,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,UAAU;AACvB,GAAG;AACH,EAAE,eAAe,EAAE,OAAO;AAC1B,CAAC,EAAE;AACS,MAAC,WAAW,GAAG;AAC3B,EAAE,MAAM,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC;AAClC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,YAAY,UAAU,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AACtF;;;;"}

View File

@@ -0,0 +1,55 @@
declare function __VLS_template(): {
default?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
container: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | HTMLElement | Window) | (() => string | HTMLElement | Window | null) | ((new (...args: any[]) => string | HTMLElement | Window) | (() => string | HTMLElement | Window | null))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
bound: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
duration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
marker: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
type: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "default" | "underline") | (() => "default" | "underline") | ((new (...args: any[]) => "default" | "underline") | (() => "default" | "underline"))[], unknown, unknown, string, boolean>;
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>;
selectScrollTop: BooleanConstructor;
}, {
scrollTo: (href?: string) => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
click: (e: MouseEvent, href?: string | undefined) => void;
change: (href: string) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
container: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | HTMLElement | Window) | (() => string | HTMLElement | Window | null) | ((new (...args: any[]) => string | HTMLElement | Window) | (() => string | HTMLElement | Window | null))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
bound: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
duration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
marker: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
type: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "default" | "underline") | (() => "default" | "underline") | ((new (...args: any[]) => "default" | "underline") | (() => "default" | "underline"))[], unknown, unknown, string, boolean>;
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>;
selectScrollTop: BooleanConstructor;
}>> & {
onChange?: ((href: string) => any) | undefined;
onClick?: ((e: MouseEvent, href?: string | undefined) => any) | undefined;
}, {
marker: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
direction: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | ((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical"))[], unknown, unknown>;
offset: number;
type: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "default" | "underline") | (() => "default" | "underline") | ((new (...args: any[]) => "default" | "underline") | (() => "default" | "underline"))[], unknown, unknown>;
duration: number;
bound: number;
selectScrollTop: 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,211 @@
import { defineComponent, useSlots, ref, computed, watch, onMounted, provide, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createCommentVNode, createElementVNode, renderSlot, nextTick } from 'vue';
import { useEventListener } from '@vueuse/core';
import { anchorProps, anchorEmits } from './anchor.mjs';
import { anchorKey } from './constants.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { getElement } from '../../../utils/dom/element.mjs';
import { throttleByRaf } from '../../../utils/throttleByRaf.mjs';
import { getScrollElement, animateScrollTo, getScrollTop } from '../../../utils/dom/scroll.mjs';
import { getOffsetTopDistance } from '../../../utils/dom/position.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { isWindow, isUndefined } from '../../../utils/types.mjs';
import { CHANGE_EVENT } from '../../../constants/event.mjs';
const __default__ = defineComponent({
name: "ElAnchor"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: anchorProps,
emits: anchorEmits,
setup(__props, { expose, emit }) {
const props = __props;
const slots = useSlots();
const currentAnchor = ref("");
const markerStyle = ref({});
const anchorRef = ref(null);
const markerRef = ref(null);
const containerEl = ref();
const links = {};
let isScrolling = false;
let currentScrollTop = 0;
const ns = useNamespace("anchor");
const cls = computed(() => [
ns.b(),
props.type === "underline" ? ns.m("underline") : "",
ns.m(props.direction)
]);
const addLink = (state) => {
links[state.href] = state.el;
};
const removeLink = (href) => {
delete links[href];
};
const setCurrentAnchor = (href) => {
const activeHref = currentAnchor.value;
if (activeHref !== href) {
currentAnchor.value = href;
emit(CHANGE_EVENT, href);
}
};
let clearAnimate = null;
const scrollToAnchor = (href) => {
if (!containerEl.value)
return;
const target = getElement(href);
if (!target)
return;
if (clearAnimate)
clearAnimate();
isScrolling = true;
const scrollEle = getScrollElement(target, containerEl.value);
const distance = getOffsetTopDistance(target, scrollEle);
const max = scrollEle.scrollHeight - scrollEle.clientHeight;
const to = Math.min(distance - props.offset, max);
clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
setTimeout(() => {
isScrolling = false;
}, 20);
});
};
const scrollTo = (href) => {
if (href) {
setCurrentAnchor(href);
scrollToAnchor(href);
}
};
const handleClick = (e, href) => {
emit("click", e, href);
scrollTo(href);
};
const handleScroll = throttleByRaf(() => {
if (containerEl.value) {
currentScrollTop = getScrollTop(containerEl.value);
}
const currentHref = getCurrentHref();
if (isScrolling || isUndefined(currentHref))
return;
setCurrentAnchor(currentHref);
});
const getCurrentHref = () => {
if (!containerEl.value)
return;
const scrollTop = getScrollTop(containerEl.value);
const anchorTopList = [];
for (const href of Object.keys(links)) {
const target = getElement(href);
if (!target)
continue;
const scrollEle = getScrollElement(target, containerEl.value);
const distance = getOffsetTopDistance(target, scrollEle);
anchorTopList.push({
top: distance - props.offset - props.bound,
href
});
}
anchorTopList.sort((prev, next) => prev.top - next.top);
for (let i = 0; i < anchorTopList.length; i++) {
const item = anchorTopList[i];
const next = anchorTopList[i + 1];
if (i === 0 && scrollTop === 0) {
return props.selectScrollTop ? item.href : "";
}
if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
return item.href;
}
}
};
const getContainer = () => {
const el = getElement(props.container);
if (!el || isWindow(el)) {
containerEl.value = window;
} else {
containerEl.value = el;
}
};
useEventListener(containerEl, "scroll", handleScroll);
const updateMarkerStyle = () => {
nextTick(() => {
if (!anchorRef.value || !markerRef.value || !currentAnchor.value) {
markerStyle.value = {};
return;
}
const currentLinkEl = links[currentAnchor.value];
if (!currentLinkEl) {
markerStyle.value = {};
return;
}
const anchorRect = anchorRef.value.getBoundingClientRect();
const markerRect = markerRef.value.getBoundingClientRect();
const linkRect = currentLinkEl.getBoundingClientRect();
if (props.direction === "horizontal") {
const left = linkRect.left - anchorRect.left;
markerStyle.value = {
left: `${left}px`,
width: `${linkRect.width}px`,
opacity: 1
};
} else {
const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
markerStyle.value = {
top: `${top}px`,
opacity: 1
};
}
});
};
watch(currentAnchor, updateMarkerStyle);
watch(() => {
var _a;
return (_a = slots.default) == null ? void 0 : _a.call(slots);
}, updateMarkerStyle);
onMounted(() => {
getContainer();
const hash = decodeURIComponent(window.location.hash);
const target = getElement(hash);
if (target) {
scrollTo(hash);
} else {
handleScroll();
}
});
watch(() => props.container, () => {
getContainer();
});
provide(anchorKey, {
ns,
direction: props.direction,
currentAnchor,
addLink,
removeLink,
handleClick
});
expose({
scrollTo
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "anchorRef",
ref: anchorRef,
class: normalizeClass(unref(cls))
}, [
_ctx.marker ? (openBlock(), createElementBlock("div", {
key: 0,
ref_key: "markerRef",
ref: markerRef,
class: normalizeClass(unref(ns).e("marker")),
style: normalizeStyle(markerStyle.value)
}, null, 6)) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).e("list"))
}, [
renderSlot(_ctx.$slots, "default")
], 2)
], 2);
};
}
});
var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "anchor.vue"]]);
export { Anchor as default };
//# sourceMappingURL=anchor2.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
import type { InjectionKey, Ref } from 'vue';
import type { UseNamespaceReturn } from 'element-plus/es/hooks';
export interface AnchorLinkState {
el: HTMLElement;
href: string;
}
export interface AnchorContext {
ns: UseNamespaceReturn;
direction: string;
currentAnchor: Ref<string>;
addLink(state: AnchorLinkState): void;
removeLink(href: string): void;
handleClick(e: MouseEvent, href?: string): void;
}
export declare const anchorKey: InjectionKey<AnchorContext>;

View File

@@ -0,0 +1,4 @@
const anchorKey = Symbol("anchor");
export { anchorKey };
//# sourceMappingURL=constants.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.mjs","sources":["../../../../../../packages/components/anchor/src/constants.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue'\nimport type { UseNamespaceReturn } from '@element-plus/hooks'\n\nexport interface AnchorLinkState {\n el: HTMLElement\n href: string\n}\n\nexport interface AnchorContext {\n ns: UseNamespaceReturn\n direction: string\n currentAnchor: Ref<string>\n addLink(state: AnchorLinkState): void\n removeLink(href: string): void\n handleClick(e: MouseEvent, href?: string): void\n}\n\nexport const anchorKey: InjectionKey<AnchorContext> = Symbol('anchor')\n"],"names":[],"mappings":"AAAY,MAAC,SAAS,GAAG,MAAM,CAAC,QAAQ;;;;"}

View File

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

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-anchor.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/anchor.scss';

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-aside.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/aside.scss';

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,8 @@
import Autocomplete from './src/autocomplete2.mjs';
export { autocompleteEmits, autocompleteProps } from './src/autocomplete.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElAutocomplete = withInstall(Autocomplete);
export { ElAutocomplete, ElAutocomplete as default };
//# sourceMappingURL=index.mjs.map

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
import { inputProps } from '../../input/src/input.mjs';
import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { NOOP, isString, isObject } from '@vue/shared';
import { UPDATE_MODEL_EVENT, INPUT_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
import { isNumber } from '../../../utils/types.mjs';
const autocompleteProps = buildProps({
...inputProps,
valueKey: {
type: String,
default: "value"
},
modelValue: {
type: [String, Number],
default: ""
},
debounce: {
type: Number,
default: 300
},
placement: {
type: definePropType(String),
values: [
"top",
"top-start",
"top-end",
"bottom",
"bottom-start",
"bottom-end"
],
default: "bottom-start"
},
fetchSuggestions: {
type: definePropType([Function, Array]),
default: NOOP
},
popperClass: {
type: String,
default: ""
},
triggerOnFocus: {
type: Boolean,
default: true
},
selectWhenUnmatched: Boolean,
hideLoading: Boolean,
teleported: useTooltipContentProps.teleported,
appendTo: useTooltipContentProps.appendTo,
highlightFirstItem: Boolean,
fitInputWidth: Boolean
});
const autocompleteEmits = {
[UPDATE_MODEL_EVENT]: (value) => isString(value) || isNumber(value),
[INPUT_EVENT]: (value) => isString(value) || isNumber(value),
[CHANGE_EVENT]: (value) => isString(value) || isNumber(value),
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent,
clear: () => true,
select: (item) => isObject(item)
};
export { autocompleteEmits, autocompleteProps };
//# sourceMappingURL=autocomplete.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,401 @@
import { defineComponent, computed, useAttrs, ref, onBeforeUnmount, onMounted, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, normalizeStyle, createElementBlock, withModifiers, renderSlot, createCommentVNode, createVNode, Fragment, renderList, createTextVNode, toDisplayString, mergeProps, withKeys, createSlots } from 'vue';
import { pick, debounce } from 'lodash-unified';
import { onClickOutside } from '@vueuse/core';
import { Loading } from '@element-plus/icons-vue';
import { ElInput } from '../../input/index.mjs';
import { ElScrollbar } from '../../scrollbar/index.mjs';
import { ElTooltip } from '../../tooltip/index.mjs';
import { ElIcon } from '../../icon/index.mjs';
import { autocompleteProps, autocompleteEmits } from './autocomplete.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { inputProps } from '../../input/src/input.mjs';
import { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { useId } from '../../../hooks/use-id/index.mjs';
import { isArray } from '@vue/shared';
import { INPUT_EVENT, UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
import { throwError } from '../../../utils/error.mjs';
const COMPONENT_NAME = "ElAutocomplete";
const __default__ = defineComponent({
name: COMPONENT_NAME,
inheritAttrs: false
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: autocompleteProps,
emits: autocompleteEmits,
setup(__props, { expose, emit }) {
const props = __props;
const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
const rawAttrs = useAttrs();
const disabled = useFormDisabled();
const ns = useNamespace("autocomplete");
const inputRef = ref();
const regionRef = ref();
const popperRef = ref();
const listboxRef = ref();
let readonly = false;
let ignoreFocusEvent = false;
const suggestions = ref([]);
const highlightedIndex = ref(-1);
const dropdownWidth = ref("");
const activated = ref(false);
const suggestionDisabled = ref(false);
const loading = ref(false);
const listboxId = useId();
const styles = computed(() => rawAttrs.style);
const suggestionVisible = computed(() => {
const isValidData = suggestions.value.length > 0;
return (isValidData || loading.value) && activated.value;
});
const suggestionLoading = computed(() => !props.hideLoading && loading.value);
const refInput = computed(() => {
if (inputRef.value) {
return Array.from(inputRef.value.$el.querySelectorAll("input"));
}
return [];
});
const onSuggestionShow = () => {
if (suggestionVisible.value) {
dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
}
};
const onHide = () => {
highlightedIndex.value = -1;
};
const getData = async (queryString) => {
if (suggestionDisabled.value)
return;
const cb = (suggestionList) => {
loading.value = false;
if (suggestionDisabled.value)
return;
if (isArray(suggestionList)) {
suggestions.value = suggestionList;
highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
} else {
throwError(COMPONENT_NAME, "autocomplete suggestions must be an array");
}
};
loading.value = true;
if (isArray(props.fetchSuggestions)) {
cb(props.fetchSuggestions);
} else {
const result = await props.fetchSuggestions(queryString, cb);
if (isArray(result))
cb(result);
}
};
const debouncedGetData = debounce(getData, props.debounce);
const handleInput = (value) => {
const valuePresented = !!value;
emit(INPUT_EVENT, value);
emit(UPDATE_MODEL_EVENT, value);
suggestionDisabled.value = false;
activated.value || (activated.value = valuePresented);
if (!props.triggerOnFocus && !value) {
suggestionDisabled.value = true;
suggestions.value = [];
return;
}
debouncedGetData(value);
};
const handleMouseDown = (event) => {
var _a;
if (disabled.value)
return;
if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
activated.value = true;
}
};
const handleChange = (value) => {
emit(CHANGE_EVENT, value);
};
const handleFocus = (evt) => {
var _a;
if (!ignoreFocusEvent) {
activated.value = true;
emit("focus", evt);
const queryString = (_a = props.modelValue) != null ? _a : "";
if (props.triggerOnFocus && !readonly) {
debouncedGetData(String(queryString));
}
} else {
ignoreFocusEvent = false;
}
};
const handleBlur = (evt) => {
setTimeout(() => {
var _a;
if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
ignoreFocusEvent = true;
return;
}
activated.value && close();
emit("blur", evt);
});
};
const handleClear = () => {
activated.value = false;
emit(UPDATE_MODEL_EVENT, "");
emit("clear");
};
const handleKeyEnter = async () => {
var _a;
if ((_a = inputRef.value) == null ? void 0 : _a.isComposing) {
return;
}
if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
handleSelect(suggestions.value[highlightedIndex.value]);
} else if (props.selectWhenUnmatched) {
emit("select", { value: props.modelValue });
suggestions.value = [];
highlightedIndex.value = -1;
}
};
const handleKeyEscape = (evt) => {
if (suggestionVisible.value) {
evt.preventDefault();
evt.stopPropagation();
close();
}
};
const close = () => {
activated.value = false;
};
const focus = () => {
var _a;
(_a = inputRef.value) == null ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = inputRef.value) == null ? void 0 : _a.blur();
};
const handleSelect = async (item) => {
emit(INPUT_EVENT, item[props.valueKey]);
emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
emit("select", item);
suggestions.value = [];
highlightedIndex.value = -1;
};
const highlight = (index) => {
var _a, _b;
if (!suggestionVisible.value || loading.value)
return;
if (index < 0) {
highlightedIndex.value = -1;
return;
}
if (index >= suggestions.value.length) {
index = suggestions.value.length - 1;
}
const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
const highlightItem = suggestionList[index];
const scrollTop = suggestion.scrollTop;
const { offsetTop, scrollHeight } = highlightItem;
if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
suggestion.scrollTop += scrollHeight;
}
if (offsetTop < scrollTop) {
suggestion.scrollTop -= scrollHeight;
}
highlightedIndex.value = index;
(_b = (_a = inputRef.value) == null ? void 0 : _a.ref) == null ? void 0 : _b.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
};
const stopHandle = onClickOutside(listboxRef, () => {
var _a;
if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent())
return;
suggestionVisible.value && close();
});
onBeforeUnmount(() => {
stopHandle == null ? void 0 : stopHandle();
});
onMounted(() => {
var _a;
const inputElement = (_a = inputRef.value) == null ? void 0 : _a.ref;
if (!inputElement)
return;
[
{ key: "role", value: "textbox" },
{ key: "aria-autocomplete", value: "list" },
{ key: "aria-controls", value: "id" },
{
key: "aria-activedescendant",
value: `${listboxId.value}-item-${highlightedIndex.value}`
}
].forEach(({ key, value }) => inputElement.setAttribute(key, value));
readonly = inputElement.hasAttribute("readonly");
});
expose({
highlightedIndex,
activated,
loading,
inputRef,
popperRef,
suggestions,
handleSelect,
handleKeyEnter,
focus,
blur,
close,
highlight,
getData
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElTooltip), {
ref_key: "popperRef",
ref: popperRef,
visible: unref(suggestionVisible),
placement: _ctx.placement,
"fallback-placements": ["bottom-start", "top-start"],
"popper-class": [unref(ns).e("popper"), _ctx.popperClass],
teleported: _ctx.teleported,
"append-to": _ctx.appendTo,
"gpu-acceleration": false,
pure: "",
"manual-mode": "",
effect: "light",
trigger: "click",
transition: `${unref(ns).namespace.value}-zoom-in-top`,
persistent: "",
role: "listbox",
onBeforeShow: onSuggestionShow,
onHide
}, {
content: withCtx(() => [
createElementVNode("div", {
ref_key: "regionRef",
ref: regionRef,
class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", unref(suggestionLoading))]),
style: normalizeStyle({
[_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
outline: "none"
}),
role: "region"
}, [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).be("suggestion", "header")),
onClick: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(_ctx.$slots, "header")
], 10, ["onClick"])) : createCommentVNode("v-if", true),
createVNode(unref(ElScrollbar), {
id: unref(listboxId),
tag: "ul",
"wrap-class": unref(ns).be("suggestion", "wrap"),
"view-class": unref(ns).be("suggestion", "list"),
role: "listbox"
}, {
default: withCtx(() => [
unref(suggestionLoading) ? (openBlock(), createElementBlock("li", { key: 0 }, [
renderSlot(_ctx.$slots, "loading", {}, () => [
createVNode(unref(ElIcon), {
class: normalizeClass(unref(ns).is("loading"))
}, {
default: withCtx(() => [
createVNode(unref(Loading))
]),
_: 1
}, 8, ["class"])
])
])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index) => {
return openBlock(), createElementBlock("li", {
id: `${unref(listboxId)}-item-${index}`,
key: index,
class: normalizeClass({ highlighted: highlightedIndex.value === index }),
role: "option",
"aria-selected": highlightedIndex.value === index,
onClick: ($event) => handleSelect(item)
}, [
renderSlot(_ctx.$slots, "default", { item }, () => [
createTextVNode(toDisplayString(item[_ctx.valueKey]), 1)
])
], 10, ["id", "aria-selected", "onClick"]);
}), 128))
]),
_: 3
}, 8, ["id", "wrap-class", "view-class"]),
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(ns).be("suggestion", "footer")),
onClick: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(_ctx.$slots, "footer")
], 10, ["onClick"])) : createCommentVNode("v-if", true)
], 6)
]),
default: withCtx(() => [
createElementVNode("div", {
ref_key: "listboxRef",
ref: listboxRef,
class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
style: normalizeStyle(unref(styles)),
role: "combobox",
"aria-haspopup": "listbox",
"aria-expanded": unref(suggestionVisible),
"aria-owns": unref(listboxId)
}, [
createVNode(unref(ElInput), mergeProps({
ref_key: "inputRef",
ref: inputRef
}, mergeProps(unref(passInputProps), _ctx.$attrs), {
"model-value": _ctx.modelValue,
disabled: unref(disabled),
onInput: handleInput,
onChange: handleChange,
onFocus: handleFocus,
onBlur: handleBlur,
onClear: handleClear,
onKeydown: [
withKeys(withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"]),
withKeys(withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"]),
withKeys(handleKeyEnter, ["enter"]),
withKeys(close, ["tab"]),
withKeys(handleKeyEscape, ["esc"])
],
onMousedown: handleMouseDown
}), createSlots({
_: 2
}, [
_ctx.$slots.prepend ? {
name: "prepend",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "prepend")
])
} : void 0,
_ctx.$slots.append ? {
name: "append",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "append")
])
} : void 0,
_ctx.$slots.prefix ? {
name: "prefix",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "prefix")
])
} : void 0,
_ctx.$slots.suffix ? {
name: "suffix",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "suffix")
])
} : void 0
]), 1040, ["model-value", "disabled", "onKeydown"])
], 14, ["aria-expanded", "aria-owns"])
]),
_: 3
}, 8, ["visible", "placement", "popper-class", "teleported", "append-to", "transition"]);
};
}
});
var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "autocomplete.vue"]]);
export { Autocomplete as default };
//# sourceMappingURL=autocomplete2.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/theme-chalk/el-autocomplete.css';
import 'element-plus/es/components/input/style/css';
import 'element-plus/es/components/scrollbar/style/css';
import 'element-plus/es/components/popper/style/css';

View File

@@ -0,0 +1,6 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-autocomplete.css';
import '../../input/style/css.mjs';
import '../../scrollbar/style/css.mjs';
import '../../popper/style/css.mjs';
//# sourceMappingURL=css.mjs.map

View File

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

View File

@@ -0,0 +1,5 @@
import 'element-plus/es/components/base/style';
import 'element-plus/theme-chalk/src/autocomplete.scss';
import 'element-plus/es/components/input/style';
import 'element-plus/es/components/scrollbar/style';
import 'element-plus/es/components/popper/style';

View File

@@ -0,0 +1,6 @@
import '../../base/style/index.mjs';
import 'element-plus/theme-chalk/src/autocomplete.scss';
import '../../input/style/index.mjs';
import '../../scrollbar/style/index.mjs';
import '../../popper/style/index.mjs';
//# sourceMappingURL=index.mjs.map

View File

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

View File

@@ -0,0 +1,6 @@
import Avatar from './src/avatar.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElAvatar: SFCWithInstall<typeof Avatar>;
export default ElAvatar;
export * from './src/avatar';
export type { AvatarInstance } from './src/instance';

View File

@@ -0,0 +1,8 @@
import Avatar from './src/avatar2.mjs';
export { avatarEmits, avatarProps } from './src/avatar.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElAvatar = withInstall(Avatar);
export { ElAvatar, ElAvatar as default };
//# sourceMappingURL=index.mjs.map

View File

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

View File

@@ -0,0 +1,22 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type { ObjectFitProperty } from 'csstype';
export declare const avatarProps: {
readonly size: import("element-plus/es/utils").EpPropFinalized<readonly [NumberConstructor, StringConstructor], "" | "small" | "default" | "large", number, "", boolean>;
readonly shape: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "circle" | "square", unknown, "circle", boolean>;
readonly icon: {
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 src: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly alt: StringConstructor;
readonly srcSet: StringConstructor;
readonly fit: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => ObjectFitProperty) | ((new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => ObjectFitProperty))[], unknown, unknown, "cover", boolean>;
};
export type AvatarProps = ExtractPropTypes<typeof avatarProps>;
export type AvatarPropsPublic = __ExtractPublicPropTypes<typeof avatarProps>;
export declare const avatarEmits: {
error: (evt: Event) => boolean;
};
export type AvatarEmits = typeof avatarEmits;

View File

@@ -0,0 +1,37 @@
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { componentSizes } from '../../../constants/size.mjs';
import { isNumber } from '../../../utils/types.mjs';
import { iconPropType } from '../../../utils/vue/icon.mjs';
const avatarProps = buildProps({
size: {
type: [Number, String],
values: componentSizes,
default: "",
validator: (val) => isNumber(val)
},
shape: {
type: String,
values: ["circle", "square"],
default: "circle"
},
icon: {
type: iconPropType
},
src: {
type: String,
default: ""
},
alt: String,
srcSet: String,
fit: {
type: definePropType(String),
default: "cover"
}
});
const avatarEmits = {
error: (evt) => evt instanceof Event
};
export { avatarEmits, avatarProps };
//# sourceMappingURL=avatar.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"avatar.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n iconPropType,\n isNumber,\n} from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type { ObjectFitProperty } from 'csstype'\n\nexport const avatarProps = buildProps({\n /**\n * @description avatar size.\n */\n size: {\n type: [Number, String],\n values: componentSizes,\n default: '',\n validator: (val: unknown): val is number => isNumber(val),\n },\n /**\n * @description avatar shape.\n */\n shape: {\n type: String,\n values: ['circle', 'square'],\n default: 'circle',\n },\n /**\n * @description representation type to icon, more info on icon component.\n */\n icon: {\n type: iconPropType,\n },\n /**\n * @description the source of the image for an image avatar.\n */\n src: {\n type: String,\n default: '',\n },\n /**\n * @description native attribute `alt` of image avatar.\n */\n alt: String,\n /**\n * @description native attribute srcset of image avatar.\n */\n srcSet: String,\n /**\n * @description set how the image fit its container for an image avatar.\n */\n fit: {\n type: definePropType<ObjectFitProperty>(String),\n default: 'cover',\n },\n} as const)\nexport type AvatarProps = ExtractPropTypes<typeof avatarProps>\nexport type AvatarPropsPublic = __ExtractPublicPropTypes<typeof avatarProps>\n\nexport const avatarEmits = {\n error: (evt: Event) => evt instanceof Event,\n}\nexport type AvatarEmits = typeof avatarEmits\n"],"names":[],"mappings":";;;;;AAOY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,SAAS,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,CAAC;AACrC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAChC,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,WAAW,GAAG;AAC3B,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,KAAK;AACtC;;;;"}

View File

@@ -0,0 +1,46 @@
declare function __VLS_template(): {
default?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly size: import("element-plus/es/utils").EpPropFinalized<readonly [NumberConstructor, StringConstructor], "" | "small" | "default" | "large", number, "", boolean>;
readonly shape: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "circle" | "square", unknown, "circle", boolean>;
readonly icon: {
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 src: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly alt: StringConstructor;
readonly srcSet: StringConstructor;
readonly fit: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => import("csstype").ObjectFitProperty) | ((new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => import("csstype").ObjectFitProperty))[], unknown, unknown, "cover", boolean>;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
error: (evt: Event) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly size: import("element-plus/es/utils").EpPropFinalized<readonly [NumberConstructor, StringConstructor], "" | "small" | "default" | "large", number, "", boolean>;
readonly shape: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "circle" | "square", unknown, "circle", boolean>;
readonly icon: {
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 src: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly alt: StringConstructor;
readonly srcSet: StringConstructor;
readonly fit: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => import("csstype").ObjectFitProperty) | ((new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => import("csstype").ObjectFitProperty))[], unknown, unknown, "cover", boolean>;
}>> & {
onError?: ((evt: Event) => any) | undefined;
}, {
readonly size: import("element-plus/es/utils").EpPropMergeType<readonly [NumberConstructor, StringConstructor], "" | "small" | "default" | "large", number>;
readonly shape: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "circle" | "square", unknown>;
readonly src: string;
readonly fit: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => import("csstype").ObjectFitProperty) | ((new (...args: any[]) => "fill" | "contain" | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "none" | "cover" | "scale-down") | (() => import("csstype").ObjectFitProperty))[], 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,71 @@
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, renderSlot } from 'vue';
import { ElIcon } from '../../icon/index.mjs';
import { avatarProps, avatarEmits } from './avatar.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { isString } from '@vue/shared';
import { isNumber } from '../../../utils/types.mjs';
import { addUnit } from '../../../utils/dom/style.mjs';
const __default__ = defineComponent({
name: "ElAvatar"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: avatarProps,
emits: avatarEmits,
setup(__props, { emit }) {
const props = __props;
const ns = useNamespace("avatar");
const hasLoadError = ref(false);
const avatarClass = computed(() => {
const { size, icon, shape } = props;
const classList = [ns.b()];
if (isString(size))
classList.push(ns.m(size));
if (icon)
classList.push(ns.m("icon"));
if (shape)
classList.push(ns.m(shape));
return classList;
});
const sizeStyle = computed(() => {
const { size } = props;
return isNumber(size) ? ns.cssVarBlock({
size: addUnit(size) || ""
}) : void 0;
});
const fitStyle = computed(() => ({
objectFit: props.fit
}));
watch(() => props.src, () => hasLoadError.value = false);
function handleError(e) {
hasLoadError.value = true;
emit("error", e);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
class: normalizeClass(unref(avatarClass)),
style: normalizeStyle(unref(sizeStyle))
}, [
(_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
key: 0,
src: _ctx.src,
alt: _ctx.alt,
srcset: _ctx.srcSet,
style: normalizeStyle(unref(fitStyle)),
onError: handleError
}, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
]),
_: 1
})) : renderSlot(_ctx.$slots, "default", { key: 2 })
], 6);
};
}
});
var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "avatar.vue"]]);
export { Avatar as default };
//# sourceMappingURL=avatar2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"avatar2.mjs","sources":["../../../../../../packages/components/avatar/src/avatar.vue"],"sourcesContent":["<template>\n <span :class=\"avatarClass\" :style=\"sizeStyle\">\n <img\n v-if=\"(src || srcSet) && !hasLoadError\"\n :src=\"src\"\n :alt=\"alt\"\n :srcset=\"srcSet\"\n :style=\"fitStyle\"\n @error=\"handleError\"\n />\n <el-icon v-else-if=\"icon\">\n <component :is=\"icon\" />\n </el-icon>\n <slot v-else />\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { addUnit, isNumber, isString } from '@element-plus/utils'\nimport { avatarEmits, avatarProps } from './avatar'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElAvatar',\n})\n\nconst props = defineProps(avatarProps)\nconst emit = defineEmits(avatarEmits)\n\nconst ns = useNamespace('avatar')\n\nconst hasLoadError = ref(false)\n\nconst avatarClass = computed(() => {\n const { size, icon, shape } = props\n const classList = [ns.b()]\n if (isString(size)) classList.push(ns.m(size))\n if (icon) classList.push(ns.m('icon'))\n if (shape) classList.push(ns.m(shape))\n return classList\n})\n\nconst sizeStyle = computed(() => {\n const { size } = props\n return isNumber(size)\n ? (ns.cssVarBlock({\n size: addUnit(size) || '',\n }) as CSSProperties)\n : undefined\n})\n\nconst fitStyle = computed<CSSProperties>(() => ({\n objectFit: props.fit,\n}))\n\n// need reset hasLoadError to false if src changed\nwatch(\n () => props.src,\n () => (hasLoadError.value = false)\n)\n\nfunction handleError(e: Event) {\n hasLoadError.value = true\n emit('error', e)\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;mCA0Bc,CAAA;AAAA,EACZ,IAAM,EAAA,UAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAEhC,IAAM,MAAA,YAAA,GAAe,IAAI,KAAK,CAAA,CAAA;AAE9B,IAAM,MAAA,WAAA,GAAc,SAAS,MAAM;AACjC,MAAA,MAAM,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAC9B,MAAA,MAAM,SAAY,GAAA,CAAC,EAAG,CAAA,CAAA,EAAG,CAAA,CAAA;AACzB,MAAI,IAAA,QAAA,CAAS,IAAI,CAAG;AACpB,QAAA,SAAoB,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,IAAQ,CAAA,CAAA,CAAA;AAC5B,MAAA,IAAI;AACJ,QAAO,SAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA;AAAA,MACR,IAAA,KAAA;AAED,QAAM,SAAA,CAAA,IAAY,WAAe,CAAA,CAAA,CAAA;AAC/B,MAAM,OAAA,SAAW,CAAA;AACjB,KAAA,CAAA,CAAA;AACoB,IACd,MAAA,SAAc,GAAA,QAAS,CAAA,MAAA;AAAA,MACzB,MACA,EAAA,IAAA,EAAA,GAAA,KAAA,CAAA;AAAA,MACL,OAAA,QAAA,CAAA,IAAA,CAAA,GAAA,EAAA,CAAA,WAAA,CAAA;AAED,QAAM,IAAA,EAAA,OAAW,UAA+B,EAAA;AAAA,iBACnC,CAAM;AAAA,KACjB,CAAA,CAAA;AAGF,IAAA,MAAA,QAAA,GAAA,QAAA,CAAA,OAAA;AAAA,MACE,SAAY,EAAA,KAAA,CAAA,GAAA;AAAA,KACZ,CAAA,CAAA,CAAA;AAA4B,IAC9B,KAAA,CAAA,MAAA,KAAA,CAAA,GAAA,EAAA,MAAA,YAAA,CAAA,KAAA,GAAA,KAAA,CAAA,CAAA;AAEA,IAAA,SAAS,YAAY,CAAU,EAAA;AAC7B,MAAA,YAAA,CAAa,KAAQ,GAAA,IAAA,CAAA;AACrB,MAAA,IAAA,CAAK,SAAS,CAAC,CAAA,CAAA;AAAA,KACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,2 @@
import type Avatar from './avatar.vue';
export type AvatarInstance = InstanceType<typeof Avatar> & unknown;

View File

@@ -0,0 +1,2 @@
//# sourceMappingURL=instance.mjs.map

Some files were not shown because too many files have changed in this diff Show More