This commit is contained in:
theluyuan 2024-09-24 17:04:44 +08:00
parent 6cd84e0021
commit 30528311c1
77 changed files with 2251 additions and 1361 deletions

View File

@ -2060,4 +2060,4 @@ function clearNumberFormat(ctx, locale, format) {
getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false;
}
}
export { parseDateTimeArgs as A, datetime as B, parseNumberArgs as C, number as D, getLocaleChain as E, MISSING_RESOLVE_VALUE as M, NOT_REOSLVED as N, assign as a, isString as b, isObject$1 as c, isArray as d, isBoolean as e, createCompileError as f, isEmptyObject as g, getGlobalThis as h, isNumber as i, isPlainObject as j, hasOwn$1 as k, handleFlatJson as l, makeSymbol as m, isRegExp as n, isFunction as o, createCoreContext as p, compileToFunction as q, registerMessageCompiler as r, setDevToolsHook as s, resolveValue as t, updateFallbackLocale as u, clearDateTimeFormat as v, clearNumberFormat as w, setAdditionalMeta as x, parseTranslateArgs as y, translate as z };
export { parseDateTimeArgs as A, datetime as B, parseNumberArgs as C, number as D, getLocaleChain as E, MISSING_RESOLVE_VALUE as M, NOT_REOSLVED as N, assign as a, isString as b, isObject$1 as c, isBoolean as d, isEmptyObject as e, createCompileError as f, getGlobalThis as g, isPlainObject as h, isNumber as i, isArray as j, hasOwn$1 as k, handleFlatJson as l, makeSymbol as m, isRegExp as n, isFunction as o, compileToFunction as p, createCoreContext as q, registerMessageCompiler as r, setDevToolsHook as s, resolveValue as t, updateFallbackLocale as u, clearDateTimeFormat as v, clearNumberFormat as w, setAdditionalMeta as x, parseTranslateArgs as y, translate as z };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -149,7 +149,9 @@ function triggerEffect(effect, debuggerEventExtraInfo) {
}
}
}
new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
new Set(
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
);
function toRaw(observed) {
const raw = observed && observed["__v_raw"];
return raw ? toRaw(raw) : observed;
@ -170,11 +172,13 @@ function triggerRefValue(ref, newVal) {
}
}
}
var _a;
class ComputedRefImpl {
constructor(getter, _setter, isReadonly, isSSR) {
this._setter = _setter;
this.dep = void 0;
this.__v_isRef = true;
this[_a] = false;
this._dirty = true;
this.effect = new ReactiveEffect(getter, () => {
if (!this._dirty) {
@ -199,6 +203,7 @@ class ComputedRefImpl {
this._setter(newValue);
}
}
_a = "__v_isReadonly";
function computed(getterOrOptions, debugOptions, isSSR = false) {
let getter;
let setter;

View File

@ -1,15 +1,15 @@
import { computed, isRef, reactive, unref, toRefs, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, nextTick, ref, watch, customRef, onUpdated } from "vue";
var _a$1;
const isClient$1 = typeof window !== "undefined";
const toString$1 = Object.prototype.toString;
import { getCurrentScope, onScopeDispose, computed, toRefs, getCurrentInstance, onMounted, nextTick, ref, unref, isRef, reactive, watch, customRef, onUpdated } from "vue";
var _a;
const isClient = typeof window !== "undefined";
const toString = Object.prototype.toString;
const isFunction = (val) => typeof val === "function";
const isNumber = (val) => typeof val === "number";
const isString = (val) => typeof val === "string";
const isObject$1 = (val) => toString$1.call(val) === "[object Object]";
const isObject = (val) => toString.call(val) === "[object Object]";
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
const noop = () => {
};
isClient$1 && ((_a$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _a$1.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function resolveUnref(r) {
return typeof r === "function" ? r() : unref(r);
}
@ -141,7 +141,7 @@ function useTimeoutFn(cb, interval, options = {}) {
}
if (immediate) {
isPending.value = true;
if (isClient$1)
if (isClient)
start();
}
tryOnScopeDispose(stop);
@ -156,7 +156,7 @@ function unrefElement(elRef) {
const plain = resolveUnref(elRef);
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
}
const defaultWindow = isClient$1 ? window : void 0;
const defaultWindow = isClient ? window : void 0;
function useEventListener(...args) {
let target;
let event;
@ -561,9 +561,4 @@ function useWindowSize(options = {}) {
useEventListener("orientationchange", update, { passive: true });
return { width, height };
}
var _a;
const isClient = typeof window !== "undefined";
const toString = Object.prototype.toString;
const isObject = (val) => toString.call(val) === "[object Object]";
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
export { TransitionPresets as T, useResizeObserver as a, useThrottleFn as b, useEventListener as c, useEyeDropper as d, useTransition as e, useMousePressed as f, isObject as g, isObject$1 as i, onClickOutside as o, reactiveOmit as r, templateRef as t, useWindowSize as u };
export { TransitionPresets as T, useResizeObserver as a, useThrottleFn as b, useEventListener as c, useEyeDropper as d, useTransition as e, useMousePressed as f, isObject as i, onClickOutside as o, reactiveOmit as r, templateRef as t, useWindowSize as u };

View File

@ -1,5 +1,5 @@
import { m as makeSymbol, a as assign, i as isNumber, b as isString, c as isObject, d as isArray, e as isBoolean, f as createCompileError, g as isEmptyObject, r as registerMessageCompiler, h as getGlobalThis, s as setDevToolsHook, j as isPlainObject, k as hasOwn, l as handleFlatJson, n as isRegExp, o as isFunction, p as createCoreContext, u as updateFallbackLocale, q as compileToFunction, t as resolveValue, v as clearDateTimeFormat, w as clearNumberFormat, x as setAdditionalMeta, N as NOT_REOSLVED, y as parseTranslateArgs, z as translate, M as MISSING_RESOLVE_VALUE, A as parseDateTimeArgs, B as datetime, C as parseNumberArgs, D as number, E as getLocaleChain } from "../@intlify/index.js";
import { h, Fragment, getCurrentInstance, inject, onMounted, onUnmounted, isRef, ref, computed, watch, createVNode, Text } from "vue";
import { m as makeSymbol, a as assign, i as isNumber, b as isString, c as isObject, d as isBoolean, e as isEmptyObject, r as registerMessageCompiler, g as getGlobalThis, s as setDevToolsHook, f as createCompileError, h as isPlainObject, j as isArray, k as hasOwn, l as handleFlatJson, n as isRegExp, o as isFunction, u as updateFallbackLocale, p as compileToFunction, q as createCoreContext, t as resolveValue, v as clearDateTimeFormat, w as clearNumberFormat, x as setAdditionalMeta, N as NOT_REOSLVED, y as parseTranslateArgs, z as translate, M as MISSING_RESOLVE_VALUE, A as parseDateTimeArgs, B as datetime, C as parseNumberArgs, D as number, E as getLocaleChain } from "../@intlify/index.js";
import { h, Fragment, getCurrentInstance, inject, onMounted, onUnmounted, ref, computed, watch, isRef, createVNode, Text } from "vue";
/*!
* vue-i18n v9.1.10
* (c) 2022 kazuya kawaguchi
@ -80,8 +80,12 @@ function createComposer(options = {}) {
const { __root } = options;
const _isGlobal = __root === void 0;
let _inheritLocale = isBoolean(options.inheritLocale) ? options.inheritLocale : true;
const _locale = ref(__root && _inheritLocale ? __root.locale.value : isString(options.locale) ? options.locale : "en-US");
const _fallbackLocale = ref(__root && _inheritLocale ? __root.fallbackLocale.value : isString(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value);
const _locale = ref(
__root && _inheritLocale ? __root.locale.value : isString(options.locale) ? options.locale : "en-US"
);
const _fallbackLocale = ref(
__root && _inheritLocale ? __root.fallbackLocale.value : isString(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value
);
const _messages = ref(getLocaleMessages(_locale.value, options));
const _datetimeFormats = ref(isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [_locale.value]: {} });
const _numberFormats = ref(isPlainObject(options.numberFormats) ? options.numberFormats : { [_locale.value]: {} });
@ -215,23 +219,44 @@ function createComposer(options = {}) {
type: "vnode"
};
function transrateVNode(...args) {
return wrapWithDeps((context) => {
let ret;
const _context2 = context;
try {
_context2.processor = processor;
ret = translate(_context2, ...args);
} finally {
_context2.processor = null;
}
return ret;
}, () => parseTranslateArgs(...args), "translate", (root) => root[TransrateVNodeSymbol](...args), (key) => [createVNode(Text, null, key, 0)], (val) => isArray(val));
return wrapWithDeps(
(context) => {
let ret;
const _context2 = context;
try {
_context2.processor = processor;
ret = translate(_context2, ...args);
} finally {
_context2.processor = null;
}
return ret;
},
() => parseTranslateArgs(...args),
"translate",
(root) => root[TransrateVNodeSymbol](...args),
(key) => [createVNode(Text, null, key, 0)],
(val) => isArray(val)
);
}
function numberParts(...args) {
return wrapWithDeps((context) => number(context, ...args), () => parseNumberArgs(...args), "number format", (root) => root[NumberPartsSymbol](...args), () => [], (val) => isString(val) || isArray(val));
return wrapWithDeps(
(context) => number(context, ...args),
() => parseNumberArgs(...args),
"number format",
(root) => root[NumberPartsSymbol](...args),
() => [],
(val) => isString(val) || isArray(val)
);
}
function datetimeParts(...args) {
return wrapWithDeps((context) => datetime(context, ...args), () => parseDateTimeArgs(...args), "datetime format", (root) => root[DatetimePartsSymbol](...args), () => [], (val) => isString(val) || isArray(val));
return wrapWithDeps(
(context) => datetime(context, ...args),
() => parseDateTimeArgs(...args),
"datetime format",
(root) => root[DatetimePartsSymbol](...args),
() => [],
(val) => isString(val) || isArray(val)
);
}
function setPluralRules(rules) {
_pluralRules = rules;

View File

@ -107,7 +107,9 @@ const _sfc_main = defineComponent({
}
if (props.position === "absolute") {
if (!targetElement.parentElement) {
throw new Error(`target parent element is not existed: ${props.target}`);
throw new Error(
`target parent element is not existed: ${props.target}`
);
}
targetElement.parentElement.style.position = "relative";
}

View File

@ -153,10 +153,14 @@ const _sfc_main = defineComponent({
}
});
};
watch(slotsChange, () => {
childrens.value = [];
setItemInstanceBySlot(slot.default && slot.default());
}, { immediate: true, deep: true });
watch(
slotsChange,
() => {
childrens.value = [];
setItemInstanceBySlot(slot.default && slot.default());
},
{ immediate: true, deep: true }
);
const sub = () => {
var _a, _b, _c;
for (var i = 0; i < childrens.value.length; i++) {
@ -213,11 +217,15 @@ const _sfc_main = defineComponent({
intervalTimer = window.setInterval(autoplay, props.interval);
}
};
watch(() => props.autoplay, () => {
if (props.autoplay) {
intervalTimer = window.setInterval(autoplay, props.interval);
}
}, { immediate: true });
watch(
() => props.autoplay,
() => {
if (props.autoplay) {
intervalTimer = window.setInterval(autoplay, props.interval);
}
},
{ immediate: true }
);
provide("active", active);
provide("slotsChange", slotsChange);
provide("anim", anim);

View File

@ -49,21 +49,27 @@ const _sfc_main = defineComponent({
onMounted(() => {
initTreeData();
});
watch(() => props.options, () => {
initTreeData();
});
watch(() => props.modelValue, () => {
if (watchModelValue.value) {
if (props.modelValue === null || props.modelValue === "") {
onClear();
} else {
updateDisplayByModelValue();
}
setTimeout(() => {
watchModelValue.value = true;
}, 0);
watch(
() => props.options,
() => {
initTreeData();
}
});
);
watch(
() => props.modelValue,
() => {
if (watchModelValue.value) {
if (props.modelValue === null || props.modelValue === "") {
onClear();
} else {
updateDisplayByModelValue();
}
setTimeout(() => {
watchModelValue.value = true;
}, 0);
}
}
);
const watchModelValue = ref(true);
const treeData = ref([]);
const initTreeData = () => {
@ -89,7 +95,9 @@ const _sfc_main = defineComponent({
let valueData = props.modelValue.split(props.decollator);
for (let index2 = 0; index2 < valueData.length; index2++) {
const element = valueData[index2];
let selectIndex = treeData.value[index2].data.findIndex((e) => e.value === element);
let selectIndex = treeData.value[index2].data.findIndex(
(e) => e.value === element
);
if (selectIndex == -1) {
break;
}

View File

@ -15,9 +15,12 @@ const _sfc_main = defineComponent({
emits: ["update:modelValue", "change"],
setup(__props, { emit }) {
const props = __props;
watch(() => props.modelValue, (val) => {
activeValues.value = [].concat(val);
});
watch(
() => props.modelValue,
(val) => {
activeValues.value = [].concat(val);
}
);
const activeValues = ref([].concat(props.modelValue));
provide("layCollapse", {
accordion: props.accordion,

View File

@ -16,7 +16,9 @@ const _sfc_main = defineComponent({
},
setup(__props) {
const props = __props;
const { accordion, activeValues, emit, collapseTransition } = inject("layCollapse");
const { accordion, activeValues, emit, collapseTransition } = inject(
"layCollapse"
);
let isShow = computed(() => {
return activeValues.value.includes(props.id);
});
@ -32,7 +34,10 @@ const _sfc_main = defineComponent({
} else {
activeValues.value.push(props.id);
}
emit("update:modelValue", accordion ? activeValues.value[0] || null : activeValues.value);
emit(
"update:modelValue",
accordion ? activeValues.value[0] || null : activeValues.value
);
emit("change", props.id, !_isShow, activeValues.value);
};
return (_ctx, _cache) => {

View File

@ -132,7 +132,10 @@ const _sfc_main = defineComponent({
alpha.value = a;
});
watch([red, green, blue], (newValue) => {
emit("update:modelValue", rgba2hex(red.value, green.value, blue.value, alpha.value));
emit(
"update:modelValue",
rgba2hex(red.value, green.value, blue.value, alpha.value)
);
let { h, s, v } = rgb2hsv(red.value, green.value, blue.value);
hue.value = h;
saturation.value = s;
@ -141,7 +144,10 @@ const _sfc_main = defineComponent({
hueSliderStyle.value = `left: ${hue.value / 360 * 100}%;`;
});
watch(alpha, () => {
emit("update:modelValue", rgba2hex(red.value, green.value, blue.value, alpha.value));
emit(
"update:modelValue",
rgba2hex(red.value, green.value, blue.value, alpha.value)
);
alphaSliderStyle.value = `left: ${alpha.value >= 1 ? "calc(100% - 6px)" : alpha.value * 100 + "%"};`;
});
let colorObj = computed(() => {
@ -278,7 +284,9 @@ const _sfc_main = defineComponent({
if (color) {
let r, g, b, a;
if (typeof color === "string") {
if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8}|[0-9a-fA-F]{3}|[0-9a-fA-F]{4})$/.test(color)) {
if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8}|[0-9a-fA-F]{3}|[0-9a-fA-F]{4})$/.test(
color
)) {
return hex2rgba(color);
}
} else {

View File

@ -11,7 +11,9 @@ const _sfc_main = defineComponent({
},
setup(__props) {
const props = __props;
const classes = computed(() => props.fluid ? "layui-fluid" : "layui-container");
const classes = computed(
() => props.fluid ? "layui-fluid" : "layui-container"
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(classes))

View File

@ -50,11 +50,14 @@ const _sfc_main = defineComponent({
const start = function() {
localStartVal.value = props.endVal;
};
watch(() => props.endVal, () => {
if (props.autoplay) {
localStartVal.value = props.endVal;
watch(
() => props.endVal,
() => {
if (props.autoplay) {
localStartVal.value = props.endVal;
}
}
});
);
onMounted(() => {
if (props.autoplay) {
start();

View File

@ -341,7 +341,10 @@ const _sfc_main$7 = defineComponent({
emits("update:hoverDate", -1);
return;
}
emits("update:hoverDate", parseInt(event.target.dataset.unix));
emits(
"update:hoverDate",
parseInt(event.target.dataset.unix)
);
};
const ifHasRangeHoverClass = computed(() => {
return function(item) {
@ -435,12 +438,22 @@ const _sfc_main$6 = defineComponent({
t("datePicker.november"),
t("datePicker.december")
]);
watch([datePicker.currentYear, datePicker.currentMonth], () => {
dateList.value = setDateList(datePicker.currentYear.value, datePicker.currentMonth.value);
}, { immediate: true });
watch(() => props.modelValue, () => {
Day.value = props.modelValue;
});
watch(
[datePicker.currentYear, datePicker.currentMonth],
() => {
dateList.value = setDateList(
datePicker.currentYear.value,
datePicker.currentMonth.value
);
},
{ immediate: true }
);
watch(
() => props.modelValue,
() => {
Day.value = props.modelValue;
}
);
const changeYearOrMonth = (type, num) => {
if (type === "year") {
datePicker.currentYear.value += num;
@ -572,13 +585,17 @@ const _sfc_main$5 = defineComponent({
onMounted(() => {
scrollTo();
});
watch(() => props.modelValue, () => {
hms.value = {
hh: props.modelValue.hh,
mm: props.modelValue.mm,
ss: props.modelValue.ss
};
}, { deep: true });
watch(
() => props.modelValue,
() => {
hms.value = {
hh: props.modelValue.hh,
mm: props.modelValue.mm,
ss: props.modelValue.ss
};
},
{ deep: true }
);
const scrollTo = () => {
nextTick(() => {
timePanelRef.value.childNodes.forEach((element) => {
@ -734,9 +751,12 @@ const _sfc_main$4 = defineComponent({
onMounted(() => {
scrollTo();
});
watch(() => Year, () => {
Year.value = props.modelValue;
});
watch(
() => Year,
() => {
Year.value = props.modelValue;
}
);
const scrollTo = () => {
nextTick(() => {
let scrollTop = 0;
@ -874,11 +894,17 @@ const _sfc_main$3 = defineComponent({
footOnOk();
}
};
watch(() => props.modelValue, () => {
Month.value = props.modelValue;
});
watch(
() => props.modelValue,
() => {
Month.value = props.modelValue;
}
);
const footOnOk = () => {
emits("update:modelValue", Month.value || Month.value === 0 ? Month.value : -1);
emits(
"update:modelValue",
Month.value || Month.value === 0 ? Month.value : -1
);
if (datePicker.range) {
emits("ok");
return;
@ -1026,10 +1052,14 @@ const _sfc_main$2 = defineComponent({
startTime.month = month;
}
};
watch(() => [startTime.year, startTime.month], () => {
prevDateList.value = setDateList(startTime.year, startTime.month);
nextDateList.value = setDateList(startTime.year, startTime.month + 1);
}, { immediate: true });
watch(
() => [startTime.year, startTime.month],
() => {
prevDateList.value = setDateList(startTime.year, startTime.month);
nextDateList.value = setDateList(startTime.year, startTime.month + 1);
},
{ immediate: true }
);
const dropdownTimePanelRefLeft = ref();
const dropdownTimePanelRefRight = ref();
const dropdownYearPanelRefLeft = ref();
@ -1355,12 +1385,15 @@ const _sfc_main$1 = defineComponent({
}
}
};
watch(() => [props.startTime, props.endTime], () => {
startTime.year = props.startTime ? dayjs(props.startTime).year() : dayjs().year();
startTime.unix = props.startTime ? dayjs(props.startTime).hour(0).minute(0).second(0).valueOf() : -1;
endTime.year = props.endTime ? dayjs(props.endTime).year() : dayjs().year();
endTime.unix = props.startTime ? dayjs(props.endTime).hour(0).minute(0).second(0).valueOf() : -1;
});
watch(
() => [props.startTime, props.endTime],
() => {
startTime.year = props.startTime ? dayjs(props.startTime).year() : dayjs().year();
startTime.unix = props.startTime ? dayjs(props.startTime).hour(0).minute(0).second(0).valueOf() : -1;
endTime.year = props.endTime ? dayjs(props.endTime).year() : dayjs().year();
endTime.unix = props.startTime ? dayjs(props.endTime).hour(0).minute(0).second(0).valueOf() : -1;
}
);
const dropdownYearPanelRefLeft = ref();
const dropdownYearPanelRefRight = ref();
const closeLeftYearPanel = () => {
@ -1382,7 +1415,9 @@ const _sfc_main$1 = defineComponent({
};
const footOnNow = () => {
startTime.year = dayjs().year();
startTime.unix = dayjs(startTime.year + "-" + (dayjs().month() + 1)).valueOf();
startTime.unix = dayjs(
startTime.year + "-" + (dayjs().month() + 1)
).valueOf();
endTime.unix = -1;
hoverMonth.value = -1;
};
@ -1402,7 +1437,9 @@ const _sfc_main$1 = defineComponent({
hoverMonth.value = -1;
return;
}
hoverMonth.value = parseInt(event.target.dataset.unix);
hoverMonth.value = parseInt(
event.target.dataset.unix
);
};
const ifHasRangeHoverClass = computed(() => {
return function(item) {
@ -1468,7 +1505,9 @@ const _sfc_main$1 = defineComponent({
"data-unix": unref(getUnix)(item, "left"),
class: normalizeClass({
"layui-this": unref(getUnix)(item, "left") === startTime.unix || unref(getUnix)(item, "left") === endTime.unix,
"laydate-range-hover": unref(ifHasRangeHoverClass)(unref(getUnix)(item, "left")),
"laydate-range-hover": unref(ifHasRangeHoverClass)(
unref(getUnix)(item, "left")
),
"layui-laydate-current": (startTime.unix === -1 || endTime.unix === -1) && unref(getUnix)(item, "left") === unref(dayjs)().startOf("month").valueOf()
}),
onClick: ($event) => handleMonthClick(unref(getUnix)(item, "left")),
@ -1512,7 +1551,9 @@ const _sfc_main$1 = defineComponent({
"data-unix": unref(getUnix)(item, "right"),
class: normalizeClass({
"layui-this": unref(getUnix)(item, "right") === startTime.unix || unref(getUnix)(item, "right") === endTime.unix,
"laydate-range-hover": unref(ifHasRangeHoverClass)(unref(getUnix)(item, "right")),
"laydate-range-hover": unref(ifHasRangeHoverClass)(
unref(getUnix)(item, "right")
),
"layui-laydate-current": (startTime.unix === -1 || endTime.unix === -1) && unref(getUnix)(item, "right") === unref(dayjs)().startOf("month").valueOf()
}),
onClick: ($event) => handleMonthClick(unref(getUnix)(item, "right")),
@ -1686,50 +1727,58 @@ const _sfc_main = defineComponent({
dropdownRef.value.hide();
showPanel.value = props.type;
};
watch(() => props.type, () => {
showPanel.value = props.type;
if (props.type === "yearmonth" && !props.range) {
showPanel.value = "year";
}
}, { immediate: true });
watch(() => props.modelValue, () => {
if (unWatch) {
return;
}
let initModelValue = props.range && props.modelValue ? props.modelValue[0] || "" : props.modelValue;
if (props.type === "month" || props.type === "year") {
initModelValue += "";
}
hms.value.hh = isNaN(dayjs(initModelValue).hour()) ? 0 : dayjs(initModelValue).hour();
hms.value.mm = isNaN(dayjs(initModelValue).minute()) ? 0 : dayjs(initModelValue).minute();
hms.value.ss = isNaN(dayjs(initModelValue).second()) ? 0 : dayjs(initModelValue).second();
if (initModelValue.length === 8 && props.type === "time") {
let modelValue = initModelValue;
modelValue = "1970-01-01 " + modelValue;
hms.value.hh = dayjs(modelValue).hour();
hms.value.mm = dayjs(modelValue).minute();
hms.value.ss = dayjs(modelValue).second();
}
currentYear.value = initModelValue ? getYear(initModelValue) : -1;
currentMonth.value = initModelValue ? getMonth(initModelValue) : -1;
currentDay.value = initModelValue ? getDay(initModelValue) : -1;
if (props.type === "date" || props.type === "datetime") {
if (currentYear.value === -1)
currentYear.value = dayjs().year();
if (currentMonth.value === -1)
currentMonth.value = dayjs().month();
if (props.timestamp) {
currentDay.value = initModelValue ? dayjs(parseInt(initModelValue)).startOf("date").unix() * 1e3 : -1;
watch(
() => props.type,
() => {
showPanel.value = props.type;
if (props.type === "yearmonth" && !props.range) {
showPanel.value = "year";
}
}
rangeValue.first = initModelValue;
rangeValue.last = props.range && props.modelValue ? props.modelValue[1] || "" : "";
if (!props.range) {
getDateValue();
} else {
getDateValueByRange();
}
}, { immediate: true });
},
{ immediate: true }
);
watch(
() => props.modelValue,
() => {
if (unWatch) {
return;
}
let initModelValue = props.range && props.modelValue ? props.modelValue[0] || "" : props.modelValue;
if (props.type === "month" || props.type === "year") {
initModelValue += "";
}
hms.value.hh = isNaN(dayjs(initModelValue).hour()) ? 0 : dayjs(initModelValue).hour();
hms.value.mm = isNaN(dayjs(initModelValue).minute()) ? 0 : dayjs(initModelValue).minute();
hms.value.ss = isNaN(dayjs(initModelValue).second()) ? 0 : dayjs(initModelValue).second();
if (initModelValue.length === 8 && props.type === "time") {
let modelValue = initModelValue;
modelValue = "1970-01-01 " + modelValue;
hms.value.hh = dayjs(modelValue).hour();
hms.value.mm = dayjs(modelValue).minute();
hms.value.ss = dayjs(modelValue).second();
}
currentYear.value = initModelValue ? getYear(initModelValue) : -1;
currentMonth.value = initModelValue ? getMonth(initModelValue) : -1;
currentDay.value = initModelValue ? getDay(initModelValue) : -1;
if (props.type === "date" || props.type === "datetime") {
if (currentYear.value === -1)
currentYear.value = dayjs().year();
if (currentMonth.value === -1)
currentMonth.value = dayjs().month();
if (props.timestamp) {
currentDay.value = initModelValue ? dayjs(parseInt(initModelValue)).startOf("date").unix() * 1e3 : -1;
}
}
rangeValue.first = initModelValue;
rangeValue.last = props.range && props.modelValue ? props.modelValue[1] || "" : "";
if (!props.range) {
getDateValue();
} else {
getDateValueByRange();
}
},
{ immediate: true }
);
const onChange = () => {
if (dropdownRef.value)
dropdownRef.value.hide();

View File

@ -176,7 +176,10 @@ const _sfc_main = defineComponent({
const slots = useSlots();
const attrs = useAttrs();
const childrenRefs = /* @__PURE__ */ new Set();
const dropdownCtx = inject(dropdownInjectionKey, void 0);
const dropdownCtx = inject(
dropdownInjectionKey,
void 0
);
const { children, firstElement: dropdownRef } = useFirstElement();
const contentRef = shallowRef();
const contentStyle = ref({});
@ -188,11 +191,15 @@ const _sfc_main = defineComponent({
const { x: mouseLeft, y: mouseTop } = toRefs(mousePosition);
const openState = ref(false);
let scrollElements;
const containerRef = computed(() => {
var _a;
return props.popupContainer ? (_a = document.querySelector(props.popupContainer)) != null ? _a : document.body : dropdownRef.value;
});
const triggerMethods = computed(() => [].concat(props.trigger));
const containerRef = computed(
() => {
var _a;
return props.popupContainer ? (_a = document.querySelector(props.popupContainer)) != null ? _a : document.body : dropdownRef.value;
}
);
const triggerMethods = computed(
() => [].concat(props.trigger)
);
const computedPlacement = computed(() => {
return transformPlacement(props.placement);
});
@ -276,7 +283,11 @@ const _sfc_main = defineComponent({
const containerRect = containerRef.value.getBoundingClientRect();
const triggerRect = props.alignPoint ? getTriggerRect() : getElementScrollRect(dropdownRef.value, containerRect);
const contentRect = getElementScrollRect(contentRef.value, containerRect);
const { style } = getContentStyle(computedPlacement.value, triggerRect, contentRect);
const { style } = getContentStyle(
computedPlacement.value,
triggerRect,
contentRect
);
if (props.autoFitMinWidth) {
style.minWidth = `${triggerRect.width}px`;
}
@ -287,11 +298,20 @@ const _sfc_main = defineComponent({
if (props.autoFitPosition) {
nextTick(() => {
const triggerRect2 = props.alignPoint ? getTriggerRect() : getElementScrollRect(dropdownRef.value, containerRect);
const contentRect2 = getElementScrollRect(contentRef.value, containerRect);
const contentRect2 = getElementScrollRect(
contentRef.value,
containerRect
);
let { top, left } = style;
top = Number(top.toString().replace("px", ""));
left = Number(left.toString().replace("px", ""));
const { top: fitTop, left: fitLeft } = getFitPlacement(top, left, computedPlacement.value, triggerRect2, contentRect2);
const { top: fitTop, left: fitLeft } = getFitPlacement(
top,
left,
computedPlacement.value,
triggerRect2,
contentRect2
);
style.top = `${fitTop}px`;
style.left = `${fitLeft}px`;
contentStyle.value = {
@ -520,16 +540,22 @@ const _sfc_main = defineComponent({
dropdownCtx == null ? void 0 : dropdownCtx.removeChildRef(ref2);
};
dropdownCtx == null ? void 0 : dropdownCtx.addChildRef(contentRef);
const { stop: removeContentResizeObserver } = useResizeObserver(contentRef, () => {
if (openState.value && props.autoFixPosition) {
updateContentStyle();
const { stop: removeContentResizeObserver } = useResizeObserver(
contentRef,
() => {
if (openState.value && props.autoFixPosition) {
updateContentStyle();
}
}
});
const { stop: removeTriggerResizeObserver } = useResizeObserver(dropdownRef, () => {
if (openState.value && props.autoFixPosition) {
updateContentStyle();
);
const { stop: removeTriggerResizeObserver } = useResizeObserver(
dropdownRef,
() => {
if (openState.value && props.autoFixPosition) {
updateContentStyle();
}
}
});
);
onClickOutside(dropdownRef, (e) => {
var _a, _b, _c;
if (!props.clickOutsideToClose || !openState.value || ((_a = dropdownRef.value) == null ? void 0 : _a.contains(e.target)) || ((_b = contentRef.value) == null ? void 0 : _b.contains(e.target))) {
@ -544,15 +570,21 @@ const _sfc_main = defineComponent({
});
const onlyChildRenderFunc = () => {
const slotContent = slots.default ? slots.default() : [];
const transformedSlotContent = slotContent.map((vnode) => cloneVNode(vnode, {
onClick: handleClick,
onContextmenu: handleContextMenuClick,
onMouseenter: handleMouseEnter,
onMouseleave: handleMouseLeave,
onFocusin: handleFocusin,
onFocusout: handleFocusout,
...attrs
}, true));
const transformedSlotContent = slotContent.map(
(vnode) => cloneVNode(
vnode,
{
onClick: handleClick,
onContextmenu: handleContextMenuClick,
onMouseenter: handleMouseEnter,
onMouseleave: handleMouseLeave,
onFocusin: handleFocusin,
onFocusout: handleFocusout,
...attrs
},
true
)
);
children.value = transformedSlotContent;
return h(Fragment, children.value);
};
@ -577,16 +609,23 @@ const _sfc_main = defineComponent({
removeTriggerResizeObserver();
window.removeEventListener("resize", handleScroll);
});
watch(() => props.visible, (newVal, oldVal) => {
openState.value = newVal;
}, { immediate: true });
provide(dropdownInjectionKey, reactive({
onMouseenter: handleMouseEnterWithContext,
onMouseleave: handleMouseLeaveWithContext,
addChildRef,
removeChildRef,
hide: handleContextHide
}));
watch(
() => props.visible,
(newVal, oldVal) => {
openState.value = newVal;
},
{ immediate: true }
);
provide(
dropdownInjectionKey,
reactive({
onMouseenter: handleMouseEnterWithContext,
onMouseleave: handleMouseLeaveWithContext,
addChildRef,
removeChildRef,
hide: handleContextHide
})
);
provide("openState", openState);
expose({ show, hide, toggle });
return (_ctx, _cache) => {

View File

@ -21,7 +21,10 @@ const _sfc_main = defineComponent({
setup(__props) {
const props = __props;
inject("openState");
const dropdownCtx = inject(dropdownInjectionKey, void 0);
const dropdownCtx = inject(
dropdownInjectionKey,
void 0
);
const handleClick = () => {
if (props.disabled) {
return;

View File

@ -26,7 +26,9 @@ const _sfc_main = defineComponent({
const props = __props;
const { t } = useI18n();
const slots = useSlots();
const description = computed(() => props.description ? props.description : t("empty.description"));
const description = computed(
() => props.description ? props.description : t("empty.description")
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, [

View File

@ -43,7 +43,9 @@ const _sfc_main = defineComponent({
} else if (typeof fields === "string" || Array.isArray(fields) && fields.length > 0) {
validateItems = [];
const validateFields = !fields ? [] : [].concat(fields);
validateFields.forEach((field) => formItemMap[field] && validateItems.push(formItemMap[field]));
validateFields.forEach(
(field) => formItemMap[field] && validateItems.push(formItemMap[field])
);
}
let errorsArrs = [];
validateItems.forEach((filed) => {
@ -70,7 +72,9 @@ const _sfc_main = defineComponent({
if (clearFields.length === 0) {
formItems.forEach((filed) => filed.clearValidate());
} else {
clearFields.forEach((field) => formItemMap[field] && formItemMap[field].clearValidate());
clearFields.forEach(
(field) => formItemMap[field] && formItemMap[field].clearValidate()
);
}
};
const reset = function() {
@ -88,13 +92,16 @@ const _sfc_main = defineComponent({
formItemMap[item.prop] = item;
};
expose({ validate, clearValidate, reset });
provide("LayForm", reactive({
formItems,
addField,
clearValidate,
validate,
...toRefs(props)
}));
provide(
"LayForm",
reactive({
formItems,
addField,
clearValidate,
validate,
...toRefs(props)
})
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("form", {
class: "layui-form",

View File

@ -89,8 +89,14 @@ const _sfc_main = defineComponent({
}
return rulesArrs;
});
const filedValue = computed(() => props.prop ? layForm.model[props.prop] : void 0);
watch(() => filedValue.value, (val) => validate(), { deep: true });
const filedValue = computed(
() => props.prop ? layForm.model[props.prop] : void 0
);
watch(
() => filedValue.value,
(val) => validate(),
{ deep: true }
);
const errorMsg = ref();
const errorStatus = ref(false);
const validate = (callback) => {
@ -101,7 +107,11 @@ const _sfc_main = defineComponent({
let model = {};
let validateMessage = null;
if (layForm.useCN) {
validateMessage = Object.assign({}, cnValidateMessage, layForm.validateMessage);
validateMessage = Object.assign(
{},
cnValidateMessage,
layForm.validateMessage
);
model[props.label || props.prop] = filedValue.value;
} else {
layForm.validateMessage && (validateMessage = layForm.validateMessage);
@ -143,12 +153,14 @@ const _sfc_main = defineComponent({
expose({ validate, clearValidate });
onMounted(() => {
if (props.prop) {
layForm.addField(reactive({
...toRefs(props),
$el: formItemRef,
validate,
clearValidate
}));
layForm.addField(
reactive({
...toRefs(props),
$el: formItemRef,
validate,
clearValidate
})
);
}
});
const getMarginLeft = computed(() => {
@ -179,7 +191,9 @@ const _sfc_main = defineComponent({
}, [
props.prop && unref(isRequired) ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(["layui-required", "layui-icon"].concat((_a = unref(layForm).requiredIcons) != null ? _a : ""))
class: normalizeClass(
["layui-required", "layui-icon"].concat((_a = unref(layForm).requiredIcons) != null ? _a : "")
)
}, [
renderSlot(_ctx.$slots, "required", {
props: { ...props, model: unref(layForm).model }

View File

@ -58,7 +58,9 @@ const _sfc_main = defineComponent({
]
];
const defaultElement = document.documentElement;
let targetEl = ref(props.target || defaultElement);
let targetEl = ref(
props.target || defaultElement
);
const isFullscreen = ref(false);
let isSupported = false;
const unprefixedMethods = methodMap[0];
@ -79,10 +81,14 @@ const _sfc_main = defineComponent({
targetEl2 = activeEl.value || defaultElement;
let fullscreenEnter = null;
if (props.immersive) {
fullscreenEnter = Promise.resolve(targetEl2[fullscreenAPI.requestFullscreen]());
fullscreenEnter = Promise.resolve(
targetEl2[fullscreenAPI.requestFullscreen]()
);
} else {
styleLayFullscreen(targetEl2, false);
fullscreenEnter = Promise.resolve(targetEl2 == null ? void 0 : targetEl2.classList.add("layui-fullscreen"));
fullscreenEnter = Promise.resolve(
targetEl2 == null ? void 0 : targetEl2.classList.add("layui-fullscreen")
);
}
return await (fullscreenEnter == null ? void 0 : fullscreenEnter.then(() => {
isFullscreen.value = true;
@ -102,7 +108,9 @@ const _sfc_main = defineComponent({
if (targetEl2 instanceof Document)
return;
styleLayFullscreen(targetEl2, true);
fullscreenExit = Promise.resolve(targetEl2 == null ? void 0 : targetEl2.classList.remove("layui-fullscreen"));
fullscreenExit = Promise.resolve(
targetEl2 == null ? void 0 : targetEl2.classList.remove("layui-fullscreen")
);
}
return await (fullscreenExit == null ? void 0 : fullscreenExit.then(() => {
isFullscreen.value = false;
@ -145,7 +153,10 @@ const _sfc_main = defineComponent({
document.addEventListener("keydown", onKeydownF11);
});
onBeforeUnmount(() => {
document.removeEventListener(fullscreenAPI.fullscreenchange, onFullscreenchange);
document.removeEventListener(
fullscreenAPI.fullscreenchange,
onFullscreenchange
);
document.removeEventListener("keydown", onFullscreenchange);
document.removeEventListener("keydown", onKeydownF11);
});

View File

@ -257,20 +257,36 @@ const _sfc_main = defineComponent({
}
}
};
watch(() => props.locale, (lang) => {
changeLocale(lang);
}, { immediate: true });
watch(() => props.locales, (locals) => {
locals == null ? void 0 : locals.forEach((item) => {
changeLocales(item.name, item.locale, item.merge);
});
}, { immediate: true, deep: true });
watch(() => props.theme, (theme) => {
changeTheme(theme);
}, { immediate: true });
watch(() => props.themeVariable, (vars) => {
changeThemeVariable(vars);
}, { immediate: true, deep: true });
watch(
() => props.locale,
(lang) => {
changeLocale(lang);
},
{ immediate: true }
);
watch(
() => props.locales,
(locals) => {
locals == null ? void 0 : locals.forEach((item) => {
changeLocales(item.name, item.locale, item.merge);
});
},
{ immediate: true, deep: true }
);
watch(
() => props.theme,
(theme) => {
changeTheme(theme);
},
{ immediate: true }
);
watch(
() => props.themeVariable,
(vars) => {
changeThemeVariable(vars);
},
{ immediate: true, deep: true }
);
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default");
};

View File

@ -18,12 +18,22 @@ const _sfc_main = defineComponent({
modelValue,
disabled
});
watch(() => modelValue, (val) => {
emit("change", modelValue.value);
emit("update:modelValue", modelValue.value);
}, { deep: true });
watch(() => props.modelValue, (val) => modelValue.value = val);
watch(() => props.disabled, (val) => disabled.value = val);
watch(
() => modelValue,
(val) => {
emit("change", modelValue.value);
emit("update:modelValue", modelValue.value);
},
{ deep: true }
);
watch(
() => props.modelValue,
(val) => modelValue.value = val
);
watch(
() => props.disabled,
(val) => disabled.value = val
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["layui-checkbox-group", { "layui-checkbox-group-disabled": disabled.value }])

View File

@ -95,7 +95,9 @@ const _sfc_main = defineComponent({
const props = __props;
const slots = useSlots();
const type = ref(props.type);
const currentValue = ref(String(props.modelValue == null ? "" : props.modelValue));
const currentValue = ref(
String(props.modelValue == null ? "" : props.modelValue)
);
const hasContent = computed(() => {
var _a;
return ((_a = props.modelValue) == null ? void 0 : _a.length) > 0;
@ -128,18 +130,26 @@ const _sfc_main = defineComponent({
return isNaN(parseInt(z)) ? 0 : z;
}
};
watch(() => props.type, () => {
type.value = props.type;
});
const input = ref();
watch(() => props.modelValue, () => {
console.log(input);
if (!(input.value == document.activeElement) && props.qfw) {
currentValue.value = formatMoney(props.modelValue.toString());
return;
watch(
() => props.type,
() => {
type.value = props.type;
}
currentValue.value = String(props.modelValue == null ? "" : props.modelValue);
});
);
const input = ref();
watch(
() => props.modelValue,
() => {
console.log(input);
if (!(input.value == document.activeElement) && props.qfw) {
currentValue.value = formatMoney(props.modelValue.toString());
return;
}
currentValue.value = String(
props.modelValue == null ? "" : props.modelValue
);
}
);
const onInput = function(event) {
const inputElement = event.target;
let value = inputElement.value;

View File

@ -100,11 +100,14 @@ const _sfc_main = defineComponent({
emit("change", tempValue.value);
}
});
watch(() => props.modelValue, (val) => {
if (val !== num.value) {
num.value = props.modelValue;
watch(
() => props.modelValue,
(val) => {
if (val !== num.value) {
num.value = props.modelValue;
}
}
});
);
let timer = 0;
const tempValue = ref(0);
const minControl = computed(() => {

View File

@ -27,8 +27,12 @@ const _sfc_main = defineComponent({
setup(__props, { emit }) {
const props = __props;
const isTree = computed(() => props.tree);
const isCollapse = computed(() => props.collapse);
const isCollapseTransition = computed(() => props.collapseTransition);
const isCollapse = computed(
() => props.collapse
);
const isCollapseTransition = computed(
() => props.collapseTransition
);
const oldOpenKeys = ref(props.openKeys);
const menuTheme = computed(() => props.theme);
const openKeys = computed({
@ -52,14 +56,17 @@ const _sfc_main = defineComponent({
const indent = computed(() => {
return props.indent;
});
watch(() => props.collapse, () => {
if (props.collapse) {
oldOpenKeys.value = props.openKeys;
openKeys.value = [];
} else {
openKeys.value = oldOpenKeys.value;
watch(
() => props.collapse,
() => {
if (props.collapse) {
oldOpenKeys.value = props.openKeys;
openKeys.value = [];
} else {
openKeys.value = oldOpenKeys.value;
}
}
});
);
provideLevel(1);
provide("isTree", isTree);
provide("selectedKey", selectedKey);

View File

@ -36,12 +36,17 @@ const _sfc_main = defineComponent({
const isCollapse = inject("isCollapse");
const theme = inject("menuTheme");
const indent = inject("indent");
const dropdownCtx = inject(dropdownInjectionKey, void 0);
const dropdownCtx = inject(
dropdownInjectionKey,
void 0
);
const selectHandle = function() {
selectedKey.value = props.id;
dropdownCtx == null ? void 0 : dropdownCtx.hide();
};
const needTooltip = computed(() => isTree.value && (isCollapse.value === true || isCollapse.value === "true") && level.value === 1);
const needTooltip = computed(
() => isTree.value && (isCollapse.value === true || isCollapse.value === "true") && level.value === 1
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("li", {
class: normalizeClass(["layui-nav-item", { "layui-this": unref(selectedKey) === __props.id }]),

View File

@ -71,9 +71,13 @@ const _sfc_main = defineComponent({
}
};
const listenerAnimationend = () => {
noticeBarTextRef.value.addEventListener("animationend", () => {
changeAnimation();
}, false);
noticeBarTextRef.value.addEventListener(
"animationend",
() => {
changeAnimation();
},
false
);
};
const onRightIconClick = () => {
if (!props.mode)

View File

@ -58,9 +58,12 @@ const _sfc_main = defineComponent({
const currentPage = ref(props.modelValue);
const currentPageShow = ref(currentPage.value);
const inlimit = ref(props.limit);
watch(() => props.limit, () => {
inlimit.value = props.limit;
});
watch(
() => props.limit,
() => {
inlimit.value = props.limit;
}
);
const totalPage = computed(() => {
maxPage.value = Math.ceil(props.total / inlimit.value);
let r = [];
@ -118,10 +121,13 @@ const _sfc_main = defineComponent({
currentPageShow.value = currentPage.value;
emit("update:modelValue", currentPage.value);
});
watch(() => props.modelValue, () => {
currentPage.value = props.modelValue;
currentPageShow.value = currentPage.value;
});
watch(
() => props.modelValue,
() => {
currentPage.value = props.modelValue;
currentPageShow.value = currentPage.value;
}
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
__props.showCount ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref(t)("page.total")) + " " + toDisplayString(__props.total) + " " + toDisplayString(unref(t)("page.item")) + " " + toDisplayString(maxPage.value) + " " + toDisplayString(unref(t)("page.page")), 1)) : createCommentVNode("", true),

View File

@ -22,12 +22,22 @@ const _sfc_main = defineComponent({
naiveName: props.name,
disabled
});
watch(() => modelValue, (val) => {
emit("change", modelValue.value);
emit("update:modelValue", modelValue.value);
}, { deep: true });
watch(() => props.modelValue, (val) => modelValue.value = val);
watch(() => props.disabled, (val) => disabled.value = val);
watch(
() => modelValue,
(val) => {
emit("change", modelValue.value);
emit("update:modelValue", modelValue.value);
},
{ deep: true }
);
watch(
() => props.modelValue,
(val) => modelValue.value = val
);
watch(
() => props.disabled,
(val) => disabled.value = val
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
renderSlot(_ctx.$slots, "default")

View File

@ -32,11 +32,16 @@ const _sfc_main = defineComponent({
const props = __props;
const currentValue = ref(props.modelValue);
const tempValue = ref(currentValue.value);
const isHalf = computed(() => props.half && Math.round(currentValue.value) !== currentValue.value);
watch(() => props.modelValue, () => {
currentValue.value = props.modelValue;
tempValue.value = props.modelValue;
});
const isHalf = computed(
() => props.half && Math.round(currentValue.value) !== currentValue.value
);
watch(
() => props.modelValue,
() => {
currentValue.value = props.modelValue;
tempValue.value = props.modelValue;
}
);
const getValue = function(index2, event) {
if (!props.half) {
return index2;

View File

@ -55,14 +55,22 @@ const _sfc_main = defineComponent({
spreadSizeRef.value = props.spreadSize;
}
}
ripples.addEventListener("animationend", () => {
isActiveRef.value = false;
}, false);
ripples.addEventListener(
"animationend",
() => {
isActiveRef.value = false;
},
false
);
};
onMounted(() => {
initWidth();
});
watch(() => props.trigger, (val) => isActiveRef.value = val === "always", { immediate: true });
watch(
() => props.trigger,
(val) => isActiveRef.value = val === "always",
{ immediate: true }
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", mergeProps({
class: "layui-water-ripples-container",

View File

@ -91,22 +91,26 @@ const _sfc_main = defineComponent({
onMounted(() => {
intOption();
timer = setInterval(intOption, 500);
watch([selectedValue, options], () => {
var _a, _b;
if (multiple.value) {
multipleValue.value = (_a = selectedValue.value) == null ? void 0 : _a.map((value) => {
return options.value.find((item) => {
item.disabled == "" || item.disabled == true ? item.closable = false : item.closable = true;
return item.value === value;
watch(
[selectedValue, options],
() => {
var _a, _b;
if (multiple.value) {
multipleValue.value = (_a = selectedValue.value) == null ? void 0 : _a.map((value) => {
return options.value.find((item) => {
item.disabled == "" || item.disabled == true ? item.closable = false : item.closable = true;
return item.value === value;
});
});
});
} else {
searchValue.value = "";
singleValue.value = (_b = options.value.find((item) => {
return item.value === selectedValue.value;
})) == null ? void 0 : _b.label;
}
}, { immediate: true, deep: true });
} else {
searchValue.value = "";
singleValue.value = (_b = options.value.find((item) => {
return item.value === selectedValue.value;
})) == null ? void 0 : _b.label;
}
},
{ immediate: true, deep: true }
);
});
onUnmounted(() => {
clearInterval(timer);

View File

@ -17,7 +17,9 @@ const _sfc_main = defineComponent({
const searchValue = inject("searchValue");
const selectRef = inject("selectRef");
const searchMethod = inject("searchMethod");
const selectedValue = inject("selectedValue");
const selectedValue = inject(
"selectedValue"
);
const multiple = inject("multiple");
const checkboxRef = ref();
const handleSelect = () => {

View File

@ -25,10 +25,12 @@ const _sfc_main = defineComponent({
}
},
setup(props, { slots }) {
const computAlign = computed(() => {
var _a;
return (_a = props.align) != null ? _a : props.direction === "horizontal" ? "center" : "";
});
const computAlign = computed(
() => {
var _a;
return (_a = props.align) != null ? _a : props.direction === "horizontal" ? "center" : "";
}
);
const spaceClass = computed(() => [
"layui-space",
{
@ -88,17 +90,25 @@ const _sfc_main = defineComponent({
};
return () => {
const children = extractChildren();
return h("div", {
class: spaceClass.value,
style: spaceStyle.value
}, children.map((child, index2) => {
var _a;
return h("div", {
key: (_a = child.key) != null ? _a : `item-${index2}`,
class: "layui-space-item",
style: itemStyle.value
}, h(child));
}));
return h(
"div",
{
class: spaceClass.value,
style: spaceStyle.value
},
children.map((child, index2) => {
var _a;
return h(
"div",
{
key: (_a = child.key) != null ? _a : `item-${index2}`,
class: "layui-space-item",
style: itemStyle.value
},
h(child)
);
})
);
};
}
});

View File

@ -21,35 +21,38 @@ const _sfc_main = defineComponent({
onMounted(() => {
const boxWidth = target.value.offsetWidth;
const boxHeight = target.value.offsetHeight;
target.value.addEventListener("mousemove", (event) => {
if (domStatus.value && domEvent.value) {
const prevDom = domEvent.value.target.previousElementSibling;
const nextDom = domEvent.value.target.nextElementSibling;
if (!props.vertical) {
const prevDomLeft = domEvent.value.target.previousElementSibling.offsetLeft;
const prevDomWidth = domEvent.value.target.previousElementSibling.offsetWidth;
const nextDomWidth = domEvent.value.target.nextElementSibling.offsetWidth;
const otherWidth = boxWidth - (prevDomWidth + nextDomWidth + 5);
const otherWidthPercentage = (prevDomWidth + nextDomWidth + 5) / boxWidth * 100;
if (event.layerX - prevDomLeft < props.minSize || boxWidth - (event.layerX - prevDomLeft) - otherWidth < props.minSize) {
return false;
target.value.addEventListener(
"mousemove",
(event) => {
if (domStatus.value && domEvent.value) {
const prevDom = domEvent.value.target.previousElementSibling;
const nextDom = domEvent.value.target.nextElementSibling;
if (!props.vertical) {
const prevDomLeft = domEvent.value.target.previousElementSibling.offsetLeft;
const prevDomWidth = domEvent.value.target.previousElementSibling.offsetWidth;
const nextDomWidth = domEvent.value.target.nextElementSibling.offsetWidth;
const otherWidth = boxWidth - (prevDomWidth + nextDomWidth + 5);
const otherWidthPercentage = (prevDomWidth + nextDomWidth + 5) / boxWidth * 100;
if (event.layerX - prevDomLeft < props.minSize || boxWidth - (event.layerX - prevDomLeft) - otherWidth < props.minSize) {
return false;
}
prevDom.style.flexBasis = (event.layerX - prevDomLeft) / (prevDomWidth + nextDomWidth + 5) * otherWidthPercentage + "%";
nextDom.style.flexBasis = (boxWidth - (event.layerX - prevDomLeft) - otherWidth) / (prevDomWidth + nextDomWidth + 5) * otherWidthPercentage + "%";
} else {
const prevDomTop = domEvent.value.target.previousElementSibling.offsetTop;
const prevDomHeight = domEvent.value.target.previousElementSibling.offsetHeight;
const nextDomHeight = domEvent.value.target.nextElementSibling.offsetHeight;
const otherHeight = boxHeight - (prevDomHeight + nextDomHeight + 5);
const otherHeightPercentage = (prevDomHeight + nextDomHeight + 5) / boxHeight * 100;
if (event.layerY - prevDomTop < props.minSize || boxHeight - (event.layerY - prevDomTop) - otherHeight < props.minSize) {
return false;
}
prevDom.style.flexBasis = (event.layerY - prevDomTop) / (prevDomHeight + nextDomHeight + 5) * otherHeightPercentage + "%";
nextDom.style.flexBasis = (boxHeight - (event.layerY - prevDomTop) - otherHeight) / (prevDomHeight + nextDomHeight + 5) * otherHeightPercentage + "%";
}
prevDom.style.flexBasis = (event.layerX - prevDomLeft) / (prevDomWidth + nextDomWidth + 5) * otherWidthPercentage + "%";
nextDom.style.flexBasis = (boxWidth - (event.layerX - prevDomLeft) - otherWidth) / (prevDomWidth + nextDomWidth + 5) * otherWidthPercentage + "%";
} else {
const prevDomTop = domEvent.value.target.previousElementSibling.offsetTop;
const prevDomHeight = domEvent.value.target.previousElementSibling.offsetHeight;
const nextDomHeight = domEvent.value.target.nextElementSibling.offsetHeight;
const otherHeight = boxHeight - (prevDomHeight + nextDomHeight + 5);
const otherHeightPercentage = (prevDomHeight + nextDomHeight + 5) / boxHeight * 100;
if (event.layerY - prevDomTop < props.minSize || boxHeight - (event.layerY - prevDomTop) - otherHeight < props.minSize) {
return false;
}
prevDom.style.flexBasis = (event.layerY - prevDomTop) / (prevDomHeight + nextDomHeight + 5) * otherHeightPercentage + "%";
nextDom.style.flexBasis = (boxHeight - (event.layerY - prevDomTop) - otherHeight) / (prevDomHeight + nextDomHeight + 5) * otherHeightPercentage + "%";
}
}
});
);
});
const moveChange = (event, status, isVertical) => {
domEvent.value = event;
@ -63,9 +66,11 @@ const _sfc_main = defineComponent({
};
const steps = ref([]);
watch(steps, () => {
steps.value.forEach((instance, index2) => {
instance.setIndex(index2);
});
steps.value.forEach(
(instance, index2) => {
instance.setIndex(index2);
}
);
});
provide("laySplitPanel", {
props,

View File

@ -67,7 +67,9 @@ const _sfc_main = defineComponent({
onMounted(() => {
});
onBeforeUnmount(() => {
parents.steps.value = parents.steps.value.filter((instance) => instance.itemId !== currentInstance.uid);
parents.steps.value = parents.steps.value.filter(
(instance) => instance.itemId !== currentInstance.uid
);
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock(Fragment, null, [

View File

@ -23,9 +23,11 @@ const _sfc_main = defineComponent({
emits("onChange", index2 - 1);
};
watch(steps, () => {
steps.value.forEach((instance, index2) => {
instance.setIndex(index2);
});
steps.value.forEach(
(instance, index2) => {
instance.setIndex(index2);
}
);
});
provide("LayStep", {
props,

View File

@ -79,7 +79,9 @@ const _sfc_main = defineComponent({
onMounted(() => {
});
onBeforeUnmount(() => {
parents.steps.value = parents.steps.value.filter((instance) => instance.itemId !== currentInstance.uid);
parents.steps.value = parents.steps.value.filter(
(instance) => instance.itemId !== currentInstance.uid
);
});
return (_ctx, _cache) => {
return !unref(simple) ? (openBlock(), createElementBlock("div", {

View File

@ -119,7 +119,9 @@ const _sfc_main = defineComponent({
const openKeys = inject("openKeys");
const indent = inject("indent");
const isCollapse = inject("isCollapse");
const isCollapseTransition = inject("isCollapseTransition");
const isCollapseTransition = inject(
"isCollapseTransition"
);
const isOpen = computed(() => {
return openKeys.value.includes(props.id);
});

View File

@ -63,11 +63,14 @@ const _sfc_main = defineComponent({
const removeItem = (id) => {
tabMap.delete(id);
};
provide(TabInjectKey, reactive({
active,
addItem,
removeItem
}));
provide(
TabInjectKey,
reactive({
active,
addItem,
removeItem
})
);
const change = function(id) {
if (props.beforeLeave && props.beforeLeave(id) === false) {
return;
@ -263,19 +266,26 @@ const _sfc_main = defineComponent({
}
};
useResizeObserver(navRef, update);
watch(tabMap, () => {
childrens.value = [];
setItemInstanceBySlot(slot.default && slot.default());
}, { immediate: true });
watch(() => [
props.modelValue,
props.tabPosition,
props.type,
childrens.value.length
], async () => {
await nextTick();
update();
});
watch(
tabMap,
() => {
childrens.value = [];
setItemInstanceBySlot(slot.default && slot.default());
},
{ immediate: true }
);
watch(
() => [
props.modelValue,
props.tabPosition,
props.type,
childrens.value.length
],
async () => {
await nextTick();
update();
}
);
onMounted(() => {
update();
scrollToActiveTab();

View File

@ -139,7 +139,10 @@ const _sfc_main$3 = defineComponent({
set(val) {
let newTableExpandKeys = [...tableExpandKeys.value];
if (!val) {
newTableExpandKeys.splice(newTableExpandKeys.indexOf(props.data[props.id]), 1);
newTableExpandKeys.splice(
newTableExpandKeys.indexOf(props.data[props.id]),
1
);
} else {
newTableExpandKeys.push(props.data[props.id]);
}
@ -194,7 +197,9 @@ const _sfc_main$3 = defineComponent({
}
return props.rowClassName(data, index2);
};
const childrenIndentSize = computed(() => props.currentIndentSize + props.indentSize);
const childrenIndentSize = computed(
() => props.currentIndentSize + props.indentSize
);
const renderFixedStyle = (column, columnIndex) => {
var _a, _b, _c, _d;
if (column.fixed) {
@ -713,15 +718,19 @@ const _sfc_main$1 = defineComponent({
const sel = ref([]);
const list = ref([]);
const alllist = ref([]);
watch(() => [props.show], () => {
let set = /* @__PURE__ */ new Set();
for (let i of props.list) {
set.add(i[props.soulkey]);
}
alllist.value = Array.from(set);
list.value = alllist.value;
selshow.value = false;
}, { deep: true });
watch(
() => [props.show],
() => {
let set = /* @__PURE__ */ new Set();
for (let i of props.list) {
set.add(i[props.soulkey]);
}
alllist.value = Array.from(set);
list.value = alllist.value;
selshow.value = false;
},
{ deep: true }
);
const seltext = ref("");
watch(seltext, () => {
let l = [];
@ -1082,12 +1091,20 @@ const _sfc_main = defineComponent({
findFinalNode(0, tableColumns.value);
const tableSelectedKeys = ref(props.selectedKeys);
const tableExpandKeys = ref([...props.expandKeys]);
watch(() => props.selectedKeys, () => {
tableSelectedKeys.value = props.selectedKeys;
}, { deep: true });
watch(() => props.expandKeys, () => {
tableExpandKeys.value = props.expandKeys;
}, { deep: true });
watch(
() => props.selectedKeys,
() => {
tableSelectedKeys.value = props.selectedKeys;
},
{ deep: true }
);
watch(
() => props.expandKeys,
() => {
tableExpandKeys.value = props.expandKeys;
},
{ deep: true }
);
const tableSelectedKey = computed({
get() {
return props.selectedKey;
@ -1096,10 +1113,14 @@ const _sfc_main = defineComponent({
emit("update:selectedKey", val);
}
});
watch(() => props.dataSource, () => {
console.log("table\u6570\u636E\u66F4\u65B0");
tableDataSource.value = [...props.dataSource];
}, { deep: true });
watch(
() => props.dataSource,
() => {
console.log("table\u6570\u636E\u66F4\u65B0");
tableDataSource.value = [...props.dataSource];
},
{ deep: true }
);
const changeAll = (isChecked) => {
if (isChecked) {
const datasources = datalist.value.filter((item, index2) => {
@ -1114,25 +1135,37 @@ const _sfc_main = defineComponent({
tableSelectedKeys.value = [];
}
};
watch(tableSelectedKeys, () => {
if (tableSelectedKeys.value.length === props.dataSource.length) {
allChecked.value = true;
} else {
allChecked.value = false;
}
if (tableSelectedKeys.value.length > 0) {
hasChecked.value = true;
} else {
hasChecked.value = false;
}
if (tableSelectedKeys.value != props.selectedKeys) {
console.log("\u521D\u59CB\u5316\u8D4B\u503C\u89E6\u53D1\u4FEE\u6539", tableSelectedKeys.value, props.selectedKeys);
emit("update:selectedKeys", tableSelectedKeys.value);
}
}, { deep: true, immediate: true });
watch(tableExpandKeys, () => {
emit("update:expandKeys", tableExpandKeys.value);
}, { deep: true, immediate: true });
watch(
tableSelectedKeys,
() => {
if (tableSelectedKeys.value.length === props.dataSource.length) {
allChecked.value = true;
} else {
allChecked.value = false;
}
if (tableSelectedKeys.value.length > 0) {
hasChecked.value = true;
} else {
hasChecked.value = false;
}
if (tableSelectedKeys.value != props.selectedKeys) {
console.log(
"\u521D\u59CB\u5316\u8D4B\u503C\u89E6\u53D1\u4FEE\u6539",
tableSelectedKeys.value,
props.selectedKeys
);
emit("update:selectedKeys", tableSelectedKeys.value);
}
},
{ deep: true, immediate: true }
);
watch(
tableExpandKeys,
() => {
emit("update:expandKeys", tableExpandKeys.value);
},
{ deep: true, immediate: true }
);
watch(tableDataSource, () => {
if (!props.page || props.serverpage) {
datalist.value = tableDataSource.value;
@ -1152,7 +1185,10 @@ const _sfc_main = defineComponent({
emit("change", page);
} else {
page.current;
datalist.value = tableDataSource.value.slice(page.limit * (page.current - 1), page.limit * page.current);
datalist.value = tableDataSource.value.slice(
page.limit * (page.current - 1),
page.limit * page.current
);
}
};
const rowClick = function(data, evt) {
@ -1182,7 +1218,11 @@ const _sfc_main = defineComponent({
var tmpWB = {
SheetNames: ["sheet"],
Sheets: {
sheet: Object.assign({}, ws, {})
sheet: Object.assign(
{},
ws,
{}
)
}
};
writeFileSync(tmpWB, name + ".xlsx", {
@ -1281,14 +1321,18 @@ const _sfc_main = defineComponent({
hasr.value ? "layui-table-has-fixed-right" : ""
];
});
watch(() => [props.height, props.maxHeight, props.dataSource], () => {
nextTick(() => {
getScrollWidth();
getFixedColumn();
});
}, {
deep: true
});
watch(
() => [props.height, props.maxHeight, props.dataSource],
() => {
nextTick(() => {
getScrollWidth();
getFixedColumn();
});
},
{
deep: true
}
);
onMounted(() => {
var _a, _b;
getScrollWidth();
@ -1497,41 +1541,45 @@ const _sfc_main = defineComponent({
watch(sxlist, () => {
console.log("sxlist\u66F4\u65B0");
});
watch([() => sxlist, () => props.dataSource], (old, new1) => {
if (Object.keys(sxlist.value).length == 0) {
return;
}
let list = [...props.dataSource];
let endlist = [];
for (let i in sxlist.value) {
for (let j in list) {
if (list[j] != "" && sxlist.value[i].length != 0) {
if (!sxlist.value[i].includes(list[j][i])) {
list[j] = "";
watch(
[() => sxlist, () => props.dataSource],
(old, new1) => {
if (Object.keys(sxlist.value).length == 0) {
return;
}
let list = [...props.dataSource];
let endlist = [];
for (let i in sxlist.value) {
for (let j in list) {
if (list[j] != "" && sxlist.value[i].length != 0) {
if (!sxlist.value[i].includes(list[j][i])) {
list[j] = "";
}
}
}
}
}
for (let i of list) {
if (i != "") {
endlist.push(i);
for (let i of list) {
if (i != "") {
endlist.push(i);
}
}
if (!props.page || props.serverpage) {
nextTick(() => {
datalist.value = endlist;
});
} else {
tableDataSource.value = endlist;
change({
limit: props.page.limit,
current: props.page.current,
isReload: true
});
}
},
{
deep: true
}
if (!props.page || props.serverpage) {
nextTick(() => {
datalist.value = endlist;
});
} else {
tableDataSource.value = endlist;
change({
limit: props.page.limit,
current: props.page.current,
isReload: true
});
}
}, {
deep: true
});
);
window.addEventListener("click", heddin);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
@ -1647,7 +1695,11 @@ const _sfc_main = defineComponent({
{
textAlign: column.align
},
renderHeadFixedStyle(column, columnIndex, tableHeadColumn)
renderHeadFixedStyle(
column,
columnIndex,
tableHeadColumn
)
])
}, [
column.type == "checkbox" ? (openBlock(), createBlock(_sfc_main$5, {

View File

@ -195,13 +195,16 @@ const _sfc_main = defineComponent({
useResizeObserver(mirrorRefEl, () => {
handleResize();
});
watch(() => inputValue.value, (val) => {
if (inputRefEl.value && !isComposing.value) {
nextTick(() => {
inputRefEl.value.value = val != null ? val : "";
});
watch(
() => inputValue.value,
(val) => {
if (inputRefEl.value && !isComposing.value) {
nextTick(() => {
inputRefEl.value.value = val != null ? val : "";
});
}
}
});
);
const moreCount = computed(() => {
if (tagData.value && computedTagData.value) {
return tagData.value.length - computedTagData.value.length;
@ -261,7 +264,11 @@ const _sfc_main = defineComponent({
size: __props.size,
onClose: ($event) => {
var _a3;
return handleClose(item.value, index2 + ((_a3 = __props.minCollapsedNum) != null ? _a3 : 0), $event);
return handleClose(
item.value,
index2 + ((_a3 = __props.minCollapsedNum) != null ? _a3 : 0),
$event
);
}
}), {
default: withCtx(() => [

View File

@ -1,7 +1,7 @@
import { w as withInstall } from "../badge/index2.js";
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createElementVNode, normalizeClass, unref, createVNode, createCommentVNode, toDisplayString } from "vue";
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
import { g as isObject } from "../_chunks/@vueuse/index.js";
import { i as isObject } from "../_chunks/@vueuse/index.js";
var index = /* @__PURE__ */ (() => ":root{--textarea-border-radius: var(--global-border-radius);--textarea-border-color: var(--global-neutral-color-3)}.layui-textarea{border-width:1px;border-style:solid;background-color:#fff;color:#000000d9;border-radius:var(--textarea-border-radius);border-color:var(--textarea-border-color);display:block;width:100%;height:auto;line-height:20px;min-height:100px;padding:6px 10px;resize:vertical;position:relative;transition:none;-webkit-transition:none}.layui-textarea-wrapper{position:relative}.layui-textarea:hover,.layui-textarea:focus{border-color:#d2d2d2!important}.layui-textarea-clear{position:absolute;color:#00000073;right:10px;top:10px}.layui-textarea::-webkit-input-placeholder{line-height:1.3}.layui-texterea-count{color:inherit;white-space:nowrap;pointer-events:none;text-align:right;margin-top:4px}.layui-textarea-disabled{cursor:not-allowed!important;opacity:.6}\n")();
const _hoisted_1 = { class: "layui-textarea-wrapper" };
const _hoisted_2 = ["value", "placeholder", "name", "disabled", "maxlength"];
@ -74,21 +74,25 @@ const _sfc_main = defineComponent({
}
return count;
});
watch([() => props.modelValue, textareaRef], () => {
var _a, _b;
if (!textareaRef.value || !props.autosize)
return;
const height = ((_a = textareaRef.value) == null ? void 0 : _a.scrollHeight) + 2;
if (isObject(props.autosize)) {
const { minHeight, maxHeight } = props.autosize;
if (height < minHeight || height > maxHeight)
watch(
[() => props.modelValue, textareaRef],
() => {
var _a, _b;
if (!textareaRef.value || !props.autosize)
return;
const height = ((_a = textareaRef.value) == null ? void 0 : _a.scrollHeight) + 2;
if (isObject(props.autosize)) {
const { minHeight, maxHeight } = props.autosize;
if (height < minHeight || height > maxHeight)
return;
}
textareaRef.value.style.height = "1px";
textareaRef.value.style.height = `${((_b = textareaRef.value) == null ? void 0 : _b.scrollHeight) + 2}px`;
},
{
immediate: true
}
textareaRef.value.style.height = "1px";
textareaRef.value.style.height = `${((_b = textareaRef.value) == null ? void 0 : _b.scrollHeight) + 2}px`;
}, {
immediate: true
});
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("textarea", {

View File

@ -90,7 +90,9 @@ const _sfc_main$1 = defineComponent({
const innerVisible = ref(props.visible);
const isExist = ref(props.visible);
let scrollElements;
const triggerMethods = computed(() => [].concat(props.trigger));
const triggerMethods = computed(
() => [].concat(props.trigger)
);
const doShow = function() {
if (!props.disabled) {
if (!isExist.value) {
@ -112,7 +114,11 @@ const _sfc_main$1 = defineComponent({
style.value = { top: -window.innerHeight + "px", left: 0 };
};
const calcPosistion = function() {
postionFns[props.position] && (style.value = postionFns[props.position](triggerRefEl.value, popperRefEl.value, innnerPosition));
postionFns[props.position] && (style.value = postionFns[props.position](
triggerRefEl.value,
popperRefEl.value,
innnerPosition
));
};
const updatePosistion = function() {
if (innerVisible.value) {
@ -184,14 +190,18 @@ const _sfc_main$1 = defineComponent({
updatePosistion();
}
}, 15);
onClickOutside(triggerRefEl.value, (e) => {
if (!innerVisible.value || triggerRefEl.value.contains(e.target) || popperRefEl.value.contains(e.target)) {
return;
onClickOutside(
triggerRefEl.value,
(e) => {
if (!innerVisible.value || triggerRefEl.value.contains(e.target) || popperRefEl.value.contains(e.target)) {
return;
}
doHidden();
},
{
ignore: [popperRefEl.value]
}
doHidden();
}, {
ignore: [popperRefEl.value]
});
);
useResizeObserver(triggerRefEl, () => {
updatePosistion();
});
@ -206,10 +216,16 @@ const _sfc_main$1 = defineComponent({
popperObserver && popperObserver.stop();
}
});
watch(() => props.visible, (isShow) => isShow ? doShow() : doHidden());
watch(() => props.content, () => {
updatePosistion();
});
watch(
() => props.visible,
(isShow) => isShow ? doShow() : doHidden()
);
watch(
() => props.content,
() => {
updatePosistion();
}
);
const isScrollElement = function(element) {
return element.scrollHeight > element.offsetHeight || element.scrollWidth > element.offsetWidth;
};

View File

@ -72,30 +72,42 @@ const _sfc_main = defineComponent({
leftSelectedKeys.value = [];
}
};
watch(() => [props.modelValue, props.dataSource], () => {
let targetDataSource = [];
props.dataSource.forEach((ds) => {
if (props.modelValue.includes(ds[props.id])) {
targetDataSource.push(ds);
watch(
() => [props.modelValue, props.dataSource],
() => {
let targetDataSource = [];
props.dataSource.forEach((ds) => {
if (props.modelValue.includes(ds[props.id])) {
targetDataSource.push(ds);
}
});
leftDataSource.value = props.dataSource.filter(
(item) => !props.modelValue.includes(item[props.id])
);
_leftDataSource.value = props.dataSource.filter(
(item) => !props.modelValue.includes(item[props.id])
);
rightDataSource.value = [...targetDataSource];
_rightDataSource.value = [...targetDataSource];
},
{ immediate: true }
);
watch(
leftSelectedKeys,
() => {
if (leftDataSource.value.length === leftSelectedKeys.value.length && leftDataSource.value.length != 0) {
allLeftChecked.value = true;
} else {
allLeftChecked.value = false;
}
});
leftDataSource.value = props.dataSource.filter((item) => !props.modelValue.includes(item[props.id]));
_leftDataSource.value = props.dataSource.filter((item) => !props.modelValue.includes(item[props.id]));
rightDataSource.value = [...targetDataSource];
_rightDataSource.value = [...targetDataSource];
}, { immediate: true });
watch(leftSelectedKeys, () => {
if (leftDataSource.value.length === leftSelectedKeys.value.length && leftDataSource.value.length != 0) {
allLeftChecked.value = true;
} else {
allLeftChecked.value = false;
}
if (leftSelectedKeys.value.length > 0 && leftDataSource.value.length != 0) {
hasLeftChecked.value = true;
} else {
hasLeftChecked.value = false;
}
}, { deep: true });
if (leftSelectedKeys.value.length > 0 && leftDataSource.value.length != 0) {
hasLeftChecked.value = true;
} else {
hasLeftChecked.value = false;
}
},
{ deep: true }
);
const allRightChange = (checked) => {
if (checked) {
const datasources = rightDataSource.value.filter((item) => {
@ -109,18 +121,22 @@ const _sfc_main = defineComponent({
rightSelectedKeys.value = [];
}
};
watch(rightSelectedKeys, () => {
if (rightDataSource.value.length === rightSelectedKeys.value.length && rightDataSource.value.length > 0) {
allRightChecked.value = true;
} else {
allRightChecked.value = false;
}
if (rightSelectedKeys.value.length > 0 && rightDataSource.value.length != 0) {
hasRightChecked.value = true;
} else {
hasRightChecked.value = false;
}
}, { deep: true });
watch(
rightSelectedKeys,
() => {
if (rightDataSource.value.length === rightSelectedKeys.value.length && rightDataSource.value.length > 0) {
allRightChecked.value = true;
} else {
allRightChecked.value = false;
}
if (rightSelectedKeys.value.length > 0 && rightDataSource.value.length != 0) {
hasRightChecked.value = true;
} else {
hasRightChecked.value = false;
}
},
{ deep: true }
);
const add = () => {
if (leftSelectedKeys.value.length === 0) {
return;

View File

@ -54,7 +54,11 @@ const _sfc_main$1 = defineComponent({
emit("node-click", node);
}
function handleChange(checked, node) {
props.tree.setCheckedKeys(checked, props.checkStrictly || props.selectParent, node);
props.tree.setCheckedKeys(
checked,
props.checkStrictly || props.selectParent,
node
);
}
function handleIconClick(node) {
node.isLeaf = !node.isLeaf;
@ -347,19 +351,22 @@ class Tree {
}
const useTree = (props, emit) => {
var _a, _b, _c, _d;
const tree = new Tree({
nodeMap: /* @__PURE__ */ new Map(),
originMap: /* @__PURE__ */ new Map(),
replaceFields: {
id: "id",
title: "title",
children: "children"
const tree = new Tree(
{
nodeMap: /* @__PURE__ */ new Map(),
originMap: /* @__PURE__ */ new Map(),
replaceFields: {
id: "id",
title: "title",
children: "children"
},
showCheckbox: (_a = props.showCheckbox) != null ? _a : false,
checkedKeys: (_b = props.checkedKeys) != null ? _b : [],
expandKeys: (_c = props.expandKeys) != null ? _c : [],
checkStrictly: (_d = props.checkStrictly) != null ? _d : false
},
showCheckbox: (_a = props.showCheckbox) != null ? _a : false,
checkedKeys: (_b = props.checkedKeys) != null ? _b : [],
expandKeys: (_c = props.expandKeys) != null ? _c : [],
checkStrictly: (_d = props.checkStrictly) != null ? _d : false
}, props.data);
props.data
);
const nodeList = computed(() => {
const nodes = tree.getData();
return nodes;
@ -418,27 +425,39 @@ const _sfc_main = defineComponent({
tree.value = _tree;
nodeList.value = _nodeList.value;
};
watch(() => props.data, () => {
loadNodeList();
}, { deep: true, immediate: true });
watch(() => props.checkedKeys, () => {
console.log(tree.value);
if (!unWatch.value) {
watch(
() => props.data,
() => {
loadNodeList();
},
{ deep: true, immediate: true }
);
watch(
() => props.checkedKeys,
() => {
console.log(tree.value);
if (!unWatch.value) {
loadNodeList();
}
},
{
deep: true
}
}, {
deep: true
});
watch(tree, () => {
if (initStatus.value) {
const { checkedKeys } = tree.value.getKeys();
unWatch.value = true;
emit("update:checkedKeys", checkedKeys);
nextTick(() => {
unWatch.value = false;
});
}
}, { deep: true });
);
watch(
tree,
() => {
if (initStatus.value) {
const { checkedKeys } = tree.value.getKeys();
unWatch.value = true;
emit("update:checkedKeys", checkedKeys);
nextTick(() => {
unWatch.value = false;
});
}
},
{ deep: true }
);
onMounted(() => {
nextTick(() => {
initStatus.value = true;

View File

@ -80,21 +80,25 @@ const _sfc_main = defineComponent({
}
}
});
watch(selectedValue, () => {
if (props.multiple) {
multipleValue.value = selectedValue.value.map((value) => {
const node = getNode(props.data, value);
node.label = node.title;
node.closable = !node.disabled;
return node;
});
} else {
const node = getNode(props.data, selectedValue.value);
if (node) {
singleValue.value = node.title;
watch(
selectedValue,
() => {
if (props.multiple) {
multipleValue.value = selectedValue.value.map((value) => {
const node = getNode(props.data, value);
node.label = node.title;
node.closable = !node.disabled;
return node;
});
} else {
const node = getNode(props.data, selectedValue.value);
if (node) {
singleValue.value = node.title;
}
}
}
}, { immediate: true, deep: true });
},
{ immediate: true, deep: true }
);
const handleClick = (node) => {
dropdownRef.value.hide();
selectedValue.value = node.id;

View File

@ -74,7 +74,10 @@ const _sfc_main = defineComponent({
let imgData = canvas.toDataURL('"image/png"');
let currentTimeStamp = new Date().valueOf();
let orgInfo = activeUploadFiles.value[0];
emit("cutdone", Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo }));
emit(
"cutdone",
Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo })
);
let newFile = dataURLtoFile(imgData);
if (!props.auto) {
emit("update:modelValue", [newFile]);
@ -139,11 +142,14 @@ const _sfc_main = defineComponent({
const slot = useSlots();
slot.default && slot.default();
getCurrentInstance();
watch(() => props.modelValue, () => {
if (!props.modelValue) {
clearAllCutEffect();
watch(
() => props.modelValue,
() => {
if (!props.modelValue) {
clearAllCutEffect();
}
}
});
);
const isDragEnter = ref(false);
const activeUploadFiles = ref([]);
const activeUploadFilesImgs = ref([]);
@ -151,7 +157,9 @@ const _sfc_main = defineComponent({
let _cropper = null;
let computedCutLayerOption;
if (props.cutOptions && props.cutOptions.layerOption) {
computedCutLayerOption = computed(() => Object.assign(defaultCutLayerOption, props.cutOptions.layerOption));
computedCutLayerOption = computed(
() => Object.assign(defaultCutLayerOption, props.cutOptions.layerOption)
);
} else {
computedCutLayerOption = computed(() => defaultCutLayerOption.value);
}
@ -214,7 +222,10 @@ const _sfc_main = defineComponent({
if (xhr.readyState === 1) {
if (xhr.status >= 200 && xhr.status <= 300 || xhr.status === 304 || xhr.status == 0) {
let successText = startUploadMsg.value;
emit("before", Object.assign({ currentTimeStamp: currentTimeStamp2, msg: successText, ...option }));
emit(
"before",
Object.assign({ currentTimeStamp: currentTimeStamp2, msg: successText, ...option })
);
}
} else if (xhr.readyState === 4) {
let successText = xhr.responseText ? xhr.responseText : uploadSuccess;

View File

@ -2,9 +2,12 @@ import { inject, computed, isRef, provide, reactive } from "vue";
const LevelInjectionKey = Symbol("menuLevelKey");
function provideLevel(level) {
const computedLevel = computed(() => isRef(level) ? level.value : level);
provide(LevelInjectionKey, reactive({
level: computedLevel
}));
provide(
LevelInjectionKey,
reactive({
level: computedLevel
})
);
}
function useLevel(props) {
const { provideNextLevel } = props || {};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
import { VNodeTypes } from "vue";
import type { PropType } from "vue";
export declare type RenderFunc = (props: Record<string, unknown>) => VNodeTypes;
export type RenderFunc = (props: Record<string, unknown>) => VNodeTypes;
declare const _default: import("vue").DefineComponent<{
renderFunc: {
type: PropType<RenderFunc>;

View File

@ -1,7 +1,7 @@
export declare type ButtonType = "primary" | "normal" | "warm" | "danger";
export declare type ButtonSize = "lg" | "md" | "sm" | "xs";
export declare type ButtonBorder = "green" | "blue" | "orange" | "red" | "black";
export declare type ButtonNativeType = "button" | "submit" | "reset";
export type ButtonType = "primary" | "normal" | "warm" | "danger";
export type ButtonSize = "lg" | "md" | "sm" | "xs";
export type ButtonBorder = "green" | "blue" | "orange" | "red" | "black";
export type ButtonNativeType = "button" | "submit" | "reset";
export declare const ButtonEmits: {
click: (evt: MouseEvent) => boolean;
};

View File

@ -1 +1 @@
export declare type CardShadow = "always" | "hover" | "never";
export type CardShadow = "always" | "hover" | "never";

View File

@ -1 +1 @@
export declare type CascaderSize = "lg" | "md" | "sm" | "xs";
export type CascaderSize = "lg" | "md" | "sm" | "xs";

View File

@ -1 +1 @@
export declare type CheckboxSize = "lg" | "md" | "sm" | "xs";
export type CheckboxSize = "lg" | "md" | "sm" | "xs";

View File

@ -1,6 +1,6 @@
import { Ref } from "vue";
export declare type DatePickerType = "date" | "datetime" | "year" | "time" | "month";
export declare type provideType = {
export type DatePickerType = "date" | "datetime" | "year" | "time" | "month";
export type provideType = {
currentYear: Ref;
currentMonth: Ref;
currentDay: Ref;

View File

@ -1,6 +1,6 @@
export declare type DropdownTrigger = "click" | "hover" | "focus" | "contextMenu";
export declare type DropdownPlacementLegacy = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "right-top" | "right-bottom" | "left-top" | "left-bottom";
export declare type DropdownPlacement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "right" | "right-start" | "right-end" | "left" | "left-start" | "left-end" | DropdownPlacementLegacy;
export type DropdownTrigger = "click" | "hover" | "focus" | "contextMenu";
export type DropdownPlacementLegacy = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "right-top" | "right-bottom" | "left-top" | "left-bottom";
export type DropdownPlacement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "right" | "right-start" | "right-end" | "left" | "left-start" | "left-end" | DropdownPlacementLegacy;
export interface ElementScrollRect {
top: number;
bottom: number;

View File

@ -1 +1 @@
export declare type InputSize = "lg" | "md" | "sm" | "xs";
export type InputSize = "lg" | "md" | "sm" | "xs";

View File

@ -1 +1 @@
export declare type InputNumberSize = "lg" | "md" | "sm" | "xs";
export type InputNumberSize = "lg" | "md" | "sm" | "xs";

View File

@ -1 +1 @@
export declare type PanelShadow = "always" | "hover" | "never";
export type PanelShadow = "always" | "hover" | "never";

View File

@ -1 +1 @@
export declare type RadioSize = "lg" | "md" | "sm" | "xs";
export type RadioSize = "lg" | "md" | "sm" | "xs";

View File

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

View File

@ -1 +1 @@
export declare type SelectSize = "lg" | "md" | "sm" | "xs";
export type SelectSize = "lg" | "md" | "sm" | "xs";

View File

@ -1 +1 @@
export declare type SwitchSize = "lg" | "md" | "sm" | "xs";
export type SwitchSize = "lg" | "md" | "sm" | "xs";

View File

@ -12,4 +12,4 @@ export interface TabsContext {
addItem: (id: string, data: TabData) => void;
removeItem: (id: string) => void;
}
export declare type TabPosition = "top" | "bottom" | "left" | "right";
export type TabPosition = "top" | "bottom" | "left" | "right";

View File

@ -1,4 +1,4 @@
export declare const TAG_COLORS: readonly ["primary", "normal", "warm", "danger"];
export declare type TagType = typeof TAG_COLORS[number];
export declare type TagShape = "square" | "round";
export declare type TagVariant = "dark" | "light" | "plain";
export type TagType = typeof TAG_COLORS[number];
export type TagShape = "square" | "round";
export type TagVariant = "dark" | "light" | "plain";

View File

@ -1 +1 @@
export declare type TagInputSize = "lg" | "md" | "sm" | "xs";
export type TagInputSize = "lg" | "md" | "sm" | "xs";

View File

@ -1,7 +1,7 @@
import { OriginalTreeData, StringOrNumber } from "./tree.type";
import { Nullable } from "../../types";
declare type CustomKey = string | number;
declare type CustomString = (() => string) | string;
type CustomKey = string | number;
type CustomString = (() => string) | string;
export interface TreeData {
id: CustomKey;
title: CustomString;

View File

@ -1,7 +1,7 @@
export declare type StringFn = () => string;
export declare type StringOrNumber = string | number;
export declare type KeysType = (number | string)[];
export declare type EditType = boolean | ("add" | "update" | "delete");
export type StringFn = () => string;
export type StringOrNumber = string | number;
export type KeysType = (number | string)[];
export type EditType = boolean | ("add" | "update" | "delete");
export interface OriginalTreeData {
title: StringFn | string;
id: StringOrNumber;
@ -31,5 +31,5 @@ export interface TreeEmits {
(e: "update:expandKeys", keys: KeysType): void;
(e: "node-click", node: OriginalTreeData, event: Event): void;
}
export declare type CustomKey = string | number;
export declare type CustomString = (() => string) | string;
export type CustomKey = string | number;
export type CustomString = (() => string) | string;

View File

@ -1 +1 @@
export declare type TreeSelectSize = "lg" | "md" | "sm" | "xs";
export type TreeSelectSize = "lg" | "md" | "sm" | "xs";

View File

@ -1,17 +1,17 @@
import type { App, DefineComponent, Ref } from "vue";
export declare type StringObject = Record<string, unknown>;
export declare type UnknownObject = Record<string | number, unknown>;
export declare type UnknownFunction = (...arg: unknown[]) => unknown;
export declare type IDefineComponent<Props = UnknownObject> = DefineComponent<Props> & {
export type StringObject = Record<string, unknown>;
export type UnknownObject = Record<string | number, unknown>;
export type UnknownFunction = (...arg: unknown[]) => unknown;
export type IDefineComponent<Props = UnknownObject> = DefineComponent<Props> & {
install: (app: App, options?: InstallOptions) => void;
};
export interface InstallOptions extends StringObject {
}
export declare type Nullable<T> = T | null;
export declare type MaybeRef<T> = Ref<T> | T;
export declare type Recordable = Record<string, any>;
export declare type Number = number;
export declare type String = string;
export declare type Boolean = boolean;
export declare type NumberOrString = number | string;
export declare type BooleanOrString = boolean | string;
export type Nullable<T> = T | null;
export type MaybeRef<T> = Ref<T> | T;
export type Recordable = Record<string, any>;
export type Number = number;
export type String = string;
export type Boolean = boolean;
export type NumberOrString = number | string;
export type BooleanOrString = boolean | string;

View File

@ -1,4 +1,4 @@
export declare type SelectValueType = string | string[] | number | number[] | null;
export type SelectValueType = string | string[] | number | number[] | null;
export interface SelectItem {
value?: SelectValueType;
label?: null | string | string[];

View File

@ -1,3 +1,3 @@
import { Plugin } from "vue";
export declare type WithInstallType<T> = T & Plugin;
export type WithInstallType<T> = T & Plugin;
export declare const withInstall: <T>(comp: T) => T & Plugin;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long