(component): 修复 slider 警告

This commit is contained in:
就眠儀式 2022-10-18 00:39:03 +08:00
parent d9116dc47e
commit e141750076
34 changed files with 81 additions and 80 deletions

View File

@ -30,8 +30,8 @@ const classes = computed(() => {
}); });
const styles = computed<StyleValue>(() => { const styles = computed<StyleValue>(() => {
return [props.color ? `background-color: ${props.color}` : ""]; return [props.color ? `background-color: ${props.color}` : ""]
}); })
</script> </script>
<template> <template>

View File

@ -72,7 +72,7 @@ const selectedKey = computed({
const indent = computed(() => { const indent = computed(() => {
return props.indent; return props.indent;
}) });
watch( watch(
() => props.collapse, () => props.collapse,

View File

@ -67,7 +67,7 @@ import LayCarousel from "../carousel/index.vue";
import LayCarouselItem from "../carouselItem/index.vue"; import LayCarouselItem from "../carouselItem/index.vue";
import { LayIcon } from "@layui/icons-vue"; import { LayIcon } from "@layui/icons-vue";
export interface LayNoticeBarProps { export interface NoticeBarProps {
mode?: string; mode?: string;
text?: string; text?: string;
textlist?: any[]; textlist?: any[];
@ -82,7 +82,7 @@ export interface LayNoticeBarProps {
rightIcon?: string; rightIcon?: string;
} }
const props = withDefaults(defineProps<LayNoticeBarProps>(), { const props = withDefaults(defineProps<NoticeBarProps>(), {
color: () => "var(--color-warning)", color: () => "var(--color-warning)",
background: () => "var(--color-warning-light-9)", background: () => "var(--color-warning-light-9)",
text: "", text: "",

View File

@ -9,7 +9,7 @@ import "./index.less";
import { Ref, ref, watch, useSlots, computed } from "vue"; import { Ref, ref, watch, useSlots, computed } from "vue";
import { useI18n } from "../../language"; import { useI18n } from "../../language";
export interface LayPageProps { export interface PageProps {
total: number; total: number;
limit: number; limit: number;
theme?: string; theme?: string;
@ -24,7 +24,7 @@ export interface LayPageProps {
modelValue?: number; modelValue?: number;
} }
const props = withDefaults(defineProps<LayPageProps>(), { const props = withDefaults(defineProps<PageProps>(), {
limit: 10, limit: 10,
pages: 10, pages: 10,
modelValue: 1, modelValue: 1,

View File

@ -20,11 +20,11 @@ export default {
import { useSlots } from "vue"; import { useSlots } from "vue";
import "./index.less"; import "./index.less";
export interface LayPageHeaderProps { export interface PageHeaderProps {
content?: string; content?: string;
backText?: string; backText?: string;
} }
const props = withDefaults(defineProps<LayPageHeaderProps>(), { const props = withDefaults(defineProps<PageHeaderProps>(), {
content: "", content: "",
backText: "返回", backText: "返回",
}); });

View File

@ -9,11 +9,11 @@ import "./index.less";
import { computed } from "vue"; import { computed } from "vue";
import { PanelShadow } from "./interface"; import { PanelShadow } from "./interface";
export interface LayPanelProps { export interface PanelProps {
shadow?: PanelShadow; shadow?: PanelShadow;
} }
const props = withDefaults(defineProps<LayPanelProps>(), { const props = withDefaults(defineProps<PanelProps>(), {
shadow: "always", shadow: "always",
}); });

View File

@ -44,10 +44,9 @@ import {
useResizeObserver, useResizeObserver,
useThrottleFn, useThrottleFn,
} from "@vueuse/core"; } from "@vueuse/core";
import { PopperTrigger } from '../tooltip/index.vue';
export type PopperTrigger = "click" | "hover" | "focus" | "contextMenu"; export interface PopperProps {
export interface LayPopperProps {
el: HTMLElement; el: HTMLElement;
content?: string | Number; content?: string | Number;
position?: string; position?: string;
@ -62,7 +61,7 @@ export interface LayPopperProps {
popperStyle?: StyleValue; popperStyle?: StyleValue;
} }
const props = withDefaults(defineProps<LayPopperProps>(), { const props = withDefaults(defineProps<PopperProps>(), {
position: "top", position: "top",
isDark: true, isDark: true,
disabled: false, disabled: false,

View File

@ -0,0 +1 @@
export type PopperTrigger = "click" | "hover" | "focus" | "contextMenu";

View File

@ -8,7 +8,7 @@ export default {
import "./index.less"; import "./index.less";
import { computed } from "vue"; import { computed } from "vue";
export interface LayProgressProps { export interface ProgressProps {
percent: number | string; percent: number | string;
theme?: string; theme?: string;
color?: string; color?: string;
@ -20,7 +20,7 @@ export interface LayProgressProps {
circleWidth?: number; circleWidth?: number;
} }
const props = withDefaults(defineProps<LayProgressProps>(), { const props = withDefaults(defineProps<ProgressProps>(), {
circle: false, circle: false,
circleSize: 150, circleSize: 150,
circleWidth: 6, circleWidth: 6,

View File

@ -7,11 +7,11 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import "./index.less"; import "./index.less";
export interface LayQuoteProps { export interface QuoteProps {
type?: string; type?: string;
} }
const props = defineProps<LayQuoteProps>(); const props = defineProps<QuoteProps>();
</script> </script>
<template> <template>

View File

@ -9,7 +9,7 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import "./index.less"; import "./index.less";
export interface LayRadioProps { export interface RadioProps {
name?: string; name?: string;
size?: RadioSize; size?: RadioSize;
disabled?: boolean; disabled?: boolean;
@ -18,7 +18,7 @@ export interface LayRadioProps {
label?: string; label?: string;
} }
const props = withDefaults(defineProps<LayRadioProps>(), { const props = withDefaults(defineProps<RadioProps>(), {
size: "md", size: "md",
}); });

View File

@ -7,13 +7,13 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { provide, ref, watch } from "vue"; import { provide, ref, watch } from "vue";
export interface LayRadioGroupProps { export interface RadioGroupProps {
modelValue?: string | boolean | number; modelValue?: string | boolean | number;
name?: string; name?: string;
disabled?: boolean; disabled?: boolean;
} }
const props = withDefaults(defineProps<LayRadioGroupProps>(), { const props = withDefaults(defineProps<RadioGroupProps>(), {
disabled: false, disabled: false,
}); });
@ -21,6 +21,7 @@ const emit = defineEmits(["update:modelValue", "change"]);
const modelValue = ref(props.modelValue); const modelValue = ref(props.modelValue);
const disabled = ref(props.disabled); const disabled = ref(props.disabled);
provide("radioGroup", { provide("radioGroup", {
name: "LayRadioGroup", name: "LayRadioGroup",
modelValue: modelValue, modelValue: modelValue,

View File

@ -8,7 +8,7 @@ export default {
import { computed, ref, watch, withDefaults } from "vue"; import { computed, ref, watch, withDefaults } from "vue";
import "./index.less"; import "./index.less";
export interface LayRateProps { export interface RateProps {
theme?: string; theme?: string;
length?: number; length?: number;
modelValue: number; modelValue: number;
@ -21,7 +21,7 @@ export interface LayRateProps {
icons?: string[]; icons?: string[];
} }
const props = withDefaults(defineProps<LayRateProps>(), { const props = withDefaults(defineProps<RateProps>(), {
length: 5, length: 5,
modelValue: 0, modelValue: 0,
readonly: false, readonly: false,

View File

@ -8,7 +8,7 @@ export default {
import "./index.less"; import "./index.less";
import { useSlots } from "vue"; import { useSlots } from "vue";
export interface LayResultProps { export interface ResultProps {
title?: string; title?: string;
status?: "success" | "failure"; status?: "success" | "failure";
describe?: string; describe?: string;
@ -16,7 +16,7 @@ export interface LayResultProps {
const slots = useSlots(); const slots = useSlots();
const props = withDefaults(defineProps<LayResultProps>(), { const props = withDefaults(defineProps<ResultProps>(), {
title: "提交信息", title: "提交信息",
status: "success", status: "success",
describe: "请核对并修改以下信息后,再重新提交。", describe: "请核对并修改以下信息后,再重新提交。",

View File

@ -7,14 +7,15 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref, watch } from "vue"; import { computed, onMounted, ref, watch } from "vue";
import "./index.less"; import "./index.less";
import { RippleTrigger, RippleType } from "./interface";
export interface RippleProps { export interface RippleProps {
type?: "out" | "inset"; type?: RippleType;
color?: string; color?: string;
borderRadius?: string; borderRadius?: string;
spreadWidth?: string; spreadWidth?: string;
spreadSize?: string; spreadSize?: string;
trigger?: "always" | "mouseenter" | "click"; trigger?: RippleTrigger;
center?: boolean; center?: boolean;
} }

View File

@ -0,0 +1,2 @@
export type RippleType = "out" | "inset";
export type RippleTrigger = "always" | "mouseenter" | "click"

View File

@ -8,11 +8,11 @@ export default {
import { computed } from "vue"; import { computed } from "vue";
import "./index.less"; import "./index.less";
export interface LayRowProps { export interface RowProps {
space?: string | number; space?: string | number;
} }
const props = defineProps<LayRowProps>(); const props = defineProps<RowProps>();
const classes = computed(() => { const classes = computed(() => {
return [props.space ? `layui-col-space${props.space}` : ""]; return [props.space ? `layui-col-space${props.space}` : ""];

View File

@ -38,16 +38,16 @@ export default {
<script lang="ts" setup> <script lang="ts" setup>
import "./index.less"; import "./index.less";
import { toRefs, onMounted, nextTick, reactive, onUnmounted, ref } from "vue"; import { onMounted, nextTick, reactive, onUnmounted, ref } from "vue";
export interface LayScrollProps { export interface ScrollProps {
height?: string; height?: string;
trackColor?: string; trackColor?: string;
thumbColor?: string; thumbColor?: string;
thumbWidth?: number; thumbWidth?: number;
} }
const props = withDefaults(defineProps<LayScrollProps>(), { const props = withDefaults(defineProps<ScrollProps>(), {
height: "100%", height: "100%",
trackColor: "rgba(0,0,0,0)", trackColor: "rgba(0,0,0,0)",
thumbColor: "#eeeeee", thumbColor: "#eeeeee",
@ -103,7 +103,9 @@ const monitorScrollBar = function () {
// @ts-ignore // @ts-ignore
let MutationObserver = let MutationObserver =
window.MutationObserver || window.MutationObserver ||
// @ts-ignore
window.WebKitMutationObserver || window.WebKitMutationObserver ||
// @ts-ignore
window.MozMutationObserver; window.MozMutationObserver;
const observer: any = new MutationObserver((mutations) => { const observer: any = new MutationObserver((mutations) => {
initScrollListner(); initScrollListner();

View File

@ -27,10 +27,9 @@ import LayDropdown from "../dropdown/index.vue";
import LaySelectOption, { import LaySelectOption, {
LaySelectOptionProps, LaySelectOptionProps,
} from "../selectOption/index.vue"; } from "../selectOption/index.vue";
import { arrayExpression } from "@babel/types";
import { SelectSize } from "./interface"; import { SelectSize } from "./interface";
export interface LaySelectProps { export interface SelectProps {
name?: string; name?: string;
disabled?: boolean; disabled?: boolean;
placeholder?: string; placeholder?: string;
@ -53,7 +52,7 @@ export interface SelectEmits {
(e: "search", value: string): void; (e: "search", value: string): void;
} }
const props = withDefaults(defineProps<LaySelectProps>(), { const props = withDefaults(defineProps<SelectProps>(), {
modelValue: null, modelValue: null,
placeholder: "请选择", placeholder: "请选择",
showEmpty: true, showEmpty: true,

View File

@ -16,25 +16,22 @@ import {
useSlots, useSlots,
} from "vue"; } from "vue";
export interface LaySelectOptionProps { export interface SelectOptionProps {
label?: string; label?: string;
value: string | number | object; value: string | number | object;
disabled?: boolean; disabled?: boolean;
keyword?: string; keyword?: string;
} }
const props = withDefaults(defineProps<LaySelectOptionProps>(), { const props = withDefaults(defineProps<SelectOptionProps>(), {
disabled: false, disabled: false,
keyword: "", keyword: "",
label: "", label: "",
}); });
const openState: Ref<boolean> = inject("openState") as Ref<boolean>;
const selectedValue: WritableComputedRef<any> = inject(
"selectedValue"
) as WritableComputedRef<any>;
const searchValue: Ref<string> = inject("searchValue") as Ref<string>; const searchValue: Ref<string> = inject("searchValue") as Ref<string>;
const selectRef: Ref<HTMLElement> = inject("selectRef") as Ref<HTMLElement>; const selectRef: Ref<HTMLElement> = inject("selectRef") as Ref<HTMLElement>;
const selectedValue: WritableComputedRef<any> = inject("selectedValue") as WritableComputedRef<any>;
const multiple: ComputedRef = inject("multiple") as ComputedRef; const multiple: ComputedRef = inject("multiple") as ComputedRef;
const handleSelect = () => { const handleSelect = () => {

View File

@ -8,11 +8,11 @@ export default {
import { computed, CSSProperties } from "vue"; import { computed, CSSProperties } from "vue";
import "./index.less"; import "./index.less";
export interface LaySideProps { export interface SideProps {
width?: string | number; width?: string | number;
} }
const props = withDefaults(defineProps<LaySideProps>(), { const props = withDefaults(defineProps<SideProps>(), {
width: "200px", width: "200px",
}); });

View File

@ -9,13 +9,13 @@ import "./index.less";
import { withDefaults } from "vue"; import { withDefaults } from "vue";
import LaySkeletonItem from "../skeletonItem/index.vue"; import LaySkeletonItem from "../skeletonItem/index.vue";
export interface LaySkeletonProps { export interface SkeletonProps {
rows?: number; rows?: number;
loading?: boolean; loading?: boolean;
animated?: boolean; animated?: boolean;
} }
const props = withDefaults(defineProps<LaySkeletonProps>(), { const props = withDefaults(defineProps<SkeletonProps>(), {
rows: 4, rows: 4,
loading: false, loading: false,
animated: false, animated: false,

View File

@ -8,11 +8,11 @@ export default {
import { withDefaults } from "vue"; import { withDefaults } from "vue";
import { LayIcon } from "@layui/icons-vue"; import { LayIcon } from "@layui/icons-vue";
export interface LaySkeletonProps { export interface SkeletonProps {
type?: string; type?: string;
} }
const props = withDefaults(defineProps<LaySkeletonProps>(), { const props = withDefaults(defineProps<SkeletonProps>(), {
type: "p", type: "p",
}); });
</script> </script>

View File

@ -1,17 +1,16 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: "StandardVue", name: "StandardVue",
}; }
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { Ref, ref } from "vue"; import { Ref, ref } from "vue";
import { on, off } from "evtd"; import { on, off } from "evtd";
// import { throttle, handle_select } from "./utils/index";
import LayTooltip from "../tooltip/index.vue"; import LayTooltip from "../tooltip/index.vue";
import { throttle, handle_select, makeDots } from "./utils/index"; import { throttle, handle_select, makeDots } from "./utils/index";
interface Prop { export interface StandardProps {
val?: number | Array<number>; val?: number | Array<number>;
disabled?: boolean; disabled?: boolean;
step?: number; step?: number;
@ -20,7 +19,7 @@ interface Prop {
showDots?: boolean; showDots?: boolean;
} }
const props = withDefaults(defineProps<Prop>(), { const props = withDefaults(defineProps<StandardProps>(), {
disabled: false, disabled: false,
val: 0, val: 0,
step: 0, step: 0,
@ -47,7 +46,7 @@ function handle_mousedown() {
const tracker = ref<HTMLElement | null>(null); const tracker = ref<HTMLElement | null>(null);
let standard_style: Ref<number> = ref<number>(props.val as number); let standard_style: Ref<number> = ref<number>(props.val as number);
const emit = defineEmits(["link-val-hook"]); const emit = defineEmits(["link-val-hook"]);
const tooptipHide = ref<Boolean>(true); const tooptipHide = ref<boolean>(true);
function standardMove(e: MouseEvent) { function standardMove(e: MouseEvent) {
tooptipHide.value = false; tooptipHide.value = false;

View File

@ -1,16 +1,16 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: "StandardRange", name: "StandardRange",
}; }
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref, toRef, Ref } from "vue"; import { ref, toRef, Ref } from "vue";
import { on, off } from "evtd"; import { on, off } from "evtd";
// import { throttle } from "./utils/index";
import LayTooltip from "../tooltip/index.vue"; import LayTooltip from "../tooltip/index.vue";
import { throttle, makeDots } from "./utils/index"; import { throttle, makeDots } from "./utils/index";
interface Prop {
export interface StandardRangeProps {
rangeValue: Array<number>; rangeValue: Array<number>;
disabled?: boolean; disabled?: boolean;
step?: number; step?: number;
@ -19,7 +19,7 @@ interface Prop {
showDots?: boolean; showDots?: boolean;
} }
const props = withDefaults(defineProps<Prop>(), { const props = withDefaults(defineProps<StandardRangeProps>(), {
step: 0, step: 0,
min: 0, min: 0,
max: 100, max: 100,
@ -53,7 +53,7 @@ function handle_select(e: Event): void {
const tracker = ref<HTMLElement | null>(null); const tracker = ref<HTMLElement | null>(null);
const emit = defineEmits(["link-val-hook"]); const emit = defineEmits(["link-val-hook"]);
const tooptipHide = ref<Boolean>(true); const tooptipHide = ref<boolean>(true);
function rangeMove(e: MouseEvent) { function rangeMove(e: MouseEvent) {
// tooptipHide.value = false; // tooptipHide.value = false;

View File

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: "Vertical", name: "Vertical",
}; }
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
@ -10,7 +10,7 @@ import { on, off } from "evtd";
import { throttle } from "./utils/index"; import { throttle } from "./utils/index";
import LayTooltip from "../tooltip/index.vue"; import LayTooltip from "../tooltip/index.vue";
interface Prop { export interface VerticalProps {
val?: number | Array<number>; val?: number | Array<number>;
disabled?: boolean; disabled?: boolean;
step?: number; step?: number;
@ -19,7 +19,7 @@ interface Prop {
showDots: boolean; showDots: boolean;
} }
const props = withDefaults(defineProps<Prop>(), { const props = withDefaults(defineProps<VerticalProps>(), {
disabled: true, disabled: true,
val: 0, val: 0,
step: 0, step: 0,
@ -49,7 +49,7 @@ function handle_mousedown() {
const tracker = ref<HTMLElement | null>(null); const tracker = ref<HTMLElement | null>(null);
let vertical_style: Ref<number> = ref<number>(props.val as number); let vertical_style: Ref<number> = ref<number>(props.val as number);
const emit = defineEmits(["link-val-hook"]); const emit = defineEmits(["link-val-hook"]);
const tooptipHide = ref<Boolean>(true); const tooptipHide = ref<boolean>(true);
function verticalMove(e: MouseEvent) { function verticalMove(e: MouseEvent) {
tooptipHide.value = false; tooptipHide.value = false;

View File

@ -1,16 +1,16 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: "VerticalRange", name: "VerticalRange",
}; }
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref, toRef, Ref } from "vue"; import { ref, toRef, Ref } from "vue";
import { on, off } from "evtd"; import { on, off } from "evtd";
// import { throttle } from "./utils/index";
import LayTooltip from "../tooltip/index.vue"; import LayTooltip from "../tooltip/index.vue";
import { throttle, makeDots } from "./utils/index"; import { throttle, makeDots } from "./utils/index";
interface Prop {
export interface VerticalRangeProps {
rangeValue: Array<number>; rangeValue: Array<number>;
disabled?: boolean; disabled?: boolean;
step?: number; step?: number;
@ -19,7 +19,7 @@ interface Prop {
showDots?: boolean; showDots?: boolean;
} }
const props = withDefaults(defineProps<Prop>(), { const props = withDefaults(defineProps<VerticalRangeProps>(), {
step: 0, step: 0,
min: 0, min: 0,
max: 100, max: 100,
@ -52,7 +52,7 @@ function handle_select(e: Event): void {
const tracker = ref<HTMLElement | null>(null); const tracker = ref<HTMLElement | null>(null);
const emit = defineEmits(["link-val-hook"]); const emit = defineEmits(["link-val-hook"]);
const tooptipHide = ref<Boolean>(true); const tooptipHide = ref<boolean>(true);
function rangeMove(e: MouseEvent) { function rangeMove(e: MouseEvent) {
// tooptipHide.value = false; // tooptipHide.value = false;

View File

@ -12,7 +12,7 @@ import StandardRange from "./StandardRange.vue";
import Vertical from "./Vertical.vue"; import Vertical from "./Vertical.vue";
import VerticalRange from "./VerticalRange.vue"; import VerticalRange from "./VerticalRange.vue";
export interface LaySliderProps { export interface SliderProps {
vertical?: boolean; vertical?: boolean;
modelValue?: number | Array<number>; modelValue?: number | Array<number>;
min?: number; min?: number;
@ -26,7 +26,7 @@ export interface LaySliderProps {
const emit = defineEmits(["update:modelValue"]); const emit = defineEmits(["update:modelValue"]);
const props = withDefaults(defineProps<LaySliderProps>(), { const props = withDefaults(defineProps<SliderProps>(), {
vertical: false, vertical: false,
modelValue: 0, modelValue: 0,
disabled: false, disabled: false,

View File

@ -9,7 +9,7 @@ import { LayIcon } from "@layui/icons-vue";
import LayPage from "../page/index.vue"; import LayPage from "../page/index.vue";
import { computed, WritableComputedRef } from "vue"; import { computed, WritableComputedRef } from "vue";
export interface LayTablePageProps { export interface TablePageProps {
showPage?: boolean; showPage?: boolean;
showSkip?: boolean; showSkip?: boolean;
showLimit?: boolean; showLimit?: boolean;
@ -23,7 +23,7 @@ export interface LayTablePageProps {
theme?: string; theme?: string;
} }
const props = withDefaults(defineProps<LayTablePageProps>(), { const props = withDefaults(defineProps<TablePageProps>(), {
showPage: true, showPage: true,
showLimit: true, showLimit: true,
showSkip: true, showSkip: true,

View File

@ -12,7 +12,7 @@ import LayCheckbox from "../checkbox/index.vue";
import LayTooltip from "../tooltip/index.vue"; import LayTooltip from "../tooltip/index.vue";
import LayRadio from "../radio/index.vue"; import LayRadio from "../radio/index.vue";
export interface LayTableRowProps { export interface TableRowProps {
index: number; index: number;
indentSize: number; indentSize: number;
currentIndentSize: number; currentIndentSize: number;
@ -48,7 +48,7 @@ const emit = defineEmits([
"update:selectedKey", "update:selectedKey",
]); ]);
const props = withDefaults(defineProps<LayTableRowProps>(), { const props = withDefaults(defineProps<TableRowProps>(), {
checkbox: false, checkbox: false,
childrenColumnName: "children", childrenColumnName: "children",
cellStyle: "", cellStyle: "",