Compare commits
34 Commits
05e5b84c5c
...
v1.7.0
| Author | SHA1 | Date | |
|---|---|---|---|
| d3d004b835 | |||
| 3e44d6eb9c | |||
| 03dda7b4ee | |||
| 1a117f55ce | |||
| 371ea1495b | |||
| 74e66728f8 | |||
| 29c1daeda9 | |||
| d2f3df7a45 | |||
| d2b464242b | |||
| 5c68a21ac2 | |||
| c7194eb604 | |||
| 3a9b2d55c6 | |||
| ef869c5ab1 | |||
| 496f1b447e | |||
| d87341b99a | |||
| 7d7ee0e05b | |||
| 785bb81f18 | |||
| 53c01a298b | |||
| 9184185de2 | |||
| d2f4a1b2be | |||
| d9127dfd42 | |||
| c2027a8665 | |||
| 49d7a25529 | |||
| 92fa833be7 | |||
| 9c7280105d | |||
| 71a3b6f1c4 | |||
| adc3f9f7d3 | |||
| a19040aa60 | |||
| 1686971f8c | |||
| cb5a696c09 | |||
| bcbe71c7ad | |||
| 0cb74e4f10 | |||
| e734ad64f0 | |||
| 0df15d84de |
@@ -1,18 +1,18 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
types: [
|
||||
{ value: "✨", name: "特性: 一个新的特性" },
|
||||
{ value: "🐛", name: "修复: 修复一个Bug" },
|
||||
{ value: "📝", name: "文档: 变更的只有文档" },
|
||||
{ value: "💄", name: "格式: 空格, 分号等格式修复" },
|
||||
{ value: "♻️", name: "重构: 代码重构,注意和特性、修复区分开" },
|
||||
{ value: "🌀", name: "样式: 样式的调整" },
|
||||
{ value: "⚡️", name: "性能: 提升性能" },
|
||||
{ value: "✅", name: "测试: 添加一个测试" },
|
||||
{ value: "🔧", name: "工具: 开发工具变动(构建、脚手架工具等)" },
|
||||
{ value: "⏪", name: "回滚: 代码回退" },
|
||||
{ value: "⬆️", name: "升级: 依赖升级" },
|
||||
{ value: "⬇️", name: "降级: 依赖降级" },
|
||||
// { value: "✨", name: "特性: 一个新的特性" },
|
||||
// { value: "🐛", name: "修复: 修复一个Bug" },
|
||||
// { value: "📝", name: "文档: 变更的只有文档" },
|
||||
// { value: "💄", name: "格式: 空格, 分号等格式修复" },
|
||||
// { value: "♻️", name: "重构: 代码重构,注意和特性、修复区分开" },
|
||||
// { value: "🌀", name: "样式: 样式的调整" },
|
||||
// { value: "⚡️", name: "性能: 提升性能" },
|
||||
// { value: "✅", name: "测试: 添加一个测试" },
|
||||
// { value: "🔧", name: "工具: 开发工具变动(构建、脚手架工具等)" },
|
||||
// { value: "⏪", name: "回滚: 代码回退" },
|
||||
// { value: "⬆️", name: "升级: 依赖升级" },
|
||||
// { value: "⬇️", name: "降级: 依赖降级" },
|
||||
],
|
||||
scopes: [
|
||||
{ name: "component" },
|
||||
|
||||
48
package.json
48
package.json
@@ -21,43 +21,43 @@
|
||||
"commit": "git add . && git-cz && git push"
|
||||
},
|
||||
"dependencies": {
|
||||
"@layui/layui-vue": "workspace:*",
|
||||
"@layui/icons-vue": "workspace:*",
|
||||
"@layui/layer-vue": "workspace:*",
|
||||
"@layui/layui-vue": "workspace:*",
|
||||
"vue": "3.2.40"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "3.2.40"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^16.2.1",
|
||||
"@commitlint/config-conventional": "^16.2.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
||||
"@typescript-eslint/parser": "^5.8.0",
|
||||
"commitizen": "^4.2.4",
|
||||
"commitlint-config-cz": "^0.13.3",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"cz-customizable": "^6.3.0",
|
||||
"eslint": "^8.5.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-vue": "^8.2.0",
|
||||
"husky": "^8.0.1",
|
||||
"prettier": "^2.6.2",
|
||||
"@babel/core": "^7.17.9",
|
||||
"@babel/preset-env": "^7.15.8",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@rollup/plugin-babel": "^5.3.0",
|
||||
"@types/node": "^16.11.9",
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/preset-env": "^7.25.4",
|
||||
"@babel/preset-typescript": "^7.24.7",
|
||||
"@commitlint/cli": "^16.3.0",
|
||||
"@commitlint/config-conventional": "^16.2.4",
|
||||
"@rollup/plugin-babel": "^5.3.1",
|
||||
"@types/node": "^16.18.108",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@vitejs/plugin-vue": "^2.3.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"@vitejs/plugin-vue": "^2.3.4",
|
||||
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
||||
"@vue/compiler-sfc": "3.2.40",
|
||||
"@vue/server-renderer": "3.2.40",
|
||||
"less": "^4.1.3",
|
||||
"commitizen": "^4.3.0",
|
||||
"commitlint-config-cz": "^0.13.3",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"cz-customizable": "^6.9.2",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^8.10.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-vue": "^8.7.1",
|
||||
"husky": "^8.0.3",
|
||||
"less": "^4.2.0",
|
||||
"prettier": "^2.8.8",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.75.5",
|
||||
"typescript": "^4.8.4",
|
||||
"rollup": "^2.79.1",
|
||||
"typescript": "^4.9.5",
|
||||
"vite": "2.9.12"
|
||||
},
|
||||
"config": {
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { computed, isRef, reactive, unref, toRefs, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, nextTick, ref, watch, customRef, onUpdated } from "vue";
|
||||
import { getCurrentScope, onScopeDispose, computed, toRefs, getCurrentInstance, onMounted, nextTick, ref, unref, isRef, reactive, watch, customRef, onUpdated } from "vue";
|
||||
var _a$1;
|
||||
const isClient$1 = typeof window !== "undefined";
|
||||
const toString$1 = Object.prototype.toString;
|
||||
|
||||
261
package/component/es/_chunks/js-image-compressor/index.js
Normal file
261
package/component/es/_chunks/js-image-compressor/index.js
Normal file
@@ -0,0 +1,261 @@
|
||||
var jsImageCompressor = { exports: {} };
|
||||
var imageCompressor_min = { exports: {} };
|
||||
(function(module, exports) {
|
||||
!function(e, t) {
|
||||
module.exports = t();
|
||||
}(window, function() {
|
||||
return function(e) {
|
||||
var t = {};
|
||||
function n(r) {
|
||||
if (t[r])
|
||||
return t[r].exports;
|
||||
var a = t[r] = { i: r, l: false, exports: {} };
|
||||
return e[r].call(a.exports, a, a.exports, n), a.l = true, a.exports;
|
||||
}
|
||||
return n.m = e, n.c = t, n.d = function(e2, t2, r) {
|
||||
n.o(e2, t2) || Object.defineProperty(e2, t2, { enumerable: true, get: r });
|
||||
}, n.r = function(e2) {
|
||||
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
|
||||
}, n.t = function(e2, t2) {
|
||||
if (1 & t2 && (e2 = n(e2)), 8 & t2)
|
||||
return e2;
|
||||
if (4 & t2 && "object" == typeof e2 && e2 && e2.__esModule)
|
||||
return e2;
|
||||
var r = /* @__PURE__ */ Object.create(null);
|
||||
if (n.r(r), Object.defineProperty(r, "default", { enumerable: true, value: e2 }), 2 & t2 && "string" != typeof e2)
|
||||
for (var a in e2)
|
||||
n.d(r, a, function(t3) {
|
||||
return e2[t3];
|
||||
}.bind(null, a));
|
||||
return r;
|
||||
}, n.n = function(e2) {
|
||||
var t2 = e2 && e2.__esModule ? function() {
|
||||
return e2.default;
|
||||
} : function() {
|
||||
return e2;
|
||||
};
|
||||
return n.d(t2, "a", t2), t2;
|
||||
}, n.o = function(e2, t2) {
|
||||
return Object.prototype.hasOwnProperty.call(e2, t2);
|
||||
}, n.p = "", n(n.s = 0);
|
||||
}([function(e, t, n) {
|
||||
n.r(t);
|
||||
var r = window, a = /^image\//, i = /\.\w+$/, o = {}, s = { file: null, quality: 0.8, convertSize: 2048e3, loose: true, redressOrientation: true }, f = function(e2) {
|
||||
return "function" == typeof e2;
|
||||
}, c = function(e2) {
|
||||
return a.test(e2);
|
||||
};
|
||||
function l(e2) {
|
||||
e2 = Object.assign({}, s, e2), this.options = e2, this.file = e2.file, this.image = null, this.ParsedOrientationInfo = null, this.init();
|
||||
}
|
||||
var u = l.prototype;
|
||||
for (var h in t.default = l, u.init = function() {
|
||||
var e2 = this, t2 = this.file, n2 = this.options;
|
||||
t2 && c(t2.type) ? (c(n2.mimeType) || (n2.mimeType = t2.type), o.file2Image(t2, function(r2) {
|
||||
f(e2.beforeCompress) && (e2.image = r2, t2.width = r2.naturalWidth, t2.height = r2.naturalHeight, e2.beforeCompress(t2)), "image/jpeg" === t2.type && n2.redressOrientation ? e2.getParsedOrientationInfo(function(t3) {
|
||||
e2.parsedOrientationInfo = t3, e2.rendCanvas();
|
||||
}) : (e2.parsedOrientationInfo = { rotate: 0, scaleX: 1, scaleY: 1 }, e2.rendCanvas());
|
||||
}, e2.error)) : e2.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6!");
|
||||
}, u.rendCanvas = function() {
|
||||
var e2 = this, t2 = this.options, n2 = this.image, r2 = this.getExpectedEdge(), a2 = r2.dWidth, i2 = r2.dHeight, s2 = r2.width, f2 = r2.height, c2 = o.image2Canvas(n2, a2, i2, e2.beforeDraw.bind(e2), e2.afterDraw.bind(e2), s2, f2);
|
||||
o.canvas2Blob(c2, function(t3) {
|
||||
t3 && (t3.width = c2.width, t3.height = c2.height), e2.success(t3);
|
||||
}, t2.quality, t2.mimeType);
|
||||
}, u.beforeCompress = function() {
|
||||
f(this.options.beforeCompress) && this.options.beforeCompress(this.file);
|
||||
}, u.getExpectedEdge = function() {
|
||||
var e2, t2 = this.image, n2 = this.parsedOrientationInfo.rotate, r2 = this.options, a2 = t2.naturalWidth, i2 = t2.naturalHeight, o2 = Math.abs(n2) % 180 == 90;
|
||||
o2 && (e2 = i2, i2 = a2, a2 = e2);
|
||||
var s2 = a2 / i2, f2 = Math.max(r2.maxWidth, 0) || 1 / 0, c2 = Math.max(r2.maxHeight, 0) || 1 / 0, l2 = Math.max(r2.minWidth, 0) || 0, u2 = Math.max(r2.minHeight, 0) || 0, h2 = Math.max(r2.width, 0) || a2, d = Math.max(r2.height, 0) || i2;
|
||||
f2 < 1 / 0 && c2 < 1 / 0 ? c2 * s2 > f2 ? c2 = f2 / s2 : f2 = c2 * s2 : f2 < 1 / 0 ? c2 = f2 / s2 : c2 < 1 / 0 && (f2 = c2 * s2), l2 > 0 && u2 > 0 ? u2 * s2 > l2 ? u2 = l2 / s2 : l2 = u2 * s2 : l2 > 0 ? u2 = l2 / s2 : u2 > 0 && (l2 = u2 * s2), d * s2 > h2 ? d = h2 / s2 : h2 = d * s2;
|
||||
var g = h2 = Math.floor(Math.min(Math.max(h2, l2), f2)), p = d = Math.floor(Math.min(Math.max(d, u2), c2));
|
||||
return o2 && (e2 = p, p = g, g = e2), { dWidth: g, dHeight: p, width: h2, height: d };
|
||||
}, u.getParsedOrientationInfo = function(e2) {
|
||||
var t2 = this;
|
||||
this.getOrientation(function(n2) {
|
||||
f(e2) && e2(t2.parseOrientation(n2));
|
||||
});
|
||||
}, u.getOrientation = function(e2) {
|
||||
var t2 = this;
|
||||
o.file2ArrayBuffer(this.file, function(n2) {
|
||||
f(e2) && e2(t2.resetAndGetOrientation(n2));
|
||||
});
|
||||
}, u.resetAndGetOrientation = function(e2) {
|
||||
var t2, n2 = new DataView(e2);
|
||||
try {
|
||||
var r2, a2, i2;
|
||||
if (255 === n2.getUint8(0) && 216 === n2.getUint8(1))
|
||||
for (var s2 = n2.byteLength, f2 = 2; f2 + 1 < s2; ) {
|
||||
if (255 === n2.getUint8(f2) && 225 === n2.getUint8(f2 + 1)) {
|
||||
a2 = f2;
|
||||
break;
|
||||
}
|
||||
f2 += 1;
|
||||
}
|
||||
if (a2) {
|
||||
var c2 = a2 + 4, l2 = a2 + 10;
|
||||
if ("Exif" === o.getStringFromCharCode(n2, c2, 4)) {
|
||||
var u2 = n2.getUint16(l2);
|
||||
if (((r2 = 18761 === u2) || 19789 === u2) && 42 === n2.getUint16(l2 + 2, r2)) {
|
||||
var h2 = n2.getUint32(l2 + 4, r2);
|
||||
h2 >= 8 && (i2 = l2 + h2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i2) {
|
||||
var d;
|
||||
s2 = n2.getUint16(i2, r2);
|
||||
for (d = 0; d < s2; d += 1)
|
||||
if (f2 = i2 + 12 * d + 2, 274 === n2.getUint16(f2, r2)) {
|
||||
f2 += 8, t2 = n2.getUint16(f2, r2), n2.setUint16(f2, 1, r2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e3) {
|
||||
console.error(e3), t2 = 1;
|
||||
}
|
||||
return t2;
|
||||
}, u.parseOrientation = function(e2) {
|
||||
var t2 = 0, n2 = 1, r2 = 1;
|
||||
switch (e2) {
|
||||
case 2:
|
||||
n2 = -1;
|
||||
break;
|
||||
case 3:
|
||||
t2 = -180;
|
||||
break;
|
||||
case 4:
|
||||
r2 = -1;
|
||||
break;
|
||||
case 5:
|
||||
t2 = 90, r2 = -1;
|
||||
break;
|
||||
case 6:
|
||||
t2 = 90;
|
||||
break;
|
||||
case 7:
|
||||
t2 = 90, n2 = -1;
|
||||
break;
|
||||
case 8:
|
||||
t2 = -90;
|
||||
}
|
||||
return { rotate: t2, scaleX: n2, scaleY: r2 };
|
||||
}, u.beforeDraw = function(e2, t2) {
|
||||
var n2 = this.parsedOrientationInfo, r2 = n2.rotate, a2 = n2.scaleX, i2 = n2.scaleY, o2 = this.file, s2 = this.options, c2 = "transparent", l2 = t2.width, u2 = t2.height;
|
||||
switch (o2.size > s2.convertSize && "image/png" === s2.mimeType && (c2 = "#fff", s2.mimeType = "image/jpeg"), e2.fillStyle = c2, e2.fillRect(0, 0, l2, u2), f(s2.beforeDraw) && s2.beforeDraw.call(this, e2, t2), e2.save(), r2) {
|
||||
case 90:
|
||||
e2.translate(l2, 0);
|
||||
break;
|
||||
case -90:
|
||||
e2.translate(0, u2);
|
||||
break;
|
||||
case -180:
|
||||
e2.translate(l2, u2);
|
||||
}
|
||||
e2.rotate(r2 * Math.PI / 180), e2.scale(a2, i2);
|
||||
}, u.afterDraw = function(e2, t2) {
|
||||
var n2 = this.options;
|
||||
f(n2.afterDraw) && n2.afterDraw.call(this, e2, t2);
|
||||
}, u.error = function(e2) {
|
||||
var t2 = this.options;
|
||||
if (!f(t2.error))
|
||||
throw new Error(e2);
|
||||
t2.error.call(this, e2);
|
||||
}, u.success = function(e2) {
|
||||
var t2, n2, r2 = this.options, a2 = this.file, o2 = this.image, s2 = this.getExpectedEdge(), l2 = o2.naturalHeight, u2 = o2.naturalWidth;
|
||||
if (e2 && e2.size)
|
||||
if (!r2.loose && e2.size > a2.size && !(s2.width > u2 || s2.height > l2))
|
||||
console.warn("\u5F53\u524D\u8BBE\u7F6E\u7684\u662F\u975E\u5BBD\u677E\u6A21\u5F0F\uFF0C\u538B\u7F29\u7ED3\u679C\u5927\u4E8E\u6E90\u56FE\u7247\uFF0C\u8F93\u51FA\u6E90\u56FE\u7247"), e2 = a2;
|
||||
else {
|
||||
var h2 = new Date();
|
||||
e2.lastModified = h2.getTime(), e2.lastModifiedDate = h2, e2.name = a2.name, e2.name && e2.type !== a2.type && (e2.name = e2.name.replace(i, (t2 = e2.type, "jpeg" === (n2 = c(t2) ? t2.substr(6) : "") && (n2 = "jpg"), "." + n2)));
|
||||
}
|
||||
else
|
||||
console.warn("\u56FE\u7247\u538B\u7F29\u51FA\u4E86\u70B9\u610F\u5916\uFF0C\u8F93\u51FA\u6E90\u56FE\u7247"), e2 = a2;
|
||||
f(r2.success) && r2.success.call(this, e2);
|
||||
}, o.file2DataUrl = function(e2, t2, n2) {
|
||||
var r2 = new FileReader();
|
||||
r2.onload = function() {
|
||||
t2(r2.result);
|
||||
}, r2.onerror = function() {
|
||||
f(n2) && n2("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF01");
|
||||
}, r2.readAsDataURL(e2);
|
||||
}, o.file2ArrayBuffer = function(e2, t2, n2) {
|
||||
var r2 = new FileReader();
|
||||
r2.onload = function(e3) {
|
||||
t2(e3.target.result);
|
||||
}, r2.onerror = function() {
|
||||
f(n2) && n2("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF01");
|
||||
}, r2.readAsArrayBuffer(e2);
|
||||
}, o.getStringFromCharCode = function(e2, t2, n2) {
|
||||
var r2, a2 = "";
|
||||
for (n2 += t2, r2 = t2; r2 < n2; r2 += 1)
|
||||
a2 += String.fromCharCode(e2.getUint8(r2));
|
||||
return a2;
|
||||
}, o.file2Image = function(e2, t2, n2) {
|
||||
var a2 = new Image(), i2 = r.URL || r.webkitURL;
|
||||
if (r.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(r.navigator.userAgent) && (a2.crossOrigin = "anonymous"), a2.alt = e2.name, a2.onerror = function() {
|
||||
f(n2) && n2("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01");
|
||||
}, i2) {
|
||||
var o2 = i2.createObjectURL(e2);
|
||||
a2.onload = function() {
|
||||
t2(a2), i2.revokeObjectURL(o2);
|
||||
}, a2.src = o2;
|
||||
} else
|
||||
this.file2DataUrl(e2, function(e3) {
|
||||
a2.onload = function() {
|
||||
t2(a2);
|
||||
}, a2.src = e3;
|
||||
}, n2);
|
||||
}, o.url2Image = function(e2, t2, n2) {
|
||||
var r2 = new Image();
|
||||
r2.src = e2, r2.onload = function() {
|
||||
t2(r2);
|
||||
}, r2.onerror = function() {
|
||||
f(n2) && n2("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01");
|
||||
};
|
||||
}, o.image2Canvas = function(e2, t2, n2, r2, a2, i2, o2) {
|
||||
var s2 = document.createElement("canvas"), c2 = s2.getContext("2d");
|
||||
return s2.width = i2 || e2.naturalWidth, s2.height = o2 || e2.naturalHeight, f(r2) && r2(c2, s2), c2.save(), c2.drawImage(e2, 0, 0, t2, n2), c2.restore(), f(a2) && a2(c2, s2), s2;
|
||||
}, o.canvas2DataUrl = function(e2, t2, n2) {
|
||||
return e2.toDataURL(n2 || "image/jpeg", t2);
|
||||
}, o.dataUrl2Image = function(e2, t2, n2) {
|
||||
var r2 = new Image();
|
||||
r2.onload = function() {
|
||||
t2(r2);
|
||||
}, r2.error = function() {
|
||||
f(n2) && n2("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01");
|
||||
}, r2.src = e2;
|
||||
}, o.dataUrl2Blob = function(e2, t2) {
|
||||
for (var n2 = e2.split(",")[1], r2 = e2.match(/^data:(.*?)(;base64)?,/)[1], a2 = atob(n2), i2 = n2.length, o2 = new Uint8Array(i2), s2 = 0; s2 < i2; s2++)
|
||||
o2[s2] = a2.charCodeAt(s2);
|
||||
return new Blob([o2], { type: t2 || r2 });
|
||||
}, o.blob2DataUrl = function(e2, t2, n2) {
|
||||
this.file2DataUrl(e2, t2, n2);
|
||||
}, o.blob2Image = function(e2, t2, n2) {
|
||||
this.file2Image(e2, t2, n2);
|
||||
}, o.canvas2Blob = function(e2, t2, n2, r2) {
|
||||
var a2 = this;
|
||||
HTMLCanvasElement.prototype.toBlob || Object.defineProperty(HTMLCanvasElement.prototype, "toBlob", { value: function(e3, t3, n3) {
|
||||
var r3 = this.toDataURL(t3, n3);
|
||||
e3(a2.dataUrl2Blob(r3));
|
||||
} }), e2.toBlob(function(e3) {
|
||||
t2(e3);
|
||||
}, r2 || "image/jpeg", n2 || 0.8);
|
||||
}, o.upload = function(e2, t2, n2) {
|
||||
var r2 = new XMLHttpRequest(), a2 = new FormData();
|
||||
a2.append("file", t2), r2.onreadystatechange = function() {
|
||||
if (4 !== r2.readyState || 200 !== r2.status)
|
||||
throw new Error(r2);
|
||||
n2 && n2(r2.responseText);
|
||||
}, r2.open("POST", e2, true), r2.send(a2);
|
||||
}, o)
|
||||
o.hasOwnProperty(h) && (l[h] = o[h]);
|
||||
}]).default;
|
||||
});
|
||||
})(imageCompressor_min);
|
||||
{
|
||||
jsImageCompressor.exports = imageCompressor_min.exports;
|
||||
}
|
||||
var ImageCompressor = jsImageCompressor.exports;
|
||||
export { ImageCompressor as I };
|
||||
@@ -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;
|
||||
|
||||
19987
package/component/es/_chunks/xlsx/index.js
Normal file
19987
package/component/es/_chunks/xlsx/index.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, computed, unref, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock } from "vue";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
var index = /* @__PURE__ */ (() => ".layui-avatar{font-size:14px;font-variant:tabular-nums;border-radius:var(--global-border-radius);box-sizing:border-box;color:#fff;list-style:none;position:relative;display:inline-block;background:#eeeeee;overflow:hidden;white-space:nowrap;text-align:center;width:32px;height:32px;line-height:32px;vertical-align:middle}.layui-avatar.layui-avatar-radius{border-radius:50%}.layui-avatar.layui-avatar-sm{height:30px;width:30px}.layui-avatar.layui-avatar-lg{height:36px;width:36px}.layui-avatar.layui-avatar-xs{height:28px;width:28px}.layui-avatar-list .layui-avatar{margin-left:-10px;display:inline-block}.layui-avatar>img{width:100%;height:100%;display:block;object-fit:cover}\n")();
|
||||
const _hoisted_1 = ["src", "alt"];
|
||||
const __default__ = {
|
||||
@@ -39,7 +39,7 @@ const _sfc_main = defineComponent({
|
||||
key: 0,
|
||||
src: __props.src,
|
||||
alt: __props.alt
|
||||
}, null, 8, _hoisted_1)) : (openBlock(), createBlock(unref(_sfc_main$2E), {
|
||||
}, null, 8, _hoisted_1)) : (openBlock(), createBlock(unref(_sfc_main$2W), {
|
||||
key: 1,
|
||||
type: __props.icon
|
||||
}, null, 8, ["type"]))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, shallowRef, computed, onMounted, onBeforeUnmount, withDirectives, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, withModifiers, renderSlot, createVNode, vShow } from "vue";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
var index = /* @__PURE__ */ (() => ".layui-backtop{position:fixed;right:30px;bottom:40px;width:50px;height:50px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:40px;background-color:#9f9f9f;color:#fff;border-radius:var(--global-border-radius);opacity:.95;z-index:999999}.layui-backtop :hover{opacity:.85}.layui-backtop-medium{width:40px;height:40px;font-size:30px}.layui-backtop-small{width:30px;height:30px;font-size:20px}\n")();
|
||||
const _hoisted_1 = ["onClick"];
|
||||
const __default__ = {
|
||||
@@ -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";
|
||||
}
|
||||
@@ -162,7 +164,7 @@ const _sfc_main = defineComponent({
|
||||
onMouseup: handlerMouseup
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default", {}, () => [
|
||||
createVNode(unref(_sfc_main$2E), {
|
||||
createVNode(unref(_sfc_main$2W), {
|
||||
type: props.icon,
|
||||
size: `${props.iconSize}px`,
|
||||
color: props.iconColor
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { defineComponent, onMounted, watch, ref, useSlots, openBlock, createElem
|
||||
import { _ as _sfc_main$3 } from "../input/index2.js";
|
||||
import { _ as _sfc_main$2 } from "../scroll/index2.js";
|
||||
import { _ as _sfc_main$1 } from "../dropdown/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
var index = /* @__PURE__ */ (() => ":root{--input-border-radius: var(--global-border-radius);--input-border-color: var(--global-neutral-color-3)}.layui-input{width:100%;height:38px;line-height:38px;border-width:1px;border-style:solid;border-color:var(--input-border-color);border-radius:var(--input-border-radius);display:inline-flex}.layui-input input{height:38px;line-height:38px;background-color:#fff;color:#000000d9;padding-left:10px;display:inline-block;border:none;height:100%;width:100%}.layui-input-append{background-color:#fafafa;border-left:1px solid var(--input-border-color);display:flex;padding:0 15px;flex:none;align-items:center}.layui-input-prepend{background-color:#fafafa;border-right:1px solid var(--input-border-color);display:flex;padding:0 15px;flex:none;align-items:center}.layui-input-wrapper{width:100%;display:inline-flex;border:none}.layui-input:hover,.layui-input:focus-within{border-color:#d2d2d2}.layui-input-clear,.layui-input-prefix,.layui-input-suffix,.layui-input-password{background-color:#fff}.layui-input-clear,.layui-input-password,.layui-input-prefix,.layui-input-suffix{display:flex;flex:none;align-items:center;padding:0 10px}.layui-input-has-prefix input{padding:0}.layui-input-clear,.layui-input-password{color:#00000073}.layui-input-clear:hover{opacity:.6}.layui-input input::-webkit-input-placeholder{line-height:1.3}.layui-input input::-ms-reveal{display:none}.layui-input-disabled{border-color:var(--input-border-color)!important}.layui-input-disabled{opacity:.6}.layui-input-disabled,.layui-input-disabled *{cursor:not-allowed!important}.layui-input[size=lg]{height:44px}.layui-input[size=lg] .layui-input{height:44px;line-height:44px}.layui-input[size=md]{height:38px}.layui-input[size=md] .layui-input{height:38px;line-height:38px}.layui-input[size=sm]{height:32px}.layui-input[size=sm] .layui-input{height:32px;line-height:32px}.layui-input[size=xs]{height:26px}.layui-input[size=xs] .layui-input{height:26px;line-height:26px}.layui-cascader{display:inline-block}.layui-cascader[size=lg]{height:44px;width:260px}.layui-cascader[size=lg] .layui-input{height:44px;line-height:44px}.layui-cascader[size=md]{height:38px;width:220px}.layui-cascader[size=md] .layui-input{height:38px;line-height:38px}.layui-cascader[size=sm]{height:32px;width:180px}.layui-cascader[size=sm] .layui-input{height:32px;line-height:32px}.layui-cascader[size=xs]{height:26px;width:140px}.layui-cascader[size=xs] .layui-input{height:26px;line-height:26px}.layui-cascader .layui-input-suffix{padding-right:10px}.layui-cascader .layui-icon-triangle-d{transition:all .3s ease-in-out;transform:rotate(0);color:var(--global-neutral-color-8)}.layui-cascader-opend .layui-icon-triangle-d{transform:rotate(180deg)}.layui-cascader .layui-cascader-panel{box-sizing:border-box;border-radius:2px;line-height:26px;color:#000c;font-size:14px;white-space:nowrap;display:inline-flex}.layui-cascader-menu{display:inline-block;border-right:1px solid var(--global-neutral-color-3)}.layui-cascader-menu:last-child{border-right:none}.layui-cascader-menu-item{min-width:130px;padding:5px 9px 5px 15px;box-sizing:border-box;transition:all .1s ease-in-out;display:flex;justify-content:space-between;align-items:center;min-height:35px}.layui-cascader-menu-item:hover,.layui-cascader-selected{background-color:var(--global-checked-color);color:#fff}.layui-cascader-menu-item .layui-icon-right{margin-left:10px}.layui-cascader-disabled,.layui-cascader-disabled *{cursor:not-allowed!important}\n")();
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../_chunks/@layui/index.js";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,38 +1,5 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, provide, watch, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
||||
const __default__ = {
|
||||
name: "LayCheckboxGroup"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
modelValue: { default: () => [] },
|
||||
disabled: { type: Boolean, default: false }
|
||||
},
|
||||
emits: ["update:modelValue", "change"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const modelValue = ref(props.modelValue);
|
||||
const disabled = ref(props.disabled);
|
||||
provide("checkboxGroup", {
|
||||
name: "LayCheckboxGroup",
|
||||
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);
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-checkbox-group", { "layui-checkbox-group-disabled": disabled.value }])
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
import { _ as _sfc_main } from "../index2.js";
|
||||
import "vue";
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@ import "vue";
|
||||
import "../_chunks/dayjs/index.js";
|
||||
import "../_chunks/@umijs/index.js";
|
||||
import "../input/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
import "../dropdown/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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) => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { defineComponent, openBlock, createBlock, withCtx, createVNode, renderSl
|
||||
import { _ as _sfc_main$1 } from "../dropdown/index2.js";
|
||||
import { L as LayDropdownMenu } from "../dropdownMenu/index2.js";
|
||||
import { _ as _sfc_main$2 } from "../dropdownMenuItem/index2.js";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
const __default__ = {
|
||||
name: "LayDropdownSubMenu"
|
||||
@@ -38,7 +38,7 @@ const _sfc_main = defineComponent({
|
||||
createVNode(_sfc_main$2, { disabled: __props.disabled }, createSlots({
|
||||
suffix: withCtx(() => [
|
||||
renderSlot(_ctx.$slots, "suffix", {}, () => [
|
||||
createVNode(unref(_sfc_main$2E), {
|
||||
createVNode(unref(_sfc_main$2W), {
|
||||
type: "layui-icon-right",
|
||||
size: "14px"
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ import "../datePicker/index2.js";
|
||||
import "../_chunks/dayjs/index.js";
|
||||
import "../_chunks/@umijs/index.js";
|
||||
import "../input/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
import "../dropdown/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
|
||||
@@ -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, [
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import "vue";
|
||||
const component = withInstall(_sfc_main$2E);
|
||||
const component = withInstall(_sfc_main$2W);
|
||||
export { component as default };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, computed, ref, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, createVNode, createCommentVNode, Fragment, renderList, normalizeClass, unref, toDisplayString, withModifiers } from "vue";
|
||||
import { i as iconfont } from "../checkbox/index2.js";
|
||||
import { i as iconfont } from "../_chunks/@layui/index.js";
|
||||
import { _ as _sfc_main$1 } from "../dropdown/index2.js";
|
||||
import { _ as _sfc_main$2 } from "../input/index2.js";
|
||||
import { _ as _sfc_main$3 } from "../scroll/index2.js";
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
46
package/component/es/index2.js
Normal file
46
package/component/es/index2.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { defineComponent, ref, provide, watch, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
||||
const __default__ = {
|
||||
name: "LayCheckboxGroup"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
modelValue: { default: () => [] },
|
||||
disabled: { type: Boolean, default: false }
|
||||
},
|
||||
emits: ["update:modelValue", "change"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const modelValue = ref(props.modelValue);
|
||||
const disabled = ref(props.disabled);
|
||||
provide("checkboxGroup", {
|
||||
name: "LayCheckboxGroup",
|
||||
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
|
||||
);
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-checkbox-group", { "layui-checkbox-group-disabled": disabled.value }])
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
export { _sfc_main as _ };
|
||||
@@ -1,5 +1,5 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { openBlock, createElementBlock, createElementVNode, defineComponent, useSlots, ref, computed, watch, normalizeClass, unref, renderSlot, createCommentVNode, createBlock, createVNode, withModifiers } from "vue";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { openBlock, createElementBlock, createElementVNode, defineComponent, useSlots, ref, computed, watch, normalizeClass, unref, renderSlot, createCommentVNode, createBlock, normalizeStyle, createVNode, withModifiers } from "vue";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
import { _ as _export_sfc } from "../dropdownMenu/index2.js";
|
||||
var index = /* @__PURE__ */ (() => ":root{--input-border-radius: var(--global-border-radius);--input-border-color: var(--global-neutral-color-3)}.layui-input{width:100%;height:38px;line-height:38px;border-width:1px;border-style:solid;border-color:var(--input-border-color);border-radius:var(--input-border-radius);display:inline-flex}.layui-input input{height:38px;line-height:38px;background-color:#fff;color:#000000d9;padding-left:10px;display:inline-block;border:none;height:100%;width:100%}.layui-input-append{background-color:#fafafa;border-left:1px solid var(--input-border-color);display:flex;padding:0 15px;flex:none;align-items:center}.layui-input-prepend{background-color:#fafafa;border-right:1px solid var(--input-border-color);display:flex;padding:0 15px;flex:none;align-items:center}.layui-input-wrapper{width:100%;display:inline-flex;border:none}.layui-input:hover,.layui-input:focus-within{border-color:#d2d2d2}.layui-input-clear,.layui-input-prefix,.layui-input-suffix,.layui-input-password{background-color:#fff}.layui-input-clear,.layui-input-password,.layui-input-prefix,.layui-input-suffix{display:flex;flex:none;align-items:center;padding:0 10px}.layui-input-has-prefix input{padding:0}.layui-input-clear,.layui-input-password{color:#00000073}.layui-input-clear:hover{opacity:.6}.layui-input input::-webkit-input-placeholder{line-height:1.3}.layui-input input::-ms-reveal{display:none}.layui-input-disabled{border-color:var(--input-border-color)!important}.layui-input-disabled{opacity:.6}.layui-input-disabled,.layui-input-disabled *{cursor:not-allowed!important}.layui-input[size=lg]{height:44px}.layui-input[size=lg] .layui-input{height:44px;line-height:44px}.layui-input[size=md]{height:38px}.layui-input[size=md] .layui-input{height:38px;line-height:38px}.layui-input[size=sm]{height:32px}.layui-input[size=sm] .layui-input{height:32px;line-height:32px}.layui-input[size=xs]{height:26px}.layui-input[size=xs] .layui-input{height:26px;line-height:26px}\n")();
|
||||
const _sfc_main$2 = {};
|
||||
@@ -88,14 +88,17 @@ const _sfc_main = defineComponent({
|
||||
maxlength: null,
|
||||
max: null,
|
||||
min: null,
|
||||
qfw: { type: Boolean, default: false }
|
||||
qfw: { type: Boolean, default: false },
|
||||
align: { default: "left" }
|
||||
},
|
||||
emits: ["blur", "input", "update:modelValue", "change", "focus", "clear"],
|
||||
setup(__props, { emit }) {
|
||||
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 +131,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;
|
||||
@@ -227,13 +238,16 @@ const _sfc_main = defineComponent({
|
||||
])) : createCommentVNode("", true),
|
||||
createElementVNode("div", _hoisted_3, [
|
||||
unref(slots).prefix || props.prefixIcon ? (openBlock(), createElementBlock("span", _hoisted_4, [
|
||||
unref(slots).prefix ? renderSlot(_ctx.$slots, "prefix", { key: 0 }) : (openBlock(), createBlock(unref(_sfc_main$2E), {
|
||||
unref(slots).prefix ? renderSlot(_ctx.$slots, "prefix", { key: 0 }) : (openBlock(), createBlock(unref(_sfc_main$2W), {
|
||||
key: 1,
|
||||
type: props.prefixIcon,
|
||||
class: "layui-input-prefix-icon"
|
||||
}, null, 8, ["type"]))
|
||||
])) : createCommentVNode("", true),
|
||||
createElementVNode("input", {
|
||||
style: normalizeStyle({
|
||||
textAlign: __props.align
|
||||
}),
|
||||
type: type.value,
|
||||
name: __props.name,
|
||||
disabled: __props.disabled,
|
||||
@@ -253,7 +267,7 @@ const _sfc_main = defineComponent({
|
||||
onCompositionend,
|
||||
ref_key: "input",
|
||||
ref: input
|
||||
}, null, 40, _hoisted_5),
|
||||
}, null, 44, _hoisted_5),
|
||||
__props.password && unref(hasContent) ? (openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
class: "layui-input-password",
|
||||
@@ -262,13 +276,13 @@ const _sfc_main = defineComponent({
|
||||
unref(isPassword) ? (openBlock(), createBlock(PasswordIcon, { key: 0 })) : (openBlock(), createBlock(UnPasswordIcon, { key: 1 }))
|
||||
])) : createCommentVNode("", true),
|
||||
__props.allowClear && unref(hasContent) && !__props.disabled ? (openBlock(), createElementBlock("span", _hoisted_6, [
|
||||
createVNode(unref(_sfc_main$2E), {
|
||||
createVNode(unref(_sfc_main$2W), {
|
||||
type: "layui-icon-close-fill",
|
||||
onClick: withModifiers(onClear, ["stop"])
|
||||
}, null, 8, ["onClick"])
|
||||
])) : createCommentVNode("", true),
|
||||
unref(slots).suffix || props.suffixIcon ? (openBlock(), createElementBlock("span", _hoisted_7, [
|
||||
unref(slots).suffix ? renderSlot(_ctx.$slots, "suffix", { key: 0 }) : (openBlock(), createBlock(unref(_sfc_main$2E), {
|
||||
unref(slots).suffix ? renderSlot(_ctx.$slots, "suffix", { key: 0 }) : (openBlock(), createBlock(unref(_sfc_main$2W), {
|
||||
key: 1,
|
||||
type: props.suffixIcon,
|
||||
class: "layui-input-suffix-icon"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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);
|
||||
|
||||
@@ -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 }]),
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@ import "../datePicker/index2.js";
|
||||
import "../_chunks/dayjs/index.js";
|
||||
import "../_chunks/@umijs/index.js";
|
||||
import "../input/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
import "../dropdown/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,3 +2,4 @@ import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, inject, ref, computed, withDirectives, openBlock, createElementBlock, normalizeClass, unref, createBlock, isRef, createCommentVNode, renderSlot, createTextVNode, toDisplayString, vShow } from "vue";
|
||||
import { a as _sfc_main$1 } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$1 } from "../checkbox/index2.js";
|
||||
const __default__ = {
|
||||
name: "LaySelectOption"
|
||||
};
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createElementBlock, mergeProps, renderSlot, Fragment, renderList, createBlock, normalizeClass } from "vue";
|
||||
import { _ as _sfc_main$1 } from "../skeletonItem/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
var index = /* @__PURE__ */ (() => ".lay-skeleton .lay-skeleton-item,.lay-skeleton .lay-skeleton-type--p{height:16px;border-radius:5px;margin-bottom:16px;background:#eeeeee}.lay-skeleton .lay-skeleton-type--image{width:240px;height:240px;background:#eeeeee;display:flex;justify-content:center;align-items:center}.lay-skeleton .lay-skeleton-type--image i{font-size:40px}.lay-skeleton-animated .lay-skeleton-type--image{width:240px;height:240px!important;display:flex;justify-content:center;align-items:center}.lay-skeleton-animated .lay-skeleton-type--image i{font-size:40px}.lay-skeleton-animated .lay-skeleton-item{height:16px;border-radius:5px;margin-bottom:16px;background:#eeeeee;background:linear-gradient(90deg,#f2f2f2 25%,#ececec 37%,#f2f2f2 63%);background-size:400% 100%;animation:lay-skeleton-loading 1.2s ease infinite}.lay-skeleton-first{width:30%}.lay-skeleton-last{width:62.8%}@keyframes lay-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}\n")();
|
||||
const __default__ = {
|
||||
name: "LaySkeleton"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createElementBlock, mergeProps, createVNode, unref, createCommentVNode } from "vue";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
const _hoisted_1 = { key: 0 };
|
||||
const __default__ = {
|
||||
name: "LaySkeletonItem"
|
||||
@@ -16,7 +16,7 @@ const _sfc_main = defineComponent({
|
||||
class: ["lay-skeleton-item", `lay-skeleton-type--${__props.type}`]
|
||||
}, _ctx.$attrs), [
|
||||
__props.type === "image" ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
createVNode(unref(_sfc_main$2E), { type: "layui-icon-picture" })
|
||||
createVNode(unref(_sfc_main$2W), { type: "layui-icon-picture" })
|
||||
])) : createCommentVNode("", true)
|
||||
], 16);
|
||||
};
|
||||
|
||||
@@ -32,8 +32,7 @@ function makeDots(props) {
|
||||
return dots;
|
||||
}
|
||||
const _hoisted_1$4 = ["onMousedown"];
|
||||
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("div", { class: "layui-slider-line-v" }, null, -1);
|
||||
const _hoisted_3$4 = ["onClick"];
|
||||
const _hoisted_2$4 = ["onClick"];
|
||||
const __default__$4 = {
|
||||
name: "StandardVue"
|
||||
};
|
||||
@@ -45,7 +44,8 @@ const _sfc_main$4 = defineComponent({
|
||||
step: { default: 0 },
|
||||
min: { default: 0 },
|
||||
max: { default: 100 },
|
||||
showDots: { type: Boolean, default: false }
|
||||
showDots: { type: Boolean, default: false },
|
||||
backgroundColor: { default: "#ccc" }
|
||||
},
|
||||
emits: ["link-val-hook"],
|
||||
setup(__props, { emit }) {
|
||||
@@ -129,14 +129,19 @@ const _sfc_main$4 = defineComponent({
|
||||
style: normalizeStyle({ width: __props.val + "%" }),
|
||||
class: normalizeClass(["layui-slider-rate-v", [__props.disabled ? "layui-slider-disabled disable-line" : ""]])
|
||||
}, null, 6),
|
||||
_hoisted_2$4,
|
||||
createElementVNode("div", {
|
||||
class: "layui-slider-line-v",
|
||||
style: normalizeStyle({
|
||||
backgroundColor: props.backgroundColor
|
||||
})
|
||||
}, null, 4),
|
||||
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(dots), (item, index2) => {
|
||||
return withDirectives((openBlock(), createElementBlock("div", {
|
||||
onClick: ($event) => focusDot(item),
|
||||
class: "layui-slider-dots",
|
||||
key: index2,
|
||||
style: normalizeStyle({ left: item + "%" })
|
||||
}, null, 12, _hoisted_3$4)), [
|
||||
}, null, 12, _hoisted_2$4)), [
|
||||
[vShow, __props.showDots]
|
||||
]);
|
||||
}), 128))
|
||||
@@ -628,7 +633,8 @@ const _sfc_main = defineComponent({
|
||||
disabled: { type: Boolean, default: false },
|
||||
range: { type: Boolean },
|
||||
rangeValue: null,
|
||||
showDots: { type: Boolean, default: false }
|
||||
showDots: { type: Boolean, default: false },
|
||||
backgroundColor: { default: "#ccc" }
|
||||
},
|
||||
emits: ["update:modelValue"],
|
||||
setup(__props, { emit }) {
|
||||
@@ -680,8 +686,9 @@ const _sfc_main = defineComponent({
|
||||
step: __props.step,
|
||||
min: __props.min,
|
||||
max: __props.max,
|
||||
showDots: __props.showDots
|
||||
}, null, 8, ["val", "disabled", "step", "min", "max", "showDots"])
|
||||
showDots: __props.showDots,
|
||||
backgroundColor: props.backgroundColor
|
||||
}, null, 8, ["val", "disabled", "step", "min", "max", "showDots", "backgroundColor"])
|
||||
]))
|
||||
]))
|
||||
]);
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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, [
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, inject, getCurrentInstance, computed, reactive, onMounted, onBeforeUnmount, unref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createBlock, Fragment, toDisplayString, createTextVNode } from "vue";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
const _hoisted_1 = { key: 0 };
|
||||
const _hoisted_2 = { class: "lay-step-item-content-title" };
|
||||
const __default__ = {
|
||||
@@ -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", {
|
||||
@@ -110,11 +112,11 @@ const _sfc_main = defineComponent({
|
||||
onClick: _cache[0] || (_cache[0] = ($event) => onChange(index.value + 1))
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "pace", {}, () => [
|
||||
__props.icon ? (openBlock(), createBlock(unref(_sfc_main$2E), {
|
||||
__props.icon ? (openBlock(), createBlock(unref(_sfc_main$2W), {
|
||||
key: 0,
|
||||
type: __props.icon
|
||||
}, null, 8, ["type"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
||||
!unref(isActive) ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(index.value + 1), 1)) : (openBlock(), createBlock(unref(_sfc_main$2E), {
|
||||
!unref(isActive) ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(index.value + 1), 1)) : (openBlock(), createBlock(unref(_sfc_main$2W), {
|
||||
key: 1,
|
||||
type: __props.status === "fail" ? "layui-icon-close" : "layui-icon-ok"
|
||||
}, null, 8, ["type"]))
|
||||
|
||||
@@ -2,7 +2,7 @@ import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, inject, computed, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, renderSlot, createElementBlock, createCommentVNode, createVNode, useSlots, ref, watchEffect, normalizeStyle, createSlots } from "vue";
|
||||
import { _ as _sfc_main$3 } from "../transition/index2.js";
|
||||
import { _ as _sfc_main$2 } from "../dropdown/index2.js";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
import { u as useLevel, p as provideLevel } from "../useLevel/index.js";
|
||||
import { i as indentHandle } from "../utils/index.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
@@ -76,7 +76,7 @@ const _sfc_main$1 = defineComponent({
|
||||
]),
|
||||
_ctx.$slots.expandIcon ? (openBlock(), createElementBlock("span", _hoisted_5$1, [
|
||||
renderSlot(_ctx.$slots, "expandIcon", {}, () => [
|
||||
createVNode(unref(_sfc_main$2E), { type: unref(computedExpandIcon) }, null, 8, ["type"])
|
||||
createVNode(unref(_sfc_main$2W), { type: unref(computedExpandIcon) }, null, 8, ["type"])
|
||||
])
|
||||
])) : createCommentVNode("", true)
|
||||
])
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { b as isArrayChildren, w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, reactive, ref, computed, provide, shallowRef, watch, nextTick, onMounted, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, unref, createCommentVNode, Fragment, renderList, withModifiers, createBlock, createVNode, renderSlot, h, createTextVNode } from "vue";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
import { T as TabInjectKey, _ as _sfc_main$1 } from "../tabItem/index2.js";
|
||||
import { R as RenderFunction } from "../dropdown/index2.js";
|
||||
import { a as useResizeObserver } from "../_chunks/@vueuse/index.js";
|
||||
@@ -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;
|
||||
@@ -244,7 +247,7 @@ const _sfc_main = defineComponent({
|
||||
if (typeof tab.icon === "function") {
|
||||
return tab.icon();
|
||||
} else if (typeof tab.icon === "string") {
|
||||
return h(_sfc_main$2E, {
|
||||
return h(_sfc_main$2W, {
|
||||
type: tab.icon,
|
||||
style: "margin-right: 8px;"
|
||||
});
|
||||
@@ -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();
|
||||
@@ -342,7 +352,7 @@ const _sfc_main = defineComponent({
|
||||
class: "layui-unselect layui-tab-bar prev",
|
||||
onClick: scrollPrev
|
||||
}, [
|
||||
createVNode(unref(_sfc_main$2E), { type: "layui-icon-left" })
|
||||
createVNode(unref(_sfc_main$2W), { type: "layui-icon-left" })
|
||||
], 512)) : createCommentVNode("", true),
|
||||
scrollable.value ? (openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
@@ -351,7 +361,7 @@ const _sfc_main = defineComponent({
|
||||
class: "layui-unselect layui-tab-bar",
|
||||
onClick: scrollNext
|
||||
}, [
|
||||
createVNode(unref(_sfc_main$2E), { type: "layui-icon-right" })
|
||||
createVNode(unref(_sfc_main$2W), { type: "layui-icon-right" })
|
||||
], 512)) : createCommentVNode("", true)
|
||||
], 2),
|
||||
createElementVNode("div", _hoisted_3, [
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
import "../_chunks/@ctrl/index.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, renderSlot, createCommentVNode, createElementVNode, withModifiers, createVNode } from "vue";
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
import { T as TinyColor } from "../_chunks/@ctrl/index.js";
|
||||
var index = /* @__PURE__ */ (() => ".layui-tag{--layui-tag-bg-color: #fafafa;--layui-tag-border-color: #f0f0f0;--layui-tag-hover-color: #FFF;--layui-tag-text-color: currentColor;display:inline-flex;align-items:baseline;vertical-align:middle;box-sizing:border-box;height:26px;line-height:26px;padding:0 8px;font-size:14px;font-weight:500;color:var(--layui-tag-text-color);background-color:var(--layui-tag-bg-color);border-width:1px;border-style:solid;border-color:transparent;border-radius:var(--global-border-radius)}.layui-tag-icon{margin-right:4px}.layui-tag-bordered{border-color:var(--layui-tag-border-color)}.layui-tag-disabled{opacity:.4;cursor:not-allowed}.layui-tag-disabled .layui-tag-close-icon .layui-icon:hover{cursor:not-allowed!important;opacity:1}.layui-tag-shap-square{border-radius:var(--global-border-radius)}.layui-tag-shap-round{border-radius:12px}.layui-tag .layui-tag-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.layui-tag .layui-tag-close-icon{margin-left:4px;font-size:14px}.layui-tag .layui-tag-close-icon .layui-icon:hover{cursor:pointer;opacity:.5}.layui-tag-size-lg{height:30px;font-size:14px;line-height:30px}.layui-tag .layui-icon{font-size:14px}.layui-tag-size-md{height:26px;font-size:14px;line-height:26px}.layui-tag .layui-icon{font-size:14px}.layui-tag-size-sm{height:22px;font-size:12px;line-height:22px}.layui-tag-size-xs{height:18px;font-size:12px;line-height:18px}.layui-tag .layui-icon{font-size:12px}.layui-tag-primary{--layui-tag-bg-color: #009688;--layui-tag-border-color: transparent;--layui-tag-hover-color: #009688;--layui-tag-text-color: #FFF}.layui-tag-primary-bordered{--layui-tag-border-color: #009688}.layui-tag-primary.layui-tag-variant-light{--layui-tag-bg-color: #e6f5f3;--layui-tag-border-color: transparent;--layui-tag-hover-color: #e6f5f3;--layui-tag-text-color: #009688}.layui-tag-primary.layui-tag-variant-light-bordered{--layui-tag-border-color: #80cbc4}.layui-tag-primary.layui-tag-variant-plain{--layui-tag-bg-color: transparent;--layui-tag-hover-color: transparent;--layui-tag-text-color: #009688;--layui-tag-border-color: transparent}.layui-tag-primary.layui-tag-variant-plain-bordered{--layui-tag-border-color: #009688}.layui-tag-normal{--layui-tag-bg-color: #1e9fff;--layui-tag-border-color: transparent;--layui-tag-hover-color: #1e9fff;--layui-tag-text-color: #FFF}.layui-tag-normal-bordered{--layui-tag-border-color: #1e9fff}.layui-tag-normal.layui-tag-variant-light{--layui-tag-bg-color: #e9f5ff;--layui-tag-border-color: transparent;--layui-tag-hover-color: #e9f5ff;--layui-tag-text-color: #1e9fff}.layui-tag-normal.layui-tag-variant-light-bordered{--layui-tag-border-color: #8fcfff}.layui-tag-normal.layui-tag-variant-plain{--layui-tag-bg-color: transparent;--layui-tag-hover-color: transparent;--layui-tag-text-color: #1e9fff;--layui-tag-border-color: transparent}.layui-tag-normal.layui-tag-variant-plain-bordered{--layui-tag-border-color: #1e9fff}.layui-tag-warm{--layui-tag-bg-color: #ffb800;--layui-tag-border-color: transparent;--layui-tag-hover-color: #ffb800;--layui-tag-text-color: #FFF}.layui-tag-warm-bordered{--layui-tag-border-color: #ffb800}.layui-tag-warm.layui-tag-variant-light{--layui-tag-bg-color: #fff8e6;--layui-tag-border-color: transparent;--layui-tag-hover-color: #fff8e6;--layui-tag-text-color: #ffb800}.layui-tag-warm.layui-tag-variant-light-bordered{--layui-tag-border-color: #ffdc80}.layui-tag-warm.layui-tag-variant-plain{--layui-tag-bg-color: transparent;--layui-tag-hover-color: transparent;--layui-tag-text-color: #ffb800;--layui-tag-border-color: transparent}.layui-tag-warm.layui-tag-variant-plain-bordered{--layui-tag-border-color: #ffb800}.layui-tag-danger{--layui-tag-bg-color: #ff5722;--layui-tag-border-color: transparent;--layui-tag-hover-color: #ff5722;--layui-tag-text-color: #FFF}.layui-tag-danger-bordered{--layui-tag-border-color: #ff5722}.layui-tag-danger.layui-tag-variant-light{--layui-tag-bg-color: #ffeee9;--layui-tag-border-color: transparent;--layui-tag-hover-color: #ffeee9;--layui-tag-text-color: #ff5722}.layui-tag-danger.layui-tag-variant-light-bordered{--layui-tag-border-color: #ffab91}.layui-tag-danger.layui-tag-variant-plain{--layui-tag-bg-color: transparent;--layui-tag-hover-color: transparent;--layui-tag-text-color: #ff5722;--layui-tag-border-color: transparent}.layui-tag-danger.layui-tag-variant-plain-bordered{--layui-tag-border-color: #ff5722}\n")();
|
||||
const _hoisted_1 = {
|
||||
@@ -108,7 +108,7 @@ const _sfc_main = defineComponent({
|
||||
onClick: withModifiers(handleClose, ["stop"])
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "close-icon", {}, () => [
|
||||
createVNode(unref(_sfc_main$2E), { type: "layui-icon-close" })
|
||||
createVNode(unref(_sfc_main$2W), { type: "layui-icon-close" })
|
||||
])
|
||||
], 8, _hoisted_3)) : createCommentVNode("", true)
|
||||
], 6)) : createCommentVNode("", true);
|
||||
|
||||
@@ -2,7 +2,7 @@ import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../tag/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../_chunks/@layui/index.js";
|
||||
import "../_chunks/@ctrl/index.js";
|
||||
import "../tooltip/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
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$2E } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/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")();
|
||||
const _hoisted_1 = { class: "layui-textarea-wrapper" };
|
||||
@@ -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", {
|
||||
@@ -108,7 +112,7 @@ const _sfc_main = defineComponent({
|
||||
onBlur
|
||||
}, null, 42, _hoisted_2),
|
||||
__props.allowClear && unref(hasContent) ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
||||
createVNode(unref(_sfc_main$2E), {
|
||||
createVNode(unref(_sfc_main$2W), {
|
||||
type: "layui-icon-close-fill",
|
||||
onClick: onClear
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, ref, toRef, shallowRef, computed, watch, onMounted, openBlock, createBlock, Teleport, withDirectives, createVNode, Transition, withCtx, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createTextVNode, toDisplayString, vShow, createCommentVNode, nextTick, getCurrentInstance, createElementBlock, Fragment, normalizeProps, mergeProps, unref } from "vue";
|
||||
import { defineComponent, useSlots, ref, toRef, shallowRef, computed, watch, onMounted, openBlock, createBlock, Teleport, withDirectives, createVNode, Transition, withCtx, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createTextVNode, toDisplayString, vShow, createCommentVNode, nextTick, getCurrentInstance, createElementBlock, Fragment, mergeProps, unref } from "vue";
|
||||
import { o as onClickOutside, a as useResizeObserver, c as useEventListener, b as useThrottleFn } from "../_chunks/@vueuse/index.js";
|
||||
var index$1 = /* @__PURE__ */ (() => ".lay-tooltip-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}\n")();
|
||||
var index = /* @__PURE__ */ (() => '.layui-popper{position:fixed;padding:10px;border-radius:3px;word-wrap:break-word;min-width:12px;min-height:12px;font-size:14px;box-sizing:border-box;box-shadow:0 2px 12px #00000026;background-color:#fff;color:#3a3a3a;border:1px solid #cecece;max-width:300px;z-index:99999}.layui-popper[position=top]{margin-bottom:6px}.layui-popper[position=top] .layui-popper-arrow{bottom:-6px;border-bottom-width:0;border-top-color:#cecece}.layui-popper[position=top] .layui-popper-arrow:after{bottom:1px;border-bottom-width:0;margin-left:-6px;border-top-color:#fff}.layui-popper[position=bottom]{margin-top:6px}.layui-popper[position=bottom] .layui-popper-arrow{top:-6px;border-top-width:0;border-bottom-color:#cecece}.layui-popper[position=bottom] .layui-popper-arrow:after{top:1px;border-top-width:0;margin-left:-6px;border-bottom-color:#fff}.layui-popper[position=right]{margin-left:6px}.layui-popper[position=right] .layui-popper-arrow{left:-6px;border-left-width:0;border-right-color:#cecece}.layui-popper[position=right] .layui-popper-arrow:after{left:1px;border-left-width:0;margin-top:-6px;border-right-color:#fff}.layui-popper[position=left]{margin-right:6px}.layui-popper[position=left] .layui-popper-arrow{right:-6px;border-right-width:0;border-left-color:#cecece}.layui-popper[position=left] .layui-popper-arrow:after{right:1px;border-right-width:0;margin-top:-6px;border-left-color:#fff}.layui-popper[position=top] .layui-popper-arrow,.layui-popper[position=bottom] .layui-popper-arrow{left:-moz-calc(44%);left:-webkit-calc(44%);left:calc(50% - 6px)}.layui-popper[position=left] .layui-popper-arrow,.layui-popper[position=right] .layui-popper-arrow{top:-moz-calc(44%);top:-webkit-calc(44%);top:calc(50% - 6px)}.layui-popper:after{content:" ";position:absolute;display:block}.layui-popper[position=top]:after{bottom:-7px;left:0;width:100%;height:7px}.layui-popper[position=bottom]:after{top:-7px;left:0;width:100%;height:7px}.layui-popper[position=left]:after{right:-7px;bottom:0;height:100%;width:7px}.layui-popper[position=right]:after{left:-7px;bottom:0;height:100%;width:7px}.layui-popper .layui-popper-arrow,.layui-popper .layui-popper-arrow:after{position:absolute;display:block;width:0;height:0;border-width:6px;border-style:solid;border-color:transparent}.layui-popper .layui-popper-arrow:after{content:" "}.layui-popper.layui-dark{background-color:#353535;color:#fff;border:1px solid #353535}.layui-popper.layui-dark[position=top]{margin-bottom:6px}.layui-popper.layui-dark[position=top] .layui-popper-arrow{bottom:-6px;border-bottom-width:0;border-top-color:#353535}.layui-popper.layui-dark[position=top] .layui-popper-arrow:after{bottom:1px;border-bottom-width:0;margin-left:-6px;border-top-color:#353535}.layui-popper.layui-dark[position=bottom]{margin-top:6px}.layui-popper.layui-dark[position=bottom] .layui-popper-arrow{top:-6px;border-top-width:0;border-bottom-color:#353535}.layui-popper.layui-dark[position=bottom] .layui-popper-arrow:after{top:1px;border-top-width:0;margin-left:-6px;border-bottom-color:#353535}.layui-popper.layui-dark[position=right]{margin-left:6px}.layui-popper.layui-dark[position=right] .layui-popper-arrow{left:-6px;border-left-width:0;border-right-color:#353535}.layui-popper.layui-dark[position=right] .layui-popper-arrow:after{left:1px;border-left-width:0;margin-top:-6px;border-right-color:#353535}.layui-popper.layui-dark[position=left]{margin-right:6px}.layui-popper.layui-dark[position=left] .layui-popper-arrow{right:-6px;border-right-width:0;border-left-color:#353535}.layui-popper.layui-dark[position=left] .layui-popper-arrow:after{right:1px;border-right-width:0;margin-top:-6px;border-left-color:#353535}\n')();
|
||||
@@ -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;
|
||||
};
|
||||
@@ -360,12 +376,15 @@ const _sfc_main = defineComponent({
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
])
|
||||
], 512)) : renderSlot(_ctx.$slots, "default", { key: 1 }),
|
||||
isMounted.value ? (openBlock(), createBlock(_sfc_main$1, normalizeProps(mergeProps({ key: 2 }, unref(innerProps))), {
|
||||
isMounted.value ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
|
||||
key: 2,
|
||||
positio: __props.position
|
||||
}, unref(innerProps)), {
|
||||
default: withCtx(() => [
|
||||
renderSlot(_ctx.$slots, "content")
|
||||
]),
|
||||
_: 3
|
||||
}, 16)) : createCommentVNode("", true)
|
||||
}, 16, ["positio"])) : createCommentVNode("", true)
|
||||
], 64);
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, computed, resolveComponent, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, createVNode, unref, withModifiers, createBlock, createCommentVNode, renderSlot, createTextVNode, toDisplayString, withCtx, createSlots, ref, watch, onMounted, nextTick } from "vue";
|
||||
import { _ as _sfc_main$2E, a as _sfc_main$2 } from "../checkbox/index2.js";
|
||||
import { defineComponent, useSlots, computed, resolveComponent, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, createVNode, unref, withModifiers, createBlock, createCommentVNode, renderSlot, createTextVNode, toDisplayString, withCtx, createSlots, ref, watch, nextTick, onMounted } from "vue";
|
||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||
import { _ as _sfc_main$2 } from "../checkbox/index2.js";
|
||||
import { _ as _sfc_main$3 } from "../transition/index2.js";
|
||||
const _hoisted_1 = ["onClick"];
|
||||
const _hoisted_2 = { class: "layui-tree-main" };
|
||||
@@ -23,7 +24,9 @@ const _sfc_main$1 = defineComponent({
|
||||
selectedKey: null,
|
||||
checkStrictly: { type: [Boolean, String] },
|
||||
collapseTransition: { type: Boolean },
|
||||
onlyIconControl: { type: Boolean }
|
||||
onlyIconControl: { type: Boolean },
|
||||
hideicon: { type: Boolean },
|
||||
selectParent: { type: Boolean }
|
||||
},
|
||||
emits: ["node-click"],
|
||||
setup(__props, { emit }) {
|
||||
@@ -42,13 +45,20 @@ const _sfc_main$1 = defineComponent({
|
||||
if (node.children.length !== 0) {
|
||||
return !node.isLeaf ? "layui-icon-addition" : "layui-icon-subtraction";
|
||||
}
|
||||
if (props.hideicon) {
|
||||
return "";
|
||||
}
|
||||
return "layui-icon-file";
|
||||
};
|
||||
function recursiveNodeClick(node) {
|
||||
emit("node-click", node);
|
||||
}
|
||||
function handleChange(checked, node) {
|
||||
props.tree.setCheckedKeys(checked, props.checkStrictly, node);
|
||||
props.tree.setCheckedKeys(
|
||||
checked,
|
||||
props.checkStrictly || props.selectParent,
|
||||
node
|
||||
);
|
||||
}
|
||||
function handleIconClick(node) {
|
||||
node.isLeaf = !node.isLeaf;
|
||||
@@ -60,6 +70,9 @@ const _sfc_main$1 = defineComponent({
|
||||
if (!node.isDisabled) {
|
||||
emit("node-click", node);
|
||||
}
|
||||
if (props.showCheckbox) {
|
||||
node.isChecked = !node.isChecked;
|
||||
}
|
||||
}
|
||||
function handleRowClick(node) {
|
||||
if (!props.showLine) {
|
||||
@@ -68,17 +81,16 @@ const _sfc_main$1 = defineComponent({
|
||||
}
|
||||
const isChildAllSelected = computed(() => {
|
||||
function _isChildAllSelected(node) {
|
||||
if (!props.showCheckbox) {
|
||||
return false;
|
||||
}
|
||||
let childSelectNum = 0;
|
||||
let res = false;
|
||||
for (const item of node.children) {
|
||||
if (item.isChecked)
|
||||
childSelectNum++;
|
||||
}
|
||||
if (childSelectNum > 0)
|
||||
node.isChecked = true;
|
||||
if (!props.selectParent) {
|
||||
if (childSelectNum > 0)
|
||||
node.isChecked = true;
|
||||
}
|
||||
if (childSelectNum == node.children.length) {
|
||||
for (const item of node.children) {
|
||||
res = _isChildAllSelected(item);
|
||||
@@ -91,11 +103,14 @@ const _sfc_main$1 = defineComponent({
|
||||
return res;
|
||||
}
|
||||
return (node) => {
|
||||
console.log(props.selectParent);
|
||||
if (props.checkStrictly) {
|
||||
return false;
|
||||
} else {
|
||||
} else if (props.selectParent) {
|
||||
let res = _isChildAllSelected(node);
|
||||
return res;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -121,7 +136,7 @@ const _sfc_main$1 = defineComponent({
|
||||
{ "layui-tree-iconClick": true }
|
||||
])
|
||||
}, [
|
||||
createVNode(unref(_sfc_main$2E), {
|
||||
createVNode(unref(_sfc_main$2W), {
|
||||
type: nodeIconType(node),
|
||||
onClick: withModifiers(($event) => handleIconClick(node), ["stop"])
|
||||
}, null, 8, ["type", "onClick"])
|
||||
@@ -139,7 +154,7 @@ const _sfc_main$1 = defineComponent({
|
||||
class: normalizeClass({
|
||||
"layui-tree-txt": true,
|
||||
"layui-disabled": node.isDisabled,
|
||||
"layui-this": __props.selectedKey === node.id
|
||||
"layui-this": __props.selectedKey === node.id || node.isChecked
|
||||
}),
|
||||
onClick: withModifiers(($event) => handleTitleClick(node), ["stop"])
|
||||
}, [
|
||||
@@ -161,6 +176,8 @@ const _sfc_main$1 = defineComponent({
|
||||
"collapse-transition": __props.collapseTransition,
|
||||
checkStrictly: __props.checkStrictly,
|
||||
"only-icon-control": __props.onlyIconControl,
|
||||
hideicon: props.hideicon,
|
||||
"select-parent": props.selectParent,
|
||||
onNodeClick: recursiveNodeClick
|
||||
}, createSlots({ _: 2 }, [
|
||||
_ctx.$slots.title ? {
|
||||
@@ -172,7 +189,7 @@ const _sfc_main$1 = defineComponent({
|
||||
]),
|
||||
key: "0"
|
||||
} : void 0
|
||||
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control"])
|
||||
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control", "hideicon", "select-parent"])
|
||||
])) : createCommentVNode("", true)
|
||||
]),
|
||||
_: 2
|
||||
@@ -222,6 +239,7 @@ class Tree {
|
||||
checkStrictly,
|
||||
replaceFields: { children, id, title }
|
||||
} = this.config;
|
||||
console.log(origin, "origin");
|
||||
const nodeKey = Reflect.get(origin, id);
|
||||
const nodeTitle = Reflect.get(origin, title);
|
||||
const nodeChildren = Reflect.get(origin, children);
|
||||
@@ -259,6 +277,7 @@ class Tree {
|
||||
});
|
||||
}
|
||||
setChildrenChecked(checked, nodes) {
|
||||
console.log("\u8D70\u8D4B\u503C\u5B50\u8282\u70B9\u4E86");
|
||||
var ableCount = 0;
|
||||
var checkCount = 0;
|
||||
const len = nodes.length;
|
||||
@@ -279,6 +298,7 @@ class Tree {
|
||||
}
|
||||
}
|
||||
setParentChecked(checked, parent) {
|
||||
console.log("\u8D70\u8D4B\u503C\u7236\u8282\u70B9\u4E86");
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
@@ -294,6 +314,7 @@ class Tree {
|
||||
}
|
||||
setCheckedKeys(checked, checkStrictly, node) {
|
||||
node.isChecked = checked;
|
||||
console.log(node, checkStrictly, 186);
|
||||
if (!checkStrictly) {
|
||||
if (node.parentNode) {
|
||||
this.setParentChecked(checked, node.parentNode);
|
||||
@@ -330,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;
|
||||
@@ -377,7 +401,9 @@ const _sfc_main = defineComponent({
|
||||
children: "children",
|
||||
title: "title"
|
||||
};
|
||||
} }
|
||||
} },
|
||||
hideicon: { type: Boolean },
|
||||
selectParent: { type: Boolean, default: false }
|
||||
},
|
||||
emits: ["update:checkedKeys", "update:expandKeys", "node-click"],
|
||||
setup(__props, { emit }) {
|
||||
@@ -399,24 +425,39 @@ const _sfc_main = defineComponent({
|
||||
tree.value = _tree;
|
||||
nodeList.value = _nodeList.value;
|
||||
};
|
||||
watch(() => props.data, () => {
|
||||
loadNodeList();
|
||||
}, { deep: true, immediate: true });
|
||||
watch(() => props.checkedKeys, () => {
|
||||
if (!unWatch.value) {
|
||||
watch(
|
||||
() => props.data,
|
||||
() => {
|
||||
loadNodeList();
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
watch(
|
||||
() => props.checkedKeys,
|
||||
() => {
|
||||
console.log(tree.value);
|
||||
if (!unWatch.value) {
|
||||
loadNodeList();
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
});
|
||||
watch(tree, () => {
|
||||
if (initStatus.value) {
|
||||
const { checkedKeys } = tree.value.getKeys();
|
||||
unWatch.value = true;
|
||||
emit("update:checkedKeys", checkedKeys);
|
||||
setTimeout(() => {
|
||||
unWatch.value = false;
|
||||
}, 0);
|
||||
}
|
||||
}, { 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;
|
||||
@@ -439,7 +480,9 @@ const _sfc_main = defineComponent({
|
||||
"check-strictly": __props.checkStrictly,
|
||||
"collapse-transition": __props.collapseTransition,
|
||||
"only-icon-control": __props.onlyIconControl,
|
||||
onNodeClick: handleClick
|
||||
onNodeClick: handleClick,
|
||||
hideicon: props.hideicon,
|
||||
selectParent: props.selectParent
|
||||
}, createSlots({ _: 2 }, [
|
||||
_ctx.$slots.title ? {
|
||||
name: "title",
|
||||
@@ -448,7 +491,7 @@ const _sfc_main = defineComponent({
|
||||
]),
|
||||
key: "0"
|
||||
} : void 0
|
||||
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control"])
|
||||
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control", "hideicon", "selectParent"])
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2602
package/component/es/upload/index2.js
Normal file
2602
package/component/es/upload/index2.js
Normal file
File diff suppressed because one or more lines are too long
@@ -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
@@ -20,7 +20,8 @@
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./es/index.js"
|
||||
"import": "./es/index.js",
|
||||
"types": "./types/index.d.ts"
|
||||
},
|
||||
"./lib/": "./lib/",
|
||||
"./es/": "./es/"
|
||||
@@ -33,16 +34,19 @@
|
||||
"build:types": "rimraf types && tsc -d"
|
||||
},
|
||||
"dependencies": {
|
||||
"@layui/icons-vue": "^1.0.9",
|
||||
"@layui/layer-vue": "git+https://git.theluyuan.com/luyuan/layui-layer.git",
|
||||
"@vueuse/core": "^9.2.0",
|
||||
"@umijs/ssr-darkreader": "^4.9.45",
|
||||
"@ctrl/tinycolor": "^3.4.1",
|
||||
"@layui/icons-vue": "^1.0.9",
|
||||
"@layui/layer-vue": "file:../layer",
|
||||
"@layui/layui-vue": "file:",
|
||||
"@umijs/ssr-darkreader": "^4.9.45",
|
||||
"@vueuse/core": "^9.2.0",
|
||||
"async-validator": "^4.1.1",
|
||||
"cropperjs": "^1.5.12",
|
||||
"dayjs": "^1.11.0",
|
||||
"evtd": "^0.2.3",
|
||||
"vue-i18n": "^9.1.10"
|
||||
"js-image-compressor": "^2.0.0",
|
||||
"vue-i18n": "^9.1.10",
|
||||
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
@@ -55,4 +59,4 @@
|
||||
"last 2 versions and > 2%",
|
||||
"ie > 10"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ export default (): UserConfigExport => {
|
||||
},
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_console: false,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ["console.log"],
|
||||
pure_funcs: [],
|
||||
},
|
||||
output: {
|
||||
comments: true,
|
||||
|
||||
@@ -77,9 +77,9 @@ export default (): UserConfigExport => {
|
||||
},
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_console: false,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ["console.log"],
|
||||
pure_funcs: [],
|
||||
},
|
||||
output: {
|
||||
comments: true,
|
||||
|
||||
@@ -27,9 +27,9 @@ export default (): UserConfigExport => {
|
||||
},
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_console: false,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ["console.log"],
|
||||
pure_funcs: [],
|
||||
},
|
||||
output: {
|
||||
comments: true,
|
||||
|
||||
@@ -104,7 +104,10 @@ watch(
|
||||
|
||||
//关闭回调
|
||||
const footOnOk = () => {
|
||||
emits("update:modelValue", Month.value ? Month.value : -1);
|
||||
emits(
|
||||
"update:modelValue",
|
||||
Month.value || Month.value === 0 ? Month.value : -1
|
||||
);
|
||||
if (datePicker.range) {
|
||||
//关闭菜单
|
||||
emits("ok");
|
||||
|
||||
@@ -551,7 +551,7 @@ html #layuicss-laydate {
|
||||
box-sizing: border-box;
|
||||
input{
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
// padding: 0;
|
||||
}
|
||||
}
|
||||
.layui-input {
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface InputProps {
|
||||
max?: number;
|
||||
min?: number;
|
||||
qfw?: boolean;
|
||||
align?: string;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<InputProps>(), {
|
||||
@@ -41,6 +42,7 @@ const props = withDefaults(defineProps<InputProps>(), {
|
||||
modelValue: "",
|
||||
size: "md",
|
||||
qfw: false,
|
||||
align: "left",
|
||||
});
|
||||
|
||||
interface InputEmits {
|
||||
@@ -217,6 +219,9 @@ const showPassword = () => {
|
||||
></lay-icon>
|
||||
</span>
|
||||
<input
|
||||
:style="{
|
||||
textAlign: align,
|
||||
}"
|
||||
:type="type"
|
||||
:name="name"
|
||||
:disabled="disabled"
|
||||
|
||||
@@ -44,6 +44,7 @@ export interface SelectProps {
|
||||
showSearch?: boolean;
|
||||
contentClass?: string | Array<string | object> | object;
|
||||
contentStyle?: StyleValue;
|
||||
position?: string;
|
||||
}
|
||||
|
||||
export interface SelectEmits {
|
||||
@@ -61,6 +62,7 @@ const props = withDefaults(defineProps<SelectProps>(), {
|
||||
disabled: false,
|
||||
multiple: false,
|
||||
size: "md",
|
||||
position: "top",
|
||||
});
|
||||
|
||||
const slots = useSlots();
|
||||
@@ -215,6 +217,7 @@ provide("searchMethod", props.searchMethod);
|
||||
:disabledInput="!showSearch"
|
||||
:size="size"
|
||||
:class="{ 'layui-unselect': true }"
|
||||
:position="position"
|
||||
@remove="handleRemove"
|
||||
@clear="handleClear"
|
||||
@input-value-change="handleSearch"
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface StandardProps {
|
||||
min?: number;
|
||||
max?: number;
|
||||
showDots?: boolean;
|
||||
backgroundColor: string;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<StandardProps>(), {
|
||||
@@ -26,6 +27,7 @@ const props = withDefaults(defineProps<StandardProps>(), {
|
||||
min: 0,
|
||||
max: 100,
|
||||
showDots: false,
|
||||
backgroundColor: "#ccc",
|
||||
});
|
||||
|
||||
const moveAction = throttle(standardMove);
|
||||
@@ -117,7 +119,12 @@ const focusDot = (val: number) => {
|
||||
class="layui-slider-rate-v"
|
||||
:class="[disabled ? 'layui-slider-disabled disable-line' : '']"
|
||||
></div>
|
||||
<div class="layui-slider-line-v"></div>
|
||||
<div
|
||||
class="layui-slider-line-v"
|
||||
:style="{
|
||||
backgroundColor: props.backgroundColor,
|
||||
}"
|
||||
></div>
|
||||
<div
|
||||
v-show="showDots"
|
||||
@click="focusDot(item)"
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface SliderProps {
|
||||
range?: boolean;
|
||||
rangeValue?: number[];
|
||||
showDots?: boolean;
|
||||
backgroundColor: string;
|
||||
}
|
||||
|
||||
const emit = defineEmits(["update:modelValue"]);
|
||||
@@ -34,6 +35,7 @@ const props = withDefaults(defineProps<SliderProps>(), {
|
||||
min: 0,
|
||||
max: 100,
|
||||
showDots: false,
|
||||
backgroundColor: "#ccc",
|
||||
});
|
||||
|
||||
let rangeValues: Ref<number[]> | any = toRef(props, "rangeValue");
|
||||
@@ -94,6 +96,7 @@ function valHook(val: any) {
|
||||
:min="min"
|
||||
:max="max"
|
||||
:showDots="showDots"
|
||||
:backgroundColor="props.backgroundColor"
|
||||
></StandardVue>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -35,6 +35,7 @@ export interface TableRowProps {
|
||||
expandKeys: Recordable[];
|
||||
getCheckboxProps: Function;
|
||||
getRadioProps: Function;
|
||||
page?: Recordable;
|
||||
}
|
||||
|
||||
const slot = useSlots();
|
||||
@@ -47,7 +48,21 @@ const emit = defineEmits([
|
||||
"update:selectedKeys",
|
||||
"update:selectedKey",
|
||||
]);
|
||||
|
||||
function toThousands(num: number | string | undefined) {
|
||||
if (typeof num == "undefined") {
|
||||
return "";
|
||||
}
|
||||
if (typeof num == "string") {
|
||||
num = parseFloat(num || "0");
|
||||
}
|
||||
let xs = num.toString().split(".")[1];
|
||||
let zs = num.toString().split(".")[0];
|
||||
let jg =
|
||||
(zs || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") +
|
||||
(xs ? "." + xs : "");
|
||||
console.log(jg);
|
||||
return jg;
|
||||
}
|
||||
const props = withDefaults(defineProps<TableRowProps>(), {
|
||||
checkbox: false,
|
||||
childrenColumnName: "children",
|
||||
@@ -57,6 +72,8 @@ const props = withDefaults(defineProps<TableRowProps>(), {
|
||||
|
||||
const tableExpandAll = ref(props.defaultExpandAll);
|
||||
|
||||
const editIndex: any = ref({});
|
||||
|
||||
const tableExpandKeys: WritableComputedRef<Recordable[]> = computed({
|
||||
get() {
|
||||
return [...props.expandKeys];
|
||||
@@ -114,6 +131,8 @@ props.columns.map((value: any) => {
|
||||
});
|
||||
|
||||
const rowClick = function (data: any, evt: MouseEvent) {
|
||||
let click = new Event("click");
|
||||
window.dispatchEvent(click);
|
||||
emit("row", data, evt);
|
||||
};
|
||||
|
||||
@@ -230,7 +249,8 @@ const renderFixedClassName = (column: any, columnIndex: number) => {
|
||||
left = false;
|
||||
}
|
||||
}
|
||||
return left ? `layui-table-fixed-left-last` : "";
|
||||
// return left ? `layui-table-fixed-left-last` : "";
|
||||
return "";
|
||||
} else {
|
||||
var right = true;
|
||||
for (var i = 0; i < columnIndex; i++) {
|
||||
@@ -242,7 +262,8 @@ const renderFixedClassName = (column: any, columnIndex: number) => {
|
||||
right = false;
|
||||
}
|
||||
}
|
||||
return right ? `layui-table-fixed-right-first` : "";
|
||||
return "";
|
||||
// return right ? `layui-table-fixed-right-first` : "";
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -455,8 +476,12 @@ const radioProps = props.getRadioProps(props.data, props.index);
|
||||
:type="expandIconType"
|
||||
@click="handleExpand"
|
||||
></lay-icon>
|
||||
|
||||
{{ index + 1 }}
|
||||
<template v-if="page">
|
||||
{{ index + 1 + (page.current - 1) * page.limit }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ index + 1 }}
|
||||
</template>
|
||||
</td>
|
||||
</template>
|
||||
</template>
|
||||
@@ -564,6 +589,7 @@ const radioProps = props.getRadioProps(props.data, props.index);
|
||||
renderCellClassName(data, column, index, columnIndex),
|
||||
column.fixed ? `layui-table-fixed-${column.fixed}` : '',
|
||||
]"
|
||||
@click="editIndex[columnIndex] = true"
|
||||
>
|
||||
<div
|
||||
style="display: flex"
|
||||
@@ -601,10 +627,37 @@ const radioProps = props.getRadioProps(props.data, props.index);
|
||||
:content="data[column.key]"
|
||||
:isAutoShow="true"
|
||||
>
|
||||
{{ data[column.key] }}
|
||||
{{
|
||||
column.qfw
|
||||
? toThousands(data[column.key])
|
||||
: data[column.key]
|
||||
}}
|
||||
</lay-tooltip>
|
||||
|
||||
<span v-else> {{ data[column.key] }} </span>
|
||||
<template v-else>
|
||||
<template v-if="column.edit">
|
||||
<span v-if="!editIndex[columnIndex]">
|
||||
{{
|
||||
column.qfw
|
||||
? toThousands(data[column.key])
|
||||
: data[column.key]
|
||||
}}
|
||||
</span>
|
||||
<lay-input
|
||||
:autofocus="true"
|
||||
v-model="data[column.key]"
|
||||
v-else
|
||||
@keyup.enter="editIndex[columnIndex] = false"
|
||||
@blur="editIndex[columnIndex] = false"
|
||||
></lay-input>
|
||||
</template>
|
||||
<span v-else>
|
||||
{{
|
||||
column.qfw
|
||||
? toThousands(data[column.key])
|
||||
: data[column.key]
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
</template>
|
||||
@@ -674,3 +727,9 @@ const radioProps = props.getRadioProps(props.data, props.index);
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.layui-table-cell :deep(.layui-input input) {
|
||||
/*padding-left: 0;*/
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@import "../dropdown/index.less";
|
||||
@import "../page/index.less";
|
||||
@import "../empty/index.less";
|
||||
|
||||
@import "../../css/soultable.less";
|
||||
.layui-table-col-special {
|
||||
width: 34px;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ export default {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { utils, writeFile } from "xlsx";
|
||||
|
||||
import "./index.less";
|
||||
import {
|
||||
ref,
|
||||
@@ -24,6 +26,7 @@ import LayEmpty from "../empty/index.vue";
|
||||
import TableRow from "./TableRow.vue";
|
||||
import TablePage from "./TablePage.vue";
|
||||
import { nextTick } from "vue";
|
||||
import soultable from "./soultable.vue";
|
||||
|
||||
export interface TableProps {
|
||||
id?: string;
|
||||
@@ -51,6 +54,8 @@ export interface TableProps {
|
||||
loading?: boolean;
|
||||
getCheckboxProps?: Function;
|
||||
getRadioProps?: Function;
|
||||
download?: string;
|
||||
serverpage?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<TableProps>(), {
|
||||
@@ -75,6 +80,8 @@ const props = withDefaults(defineProps<TableProps>(), {
|
||||
loading: false,
|
||||
getCheckboxProps: () => {},
|
||||
getRadioProps: () => {},
|
||||
download: "",
|
||||
serverpage: false,
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
@@ -85,12 +92,16 @@ const emit = defineEmits([
|
||||
"row-contextmenu",
|
||||
"row-double",
|
||||
"row",
|
||||
"update:page",
|
||||
]);
|
||||
|
||||
const slot = useSlots();
|
||||
const slots = slot.default && slot.default();
|
||||
const tableRef = ref();
|
||||
|
||||
const datalist = ref([...props.dataSource]);
|
||||
console.log(datalist.value, 97);
|
||||
console.log("表格初始化", 97);
|
||||
const s = "";
|
||||
const allChecked = ref(false);
|
||||
const hasChecked = ref(false);
|
||||
@@ -232,7 +243,8 @@ const findFinalNode = (level: number, columns: any[]) => {
|
||||
|
||||
findFinalNode(0, tableColumns.value);
|
||||
|
||||
const tableSelectedKeys = ref<Recordable[]>([...props.selectedKeys]);
|
||||
// 你浅拷贝他干什么呀
|
||||
const tableSelectedKeys = ref<Recordable[]>(props.selectedKeys);
|
||||
const tableExpandKeys = ref<Recordable[]>([...props.expandKeys]);
|
||||
|
||||
watch(
|
||||
@@ -263,7 +275,17 @@ const tableSelectedKey: WritableComputedRef<string> = computed({
|
||||
watch(
|
||||
() => props.dataSource,
|
||||
() => {
|
||||
console.log("table数据更新");
|
||||
tableDataSource.value = [...props.dataSource];
|
||||
// if(!props.page){
|
||||
// datalist.value = [...props.dataSource]
|
||||
// }else{
|
||||
// change({
|
||||
// limit: props.page.limit,
|
||||
// current: pagecurrent || props.page.current
|
||||
// })
|
||||
// }
|
||||
|
||||
// 为什么修改数据就要把选中清空? 我要清空不会自己清吗?
|
||||
// tableSelectedKeys.value = [];
|
||||
// tableSelectedKey.value = s;
|
||||
@@ -273,7 +295,7 @@ watch(
|
||||
|
||||
const changeAll = (isChecked: boolean) => {
|
||||
if (isChecked) {
|
||||
const datasources = props.dataSource.filter((item: any, index: number) => {
|
||||
const datasources = datalist.value.filter((item: any, index: number) => {
|
||||
return !props.getCheckboxProps(item, index)?.disabled;
|
||||
});
|
||||
const ids = datasources.map((item) => {
|
||||
@@ -298,7 +320,14 @@ watch(
|
||||
} else {
|
||||
hasChecked.value = false;
|
||||
}
|
||||
emit("update:selectedKeys", tableSelectedKeys.value);
|
||||
if (tableSelectedKeys.value != props.selectedKeys) {
|
||||
console.log(
|
||||
"初始化赋值触发修改",
|
||||
tableSelectedKeys.value,
|
||||
props.selectedKeys
|
||||
);
|
||||
emit("update:selectedKeys", tableSelectedKeys.value);
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
@@ -310,9 +339,35 @@ watch(
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
watch(tableDataSource, () => {
|
||||
console.log("tableDataSource更新", tableDataSource.value);
|
||||
if (!props.page || props.serverpage) {
|
||||
datalist.value = tableDataSource.value;
|
||||
} else {
|
||||
// props.page.count = tableDataSource.value.length
|
||||
let tmp = { ...props.page };
|
||||
tmp.total = tableDataSource.value.length;
|
||||
emit("update:page", tmp);
|
||||
// tableDataSource.value = endlist
|
||||
sxlist.value = {};
|
||||
// pagecurrent ||
|
||||
change({
|
||||
limit: props.page.limit,
|
||||
current: props.page.current,
|
||||
});
|
||||
}
|
||||
});
|
||||
let pagecurrent: number;
|
||||
const change = function (page: any) {
|
||||
emit("change", page);
|
||||
if (props.serverpage) {
|
||||
emit("change", page);
|
||||
} else {
|
||||
pagecurrent = page.current;
|
||||
datalist.value = tableDataSource.value.slice(
|
||||
page.limit * (page.current - 1),
|
||||
page.limit * page.current
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const rowClick = function (data: any, evt: MouseEvent) {
|
||||
@@ -338,51 +393,113 @@ const print = () => {
|
||||
document.body.innerHTML = oldContent;
|
||||
};
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
* @param list 导出的信息
|
||||
* @param header 信息的键名
|
||||
* @param name 导出文件名称
|
||||
*/
|
||||
function exportElcel(list: any, header: any, name: string) {
|
||||
const ws = utils.json_to_sheet(list, {
|
||||
header,
|
||||
skipHeader: true,
|
||||
});
|
||||
console.log(ws);
|
||||
var tmpWB = {
|
||||
SheetNames: ["sheet"], //保存的表标题
|
||||
Sheets: {
|
||||
sheet: Object.assign(
|
||||
{},
|
||||
ws, //内容
|
||||
{}
|
||||
),
|
||||
},
|
||||
};
|
||||
writeFile(tmpWB, name + ".xlsx", {
|
||||
bookType: "xlsx",
|
||||
type: "binary",
|
||||
});
|
||||
}
|
||||
// 报表导出
|
||||
const exportData = () => {
|
||||
var tableStr = ``;
|
||||
let head: any = [];
|
||||
let list: any = [];
|
||||
let title: any = {};
|
||||
for (let tableHeadColumn of tableHeadColumns.value) {
|
||||
tableStr += "<tr>";
|
||||
// tableStr += "<tr>";
|
||||
for (let column of tableHeadColumn) {
|
||||
tableStr += `<td colspan=${column.colspan} rowspan=${column.rowspan}>${column.title}</td>`;
|
||||
// tableStr += `<td colspan=${column.colspan} rowspan=${column.rowspan}>${column.title}</td>`;
|
||||
title[column.key] = column.title;
|
||||
head.push(column.key);
|
||||
}
|
||||
tableStr += "</tr>";
|
||||
// tableStr += "</tr>";
|
||||
}
|
||||
list.push(title);
|
||||
console.log(tableDataSource.value, tableHeadColumns.value);
|
||||
tableDataSource.value.forEach((item, rowIndex) => {
|
||||
tableStr += "<tr>";
|
||||
let info: any = {};
|
||||
tableBodyColumns.value.forEach((tableColumn, columnIndex) => {
|
||||
Object.keys(item).forEach((name) => {
|
||||
if (tableColumn.key === name) {
|
||||
const rowColSpan = props.spanMethod(
|
||||
item,
|
||||
tableColumn,
|
||||
rowIndex,
|
||||
columnIndex
|
||||
);
|
||||
const rowspan = rowColSpan ? rowColSpan[0] : 1;
|
||||
const colspan = rowColSpan ? rowColSpan[1] : 1;
|
||||
if (rowspan != 0 && colspan != 0) {
|
||||
tableStr += `<td colspan=${colspan} rowspan=${rowspan}>${item[name]}</td>`;
|
||||
// const rowColSpan = props.spanMethod(
|
||||
// item,
|
||||
// tableColumn,
|
||||
// rowIndex,
|
||||
// columnIndex
|
||||
// );
|
||||
// const rowspan = rowColSpan ? rowColSpan[0] : 1;
|
||||
// const colspan = rowColSpan ? rowColSpan[1] : 1;
|
||||
// if (rowspan != 0 && colspan != 0) {
|
||||
// tableStr += `<td colspan=${colspan} rowspan=${rowspan}${tableColumn.valueType == 'str' ? ' x:str' : ''}>${item[name] || ''}</td>`;
|
||||
// }
|
||||
if (tableColumn.valueType == "str") {
|
||||
info[name] = item[name];
|
||||
} else {
|
||||
info[name] =
|
||||
isNaN(Number(item[name])) || (!item[name] && item[name] !== 0)
|
||||
? item[name]
|
||||
: Number(item[name]);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (tableColumn.type == "number") {
|
||||
// const rowColSpan = props.spanMethod(
|
||||
// item,
|
||||
// tableColumn,
|
||||
// rowIndex,
|
||||
// columnIndex
|
||||
// );
|
||||
// const rowspan = rowColSpan ? rowColSpan[0] : 1;
|
||||
// const colspan = rowColSpan ? rowColSpan[1] : 1;
|
||||
// if (rowspan != 0 && colspan != 0) {
|
||||
// tableStr += `<td colspan=${colspan} rowspan=${rowspan}>${rowIndex + 1}</td>`;
|
||||
// }
|
||||
info[tableColumn.key] = rowIndex + 1;
|
||||
}
|
||||
});
|
||||
tableStr += "</tr>";
|
||||
// tableStr += "</tr>";
|
||||
list.push(info);
|
||||
});
|
||||
var worksheet = "Sheet1";
|
||||
var uri = "data:application/vnd.ms-excel;base64,";
|
||||
var exportTemplate = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
|
||||
<x:Name>${worksheet}</x:Name>
|
||||
<x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
|
||||
</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<table syle="table-layout: fixed;word-wrap: break-word; word-break: break-all;">${tableStr}</table>
|
||||
</body>
|
||||
</html>`;
|
||||
window.location.href = uri + base64(exportTemplate);
|
||||
// var worksheet = "Sheet1";
|
||||
// var uri = "data:application/vnd.ms-excel;base64,";
|
||||
// var exportTemplate = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"
|
||||
// xmlns="http://www.w3.org/TR/REC-html40">
|
||||
// <head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
|
||||
// <x:Name>${worksheet}</x:Name>
|
||||
// <x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
|
||||
// </x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
|
||||
// </head>
|
||||
// <body>
|
||||
// <table syle="table-layout: fixed;word-wrap: break-word; word-break: break-all;">${tableStr}</table>
|
||||
// </body>
|
||||
// </html>`;
|
||||
// let a = document.createElement("a");
|
||||
// a.href = uri + base64(exportTemplate);
|
||||
// a.download = (props.download || "下载文件") + ".xls";
|
||||
// a.click();
|
||||
// window.location.href =
|
||||
exportElcel(list, head, props.download || "下载文件");
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -392,31 +509,35 @@ function base64(s: string) {
|
||||
}
|
||||
|
||||
// 列排序
|
||||
const sortTable = (e: any, key: string, sort: string) => {
|
||||
const sortTable = (e: any, key: string, sort: string, issoul = false) => {
|
||||
let currentSort = e.target.parentNode.getAttribute("lay-sort");
|
||||
if (sort === "desc") {
|
||||
if (currentSort === sort) {
|
||||
if (currentSort === sort && !issoul) {
|
||||
e.target.parentNode.setAttribute("lay-sort", "");
|
||||
tableDataSource.value = [...props.dataSource];
|
||||
} else {
|
||||
console.log("排序了");
|
||||
e.target.parentNode.setAttribute("lay-sort", "desc");
|
||||
tableDataSource.value.sort((x, y) => {
|
||||
if (x[key] < y[key]) return 1;
|
||||
else if (x[key] > y[key]) return -1;
|
||||
else return 0;
|
||||
});
|
||||
tableDataSource.value = [...tableDataSource.value];
|
||||
}
|
||||
} else {
|
||||
if (currentSort === sort) {
|
||||
if (currentSort === sort && !issoul) {
|
||||
e.target.parentNode.setAttribute("lay-sort", "");
|
||||
tableDataSource.value = [...props.dataSource];
|
||||
} else {
|
||||
console.log("排序了");
|
||||
e.target.parentNode.setAttribute("lay-sort", "asc");
|
||||
tableDataSource.value.sort((x, y) => {
|
||||
if (x[key] < y[key]) return -1;
|
||||
else if (x[key] > y[key]) return 1;
|
||||
else return 0;
|
||||
});
|
||||
tableDataSource.value = [...tableDataSource.value];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -632,7 +753,8 @@ const renderFixedClassName = (column: any, columnIndex: number) => {
|
||||
left = false;
|
||||
}
|
||||
}
|
||||
return left ? `layui-table-fixed-left-last` : "";
|
||||
return "";
|
||||
// return left ? `layui-table-fixed-left-last` : "";
|
||||
} else {
|
||||
var right = true;
|
||||
for (var i = 0; i < columnIndex; i++) {
|
||||
@@ -644,7 +766,8 @@ const renderFixedClassName = (column: any, columnIndex: number) => {
|
||||
right = false;
|
||||
}
|
||||
}
|
||||
return right ? `layui-table-fixed-right-first` : "";
|
||||
return "";
|
||||
// return right ? `layui-table-fixed-right-first` : "";
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -697,6 +820,85 @@ const toolbarStyle = (toolbarName: string) => {
|
||||
onBeforeUnmount(() => {
|
||||
window.onresize = null;
|
||||
});
|
||||
|
||||
// 模仿soultable
|
||||
const soulstatus = ref(false);
|
||||
const soultop = ref(0);
|
||||
const soulleft = ref(0);
|
||||
const selcolumn = ref<any>({});
|
||||
const soulkey = ref("");
|
||||
const sxlist: any = ref({});
|
||||
function showsoul(event: MouseEvent, column: any, key: string) {
|
||||
console.log(event);
|
||||
soulleft.value = event.pageX;
|
||||
soultop.value = event.pageY;
|
||||
soulstatus.value = true;
|
||||
selcolumn.value = column;
|
||||
soulkey.value = key;
|
||||
}
|
||||
const heddin = () => {
|
||||
soulkey.value = "";
|
||||
};
|
||||
function asc(event: any) {
|
||||
selcolumn.value.soulclass = "soul-icon-filter-asc";
|
||||
sortTable(event, selcolumn.value.key, "asc", true);
|
||||
}
|
||||
function desc(event: any) {
|
||||
selcolumn.value.soulclass = "soul-icon-filter-desc";
|
||||
sortTable(event, selcolumn.value.key, "desc", true);
|
||||
}
|
||||
|
||||
function sx(e: any) {
|
||||
sxlist.value[e.key] = e.list;
|
||||
console.log("筛选事件", sxlist.value, sxlist.value.length);
|
||||
}
|
||||
watch(sxlist, () => {
|
||||
console.log("sxlist更新");
|
||||
});
|
||||
watch(
|
||||
[() => sxlist, () => props.dataSource],
|
||||
(old, new1) => {
|
||||
// tableDataSource
|
||||
// console.log(JSON.stringify(sxlist.value),JSON.stringify(props.dataSource),old[0] == new1[0],old[1] == new1[1])
|
||||
if (Object.keys(sxlist.value).length == 0) {
|
||||
return;
|
||||
}
|
||||
let list: any = [...props.dataSource];
|
||||
let endlist: any = [];
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (!props.page || props.serverpage) {
|
||||
nextTick(() => {
|
||||
datalist.value = endlist;
|
||||
});
|
||||
} else {
|
||||
tableDataSource.value = endlist;
|
||||
// pagecurrent ||
|
||||
change({
|
||||
limit: props.page.limit,
|
||||
current: props.page.current,
|
||||
isReload: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
window.addEventListener("click", heddin);
|
||||
// 将分页移入到组件内
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -867,6 +1069,20 @@ onBeforeUnmount(() => {
|
||||
title="降序"
|
||||
></i>
|
||||
</span>
|
||||
<span
|
||||
v-if="column.soul"
|
||||
class="layui-table-sort layui-inline soul-icon"
|
||||
>
|
||||
<i
|
||||
class="soul-icon soul-box"
|
||||
:class="column.soulclass || 'soul-icon-filter'"
|
||||
@click.stop="showsoul($event, column, column.key)"
|
||||
>
|
||||
<!-- <div v-show="column.soulshow" @click.stop="" class="soulbox">
|
||||
11111
|
||||
</div> -->
|
||||
</i>
|
||||
</span>
|
||||
</template>
|
||||
</th>
|
||||
</template>
|
||||
@@ -884,7 +1100,7 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<table
|
||||
class="layui-table"
|
||||
v-if="tableDataSource.length > 0 && loading == false"
|
||||
v-if="datalist.length > 0 && loading == false"
|
||||
:class="{ 'layui-table-even': props.even }"
|
||||
:lay-size="size"
|
||||
:lay-skin="skin"
|
||||
@@ -906,10 +1122,7 @@ onBeforeUnmount(() => {
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<!-- 渲染 -->
|
||||
<template
|
||||
v-for="(children, index) in tableDataSource"
|
||||
:key="index"
|
||||
>
|
||||
<template v-for="(children, index) in datalist" :key="index">
|
||||
<table-row
|
||||
:id="id"
|
||||
:index="index"
|
||||
@@ -934,6 +1147,7 @@ onBeforeUnmount(() => {
|
||||
@row="rowClick"
|
||||
@row-double="rowDoubleClick"
|
||||
@row-contextmenu="rowContextmenu"
|
||||
:page="page"
|
||||
>
|
||||
<template v-for="name in slotsData" #[name]="{ data }">
|
||||
<slot :name="name" :data="data"></slot>
|
||||
@@ -971,7 +1185,7 @@ onBeforeUnmount(() => {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<template v-if="tableDataSource.length == 0 && loading == false">
|
||||
<template v-if="datalist.length == 0 && loading == false">
|
||||
<lay-empty></lay-empty>
|
||||
<div :style="{ width: tableBodyEmptyWidth }"></div>
|
||||
</template>
|
||||
@@ -1006,5 +1220,24 @@ onBeforeUnmount(() => {
|
||||
</table-page>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-for="(tableHeadColumn, tableHeadColumnIndex) in tableHeadColumns"
|
||||
:key="tableHeadColumnIndex"
|
||||
>
|
||||
<div v-for="(column, columnIndex) in tableHeadColumn" :key="column">
|
||||
<soultable
|
||||
:top="soultop"
|
||||
:left="soulleft"
|
||||
v-show="soulkey == column.key"
|
||||
:show="soulkey == column.key"
|
||||
@asc="asc"
|
||||
@desc="desc"
|
||||
@daochu="exportData"
|
||||
:list="datalist"
|
||||
:soulkey="column.key"
|
||||
@sx="sx"
|
||||
></soultable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
14
package/component/src/component/table/soultable.less
Normal file
14
package/component/src/component/table/soultable.less
Normal file
@@ -0,0 +1,14 @@
|
||||
.soulbox{
|
||||
position: absolute;
|
||||
background-color: #333333;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
z-index: 2147483647;
|
||||
min-width: 160px;
|
||||
max-width: 320px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 5px;
|
||||
box-shadow: 2px 2px 4px -2px rgba(0,0,0,.2);
|
||||
}
|
||||
172
package/component/src/component/table/soultable.vue
Normal file
172
package/component/src/component/table/soultable.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div
|
||||
class="soulbox"
|
||||
:style="`top: ${props.top}px;left:${props.left}px`"
|
||||
@click.stop=""
|
||||
>
|
||||
<ul @mouseover="shubiao">
|
||||
<li @click="asc" class="soul-sort" data-value="asc" style="">
|
||||
<i class="soul-icon soul-icon-asc"></i> 升序排列
|
||||
</li>
|
||||
<li
|
||||
@click="desc"
|
||||
class="soul-sort"
|
||||
data-value="desc"
|
||||
style="border-bottom: 1px solid rgb(230, 230, 230)"
|
||||
>
|
||||
<i class="soul-icon soul-icon-desc"></i> 降序排列
|
||||
</li>
|
||||
<!-- <li class="soul-column" style=""><i class="layui-icon layui-icon-table"></i> 表格列 <i
|
||||
class="layui-icon layui-icon-right" style="float: right"></i></li> -->
|
||||
<li class="soul-dropList" style="" show="select">
|
||||
<i class="soul-icon soul-icon-drop-list" show="select"></i> 筛选数据
|
||||
<i
|
||||
class="layui-icon layui-icon-right"
|
||||
style="float: right"
|
||||
show="select"
|
||||
></i>
|
||||
</li>
|
||||
<li
|
||||
@click="daochu"
|
||||
class="soul-sort"
|
||||
data-value="desc"
|
||||
style="border-bottom: 1px solid rgb(230, 230, 230)"
|
||||
>
|
||||
<i class="soul-icon soul-icon-download"></i> 导出excel
|
||||
</li>
|
||||
<!-- <li class="soul-condition" style=""><i class="soul-icon soul-icon-query"></i> 筛选条件 <i
|
||||
class="layui-icon layui-icon-right" style="float: right"></i></li>
|
||||
<li class="soul-edit-condition" style=""><i class="layui-icon layui-icon-edit"></i> 编辑筛选条件 </li>
|
||||
<li class="soul-export" style=""><i class="soul-icon soul-icon-download"></i> 导出excel </li> -->
|
||||
</ul>
|
||||
<div class="soulbox" style="left: 100%; top: 65px" v-show="selshow">
|
||||
<lay-input
|
||||
prefix-icon="layui-icon-search"
|
||||
v-model="seltext"
|
||||
size="sm"
|
||||
placeholder="关键字搜索"
|
||||
>
|
||||
</lay-input>
|
||||
<div class="check" style="min-width: 190px">
|
||||
<div class="multiOption" data-type="all" @click="select(1)">
|
||||
<i class="soul-icon"></i> 全选
|
||||
</div>
|
||||
<div class="multiOption" data-type="none" @click="select(2)">
|
||||
<i class="soul-icon"></i> 清空
|
||||
</div>
|
||||
<div class="multiOption" data-type="reverse" @click="select(3)">
|
||||
<i class="soul-icon"></i>反选
|
||||
</div>
|
||||
</div>
|
||||
<ul style="max-height: 300px; overflow: auto">
|
||||
<LayCheckboxGroup v-model="sel">
|
||||
<li v-for="(i, j) in list">
|
||||
<LayCheckbox skin="primary" :value="i"></LayCheckbox>{{ i }}
|
||||
</li>
|
||||
</LayCheckboxGroup>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import "./soultable.less";
|
||||
import { ref, watch, withDefaults } from "vue";
|
||||
import layInput from "../input/index.vue";
|
||||
import LayCheckbox from "../checkbox/index.vue";
|
||||
import LayCheckboxGroup from "../checkboxGroup/index.vue";
|
||||
export interface SoulTableProps {
|
||||
left: number;
|
||||
top: number;
|
||||
list: any;
|
||||
soulkey: string;
|
||||
show: boolean;
|
||||
}
|
||||
const props = withDefaults(defineProps<SoulTableProps>(), {
|
||||
top: 10,
|
||||
left: 10,
|
||||
list: [],
|
||||
soulkey: "",
|
||||
show: false,
|
||||
});
|
||||
const emit = defineEmits(["asc", "desc", "sx", "daochu"]);
|
||||
function asc(event: any) {
|
||||
emit("asc", event);
|
||||
}
|
||||
function desc(event: any) {
|
||||
emit("desc", event);
|
||||
}
|
||||
function daochu() {
|
||||
emit("daochu");
|
||||
}
|
||||
const sel: any = ref([]);
|
||||
const list: any = ref([]);
|
||||
const alllist: any = ref([]);
|
||||
watch(
|
||||
() => [props.show],
|
||||
() => {
|
||||
let set = new Set();
|
||||
for (let i of props.list) {
|
||||
set.add(i[props.soulkey]);
|
||||
// console.log(i, i[props.soulkey]);
|
||||
}
|
||||
alllist.value = Array.from(set);
|
||||
list.value = alllist.value;
|
||||
selshow.value = false;
|
||||
// console.log(list.value);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
// watch(alllist,()=>{
|
||||
// list.value = []
|
||||
// for(let i of list){
|
||||
|
||||
// }
|
||||
// })
|
||||
const seltext = ref("");
|
||||
watch(seltext, () => {
|
||||
let l = [];
|
||||
if (seltext.value) {
|
||||
for (let i of alllist.value) {
|
||||
if (i.indexOf(seltext.value) != -1) {
|
||||
l.push(i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
l = alllist.value;
|
||||
}
|
||||
list.value = l;
|
||||
});
|
||||
watch(sel, () => {
|
||||
emit("sx", { key: props.soulkey, list: sel.value });
|
||||
});
|
||||
function select(type: number) {
|
||||
if (type == 1) {
|
||||
sel.value = [];
|
||||
let t = [];
|
||||
for (let i of list.value) {
|
||||
t.push(i);
|
||||
}
|
||||
sel.value = t;
|
||||
} else if (type == 3) {
|
||||
let t = [];
|
||||
for (let i of list.value) {
|
||||
if (!sel.value.includes(i)) {
|
||||
t.push(i);
|
||||
}
|
||||
}
|
||||
sel.value = t;
|
||||
} else if (type == 2) {
|
||||
sel.value = [];
|
||||
}
|
||||
}
|
||||
const selshow = ref(false);
|
||||
function shubiao(event: any) {
|
||||
console.log(event, 160);
|
||||
if (event.target.getAttribute("show") == "select") {
|
||||
selshow.value = true;
|
||||
} else {
|
||||
selshow.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
export const TAG_COLORS = ["primary", "normal", "warm", "danger"] as const;
|
||||
|
||||
export type TagType = typeof TAG_COLORS[number];
|
||||
export type TagType = (typeof TAG_COLORS)[number];
|
||||
|
||||
export type TagShape = "square" | "round";
|
||||
|
||||
|
||||
@@ -40,12 +40,14 @@ export interface TagInputProps {
|
||||
size?: TagInputSize;
|
||||
tagProps?: TagProps;
|
||||
disabledInput?: boolean;
|
||||
position?: string;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<TagInputProps>(), {
|
||||
placeholder: undefined,
|
||||
minCollapsedNum: 0,
|
||||
size: "md",
|
||||
position: "top",
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
@@ -274,6 +276,7 @@ defineExpose({
|
||||
trigger="hover"
|
||||
popperStyle="padding:6px"
|
||||
:disabled="!collapseTagsTooltip"
|
||||
:position="position"
|
||||
>
|
||||
<LayTag v-bind="tagProps" key="more" :closable="false" :size="size">
|
||||
+{{ moreCount }}...
|
||||
|
||||
@@ -108,7 +108,7 @@ onMounted(() => {
|
||||
</span>
|
||||
</div>
|
||||
<slot v-else></slot>
|
||||
<lay-popper v-if="isMounted" v-bind="innerProps">
|
||||
<lay-popper :positio="position" v-if="isMounted" v-bind="innerProps">
|
||||
<slot name="content"></slot>
|
||||
</lay-popper>
|
||||
</template>
|
||||
|
||||
@@ -24,6 +24,7 @@ export interface TreeData {
|
||||
isLeaf: boolean;
|
||||
hasNextSibling: boolean;
|
||||
parentNode: Nullable<TreeData>;
|
||||
selectParent: boolean;
|
||||
}
|
||||
|
||||
export interface TreeNodeProps {
|
||||
@@ -35,6 +36,8 @@ export interface TreeNodeProps {
|
||||
checkStrictly: boolean | string;
|
||||
collapseTransition: boolean;
|
||||
onlyIconControl: boolean;
|
||||
hideicon?: boolean;
|
||||
selectParent: boolean;
|
||||
}
|
||||
|
||||
interface TreeNodeEmits {
|
||||
@@ -69,6 +72,9 @@ const nodeIconType = (node: TreeData): string => {
|
||||
if (node.children.length !== 0) {
|
||||
return !node.isLeaf ? "layui-icon-addition" : "layui-icon-subtraction";
|
||||
}
|
||||
if (props.hideicon) {
|
||||
return "";
|
||||
}
|
||||
return "layui-icon-file";
|
||||
};
|
||||
|
||||
@@ -77,7 +83,11 @@ function recursiveNodeClick(node: TreeData) {
|
||||
}
|
||||
|
||||
function handleChange(checked: boolean, node: TreeData) {
|
||||
props.tree.setCheckedKeys(checked, props.checkStrictly, node);
|
||||
props.tree.setCheckedKeys(
|
||||
checked,
|
||||
props.checkStrictly || props.selectParent,
|
||||
node
|
||||
);
|
||||
}
|
||||
|
||||
function handleIconClick(node: TreeData) {
|
||||
@@ -91,6 +101,9 @@ function handleTitleClick(node: TreeData) {
|
||||
if (!node.isDisabled) {
|
||||
emit("node-click", node);
|
||||
}
|
||||
if (props.showCheckbox) {
|
||||
node.isChecked = !node.isChecked;
|
||||
}
|
||||
}
|
||||
|
||||
function handleRowClick(node: TreeData) {
|
||||
@@ -102,15 +115,14 @@ function handleRowClick(node: TreeData) {
|
||||
//判断是否半选
|
||||
const isChildAllSelected = computed(() => {
|
||||
function _isChildAllSelected(node: TreeData): boolean {
|
||||
if (!props.showCheckbox) {
|
||||
return false;
|
||||
}
|
||||
let childSelectNum = 0;
|
||||
let res = false; // true为半选 false为全选
|
||||
for (const item of node.children) {
|
||||
if (item.isChecked) childSelectNum++;
|
||||
}
|
||||
if (childSelectNum > 0) node.isChecked = true; //此处的处理与 checkedKeys 有关联
|
||||
if (!props.selectParent) {
|
||||
if (childSelectNum > 0) node.isChecked = true; //此处的处理与 checkedKeys 有关联
|
||||
}
|
||||
if (childSelectNum == node.children.length) {
|
||||
//继续递归向下判断
|
||||
for (const item of node.children) {
|
||||
@@ -124,11 +136,14 @@ const isChildAllSelected = computed(() => {
|
||||
}
|
||||
|
||||
return (node: TreeData): boolean => {
|
||||
console.log(props.selectParent);
|
||||
if (props.checkStrictly) {
|
||||
return false;
|
||||
} else {
|
||||
} else if (props.selectParent) {
|
||||
let res = _isChildAllSelected(node);
|
||||
return res;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -170,7 +185,7 @@ const isChildAllSelected = computed(() => {
|
||||
:class="{
|
||||
'layui-tree-txt': true,
|
||||
'layui-disabled': node.isDisabled,
|
||||
'layui-this': selectedKey === node.id,
|
||||
'layui-this': selectedKey === node.id || node.isChecked,
|
||||
}"
|
||||
@click.stop="handleTitleClick(node)"
|
||||
>
|
||||
@@ -193,6 +208,8 @@ const isChildAllSelected = computed(() => {
|
||||
:collapse-transition="collapseTransition"
|
||||
:checkStrictly="checkStrictly"
|
||||
:only-icon-control="onlyIconControl"
|
||||
:hideicon="props.hideicon"
|
||||
:select-parent="props.selectParent"
|
||||
@node-click="recursiveNodeClick"
|
||||
>
|
||||
<template v-if="$slots.title" v-slot:title="slotProp: { data: any }">
|
||||
|
||||
@@ -38,6 +38,8 @@ export interface TreeProps {
|
||||
showLine?: boolean;
|
||||
showCheckbox?: boolean;
|
||||
replaceFields?: ReplaceFieldsOptions;
|
||||
hideicon?: boolean;
|
||||
selectParent?: boolean;
|
||||
}
|
||||
|
||||
interface TreeEmits {
|
||||
@@ -64,6 +66,7 @@ const props = withDefaults(defineProps<TreeProps>(), {
|
||||
title: "title",
|
||||
};
|
||||
},
|
||||
selectParent: false,
|
||||
});
|
||||
|
||||
const slots = useSlots();
|
||||
@@ -100,9 +103,13 @@ watch(
|
||||
watch(
|
||||
() => props.checkedKeys,
|
||||
() => {
|
||||
console.log(tree.value);
|
||||
if (!unWatch.value) {
|
||||
loadNodeList();
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -113,9 +120,9 @@ watch(
|
||||
const { checkedKeys } = tree.value.getKeys();
|
||||
unWatch.value = true;
|
||||
emit("update:checkedKeys", checkedKeys);
|
||||
setTimeout(() => {
|
||||
nextTick(() => {
|
||||
unWatch.value = false;
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
@@ -144,6 +151,8 @@ function handleClick(node: TreeData) {
|
||||
:collapse-transition="collapseTransition"
|
||||
:only-icon-control="onlyIconControl"
|
||||
@node-click="handleClick"
|
||||
:hideicon="props.hideicon"
|
||||
:selectParent="props.selectParent"
|
||||
>
|
||||
<template v-if="$slots.title" v-slot:title="{ data }">
|
||||
<slot name="title" :data="data"></slot>
|
||||
|
||||
@@ -94,7 +94,7 @@ class Tree {
|
||||
checkStrictly,
|
||||
replaceFields: { children, id, title },
|
||||
} = this.config;
|
||||
|
||||
console.log(origin, "origin");
|
||||
const nodeKey = Reflect.get(origin, id);
|
||||
const nodeTitle = Reflect.get(origin, title);
|
||||
const nodeChildren = Reflect.get(origin, children);
|
||||
@@ -137,6 +137,7 @@ class Tree {
|
||||
}
|
||||
|
||||
setChildrenChecked(checked: boolean, nodes: TreeData[]) {
|
||||
console.log("走赋值子节点了");
|
||||
var ableCount = 0;
|
||||
var checkCount = 0;
|
||||
const len = nodes.length;
|
||||
@@ -163,6 +164,7 @@ class Tree {
|
||||
}
|
||||
|
||||
setParentChecked(checked: boolean, parent: TreeData) {
|
||||
console.log("走赋值父节点了");
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
@@ -183,6 +185,7 @@ class Tree {
|
||||
node: TreeData
|
||||
) {
|
||||
node.isChecked = checked;
|
||||
console.log(node, checkStrictly, 186);
|
||||
if (!checkStrictly) {
|
||||
if (node.parentNode) {
|
||||
this.setParentChecked(checked, node.parentNode);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user