测试
This commit is contained in:
5
frontend/node_modules/element-plus/es/components/rate/index.d.ts
generated
vendored
Normal file
5
frontend/node_modules/element-plus/es/components/rate/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import Rate from './src/rate.vue';
|
||||
import type { SFCWithInstall } from 'element-plus/es/utils';
|
||||
export declare const ElRate: SFCWithInstall<typeof Rate>;
|
||||
export default ElRate;
|
||||
export * from './src/rate';
|
||||
8
frontend/node_modules/element-plus/es/components/rate/index.mjs
generated
vendored
Normal file
8
frontend/node_modules/element-plus/es/components/rate/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import Rate from './src/rate2.mjs';
|
||||
export { rateEmits, rateProps } from './src/rate.mjs';
|
||||
import { withInstall } from '../../utils/vue/install.mjs';
|
||||
|
||||
const ElRate = withInstall(Rate);
|
||||
|
||||
export { ElRate, ElRate as default };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/rate/index.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/rate/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/rate/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Rate from './src/rate.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElRate: SFCWithInstall<typeof Rate> = withInstall(Rate)\nexport default ElRate\n\nexport * from './src/rate'\n"],"names":[],"mappings":";;;;AAEY,MAAC,MAAM,GAAG,WAAW,CAAC,IAAI;;;;"}
|
||||
38
frontend/node_modules/element-plus/es/components/rate/src/rate.d.ts
generated
vendored
Normal file
38
frontend/node_modules/element-plus/es/components/rate/src/rate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { Component, ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
|
||||
import type Rate from './rate.vue';
|
||||
export declare const rateProps: {
|
||||
readonly ariaLabel: StringConstructor;
|
||||
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
||||
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
||||
readonly lowThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 2, boolean>;
|
||||
readonly highThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 4, boolean>;
|
||||
readonly max: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 5, boolean>;
|
||||
readonly colors: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>) | ((new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>))[], unknown, unknown, () => ["", "", ""], boolean>;
|
||||
readonly voidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly disabledVoidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly icons: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>) | ((new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>))[], unknown, unknown, () => [Component, Component, Component], boolean>;
|
||||
readonly voidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
|
||||
readonly disabledVoidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
|
||||
readonly disabled: BooleanConstructor;
|
||||
readonly allowHalf: BooleanConstructor;
|
||||
readonly showText: BooleanConstructor;
|
||||
readonly showScore: BooleanConstructor;
|
||||
readonly textColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly texts: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | ((new (...args: any[]) => string[]) | (() => string[]))[], unknown, unknown, () => ["Extremely bad", "Disappointed", "Fair", "Satisfied", "Surprise"], boolean>;
|
||||
readonly scoreTemplate: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "{value}", boolean>;
|
||||
readonly size: {
|
||||
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly clearable: BooleanConstructor;
|
||||
};
|
||||
export type RateProps = ExtractPropTypes<typeof rateProps>;
|
||||
export type RatePropsPublic = __ExtractPublicPropTypes<typeof rateProps>;
|
||||
export declare const rateEmits: {
|
||||
change: (value: number) => boolean;
|
||||
"update:modelValue": (value: number) => boolean;
|
||||
};
|
||||
export type RateEmits = typeof rateEmits;
|
||||
export type RateInstance = InstanceType<typeof Rate> & unknown;
|
||||
87
frontend/node_modules/element-plus/es/components/rate/src/rate.mjs
generated
vendored
Normal file
87
frontend/node_modules/element-plus/es/components/rate/src/rate.mjs
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
import { StarFilled, Star } from '@element-plus/icons-vue';
|
||||
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
||||
import { mutable } from '../../../utils/typescript.mjs';
|
||||
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
||||
import { useSizeProp } from '../../../hooks/use-size/index.mjs';
|
||||
import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
|
||||
import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
|
||||
import { isNumber } from '../../../utils/types.mjs';
|
||||
|
||||
const rateProps = buildProps({
|
||||
modelValue: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: void 0
|
||||
},
|
||||
lowThreshold: {
|
||||
type: Number,
|
||||
default: 2
|
||||
},
|
||||
highThreshold: {
|
||||
type: Number,
|
||||
default: 4
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default: 5
|
||||
},
|
||||
colors: {
|
||||
type: definePropType([Array, Object]),
|
||||
default: () => mutable(["", "", ""])
|
||||
},
|
||||
voidColor: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
disabledVoidColor: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
icons: {
|
||||
type: definePropType([Array, Object]),
|
||||
default: () => [StarFilled, StarFilled, StarFilled]
|
||||
},
|
||||
voidIcon: {
|
||||
type: iconPropType,
|
||||
default: () => Star
|
||||
},
|
||||
disabledVoidIcon: {
|
||||
type: iconPropType,
|
||||
default: () => StarFilled
|
||||
},
|
||||
disabled: Boolean,
|
||||
allowHalf: Boolean,
|
||||
showText: Boolean,
|
||||
showScore: Boolean,
|
||||
textColor: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
texts: {
|
||||
type: definePropType(Array),
|
||||
default: () => mutable([
|
||||
"Extremely bad",
|
||||
"Disappointed",
|
||||
"Fair",
|
||||
"Satisfied",
|
||||
"Surprise"
|
||||
])
|
||||
},
|
||||
scoreTemplate: {
|
||||
type: String,
|
||||
default: "{value}"
|
||||
},
|
||||
size: useSizeProp,
|
||||
clearable: Boolean,
|
||||
...useAriaProps(["ariaLabel"])
|
||||
});
|
||||
const rateEmits = {
|
||||
[CHANGE_EVENT]: (value) => isNumber(value),
|
||||
[UPDATE_MODEL_EVENT]: (value) => isNumber(value)
|
||||
};
|
||||
|
||||
export { rateEmits, rateProps };
|
||||
//# sourceMappingURL=rate.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/rate/src/rate.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/rate/src/rate.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
90
frontend/node_modules/element-plus/es/components/rate/src/rate.vue.d.ts
generated
vendored
Normal file
90
frontend/node_modules/element-plus/es/components/rate/src/rate.vue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
import type { Component } from 'vue';
|
||||
declare function setCurrentValue(value: number, event?: MouseEvent): void;
|
||||
declare function resetCurrentValue(): void;
|
||||
declare const _default: import("vue").DefineComponent<{
|
||||
readonly ariaLabel: StringConstructor;
|
||||
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
||||
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
||||
readonly lowThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 2, boolean>;
|
||||
readonly highThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 4, boolean>;
|
||||
readonly max: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 5, boolean>;
|
||||
readonly colors: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>) | ((new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>))[], unknown, unknown, () => ["", "", ""], boolean>;
|
||||
readonly voidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly disabledVoidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly icons: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>) | ((new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>))[], unknown, unknown, () => [Component, Component, Component], boolean>;
|
||||
readonly voidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
|
||||
readonly disabledVoidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
|
||||
readonly disabled: BooleanConstructor;
|
||||
readonly allowHalf: BooleanConstructor;
|
||||
readonly showText: BooleanConstructor;
|
||||
readonly showScore: BooleanConstructor;
|
||||
readonly textColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly texts: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | ((new (...args: any[]) => string[]) | (() => string[]))[], unknown, unknown, () => ["Extremely bad", "Disappointed", "Fair", "Satisfied", "Surprise"], boolean>;
|
||||
readonly scoreTemplate: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "{value}", boolean>;
|
||||
readonly size: {
|
||||
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly clearable: BooleanConstructor;
|
||||
}, {
|
||||
/** @description set current value */
|
||||
setCurrentValue: typeof setCurrentValue;
|
||||
/** @description reset current value */
|
||||
resetCurrentValue: typeof resetCurrentValue;
|
||||
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
||||
"update:modelValue": (value: number) => void;
|
||||
change: (value: number) => void;
|
||||
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
readonly ariaLabel: StringConstructor;
|
||||
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
||||
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
||||
readonly lowThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 2, boolean>;
|
||||
readonly highThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 4, boolean>;
|
||||
readonly max: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 5, boolean>;
|
||||
readonly colors: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>) | ((new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>))[], unknown, unknown, () => ["", "", ""], boolean>;
|
||||
readonly voidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly disabledVoidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly icons: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>) | ((new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>))[], unknown, unknown, () => [Component, Component, Component], boolean>;
|
||||
readonly voidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
|
||||
readonly disabledVoidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
|
||||
readonly disabled: BooleanConstructor;
|
||||
readonly allowHalf: BooleanConstructor;
|
||||
readonly showText: BooleanConstructor;
|
||||
readonly showScore: BooleanConstructor;
|
||||
readonly textColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly texts: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | ((new (...args: any[]) => string[]) | (() => string[]))[], unknown, unknown, () => ["Extremely bad", "Disappointed", "Fair", "Satisfied", "Surprise"], boolean>;
|
||||
readonly scoreTemplate: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "{value}", boolean>;
|
||||
readonly size: {
|
||||
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly clearable: BooleanConstructor;
|
||||
}>> & {
|
||||
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
||||
onChange?: ((value: number) => any) | undefined;
|
||||
}, {
|
||||
readonly disabled: boolean;
|
||||
readonly id: string;
|
||||
readonly modelValue: number;
|
||||
readonly max: number;
|
||||
readonly clearable: boolean;
|
||||
readonly textColor: string;
|
||||
readonly colors: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>) | ((new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>))[], unknown, unknown>;
|
||||
readonly showText: boolean;
|
||||
readonly lowThreshold: number;
|
||||
readonly highThreshold: number;
|
||||
readonly voidColor: string;
|
||||
readonly disabledVoidColor: string;
|
||||
readonly icons: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>) | ((new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>))[], unknown, unknown>;
|
||||
readonly voidIcon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>;
|
||||
readonly disabledVoidIcon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>;
|
||||
readonly texts: string[];
|
||||
readonly scoreTemplate: string;
|
||||
readonly allowHalf: boolean;
|
||||
readonly showScore: boolean;
|
||||
}>;
|
||||
export default _default;
|
||||
260
frontend/node_modules/element-plus/es/components/rate/src/rate2.mjs
generated
vendored
Normal file
260
frontend/node_modules/element-plus/es/components/rate/src/rate2.mjs
generated
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
import { defineComponent, inject, ref, computed, markRaw, watch, openBlock, createElementBlock, unref, normalizeClass, normalizeStyle, Fragment, renderList, createVNode, withCtx, withDirectives, createBlock, resolveDynamicComponent, vShow, toDisplayString, createCommentVNode } from 'vue';
|
||||
import { clamp } from 'lodash-unified';
|
||||
import { ElIcon } from '../../icon/index.mjs';
|
||||
import { rateProps, rateEmits } from './rate.mjs';
|
||||
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
||||
import { formContextKey, formItemContextKey } from '../../form/src/constants.mjs';
|
||||
import { useFormSize } from '../../form/src/hooks/use-form-common-props.mjs';
|
||||
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
||||
import { useFormItemInputId } from '../../form/src/hooks/use-form-item.mjs';
|
||||
import { isArray, isObject, isString } from '@vue/shared';
|
||||
import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
|
||||
import { getEventCode } from '../../../utils/dom/event.mjs';
|
||||
import { EVENT_CODE } from '../../../constants/aria.mjs';
|
||||
|
||||
const __default__ = defineComponent({
|
||||
name: "ElRate"
|
||||
});
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
...__default__,
|
||||
props: rateProps,
|
||||
emits: rateEmits,
|
||||
setup(__props, { expose, emit }) {
|
||||
const props = __props;
|
||||
function getValueFromMap(value, map) {
|
||||
const isExcludedObject = (val) => isObject(val);
|
||||
const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
|
||||
const val = map[key];
|
||||
const excluded = isExcludedObject(val) ? val.excluded : false;
|
||||
return excluded ? value < key : value <= key;
|
||||
}).sort((a, b) => a - b);
|
||||
const matchedValue = map[matchedKeys[0]];
|
||||
return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
|
||||
}
|
||||
const formContext = inject(formContextKey, void 0);
|
||||
const formItemContext = inject(formItemContextKey, void 0);
|
||||
const rateSize = useFormSize();
|
||||
const ns = useNamespace("rate");
|
||||
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
|
||||
formItemContext
|
||||
});
|
||||
const currentValue = ref(props.modelValue);
|
||||
const hoverIndex = ref(-1);
|
||||
const pointerAtLeftHalf = ref(true);
|
||||
const iconRefs = ref([]);
|
||||
const iconClientWidths = computed(() => iconRefs.value.map((icon) => icon.$el.clientWidth));
|
||||
const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
|
||||
const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
|
||||
const rateStyles = computed(() => {
|
||||
return ns.cssVarBlock({
|
||||
"void-color": props.voidColor,
|
||||
"disabled-void-color": props.disabledVoidColor,
|
||||
"fill-color": activeColor.value
|
||||
});
|
||||
});
|
||||
const text = computed(() => {
|
||||
let result = "";
|
||||
if (props.showScore) {
|
||||
result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
|
||||
} else if (props.showText) {
|
||||
result = props.texts[Math.ceil(currentValue.value) - 1];
|
||||
}
|
||||
return result;
|
||||
});
|
||||
const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
|
||||
const colorMap = computed(() => isArray(props.colors) ? {
|
||||
[props.lowThreshold]: props.colors[0],
|
||||
[props.highThreshold]: { value: props.colors[1], excluded: true },
|
||||
[props.max]: props.colors[2]
|
||||
} : props.colors);
|
||||
const activeColor = computed(() => {
|
||||
const color = getValueFromMap(currentValue.value, colorMap.value);
|
||||
return isObject(color) ? "" : color;
|
||||
});
|
||||
const decimalStyle = computed(() => {
|
||||
let width = "";
|
||||
if (rateDisabled.value) {
|
||||
width = `${valueDecimal.value}%`;
|
||||
} else if (props.allowHalf) {
|
||||
width = "50%";
|
||||
}
|
||||
return {
|
||||
color: activeColor.value,
|
||||
width
|
||||
};
|
||||
});
|
||||
const componentMap = computed(() => {
|
||||
let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons };
|
||||
icons = markRaw(icons);
|
||||
return isArray(icons) ? {
|
||||
[props.lowThreshold]: icons[0],
|
||||
[props.highThreshold]: {
|
||||
value: icons[1],
|
||||
excluded: true
|
||||
},
|
||||
[props.max]: icons[2]
|
||||
} : icons;
|
||||
});
|
||||
const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
|
||||
const voidComponent = computed(() => rateDisabled.value ? isString(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
|
||||
const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
|
||||
function showDecimalIcon(item) {
|
||||
const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
|
||||
const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
|
||||
return showWhenDisabled || showWhenAllowHalf;
|
||||
}
|
||||
function emitValue(value) {
|
||||
if (props.clearable && value === props.modelValue) {
|
||||
value = 0;
|
||||
}
|
||||
emit(UPDATE_MODEL_EVENT, value);
|
||||
if (props.modelValue !== value) {
|
||||
emit(CHANGE_EVENT, value);
|
||||
}
|
||||
}
|
||||
function selectValue(value) {
|
||||
if (rateDisabled.value) {
|
||||
return;
|
||||
}
|
||||
if (props.allowHalf && pointerAtLeftHalf.value) {
|
||||
emitValue(currentValue.value);
|
||||
} else {
|
||||
emitValue(value);
|
||||
}
|
||||
}
|
||||
function handleKey(e) {
|
||||
if (rateDisabled.value) {
|
||||
return;
|
||||
}
|
||||
const code = getEventCode(e);
|
||||
const step = props.allowHalf ? 0.5 : 1;
|
||||
let _currentValue = currentValue.value;
|
||||
switch (code) {
|
||||
case EVENT_CODE.up:
|
||||
case EVENT_CODE.right:
|
||||
_currentValue += step;
|
||||
break;
|
||||
case EVENT_CODE.left:
|
||||
case EVENT_CODE.down:
|
||||
_currentValue -= step;
|
||||
break;
|
||||
}
|
||||
_currentValue = clamp(_currentValue, 0, props.max);
|
||||
if (_currentValue === currentValue.value) {
|
||||
return;
|
||||
}
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
emit(UPDATE_MODEL_EVENT, _currentValue);
|
||||
emit(CHANGE_EVENT, _currentValue);
|
||||
return _currentValue;
|
||||
}
|
||||
function setCurrentValue(value, event) {
|
||||
if (rateDisabled.value) {
|
||||
return;
|
||||
}
|
||||
if (props.allowHalf && event) {
|
||||
pointerAtLeftHalf.value = event.offsetX * 2 <= iconClientWidths.value[value - 1];
|
||||
currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
|
||||
} else {
|
||||
currentValue.value = value;
|
||||
}
|
||||
hoverIndex.value = value;
|
||||
}
|
||||
function resetCurrentValue() {
|
||||
if (rateDisabled.value) {
|
||||
return;
|
||||
}
|
||||
if (props.allowHalf) {
|
||||
pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
|
||||
}
|
||||
currentValue.value = props.modelValue;
|
||||
hoverIndex.value = -1;
|
||||
}
|
||||
watch(() => props.modelValue, (val) => {
|
||||
currentValue.value = val;
|
||||
pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
|
||||
});
|
||||
if (!props.modelValue) {
|
||||
emit(UPDATE_MODEL_EVENT, 0);
|
||||
}
|
||||
expose({
|
||||
setCurrentValue,
|
||||
resetCurrentValue
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
var _a;
|
||||
return openBlock(), createElementBlock("div", {
|
||||
id: unref(inputId),
|
||||
class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
|
||||
role: "slider",
|
||||
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
|
||||
"aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
|
||||
"aria-valuenow": currentValue.value,
|
||||
"aria-valuetext": unref(text) || void 0,
|
||||
"aria-valuemin": "0",
|
||||
"aria-valuemax": _ctx.max,
|
||||
tabindex: "0",
|
||||
style: normalizeStyle(unref(rateStyles)),
|
||||
onKeydown: handleKey
|
||||
}, [
|
||||
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
|
||||
return openBlock(), createElementBlock("span", {
|
||||
key,
|
||||
class: normalizeClass(unref(ns).e("item")),
|
||||
onMousemove: ($event) => setCurrentValue(item, $event),
|
||||
onMouseleave: resetCurrentValue,
|
||||
onClick: ($event) => selectValue(item)
|
||||
}, [
|
||||
createVNode(unref(ElIcon), {
|
||||
ref_for: true,
|
||||
ref_key: "iconRefs",
|
||||
ref: iconRefs,
|
||||
class: normalizeClass([
|
||||
unref(ns).e("icon"),
|
||||
{ hover: hoverIndex.value === item },
|
||||
unref(ns).is("active", item <= currentValue.value),
|
||||
unref(ns).is("focus-visible", item === Math.ceil(currentValue.value || 1))
|
||||
])
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), null, null, 512)), [
|
||||
[vShow, !showDecimalIcon(item) && item <= currentValue.value]
|
||||
]),
|
||||
withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), null, null, 512)), [
|
||||
[vShow, !showDecimalIcon(item) && item > currentValue.value]
|
||||
]),
|
||||
withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), {
|
||||
class: normalizeClass([unref(ns).em("decimal", "box")])
|
||||
}, null, 8, ["class"])), [
|
||||
[vShow, showDecimalIcon(item)]
|
||||
]),
|
||||
withDirectives(createVNode(unref(ElIcon), {
|
||||
style: normalizeStyle(unref(decimalStyle)),
|
||||
class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
(openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
|
||||
]),
|
||||
_: 2
|
||||
}, 1032, ["style", "class"]), [
|
||||
[vShow, showDecimalIcon(item)]
|
||||
])
|
||||
]),
|
||||
_: 2
|
||||
}, 1032, ["class"])
|
||||
], 42, ["onMousemove", "onClick"]);
|
||||
}), 128)),
|
||||
_ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass(unref(ns).e("text")),
|
||||
style: normalizeStyle({ color: _ctx.textColor })
|
||||
}, toDisplayString(unref(text)), 7)) : createCommentVNode("v-if", true)
|
||||
], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
|
||||
};
|
||||
}
|
||||
});
|
||||
var Rate = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "rate.vue"]]);
|
||||
|
||||
export { Rate as default };
|
||||
//# sourceMappingURL=rate2.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/rate/src/rate2.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/rate/src/rate2.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
frontend/node_modules/element-plus/es/components/rate/style/css.d.ts
generated
vendored
Normal file
2
frontend/node_modules/element-plus/es/components/rate/style/css.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import 'element-plus/es/components/base/style/css';
|
||||
import 'element-plus/theme-chalk/el-rate.css';
|
||||
3
frontend/node_modules/element-plus/es/components/rate/style/css.mjs
generated
vendored
Normal file
3
frontend/node_modules/element-plus/es/components/rate/style/css.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import '../../base/style/css.mjs';
|
||||
import 'element-plus/theme-chalk/el-rate.css';
|
||||
//# sourceMappingURL=css.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/rate/style/css.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/rate/style/css.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
||||
2
frontend/node_modules/element-plus/es/components/rate/style/index.d.ts
generated
vendored
Normal file
2
frontend/node_modules/element-plus/es/components/rate/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import 'element-plus/es/components/base/style';
|
||||
import 'element-plus/theme-chalk/src/rate.scss';
|
||||
3
frontend/node_modules/element-plus/es/components/rate/style/index.mjs
generated
vendored
Normal file
3
frontend/node_modules/element-plus/es/components/rate/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import '../../base/style/index.mjs';
|
||||
import 'element-plus/theme-chalk/src/rate.scss';
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/rate/style/index.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/rate/style/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
||||
Reference in New Issue
Block a user