Compare commits

...

2 Commits

Author SHA1 Message Date
d2b464242b ♻️ component
fix(utils): 调整计算内容高度公式中的偏移量

style(component): 移除 soulkey 的默认空字符串值

chore(component): 更新 layer-vue 依赖路径为本地路径

feat(layer): 为图片组件添加滚轮缩放功能

refactor(component): 优化 computedRefImpl 类的实现

docs(component): 更新依赖路径和版本信息

style(component): 统一 isObject 函数的命名和实现

refactor(component): 重构上传组件的代码结构
2025-04-15 10:05:22 +08:00
5c68a21ac2 123 2024-11-06 09:23:24 +08:00
21 changed files with 2875 additions and 2827 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -172,13 +172,11 @@ function triggerRefValue(ref, newVal) {
} }
} }
} }
var _a;
class ComputedRefImpl { class ComputedRefImpl {
constructor(getter, _setter, isReadonly, isSSR) { constructor(getter, _setter, isReadonly, isSSR) {
this._setter = _setter; this._setter = _setter;
this.dep = void 0; this.dep = void 0;
this.__v_isRef = true; this.__v_isRef = true;
this[_a] = false;
this._dirty = true; this._dirty = true;
this.effect = new ReactiveEffect(getter, () => { this.effect = new ReactiveEffect(getter, () => {
if (!this._dirty) { if (!this._dirty) {
@ -203,7 +201,6 @@ class ComputedRefImpl {
this._setter(newValue); this._setter(newValue);
} }
} }
_a = "__v_isReadonly";
function computed(getterOrOptions, debugOptions, isSSR = false) { function computed(getterOrOptions, debugOptions, isSSR = false) {
let getter; let getter;
let setter; let setter;

View File

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

View File

@ -1783,7 +1783,6 @@ const _sfc_main = defineComponent({
if (dropdownRef.value) if (dropdownRef.value)
dropdownRef.value.hide(); dropdownRef.value.hide();
$emits("update:modelValue", dateValue.value); $emits("update:modelValue", dateValue.value);
$emits("change", dateValue.value);
}; };
provide("datePicker", { provide("datePicker", {
currentYear, currentYear,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1510,7 +1510,7 @@ const _sfc_main = defineComponent({
const soultop = ref(0); const soultop = ref(0);
const soulleft = ref(0); const soulleft = ref(0);
const selcolumn = ref({}); const selcolumn = ref({});
const soulkey = ref(""); const soulkey = ref();
const sxlist = ref({}); const sxlist = ref({});
function showsoul(event, column, key) { function showsoul(event, column, key) {
console.log(event); console.log(event);

View File

@ -1,7 +1,7 @@
import { w as withInstall } from "../badge/index2.js"; import { w as withInstall } from "../badge/index2.js";
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createElementVNode, normalizeClass, unref, createVNode, createCommentVNode, toDisplayString } from "vue"; 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 { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
import { i as isObject } from "../_chunks/@vueuse/index.js"; import { g 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")(); 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_1 = { class: "layui-textarea-wrapper" };
const _hoisted_2 = ["value", "placeholder", "name", "disabled", "maxlength"]; const _hoisted_2 = ["value", "placeholder", "name", "disabled", "maxlength"];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,8 @@
], ],
"exports": { "exports": {
".": { ".": {
"import": "./es/index.js" "import": "./es/index.js",
"types": "./types/index.d.ts"
}, },
"./lib/": "./lib/", "./lib/": "./lib/",
"./es/": "./es/" "./es/": "./es/"
@ -35,7 +36,7 @@
"dependencies": { "dependencies": {
"@ctrl/tinycolor": "^3.4.1", "@ctrl/tinycolor": "^3.4.1",
"@layui/icons-vue": "^1.0.9", "@layui/icons-vue": "^1.0.9",
"@layui/layer-vue": "git+https://git.theluyuan.com/luyuan/layui-layer.git", "@layui/layer-vue": "file:../layer",
"@layui/layui-vue": "file:", "@layui/layui-vue": "file:",
"@umijs/ssr-darkreader": "^4.9.45", "@umijs/ssr-darkreader": "^4.9.45",
"@vueuse/core": "^9.2.0", "@vueuse/core": "^9.2.0",

View File

@ -396,7 +396,6 @@ const onChange = () => {
// @ts-ignore // @ts-ignore
dropdownRef.value.hide(); dropdownRef.value.hide();
$emits("update:modelValue", dateValue.value); $emits("update:modelValue", dateValue.value);
$emits("change", dateValue.value);
}; };
provide("datePicker", { provide("datePicker", {

View File

@ -826,7 +826,7 @@ const soulstatus = ref(false);
const soultop = ref(0); const soultop = ref(0);
const soulleft = ref(0); const soulleft = ref(0);
const selcolumn = ref<any>({}); const selcolumn = ref<any>({});
const soulkey = ref(""); const soulkey = ref<string>();
const sxlist: any = ref({}); const sxlist: any = ref({});
function showsoul(event: MouseEvent, column: any, key: string) { function showsoul(event: MouseEvent, column: any, key: string) {
console.log(event); console.log(event);

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, createCommentVNode, toDisplayString, normalizeClass, ref, watch, onMounted, nextTick, createElementVNode, Fragment, renderList, shallowRef, createTextVNode, createVNode, useSlots, inject, Transition, withCtx, createBlock, renderSlot, h, render, isVNode } from "vue"; import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, createCommentVNode, toDisplayString, normalizeClass, ref, watch, onMounted, nextTick, createElementVNode, withModifiers, Fragment, renderList, shallowRef, createTextVNode, createVNode, useSlots, inject, Transition, withCtx, createBlock, renderSlot, h, render, isVNode } from "vue";
function _typeof$1(o) { function _typeof$1(o) {
"@babel/helpers - typeof"; "@babel/helpers - typeof";
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
@ -628,7 +628,7 @@ function _objectSpread$3(e) {
var _hoisted_1$2 = { var _hoisted_1$2 = {
class: "layui-layer-phimg" class: "layui-layer-phimg"
}; };
var _hoisted_2$2 = ["src"]; var _hoisted_2$2 = ["src", "onWheel"];
var _hoisted_3$2 = { var _hoisted_3$2 = {
key: 0, key: 0,
class: "layui-layer-imgsee" class: "layui-layer-imgsee"
@ -697,10 +697,20 @@ var _sfc_main$2 = defineComponent(_objectSpread$3(_objectSpread$3({}, __default_
}); });
return res; return res;
}); });
var scale = ref(1);
var handleWheel = function handleWheel2(event) {
var delta = event.deltaY > 0 ? -0.1 : 0.1;
var newScale = scale.value + delta;
scale.value = Math.min(Math.max(newScale, 0.5), 3);
};
return function(_ctx, _cache) { return function(_ctx, _cache) {
return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("img", { return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("img", {
src: __props.imgList[index2.value].src src: __props.imgList[index2.value].src,
}, null, 8, _hoisted_2$2), __props.imgList.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [__props.imgList.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_4$1, [createElementVNode("a", { onWheel: withModifiers(handleWheel, ["prevent"]),
style: normalizeStyle({
transform: "scale(".concat(scale.value, ")")
})
}, null, 44, _hoisted_2$2), __props.imgList.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [__props.imgList.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_4$1, [createElementVNode("a", {
href: "javascript:;", href: "javascript:;",
class: "layui-layer-iconext layui-layer-imgprev", class: "layui-layer-iconext layui-layer-imgprev",
onClick: _cache[0] || (_cache[0] = function($event) { onClick: _cache[0] || (_cache[0] = function($event) {
@ -950,7 +960,7 @@ function calculateContent(title2, height, btn, type, isMessage) {
if (btn && btn.length > 0) { if (btn && btn.length > 0) {
if (type == 0) { if (type == 0) {
if (title2) { if (title2) {
return "calc(" + height + " - 137px)"; return "calc(" + height + " - 90px)";
} else { } else {
return "calc(" + height + " - 86px)"; return "calc(" + height + " - 86px)";
} }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,11 @@
<template> <template>
<div class="layui-layer-phimg"> <div class="layui-layer-phimg">
<img :src="imgList[index].src" /> <!-- img 标签添加滚轮事件监听 -->
<img
:src="imgList[index].src"
@wheel.prevent="handleWheel"
:style="{ transform: `scale(${scale})` }"
/>
<div class="layui-layer-imgsee" v-if="imgList.length > 0"> <div class="layui-layer-imgsee" v-if="imgList.length > 0">
<span class="layui-layer-imguide" v-if="imgList.length > 1"> <span class="layui-layer-imguide" v-if="imgList.length > 1">
<a <a
@ -97,4 +102,14 @@ const ifSetThumb = computed(() => {
}); });
return res; return res;
}); });
//
const scale = ref(1);
//
const handleWheel = (event: WheelEvent) => {
const delta = event.deltaY > 0 ? -0.1 : 0.1;
const newScale = scale.value + delta;
//
scale.value = Math.min(Math.max(newScale, 0.5), 3);
};
</script> </script>

View File

@ -145,7 +145,7 @@ export function calculateContent(
if (btn && btn.length > 0) { if (btn && btn.length > 0) {
if (type == 0) { if (type == 0) {
if (title) { if (title) {
return "calc(" + height + " - 137px)"; return "calc(" + height + " - 90px)";
} else { } else {
return "calc(" + height + " - 86px)"; return "calc(" + height + " - 86px)";
} }

10
pnpm-lock.yaml generated
View File

@ -118,8 +118,8 @@ importers:
specifier: ^1.0.9 specifier: ^1.0.9
version: 1.1.0 version: 1.1.0
'@layui/layer-vue': '@layui/layer-vue':
specifier: git+https://git.theluyuan.com/luyuan/layui-layer.git specifier: file:../layer
version: git+https://git.theluyuan.com/luyuan/layui-layer.git#9a33139a88a82285754ff8005675378713a2e524 version: link:../layer
'@layui/layui-vue': '@layui/layui-vue':
specifier: 'file:' specifier: 'file:'
version: 'link:' version: 'link:'
@ -1099,10 +1099,6 @@ packages:
'@layui/icons-vue@1.1.0': '@layui/icons-vue@1.1.0':
resolution: {integrity: sha512-ndc53qyUZSslUkO8ZHeBMh6i4gSTtAUqsPpKQZWML0JH6E/X3LIySe6LATeqEMmD7wWSnHJ+WBVGO4ij85Dk1g==} resolution: {integrity: sha512-ndc53qyUZSslUkO8ZHeBMh6i4gSTtAUqsPpKQZWML0JH6E/X3LIySe6LATeqEMmD7wWSnHJ+WBVGO4ij85Dk1g==}
'@layui/layer-vue@git+https://git.theluyuan.com/luyuan/layui-layer.git#9a33139a88a82285754ff8005675378713a2e524':
resolution: {commit: 9a33139a88a82285754ff8005675378713a2e524, repo: https://git.theluyuan.com/luyuan/layui-layer.git, type: git}
version: 1.4.7
'@nodelib/fs.scandir@2.1.5': '@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
@ -4554,8 +4550,6 @@ snapshots:
'@layui/icons-vue@1.1.0': {} '@layui/icons-vue@1.1.0': {}
'@layui/layer-vue@git+https://git.theluyuan.com/luyuan/layui-layer.git#9a33139a88a82285754ff8005675378713a2e524': {}
'@nodelib/fs.scandir@2.1.5': '@nodelib/fs.scandir@2.1.5':
dependencies: dependencies:
'@nodelib/fs.stat': 2.0.5 '@nodelib/fs.stat': 2.0.5