1
This commit is contained in:
parent
a062e58312
commit
c1cce5a7c2
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,7 +1,6 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
package-lock.json
|
||||
package/document/dist/
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
|
8
package/component/.gitignore
vendored
8
package/component/.gitignore
vendored
@ -1,12 +1,6 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
example/dist/
|
||||
lib/
|
||||
es/
|
||||
umd/
|
||||
esm/
|
||||
/types/
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
869
package/component/es/_chunks/@ctrl/index.js
Normal file
869
package/component/es/_chunks/@ctrl/index.js
Normal file
@ -0,0 +1,869 @@
|
||||
function bound01(n, max) {
|
||||
if (isOnePointZero(n)) {
|
||||
n = "100%";
|
||||
}
|
||||
var isPercent = isPercentage(n);
|
||||
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
||||
if (isPercent) {
|
||||
n = parseInt(String(n * max), 10) / 100;
|
||||
}
|
||||
if (Math.abs(n - max) < 1e-6) {
|
||||
return 1;
|
||||
}
|
||||
if (max === 360) {
|
||||
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
|
||||
} else {
|
||||
n = n % max / parseFloat(String(max));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
function clamp01(val) {
|
||||
return Math.min(1, Math.max(0, val));
|
||||
}
|
||||
function isOnePointZero(n) {
|
||||
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
|
||||
}
|
||||
function isPercentage(n) {
|
||||
return typeof n === "string" && n.indexOf("%") !== -1;
|
||||
}
|
||||
function boundAlpha(a) {
|
||||
a = parseFloat(a);
|
||||
if (isNaN(a) || a < 0 || a > 1) {
|
||||
a = 1;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
function convertToPercentage(n) {
|
||||
if (n <= 1) {
|
||||
return "".concat(Number(n) * 100, "%");
|
||||
}
|
||||
return n;
|
||||
}
|
||||
function pad2(c) {
|
||||
return c.length === 1 ? "0" + c : String(c);
|
||||
}
|
||||
function rgbToRgb(r, g, b) {
|
||||
return {
|
||||
r: bound01(r, 255) * 255,
|
||||
g: bound01(g, 255) * 255,
|
||||
b: bound01(b, 255) * 255
|
||||
};
|
||||
}
|
||||
function rgbToHsl(r, g, b) {
|
||||
r = bound01(r, 255);
|
||||
g = bound01(g, 255);
|
||||
b = bound01(b, 255);
|
||||
var max = Math.max(r, g, b);
|
||||
var min = Math.min(r, g, b);
|
||||
var h = 0;
|
||||
var s = 0;
|
||||
var l = (max + min) / 2;
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
h = 0;
|
||||
} else {
|
||||
var d = max - min;
|
||||
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
||||
switch (max) {
|
||||
case r:
|
||||
h = (g - b) / d + (g < b ? 6 : 0);
|
||||
break;
|
||||
case g:
|
||||
h = (b - r) / d + 2;
|
||||
break;
|
||||
case b:
|
||||
h = (r - g) / d + 4;
|
||||
break;
|
||||
}
|
||||
h /= 6;
|
||||
}
|
||||
return { h, s, l };
|
||||
}
|
||||
function hue2rgb(p, q, t) {
|
||||
if (t < 0) {
|
||||
t += 1;
|
||||
}
|
||||
if (t > 1) {
|
||||
t -= 1;
|
||||
}
|
||||
if (t < 1 / 6) {
|
||||
return p + (q - p) * (6 * t);
|
||||
}
|
||||
if (t < 1 / 2) {
|
||||
return q;
|
||||
}
|
||||
if (t < 2 / 3) {
|
||||
return p + (q - p) * (2 / 3 - t) * 6;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
function hslToRgb(h, s, l) {
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
h = bound01(h, 360);
|
||||
s = bound01(s, 100);
|
||||
l = bound01(l, 100);
|
||||
if (s === 0) {
|
||||
g = l;
|
||||
b = l;
|
||||
r = l;
|
||||
} else {
|
||||
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
||||
var p = 2 * l - q;
|
||||
r = hue2rgb(p, q, h + 1 / 3);
|
||||
g = hue2rgb(p, q, h);
|
||||
b = hue2rgb(p, q, h - 1 / 3);
|
||||
}
|
||||
return { r: r * 255, g: g * 255, b: b * 255 };
|
||||
}
|
||||
function rgbToHsv(r, g, b) {
|
||||
r = bound01(r, 255);
|
||||
g = bound01(g, 255);
|
||||
b = bound01(b, 255);
|
||||
var max = Math.max(r, g, b);
|
||||
var min = Math.min(r, g, b);
|
||||
var h = 0;
|
||||
var v = max;
|
||||
var d = max - min;
|
||||
var s = max === 0 ? 0 : d / max;
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else {
|
||||
switch (max) {
|
||||
case r:
|
||||
h = (g - b) / d + (g < b ? 6 : 0);
|
||||
break;
|
||||
case g:
|
||||
h = (b - r) / d + 2;
|
||||
break;
|
||||
case b:
|
||||
h = (r - g) / d + 4;
|
||||
break;
|
||||
}
|
||||
h /= 6;
|
||||
}
|
||||
return { h, s, v };
|
||||
}
|
||||
function hsvToRgb(h, s, v) {
|
||||
h = bound01(h, 360) * 6;
|
||||
s = bound01(s, 100);
|
||||
v = bound01(v, 100);
|
||||
var i = Math.floor(h);
|
||||
var f = h - i;
|
||||
var p = v * (1 - s);
|
||||
var q = v * (1 - f * s);
|
||||
var t = v * (1 - (1 - f) * s);
|
||||
var mod = i % 6;
|
||||
var r = [v, q, p, p, t, v][mod];
|
||||
var g = [t, v, v, q, p, p][mod];
|
||||
var b = [p, p, t, v, v, q][mod];
|
||||
return { r: r * 255, g: g * 255, b: b * 255 };
|
||||
}
|
||||
function rgbToHex(r, g, b, allow3Char) {
|
||||
var hex = [
|
||||
pad2(Math.round(r).toString(16)),
|
||||
pad2(Math.round(g).toString(16)),
|
||||
pad2(Math.round(b).toString(16))
|
||||
];
|
||||
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
|
||||
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
||||
}
|
||||
return hex.join("");
|
||||
}
|
||||
function rgbaToHex(r, g, b, a, allow4Char) {
|
||||
var hex = [
|
||||
pad2(Math.round(r).toString(16)),
|
||||
pad2(Math.round(g).toString(16)),
|
||||
pad2(Math.round(b).toString(16)),
|
||||
pad2(convertDecimalToHex(a))
|
||||
];
|
||||
if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
|
||||
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
||||
}
|
||||
return hex.join("");
|
||||
}
|
||||
function convertDecimalToHex(d) {
|
||||
return Math.round(parseFloat(d) * 255).toString(16);
|
||||
}
|
||||
function convertHexToDecimal(h) {
|
||||
return parseIntFromHex(h) / 255;
|
||||
}
|
||||
function parseIntFromHex(val) {
|
||||
return parseInt(val, 16);
|
||||
}
|
||||
function numberInputToObject(color) {
|
||||
return {
|
||||
r: color >> 16,
|
||||
g: (color & 65280) >> 8,
|
||||
b: color & 255
|
||||
};
|
||||
}
|
||||
var names = {
|
||||
aliceblue: "#f0f8ff",
|
||||
antiquewhite: "#faebd7",
|
||||
aqua: "#00ffff",
|
||||
aquamarine: "#7fffd4",
|
||||
azure: "#f0ffff",
|
||||
beige: "#f5f5dc",
|
||||
bisque: "#ffe4c4",
|
||||
black: "#000000",
|
||||
blanchedalmond: "#ffebcd",
|
||||
blue: "#0000ff",
|
||||
blueviolet: "#8a2be2",
|
||||
brown: "#a52a2a",
|
||||
burlywood: "#deb887",
|
||||
cadetblue: "#5f9ea0",
|
||||
chartreuse: "#7fff00",
|
||||
chocolate: "#d2691e",
|
||||
coral: "#ff7f50",
|
||||
cornflowerblue: "#6495ed",
|
||||
cornsilk: "#fff8dc",
|
||||
crimson: "#dc143c",
|
||||
cyan: "#00ffff",
|
||||
darkblue: "#00008b",
|
||||
darkcyan: "#008b8b",
|
||||
darkgoldenrod: "#b8860b",
|
||||
darkgray: "#a9a9a9",
|
||||
darkgreen: "#006400",
|
||||
darkgrey: "#a9a9a9",
|
||||
darkkhaki: "#bdb76b",
|
||||
darkmagenta: "#8b008b",
|
||||
darkolivegreen: "#556b2f",
|
||||
darkorange: "#ff8c00",
|
||||
darkorchid: "#9932cc",
|
||||
darkred: "#8b0000",
|
||||
darksalmon: "#e9967a",
|
||||
darkseagreen: "#8fbc8f",
|
||||
darkslateblue: "#483d8b",
|
||||
darkslategray: "#2f4f4f",
|
||||
darkslategrey: "#2f4f4f",
|
||||
darkturquoise: "#00ced1",
|
||||
darkviolet: "#9400d3",
|
||||
deeppink: "#ff1493",
|
||||
deepskyblue: "#00bfff",
|
||||
dimgray: "#696969",
|
||||
dimgrey: "#696969",
|
||||
dodgerblue: "#1e90ff",
|
||||
firebrick: "#b22222",
|
||||
floralwhite: "#fffaf0",
|
||||
forestgreen: "#228b22",
|
||||
fuchsia: "#ff00ff",
|
||||
gainsboro: "#dcdcdc",
|
||||
ghostwhite: "#f8f8ff",
|
||||
goldenrod: "#daa520",
|
||||
gold: "#ffd700",
|
||||
gray: "#808080",
|
||||
green: "#008000",
|
||||
greenyellow: "#adff2f",
|
||||
grey: "#808080",
|
||||
honeydew: "#f0fff0",
|
||||
hotpink: "#ff69b4",
|
||||
indianred: "#cd5c5c",
|
||||
indigo: "#4b0082",
|
||||
ivory: "#fffff0",
|
||||
khaki: "#f0e68c",
|
||||
lavenderblush: "#fff0f5",
|
||||
lavender: "#e6e6fa",
|
||||
lawngreen: "#7cfc00",
|
||||
lemonchiffon: "#fffacd",
|
||||
lightblue: "#add8e6",
|
||||
lightcoral: "#f08080",
|
||||
lightcyan: "#e0ffff",
|
||||
lightgoldenrodyellow: "#fafad2",
|
||||
lightgray: "#d3d3d3",
|
||||
lightgreen: "#90ee90",
|
||||
lightgrey: "#d3d3d3",
|
||||
lightpink: "#ffb6c1",
|
||||
lightsalmon: "#ffa07a",
|
||||
lightseagreen: "#20b2aa",
|
||||
lightskyblue: "#87cefa",
|
||||
lightslategray: "#778899",
|
||||
lightslategrey: "#778899",
|
||||
lightsteelblue: "#b0c4de",
|
||||
lightyellow: "#ffffe0",
|
||||
lime: "#00ff00",
|
||||
limegreen: "#32cd32",
|
||||
linen: "#faf0e6",
|
||||
magenta: "#ff00ff",
|
||||
maroon: "#800000",
|
||||
mediumaquamarine: "#66cdaa",
|
||||
mediumblue: "#0000cd",
|
||||
mediumorchid: "#ba55d3",
|
||||
mediumpurple: "#9370db",
|
||||
mediumseagreen: "#3cb371",
|
||||
mediumslateblue: "#7b68ee",
|
||||
mediumspringgreen: "#00fa9a",
|
||||
mediumturquoise: "#48d1cc",
|
||||
mediumvioletred: "#c71585",
|
||||
midnightblue: "#191970",
|
||||
mintcream: "#f5fffa",
|
||||
mistyrose: "#ffe4e1",
|
||||
moccasin: "#ffe4b5",
|
||||
navajowhite: "#ffdead",
|
||||
navy: "#000080",
|
||||
oldlace: "#fdf5e6",
|
||||
olive: "#808000",
|
||||
olivedrab: "#6b8e23",
|
||||
orange: "#ffa500",
|
||||
orangered: "#ff4500",
|
||||
orchid: "#da70d6",
|
||||
palegoldenrod: "#eee8aa",
|
||||
palegreen: "#98fb98",
|
||||
paleturquoise: "#afeeee",
|
||||
palevioletred: "#db7093",
|
||||
papayawhip: "#ffefd5",
|
||||
peachpuff: "#ffdab9",
|
||||
peru: "#cd853f",
|
||||
pink: "#ffc0cb",
|
||||
plum: "#dda0dd",
|
||||
powderblue: "#b0e0e6",
|
||||
purple: "#800080",
|
||||
rebeccapurple: "#663399",
|
||||
red: "#ff0000",
|
||||
rosybrown: "#bc8f8f",
|
||||
royalblue: "#4169e1",
|
||||
saddlebrown: "#8b4513",
|
||||
salmon: "#fa8072",
|
||||
sandybrown: "#f4a460",
|
||||
seagreen: "#2e8b57",
|
||||
seashell: "#fff5ee",
|
||||
sienna: "#a0522d",
|
||||
silver: "#c0c0c0",
|
||||
skyblue: "#87ceeb",
|
||||
slateblue: "#6a5acd",
|
||||
slategray: "#708090",
|
||||
slategrey: "#708090",
|
||||
snow: "#fffafa",
|
||||
springgreen: "#00ff7f",
|
||||
steelblue: "#4682b4",
|
||||
tan: "#d2b48c",
|
||||
teal: "#008080",
|
||||
thistle: "#d8bfd8",
|
||||
tomato: "#ff6347",
|
||||
turquoise: "#40e0d0",
|
||||
violet: "#ee82ee",
|
||||
wheat: "#f5deb3",
|
||||
white: "#ffffff",
|
||||
whitesmoke: "#f5f5f5",
|
||||
yellow: "#ffff00",
|
||||
yellowgreen: "#9acd32"
|
||||
};
|
||||
function inputToRGB(color) {
|
||||
var rgb = { r: 0, g: 0, b: 0 };
|
||||
var a = 1;
|
||||
var s = null;
|
||||
var v = null;
|
||||
var l = null;
|
||||
var ok = false;
|
||||
var format = false;
|
||||
if (typeof color === "string") {
|
||||
color = stringInputToObject(color);
|
||||
}
|
||||
if (typeof color === "object") {
|
||||
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
||||
rgb = rgbToRgb(color.r, color.g, color.b);
|
||||
ok = true;
|
||||
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
||||
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
||||
s = convertToPercentage(color.s);
|
||||
v = convertToPercentage(color.v);
|
||||
rgb = hsvToRgb(color.h, s, v);
|
||||
ok = true;
|
||||
format = "hsv";
|
||||
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
||||
s = convertToPercentage(color.s);
|
||||
l = convertToPercentage(color.l);
|
||||
rgb = hslToRgb(color.h, s, l);
|
||||
ok = true;
|
||||
format = "hsl";
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(color, "a")) {
|
||||
a = color.a;
|
||||
}
|
||||
}
|
||||
a = boundAlpha(a);
|
||||
return {
|
||||
ok,
|
||||
format: color.format || format,
|
||||
r: Math.min(255, Math.max(rgb.r, 0)),
|
||||
g: Math.min(255, Math.max(rgb.g, 0)),
|
||||
b: Math.min(255, Math.max(rgb.b, 0)),
|
||||
a
|
||||
};
|
||||
}
|
||||
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
||||
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
||||
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
|
||||
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
||||
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
||||
var matchers = {
|
||||
CSS_UNIT: new RegExp(CSS_UNIT),
|
||||
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
||||
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
||||
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
||||
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
||||
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
||||
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
||||
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
||||
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
||||
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
||||
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
||||
};
|
||||
function stringInputToObject(color) {
|
||||
color = color.trim().toLowerCase();
|
||||
if (color.length === 0) {
|
||||
return false;
|
||||
}
|
||||
var named = false;
|
||||
if (names[color]) {
|
||||
color = names[color];
|
||||
named = true;
|
||||
} else if (color === "transparent") {
|
||||
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
||||
}
|
||||
var match = matchers.rgb.exec(color);
|
||||
if (match) {
|
||||
return { r: match[1], g: match[2], b: match[3] };
|
||||
}
|
||||
match = matchers.rgba.exec(color);
|
||||
if (match) {
|
||||
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
||||
}
|
||||
match = matchers.hsl.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], l: match[3] };
|
||||
}
|
||||
match = matchers.hsla.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
||||
}
|
||||
match = matchers.hsv.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], v: match[3] };
|
||||
}
|
||||
match = matchers.hsva.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
||||
}
|
||||
match = matchers.hex8.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1]),
|
||||
g: parseIntFromHex(match[2]),
|
||||
b: parseIntFromHex(match[3]),
|
||||
a: convertHexToDecimal(match[4]),
|
||||
format: named ? "name" : "hex8"
|
||||
};
|
||||
}
|
||||
match = matchers.hex6.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1]),
|
||||
g: parseIntFromHex(match[2]),
|
||||
b: parseIntFromHex(match[3]),
|
||||
format: named ? "name" : "hex"
|
||||
};
|
||||
}
|
||||
match = matchers.hex4.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1] + match[1]),
|
||||
g: parseIntFromHex(match[2] + match[2]),
|
||||
b: parseIntFromHex(match[3] + match[3]),
|
||||
a: convertHexToDecimal(match[4] + match[4]),
|
||||
format: named ? "name" : "hex8"
|
||||
};
|
||||
}
|
||||
match = matchers.hex3.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1] + match[1]),
|
||||
g: parseIntFromHex(match[2] + match[2]),
|
||||
b: parseIntFromHex(match[3] + match[3]),
|
||||
format: named ? "name" : "hex"
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isValidCSSUnit(color) {
|
||||
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
||||
}
|
||||
var TinyColor = function() {
|
||||
function TinyColor2(color, opts) {
|
||||
if (color === void 0) {
|
||||
color = "";
|
||||
}
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
var _a;
|
||||
if (color instanceof TinyColor2) {
|
||||
return color;
|
||||
}
|
||||
if (typeof color === "number") {
|
||||
color = numberInputToObject(color);
|
||||
}
|
||||
this.originalInput = color;
|
||||
var rgb = inputToRGB(color);
|
||||
this.originalInput = color;
|
||||
this.r = rgb.r;
|
||||
this.g = rgb.g;
|
||||
this.b = rgb.b;
|
||||
this.a = rgb.a;
|
||||
this.roundA = Math.round(100 * this.a) / 100;
|
||||
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
|
||||
this.gradientType = opts.gradientType;
|
||||
if (this.r < 1) {
|
||||
this.r = Math.round(this.r);
|
||||
}
|
||||
if (this.g < 1) {
|
||||
this.g = Math.round(this.g);
|
||||
}
|
||||
if (this.b < 1) {
|
||||
this.b = Math.round(this.b);
|
||||
}
|
||||
this.isValid = rgb.ok;
|
||||
}
|
||||
TinyColor2.prototype.isDark = function() {
|
||||
return this.getBrightness() < 128;
|
||||
};
|
||||
TinyColor2.prototype.isLight = function() {
|
||||
return !this.isDark();
|
||||
};
|
||||
TinyColor2.prototype.getBrightness = function() {
|
||||
var rgb = this.toRgb();
|
||||
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
||||
};
|
||||
TinyColor2.prototype.getLuminance = function() {
|
||||
var rgb = this.toRgb();
|
||||
var R;
|
||||
var G;
|
||||
var B;
|
||||
var RsRGB = rgb.r / 255;
|
||||
var GsRGB = rgb.g / 255;
|
||||
var BsRGB = rgb.b / 255;
|
||||
if (RsRGB <= 0.03928) {
|
||||
R = RsRGB / 12.92;
|
||||
} else {
|
||||
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
if (GsRGB <= 0.03928) {
|
||||
G = GsRGB / 12.92;
|
||||
} else {
|
||||
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
if (BsRGB <= 0.03928) {
|
||||
B = BsRGB / 12.92;
|
||||
} else {
|
||||
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
||||
};
|
||||
TinyColor2.prototype.getAlpha = function() {
|
||||
return this.a;
|
||||
};
|
||||
TinyColor2.prototype.setAlpha = function(alpha) {
|
||||
this.a = boundAlpha(alpha);
|
||||
this.roundA = Math.round(100 * this.a) / 100;
|
||||
return this;
|
||||
};
|
||||
TinyColor2.prototype.toHsv = function() {
|
||||
var hsv = rgbToHsv(this.r, this.g, this.b);
|
||||
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
||||
};
|
||||
TinyColor2.prototype.toHsvString = function() {
|
||||
var hsv = rgbToHsv(this.r, this.g, this.b);
|
||||
var h = Math.round(hsv.h * 360);
|
||||
var s = Math.round(hsv.s * 100);
|
||||
var v = Math.round(hsv.v * 100);
|
||||
return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toHsl = function() {
|
||||
var hsl = rgbToHsl(this.r, this.g, this.b);
|
||||
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
||||
};
|
||||
TinyColor2.prototype.toHslString = function() {
|
||||
var hsl = rgbToHsl(this.r, this.g, this.b);
|
||||
var h = Math.round(hsl.h * 360);
|
||||
var s = Math.round(hsl.s * 100);
|
||||
var l = Math.round(hsl.l * 100);
|
||||
return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toHex = function(allow3Char) {
|
||||
if (allow3Char === void 0) {
|
||||
allow3Char = false;
|
||||
}
|
||||
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
||||
};
|
||||
TinyColor2.prototype.toHexString = function(allow3Char) {
|
||||
if (allow3Char === void 0) {
|
||||
allow3Char = false;
|
||||
}
|
||||
return "#" + this.toHex(allow3Char);
|
||||
};
|
||||
TinyColor2.prototype.toHex8 = function(allow4Char) {
|
||||
if (allow4Char === void 0) {
|
||||
allow4Char = false;
|
||||
}
|
||||
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
||||
};
|
||||
TinyColor2.prototype.toHex8String = function(allow4Char) {
|
||||
if (allow4Char === void 0) {
|
||||
allow4Char = false;
|
||||
}
|
||||
return "#" + this.toHex8(allow4Char);
|
||||
};
|
||||
TinyColor2.prototype.toRgb = function() {
|
||||
return {
|
||||
r: Math.round(this.r),
|
||||
g: Math.round(this.g),
|
||||
b: Math.round(this.b),
|
||||
a: this.a
|
||||
};
|
||||
};
|
||||
TinyColor2.prototype.toRgbString = function() {
|
||||
var r = Math.round(this.r);
|
||||
var g = Math.round(this.g);
|
||||
var b = Math.round(this.b);
|
||||
return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toPercentageRgb = function() {
|
||||
var fmt = function(x) {
|
||||
return "".concat(Math.round(bound01(x, 255) * 100), "%");
|
||||
};
|
||||
return {
|
||||
r: fmt(this.r),
|
||||
g: fmt(this.g),
|
||||
b: fmt(this.b),
|
||||
a: this.a
|
||||
};
|
||||
};
|
||||
TinyColor2.prototype.toPercentageRgbString = function() {
|
||||
var rnd = function(x) {
|
||||
return Math.round(bound01(x, 255) * 100);
|
||||
};
|
||||
return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toName = function() {
|
||||
if (this.a === 0) {
|
||||
return "transparent";
|
||||
}
|
||||
if (this.a < 1) {
|
||||
return false;
|
||||
}
|
||||
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
|
||||
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
|
||||
var _b = _a[_i], key = _b[0], value = _b[1];
|
||||
if (hex === value) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TinyColor2.prototype.toString = function(format) {
|
||||
var formatSet = Boolean(format);
|
||||
format = format !== null && format !== void 0 ? format : this.format;
|
||||
var formattedString = false;
|
||||
var hasAlpha = this.a < 1 && this.a >= 0;
|
||||
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
|
||||
if (needsAlphaFormat) {
|
||||
if (format === "name" && this.a === 0) {
|
||||
return this.toName();
|
||||
}
|
||||
return this.toRgbString();
|
||||
}
|
||||
if (format === "rgb") {
|
||||
formattedString = this.toRgbString();
|
||||
}
|
||||
if (format === "prgb") {
|
||||
formattedString = this.toPercentageRgbString();
|
||||
}
|
||||
if (format === "hex" || format === "hex6") {
|
||||
formattedString = this.toHexString();
|
||||
}
|
||||
if (format === "hex3") {
|
||||
formattedString = this.toHexString(true);
|
||||
}
|
||||
if (format === "hex4") {
|
||||
formattedString = this.toHex8String(true);
|
||||
}
|
||||
if (format === "hex8") {
|
||||
formattedString = this.toHex8String();
|
||||
}
|
||||
if (format === "name") {
|
||||
formattedString = this.toName();
|
||||
}
|
||||
if (format === "hsl") {
|
||||
formattedString = this.toHslString();
|
||||
}
|
||||
if (format === "hsv") {
|
||||
formattedString = this.toHsvString();
|
||||
}
|
||||
return formattedString || this.toHexString();
|
||||
};
|
||||
TinyColor2.prototype.toNumber = function() {
|
||||
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
||||
};
|
||||
TinyColor2.prototype.clone = function() {
|
||||
return new TinyColor2(this.toString());
|
||||
};
|
||||
TinyColor2.prototype.lighten = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.l += amount / 100;
|
||||
hsl.l = clamp01(hsl.l);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.brighten = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var rgb = this.toRgb();
|
||||
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
||||
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
||||
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
||||
return new TinyColor2(rgb);
|
||||
};
|
||||
TinyColor2.prototype.darken = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.l -= amount / 100;
|
||||
hsl.l = clamp01(hsl.l);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.tint = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
return this.mix("white", amount);
|
||||
};
|
||||
TinyColor2.prototype.shade = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
return this.mix("black", amount);
|
||||
};
|
||||
TinyColor2.prototype.desaturate = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.s -= amount / 100;
|
||||
hsl.s = clamp01(hsl.s);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.saturate = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.s += amount / 100;
|
||||
hsl.s = clamp01(hsl.s);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.greyscale = function() {
|
||||
return this.desaturate(100);
|
||||
};
|
||||
TinyColor2.prototype.spin = function(amount) {
|
||||
var hsl = this.toHsl();
|
||||
var hue = (hsl.h + amount) % 360;
|
||||
hsl.h = hue < 0 ? 360 + hue : hue;
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.mix = function(color, amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 50;
|
||||
}
|
||||
var rgb1 = this.toRgb();
|
||||
var rgb2 = new TinyColor2(color).toRgb();
|
||||
var p = amount / 100;
|
||||
var rgba = {
|
||||
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
||||
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
||||
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
||||
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
||||
};
|
||||
return new TinyColor2(rgba);
|
||||
};
|
||||
TinyColor2.prototype.analogous = function(results, slices) {
|
||||
if (results === void 0) {
|
||||
results = 6;
|
||||
}
|
||||
if (slices === void 0) {
|
||||
slices = 30;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
var part = 360 / slices;
|
||||
var ret = [this];
|
||||
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
||||
hsl.h = (hsl.h + part) % 360;
|
||||
ret.push(new TinyColor2(hsl));
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
TinyColor2.prototype.complement = function() {
|
||||
var hsl = this.toHsl();
|
||||
hsl.h = (hsl.h + 180) % 360;
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.monochromatic = function(results) {
|
||||
if (results === void 0) {
|
||||
results = 6;
|
||||
}
|
||||
var hsv = this.toHsv();
|
||||
var h = hsv.h;
|
||||
var s = hsv.s;
|
||||
var v = hsv.v;
|
||||
var res = [];
|
||||
var modification = 1 / results;
|
||||
while (results--) {
|
||||
res.push(new TinyColor2({ h, s, v }));
|
||||
v = (v + modification) % 1;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
TinyColor2.prototype.splitcomplement = function() {
|
||||
var hsl = this.toHsl();
|
||||
var h = hsl.h;
|
||||
return [
|
||||
this,
|
||||
new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
||||
new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
|
||||
];
|
||||
};
|
||||
TinyColor2.prototype.onBackground = function(background) {
|
||||
var fg = this.toRgb();
|
||||
var bg = new TinyColor2(background).toRgb();
|
||||
return new TinyColor2({
|
||||
r: bg.r + (fg.r - bg.r) * fg.a,
|
||||
g: bg.g + (fg.g - bg.g) * fg.a,
|
||||
b: bg.b + (fg.b - bg.b) * fg.a
|
||||
});
|
||||
};
|
||||
TinyColor2.prototype.triad = function() {
|
||||
return this.polyad(3);
|
||||
};
|
||||
TinyColor2.prototype.tetrad = function() {
|
||||
return this.polyad(4);
|
||||
};
|
||||
TinyColor2.prototype.polyad = function(n) {
|
||||
var hsl = this.toHsl();
|
||||
var h = hsl.h;
|
||||
var result = [this];
|
||||
var increment = 360 / n;
|
||||
for (var i = 1; i < n; i++) {
|
||||
result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
TinyColor2.prototype.equals = function(color) {
|
||||
return this.toRgbString() === new TinyColor2(color).toRgbString();
|
||||
};
|
||||
return TinyColor2;
|
||||
}();
|
||||
export { TinyColor as T };
|
2063
package/component/es/_chunks/@intlify/index.js
Normal file
2063
package/component/es/_chunks/@intlify/index.js
Normal file
File diff suppressed because it is too large
Load Diff
5499
package/component/es/_chunks/@umijs/index.js
Normal file
5499
package/component/es/_chunks/@umijs/index.js
Normal file
File diff suppressed because it is too large
Load Diff
216
package/component/es/_chunks/@vue/index.js
Normal file
216
package/component/es/_chunks/@vue/index.js
Normal file
@ -0,0 +1,216 @@
|
||||
const NOOP = () => {
|
||||
};
|
||||
const isArray = Array.isArray;
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isSymbol = (val) => typeof val === "symbol";
|
||||
let activeEffectScope;
|
||||
function recordEffectScope(effect, scope = activeEffectScope) {
|
||||
if (scope && scope.active) {
|
||||
scope.effects.push(effect);
|
||||
}
|
||||
}
|
||||
const createDep = (effects) => {
|
||||
const dep = new Set(effects);
|
||||
dep.w = 0;
|
||||
dep.n = 0;
|
||||
return dep;
|
||||
};
|
||||
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
||||
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
||||
const initDepMarkers = ({ deps }) => {
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].w |= trackOpBit;
|
||||
}
|
||||
}
|
||||
};
|
||||
const finalizeDepMarkers = (effect) => {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
let ptr = 0;
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
const dep = deps[i];
|
||||
if (wasTracked(dep) && !newTracked(dep)) {
|
||||
dep.delete(effect);
|
||||
} else {
|
||||
deps[ptr++] = dep;
|
||||
}
|
||||
dep.w &= ~trackOpBit;
|
||||
dep.n &= ~trackOpBit;
|
||||
}
|
||||
deps.length = ptr;
|
||||
}
|
||||
};
|
||||
let effectTrackDepth = 0;
|
||||
let trackOpBit = 1;
|
||||
const maxMarkerBits = 30;
|
||||
let activeEffect;
|
||||
class ReactiveEffect {
|
||||
constructor(fn, scheduler = null, scope) {
|
||||
this.fn = fn;
|
||||
this.scheduler = scheduler;
|
||||
this.active = true;
|
||||
this.deps = [];
|
||||
this.parent = void 0;
|
||||
recordEffectScope(this, scope);
|
||||
}
|
||||
run() {
|
||||
if (!this.active) {
|
||||
return this.fn();
|
||||
}
|
||||
let parent = activeEffect;
|
||||
let lastShouldTrack = shouldTrack;
|
||||
while (parent) {
|
||||
if (parent === this) {
|
||||
return;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
try {
|
||||
this.parent = activeEffect;
|
||||
activeEffect = this;
|
||||
shouldTrack = true;
|
||||
trackOpBit = 1 << ++effectTrackDepth;
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
initDepMarkers(this);
|
||||
} else {
|
||||
cleanupEffect(this);
|
||||
}
|
||||
return this.fn();
|
||||
} finally {
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
finalizeDepMarkers(this);
|
||||
}
|
||||
trackOpBit = 1 << --effectTrackDepth;
|
||||
activeEffect = this.parent;
|
||||
shouldTrack = lastShouldTrack;
|
||||
this.parent = void 0;
|
||||
if (this.deferStop) {
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
stop() {
|
||||
if (activeEffect === this) {
|
||||
this.deferStop = true;
|
||||
} else if (this.active) {
|
||||
cleanupEffect(this);
|
||||
if (this.onStop) {
|
||||
this.onStop();
|
||||
}
|
||||
this.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function cleanupEffect(effect) {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].delete(effect);
|
||||
}
|
||||
deps.length = 0;
|
||||
}
|
||||
}
|
||||
let shouldTrack = true;
|
||||
function trackEffects(dep, debuggerEventExtraInfo) {
|
||||
let shouldTrack2 = false;
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
if (!newTracked(dep)) {
|
||||
dep.n |= trackOpBit;
|
||||
shouldTrack2 = !wasTracked(dep);
|
||||
}
|
||||
} else {
|
||||
shouldTrack2 = !dep.has(activeEffect);
|
||||
}
|
||||
if (shouldTrack2) {
|
||||
dep.add(activeEffect);
|
||||
activeEffect.deps.push(dep);
|
||||
}
|
||||
}
|
||||
function triggerEffects(dep, debuggerEventExtraInfo) {
|
||||
const effects = isArray(dep) ? dep : [...dep];
|
||||
for (const effect of effects) {
|
||||
if (effect.computed) {
|
||||
triggerEffect(effect);
|
||||
}
|
||||
}
|
||||
for (const effect of effects) {
|
||||
if (!effect.computed) {
|
||||
triggerEffect(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
function triggerEffect(effect, debuggerEventExtraInfo) {
|
||||
if (effect !== activeEffect || effect.allowRecurse) {
|
||||
if (effect.scheduler) {
|
||||
effect.scheduler();
|
||||
} else {
|
||||
effect.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
function trackRefValue(ref) {
|
||||
if (shouldTrack && activeEffect) {
|
||||
ref = toRaw(ref);
|
||||
{
|
||||
trackEffects(ref.dep || (ref.dep = createDep()));
|
||||
}
|
||||
}
|
||||
}
|
||||
function triggerRefValue(ref, newVal) {
|
||||
ref = toRaw(ref);
|
||||
if (ref.dep) {
|
||||
{
|
||||
triggerEffects(ref.dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
class ComputedRefImpl {
|
||||
constructor(getter, _setter, isReadonly, isSSR) {
|
||||
this._setter = _setter;
|
||||
this.dep = void 0;
|
||||
this.__v_isRef = true;
|
||||
this._dirty = true;
|
||||
this.effect = new ReactiveEffect(getter, () => {
|
||||
if (!this._dirty) {
|
||||
this._dirty = true;
|
||||
triggerRefValue(this);
|
||||
}
|
||||
});
|
||||
this.effect.computed = this;
|
||||
this.effect.active = this._cacheable = !isSSR;
|
||||
this["__v_isReadonly"] = isReadonly;
|
||||
}
|
||||
get value() {
|
||||
const self = toRaw(this);
|
||||
trackRefValue(self);
|
||||
if (self._dirty || !self._cacheable) {
|
||||
self._dirty = false;
|
||||
self._value = self.effect.run();
|
||||
}
|
||||
return self._value;
|
||||
}
|
||||
set value(newValue) {
|
||||
this._setter(newValue);
|
||||
}
|
||||
}
|
||||
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
||||
let getter;
|
||||
let setter;
|
||||
const onlyGetter = isFunction(getterOrOptions);
|
||||
if (onlyGetter) {
|
||||
getter = getterOrOptions;
|
||||
setter = NOOP;
|
||||
} else {
|
||||
getter = getterOrOptions.get;
|
||||
setter = getterOrOptions.set;
|
||||
}
|
||||
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
||||
return cRef;
|
||||
}
|
||||
export { computed as c };
|
564
package/component/es/_chunks/@vueuse/index.js
Normal file
564
package/component/es/_chunks/@vueuse/index.js
Normal file
@ -0,0 +1,564 @@
|
||||
import { computed, isRef, reactive, unref, toRefs, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, nextTick, ref, watch, customRef, onUpdated } from "vue";
|
||||
var _a;
|
||||
const isClient = typeof window !== "undefined";
|
||||
const toString = Object.prototype.toString;
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isNumber = (val) => typeof val === "number";
|
||||
const isString = (val) => typeof val === "string";
|
||||
const isObject = (val) => toString.call(val) === "[object Object]";
|
||||
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
||||
const noop = () => {
|
||||
};
|
||||
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
||||
function resolveUnref(r) {
|
||||
return typeof r === "function" ? r() : unref(r);
|
||||
}
|
||||
function createFilterWrapper(filter, fn) {
|
||||
function wrapper(...args) {
|
||||
filter(() => fn.apply(this, args), { fn, thisArg: this, args });
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
function throttleFilter(ms, trailing = true, leading = true) {
|
||||
let lastExec = 0;
|
||||
let timer;
|
||||
let isLeading = true;
|
||||
const clear = () => {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = void 0;
|
||||
}
|
||||
};
|
||||
const filter = (invoke) => {
|
||||
const duration = resolveUnref(ms);
|
||||
const elapsed = Date.now() - lastExec;
|
||||
clear();
|
||||
if (duration <= 0) {
|
||||
lastExec = Date.now();
|
||||
return invoke();
|
||||
}
|
||||
if (elapsed > duration && (leading || !isLeading)) {
|
||||
lastExec = Date.now();
|
||||
invoke();
|
||||
} else if (trailing) {
|
||||
timer = setTimeout(() => {
|
||||
lastExec = Date.now();
|
||||
isLeading = true;
|
||||
clear();
|
||||
invoke();
|
||||
}, duration);
|
||||
}
|
||||
if (!leading && !timer)
|
||||
timer = setTimeout(() => isLeading = true, duration);
|
||||
isLeading = false;
|
||||
};
|
||||
return filter;
|
||||
}
|
||||
function identity(arg) {
|
||||
return arg;
|
||||
}
|
||||
function tryOnScopeDispose(fn) {
|
||||
if (getCurrentScope()) {
|
||||
onScopeDispose(fn);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function toReactive(objectRef) {
|
||||
if (!isRef(objectRef))
|
||||
return reactive(objectRef);
|
||||
const proxy = new Proxy({}, {
|
||||
get(_, p, receiver) {
|
||||
return unref(Reflect.get(objectRef.value, p, receiver));
|
||||
},
|
||||
set(_, p, value) {
|
||||
if (isRef(objectRef.value[p]) && !isRef(value))
|
||||
objectRef.value[p].value = value;
|
||||
else
|
||||
objectRef.value[p] = value;
|
||||
return true;
|
||||
},
|
||||
deleteProperty(_, p) {
|
||||
return Reflect.deleteProperty(objectRef.value, p);
|
||||
},
|
||||
has(_, p) {
|
||||
return Reflect.has(objectRef.value, p);
|
||||
},
|
||||
ownKeys() {
|
||||
return Object.keys(objectRef.value);
|
||||
},
|
||||
getOwnPropertyDescriptor() {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
}
|
||||
});
|
||||
return reactive(proxy);
|
||||
}
|
||||
function reactiveComputed(fn) {
|
||||
return toReactive(computed(fn));
|
||||
}
|
||||
function reactiveOmit(obj, ...keys) {
|
||||
const flatKeys = keys.flat();
|
||||
return reactiveComputed(() => Object.fromEntries(Object.entries(toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
||||
}
|
||||
function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
|
||||
return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
|
||||
}
|
||||
function tryOnMounted(fn, sync = true) {
|
||||
if (getCurrentInstance())
|
||||
onMounted(fn);
|
||||
else if (sync)
|
||||
fn();
|
||||
else
|
||||
nextTick(fn);
|
||||
}
|
||||
function useTimeoutFn(cb, interval, options = {}) {
|
||||
const {
|
||||
immediate = true
|
||||
} = options;
|
||||
const isPending = ref(false);
|
||||
let timer = null;
|
||||
function clear() {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
function stop() {
|
||||
isPending.value = false;
|
||||
clear();
|
||||
}
|
||||
function start(...args) {
|
||||
clear();
|
||||
isPending.value = true;
|
||||
timer = setTimeout(() => {
|
||||
isPending.value = false;
|
||||
timer = null;
|
||||
cb(...args);
|
||||
}, resolveUnref(interval));
|
||||
}
|
||||
if (immediate) {
|
||||
isPending.value = true;
|
||||
if (isClient)
|
||||
start();
|
||||
}
|
||||
tryOnScopeDispose(stop);
|
||||
return {
|
||||
isPending,
|
||||
start,
|
||||
stop
|
||||
};
|
||||
}
|
||||
function unrefElement(elRef) {
|
||||
var _a2;
|
||||
const plain = resolveUnref(elRef);
|
||||
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
|
||||
}
|
||||
const defaultWindow = isClient ? window : void 0;
|
||||
function useEventListener(...args) {
|
||||
let target;
|
||||
let event;
|
||||
let listener;
|
||||
let options;
|
||||
if (isString(args[0])) {
|
||||
[event, listener, options] = args;
|
||||
target = defaultWindow;
|
||||
} else {
|
||||
[target, event, listener, options] = args;
|
||||
}
|
||||
if (!target)
|
||||
return noop;
|
||||
let cleanup = noop;
|
||||
const stopWatch = watch(() => unrefElement(target), (el) => {
|
||||
cleanup();
|
||||
if (!el)
|
||||
return;
|
||||
el.addEventListener(event, listener, options);
|
||||
cleanup = () => {
|
||||
el.removeEventListener(event, listener, options);
|
||||
cleanup = noop;
|
||||
};
|
||||
}, { immediate: true, flush: "post" });
|
||||
const stop = () => {
|
||||
stopWatch();
|
||||
cleanup();
|
||||
};
|
||||
tryOnScopeDispose(stop);
|
||||
return stop;
|
||||
}
|
||||
function onClickOutside(target, handler, options = {}) {
|
||||
const { window: window2 = defaultWindow, ignore, capture = true, detectIframe = false } = options;
|
||||
if (!window2)
|
||||
return;
|
||||
const shouldListen = ref(true);
|
||||
let fallback;
|
||||
const listener = (event) => {
|
||||
window2.clearTimeout(fallback);
|
||||
const el = unrefElement(target);
|
||||
const composedPath = event.composedPath();
|
||||
if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
|
||||
return;
|
||||
if (ignore && ignore.length > 0) {
|
||||
if (ignore.some((target2) => {
|
||||
const el2 = unrefElement(target2);
|
||||
return el2 && (event.target === el2 || composedPath.includes(el2));
|
||||
}))
|
||||
return;
|
||||
}
|
||||
handler(event);
|
||||
};
|
||||
const cleanup = [
|
||||
useEventListener(window2, "click", listener, { passive: true, capture }),
|
||||
useEventListener(window2, "pointerdown", (e) => {
|
||||
const el = unrefElement(target);
|
||||
shouldListen.value = !!el && !e.composedPath().includes(el);
|
||||
}, { passive: true }),
|
||||
useEventListener(window2, "pointerup", (e) => {
|
||||
if (e.button === 0) {
|
||||
const path = e.composedPath();
|
||||
e.composedPath = () => path;
|
||||
fallback = window2.setTimeout(() => listener(e), 50);
|
||||
}
|
||||
}, { passive: true }),
|
||||
detectIframe && useEventListener(window2, "blur", (event) => {
|
||||
var _a2;
|
||||
const el = unrefElement(target);
|
||||
if (((_a2 = document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
|
||||
handler(event);
|
||||
})
|
||||
].filter(Boolean);
|
||||
const stop = () => cleanup.forEach((fn) => fn());
|
||||
return stop;
|
||||
}
|
||||
function templateRef(key, initialValue = null) {
|
||||
const instance = getCurrentInstance();
|
||||
let _trigger = () => {
|
||||
};
|
||||
const element = customRef((track, trigger) => {
|
||||
_trigger = trigger;
|
||||
return {
|
||||
get() {
|
||||
var _a2, _b;
|
||||
track();
|
||||
return (_b = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$refs[key]) != null ? _b : initialValue;
|
||||
},
|
||||
set() {
|
||||
}
|
||||
};
|
||||
});
|
||||
tryOnMounted(_trigger);
|
||||
onUpdated(_trigger);
|
||||
return element;
|
||||
}
|
||||
function useSupported(callback, sync = false) {
|
||||
const isSupported = ref();
|
||||
const update = () => isSupported.value = Boolean(callback());
|
||||
update();
|
||||
tryOnMounted(update, sync);
|
||||
return isSupported;
|
||||
}
|
||||
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
||||
const globalKey = "__vueuse_ssr_handlers__";
|
||||
_global[globalKey] = _global[globalKey] || {};
|
||||
_global[globalKey];
|
||||
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
||||
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
||||
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
||||
var __objRest$2 = (source, exclude) => {
|
||||
var target = {};
|
||||
for (var prop in source)
|
||||
if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
|
||||
target[prop] = source[prop];
|
||||
if (source != null && __getOwnPropSymbols$f)
|
||||
for (var prop of __getOwnPropSymbols$f(source)) {
|
||||
if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
return target;
|
||||
};
|
||||
function useResizeObserver(target, callback, options = {}) {
|
||||
const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
|
||||
let observer;
|
||||
const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
|
||||
const cleanup = () => {
|
||||
if (observer) {
|
||||
observer.disconnect();
|
||||
observer = void 0;
|
||||
}
|
||||
};
|
||||
const stopWatch = watch(() => unrefElement(target), (el) => {
|
||||
cleanup();
|
||||
if (isSupported.value && window2 && el) {
|
||||
observer = new ResizeObserver(callback);
|
||||
observer.observe(el, observerOptions);
|
||||
}
|
||||
}, { immediate: true, flush: "post" });
|
||||
const stop = () => {
|
||||
cleanup();
|
||||
stopWatch();
|
||||
};
|
||||
tryOnScopeDispose(stop);
|
||||
return {
|
||||
isSupported,
|
||||
stop
|
||||
};
|
||||
}
|
||||
function useRafFn(fn, options = {}) {
|
||||
const {
|
||||
immediate = true,
|
||||
window: window2 = defaultWindow
|
||||
} = options;
|
||||
const isActive = ref(false);
|
||||
let rafId = null;
|
||||
function loop() {
|
||||
if (!isActive.value || !window2)
|
||||
return;
|
||||
fn();
|
||||
rafId = window2.requestAnimationFrame(loop);
|
||||
}
|
||||
function resume() {
|
||||
if (!isActive.value && window2) {
|
||||
isActive.value = true;
|
||||
loop();
|
||||
}
|
||||
}
|
||||
function pause() {
|
||||
isActive.value = false;
|
||||
if (rafId != null && window2) {
|
||||
window2.cancelAnimationFrame(rafId);
|
||||
rafId = null;
|
||||
}
|
||||
}
|
||||
if (immediate)
|
||||
resume();
|
||||
tryOnScopeDispose(pause);
|
||||
return {
|
||||
isActive,
|
||||
pause,
|
||||
resume
|
||||
};
|
||||
}
|
||||
function useEyeDropper(options = {}) {
|
||||
const { initialValue = "" } = options;
|
||||
const isSupported = useSupported(() => typeof window !== "undefined" && "EyeDropper" in window);
|
||||
const sRGBHex = ref(initialValue);
|
||||
async function open(openOptions) {
|
||||
if (!isSupported.value)
|
||||
return;
|
||||
const eyeDropper = new window.EyeDropper();
|
||||
const result = await eyeDropper.open(openOptions);
|
||||
sRGBHex.value = result.sRGBHex;
|
||||
return result;
|
||||
}
|
||||
return { isSupported, sRGBHex, open };
|
||||
}
|
||||
function useMousePressed(options = {}) {
|
||||
const {
|
||||
touch = true,
|
||||
drag = true,
|
||||
initialValue = false,
|
||||
window: window2 = defaultWindow
|
||||
} = options;
|
||||
const pressed = ref(initialValue);
|
||||
const sourceType = ref(null);
|
||||
if (!window2) {
|
||||
return {
|
||||
pressed,
|
||||
sourceType
|
||||
};
|
||||
}
|
||||
const onPressed = (srcType) => () => {
|
||||
pressed.value = true;
|
||||
sourceType.value = srcType;
|
||||
};
|
||||
const onReleased = () => {
|
||||
pressed.value = false;
|
||||
sourceType.value = null;
|
||||
};
|
||||
const target = computed(() => unrefElement(options.target) || window2);
|
||||
useEventListener(target, "mousedown", onPressed("mouse"), { passive: true });
|
||||
useEventListener(window2, "mouseleave", onReleased, { passive: true });
|
||||
useEventListener(window2, "mouseup", onReleased, { passive: true });
|
||||
if (drag) {
|
||||
useEventListener(target, "dragstart", onPressed("mouse"), { passive: true });
|
||||
useEventListener(window2, "drop", onReleased, { passive: true });
|
||||
useEventListener(window2, "dragend", onReleased, { passive: true });
|
||||
}
|
||||
if (touch) {
|
||||
useEventListener(target, "touchstart", onPressed("touch"), { passive: true });
|
||||
useEventListener(window2, "touchend", onReleased, { passive: true });
|
||||
useEventListener(window2, "touchcancel", onReleased, { passive: true });
|
||||
}
|
||||
return {
|
||||
pressed,
|
||||
sourceType
|
||||
};
|
||||
}
|
||||
var SwipeDirection;
|
||||
(function(SwipeDirection2) {
|
||||
SwipeDirection2["UP"] = "UP";
|
||||
SwipeDirection2["RIGHT"] = "RIGHT";
|
||||
SwipeDirection2["DOWN"] = "DOWN";
|
||||
SwipeDirection2["LEFT"] = "LEFT";
|
||||
SwipeDirection2["NONE"] = "NONE";
|
||||
})(SwipeDirection || (SwipeDirection = {}));
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __spreadValues = (a, b) => {
|
||||
for (var prop in b || (b = {}))
|
||||
if (__hasOwnProp.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
if (__getOwnPropSymbols)
|
||||
for (var prop of __getOwnPropSymbols(b)) {
|
||||
if (__propIsEnum.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
const _TransitionPresets = {
|
||||
easeInSine: [0.12, 0, 0.39, 0],
|
||||
easeOutSine: [0.61, 1, 0.88, 1],
|
||||
easeInOutSine: [0.37, 0, 0.63, 1],
|
||||
easeInQuad: [0.11, 0, 0.5, 0],
|
||||
easeOutQuad: [0.5, 1, 0.89, 1],
|
||||
easeInOutQuad: [0.45, 0, 0.55, 1],
|
||||
easeInCubic: [0.32, 0, 0.67, 0],
|
||||
easeOutCubic: [0.33, 1, 0.68, 1],
|
||||
easeInOutCubic: [0.65, 0, 0.35, 1],
|
||||
easeInQuart: [0.5, 0, 0.75, 0],
|
||||
easeOutQuart: [0.25, 1, 0.5, 1],
|
||||
easeInOutQuart: [0.76, 0, 0.24, 1],
|
||||
easeInQuint: [0.64, 0, 0.78, 0],
|
||||
easeOutQuint: [0.22, 1, 0.36, 1],
|
||||
easeInOutQuint: [0.83, 0, 0.17, 1],
|
||||
easeInExpo: [0.7, 0, 0.84, 0],
|
||||
easeOutExpo: [0.16, 1, 0.3, 1],
|
||||
easeInOutExpo: [0.87, 0, 0.13, 1],
|
||||
easeInCirc: [0.55, 0, 1, 0.45],
|
||||
easeOutCirc: [0, 0.55, 0.45, 1],
|
||||
easeInOutCirc: [0.85, 0, 0.15, 1],
|
||||
easeInBack: [0.36, 0, 0.66, -0.56],
|
||||
easeOutBack: [0.34, 1.56, 0.64, 1],
|
||||
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
||||
};
|
||||
const TransitionPresets = __spreadValues({
|
||||
linear: identity
|
||||
}, _TransitionPresets);
|
||||
function createEasingFunction([p0, p1, p2, p3]) {
|
||||
const a = (a1, a2) => 1 - 3 * a2 + 3 * a1;
|
||||
const b = (a1, a2) => 3 * a2 - 6 * a1;
|
||||
const c = (a1) => 3 * a1;
|
||||
const calcBezier = (t, a1, a2) => ((a(a1, a2) * t + b(a1, a2)) * t + c(a1)) * t;
|
||||
const getSlope = (t, a1, a2) => 3 * a(a1, a2) * t * t + 2 * b(a1, a2) * t + c(a1);
|
||||
const getTforX = (x) => {
|
||||
let aGuessT = x;
|
||||
for (let i = 0; i < 4; ++i) {
|
||||
const currentSlope = getSlope(aGuessT, p0, p2);
|
||||
if (currentSlope === 0)
|
||||
return aGuessT;
|
||||
const currentX = calcBezier(aGuessT, p0, p2) - x;
|
||||
aGuessT -= currentX / currentSlope;
|
||||
}
|
||||
return aGuessT;
|
||||
};
|
||||
return (x) => p0 === p1 && p2 === p3 ? x : calcBezier(getTforX(x), p1, p3);
|
||||
}
|
||||
function useTransition(source, options = {}) {
|
||||
const {
|
||||
delay = 0,
|
||||
disabled = false,
|
||||
duration = 1e3,
|
||||
onFinished = noop,
|
||||
onStarted = noop,
|
||||
transition = identity
|
||||
} = options;
|
||||
const currentTransition = computed(() => {
|
||||
const t = unref(transition);
|
||||
return isFunction(t) ? t : createEasingFunction(t);
|
||||
});
|
||||
const sourceValue = computed(() => {
|
||||
const s = unref(source);
|
||||
return isNumber(s) ? s : s.map(unref);
|
||||
});
|
||||
const sourceVector = computed(() => isNumber(sourceValue.value) ? [sourceValue.value] : sourceValue.value);
|
||||
const outputVector = ref(sourceVector.value.slice(0));
|
||||
let currentDuration;
|
||||
let diffVector;
|
||||
let endAt;
|
||||
let startAt;
|
||||
let startVector;
|
||||
const { resume, pause } = useRafFn(() => {
|
||||
const now = Date.now();
|
||||
const progress = clamp(1 - (endAt - now) / currentDuration, 0, 1);
|
||||
outputVector.value = startVector.map((val, i) => {
|
||||
var _a2;
|
||||
return val + ((_a2 = diffVector[i]) != null ? _a2 : 0) * currentTransition.value(progress);
|
||||
});
|
||||
if (progress >= 1) {
|
||||
pause();
|
||||
onFinished();
|
||||
}
|
||||
}, { immediate: false });
|
||||
const start = () => {
|
||||
pause();
|
||||
currentDuration = unref(duration);
|
||||
diffVector = outputVector.value.map((n, i) => {
|
||||
var _a2, _b;
|
||||
return ((_a2 = sourceVector.value[i]) != null ? _a2 : 0) - ((_b = outputVector.value[i]) != null ? _b : 0);
|
||||
});
|
||||
startVector = outputVector.value.slice(0);
|
||||
startAt = Date.now();
|
||||
endAt = startAt + currentDuration;
|
||||
resume();
|
||||
onStarted();
|
||||
};
|
||||
const timeout = useTimeoutFn(start, delay, { immediate: false });
|
||||
watch(sourceVector, () => {
|
||||
if (unref(disabled)) {
|
||||
outputVector.value = sourceVector.value.slice(0);
|
||||
} else {
|
||||
if (unref(delay) <= 0)
|
||||
start();
|
||||
else
|
||||
timeout.start();
|
||||
}
|
||||
}, { deep: true });
|
||||
return computed(() => {
|
||||
const targetVector = unref(disabled) ? sourceVector : outputVector;
|
||||
return isNumber(sourceValue.value) ? targetVector.value[0] : targetVector.value;
|
||||
});
|
||||
}
|
||||
function useWindowSize(options = {}) {
|
||||
const {
|
||||
window: window2 = defaultWindow,
|
||||
initialWidth = Infinity,
|
||||
initialHeight = Infinity,
|
||||
listenOrientation = true,
|
||||
includeScrollbar = true
|
||||
} = options;
|
||||
const width = ref(initialWidth);
|
||||
const height = ref(initialHeight);
|
||||
const update = () => {
|
||||
if (window2) {
|
||||
if (includeScrollbar) {
|
||||
width.value = window2.innerWidth;
|
||||
height.value = window2.innerHeight;
|
||||
} else {
|
||||
width.value = window2.document.documentElement.clientWidth;
|
||||
height.value = window2.document.documentElement.clientHeight;
|
||||
}
|
||||
}
|
||||
};
|
||||
update();
|
||||
tryOnMounted(update);
|
||||
useEventListener("resize", update, { passive: true });
|
||||
if (listenOrientation)
|
||||
useEventListener("orientationchange", update, { passive: true });
|
||||
return { width, height };
|
||||
}
|
||||
export { TransitionPresets as T, useResizeObserver as a, useThrottleFn as b, useEventListener as c, useEyeDropper as d, useTransition as e, useMousePressed as f, isObject as i, onClickOutside as o, reactiveOmit as r, templateRef as t, useWindowSize as u };
|
1011
package/component/es/_chunks/async-validator/index.js
Normal file
1011
package/component/es/_chunks/async-validator/index.js
Normal file
File diff suppressed because it is too large
Load Diff
2570
package/component/es/_chunks/cropperjs/index.js
Normal file
2570
package/component/es/_chunks/cropperjs/index.js
Normal file
File diff suppressed because it is too large
Load Diff
208
package/component/es/_chunks/dayjs/index.js
Normal file
208
package/component/es/_chunks/dayjs/index.js
Normal file
@ -0,0 +1,208 @@
|
||||
import { c as commonjsGlobal } from "../@umijs/index.js";
|
||||
var dayjs_min = { exports: {} };
|
||||
(function(module, exports) {
|
||||
!function(t, e) {
|
||||
module.exports = e();
|
||||
}(commonjsGlobal, function() {
|
||||
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_") }, m = function(t2, e2, n2) {
|
||||
var r2 = String(t2);
|
||||
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
||||
}, g = { s: m, z: function(t2) {
|
||||
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
||||
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
||||
}, m: function t2(e2, n2) {
|
||||
if (e2.date() < n2.date())
|
||||
return -t2(n2, e2);
|
||||
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
|
||||
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
||||
}, a: function(t2) {
|
||||
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
||||
}, p: function(t2) {
|
||||
return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
||||
}, u: function(t2) {
|
||||
return void 0 === t2;
|
||||
} }, v = "en", D = {};
|
||||
D[v] = M;
|
||||
var p = function(t2) {
|
||||
return t2 instanceof _;
|
||||
}, S = function t2(e2, n2, r2) {
|
||||
var i2;
|
||||
if (!e2)
|
||||
return v;
|
||||
if ("string" == typeof e2) {
|
||||
var s2 = e2.toLowerCase();
|
||||
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
||||
var u2 = e2.split("-");
|
||||
if (!i2 && u2.length > 1)
|
||||
return t2(u2[0]);
|
||||
} else {
|
||||
var a2 = e2.name;
|
||||
D[a2] = e2, i2 = a2;
|
||||
}
|
||||
return !r2 && i2 && (v = i2), i2 || !r2 && v;
|
||||
}, w = function(t2, e2) {
|
||||
if (p(t2))
|
||||
return t2.clone();
|
||||
var n2 = "object" == typeof e2 ? e2 : {};
|
||||
return n2.date = t2, n2.args = arguments, new _(n2);
|
||||
}, O = g;
|
||||
O.l = S, O.i = p, O.w = function(t2, e2) {
|
||||
return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
||||
};
|
||||
var _ = function() {
|
||||
function M2(t2) {
|
||||
this.$L = S(t2.locale, null, true), this.parse(t2);
|
||||
}
|
||||
var m2 = M2.prototype;
|
||||
return m2.parse = function(t2) {
|
||||
this.$d = function(t3) {
|
||||
var e2 = t3.date, n2 = t3.utc;
|
||||
if (null === e2)
|
||||
return new Date(NaN);
|
||||
if (O.u(e2))
|
||||
return new Date();
|
||||
if (e2 instanceof Date)
|
||||
return new Date(e2);
|
||||
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
||||
var r2 = e2.match(l);
|
||||
if (r2) {
|
||||
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
||||
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
||||
}
|
||||
}
|
||||
return new Date(e2);
|
||||
}(t2), this.$x = t2.x || {}, this.init();
|
||||
}, m2.init = function() {
|
||||
var t2 = this.$d;
|
||||
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
||||
}, m2.$utils = function() {
|
||||
return O;
|
||||
}, m2.isValid = function() {
|
||||
return !(this.$d.toString() === $);
|
||||
}, m2.isSame = function(t2, e2) {
|
||||
var n2 = w(t2);
|
||||
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
||||
}, m2.isAfter = function(t2, e2) {
|
||||
return w(t2) < this.startOf(e2);
|
||||
}, m2.isBefore = function(t2, e2) {
|
||||
return this.endOf(e2) < w(t2);
|
||||
}, m2.$g = function(t2, e2, n2) {
|
||||
return O.u(t2) ? this[e2] : this.set(n2, t2);
|
||||
}, m2.unix = function() {
|
||||
return Math.floor(this.valueOf() / 1e3);
|
||||
}, m2.valueOf = function() {
|
||||
return this.$d.getTime();
|
||||
}, m2.startOf = function(t2, e2) {
|
||||
var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
|
||||
var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
||||
return r2 ? i2 : i2.endOf(a);
|
||||
}, l2 = function(t3, e3) {
|
||||
return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
||||
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
|
||||
switch (h2) {
|
||||
case c:
|
||||
return r2 ? $2(1, 0) : $2(31, 11);
|
||||
case f:
|
||||
return r2 ? $2(1, M3) : $2(0, M3 + 1);
|
||||
case o:
|
||||
var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2;
|
||||
return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
||||
case a:
|
||||
case d:
|
||||
return l2(g2 + "Hours", 0);
|
||||
case u:
|
||||
return l2(g2 + "Minutes", 1);
|
||||
case s:
|
||||
return l2(g2 + "Seconds", 2);
|
||||
case i:
|
||||
return l2(g2 + "Milliseconds", 3);
|
||||
default:
|
||||
return this.clone();
|
||||
}
|
||||
}, m2.endOf = function(t2) {
|
||||
return this.startOf(t2, false);
|
||||
}, m2.$set = function(t2, e2) {
|
||||
var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
||||
if (o2 === f || o2 === c) {
|
||||
var y2 = this.clone().set(d, 1);
|
||||
y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
||||
} else
|
||||
$2 && this.$d[$2](l2);
|
||||
return this.init(), this;
|
||||
}, m2.set = function(t2, e2) {
|
||||
return this.clone().$set(t2, e2);
|
||||
}, m2.get = function(t2) {
|
||||
return this[O.p(t2)]();
|
||||
}, m2.add = function(r2, h2) {
|
||||
var d2, $2 = this;
|
||||
r2 = Number(r2);
|
||||
var l2 = O.p(h2), y2 = function(t2) {
|
||||
var e2 = w($2);
|
||||
return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
|
||||
};
|
||||
if (l2 === f)
|
||||
return this.set(f, this.$M + r2);
|
||||
if (l2 === c)
|
||||
return this.set(c, this.$y + r2);
|
||||
if (l2 === a)
|
||||
return y2(1);
|
||||
if (l2 === o)
|
||||
return y2(7);
|
||||
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
||||
return O.w(m3, this);
|
||||
}, m2.subtract = function(t2, e2) {
|
||||
return this.add(-1 * t2, e2);
|
||||
}, m2.format = function(t2) {
|
||||
var e2 = this, n2 = this.$locale();
|
||||
if (!this.isValid())
|
||||
return n2.invalidDate || $;
|
||||
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
|
||||
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].substr(0, s3);
|
||||
}, c2 = function(t3) {
|
||||
return O.s(s2 % 12 || 12, t3, "0");
|
||||
}, d2 = n2.meridiem || function(t3, e3, n3) {
|
||||
var r3 = t3 < 12 ? "AM" : "PM";
|
||||
return n3 ? r3.toLowerCase() : r3;
|
||||
}, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
|
||||
return r2.replace(y, function(t3, e3) {
|
||||
return e3 || l2[t3] || i2.replace(":", "");
|
||||
});
|
||||
}, m2.utcOffset = function() {
|
||||
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
||||
}, m2.diff = function(r2, d2, $2) {
|
||||
var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3);
|
||||
return v2 = (l2 = {}, l2[c] = v2 / 12, l2[f] = v2, l2[h] = v2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? v2 : O.a(v2);
|
||||
}, m2.daysInMonth = function() {
|
||||
return this.endOf(f).$D;
|
||||
}, m2.$locale = function() {
|
||||
return D[this.$L];
|
||||
}, m2.locale = function(t2, e2) {
|
||||
if (!t2)
|
||||
return this.$L;
|
||||
var n2 = this.clone(), r2 = S(t2, e2, true);
|
||||
return r2 && (n2.$L = r2), n2;
|
||||
}, m2.clone = function() {
|
||||
return O.w(this.$d, this);
|
||||
}, m2.toDate = function() {
|
||||
return new Date(this.valueOf());
|
||||
}, m2.toJSON = function() {
|
||||
return this.isValid() ? this.toISOString() : null;
|
||||
}, m2.toISOString = function() {
|
||||
return this.$d.toISOString();
|
||||
}, m2.toString = function() {
|
||||
return this.$d.toUTCString();
|
||||
}, M2;
|
||||
}(), b = _.prototype;
|
||||
return w.prototype = b, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
|
||||
b[t2[1]] = function(e2) {
|
||||
return this.$g(e2, t2[0], t2[1]);
|
||||
};
|
||||
}), w.extend = function(t2, e2) {
|
||||
return t2.$i || (t2(e2, _, w), t2.$i = true), w;
|
||||
}, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
|
||||
return w(1e3 * t2);
|
||||
}, w.en = D[v], w.Ls = D, w.p = {}, w;
|
||||
});
|
||||
})(dayjs_min);
|
||||
var dayjs = dayjs_min.exports;
|
||||
export { dayjs as d };
|
311
package/component/es/_chunks/evtd/index.js
Normal file
311
package/component/es/_chunks/evtd/index.js
Normal file
@ -0,0 +1,311 @@
|
||||
const traps = {
|
||||
mousemoveoutside: /* @__PURE__ */ new WeakMap(),
|
||||
clickoutside: /* @__PURE__ */ new WeakMap()
|
||||
};
|
||||
function createTrapHandler(name, el, originalHandler) {
|
||||
if (name === "mousemoveoutside") {
|
||||
const moveHandler = (e) => {
|
||||
if (el.contains(e.target))
|
||||
return;
|
||||
originalHandler(e);
|
||||
};
|
||||
return {
|
||||
mousemove: moveHandler,
|
||||
touchstart: moveHandler
|
||||
};
|
||||
} else if (name === "clickoutside") {
|
||||
let mouseDownOutside = false;
|
||||
const downHandler = (e) => {
|
||||
mouseDownOutside = !el.contains(e.target);
|
||||
};
|
||||
const upHanlder = (e) => {
|
||||
if (!mouseDownOutside)
|
||||
return;
|
||||
if (el.contains(e.target))
|
||||
return;
|
||||
originalHandler(e);
|
||||
};
|
||||
return {
|
||||
mousedown: downHandler,
|
||||
mouseup: upHanlder,
|
||||
touchstart: downHandler,
|
||||
touchend: upHanlder
|
||||
};
|
||||
}
|
||||
console.error(`[evtd/create-trap-handler]: name \`${name}\` is invalid. This could be a bug of evtd.`);
|
||||
return {};
|
||||
}
|
||||
function ensureTrapHandlers(name, el, handler) {
|
||||
const handlers = traps[name];
|
||||
let elHandlers = handlers.get(el);
|
||||
if (elHandlers === void 0) {
|
||||
handlers.set(el, elHandlers = /* @__PURE__ */ new WeakMap());
|
||||
}
|
||||
let trapHandler = elHandlers.get(handler);
|
||||
if (trapHandler === void 0) {
|
||||
elHandlers.set(handler, trapHandler = createTrapHandler(name, el, handler));
|
||||
}
|
||||
return trapHandler;
|
||||
}
|
||||
function trapOn(name, el, handler, options) {
|
||||
if (name === "mousemoveoutside" || name === "clickoutside") {
|
||||
const trapHandlers = ensureTrapHandlers(name, el, handler);
|
||||
Object.keys(trapHandlers).forEach((key) => {
|
||||
on(key, document, trapHandlers[key], options);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function trapOff(name, el, handler, options) {
|
||||
if (name === "mousemoveoutside" || name === "clickoutside") {
|
||||
const trapHandlers = ensureTrapHandlers(name, el, handler);
|
||||
Object.keys(trapHandlers).forEach((key) => {
|
||||
off(key, document, trapHandlers[key], options);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function createDelegate() {
|
||||
if (typeof window === "undefined") {
|
||||
return {
|
||||
on: () => {
|
||||
},
|
||||
off: () => {
|
||||
}
|
||||
};
|
||||
}
|
||||
const propagationStopped = /* @__PURE__ */ new WeakMap();
|
||||
const immediatePropagationStopped = /* @__PURE__ */ new WeakMap();
|
||||
function trackPropagation() {
|
||||
propagationStopped.set(this, true);
|
||||
}
|
||||
function trackImmediate() {
|
||||
propagationStopped.set(this, true);
|
||||
immediatePropagationStopped.set(this, true);
|
||||
}
|
||||
function spy(event, propName, fn) {
|
||||
const source = event[propName];
|
||||
event[propName] = function() {
|
||||
fn.apply(event, arguments);
|
||||
return source.apply(event, arguments);
|
||||
};
|
||||
return event;
|
||||
}
|
||||
function unspy(event, propName) {
|
||||
event[propName] = Event.prototype[propName];
|
||||
}
|
||||
const currentTargets = /* @__PURE__ */ new WeakMap();
|
||||
const currentTargetDescriptor = Object.getOwnPropertyDescriptor(Event.prototype, "currentTarget");
|
||||
function getCurrentTarget() {
|
||||
var _a;
|
||||
return (_a = currentTargets.get(this)) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
function defineCurrentTarget(event, getter) {
|
||||
if (currentTargetDescriptor === void 0)
|
||||
return;
|
||||
Object.defineProperty(event, "currentTarget", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: getter !== null && getter !== void 0 ? getter : currentTargetDescriptor.get
|
||||
});
|
||||
}
|
||||
const phaseToTypeToElToHandlers = {
|
||||
bubble: {},
|
||||
capture: {}
|
||||
};
|
||||
const typeToWindowEventHandlers = {};
|
||||
function createUnifiedHandler() {
|
||||
const delegeteHandler = function(e) {
|
||||
const { type, eventPhase, target, bubbles } = e;
|
||||
if (eventPhase === 2)
|
||||
return;
|
||||
const phase = eventPhase === 1 ? "capture" : "bubble";
|
||||
let cursor = target;
|
||||
const path = [];
|
||||
while (true) {
|
||||
if (cursor === null)
|
||||
cursor = window;
|
||||
path.push(cursor);
|
||||
if (cursor === window) {
|
||||
break;
|
||||
}
|
||||
cursor = cursor.parentNode || null;
|
||||
}
|
||||
const captureElToHandlers = phaseToTypeToElToHandlers.capture[type];
|
||||
const bubbleElToHandlers = phaseToTypeToElToHandlers.bubble[type];
|
||||
spy(e, "stopPropagation", trackPropagation);
|
||||
spy(e, "stopImmediatePropagation", trackImmediate);
|
||||
defineCurrentTarget(e, getCurrentTarget);
|
||||
if (phase === "capture") {
|
||||
if (captureElToHandlers === void 0)
|
||||
return;
|
||||
for (let i = path.length - 1; i >= 0; --i) {
|
||||
if (propagationStopped.has(e))
|
||||
break;
|
||||
const target2 = path[i];
|
||||
const handlers = captureElToHandlers.get(target2);
|
||||
if (handlers !== void 0) {
|
||||
currentTargets.set(e, target2);
|
||||
for (const handler of handlers) {
|
||||
if (immediatePropagationStopped.has(e))
|
||||
break;
|
||||
handler(e);
|
||||
}
|
||||
}
|
||||
if (i === 0 && !bubbles && bubbleElToHandlers !== void 0) {
|
||||
const bubbleHandlers = bubbleElToHandlers.get(target2);
|
||||
if (bubbleHandlers !== void 0) {
|
||||
for (const handler of bubbleHandlers) {
|
||||
if (immediatePropagationStopped.has(e))
|
||||
break;
|
||||
handler(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (phase === "bubble") {
|
||||
if (bubbleElToHandlers === void 0)
|
||||
return;
|
||||
for (let i = 0; i < path.length; ++i) {
|
||||
if (propagationStopped.has(e))
|
||||
break;
|
||||
const target2 = path[i];
|
||||
const handlers = bubbleElToHandlers.get(target2);
|
||||
if (handlers !== void 0) {
|
||||
currentTargets.set(e, target2);
|
||||
for (const handler of handlers) {
|
||||
if (immediatePropagationStopped.has(e))
|
||||
break;
|
||||
handler(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unspy(e, "stopPropagation");
|
||||
unspy(e, "stopImmediatePropagation");
|
||||
defineCurrentTarget(e);
|
||||
};
|
||||
delegeteHandler.displayName = "evtdUnifiedHandler";
|
||||
return delegeteHandler;
|
||||
}
|
||||
function createUnifiedWindowEventHandler() {
|
||||
const delegateHandler = function(e) {
|
||||
const { type, eventPhase } = e;
|
||||
if (eventPhase !== 2)
|
||||
return;
|
||||
const handlers = typeToWindowEventHandlers[type];
|
||||
if (handlers === void 0)
|
||||
return;
|
||||
handlers.forEach((handler) => handler(e));
|
||||
};
|
||||
delegateHandler.displayName = "evtdUnifiedWindowEventHandler";
|
||||
return delegateHandler;
|
||||
}
|
||||
const unifiedHandler = createUnifiedHandler();
|
||||
const unfiendWindowEventHandler = createUnifiedWindowEventHandler();
|
||||
function ensureElToHandlers(phase, type) {
|
||||
const phaseHandlers = phaseToTypeToElToHandlers[phase];
|
||||
if (phaseHandlers[type] === void 0) {
|
||||
phaseHandlers[type] = /* @__PURE__ */ new Map();
|
||||
window.addEventListener(type, unifiedHandler, phase === "capture");
|
||||
}
|
||||
return phaseHandlers[type];
|
||||
}
|
||||
function ensureWindowEventHandlers(type) {
|
||||
const windowEventHandlers = typeToWindowEventHandlers[type];
|
||||
if (windowEventHandlers === void 0) {
|
||||
typeToWindowEventHandlers[type] = /* @__PURE__ */ new Set();
|
||||
window.addEventListener(type, unfiendWindowEventHandler);
|
||||
}
|
||||
return typeToWindowEventHandlers[type];
|
||||
}
|
||||
function ensureHandlers(elToHandlers, el) {
|
||||
let elHandlers = elToHandlers.get(el);
|
||||
if (elHandlers === void 0) {
|
||||
elToHandlers.set(el, elHandlers = /* @__PURE__ */ new Set());
|
||||
}
|
||||
return elHandlers;
|
||||
}
|
||||
function handlerExist(el, phase, type, handler) {
|
||||
const elToHandlers = phaseToTypeToElToHandlers[phase][type];
|
||||
if (elToHandlers !== void 0) {
|
||||
const handlers = elToHandlers.get(el);
|
||||
if (handlers !== void 0) {
|
||||
if (handlers.has(handler))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function windowEventHandlerExist(type, handler) {
|
||||
const handlers = typeToWindowEventHandlers[type];
|
||||
if (handlers !== void 0) {
|
||||
if (handlers.has(handler)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function on2(type, el, handler, options) {
|
||||
let mergedHandler;
|
||||
if (typeof options === "object" && options.once === true) {
|
||||
mergedHandler = (e) => {
|
||||
off2(type, el, mergedHandler, options);
|
||||
handler(e);
|
||||
};
|
||||
} else {
|
||||
mergedHandler = handler;
|
||||
}
|
||||
const trapped = trapOn(type, el, mergedHandler, options);
|
||||
if (trapped)
|
||||
return;
|
||||
const phase = options === true || typeof options === "object" && options.capture === true ? "capture" : "bubble";
|
||||
const elToHandlers = ensureElToHandlers(phase, type);
|
||||
const handlers = ensureHandlers(elToHandlers, el);
|
||||
if (!handlers.has(mergedHandler))
|
||||
handlers.add(mergedHandler);
|
||||
if (el === window) {
|
||||
const windowEventHandlers = ensureWindowEventHandlers(type);
|
||||
if (!windowEventHandlers.has(mergedHandler)) {
|
||||
windowEventHandlers.add(mergedHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
function off2(type, el, handler, options) {
|
||||
const trapped = trapOff(type, el, handler, options);
|
||||
if (trapped)
|
||||
return;
|
||||
const capture = options === true || typeof options === "object" && options.capture === true;
|
||||
const phase = capture ? "capture" : "bubble";
|
||||
const elToHandlers = ensureElToHandlers(phase, type);
|
||||
const handlers = ensureHandlers(elToHandlers, el);
|
||||
if (el === window) {
|
||||
const mirrorPhase = capture ? "bubble" : "capture";
|
||||
if (!handlerExist(el, mirrorPhase, type, handler) && windowEventHandlerExist(type, handler)) {
|
||||
const windowEventHandlers = typeToWindowEventHandlers[type];
|
||||
windowEventHandlers.delete(handler);
|
||||
if (windowEventHandlers.size === 0) {
|
||||
window.removeEventListener(type, unfiendWindowEventHandler);
|
||||
typeToWindowEventHandlers[type] = void 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (handlers.has(handler))
|
||||
handlers.delete(handler);
|
||||
if (handlers.size === 0) {
|
||||
elToHandlers.delete(el);
|
||||
}
|
||||
if (elToHandlers.size === 0) {
|
||||
window.removeEventListener(type, unifiedHandler, phase === "capture");
|
||||
phaseToTypeToElToHandlers[phase][type] = void 0;
|
||||
}
|
||||
}
|
||||
return {
|
||||
on: on2,
|
||||
off: off2
|
||||
};
|
||||
}
|
||||
const { on, off } = createDelegate();
|
||||
export { off as a, on as o };
|
1
package/component/es/_chunks/vue-demi/index.js
Normal file
1
package/component/es/_chunks/vue-demi/index.js
Normal file
@ -0,0 +1 @@
|
||||
import "vue";
|
1172
package/component/es/_chunks/vue-i18n/index.js
Normal file
1172
package/component/es/_chunks/vue-i18n/index.js
Normal file
File diff suppressed because it is too large
Load Diff
1
package/component/es/affix/index.css
Normal file
1
package/component/es/affix/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-affix{display:block;z-index:999;transition:all .3s ease-in-out}
|
119
package/component/es/affix/index.js
Normal file
119
package/component/es/affix/index.js
Normal file
@ -0,0 +1,119 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, computed, onMounted, nextTick, onUnmounted, openBlock, createElementBlock, normalizeStyle, unref, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-affix{display:block;z-index:999;transition:all .3s ease-in-out}\n")();
|
||||
const __default__ = {
|
||||
name: "LayAffix"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
offset: { default: 0 },
|
||||
target: { default: () => {
|
||||
return document.body;
|
||||
} },
|
||||
position: { default: "top" }
|
||||
},
|
||||
emits: ["scroll"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const outWindow = ref(false);
|
||||
const dom = ref();
|
||||
let changeScrollTop = 0;
|
||||
let orginOffsetLeft = 0;
|
||||
let marginLeft = 0;
|
||||
let marginTop = 0;
|
||||
let marginBottom = 0;
|
||||
let fixedOffset = 0;
|
||||
const getStyle = computed(() => {
|
||||
if (outWindow.value && dom.value) {
|
||||
let style = {
|
||||
position: "fixed !important",
|
||||
top: "unset",
|
||||
bottom: "unset",
|
||||
left: orginOffsetLeft - marginLeft + "px"
|
||||
};
|
||||
if (props.position === "top") {
|
||||
style.top = fixedOffset - marginTop + "px";
|
||||
} else {
|
||||
style.bottom = fixedOffset - marginBottom + "px";
|
||||
}
|
||||
return style;
|
||||
}
|
||||
});
|
||||
const checkInWindow = () => {
|
||||
var _a;
|
||||
if (dom.value) {
|
||||
let offsetTop = dom.value.offsetTop;
|
||||
let scrollTop = (_a = props.target) == null ? void 0 : _a.scrollTop;
|
||||
if (props.position === "top") {
|
||||
let result = offsetTop - scrollTop + props.target.offsetTop;
|
||||
if (result < fixedOffset) {
|
||||
if (outWindow.value) {
|
||||
if (scrollTop <= changeScrollTop) {
|
||||
outWindow.value = false;
|
||||
}
|
||||
} else {
|
||||
changeScrollTop = scrollTop;
|
||||
outWindow.value = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let viewHeight = props.target.offsetHeight > window.innerHeight ? window.innerHeight : props.target.offsetHeight;
|
||||
let result = viewHeight + scrollTop - offsetTop - dom.value.offsetHeight;
|
||||
if (outWindow.value) {
|
||||
if (scrollTop >= changeScrollTop) {
|
||||
outWindow.value = false;
|
||||
}
|
||||
} else {
|
||||
if (result < fixedOffset) {
|
||||
changeScrollTop = scrollTop - result + props.offset;
|
||||
outWindow.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
emit("scroll", {
|
||||
targetScroll: scrollTop,
|
||||
affixed: outWindow.value,
|
||||
offset: !outWindow.value ? 0 : Math.abs(scrollTop - changeScrollTop)
|
||||
});
|
||||
}
|
||||
};
|
||||
const getDomStyle = (dom2, attr) => {
|
||||
if (dom2.currentStyle) {
|
||||
return dom2.currentStyle[attr];
|
||||
} else {
|
||||
return document.defaultView.getComputedStyle(dom2, null)[attr];
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
dom.value.offsetTop - props.target.offsetTop;
|
||||
orginOffsetLeft = dom.value.getBoundingClientRect().left;
|
||||
marginLeft = parseFloat(getDomStyle(dom.value, "marginLeft"));
|
||||
marginTop = parseFloat(getDomStyle(dom.value, "marginTop"));
|
||||
marginBottom = parseFloat(getDomStyle(dom.value, "marginBottom"));
|
||||
fixedOffset = props.offset + props.target.offsetTop;
|
||||
if (props.position === "bottom") {
|
||||
fixedOffset = props.offset;
|
||||
}
|
||||
props.target.addEventListener("scroll", checkInWindow, true);
|
||||
checkInWindow();
|
||||
});
|
||||
});
|
||||
onUnmounted(() => {
|
||||
props.target.removeEventListener("scroll", checkInWindow);
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: "layui-affix",
|
||||
style: normalizeStyle(unref(getStyle)),
|
||||
ref_key: "dom",
|
||||
ref: dom
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 4);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/avatar/index.css
Normal file
1
package/component/es/avatar/index.css
Normal file
@ -0,0 +1 @@
|
||||
.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}
|
51
package/component/es/avatar/index.js
Normal file
51
package/component/es/avatar/index.js
Normal file
@ -0,0 +1,51 @@
|
||||
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";
|
||||
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__ = {
|
||||
name: "LayAvatar"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
src: null,
|
||||
size: { default: "md" },
|
||||
radius: { type: Boolean, default: false },
|
||||
icon: { default: "layui-icon-username" },
|
||||
alt: null
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const slot = useSlots();
|
||||
const classes = computed(() => {
|
||||
return [
|
||||
"layui-avatar",
|
||||
props.radius ? "layui-avatar-radius" : "",
|
||||
props.size ? `layui-avatar-${props.size}` : ""
|
||||
];
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return unref(slot).default ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass(unref(classes))
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 2)) : (openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
class: normalizeClass(unref(classes))
|
||||
}, [
|
||||
__props.src ? (openBlock(), createElementBlock("img", {
|
||||
key: 0,
|
||||
src: __props.src,
|
||||
alt: __props.alt
|
||||
}, null, 8, _hoisted_1)) : (openBlock(), createBlock(unref(_sfc_main$2E), {
|
||||
key: 1,
|
||||
type: __props.icon
|
||||
}, null, 8, ["type"]))
|
||||
], 2));
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
15
package/component/es/avatarList/index.js
Normal file
15
package/component/es/avatarList/index.js
Normal file
@ -0,0 +1,15 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { openBlock, createElementBlock, renderSlot } from "vue";
|
||||
import { _ as _export_sfc } from "../dropdownMenu/index2.js";
|
||||
const _sfc_main = {
|
||||
name: "LayAvatarList"
|
||||
};
|
||||
const _hoisted_1 = { class: "layui-avatar-list" };
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
}
|
||||
var Component = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
const component = withInstall(Component);
|
||||
export { component as default };
|
1
package/component/es/backTop/index.css
Normal file
1
package/component/es/backTop/index.css
Normal file
@ -0,0 +1 @@
|
||||
.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}
|
178
package/component/es/backTop/index.js
Normal file
178
package/component/es/backTop/index.js
Normal file
@ -0,0 +1,178 @@
|
||||
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";
|
||||
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__ = {
|
||||
name: "LayBacktop"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
target: { default: "window" },
|
||||
showHeight: { default: 200 },
|
||||
disabled: { type: Boolean, default: false },
|
||||
position: null,
|
||||
right: null,
|
||||
bottom: null,
|
||||
size: null,
|
||||
bgcolor: null,
|
||||
opacity: null,
|
||||
color: null,
|
||||
borderRadius: null,
|
||||
circle: { type: Boolean, default: false },
|
||||
icon: { default: "layui-icon-top" },
|
||||
iconSize: { default: 30 },
|
||||
iconColor: null
|
||||
},
|
||||
emits: ["click"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const backtopRef = ref(null);
|
||||
const scrollTarget = shallowRef(void 0);
|
||||
let visible = ref(props.showHeight === 0);
|
||||
const classBacktop = computed(() => {
|
||||
return {
|
||||
"layui-backtop-medium": props.size === "medium",
|
||||
"layui-backtop-small": props.size === "small"
|
||||
};
|
||||
});
|
||||
const borderRadius = computed(() => {
|
||||
if (props.circle) {
|
||||
return "50%";
|
||||
}
|
||||
return typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius;
|
||||
});
|
||||
const styleBacktop = computed(() => {
|
||||
return {
|
||||
position: props.position,
|
||||
right: `${props.right}px`,
|
||||
bottom: `${props.bottom}px`,
|
||||
backgroundColor: props.bgcolor,
|
||||
opacity: props.opacity,
|
||||
color: props.color,
|
||||
borderRadius: borderRadius.value
|
||||
};
|
||||
});
|
||||
const easeInOut = (value) => {
|
||||
return value < 0.5 ? 2 * value * value : 1 - 2 * (value - 1) * (value - 1);
|
||||
};
|
||||
const scrollToTop = () => {
|
||||
if (!scrollTarget.value)
|
||||
return;
|
||||
if (scrollTarget.value instanceof Window) {
|
||||
window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
|
||||
} else {
|
||||
const previous = Date.now();
|
||||
const scrollHeight = scrollTarget.value.scrollTop;
|
||||
const animationFunc = () => {
|
||||
if (!scrollTarget.value || scrollTarget.value instanceof Window)
|
||||
return;
|
||||
const elapsed = (Date.now() - previous) / 450;
|
||||
if (elapsed < 1) {
|
||||
scrollTarget.value.scrollTop = scrollHeight * (1 - easeInOut(elapsed));
|
||||
window.requestAnimationFrame(animationFunc);
|
||||
} else {
|
||||
scrollTarget.value.scrollTop = 0;
|
||||
}
|
||||
};
|
||||
window.requestAnimationFrame(animationFunc);
|
||||
}
|
||||
};
|
||||
const handleScroll = () => {
|
||||
if (!scrollTarget.value)
|
||||
return;
|
||||
const scrollTop = scrollTarget.value instanceof Window ? window.pageYOffset : scrollTarget.value.scrollTop;
|
||||
visible.value = scrollTop >= props.showHeight;
|
||||
};
|
||||
const handleClick = (event) => {
|
||||
if (!props.disabled) {
|
||||
scrollToTop();
|
||||
}
|
||||
emit("click", event);
|
||||
};
|
||||
const handlerMousedown = () => {
|
||||
backtopRef.value.style.opacity = "1";
|
||||
};
|
||||
const handlerMouseup = () => {
|
||||
backtopRef.value.style.opacity = "0.95";
|
||||
};
|
||||
const getScrollTarget = () => {
|
||||
if (props.target === "window") {
|
||||
return getScrollParent(backtopRef.value, false);
|
||||
} else {
|
||||
const targetElement = document.querySelector(props.target);
|
||||
if (!targetElement) {
|
||||
throw new Error(`target is not existed: ${props.target}`);
|
||||
}
|
||||
if (props.position === "absolute") {
|
||||
if (!targetElement.parentElement) {
|
||||
throw new Error(`target parent element is not existed: ${props.target}`);
|
||||
}
|
||||
targetElement.parentElement.style.position = "relative";
|
||||
}
|
||||
return targetElement;
|
||||
}
|
||||
};
|
||||
const getScrollParent = (element, includeHidden) => {
|
||||
let style = getComputedStyle(element);
|
||||
let excludeStaticParent = style.position === "absolute";
|
||||
let overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
|
||||
for (let parent = element; parent = parent.parentElement; ) {
|
||||
style = getComputedStyle(parent);
|
||||
if (excludeStaticParent && style.position === "static") {
|
||||
continue;
|
||||
}
|
||||
if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
};
|
||||
const throttle = (func, wait) => {
|
||||
var timer = null;
|
||||
return (...args) => {
|
||||
if (!timer) {
|
||||
timer = setTimeout(() => {
|
||||
timer = null;
|
||||
func.apply(this, args);
|
||||
}, wait);
|
||||
}
|
||||
};
|
||||
};
|
||||
const callback = throttle(handleScroll, 300);
|
||||
onMounted(() => {
|
||||
if (!props.target)
|
||||
return;
|
||||
scrollTarget.value = getScrollTarget();
|
||||
scrollTarget.value.addEventListener("scroll", callback);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
var _a;
|
||||
(_a = scrollTarget.value) == null ? void 0 : _a.removeEventListener("scroll", callback);
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return withDirectives((openBlock(), createElementBlock("div", {
|
||||
ref_key: "backtopRef",
|
||||
ref: backtopRef,
|
||||
class: normalizeClass(["layui-backtop", unref(classBacktop)]),
|
||||
style: normalizeStyle({ ...unref(styleBacktop) }),
|
||||
onClick: withModifiers(handleClick, ["stop"]),
|
||||
onMousedown: handlerMousedown,
|
||||
onMouseup: handlerMouseup
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default", {}, () => [
|
||||
createVNode(unref(_sfc_main$2E), {
|
||||
type: props.icon,
|
||||
size: `${props.iconSize}px`,
|
||||
color: props.iconColor
|
||||
}, null, 8, ["type", "size", "color"])
|
||||
])
|
||||
], 46, _hoisted_1)), [
|
||||
[vShow, unref(visible)]
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/badge/index.css
Normal file
1
package/component/es/badge/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-badge,.layui-badge-dot,.layui-badge-rim{position:relative;display:inline-block;padding:0 6px;font-size:12px;text-align:center;background-color:#ff5722;color:#fff;border-radius:var(--global-border-radius)}.layui-badge{height:18px;line-height:18px}.layui-badge-dot{width:8px;height:8px;padding:0;border-radius:50%}.layui-badge-rim{height:18px;line-height:18px;border-width:1px;border-style:solid;background-color:#fff;border-color:var(--global-neutral-color-3);color:#666}.layui-badge-dot-ripple>span{position:absolute;top:0;left:0;width:100%;height:100%;display:block;border-radius:50%;box-sizing:border-box;animation:layui-badge-dot-anim-ripple 1.2s ease-in-out infinite}@keyframes layui-badge-dot-anim-ripple{0%{transform:scale(.8);opacity:.6}to{transform:scale(2.4);opacity:0}}.layui-btn .layui-badge,.layui-btn .layui-badge-dot{margin-left:5px}.layui-nav .layui-badge,.layui-nav .layui-badge-dot{position:absolute;top:50%;margin:-5px 6px 0}.layui-nav .layui-badge{margin-top:-10px}.layui-tab-title .layui-badge,.layui-tab-title .layui-badge-dot{left:5px;top:-2px}
|
2
package/component/es/badge/index.js
Normal file
2
package/component/es/badge/index.js
Normal file
@ -0,0 +1,2 @@
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
54
package/component/es/badge/index2.js
Normal file
54
package/component/es/badge/index2.js
Normal file
@ -0,0 +1,54 @@
|
||||
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createCommentVNode, renderSlot } from "vue";
|
||||
const withInstall = (comp) => {
|
||||
const component2 = comp;
|
||||
component2.install = (app) => {
|
||||
app.component(component2.name, comp);
|
||||
};
|
||||
return component2;
|
||||
};
|
||||
var index = /* @__PURE__ */ (() => ".layui-badge,.layui-badge-dot,.layui-badge-rim{position:relative;display:inline-block;padding:0 6px;font-size:12px;text-align:center;background-color:#ff5722;color:#fff;border-radius:var(--global-border-radius)}.layui-badge{height:18px;line-height:18px}.layui-badge-dot{width:8px;height:8px;padding:0;border-radius:50%}.layui-badge-rim{height:18px;line-height:18px;border-width:1px;border-style:solid;background-color:#fff;border-color:var(--global-neutral-color-3);color:#666}.layui-badge-dot-ripple>span{position:absolute;top:0;left:0;width:100%;height:100%;display:block;border-radius:50%;box-sizing:border-box;animation:layui-badge-dot-anim-ripple 1.2s ease-in-out infinite}@keyframes layui-badge-dot-anim-ripple{0%{transform:scale(.8);opacity:.6}to{transform:scale(2.4);opacity:0}}.layui-btn .layui-badge,.layui-btn .layui-badge-dot{margin-left:5px}.layui-nav .layui-badge,.layui-nav .layui-badge-dot{position:absolute;top:50%;margin:-5px 6px 0}.layui-nav .layui-badge{margin-top:-10px}.layui-tab-title .layui-badge,.layui-tab-title .layui-badge-dot{left:5px;top:-2px}\n")();
|
||||
const __default__ = {
|
||||
name: "LayBadge"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
type: null,
|
||||
theme: null,
|
||||
color: null,
|
||||
ripple: { type: Boolean }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const classes = computed(() => {
|
||||
return [
|
||||
{
|
||||
"layui-badge": !props.type,
|
||||
"layui-badge-dot": props.type == "dot",
|
||||
"layui-badge-rim": props.type == "rim",
|
||||
"layui-badge-dot-ripple": props.ripple
|
||||
},
|
||||
`layui-bg-${props.theme}`
|
||||
];
|
||||
});
|
||||
const styles = computed(() => {
|
||||
return [props.color ? `background-color: ${props.color}` : ""];
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
var _a;
|
||||
return openBlock(), createElementBlock("span", {
|
||||
class: normalizeClass(unref(classes)),
|
||||
style: normalizeStyle(unref(styles))
|
||||
}, [
|
||||
__props.type === "dot" ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass(props.theme ? `layui-bg-${props.theme}` : ``),
|
||||
style: normalizeStyle((_a = unref(styles)) != null ? _a : `background-color: #ff5722;`)
|
||||
}, null, 6)) : createCommentVNode("", true),
|
||||
__props.type != "dot" ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("", true)
|
||||
], 6);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as c, withInstall as w };
|
1
package/component/es/body/index.css
Normal file
1
package/component/es/body/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-body{display:block;flex:1;overflow:auto;height:100%;box-sizing:border-box;min-height:300px}
|
19
package/component/es/body/index.js
Normal file
19
package/component/es/body/index.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-body{display:block;flex:1;overflow:auto;height:100%;box-sizing:border-box;min-height:300px}\n")();
|
||||
const _hoisted_1 = { class: "layui-body" };
|
||||
const __default__ = {
|
||||
name: "LayBody"
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
...__default__,
|
||||
setup(__props) {
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/breadcrumb/index.css
Normal file
1
package/component/es/breadcrumb/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-breadcrumb{font-size:0}.layui-breadcrumb>*{font-size:14px}.layui-breadcrumb a{color:#999}.layui-breadcrumb a:hover{color:var(--global-checked-color)!important}.layui-breadcrumb a:nth-last-child(2){color:#666;font-style:normal}.layui-breadcrumb span:last-child{display:none}.layui-breadcrumb span[lay-separator]{margin:0 10px;color:var(--global-neutral-color-7)}
|
24
package/component/es/breadcrumb/index.js
Normal file
24
package/component/es/breadcrumb/index.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, provide, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-breadcrumb{font-size:0}.layui-breadcrumb>*{font-size:14px}.layui-breadcrumb a{color:#999}.layui-breadcrumb a:hover{color:var(--global-checked-color)!important}.layui-breadcrumb a:nth-last-child(2){color:#666;font-style:normal}.layui-breadcrumb span:last-child{display:none}.layui-breadcrumb span[lay-separator]{margin:0 10px;color:var(--global-neutral-color-7)}\n")();
|
||||
const _hoisted_1 = { class: "layui-breadcrumb" };
|
||||
const __default__ = {
|
||||
name: "LayBreadcrumb"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
separator: { default: "/" }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
provide("separator", props.separator);
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("span", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
27
package/component/es/breadcrumbItem/index.js
Normal file
27
package/component/es/breadcrumbItem/index.js
Normal file
@ -0,0 +1,27 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, inject, openBlock, createElementBlock, Fragment, createElementVNode, mergeProps, renderSlot, createTextVNode, toDisplayString, unref } from "vue";
|
||||
const _hoisted_1 = { "lay-separator": "" };
|
||||
const __default__ = {
|
||||
name: "LayBreadcrumbItem"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
title: null
|
||||
},
|
||||
setup(__props) {
|
||||
const separator = inject("separator");
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock(Fragment, null, [
|
||||
createElementVNode("a", mergeProps({ href: "javascript:void(0);" }, _ctx.$attrs), [
|
||||
renderSlot(_ctx.$slots, "default", {}, () => [
|
||||
createTextVNode(toDisplayString(__props.title), 1)
|
||||
])
|
||||
], 16),
|
||||
createElementVNode("span", _hoisted_1, toDisplayString(unref(separator)), 1)
|
||||
], 64);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/button/index.css
Normal file
1
package/component/es/button/index.css
Normal file
@ -0,0 +1 @@
|
||||
:root{--button-primary-text-color: #fff;--button-primary-background-color: var(--global-primary-color);--button-primary-border-color: var(--global-primary-color);--button-normal-text-color: #fff;--button-normal-background-color: var(--global-normal-color);--button-normal-border-color: var(--global-normal-color);--button-warm-text-color: #fff;--button-warm-background-color: var(--global-warm-color);--button-warm-border-color: var(--global-warm-color);--button-danger-text-color: #fff;--button-danger-background-color: var(--global-danger-color);--button-danger-border-color: var(--global-danger-color);--button-border-radius: var(--global-border-radius);--button-border-color: var(--global-neutral-color-6);--button-background-color: 0 0;--button-text-color: #666}.layui-btn{height:38px;line-height:36px;padding:0 18px;font-size:14px;text-align:center;white-space:nowrap;color:var(--button-text-color);background:var(--button-background-color);border-radius:var(--button-border-radius);border-color:var(--button-border-color);border-width:1px;border-style:solid;cursor:pointer}.layui-btn-primary{color:var(--button-primary-text-color);background-color:var(--button-primary-background-color);border-color:var(--button-primary-border-color)}.layui-btn-normal{color:var(--button-normal-text-color);background-color:var(--button-normal-background-color);border-color:var(--button-normal-border-color)}.layui-btn-warm{color:var(--button-warm-text-color);background-color:var(--button-warm-background-color);border-color:var(--button-warm-border-color)}.layui-btn-danger{color:var(--button-danger-text-color);background-color:var(--button-danger-background-color);border-color:var(--button-danger-border-color)}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80)}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn-lg{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-sm{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-xs{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-xs i{font-size:12px!important}.layui-btn-fluid{width:100%}.layui-btn-radius{border-radius:100px}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border-color:#eee!important;background-color:#fbfbfb!important;color:#d2d2d2!important;cursor:not-allowed!important;opacity:1}.layui-btn+.layui-btn{margin-left:10px}.layui-btn .layui-icon{padding:0 2px;vertical-align:middle\ ;vertical-align:bottom}
|
3
package/component/es/button/index.js
Normal file
3
package/component/es/button/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
76
package/component/es/button/index2.js
Normal file
76
package/component/es/button/index2.js
Normal file
@ -0,0 +1,76 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createCommentVNode, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ":root{--button-primary-text-color: #fff;--button-primary-background-color: var(--global-primary-color);--button-primary-border-color: var(--global-primary-color);--button-normal-text-color: #fff;--button-normal-background-color: var(--global-normal-color);--button-normal-border-color: var(--global-normal-color);--button-warm-text-color: #fff;--button-warm-background-color: var(--global-warm-color);--button-warm-border-color: var(--global-warm-color);--button-danger-text-color: #fff;--button-danger-background-color: var(--global-danger-color);--button-danger-border-color: var(--global-danger-color);--button-border-radius: var(--global-border-radius);--button-border-color: var(--global-neutral-color-6);--button-background-color: 0 0;--button-text-color: #666}.layui-btn{height:38px;line-height:36px;padding:0 18px;font-size:14px;text-align:center;white-space:nowrap;color:var(--button-text-color);background:var(--button-background-color);border-radius:var(--button-border-radius);border-color:var(--button-border-color);border-width:1px;border-style:solid;cursor:pointer}.layui-btn-primary{color:var(--button-primary-text-color);background-color:var(--button-primary-background-color);border-color:var(--button-primary-border-color)}.layui-btn-normal{color:var(--button-normal-text-color);background-color:var(--button-normal-background-color);border-color:var(--button-normal-border-color)}.layui-btn-warm{color:var(--button-warm-text-color);background-color:var(--button-warm-background-color);border-color:var(--button-warm-border-color)}.layui-btn-danger{color:var(--button-danger-text-color);background-color:var(--button-danger-background-color);border-color:var(--button-danger-border-color)}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80)}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn-lg{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-sm{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-xs{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-xs i{font-size:12px!important}.layui-btn-fluid{width:100%}.layui-btn-radius{border-radius:100px}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border-color:#eee!important;background-color:#fbfbfb!important;color:#d2d2d2!important;cursor:not-allowed!important;opacity:1}.layui-btn+.layui-btn{margin-left:10px}.layui-btn .layui-icon{padding:0 2px;vertical-align:middle\\ ;vertical-align:bottom}\n")();
|
||||
const ButtonEmits = {
|
||||
click: (evt) => evt instanceof MouseEvent
|
||||
};
|
||||
const _hoisted_1 = ["type"];
|
||||
const __default__ = {
|
||||
name: "LayButton"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
type: null,
|
||||
size: null,
|
||||
prefixIcon: null,
|
||||
suffixIcon: null,
|
||||
loadingIcon: { default: "layui-icon-loading-one" },
|
||||
borderStyle: { default: "soild" },
|
||||
border: null,
|
||||
fluid: { type: Boolean, default: false },
|
||||
radius: { type: Boolean, default: false },
|
||||
loading: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean },
|
||||
nativeType: { default: "button" }
|
||||
},
|
||||
emits: ButtonEmits,
|
||||
setup(__props, { emit: emits }) {
|
||||
const props = __props;
|
||||
const onClick = (event) => {
|
||||
if (!props.disabled) {
|
||||
emits("click", event);
|
||||
}
|
||||
};
|
||||
const styles = computed(() => {
|
||||
return {
|
||||
border: `1px ${props.borderStyle}`
|
||||
};
|
||||
});
|
||||
const classes = computed(() => {
|
||||
return [
|
||||
{
|
||||
"layui-btn-fluid": props.fluid,
|
||||
"layui-btn-radius": props.radius,
|
||||
"layui-btn-disabled": props.disabled
|
||||
},
|
||||
props.type ? `layui-btn-${props.type}` : "",
|
||||
props.size ? `layui-btn-${props.size}` : "",
|
||||
props.border ? `layui-border-${props.border}` : ""
|
||||
];
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("button", {
|
||||
class: normalizeClass(["layui-btn", unref(classes)]),
|
||||
style: normalizeStyle(unref(styles)),
|
||||
type: __props.nativeType,
|
||||
onClick
|
||||
}, [
|
||||
__props.prefixIcon ? (openBlock(), createElementBlock("i", {
|
||||
key: 0,
|
||||
class: normalizeClass(`layui-icon ${__props.prefixIcon}`)
|
||||
}, null, 2)) : createCommentVNode("", true),
|
||||
__props.loading ? (openBlock(), createElementBlock("i", {
|
||||
key: 1,
|
||||
class: normalizeClass([__props.loadingIcon, "layui-icon layui-anim layui-anim-rotate layui-anim-loop"])
|
||||
}, null, 2)) : renderSlot(_ctx.$slots, "default", { key: 2 }),
|
||||
__props.suffixIcon ? (openBlock(), createElementBlock("i", {
|
||||
key: 3,
|
||||
class: normalizeClass(`layui-icon ${__props.suffixIcon}`)
|
||||
}, null, 2)) : createCommentVNode("", true)
|
||||
], 14, _hoisted_1);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { _sfc_main as _, component as c };
|
1
package/component/es/buttonContainer/index.css
Normal file
1
package/component/es/buttonContainer/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-btn-container{font-size:0}.layui-btn-container .layui-btn{margin-right:10px;margin-bottom:10px}.layui-btn-container .layui-btn+.layui-btn{margin-left:0}
|
19
package/component/es/buttonContainer/index.js
Normal file
19
package/component/es/buttonContainer/index.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-btn-container{font-size:0}.layui-btn-container .layui-btn{margin-right:10px;margin-bottom:10px}.layui-btn-container .layui-btn+.layui-btn{margin-left:0}\n")();
|
||||
const _hoisted_1 = { class: "layui-btn-container" };
|
||||
const __default__ = {
|
||||
name: "LayButtonContainer"
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
...__default__,
|
||||
setup(__props) {
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/buttonGroup/index.css
Normal file
1
package/component/es/buttonGroup/index.css
Normal file
@ -0,0 +1 @@
|
||||
:root{--button-primary-color: var(--global-primary-color);--button-border-radius: var(--global-border-radius)}.layui-btn-group{vertical-align:middle;font-size:0}.layui-btn-group .layui-btn{margin-left:0!important;margin-right:0!important;border-radius:0}.layui-btn-group .layui-btn:not(:last-child){border-right:none!important}.layui-btn-group .layui-btn.layui-btn-primary:not(:first-child),.layui-btn-group .layui-btn.layui-btn-normal:not(:first-child),.layui-btn-group .layui-btn.layui-btn-warm:not(:first-child),.layui-btn-group .layui-btn.layui-btn-danger:not(:first-child){border-left:1px solid rgba(255,255,255,.5)}.layui-btn-group .layui-btn:first-child{border-radius:var(--button-border-radius) 0 0 var(--button-border-radius)}.layui-btn-group .layui-btn:last-child{border-radius:0 var(--button-border-radius) var(--button-border-radius) 0}.layui-btn-group .layui-btn+.layui-btn{margin-left:0}.layui-btn-group+.layui-btn-group{margin-left:10px}
|
19
package/component/es/buttonGroup/index.js
Normal file
19
package/component/es/buttonGroup/index.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ":root{--button-primary-color: var(--global-primary-color);--button-border-radius: var(--global-border-radius)}.layui-btn-group{vertical-align:middle;font-size:0}.layui-btn-group .layui-btn{margin-left:0!important;margin-right:0!important;border-radius:0}.layui-btn-group .layui-btn:not(:last-child){border-right:none!important}.layui-btn-group .layui-btn.layui-btn-primary:not(:first-child),.layui-btn-group .layui-btn.layui-btn-normal:not(:first-child),.layui-btn-group .layui-btn.layui-btn-warm:not(:first-child),.layui-btn-group .layui-btn.layui-btn-danger:not(:first-child){border-left:1px solid rgba(255,255,255,.5)}.layui-btn-group .layui-btn:first-child{border-radius:var(--button-border-radius) 0 0 var(--button-border-radius)}.layui-btn-group .layui-btn:last-child{border-radius:0 var(--button-border-radius) var(--button-border-radius) 0}.layui-btn-group .layui-btn+.layui-btn{margin-left:0}.layui-btn-group+.layui-btn-group{margin-left:10px}\n")();
|
||||
const _hoisted_1 = { class: "layui-btn-group" };
|
||||
const __default__ = {
|
||||
name: "LayButtonGroup"
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
...__default__,
|
||||
setup(__props) {
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/card/index.css
Normal file
1
package/component/es/card/index.css
Normal file
@ -0,0 +1 @@
|
||||
:root{--card-border-radius: var(--global-border-radius)}.layui-card{margin-bottom:15px;background-color:#fff;border-radius:var(--card-border-radius)}.layui-card .layui-card-header{height:42px;line-height:42px;padding:0 15px;border-bottom:1px solid #f6f6f6;font-size:14px}.layui-card .layui-card-footer{height:42px;line-height:42px;padding:0 15px;border-top:1px solid #f6f6f6;font-size:14px}.layui-card .layui-card-header .layui-card-header-extra{float:right}.layui-card .layui-card-body{padding:10px 15px;line-height:24px}.layui-card:last-child{margin-bottom:0}.layui-card.is-hover-shadow:hover,.layui-card.shadow{box-shadow:0 1px 2px #0000000d}
|
61
package/component/es/card/index.js
Normal file
61
package/component/es/card/index.js
Normal file
@ -0,0 +1,61 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ":root{--card-border-radius: var(--global-border-radius)}.layui-card{margin-bottom:15px;background-color:#fff;border-radius:var(--card-border-radius)}.layui-card .layui-card-header{height:42px;line-height:42px;padding:0 15px;border-bottom:1px solid #f6f6f6;font-size:14px}.layui-card .layui-card-footer{height:42px;line-height:42px;padding:0 15px;border-top:1px solid #f6f6f6;font-size:14px}.layui-card .layui-card-header .layui-card-header-extra{float:right}.layui-card .layui-card-body{padding:10px 15px;line-height:24px}.layui-card:last-child{margin-bottom:0}.layui-card.is-hover-shadow:hover,.layui-card.shadow{box-shadow:0 1px 2px #0000000d}\n")();
|
||||
const _hoisted_1 = {
|
||||
key: 0,
|
||||
class: "layui-card-header"
|
||||
};
|
||||
const _hoisted_2 = { class: "layui-card-header-title" };
|
||||
const _hoisted_3 = {
|
||||
key: 0,
|
||||
class: "layui-card-header-extra"
|
||||
};
|
||||
const _hoisted_4 = { class: "layui-card-body" };
|
||||
const _hoisted_5 = {
|
||||
key: 1,
|
||||
class: "layui-card-footer"
|
||||
};
|
||||
const __default__ = {
|
||||
name: "LayCard"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
title: null,
|
||||
shadow: { default: "always" }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const slots = useSlots();
|
||||
const classes = computed(() => {
|
||||
return {
|
||||
shadow: props.shadow === "always",
|
||||
"is-hover-shadow": props.shadow === "hover"
|
||||
};
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-card", unref(classes)])
|
||||
}, [
|
||||
unref(slots).title || __props.title || unref(slots).extra ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
createElementVNode("span", _hoisted_2, [
|
||||
renderSlot(_ctx.$slots, "title", {}, () => [
|
||||
createTextVNode(toDisplayString(__props.title), 1)
|
||||
])
|
||||
]),
|
||||
unref(slots).extra ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
||||
renderSlot(_ctx.$slots, "extra")
|
||||
])) : createCommentVNode("", true)
|
||||
])) : createCommentVNode("", true),
|
||||
createElementVNode("div", _hoisted_4, [
|
||||
unref(slots).body ? renderSlot(_ctx.$slots, "body", { key: 0 }) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
||||
]),
|
||||
unref(slots).footer ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
||||
renderSlot(_ctx.$slots, "footer")
|
||||
])) : createCommentVNode("", true)
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/carousel/index.css
Normal file
1
package/component/es/carousel/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-carousel{position:relative;left:0;top:0;background-color:#f8f8f8}.layui-carousel>[carousel-item]{position:relative;width:100%;height:100%;overflow:hidden}.layui-carousel>[carousel-item]:before{position:absolute;content:"\e63d";left:50%;top:50%;width:100px;line-height:20px;margin:-10px 0 0 -50px;text-align:center;color:var(--global-neutral-color-8);font-family:layui-icon!important;font-size:30px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-carousel>[carousel-item]>*{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f8f8f8;transition-duration:.3s;-webkit-transition-duration:.3s;overflow:hidden;visibility:hidden}.layui-carousel-updown>*{-webkit-transition:.3s ease-in-out up;transition:.3s ease-in-out up}.layui-carousel-arrow{display:none\ ;opacity:0;position:absolute;left:10px;top:50%;margin-top:-18px;width:36px;height:36px;line-height:36px;text-align:center;font-size:20px;border:0;border-radius:50%;background-color:#0003;color:#fff;-webkit-transition-duration:.3s;transition-duration:.3s;cursor:pointer}.layui-carousel-arrow[lay-type=add]{left:auto!important;right:10px}.layui-carousel:hover .layui-carousel-arrow[lay-type=add],.layui-carousel[lay-arrow=always] .layui-carousel-arrow[lay-type=add]{right:20px}.layui-carousel[lay-arrow=always] .layui-carousel-arrow{opacity:1;left:20px}.layui-carousel[lay-arrow=none] .layui-carousel-arrow{display:none}.layui-carousel-arrow:hover,.layui-carousel-ind ul:hover{background-color:#00000059}.layui-carousel:hover .layui-carousel-arrow{display:block\ ;opacity:1;left:20px}.layui-carousel-ind{position:relative;top:-35px;width:100%;line-height:0!important;text-align:center;font-size:0}.layui-carousel[lay-indicator=outside]{margin-bottom:30px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind{top:10px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind ul{background-color:#00000080}.layui-carousel[lay-indicator=none] .layui-carousel-ind{display:none}.layui-carousel-ind ul{display:inline-block;padding:5px;background-color:#0003;border-radius:10px;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind li{display:inline-block;width:10px;height:10px;margin:0 3px;font-size:14px;background-color:var(--global-neutral-color-3);background-color:#ffffff80;border-radius:50%;cursor:pointer;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind li:hover{background-color:#ffffffb3}.layui-carousel-ind li.layui-this{background-color:#fff}.layui-carousel>[carousel-item]>.layui-carousel-next,.layui-carousel>[carousel-item]>.layui-carousel-prev,.layui-carousel>[carousel-item]>.layui-this{display:block}.layui-carousel>[carousel-item]>.layui-this{left:0}.layui-carousel>[carousel-item]>.layui-carousel-prev{left:-100%}.layui-carousel>[carousel-item]>.layui-carousel-next{left:100%}.layui-carousel>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel>[carousel-item]>.layui-carousel-prev.layui-carousel-right{left:0}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-left{left:-100%}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-right{left:100%}.layui-carousel[lay-anim=updown] .layui-carousel-arrow{left:50%!important;top:20px;margin:0 0 0 -18px}.layui-carousel[lay-anim=updown]>[carousel-item]>*,.layui-carousel[lay-anim=fade]>[carousel-item]>*{left:0!important}.layui-carousel[lay-anim=updown] .layui-carousel-arrow[lay-type=add]{top:auto!important;bottom:20px}.layui-carousel[lay-anim=updown] .layui-carousel-ind{position:absolute;top:50%;right:20px;width:auto;height:auto;transform:translateY(-50%)}.layui-carousel[lay-anim=updown] .layui-carousel-ind ul{padding:3px 5px}.layui-carousel[lay-anim=updown] .layui-carousel-ind li{display:block;margin:6px 0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next{top:100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-left{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-right{top:100%}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev{opacity:0}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{opacity:1}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-right{opacity:0}
|
3
package/component/es/carousel/index.js
Normal file
3
package/component/es/carousel/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
267
package/component/es/carousel/index2.js
Normal file
267
package/component/es/carousel/index2.js
Normal file
@ -0,0 +1,267 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, inject, ref, computed, openBlock, createElementBlock, normalizeStyle, unref, renderSlot, useSlots, watch, provide, createElementVNode, Fragment, renderList, normalizeClass, withModifiers, toDisplayString } from "vue";
|
||||
var index = /* @__PURE__ */ (() => '.layui-carousel{position:relative;left:0;top:0;background-color:#f8f8f8}.layui-carousel>[carousel-item]{position:relative;width:100%;height:100%;overflow:hidden}.layui-carousel>[carousel-item]:before{position:absolute;content:"\\e63d";left:50%;top:50%;width:100px;line-height:20px;margin:-10px 0 0 -50px;text-align:center;color:var(--global-neutral-color-8);font-family:layui-icon!important;font-size:30px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-carousel>[carousel-item]>*{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f8f8f8;transition-duration:.3s;-webkit-transition-duration:.3s;overflow:hidden;visibility:hidden}.layui-carousel-updown>*{-webkit-transition:.3s ease-in-out up;transition:.3s ease-in-out up}.layui-carousel-arrow{display:none\\ ;opacity:0;position:absolute;left:10px;top:50%;margin-top:-18px;width:36px;height:36px;line-height:36px;text-align:center;font-size:20px;border:0;border-radius:50%;background-color:#0003;color:#fff;-webkit-transition-duration:.3s;transition-duration:.3s;cursor:pointer}.layui-carousel-arrow[lay-type=add]{left:auto!important;right:10px}.layui-carousel:hover .layui-carousel-arrow[lay-type=add],.layui-carousel[lay-arrow=always] .layui-carousel-arrow[lay-type=add]{right:20px}.layui-carousel[lay-arrow=always] .layui-carousel-arrow{opacity:1;left:20px}.layui-carousel[lay-arrow=none] .layui-carousel-arrow{display:none}.layui-carousel-arrow:hover,.layui-carousel-ind ul:hover{background-color:#00000059}.layui-carousel:hover .layui-carousel-arrow{display:block\\ ;opacity:1;left:20px}.layui-carousel-ind{position:relative;top:-35px;width:100%;line-height:0!important;text-align:center;font-size:0}.layui-carousel[lay-indicator=outside]{margin-bottom:30px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind{top:10px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind ul{background-color:#00000080}.layui-carousel[lay-indicator=none] .layui-carousel-ind{display:none}.layui-carousel-ind ul{display:inline-block;padding:5px;background-color:#0003;border-radius:10px;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind li{display:inline-block;width:10px;height:10px;margin:0 3px;font-size:14px;background-color:var(--global-neutral-color-3);background-color:#ffffff80;border-radius:50%;cursor:pointer;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind li:hover{background-color:#ffffffb3}.layui-carousel-ind li.layui-this{background-color:#fff}.layui-carousel>[carousel-item]>.layui-carousel-next,.layui-carousel>[carousel-item]>.layui-carousel-prev,.layui-carousel>[carousel-item]>.layui-this{display:block}.layui-carousel>[carousel-item]>.layui-this{left:0}.layui-carousel>[carousel-item]>.layui-carousel-prev{left:-100%}.layui-carousel>[carousel-item]>.layui-carousel-next{left:100%}.layui-carousel>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel>[carousel-item]>.layui-carousel-prev.layui-carousel-right{left:0}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-left{left:-100%}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-right{left:100%}.layui-carousel[lay-anim=updown] .layui-carousel-arrow{left:50%!important;top:20px;margin:0 0 0 -18px}.layui-carousel[lay-anim=updown]>[carousel-item]>*,.layui-carousel[lay-anim=fade]>[carousel-item]>*{left:0!important}.layui-carousel[lay-anim=updown] .layui-carousel-arrow[lay-type=add]{top:auto!important;bottom:20px}.layui-carousel[lay-anim=updown] .layui-carousel-ind{position:absolute;top:50%;right:20px;width:auto;height:auto;transform:translateY(-50%)}.layui-carousel[lay-anim=updown] .layui-carousel-ind ul{padding:3px 5px}.layui-carousel[lay-anim=updown] .layui-carousel-ind li{display:block;margin:6px 0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next{top:100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-left{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-right{top:100%}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev{opacity:0}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{opacity:1}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-right{opacity:0}\n')();
|
||||
const _hoisted_1$1 = ["data-id"];
|
||||
const __default__$1 = {
|
||||
name: "LayCarouselItem"
|
||||
};
|
||||
const _sfc_main$1 = defineComponent({
|
||||
...__default__$1,
|
||||
props: {
|
||||
id: null
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const active = inject("active");
|
||||
const slotsChange = inject("slotsChange");
|
||||
slotsChange.value = !slotsChange.value;
|
||||
const anim = inject("anim");
|
||||
const item = ref();
|
||||
const getStyle = computed(() => {
|
||||
if (item.value) {
|
||||
let allChild = item.value.parentNode.children;
|
||||
let allChildNum = allChild.length;
|
||||
let activeIndex = 0;
|
||||
let currentIndex = 0;
|
||||
for (let index2 = 0; index2 < allChild.length; index2++) {
|
||||
const element = allChild[index2];
|
||||
if (element.getAttribute("data-id") === active.value) {
|
||||
activeIndex = index2;
|
||||
}
|
||||
if (element.getAttribute("data-id") === props.id) {
|
||||
currentIndex = index2;
|
||||
}
|
||||
}
|
||||
let prevIndex = activeIndex > 0 ? activeIndex - 1 : allChildNum - 1;
|
||||
let nextIndex = activeIndex + 1 < allChildNum ? activeIndex + 1 : 0;
|
||||
let animation = anim.value;
|
||||
if (activeIndex === currentIndex) {
|
||||
if (animation === "updown") {
|
||||
return {
|
||||
transform: "translateY(0)",
|
||||
visibility: "inherit"
|
||||
};
|
||||
} else if (animation.includes("fade")) {
|
||||
return {
|
||||
opacity: 1,
|
||||
visibility: "inherit"
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
transform: "translateX(0)",
|
||||
visibility: "inherit"
|
||||
};
|
||||
}
|
||||
}
|
||||
if (prevIndex === currentIndex) {
|
||||
if (animation === "updown") {
|
||||
return {
|
||||
transform: "translateY(-100%)"
|
||||
};
|
||||
} else if (animation.includes("fade")) {
|
||||
return {
|
||||
opacity: 0
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
transform: "translateX(-100%)"
|
||||
};
|
||||
}
|
||||
}
|
||||
if (nextIndex === currentIndex) {
|
||||
if (animation === "updown") {
|
||||
return {
|
||||
transform: "translateY(100%)"
|
||||
};
|
||||
} else if (animation.includes("fade")) {
|
||||
return {
|
||||
opacity: 0
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
transform: "translateX(100%)"
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
display: "none"
|
||||
};
|
||||
}
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("li", {
|
||||
ref_key: "item",
|
||||
ref: item,
|
||||
style: normalizeStyle(unref(getStyle)),
|
||||
"data-id": __props.id
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 12, _hoisted_1$1);
|
||||
};
|
||||
}
|
||||
});
|
||||
const _hoisted_1 = ["lay-anim", "lay-indicator", "lay-arrow"];
|
||||
const _hoisted_2 = { "carousel-item": "" };
|
||||
const _hoisted_3 = { class: "layui-carousel-ind" };
|
||||
const _hoisted_4 = ["onClick"];
|
||||
const __default__ = {
|
||||
name: "LayCarousel"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
width: { default: "100%" },
|
||||
height: { default: "280px" },
|
||||
modelValue: null,
|
||||
autoplay: { type: Boolean, default: true },
|
||||
arrow: { default: "hover" },
|
||||
anim: { default: "default" },
|
||||
indicator: { default: "inside" },
|
||||
pauseOnHover: { type: Boolean, default: true },
|
||||
interval: { default: 3e3 }
|
||||
},
|
||||
emits: ["update:modelValue", "change"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const slot = useSlots();
|
||||
const slots = slot.default && slot.default();
|
||||
const active = computed({
|
||||
get() {
|
||||
return props.modelValue;
|
||||
},
|
||||
set(val) {
|
||||
emit("update:modelValue", val);
|
||||
}
|
||||
});
|
||||
const anim = computed(() => props.anim);
|
||||
const change = function(id) {
|
||||
emit("change", id);
|
||||
active.value = id;
|
||||
};
|
||||
const childrens = ref([]);
|
||||
const slotsChange = ref(true);
|
||||
const setItemInstanceBySlot = function(nodes) {
|
||||
const showNodes = nodes == null ? void 0 : nodes.filter((item) => {
|
||||
return item.children != "v-if";
|
||||
});
|
||||
showNodes == null ? void 0 : showNodes.map((item) => {
|
||||
let component2 = item.type;
|
||||
if (component2.name != _sfc_main$1.name) {
|
||||
setItemInstanceBySlot(item.children);
|
||||
} else {
|
||||
childrens.value.push(item);
|
||||
}
|
||||
});
|
||||
};
|
||||
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++) {
|
||||
if (((_a = childrens.value[i].props) == null ? void 0 : _a.id) === active.value) {
|
||||
if (i === 0) {
|
||||
active.value = (_b = childrens.value[slots.length - 1].props) == null ? void 0 : _b.id;
|
||||
} else {
|
||||
active.value = (_c = childrens.value[i - 1].props) == null ? void 0 : _c.id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
const add = () => {
|
||||
var _a, _b, _c;
|
||||
for (var i = 0; i < childrens.value.length; i++) {
|
||||
if (((_a = childrens.value[i].props) == null ? void 0 : _a.id) === active.value) {
|
||||
if (i === childrens.value.length - 1) {
|
||||
active.value = (_b = childrens.value[0].props) == null ? void 0 : _b.id;
|
||||
} else {
|
||||
active.value = (_c = childrens.value[i + 1].props) == null ? void 0 : _c.id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
const autoplay = () => {
|
||||
var _a, _b, _c;
|
||||
for (var i = 0; i < childrens.value.length; i++) {
|
||||
if (((_a = childrens.value[i].props) == null ? void 0 : _a.id) === active.value) {
|
||||
if (i === childrens.value.length - 1) {
|
||||
active.value = (_b = childrens.value[0].props) == null ? void 0 : _b.id;
|
||||
} else {
|
||||
active.value = (_c = childrens.value[i + 1].props) == null ? void 0 : _c.id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
let intervalTimer = 0;
|
||||
const cleanIntervalTimer = () => {
|
||||
if (intervalTimer) {
|
||||
window.clearInterval(intervalTimer);
|
||||
intervalTimer = 0;
|
||||
}
|
||||
};
|
||||
const handleMouseEnter = () => {
|
||||
if (props.autoplay && props.pauseOnHover) {
|
||||
cleanIntervalTimer();
|
||||
}
|
||||
};
|
||||
const handleMouseLeave = () => {
|
||||
if (props.autoplay && props.pauseOnHover) {
|
||||
intervalTimer = window.setInterval(autoplay, props.interval);
|
||||
}
|
||||
};
|
||||
watch(() => props.autoplay, () => {
|
||||
if (props.autoplay) {
|
||||
intervalTimer = window.setInterval(autoplay, props.interval);
|
||||
}
|
||||
}, { immediate: true });
|
||||
provide("active", active);
|
||||
provide("slotsChange", slotsChange);
|
||||
provide("anim", anim);
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: "layui-carousel",
|
||||
"lay-anim": unref(anim),
|
||||
"lay-indicator": __props.indicator,
|
||||
"lay-arrow": __props.arrow,
|
||||
style: normalizeStyle({ width: __props.width, height: __props.height }),
|
||||
onMouseenter: handleMouseEnter,
|
||||
onMouseleave: handleMouseLeave
|
||||
}, [
|
||||
createElementVNode("div", _hoisted_2, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]),
|
||||
createElementVNode("div", _hoisted_3, [
|
||||
createElementVNode("ul", null, [
|
||||
(openBlock(true), createElementBlock(Fragment, null, renderList(childrens.value, (ss, index2) => {
|
||||
var _a;
|
||||
return openBlock(), createElementBlock("li", {
|
||||
key: index2,
|
||||
class: normalizeClass([((_a = ss.props) == null ? void 0 : _a.id) === unref(active) ? "layui-this" : ""]),
|
||||
onClick: withModifiers(($event) => {
|
||||
var _a2;
|
||||
return change((_a2 = ss.props) == null ? void 0 : _a2.id);
|
||||
}, ["stop"])
|
||||
}, null, 10, _hoisted_4);
|
||||
}), 128))
|
||||
])
|
||||
]),
|
||||
createElementVNode("button", {
|
||||
class: "layui-icon layui-carousel-arrow",
|
||||
"lay-type": "sub",
|
||||
onClick: sub
|
||||
}, toDisplayString(unref(anim) === "updown" ? "\uE619" : "\uE603"), 1),
|
||||
createElementVNode("button", {
|
||||
class: "layui-icon layui-carousel-arrow",
|
||||
"lay-type": "add",
|
||||
onClick: add
|
||||
}, toDisplayString(unref(anim) === "updown" ? "\uE61A" : "\uE602"), 1)
|
||||
], 44, _hoisted_1);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { _sfc_main$1 as _, _sfc_main as a, component as c };
|
5
package/component/es/carouselItem/index.js
Normal file
5
package/component/es/carouselItem/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { _ as _sfc_main } from "../carousel/index2.js";
|
||||
import "vue";
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/cascader/index.css
Normal file
1
package/component/es/cascader/index.css
Normal file
@ -0,0 +1 @@
|
||||
: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}
|
274
package/component/es/cascader/index.js
Normal file
274
package/component/es/cascader/index.js
Normal file
@ -0,0 +1,274 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, onMounted, watch, ref, useSlots, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, createElementVNode, Fragment, renderList, createBlock, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
||||
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 "../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")();
|
||||
const _hoisted_1 = ["size"];
|
||||
const _hoisted_2 = { class: "layui-cascader-panel" };
|
||||
const _hoisted_3 = ["onClick"];
|
||||
const _hoisted_4 = {
|
||||
key: 2,
|
||||
class: "layui-icon layui-icon-right"
|
||||
};
|
||||
const __default__ = {
|
||||
name: "LayCascader"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
options: { default: null },
|
||||
modelValue: { default: "" },
|
||||
decollator: { default: "/" },
|
||||
placeholder: { default: "" },
|
||||
onlyLastLevel: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean, default: false },
|
||||
replaceFields: { default: () => {
|
||||
return {
|
||||
label: "label",
|
||||
value: "value",
|
||||
children: "children"
|
||||
};
|
||||
} },
|
||||
allowClear: { type: Boolean, default: false },
|
||||
size: { default: "md" },
|
||||
trigger: { default: "click" },
|
||||
contentClass: null,
|
||||
contentStyle: null
|
||||
},
|
||||
emits: ["update:modelValue", "change", "clear"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
onMounted(() => {
|
||||
initTreeData();
|
||||
});
|
||||
watch(() => props.options, () => {
|
||||
initTreeData();
|
||||
});
|
||||
watch(() => props.modelValue, () => {
|
||||
if (props.modelValue === null || props.modelValue === "") {
|
||||
onClear();
|
||||
}
|
||||
});
|
||||
const treeData = ref([]);
|
||||
const initTreeData = () => {
|
||||
let treeLvNum = getMaxFloor(props.options);
|
||||
for (let index2 = 0; index2 < treeLvNum; index2++) {
|
||||
if (index2 == 0) {
|
||||
treeData.value[0] = {
|
||||
selectIndex: null,
|
||||
data: findData(props.options, 1)
|
||||
};
|
||||
} else {
|
||||
treeData.value[index2] = {
|
||||
selectIndex: null,
|
||||
data: []
|
||||
};
|
||||
}
|
||||
}
|
||||
if (props.modelValue) {
|
||||
try {
|
||||
let valueData = props.modelValue.split(props.decollator);
|
||||
let data = [];
|
||||
for (let index2 = 0; index2 < treeData.value.length; index2++) {
|
||||
const element = treeData.value[index2];
|
||||
const nowValue = valueData[index2];
|
||||
for (let i = 0; i < element.length; i++) {
|
||||
const ele = element[i];
|
||||
if (nowValue === ele.value) {
|
||||
data.push(ele);
|
||||
element.selectIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
displayValue.value = data.map((e) => {
|
||||
return e.label;
|
||||
}).join(` ${props.decollator} `);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
function getMaxFloor(treeData2) {
|
||||
let max = 0;
|
||||
function each(data, floor) {
|
||||
data.forEach((e) => {
|
||||
if (floor > max) {
|
||||
max = floor;
|
||||
}
|
||||
if (e[props.replaceFields.children] && e[props.replaceFields.children].length > 0) {
|
||||
each(e[props.replaceFields.children], floor + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
each(treeData2, 1);
|
||||
return max;
|
||||
}
|
||||
function findData(orginData, level) {
|
||||
var _a;
|
||||
let data = [];
|
||||
for (let i = 0; i < orginData.length; i++) {
|
||||
const element = orginData[i];
|
||||
if (level === 1) {
|
||||
data.push({
|
||||
value: element[props.replaceFields.value],
|
||||
label: element[props.replaceFields.label],
|
||||
slot: element.slot || false,
|
||||
children: (_a = element[props.replaceFields.children]) != null ? _a : false,
|
||||
orginData: element
|
||||
});
|
||||
}
|
||||
if (level !== 1 && element[props.replaceFields.children] && element[props.replaceFields.children].length > 0) {
|
||||
findData(element[props.replaceFields.children], level - 1);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
ref([]);
|
||||
const selectBar = (item, selectIndex, parentIndex) => {
|
||||
treeData.value[parentIndex].selectIndex = selectIndex;
|
||||
if (item.children && item.children.length > 0) {
|
||||
treeData.value[parentIndex + 1].selectIndex = null;
|
||||
treeData.value[parentIndex + 1].data = findData(item.children, 1);
|
||||
}
|
||||
let nextIndex = parentIndex + 2;
|
||||
for (let index2 = nextIndex; index2 < treeData.value.length; index2++) {
|
||||
treeData.value[index2].selectIndex = null;
|
||||
treeData.value[index2].data = [];
|
||||
}
|
||||
if (!item.children || item.children.length === 0) {
|
||||
let extractData = function(orginData, dataContainer2, index2) {
|
||||
const element = orginData[index2].data;
|
||||
const selectIndex2 = orginData[index2].selectIndex;
|
||||
const selectData = element[selectIndex2];
|
||||
dataContainer2.push(selectData);
|
||||
if (selectData.children && selectData.children.length > 0) {
|
||||
extractData(orginData, dataContainer2, index2 + 1);
|
||||
}
|
||||
};
|
||||
let data = [];
|
||||
extractData(treeData.value, data, 0);
|
||||
let fullLable = data.map((e) => {
|
||||
return e.label;
|
||||
}).join(` ${props.decollator} `);
|
||||
if (!props.onlyLastLevel) {
|
||||
displayValue.value = fullLable;
|
||||
} else {
|
||||
let _data = data.map((e) => {
|
||||
return e.label;
|
||||
});
|
||||
displayValue.value = _data[_data.length - 1];
|
||||
}
|
||||
let value = data.map((e) => {
|
||||
return e.value;
|
||||
}).join(props.decollator);
|
||||
emit("update:modelValue", value);
|
||||
let evt = {
|
||||
display: displayValue.value,
|
||||
value,
|
||||
label: fullLable,
|
||||
currentClick: JSON.parse(JSON.stringify(item.orginData))
|
||||
};
|
||||
emit("change", evt);
|
||||
if (dropdownRef.value)
|
||||
dropdownRef.value.hide();
|
||||
}
|
||||
};
|
||||
const displayValue = ref("");
|
||||
const slots = useSlots();
|
||||
const dropdownRef = ref();
|
||||
const onClear = () => {
|
||||
displayValue.value = "";
|
||||
let arr = JSON.parse(JSON.stringify(treeData.value));
|
||||
for (let index2 = 0; index2 < arr.length; index2++) {
|
||||
arr[index2].selectIndex = null;
|
||||
if (index2 === 0) {
|
||||
continue;
|
||||
}
|
||||
arr[index2].data = [];
|
||||
}
|
||||
treeData.value = arr;
|
||||
emit("update:modelValue", null);
|
||||
};
|
||||
const openState = ref(false);
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
size: __props.size,
|
||||
class: normalizeClass([
|
||||
"layui-cascader",
|
||||
{
|
||||
"layui-cascader-opend": openState.value,
|
||||
"layui-cascader-disabled": __props.disabled
|
||||
}
|
||||
])
|
||||
}, [
|
||||
createVNode(_sfc_main$1, {
|
||||
ref_key: "dropdownRef",
|
||||
ref: dropdownRef,
|
||||
trigger: __props.trigger,
|
||||
autoFitMinWidth: false,
|
||||
updateAtScroll: true,
|
||||
disabled: __props.disabled,
|
||||
contentClass: __props.contentClass,
|
||||
contentStyle: __props.contentStyle,
|
||||
onShow: _cache[1] || (_cache[1] = ($event) => openState.value = true),
|
||||
onHide: _cache[2] || (_cache[2] = ($event) => openState.value = false)
|
||||
}, {
|
||||
content: withCtx(() => [
|
||||
createElementVNode("div", _hoisted_2, [
|
||||
(openBlock(true), createElementBlock(Fragment, null, renderList(treeData.value, (itemCol, index2) => {
|
||||
return openBlock(), createElementBlock(Fragment, null, [
|
||||
itemCol.data.length ? (openBlock(), createBlock(_sfc_main$2, {
|
||||
height: "180px",
|
||||
class: "layui-cascader-menu",
|
||||
key: "cascader-menu" + index2
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
(openBlock(true), createElementBlock(Fragment, null, renderList(itemCol.data, (item, i) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-cascader-menu-item", [
|
||||
{
|
||||
"layui-cascader-selected": itemCol.selectIndex === i
|
||||
}
|
||||
]]),
|
||||
key: index2 + i,
|
||||
onClick: ($event) => selectBar(item, i, index2)
|
||||
}, [
|
||||
item.slot && unref(slots)[item.slot] ? renderSlot(_ctx.$slots, item.slot, { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
||||
createTextVNode(toDisplayString(item.label), 1)
|
||||
], 64)),
|
||||
item.children && item.children.length ? (openBlock(), createElementBlock("i", _hoisted_4)) : createCommentVNode("", true)
|
||||
], 10, _hoisted_3);
|
||||
}), 128))
|
||||
]),
|
||||
_: 2
|
||||
}, 1024)) : createCommentVNode("", true)
|
||||
], 64);
|
||||
}), 256))
|
||||
])
|
||||
]),
|
||||
default: withCtx(() => [
|
||||
!unref(slots).default ? (openBlock(), createBlock(_sfc_main$3, {
|
||||
key: 0,
|
||||
modelValue: displayValue.value,
|
||||
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => displayValue.value = $event),
|
||||
"suffix-icon": "layui-icon-triangle-d",
|
||||
placeholder: __props.placeholder,
|
||||
"allow-clear": __props.allowClear,
|
||||
disabled: __props.disabled,
|
||||
readonly: true,
|
||||
size: __props.size,
|
||||
onClear
|
||||
}, null, 8, ["modelValue", "placeholder", "allow-clear", "disabled", "size"])) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
||||
]),
|
||||
_: 3
|
||||
}, 8, ["trigger", "disabled", "contentClass", "contentStyle"])
|
||||
], 10, _hoisted_1);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/checkbox/index.css
Normal file
1
package/component/es/checkbox/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-checkbox[size=lg]{height:18px;line-height:18px}.layui-checkbox[size=lg] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:18px;height:18px;font-size:16px}.layui-checkbox[size=lg] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:18px;line-height:18px;font-size:16px}.layui-checkbox[size=md]{height:16px;line-height:16px}.layui-checkbox[size=md] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:16px;height:16px;font-size:14px}.layui-checkbox[size=md] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:16px;line-height:16px;font-size:14px}.layui-checkbox[size=sm]{height:14px;line-height:14px}.layui-checkbox[size=sm] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:14px;height:14px;font-size:12px}.layui-checkbox[size=sm] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:14px;line-height:14px;font-size:12px}.layui-checkbox[size=xs]{height:12px;line-height:12px}.layui-checkbox[size=xs] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:12px;height:12px;font-size:10px}.layui-checkbox[size=xs] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:12px;line-height:12px;font-size:10px}.layui-checkbox input[type=checkbox]{display:none}.layui-form-checkbox{position:relative;height:30px;line-height:30px;margin-right:10px;padding-right:30px;cursor:pointer;font-size:0;-webkit-transition:.1s linear;transition:.1s linear;box-sizing:border-box}.layui-form-checkbox span{padding:0 10px;height:100%;font-size:14px;border-radius:2px 0 0 2px;background-color:var(--global-neutral-color-6);color:#fff;overflow:hidden}.layui-form-checkbox:hover span{background-color:var(--global-neutral-color-8)}.layui-form-checkbox i{top:0;right:0;width:29px;height:28px;position:absolute;border:1px solid var(--global-neutral-color-6);border-radius:0 2px 2px 0;color:#fff;font-size:20px;text-align:center}.layui-form-checkbox:hover i{border-color:var(--global-neutral-color-8);color:var(--global-neutral-color-8)}.layui-form-checkbox[lay-skin=primary]{height:auto!important;line-height:normal!important;min-width:18px;min-height:18px;border:none!important;margin-right:0;padding-left:28px;padding-right:0;background:0 0}.layui-form-checkbox[lay-skin=primary] span{padding-left:0;padding-right:15px;line-height:18px;background:0 0;color:#666}.layui-form-checkbox[lay-skin=primary] i{right:auto;left:0;width:16px;height:16px;line-height:16px;border:1px solid var(--global-neutral-color-6);font-size:12px;border-radius:2px;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-checkbox[lay-skin=primary]:hover i{border-color:var(--global-checked-color);color:#fff}.layui-form-checked,.layui-form-checked:hover{border-color:var(--global-checked-color)}.layui-form-checked i,.layui-form-checked:hover i{color:var(--global-checked-color)}.layui-form-checked span,.layui-form-checked:hover span{background-color:var(--global-checked-color)}.layui-form-checked[lay-skin=primary] i{border-color:var(--global-checked-color);background-color:var(--global-checked-color);color:#fff}.layui-form-checked[lay-skin=primary] span{background:0 0!important}.layui-checkbox-disabled[lay-skin=primary] span{background:0 0!important;color:var(--global-neutral-color-8)!important}.layui-checkbox-disabled[lay-skin=primary]:hover i{border-color:var(--global-neutral-color-6)}.layui-checkbox-disabled,.layui-checkbox-disabled i{border-color:var(--global-neutral-color-3)!important}.layui-checkbox-disabled span{background-color:var(--global-neutral-color-3)!important}.layui-checkbox-disabled em{color:var(--global-neutral-color-6)!important}.layui-checkbox-disabled:hover i{color:#fff!important}.layui-checkbox-disabled .layui-icon-ok,.layui-checkbox-disabled .layui-icon-subtraction{background-color:var(--global-neutral-color-3)!important;border-color:var(--global-neutral-color-3)!important}
|
3
package/component/es/checkbox/index.js
Normal file
3
package/component/es/checkbox/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
3897
package/component/es/checkbox/index2.js
Normal file
3897
package/component/es/checkbox/index2.js
Normal file
File diff suppressed because it is too large
Load Diff
38
package/component/es/checkboxGroup/index.js
Normal file
38
package/component/es/checkboxGroup/index.js
Normal file
@ -0,0 +1,38 @@
|
||||
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);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
42
package/component/es/col/index.js
Normal file
42
package/component/es/col/index.js
Normal file
@ -0,0 +1,42 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from "vue";
|
||||
const __default__ = {
|
||||
name: "LayCol"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
md: null,
|
||||
xs: null,
|
||||
sm: null,
|
||||
lg: null,
|
||||
mdOffset: null,
|
||||
xsOffset: null,
|
||||
smOffset: null,
|
||||
lgOffset: null
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const classes = computed(() => {
|
||||
return [
|
||||
props.md ? `layui-col-md${props.md}` : "",
|
||||
props.xs ? `layui-col-xs${props.xs}` : "",
|
||||
props.sm ? `layui-col-sm${props.sm}` : "",
|
||||
props.lg ? `layui-col-lg${props.lg}` : "",
|
||||
props.mdOffset ? `layui-col-md-offset${props.mdOffset}` : "",
|
||||
props.xsOffset ? `layui-col-xs-offset${props.xsOffset}` : "",
|
||||
props.smOffset ? `layui-col-sm-offset${props.smOffset}` : "",
|
||||
props.lgOffset ? `layui-col-lg-offset${props.lgOffset}` : ""
|
||||
];
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-col", unref(classes)])
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/collapse/index.css
Normal file
1
package/component/es/collapse/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-collapse{border-width:1px;border-style:solid;border-radius:2px}.layui-colla-content,.layui-colla-item{border-top-width:1px;border-top-style:solid}.layui-colla-item:first-child{border-top:none}.layui-colla-title{position:relative;height:42px;line-height:42px;padding:0 15px 0 35px;color:#333;background-color:var(--global-neutral-color-1);cursor:pointer;font-size:14px;overflow:hidden}.layui-colla-content{padding:10px 15px;line-height:1.6;color:#666}.layui-colla-icon{left:15px;top:0;font-size:14px;position:absolute}
|
36
package/component/es/collapse/index.js
Normal file
36
package/component/es/collapse/index.js
Normal file
@ -0,0 +1,36 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, watch, ref, provide, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-collapse{border-width:1px;border-style:solid;border-radius:2px}.layui-colla-content,.layui-colla-item{border-top-width:1px;border-top-style:solid}.layui-colla-item:first-child{border-top:none}.layui-colla-title{position:relative;height:42px;line-height:42px;padding:0 15px 0 35px;color:#333;background-color:var(--global-neutral-color-1);cursor:pointer;font-size:14px;overflow:hidden}.layui-colla-content{padding:10px 15px;line-height:1.6;color:#666}.layui-colla-icon{left:15px;top:0;font-size:14px;position:absolute}\n")();
|
||||
const _hoisted_1 = { class: "layui-collapse" };
|
||||
const __default__ = {
|
||||
name: "LayCollapse"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
accordion: { type: Boolean, default: false },
|
||||
modelValue: { default: () => [] },
|
||||
collapseTransition: { type: Boolean, default: true }
|
||||
},
|
||||
emits: ["update:modelValue", "change"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
watch(() => props.modelValue, (val) => {
|
||||
activeValues.value = [].concat(val);
|
||||
});
|
||||
const activeValues = ref([].concat(props.modelValue));
|
||||
provide("layCollapse", {
|
||||
accordion: props.accordion,
|
||||
collapseTransition: props.collapseTransition,
|
||||
activeValues,
|
||||
emit
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
72
package/component/es/collapseItem/index.js
Normal file
72
package/component/es/collapseItem/index.js
Normal file
@ -0,0 +1,72 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, inject, computed, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, normalizeStyle, unref, createVNode, withCtx, createCommentVNode } from "vue";
|
||||
import { _ as _sfc_main$1 } from "../transition/index2.js";
|
||||
const _hoisted_1 = { class: "layui-colla-item" };
|
||||
const _hoisted_2 = { key: 0 };
|
||||
const _hoisted_3 = { class: "layui-colla-content" };
|
||||
const __default__ = {
|
||||
name: "LayCollapseItem"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
id: null,
|
||||
title: null,
|
||||
disabled: { type: Boolean, default: false }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const { accordion, activeValues, emit, collapseTransition } = inject("layCollapse");
|
||||
let isShow = computed(() => {
|
||||
return activeValues.value.includes(props.id);
|
||||
});
|
||||
const showHandle = function() {
|
||||
if (props.disabled) {
|
||||
return;
|
||||
}
|
||||
const _isShow = isShow.value;
|
||||
if (accordion) {
|
||||
activeValues.value = !_isShow ? [props.id] : [];
|
||||
} else if (_isShow) {
|
||||
activeValues.value.splice(activeValues.value.indexOf(props.id), 1);
|
||||
} else {
|
||||
activeValues.value.push(props.id);
|
||||
}
|
||||
emit("update:modelValue", accordion ? activeValues.value[0] || null : activeValues.value);
|
||||
emit("change", props.id, !_isShow, activeValues.value);
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
createElementVNode("h2", {
|
||||
class: normalizeClass(["layui-colla-title", { "layui-disabled": __props.disabled }]),
|
||||
onClick: showHandle
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "title", { props }, () => [
|
||||
createTextVNode(toDisplayString(__props.title), 1)
|
||||
]),
|
||||
createElementVNode("i", {
|
||||
class: "layui-icon layui-colla-icon layui-icon-right",
|
||||
style: normalizeStyle({
|
||||
transform: unref(isShow) ? "rotate(90deg)" : "none",
|
||||
transition: unref(collapseTransition) ? "all 0.2s ease 0s" : ""
|
||||
})
|
||||
}, null, 4)
|
||||
], 2),
|
||||
createVNode(_sfc_main$1, { enable: unref(collapseTransition) }, {
|
||||
default: withCtx(() => [
|
||||
unref(isShow) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
||||
createElementVNode("div", _hoisted_3, [
|
||||
createElementVNode("p", null, [
|
||||
renderSlot(_ctx.$slots, "default", { props })
|
||||
])
|
||||
])
|
||||
])) : createCommentVNode("", true)
|
||||
]),
|
||||
_: 3
|
||||
}, 8, ["enable"])
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/colorPicker/index.css
Normal file
1
package/component/es/colorPicker/index.css
Normal file
File diff suppressed because one or more lines are too long
545
package/component/es/colorPicker/index.js
Normal file
545
package/component/es/colorPicker/index.js
Normal file
File diff suppressed because one or more lines are too long
1
package/component/es/container/index.css
Normal file
1
package/component/es/container/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-container{position:relative;margin:0 auto;padding:0 15px;box-sizing:border-box}.layui-fluid{position:relative;margin:0 auto;padding:0 15px}
|
25
package/component/es/container/index.js
Normal file
25
package/component/es/container/index.js
Normal file
@ -0,0 +1,25 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-container{position:relative;margin:0 auto;padding:0 15px;box-sizing:border-box}.layui-fluid{position:relative;margin:0 auto;padding:0 15px}\n")();
|
||||
const __default__ = {
|
||||
name: "LayContainer"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
fluid: { default: false }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const classes = computed(() => props.fluid ? "layui-fluid" : "layui-container");
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(unref(classes))
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
76
package/component/es/countUp/index.js
Normal file
76
package/component/es/countUp/index.js
Normal file
@ -0,0 +1,76 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, Fragment, renderSlot, createElementVNode, toDisplayString, unref } from "vue";
|
||||
import { T as TransitionPresets, e as useTransition } from "../_chunks/@vueuse/index.js";
|
||||
const __default__ = {
|
||||
name: "LayCountUp"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
startVal: { default: 0 },
|
||||
endVal: { default: 0 },
|
||||
decimal: { default: "." },
|
||||
decimalPlaces: { default: 0 },
|
||||
useGrouping: { type: Boolean, default: true },
|
||||
separator: { default: "," },
|
||||
autoplay: { type: Boolean, default: true },
|
||||
useEasing: { type: Boolean, default: true },
|
||||
easingFn: { default: TransitionPresets.easeInOutCubic },
|
||||
duration: { default: 2e3 },
|
||||
prefix: { default: "" },
|
||||
suffix: { default: "" }
|
||||
},
|
||||
setup(__props, { expose }) {
|
||||
const props = __props;
|
||||
let localStartVal = ref(props.startVal);
|
||||
const isNumber = (val) => !isNaN(parseFloat(val));
|
||||
const formatNumber = (num) => {
|
||||
if (typeof num != "number")
|
||||
return "0";
|
||||
num = num.toFixed(props.decimalPlaces);
|
||||
num += "";
|
||||
const x = num.split(".");
|
||||
let x1 = x[0];
|
||||
const x2 = x.length > 1 ? props.decimal + x[1] : "";
|
||||
const rgx = /(\d+)(\d{3})/;
|
||||
if (props.useGrouping && props.separator && !isNumber(props.separator)) {
|
||||
while (rgx.test(x1)) {
|
||||
x1 = x1.replace(rgx, "$1" + props.separator + "$2");
|
||||
}
|
||||
}
|
||||
return props.prefix + x1 + x2 + props.suffix;
|
||||
};
|
||||
const printVal = useTransition(localStartVal, {
|
||||
delay: 0,
|
||||
duration: props.duration,
|
||||
disabled: !props.useEasing,
|
||||
transition: typeof props.easingFn === "string" ? TransitionPresets[props.easingFn] : props.easingFn
|
||||
});
|
||||
const displayValue = computed(() => formatNumber(printVal.value));
|
||||
const start = function() {
|
||||
localStartVal.value = props.endVal;
|
||||
};
|
||||
watch(() => props.endVal, () => {
|
||||
if (props.autoplay) {
|
||||
localStartVal.value = props.endVal;
|
||||
}
|
||||
});
|
||||
onMounted(() => {
|
||||
if (props.autoplay) {
|
||||
start();
|
||||
}
|
||||
});
|
||||
expose({
|
||||
start
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock(Fragment, null, [
|
||||
renderSlot(_ctx.$slots, "prefix"),
|
||||
createElementVNode("span", null, toDisplayString(unref(displayValue)), 1),
|
||||
renderSlot(_ctx.$slots, "suffix")
|
||||
], 64);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/datePicker/index.css
Normal file
1
package/component/es/datePicker/index.css
Normal file
File diff suppressed because one or more lines are too long
13
package/component/es/datePicker/index.js
Normal file
13
package/component/es/datePicker/index.js
Normal file
@ -0,0 +1,13 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../_chunks/dayjs/index.js";
|
||||
import "../_chunks/@umijs/index.js";
|
||||
import "../input/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
import "../dropdown/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
import "../_chunks/vue-i18n/index.js";
|
||||
import "../_chunks/@intlify/index.js";
|
||||
import "../_chunks/@vue/index.js";
|
1857
package/component/es/datePicker/index2.js
Normal file
1857
package/component/es/datePicker/index2.js
Normal file
File diff suppressed because one or more lines are too long
1
package/component/es/dropdown/index.css
Normal file
1
package/component/es/dropdown/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-dropdown{position:relative;display:inline-block}.layui-dropdown-content{position:absolute;z-index:99999;background-color:#fff;box-sizing:border-box;border:1px solid #e4e7ed;border-radius:2px;box-shadow:0 2px 12px #0000001a}.layui-dropdown-content>.layui-dropdown-menu{border-radius:var(--global-border-radius);margin:5px 0}.layui-dropdown-content .layui-menu{position:relative;background-color:#fff}.layui-dropdown-content .layui-menu li,.layui-dropdown-content .layui-menu-body-title a{padding:5px 15px}.layui-dropdown-content .layui-menu li{position:relative;display:flex;margin:1px 0;line-height:26px;color:#000c;font-size:14px;white-space:nowrap;cursor:pointer}.layui-dropdown-content .layui-menu li:hover{background-color:var(--global-neutral-color-2)}.layui-dropdown-content .layui-menu-body-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-dropdown-menu-prefix{margin-right:8px}.layui-dropdown-menu-suffix{margin-left:15px}.layui-dropdown-content .layui-menu li.layui-disabled:hover{background-color:inherit}
|
4
package/component/es/dropdown/index.js
Normal file
4
package/component/es/dropdown/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../_chunks/@vueuse/index.js";
|
636
package/component/es/dropdown/index2.js
Normal file
636
package/component/es/dropdown/index2.js
Normal file
@ -0,0 +1,636 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, onMounted, openBlock, createBlock, Teleport, renderSlot, onUpdated, useSlots, useAttrs, inject, shallowRef, reactive, toRefs, computed, onBeforeUnmount, watch, provide, createElementBlock, Fragment, createVNode, unref, mergeProps, withCtx, normalizeClass, normalizeStyle, createCommentVNode, cloneVNode, h, nextTick } from "vue";
|
||||
import { u as useWindowSize, a as useResizeObserver, o as onClickOutside, b as useThrottleFn } from "../_chunks/@vueuse/index.js";
|
||||
var index = /* @__PURE__ */ (() => ".layui-dropdown{position:relative;display:inline-block}.layui-dropdown-content{position:absolute;z-index:99999;background-color:#fff;box-sizing:border-box;border:1px solid #e4e7ed;border-radius:2px;box-shadow:0 2px 12px #0000001a}.layui-dropdown-content>.layui-dropdown-menu{border-radius:var(--global-border-radius);margin:5px 0}.layui-dropdown-content .layui-menu{position:relative;background-color:#fff}.layui-dropdown-content .layui-menu li,.layui-dropdown-content .layui-menu-body-title a{padding:5px 15px}.layui-dropdown-content .layui-menu li{position:relative;display:flex;margin:1px 0;line-height:26px;color:#000c;font-size:14px;white-space:nowrap;cursor:pointer}.layui-dropdown-content .layui-menu li:hover{background-color:var(--global-neutral-color-2)}.layui-dropdown-content .layui-menu-body-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-dropdown-menu-prefix{margin-right:8px}.layui-dropdown-menu-suffix{margin-left:15px}.layui-dropdown-content .layui-menu li.layui-disabled:hover{background-color:inherit}\n")();
|
||||
const dropdownInjectionKey = Symbol("dropdownInjectKey");
|
||||
const __default__$1 = {
|
||||
name: "TeleportWrapper"
|
||||
};
|
||||
const _sfc_main$1 = defineComponent({
|
||||
...__default__$1,
|
||||
props: {
|
||||
to: { default: "" },
|
||||
disabled: { type: Boolean, default: false }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const target = ref(null);
|
||||
onMounted(() => {
|
||||
const observer = new MutationObserver((mutationList, observer2) => {
|
||||
for (const mutation of mutationList) {
|
||||
if (mutation.type !== "childList")
|
||||
continue;
|
||||
const el = document.querySelector(props.to);
|
||||
if (!el)
|
||||
continue;
|
||||
target.value = el;
|
||||
observer2.disconnect();
|
||||
break;
|
||||
}
|
||||
});
|
||||
observer.observe(document, { childList: true, subtree: true });
|
||||
return () => observer.disconnect();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createBlock(Teleport, {
|
||||
to: target.value,
|
||||
disabled: !target.value || __props.disabled
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 8, ["to", "disabled"]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const isScrollElement = (element) => {
|
||||
return element.scrollHeight > element.offsetHeight || element.scrollWidth > element.offsetWidth;
|
||||
};
|
||||
const getScrollElements = (container) => {
|
||||
var _a;
|
||||
const scrollElements = [];
|
||||
let element = container;
|
||||
while (element && element !== document.documentElement) {
|
||||
if (isScrollElement(element)) {
|
||||
scrollElements.push(element);
|
||||
}
|
||||
element = (_a = element.parentElement) != null ? _a : void 0;
|
||||
}
|
||||
return scrollElements;
|
||||
};
|
||||
const isElement = (vn) => {
|
||||
return Boolean(vn && vn.shapeFlag & 1);
|
||||
};
|
||||
const isComponent = (vn, type) => {
|
||||
return Boolean(vn && vn.shapeFlag & 6);
|
||||
};
|
||||
const isArrayChildren = (vn, children) => {
|
||||
return Boolean(vn && vn.shapeFlag & 16);
|
||||
};
|
||||
const getChildrenArray = (vn) => {
|
||||
if (isArrayChildren(vn, vn.children)) {
|
||||
return vn.children;
|
||||
}
|
||||
if (Array.isArray(vn)) {
|
||||
return vn;
|
||||
}
|
||||
return void 0;
|
||||
};
|
||||
const getFirstElementFromVNode = (vn) => {
|
||||
var _a, _b;
|
||||
if (isElement(vn)) {
|
||||
return vn.el;
|
||||
}
|
||||
if (isComponent(vn)) {
|
||||
if (((_a = vn.el) == null ? void 0 : _a.nodeType) === 1) {
|
||||
return vn.el;
|
||||
}
|
||||
if ((_b = vn.component) == null ? void 0 : _b.subTree) {
|
||||
const ele = getFirstElementFromVNode(vn.component.subTree);
|
||||
if (ele)
|
||||
return ele;
|
||||
}
|
||||
} else {
|
||||
const children = getChildrenArray(vn);
|
||||
return getFirstElementFromChildren(children);
|
||||
}
|
||||
return void 0;
|
||||
};
|
||||
const getFirstElementFromChildren = (children) => {
|
||||
if (children && children.length > 0) {
|
||||
for (const child of children) {
|
||||
const element = getFirstElementFromVNode(child);
|
||||
if (element)
|
||||
return element;
|
||||
}
|
||||
}
|
||||
return void 0;
|
||||
};
|
||||
const useFirstElement = () => {
|
||||
const children = {};
|
||||
const firstElement = ref();
|
||||
const getFirstElement = () => {
|
||||
const element = getFirstElementFromChildren(children.value);
|
||||
if (element !== firstElement.value) {
|
||||
firstElement.value = element;
|
||||
}
|
||||
};
|
||||
onMounted(() => getFirstElement());
|
||||
onUpdated(() => getFirstElement());
|
||||
return {
|
||||
children,
|
||||
firstElement
|
||||
};
|
||||
};
|
||||
const transformPlacement = (placement) => {
|
||||
const shouldTransform = placement.includes("-");
|
||||
const placementMap = {
|
||||
top: "start",
|
||||
left: "start",
|
||||
bottom: "end",
|
||||
right: "end"
|
||||
};
|
||||
if (shouldTransform) {
|
||||
const separated = placement.split("-");
|
||||
return `${separated[0]}-${placementMap[separated[1]] || separated[1]}`;
|
||||
}
|
||||
return placement;
|
||||
};
|
||||
var RenderFunction = defineComponent({
|
||||
name: "RenderFunction",
|
||||
props: {
|
||||
renderFunc: {
|
||||
type: Function,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
setup(props, ctx) {
|
||||
return () => {
|
||||
if (typeof props.renderFunc !== "function") {
|
||||
return null;
|
||||
}
|
||||
return props.renderFunc(ctx.attrs);
|
||||
};
|
||||
}
|
||||
});
|
||||
const __default__ = {
|
||||
name: "LayDropdown",
|
||||
inheritAttrs: false
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
visible: { type: Boolean, default: false },
|
||||
trigger: { default: "click" },
|
||||
placement: { default: "bottom-start" },
|
||||
disabled: { type: Boolean, default: false },
|
||||
autoFitPosition: { type: Boolean, default: true },
|
||||
autoFitWidth: { type: Boolean, default: false },
|
||||
autoFitMinWidth: { type: Boolean, default: true },
|
||||
updateAtScroll: { type: Boolean, default: false },
|
||||
autoFixPosition: { type: Boolean, default: true },
|
||||
clickToClose: { type: Boolean, default: true },
|
||||
blurToClose: { type: Boolean, default: true },
|
||||
clickOutsideToClose: { type: Boolean, default: true },
|
||||
contentOffset: { default: 2 },
|
||||
mouseEnterDelay: { default: 150 },
|
||||
mouseLeaveDelay: { default: 150 },
|
||||
focusDelay: { default: 150 },
|
||||
alignPoint: { type: Boolean, default: false },
|
||||
contentClass: null,
|
||||
contentStyle: null,
|
||||
popupContainer: { default: "body" }
|
||||
},
|
||||
emits: ["show", "hide"],
|
||||
setup(__props, { expose, emit }) {
|
||||
const props = __props;
|
||||
const slots = useSlots();
|
||||
const attrs = useAttrs();
|
||||
const childrenRefs = /* @__PURE__ */ new Set();
|
||||
const dropdownCtx = inject(dropdownInjectionKey, void 0);
|
||||
const { children, firstElement: dropdownRef } = useFirstElement();
|
||||
const contentRef = shallowRef();
|
||||
const contentStyle = ref({});
|
||||
const { width: windowWidth, height: windowHeight } = useWindowSize();
|
||||
const mousePosition = reactive({
|
||||
x: 0,
|
||||
y: 0
|
||||
});
|
||||
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 computedPlacement = computed(() => {
|
||||
return transformPlacement(props.placement);
|
||||
});
|
||||
let delayTimer = 0;
|
||||
const cleanDelayTimer = () => {
|
||||
if (delayTimer) {
|
||||
window.clearTimeout(delayTimer);
|
||||
delayTimer = 0;
|
||||
}
|
||||
};
|
||||
const show = (delay) => {
|
||||
if (props.disabled == false) {
|
||||
changeVisible(true, delay);
|
||||
emit("show");
|
||||
}
|
||||
};
|
||||
const hide = (delay) => {
|
||||
changeVisible(false, delay);
|
||||
emit("hide");
|
||||
};
|
||||
const toggle = () => {
|
||||
if (props.disabled == false)
|
||||
if (openState.value) {
|
||||
hide();
|
||||
} else {
|
||||
show();
|
||||
}
|
||||
};
|
||||
const changeVisible = (visible, delay) => {
|
||||
if (visible === openState.value && delayTimer === 0) {
|
||||
return;
|
||||
}
|
||||
const update = () => {
|
||||
openState.value = visible;
|
||||
nextTick(() => {
|
||||
updateContentStyle();
|
||||
});
|
||||
};
|
||||
if (delay) {
|
||||
cleanDelayTimer();
|
||||
if (visible !== openState.value) {
|
||||
delayTimer = window.setTimeout(update, delay);
|
||||
}
|
||||
} else {
|
||||
update();
|
||||
}
|
||||
};
|
||||
const getElementScrollRect = (element, containerRect) => {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return {
|
||||
top: rect.top,
|
||||
bottom: rect.bottom,
|
||||
left: rect.left,
|
||||
right: rect.right,
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
scrollTop: rect.top - containerRect.top,
|
||||
scrollBottom: rect.bottom - containerRect.top,
|
||||
scrollLeft: rect.left - containerRect.left,
|
||||
scrollRight: rect.right - containerRect.left
|
||||
};
|
||||
};
|
||||
const getTriggerRect = () => {
|
||||
return {
|
||||
top: mouseTop.value,
|
||||
bottom: mouseTop.value,
|
||||
left: mouseLeft.value,
|
||||
right: mouseLeft.value,
|
||||
scrollTop: mouseTop.value,
|
||||
scrollBottom: mouseTop.value,
|
||||
scrollLeft: mouseLeft.value,
|
||||
scrollRight: mouseLeft.value,
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
};
|
||||
const updateContentStyle = () => {
|
||||
if (!containerRef.value || !dropdownRef.value || !contentRef.value) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
if (props.autoFitMinWidth) {
|
||||
style.minWidth = `${triggerRect.width}px`;
|
||||
}
|
||||
if (props.autoFitWidth) {
|
||||
style.width = `${triggerRect.width}px`;
|
||||
}
|
||||
contentStyle.value = style;
|
||||
if (props.autoFitPosition) {
|
||||
nextTick(() => {
|
||||
const triggerRect2 = props.alignPoint ? getTriggerRect() : getElementScrollRect(dropdownRef.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);
|
||||
style.top = `${fitTop}px`;
|
||||
style.left = `${fitLeft}px`;
|
||||
contentStyle.value = {
|
||||
...style
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
const updateMousePosition = (e) => {
|
||||
if (props.alignPoint) {
|
||||
const { pageX, pageY } = e;
|
||||
mousePosition.x = pageX;
|
||||
mousePosition.y = pageY;
|
||||
}
|
||||
};
|
||||
const getContentStyle = (placement, triggerRect, contentRect, {
|
||||
customStyle = {}
|
||||
} = {}) => {
|
||||
let { top, left } = getContentOffset(placement, triggerRect, contentRect);
|
||||
const style = {
|
||||
top: `${top}px`,
|
||||
left: `${left}px`,
|
||||
...customStyle
|
||||
};
|
||||
return {
|
||||
style
|
||||
};
|
||||
};
|
||||
const getPosition = (placement) => {
|
||||
if (["top", "top-start", "top-end"].includes(placement)) {
|
||||
return "top";
|
||||
}
|
||||
if (["bottom", "bottom-start", "bottom-end"].includes(placement)) {
|
||||
return "bottom";
|
||||
}
|
||||
if (["left", "left-start", "left-end"].includes(placement)) {
|
||||
return "left";
|
||||
}
|
||||
if (["right", "right-start", "right-end"].includes(placement)) {
|
||||
return "right";
|
||||
}
|
||||
return "bottom";
|
||||
};
|
||||
const getFitPlacement = (top, left, placement, triggerRect, contentRect) => {
|
||||
const position = getPosition(placement);
|
||||
if (["top", "bottom"].includes(position)) {
|
||||
if (contentRect.bottom > windowHeight.value) {
|
||||
top = triggerRect.scrollTop - contentRect.height - props.contentOffset;
|
||||
}
|
||||
if (contentRect.top < 0) {
|
||||
top = triggerRect.scrollBottom + props.contentOffset;
|
||||
}
|
||||
if (contentRect.left < 0) {
|
||||
left = left + (0 - contentRect.left);
|
||||
}
|
||||
if (contentRect.right > windowWidth.value) {
|
||||
left = left - (contentRect.right - windowWidth.value);
|
||||
}
|
||||
}
|
||||
if (["left", "right"].includes(position)) {
|
||||
if (contentRect.bottom > windowHeight.value) {
|
||||
top = top - (contentRect.bottom - windowHeight.value);
|
||||
}
|
||||
if (contentRect.top < 0) {
|
||||
top = top + (0 - contentRect.top);
|
||||
}
|
||||
if (contentRect.left < 0) {
|
||||
left = triggerRect.scrollRight + props.contentOffset;
|
||||
}
|
||||
if (contentRect.right > windowWidth.value) {
|
||||
left = triggerRect.scrollLeft - contentRect.width - props.contentOffset;
|
||||
}
|
||||
}
|
||||
return {
|
||||
top,
|
||||
left
|
||||
};
|
||||
};
|
||||
const getContentOffset = (placement, triggerRect, contentRect) => {
|
||||
switch (placement) {
|
||||
case "top":
|
||||
return {
|
||||
top: triggerRect.scrollTop - contentRect.height - props.contentOffset,
|
||||
left: triggerRect.scrollLeft + Math.round((triggerRect.width - contentRect.width) / 2)
|
||||
};
|
||||
case "top-start":
|
||||
return {
|
||||
top: triggerRect.scrollTop - contentRect.height - props.contentOffset,
|
||||
left: triggerRect.scrollLeft
|
||||
};
|
||||
case "top-end":
|
||||
return {
|
||||
top: triggerRect.scrollTop - contentRect.height - props.contentOffset,
|
||||
left: triggerRect.scrollRight - contentRect.width
|
||||
};
|
||||
case "bottom":
|
||||
return {
|
||||
top: triggerRect.scrollBottom + props.contentOffset,
|
||||
left: triggerRect.scrollLeft + Math.round((triggerRect.width - contentRect.width) / 2)
|
||||
};
|
||||
case "bottom-start":
|
||||
return {
|
||||
top: triggerRect.scrollBottom + props.contentOffset,
|
||||
left: triggerRect.scrollLeft
|
||||
};
|
||||
case "bottom-end":
|
||||
return {
|
||||
top: triggerRect.scrollBottom + props.contentOffset,
|
||||
left: triggerRect.scrollRight - contentRect.width
|
||||
};
|
||||
case "right":
|
||||
return {
|
||||
top: triggerRect.scrollTop + Math.round((triggerRect.height - contentRect.height) / 2),
|
||||
left: triggerRect.scrollRight + props.contentOffset
|
||||
};
|
||||
case "right-start":
|
||||
return {
|
||||
top: triggerRect.scrollTop,
|
||||
left: triggerRect.scrollRight + props.contentOffset
|
||||
};
|
||||
case "right-end":
|
||||
return {
|
||||
top: triggerRect.scrollBottom - contentRect.height,
|
||||
left: triggerRect.scrollRight + props.contentOffset
|
||||
};
|
||||
case "left":
|
||||
return {
|
||||
top: triggerRect.scrollTop + Math.round((triggerRect.height - contentRect.height) / 2),
|
||||
left: triggerRect.scrollLeft - contentRect.width - props.contentOffset
|
||||
};
|
||||
case "left-start":
|
||||
return {
|
||||
top: triggerRect.scrollTop,
|
||||
left: triggerRect.scrollLeft - contentRect.width - props.contentOffset
|
||||
};
|
||||
case "left-end":
|
||||
return {
|
||||
top: triggerRect.scrollBottom - contentRect.height,
|
||||
left: triggerRect.scrollLeft - contentRect.width - props.contentOffset
|
||||
};
|
||||
default:
|
||||
return {
|
||||
left: 0,
|
||||
top: 0
|
||||
};
|
||||
}
|
||||
};
|
||||
const handleScroll = useThrottleFn(() => {
|
||||
if (openState.value) {
|
||||
updateContentStyle();
|
||||
}
|
||||
}, 10);
|
||||
const handleClick = (e) => {
|
||||
if (props.disabled || openState.value && !props.clickToClose) {
|
||||
return;
|
||||
}
|
||||
if (triggerMethods.value.includes("click")) {
|
||||
updateMousePosition(e);
|
||||
toggle();
|
||||
}
|
||||
};
|
||||
const handleContextMenuClick = (e) => {
|
||||
if (props.disabled || openState.value && !props.clickToClose) {
|
||||
return;
|
||||
}
|
||||
if (triggerMethods.value.includes("contextMenu")) {
|
||||
e.preventDefault();
|
||||
if (props.alignPoint) {
|
||||
hide();
|
||||
}
|
||||
updateMousePosition(e);
|
||||
toggle();
|
||||
}
|
||||
};
|
||||
const handleMouseEnter = (e) => {
|
||||
if (props.disabled || !triggerMethods.value.includes("hover")) {
|
||||
return;
|
||||
}
|
||||
show(props.mouseEnterDelay);
|
||||
};
|
||||
const handleMouseEnterWithContext = (e) => {
|
||||
if (!props.popupContainer) {
|
||||
return;
|
||||
}
|
||||
dropdownCtx == null ? void 0 : dropdownCtx.onMouseenter(e);
|
||||
handleMouseEnter();
|
||||
};
|
||||
const handleMouseLeave = (e) => {
|
||||
if (props.disabled || !triggerMethods.value.includes("hover")) {
|
||||
return;
|
||||
}
|
||||
hide(props.mouseLeaveDelay);
|
||||
};
|
||||
const handleMouseLeaveWithContext = (e) => {
|
||||
if (!props.popupContainer) {
|
||||
return;
|
||||
}
|
||||
dropdownCtx == null ? void 0 : dropdownCtx.onMouseleave(e);
|
||||
handleMouseLeave();
|
||||
};
|
||||
const handleFocusin = () => {
|
||||
if (props.disabled || !triggerMethods.value.includes("focus")) {
|
||||
return;
|
||||
}
|
||||
show(props.focusDelay);
|
||||
};
|
||||
const handleFocusout = () => {
|
||||
if (props.disabled || !triggerMethods.value.includes("focus")) {
|
||||
return;
|
||||
}
|
||||
if (!props.blurToClose) {
|
||||
return;
|
||||
}
|
||||
hide();
|
||||
};
|
||||
const handleContextHide = () => {
|
||||
hide();
|
||||
dropdownCtx == null ? void 0 : dropdownCtx.hide();
|
||||
};
|
||||
const addChildRef = (ref2) => {
|
||||
childrenRefs.add(ref2);
|
||||
dropdownCtx == null ? void 0 : dropdownCtx.addChildRef(ref2);
|
||||
};
|
||||
const removeChildRef = (ref2) => {
|
||||
childrenRefs.delete(ref2);
|
||||
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: 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))) {
|
||||
return;
|
||||
}
|
||||
for (const item of childrenRefs) {
|
||||
if ((_c = item.value) == null ? void 0 : _c.contains(e.target)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
hide();
|
||||
});
|
||||
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));
|
||||
children.value = transformedSlotContent;
|
||||
return h(Fragment, children.value);
|
||||
};
|
||||
onMounted(() => {
|
||||
if (props.updateAtScroll) {
|
||||
scrollElements = getScrollElements(dropdownRef.value);
|
||||
for (const item of scrollElements) {
|
||||
item.addEventListener("scroll", handleScroll);
|
||||
}
|
||||
}
|
||||
window.addEventListener("resize", handleScroll);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
dropdownCtx == null ? void 0 : dropdownCtx.removeChildRef(contentRef);
|
||||
if (scrollElements) {
|
||||
for (const item of scrollElements) {
|
||||
item.removeEventListener("scroll", handleScroll);
|
||||
}
|
||||
scrollElements = void 0;
|
||||
}
|
||||
removeContentResizeObserver();
|
||||
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
|
||||
}));
|
||||
provide("openState", openState);
|
||||
expose({ show, hide, toggle });
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock(Fragment, null, [
|
||||
createVNode(unref(RenderFunction), mergeProps({ renderFunc: onlyChildRenderFunc }, _ctx.$attrs), null, 16),
|
||||
createVNode(_sfc_main$1, {
|
||||
to: __props.popupContainer,
|
||||
disabled: __props.disabled
|
||||
}, {
|
||||
default: withCtx(() => {
|
||||
var _a;
|
||||
return [
|
||||
openState.value ? (openBlock(), createElementBlock("div", {
|
||||
key: 0,
|
||||
ref_key: "contentRef",
|
||||
ref: contentRef,
|
||||
class: normalizeClass([
|
||||
"layui-dropdown-content",
|
||||
"layui-anim",
|
||||
"layui-anim-upbit",
|
||||
props.contentClass
|
||||
]),
|
||||
style: normalizeStyle([contentStyle.value, (_a = props.contentStyle) != null ? _a : ""]),
|
||||
onMouseenter: handleMouseEnterWithContext,
|
||||
onMouseleave: handleMouseLeaveWithContext
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "content")
|
||||
], 38)) : createCommentVNode("", true)
|
||||
];
|
||||
}),
|
||||
_: 3
|
||||
}, 8, ["to", "disabled"])
|
||||
], 64);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { RenderFunction as R, _sfc_main as _, component as c, dropdownInjectionKey as d };
|
3
package/component/es/dropdownMenu/index.js
Normal file
3
package/component/es/dropdownMenu/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
21
package/component/es/dropdownMenu/index2.js
Normal file
21
package/component/es/dropdownMenu/index2.js
Normal file
@ -0,0 +1,21 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var _export_sfc = (sfc, props) => {
|
||||
const target = sfc.__vccOpts || sfc;
|
||||
for (const [key, val] of props) {
|
||||
target[key] = val;
|
||||
}
|
||||
return target;
|
||||
};
|
||||
const _sfc_main = {
|
||||
name: "LayDropdownMenu"
|
||||
};
|
||||
const _hoisted_1 = { class: "layui-menu layui-dropdown-menu" };
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return openBlock(), createElementBlock("ul", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
}
|
||||
var LayDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
const component = withInstall(LayDropdownMenu);
|
||||
export { LayDropdownMenu as L, _export_sfc as _, component as c };
|
5
package/component/es/dropdownMenuItem/index.js
Normal file
5
package/component/es/dropdownMenuItem/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../dropdown/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
51
package/component/es/dropdownMenuItem/index2.js
Normal file
51
package/component/es/dropdownMenuItem/index2.js
Normal file
@ -0,0 +1,51 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, inject, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createCommentVNode } from "vue";
|
||||
import { d as dropdownInjectionKey } from "../dropdown/index2.js";
|
||||
const _hoisted_1 = { class: "layui-menu-body-title" };
|
||||
const _hoisted_2 = {
|
||||
key: 0,
|
||||
class: "layui-dropdown-menu-prefix"
|
||||
};
|
||||
const _hoisted_3 = {
|
||||
key: 0,
|
||||
class: "layui-dropdown-menu-suffix"
|
||||
};
|
||||
const __default__ = {
|
||||
name: "LayDropdownMenuItem"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
disabled: { type: Boolean, default: false }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
inject("openState");
|
||||
const dropdownCtx = inject(dropdownInjectionKey, void 0);
|
||||
const handleClick = () => {
|
||||
if (props.disabled) {
|
||||
return;
|
||||
}
|
||||
dropdownCtx == null ? void 0 : dropdownCtx.hide();
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("li", {
|
||||
onClick: handleClick,
|
||||
class: normalizeClass({ "layui-disabled": __props.disabled }),
|
||||
style: normalizeStyle(_ctx.$slots.suffix ? `justify-content: space-between;` : "")
|
||||
}, [
|
||||
createElementVNode("span", _hoisted_1, [
|
||||
_ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
||||
renderSlot(_ctx.$slots, "prefix")
|
||||
])) : createCommentVNode("", true),
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]),
|
||||
_ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
||||
renderSlot(_ctx.$slots, "suffix")
|
||||
])) : createCommentVNode("", true)
|
||||
], 6);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { _sfc_main as _, component as c };
|
71
package/component/es/dropdownSubMenu/index.js
Normal file
71
package/component/es/dropdownSubMenu/index.js
Normal file
@ -0,0 +1,71 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createBlock, withCtx, createVNode, renderSlot, createSlots, unref } from "vue";
|
||||
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 "../_chunks/@vueuse/index.js";
|
||||
const __default__ = {
|
||||
name: "LayDropdownSubMenu"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
trigger: { default: "hover" },
|
||||
placement: { default: "right-start" },
|
||||
disabled: { type: Boolean, default: false },
|
||||
contentOffset: { default: 2 }
|
||||
},
|
||||
setup(__props) {
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createBlock(_sfc_main$1, {
|
||||
trigger: __props.trigger,
|
||||
placement: __props.placement,
|
||||
"auto-fit-min-width": false,
|
||||
contentOffset: __props.contentOffset,
|
||||
disabled: __props.disabled,
|
||||
updateAtScroll: ""
|
||||
}, {
|
||||
content: withCtx(() => [
|
||||
createVNode(LayDropdownMenu, null, {
|
||||
default: withCtx(() => [
|
||||
renderSlot(_ctx.$slots, "content")
|
||||
]),
|
||||
_: 3
|
||||
})
|
||||
]),
|
||||
default: withCtx(() => [
|
||||
createVNode(_sfc_main$2, { disabled: __props.disabled }, createSlots({
|
||||
suffix: withCtx(() => [
|
||||
renderSlot(_ctx.$slots, "suffix", {}, () => [
|
||||
createVNode(unref(_sfc_main$2E), {
|
||||
type: "layui-icon-right",
|
||||
size: "14px"
|
||||
})
|
||||
])
|
||||
]),
|
||||
_: 2
|
||||
}, [
|
||||
_ctx.$slots.prefix ? {
|
||||
name: "prefix",
|
||||
fn: withCtx(() => [
|
||||
renderSlot(_ctx.$slots, "prefix")
|
||||
]),
|
||||
key: "0"
|
||||
} : void 0,
|
||||
_ctx.$slots.default ? {
|
||||
name: "default",
|
||||
fn: withCtx(() => [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]),
|
||||
key: "1"
|
||||
} : void 0
|
||||
]), 1032, ["disabled"])
|
||||
]),
|
||||
_: 3
|
||||
}, 8, ["trigger", "placement", "contentOffset", "disabled"]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/empty/index.css
Normal file
1
package/component/es/empty/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-empty{margin:0 8px;font-size:14px;line-height:22px;text-align:center}.layui-empty-image{margin-bottom:8px}.layui-empty-image img{height:100px;margin:auto}.layui-empty-description{margin:0}.layui-empty-extra{margin-top:30px}
|
14
package/component/es/empty/index.js
Normal file
14
package/component/es/empty/index.js
Normal file
@ -0,0 +1,14 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../datePicker/index2.js";
|
||||
import "../_chunks/dayjs/index.js";
|
||||
import "../_chunks/@umijs/index.js";
|
||||
import "../input/index2.js";
|
||||
import "../checkbox/index2.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
import "../dropdown/index2.js";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
import "../_chunks/vue-i18n/index.js";
|
||||
import "../_chunks/@intlify/index.js";
|
||||
import "../_chunks/@vue/index.js";
|
44
package/component/es/empty/index2.js
Normal file
44
package/component/es/empty/index2.js
Normal file
File diff suppressed because one or more lines are too long
1
package/component/es/exception/index.css
Normal file
1
package/component/es/exception/index.css
Normal file
File diff suppressed because one or more lines are too long
63
package/component/es/exception/index.js
Normal file
63
package/component/es/exception/index.js
Normal file
File diff suppressed because one or more lines are too long
1
package/component/es/field/index.css
Normal file
1
package/component/es/field/index.css
Normal file
@ -0,0 +1 @@
|
||||
:root{--field-border-color: var(--global-neutral-color-3);--field-border-radius: var(--global-border-radius)}.layui-field{margin-bottom:10px;padding:0;border-width:1px;border-color:var(--field-border-color);border-style:solid}.layui-field legend{margin-left:20px;padding:0 10px;font-size:20px;font-weight:300}.layui-field-title{margin:10px 0 20px;border-width:1px 0 0}.layui-field-box{padding:15px}.layui-field-title .layui-field-box{padding:10px 0}
|
39
package/component/es/field/index.js
Normal file
39
package/component/es/field/index.js
Normal file
@ -0,0 +1,39 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, unref, openBlock, createElementBlock, createElementVNode, toDisplayString, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ":root{--field-border-color: var(--global-neutral-color-3);--field-border-radius: var(--global-border-radius)}.layui-field{margin-bottom:10px;padding:0;border-width:1px;border-color:var(--field-border-color);border-style:solid}.layui-field legend{margin-left:20px;padding:0 10px;font-size:20px;font-weight:300}.layui-field-title{margin:10px 0 20px;border-width:1px 0 0}.layui-field-box{padding:15px}.layui-field-title .layui-field-box{padding:10px 0}\n")();
|
||||
const _hoisted_1 = {
|
||||
key: 0,
|
||||
class: "layui-field"
|
||||
};
|
||||
const _hoisted_2 = { class: "layui-field-box" };
|
||||
const _hoisted_3 = {
|
||||
key: 1,
|
||||
class: "layui-field layui-field-title"
|
||||
};
|
||||
const _hoisted_4 = { name: "docend" };
|
||||
const __default__ = {
|
||||
name: "LayField"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
title: null
|
||||
},
|
||||
setup(__props) {
|
||||
const slot = useSlots();
|
||||
return (_ctx, _cache) => {
|
||||
return unref(slot).default ? (openBlock(), createElementBlock("fieldset", _hoisted_1, [
|
||||
createElementVNode("legend", null, toDisplayString(__props.title), 1),
|
||||
createElementVNode("div", _hoisted_2, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
])
|
||||
])) : (openBlock(), createElementBlock("fieldset", _hoisted_3, [
|
||||
createElementVNode("legend", null, [
|
||||
createElementVNode("a", _hoisted_4, toDisplayString(__props.title), 1)
|
||||
])
|
||||
]));
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/footer/index.css
Normal file
1
package/component/es/footer/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-footer{box-sizing:border-box}
|
3
package/component/es/footer/index.js
Normal file
3
package/component/es/footer/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
19
package/component/es/footer/index2.js
Normal file
19
package/component/es/footer/index2.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-footer{box-sizing:border-box}\n")();
|
||||
const _hoisted_1 = { class: "layui-footer" };
|
||||
const __default__ = {
|
||||
name: "LayFooter"
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
...__default__,
|
||||
setup(__props) {
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { _sfc_main as _, component as c };
|
1
package/component/es/form/index.css
Normal file
1
package/component/es/form/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-form-item{margin-bottom:20px;clear:both}.layui-form-item-right .layui-form-label{text-align:right}.layui-form-item-left .layui-form-label{text-align:left}.layui-form-item-top .layui-form-label{text-align:left;float:none}.layui-form-item-top>div{margin-left:0}.layui-form-item:after{content:" ";clear:both;display:block;height:0}.layui-form-label{float:left;display:block;width:95px;padding-right:15px;line-height:38px;font-weight:400}.layui-form-label-col{display:block;float:none;padding:9px 0;line-height:20px;text-align:left}.layui-form-item .layui-inline{margin-bottom:5px;margin-right:10px}.layui-input-block{margin-left:110px;min-height:36px}.layui-input-inline{display:inline-block;vertical-align:middle}.layui-form-item .layui-input-inline{float:left;width:190px;margin-right:10px}.layui-form-text .layui-input-inline{width:auto}.layui-form-mid{float:left;display:block;padding:9px 0!important;line-height:20px;margin-right:10px}.layui-form-danger+.layui-form-select .layui-input,.layui-form-danger:focus{border-color:#ff5722!important}.layui-form-item .layui-form-checkbox{margin-top:4px}.layui-form-item .layui-form-checkbox[lay-skin=primary]{margin-top:10px}.layui-required{color:#ff5722;font-size:12px;line-height:1}.layui-form .layui-form-item .layui-input-block .layui-form-danger,.layui-form .layui-form-item .layui-input-inline .layui-form-danger,.layui-form .layui-form-item .layui-input-block .layui-form-danger .layui-textarea,.layui-form .layui-form-item .layui-input-inline .layui-form-danger .layui-textarea,.layui-form .layui-form-item .layui-input-block .layui-form-danger .layui-tag-input,.layui-form .layui-form-item .layui-input-inline .layui-form-danger .layui-tag-input,.layui-form .layui-form-item .layui-input-block .layui-form-danger .layui-input,.layui-form .layui-form-item .layui-input-inline .layui-form-danger .layui-input{border-color:#ff5722!important}.layui-error-message{color:#ff5722;font-size:12px;line-height:1;padding-top:5px;position:absolute;top:100%;left:0}.layui-error-message-anim{-ms-transform-origin:0 0;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-animation:layui-top-show-anim .3s ease 1;animation:layui-top-show-anim .3s ease 1}@keyframes layui-top-show-anim{0%{opacity:.3;transform:rotateX(45deg)}to{opacity:1;transform:rotateX(0)}}
|
109
package/component/es/form/index.js
Normal file
109
package/component/es/form/index.js
Normal file
@ -0,0 +1,109 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, onMounted, provide, reactive, toRefs, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => '.layui-form-item{margin-bottom:20px;clear:both}.layui-form-item-right .layui-form-label{text-align:right}.layui-form-item-left .layui-form-label{text-align:left}.layui-form-item-top .layui-form-label{text-align:left;float:none}.layui-form-item-top>div{margin-left:0}.layui-form-item:after{content:" ";clear:both;display:block;height:0}.layui-form-label{float:left;display:block;width:95px;padding-right:15px;line-height:38px;font-weight:400}.layui-form-label-col{display:block;float:none;padding:9px 0;line-height:20px;text-align:left}.layui-form-item .layui-inline{margin-bottom:5px;margin-right:10px}.layui-input-block{margin-left:110px;min-height:36px}.layui-input-inline{display:inline-block;vertical-align:middle}.layui-form-item .layui-input-inline{float:left;width:190px;margin-right:10px}.layui-form-text .layui-input-inline{width:auto}.layui-form-mid{float:left;display:block;padding:9px 0!important;line-height:20px;margin-right:10px}.layui-form-danger+.layui-form-select .layui-input,.layui-form-danger:focus{border-color:#ff5722!important}.layui-form-item .layui-form-checkbox{margin-top:4px}.layui-form-item .layui-form-checkbox[lay-skin=primary]{margin-top:10px}.layui-required{color:#ff5722;font-size:12px;line-height:1}.layui-form .layui-form-item .layui-input-block .layui-form-danger,.layui-form .layui-form-item .layui-input-inline .layui-form-danger,.layui-form .layui-form-item .layui-input-block .layui-form-danger .layui-textarea,.layui-form .layui-form-item .layui-input-inline .layui-form-danger .layui-textarea,.layui-form .layui-form-item .layui-input-block .layui-form-danger .layui-tag-input,.layui-form .layui-form-item .layui-input-inline .layui-form-danger .layui-tag-input,.layui-form .layui-form-item .layui-input-block .layui-form-danger .layui-input,.layui-form .layui-form-item .layui-input-inline .layui-form-danger .layui-input{border-color:#ff5722!important}.layui-error-message{color:#ff5722;font-size:12px;line-height:1;padding-top:5px;position:absolute;top:100%;left:0}.layui-error-message-anim{-ms-transform-origin:0 0;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-animation:layui-top-show-anim .3s ease 1;animation:layui-top-show-anim .3s ease 1}@keyframes layui-top-show-anim{0%{opacity:.3;transform:rotateX(45deg)}to{opacity:1;transform:rotateX(0)}}\n')();
|
||||
const __default__ = {
|
||||
name: "LayForm"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
model: { default: function() {
|
||||
return {};
|
||||
} },
|
||||
required: { type: Boolean },
|
||||
rules: null,
|
||||
initValidate: { type: Boolean, default: false },
|
||||
requiredIcons: { default: "" },
|
||||
requiredErrorMessage: null,
|
||||
validateMessage: null,
|
||||
useCN: { type: Boolean, default: true }
|
||||
},
|
||||
emits: ["submit"],
|
||||
setup(__props, { expose, emit }) {
|
||||
const props = __props;
|
||||
const formItems = [];
|
||||
const formItemMap = {};
|
||||
onMounted(() => {
|
||||
var _a;
|
||||
props.initValidate && ((_a = validate()) == null ? void 0 : _a.catch((err) => {
|
||||
}));
|
||||
});
|
||||
const submit = function() {
|
||||
let _isValidate = false;
|
||||
validate((isValidate, model, errors) => {
|
||||
_isValidate = isValidate;
|
||||
emit("submit", isValidate, model, errors);
|
||||
});
|
||||
return _isValidate;
|
||||
};
|
||||
const validate = function(fields, callback) {
|
||||
let validateItems = formItems;
|
||||
if (typeof fields === "function") {
|
||||
callback = fields;
|
||||
} 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]));
|
||||
}
|
||||
let errorsArrs = [];
|
||||
validateItems.forEach((filed) => {
|
||||
filed.validate((errors, _fields) => {
|
||||
errorsArrs = errorsArrs.concat(errors);
|
||||
});
|
||||
});
|
||||
const isValidate = errorsArrs.length === 0;
|
||||
if (typeof callback === "function") {
|
||||
isValidate ? callback(true, props.model, null) : callback(false, props.model, errorsArrs);
|
||||
return null;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
const callbackParams = {
|
||||
isValidate,
|
||||
model: props.model,
|
||||
errors: isValidate ? null : errorsArrs
|
||||
};
|
||||
callbackParams.isValidate ? resolve(callbackParams) : reject(callbackParams);
|
||||
});
|
||||
};
|
||||
const clearValidate = function(fields) {
|
||||
const clearFields = !fields ? [] : [].concat(fields);
|
||||
if (clearFields.length === 0) {
|
||||
formItems.forEach((filed) => filed.clearValidate());
|
||||
} else {
|
||||
clearFields.forEach((field) => formItemMap[field] && formItemMap[field].clearValidate());
|
||||
}
|
||||
};
|
||||
const reset = function() {
|
||||
for (const key in props.model) {
|
||||
props.model[key] = null;
|
||||
}
|
||||
setTimeout(() => {
|
||||
var _a;
|
||||
return (_a = validate()) == null ? void 0 : _a.catch((err) => {
|
||||
});
|
||||
}, 0);
|
||||
};
|
||||
const addField = function(item) {
|
||||
formItems.push(item);
|
||||
formItemMap[item.prop] = item;
|
||||
};
|
||||
expose({ validate, clearValidate, reset });
|
||||
provide("LayForm", reactive({
|
||||
formItems,
|
||||
addField,
|
||||
clearValidate,
|
||||
validate,
|
||||
...toRefs(props)
|
||||
}));
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("form", {
|
||||
class: "layui-form",
|
||||
onsubmit: submit
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
221
package/component/es/formItem/index.js
Normal file
221
package/component/es/formItem/index.js
Normal file
@ -0,0 +1,221 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, inject, ref, computed, watch, onMounted, reactive, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
||||
import { S as Schema } from "../_chunks/async-validator/index.js";
|
||||
var cnValidateMessage = {
|
||||
default: "%s\u9A8C\u8BC1\u5931\u8D25",
|
||||
required: "%s\u4E0D\u80FD\u4E3A\u7A7A",
|
||||
enum: "%s\u4E0D\u5728\u679A\u4E3E%s\u91CC\u9762",
|
||||
whitespace: "%s\u4E0D\u80FD\u4E3A\u7A7A",
|
||||
date: {
|
||||
format: "%s\u65E5\u671F%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u683C\u5F0F\u7684\u65E5\u671F%s",
|
||||
parse: "%s\u65E0\u6CD5\u89E3\u6790\u4E3A\u65E5\u671F,%s\u662F\u65E0\u6548\u7684",
|
||||
invalid: "%s\u65E5\u671F%s\u662F\u65E0\u6548\u7684"
|
||||
},
|
||||
types: {
|
||||
number: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u6570\u5B57",
|
||||
boolean: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u5E03\u5C14\u7C7B\u578B",
|
||||
method: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u65B9\u6CD5",
|
||||
regexp: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u6B63\u5219\u8868\u8FBE\u5F0F",
|
||||
integer: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u6574\u578B\u6570\u5B57",
|
||||
float: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u6D6E\u70B9\u5C0F\u6570",
|
||||
array: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u6570\u7EC4",
|
||||
object: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u5BF9\u8C61",
|
||||
enum: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u679A\u4E3E",
|
||||
date: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u65E5\u671F",
|
||||
url: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684url",
|
||||
hex: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u5341\u516D\u8FDB\u5236",
|
||||
email: "%s\u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u7684\u90AE\u7BB1"
|
||||
},
|
||||
string: {
|
||||
len: "%s\u5FC5\u987B\u662F\u957F\u5EA6\u4E3A%s\u4E2A\u5B57\u7B26",
|
||||
min: "%s\u6700\u5C0F\u957F\u5EA6\u4E3A%s\u4E2A\u5B57\u7B26",
|
||||
max: "%s\u6700\u957F%s\u4E2A\u5B57\u7B26",
|
||||
range: "%s\u5B57\u7B26\u957F\u5EA6\u9700\u8981\u5728%s\u548C%s\u4E4B\u95F4"
|
||||
},
|
||||
number: {
|
||||
len: "%s\u957F\u5EA6\u5FC5\u987B\u4E3A%s",
|
||||
min: "%s\u5FC5\u987B\u5C0F\u4E8E%s",
|
||||
max: "%s\u5FC5\u987B\u5927\u4E8E%s",
|
||||
range: "%s\u9700\u8981\u5728%s\u548C%s\u4E4B\u95F4"
|
||||
},
|
||||
array: {
|
||||
len: "%s\u957F\u5EA6\u5FC5\u987B\u4E3A%s",
|
||||
min: "%s\u957F\u5EA6\u5FC5\u987B\u5C0F\u4E8E%s",
|
||||
max: "%s\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E%s",
|
||||
range: "%s\u957F\u5EA6\u9700\u8981\u5728%s\u548C%s\u4E4B\u95F4"
|
||||
},
|
||||
pattern: {
|
||||
mismatch: "%s\u503C%s\u4E0D\u80FD\u5339\u914D%s"
|
||||
}
|
||||
};
|
||||
const __default__ = {
|
||||
name: "LayFormItem"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
prop: null,
|
||||
mode: { default: "block" },
|
||||
label: null,
|
||||
labelPosition: { default: "right" },
|
||||
labelWidth: { default: 95 },
|
||||
errorMessage: null,
|
||||
rules: null,
|
||||
required: { type: Boolean },
|
||||
requiredErrorMessage: null
|
||||
},
|
||||
setup(__props, { expose }) {
|
||||
const props = __props;
|
||||
const layForm = inject("LayForm", {});
|
||||
const formItemRef = ref();
|
||||
const slotParent = ref();
|
||||
const isRequired = computed(() => {
|
||||
return props.required || layForm.required;
|
||||
});
|
||||
const ruleItems = computed(() => {
|
||||
const prop = props.prop;
|
||||
if (!prop) {
|
||||
return {};
|
||||
}
|
||||
let rulesArrs = [];
|
||||
if (isRequired.value) {
|
||||
rulesArrs.push({ required: true });
|
||||
}
|
||||
if (props.rules) {
|
||||
rulesArrs = rulesArrs.concat(props.rules);
|
||||
}
|
||||
if (layForm.rules && layForm.rules[prop]) {
|
||||
rulesArrs = rulesArrs.concat(layForm.rules[prop]);
|
||||
}
|
||||
return rulesArrs;
|
||||
});
|
||||
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) => {
|
||||
if (props.prop && ruleItems.value.length > 0) {
|
||||
const descriptor = {};
|
||||
descriptor[layForm.useCN ? props.label || props.prop : props.prop] = ruleItems.value;
|
||||
const validator = new Schema(descriptor);
|
||||
let model = {};
|
||||
let validateMessage = null;
|
||||
if (layForm.useCN) {
|
||||
validateMessage = Object.assign({}, cnValidateMessage, layForm.validateMessage);
|
||||
model[props.label || props.prop] = filedValue.value;
|
||||
} else {
|
||||
layForm.validateMessage && (validateMessage = layForm.validateMessage);
|
||||
model[props.prop] = filedValue.value;
|
||||
}
|
||||
layForm.requiredErrorMessage && (validateMessage = Object.assign(validateMessage, {
|
||||
required: layForm.requiredErrorMessage
|
||||
}));
|
||||
props.requiredErrorMessage && (validateMessage = Object.assign(validateMessage, {
|
||||
required: props.requiredErrorMessage
|
||||
}));
|
||||
validateMessage && validator.messages(validateMessage);
|
||||
validator.validate(model, (errors, fields) => {
|
||||
var _a, _b;
|
||||
errorStatus.value = errors !== null && errors.length > 0;
|
||||
const slotParentDiv = slotParent.value;
|
||||
if (errorStatus.value) {
|
||||
const _errors = errors;
|
||||
layForm.useCN && _errors.forEach((error) => {
|
||||
error.label = props.label;
|
||||
error.field = props.prop;
|
||||
});
|
||||
errorMsg.value = (_a = props.errorMessage) != null ? _a : _errors[0].message;
|
||||
(slotParentDiv == null ? void 0 : slotParentDiv.childElementCount) > 0 && ((_b = slotParentDiv == null ? void 0 : slotParentDiv.firstElementChild) == null ? void 0 : _b.classList.add("layui-form-danger"));
|
||||
callback && callback(_errors, fields);
|
||||
} else {
|
||||
clearValidate();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const clearValidate = () => {
|
||||
var _a;
|
||||
errorStatus.value = false;
|
||||
errorMsg.value = "";
|
||||
const slotParentDiv = slotParent.value;
|
||||
(slotParentDiv == null ? void 0 : slotParentDiv.childElementCount) > 0 && ((_a = slotParentDiv == null ? void 0 : slotParentDiv.firstElementChild) == null ? void 0 : _a.classList.remove("layui-form-danger"));
|
||||
};
|
||||
expose({ validate, clearValidate });
|
||||
onMounted(() => {
|
||||
if (props.prop) {
|
||||
layForm.addField(reactive({
|
||||
...toRefs(props),
|
||||
$el: formItemRef,
|
||||
validate,
|
||||
clearValidate
|
||||
}));
|
||||
}
|
||||
});
|
||||
const getMarginLeft = computed(() => {
|
||||
if (props.mode == "block") {
|
||||
if (props.labelPosition != "top") {
|
||||
let labelWidth = typeof props.labelWidth === "string" ? parseFloat(props.labelWidth) : props.labelWidth;
|
||||
labelWidth += 15;
|
||||
return {
|
||||
"margin-left": `${labelWidth}px`
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
"margin-left": "0px"
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
var _a;
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-form-item", [`layui-form-item-${__props.labelPosition}`]]),
|
||||
ref_key: "formItemRef",
|
||||
ref: formItemRef
|
||||
}, [
|
||||
createElementVNode("label", {
|
||||
class: "layui-form-label",
|
||||
style: normalizeStyle({ width: __props.labelWidth + "px" })
|
||||
}, [
|
||||
props.prop && unref(isRequired) ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass(["layui-required", "layui-icon"].concat((_a = unref(layForm).requiredIcons) != null ? _a : ""))
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "required", {
|
||||
props: { ...props, model: unref(layForm).model }
|
||||
}, () => [
|
||||
createTextVNode(toDisplayString(unref(layForm).requiredIcons ? "" : "*"), 1)
|
||||
])
|
||||
], 2)) : createCommentVNode("", true),
|
||||
renderSlot(_ctx.$slots, "label", {
|
||||
props: { ...props, model: unref(layForm).model }
|
||||
}, () => [
|
||||
createTextVNode(toDisplayString(__props.label), 1)
|
||||
])
|
||||
], 4),
|
||||
createElementVNode("div", {
|
||||
class: normalizeClass([__props.mode ? "layui-input-" + __props.mode : ""]),
|
||||
style: normalizeStyle(unref(getMarginLeft))
|
||||
}, [
|
||||
createElementVNode("div", {
|
||||
ref_key: "slotParent",
|
||||
ref: slotParent
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default", {
|
||||
props: { ...props, model: unref(layForm).model }
|
||||
})
|
||||
], 512),
|
||||
errorStatus.value ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass([
|
||||
"layui-error-message",
|
||||
{ "layui-error-message-anim": errorStatus.value }
|
||||
])
|
||||
}, toDisplayString(errorMsg.value), 3)) : createCommentVNode("", true)
|
||||
], 6)
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/fullscreen/index.css
Normal file
1
package/component/es/fullscreen/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-fullscreen{top:0;left:0;width:100%;height:100%;position:fixed;overflow:auto;z-index:10}
|
163
package/component/es/fullscreen/index.js
Normal file
163
package/component/es/fullscreen/index.js
Normal file
@ -0,0 +1,163 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, ref, computed, onMounted, onBeforeUnmount, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-fullscreen{top:0;left:0;width:100%;height:100%;position:fixed;overflow:auto;z-index:10}\n")();
|
||||
const __default__ = {
|
||||
name: "LayFullscreen"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
target: null,
|
||||
immersive: { type: Boolean, default: true },
|
||||
position: null,
|
||||
zIndex: null
|
||||
},
|
||||
emits: ["fullscreenchange"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const methodMap = [
|
||||
[
|
||||
"requestFullscreen",
|
||||
"exitFullscreen",
|
||||
"fullscreenElement",
|
||||
"fullscreenEnabled",
|
||||
"fullscreenchange",
|
||||
"fullscreenerror"
|
||||
],
|
||||
[
|
||||
"webkitRequestFullscreen",
|
||||
"webkitExitFullscreen",
|
||||
"webkitFullscreenElement",
|
||||
"webkitFullscreenEnabled",
|
||||
"webkitfullscreenchange",
|
||||
"webkitfullscreenerror"
|
||||
],
|
||||
[
|
||||
"webkitRequestFullScreen",
|
||||
"webkitCancelFullScreen",
|
||||
"webkitCurrentFullScreenElement",
|
||||
"webkitCancelFullScreen",
|
||||
"webkitfullscreenchange",
|
||||
"webkitfullscreenerror"
|
||||
],
|
||||
[
|
||||
"mozRequestFullScreen",
|
||||
"mozCancelFullScreen",
|
||||
"mozFullScreenElement",
|
||||
"mozFullScreenEnabled",
|
||||
"mozfullscreenchange",
|
||||
"mozfullscreenerror"
|
||||
],
|
||||
[
|
||||
"msRequestFullscreen",
|
||||
"msExitFullscreen",
|
||||
"msFullscreenElement",
|
||||
"msFullscreenEnabled",
|
||||
"MSFullscreenChange",
|
||||
"MSFullscreenError"
|
||||
]
|
||||
];
|
||||
const defaultElement = document.documentElement;
|
||||
let targetEl = ref(props.target || defaultElement);
|
||||
const isFullscreen = ref(false);
|
||||
let isSupported = false;
|
||||
const unprefixedMethods = methodMap[0];
|
||||
const fullscreenAPI = {};
|
||||
for (const methodList of methodMap) {
|
||||
if (methodList[1] in document) {
|
||||
for (const [index2, method] of methodList.entries()) {
|
||||
fullscreenAPI[unprefixedMethods[index2]] = method;
|
||||
}
|
||||
isSupported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
async function enter(targetEl2) {
|
||||
if (!isSupported)
|
||||
return;
|
||||
if (!targetEl2)
|
||||
targetEl2 = activeEl.value || defaultElement;
|
||||
let fullscreenEnter = null;
|
||||
if (props.immersive) {
|
||||
fullscreenEnter = Promise.resolve(targetEl2[fullscreenAPI.requestFullscreen]());
|
||||
} else {
|
||||
styleLayFullscreen(targetEl2, false);
|
||||
fullscreenEnter = Promise.resolve(targetEl2 == null ? void 0 : targetEl2.classList.add("layui-fullscreen"));
|
||||
}
|
||||
return await (fullscreenEnter == null ? void 0 : fullscreenEnter.then(() => {
|
||||
isFullscreen.value = true;
|
||||
emit("fullscreenchange", isFullscreen.value);
|
||||
return !!document.fullscreenElement;
|
||||
}));
|
||||
}
|
||||
async function exit(targetEl2) {
|
||||
if (!isSupported)
|
||||
return;
|
||||
if (!targetEl2)
|
||||
targetEl2 = activeEl.value || document;
|
||||
let fullscreenExit = null;
|
||||
if (props.immersive) {
|
||||
fullscreenExit = Promise.resolve(document[fullscreenAPI.exitFullscreen]());
|
||||
} else {
|
||||
if (targetEl2 instanceof Document)
|
||||
return;
|
||||
styleLayFullscreen(targetEl2, true);
|
||||
fullscreenExit = Promise.resolve(targetEl2 == null ? void 0 : targetEl2.classList.remove("layui-fullscreen"));
|
||||
}
|
||||
return await (fullscreenExit == null ? void 0 : fullscreenExit.then(() => {
|
||||
isFullscreen.value = false;
|
||||
emit("fullscreenchange", isFullscreen.value);
|
||||
return !!document.fullscreenElement;
|
||||
}));
|
||||
}
|
||||
async function toggle() {
|
||||
if (isFullscreen.value) {
|
||||
await exit(activeEl.value);
|
||||
} else {
|
||||
await enter(activeEl.value);
|
||||
}
|
||||
}
|
||||
const styleLayFullscreen = function(el, isRemove = false) {
|
||||
el.style.position = isRemove ? "" : props.position || "";
|
||||
el.style.zIndex = isRemove ? "" : props.zIndex || "";
|
||||
};
|
||||
const activeEl = computed(() => targetEl.value = props.target);
|
||||
const onFullscreenchange = function(event) {
|
||||
if (isFullscreen.value && !document.fullscreenElement) {
|
||||
if (props.immersive) {
|
||||
isFullscreen.value = false;
|
||||
emit("fullscreenchange", isFullscreen.value);
|
||||
} else if (event.key === "Escape") {
|
||||
exit(activeEl.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
const onKeydownF11 = function(event) {
|
||||
let isRootNodeFullscreen = props.immersive && (!activeEl.value || activeEl.value === defaultElement);
|
||||
if (event.key === "F11" && isRootNodeFullscreen) {
|
||||
event.preventDefault();
|
||||
toggle();
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
document.addEventListener(fullscreenAPI.fullscreenchange, onFullscreenchange);
|
||||
document.addEventListener("keydown", onFullscreenchange);
|
||||
document.addEventListener("keydown", onKeydownF11);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener(fullscreenAPI.fullscreenchange, onFullscreenchange);
|
||||
document.removeEventListener("keydown", onFullscreenchange);
|
||||
document.removeEventListener("keydown", onKeydownF11);
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return renderSlot(_ctx.$slots, "default", {
|
||||
isFullscreen: isFullscreen.value,
|
||||
enter,
|
||||
exit,
|
||||
toggle
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/header/index.css
Normal file
1
package/component/es/header/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-header{box-sizing:border-box;height:60px}
|
3
package/component/es/header/index.js
Normal file
3
package/component/es/header/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
19
package/component/es/header/index2.js
Normal file
19
package/component/es/header/index2.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, openBlock, createElementBlock, renderSlot } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-header{box-sizing:border-box;height:60px}\n")();
|
||||
const _hoisted_1 = { class: "layui-header" };
|
||||
const __default__ = {
|
||||
name: "LayHeader"
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
...__default__,
|
||||
setup(__props) {
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { _sfc_main as _, component as c };
|
5
package/component/es/icon/index.js
Normal file
5
package/component/es/icon/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
import { _ as _sfc_main$2E } from "../checkbox/index2.js";
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import "vue";
|
||||
const component = withInstall(_sfc_main$2E);
|
||||
export { component as default };
|
1
package/component/es/iconPicker/index.css
Normal file
1
package/component/es/iconPicker/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-dropdown{position:relative;display:inline-block}.layui-dropdown-content{position:absolute;z-index:99999;background-color:#fff;box-sizing:border-box;border:1px solid #e4e7ed;border-radius:2px;box-shadow:0 2px 12px #0000001a}.layui-dropdown-content>.layui-dropdown-menu{border-radius:var(--global-border-radius);margin:5px 0}.layui-dropdown-content .layui-menu{position:relative;background-color:#fff}.layui-dropdown-content .layui-menu li,.layui-dropdown-content .layui-menu-body-title a{padding:5px 15px}.layui-dropdown-content .layui-menu li{position:relative;display:flex;margin:1px 0;line-height:26px;color:#000c;font-size:14px;white-space:nowrap;cursor:pointer}.layui-dropdown-content .layui-menu li:hover{background-color:var(--global-neutral-color-2)}.layui-dropdown-content .layui-menu-body-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-dropdown-menu-prefix{margin-right:8px}.layui-dropdown-menu-suffix{margin-left:15px}.layui-dropdown-content .layui-menu li.layui-disabled:hover{background-color:inherit}:root{--icon-picker-border-radius: var(--global-border-radius);--icon-picker-checked-color: var(--global-checked-color)}.layui-iconpicker{position:relative;height:38px;line-height:38px;border-width:1px;border-style:solid;border-radius:var(--icon-picker-border-radius);cursor:pointer}.layui-iconpicker .layui-inline{height:36px;line-height:36px;vertical-align:top}.layui-iconpicker-title{padding-left:5px}.layui-iconpicker-main{padding:0 10px}.layui-iconpicker-main .layui-icon{font-size:20px}.layui-iconpicker-main .layui-inline{vertical-align:top}.layui-iconpicker-split .layui-iconpicker-main{padding:0 15px;border-right-width:1px;border-right-style:solid}.layui-iconpicker-suffix{position:relative;width:35px;text-align:center}.layui-iconpicker-suffix .layui-icon{font-size:14px;color:#00000080;transition:all .3s}.layui-iconpicker-down .layui-iconpicker-suffix .layui-icon-down{transform:rotate(180deg)}.layui-iconpicker-search{padding:10px;box-shadow:0 2px 8px #f0f1f2;border-bottom:1px solid whitesmoke}.layui-iconpicker-list{width:321px}.layui-iconpicker-list ul{margin:6px}.layui-iconpicker-list li{vertical-align:top;display:inline-block;width:60px;margin:2.5px;padding:5px;overflow:hidden;border:1px solid #eee;border-radius:2px;cursor:pointer;text-align:center}.layui-iconpicker-list li:hover{background-color:var(--global-neutral-color-1);color:#00000080}.layui-iconpicker-list li.layui-this{border-color:var(--icon-picker-checked-color);color:var(--icon-picker-checked-color)}.layui-iconpicker-list li .layui-icon{font-size:20px}.layui-iconpicker-list li .layui-elip{margin-top:2px;line-height:20px;font-size:12px}.layui-iconpicker-list .layui-none{margin:30px 0 35px}.layui-iconpicker-scroll .layui-iconpicker-list{max-height:200px}.layui-iconpicker-page{position:relative;padding:10px 10px 5px;border-top:1px solid #eee;text-align:right}.layui-iconpicker-page .layui-laypage{margin:0}.layui-iconpicker-page .layui-laypage a,.layui-iconpicker-page .layui-laypage span{padding:0 10px;color:#666}.layui-iconpicker-page .layui-laypage-count{position:absolute;left:10px}.layui-iconpicker-page .layui-laypage-curr .layui-laypage-em{background:0 0}.layui-iconpicker-page .layui-laypage-curr em{color:#666;color:#0009}.layui-iconpicker-page .layui-laypage-first,.layui-iconpicker-page .layui-laypage-last,.layui-iconpicker-page .layui-laypage-spr{display:none}.layui-colorpicker-disabled{opacity:.6}.layui-colorpicker-disabled,.layui-colorpicker-disabled *{cursor:not-allowed!important}
|
253
package/component/es/iconPicker/index.js
Normal file
253
package/component/es/iconPicker/index.js
Normal file
@ -0,0 +1,253 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, computed, ref, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, createVNode, createCommentVNode, Fragment, renderList, normalizeClass, unref, toDisplayString } from "vue";
|
||||
import { i as iconfont } from "../checkbox/index2.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";
|
||||
import "../_chunks/@vueuse/index.js";
|
||||
import "../dropdownMenu/index2.js";
|
||||
var index = /* @__PURE__ */ (() => ".layui-dropdown{position:relative;display:inline-block}.layui-dropdown-content{position:absolute;z-index:99999;background-color:#fff;box-sizing:border-box;border:1px solid #e4e7ed;border-radius:2px;box-shadow:0 2px 12px #0000001a}.layui-dropdown-content>.layui-dropdown-menu{border-radius:var(--global-border-radius);margin:5px 0}.layui-dropdown-content .layui-menu{position:relative;background-color:#fff}.layui-dropdown-content .layui-menu li,.layui-dropdown-content .layui-menu-body-title a{padding:5px 15px}.layui-dropdown-content .layui-menu li{position:relative;display:flex;margin:1px 0;line-height:26px;color:#000c;font-size:14px;white-space:nowrap;cursor:pointer}.layui-dropdown-content .layui-menu li:hover{background-color:var(--global-neutral-color-2)}.layui-dropdown-content .layui-menu-body-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-dropdown-menu-prefix{margin-right:8px}.layui-dropdown-menu-suffix{margin-left:15px}.layui-dropdown-content .layui-menu li.layui-disabled:hover{background-color:inherit}:root{--icon-picker-border-radius: var(--global-border-radius);--icon-picker-checked-color: var(--global-checked-color)}.layui-iconpicker{position:relative;height:38px;line-height:38px;border-width:1px;border-style:solid;border-radius:var(--icon-picker-border-radius);cursor:pointer}.layui-iconpicker .layui-inline{height:36px;line-height:36px;vertical-align:top}.layui-iconpicker-title{padding-left:5px}.layui-iconpicker-main{padding:0 10px}.layui-iconpicker-main .layui-icon{font-size:20px}.layui-iconpicker-main .layui-inline{vertical-align:top}.layui-iconpicker-split .layui-iconpicker-main{padding:0 15px;border-right-width:1px;border-right-style:solid}.layui-iconpicker-suffix{position:relative;width:35px;text-align:center}.layui-iconpicker-suffix .layui-icon{font-size:14px;color:#00000080;transition:all .3s}.layui-iconpicker-down .layui-iconpicker-suffix .layui-icon-down{transform:rotate(180deg)}.layui-iconpicker-search{padding:10px;box-shadow:0 2px 8px #f0f1f2;border-bottom:1px solid whitesmoke}.layui-iconpicker-list{width:321px}.layui-iconpicker-list ul{margin:6px}.layui-iconpicker-list li{vertical-align:top;display:inline-block;width:60px;margin:2.5px;padding:5px;overflow:hidden;border:1px solid #eee;border-radius:2px;cursor:pointer;text-align:center}.layui-iconpicker-list li:hover{background-color:var(--global-neutral-color-1);color:#00000080}.layui-iconpicker-list li.layui-this{border-color:var(--icon-picker-checked-color);color:var(--icon-picker-checked-color)}.layui-iconpicker-list li .layui-icon{font-size:20px}.layui-iconpicker-list li .layui-elip{margin-top:2px;line-height:20px;font-size:12px}.layui-iconpicker-list .layui-none{margin:30px 0 35px}.layui-iconpicker-scroll .layui-iconpicker-list{max-height:200px}.layui-iconpicker-page{position:relative;padding:10px 10px 5px;border-top:1px solid #eee;text-align:right}.layui-iconpicker-page .layui-laypage{margin:0}.layui-iconpicker-page .layui-laypage a,.layui-iconpicker-page .layui-laypage span{padding:0 10px;color:#666}.layui-iconpicker-page .layui-laypage-count{position:absolute;left:10px}.layui-iconpicker-page .layui-laypage-curr .layui-laypage-em{background:0 0}.layui-iconpicker-page .layui-laypage-curr em{color:#666;color:#0009}.layui-iconpicker-page .layui-laypage-first,.layui-iconpicker-page .layui-laypage-last,.layui-iconpicker-page .layui-laypage-spr{display:none}.layui-colorpicker-disabled{opacity:.6}.layui-colorpicker-disabled,.layui-colorpicker-disabled *{cursor:not-allowed!important}\n")();
|
||||
const _hoisted_1 = { class: "layui-inline layui-iconpicker-main" };
|
||||
const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", { class: "layui-inline layui-iconpicker-suffix" }, [
|
||||
/* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-down layui-anim" })
|
||||
], -1);
|
||||
const _hoisted_3 = { class: "layui-iconpicker-view layui-iconpicker-scroll" };
|
||||
const _hoisted_4 = {
|
||||
key: 0,
|
||||
class: "layui-iconpicker-search"
|
||||
};
|
||||
const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-search" }, null, -1);
|
||||
const _hoisted_6 = { class: "layui-iconpicker-list" };
|
||||
const _hoisted_7 = ["onClick"];
|
||||
const _hoisted_8 = { class: "layui-elip" };
|
||||
const _hoisted_9 = {
|
||||
key: 1,
|
||||
class: "layui-iconpicker-page"
|
||||
};
|
||||
const _hoisted_10 = {
|
||||
id: "layui-laypage-1",
|
||||
class: "layui-laypage layui-laypage-default"
|
||||
};
|
||||
const _hoisted_11 = { class: "layui-laypage-count" };
|
||||
const _hoisted_12 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-left" }, null, -1);
|
||||
const _hoisted_13 = [
|
||||
_hoisted_12
|
||||
];
|
||||
const _hoisted_14 = { class: "layui-laypage-curr" };
|
||||
const _hoisted_15 = /* @__PURE__ */ createElementVNode("em", { class: "layui-laypage-em" }, null, -1);
|
||||
const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", { class: "layui-laypage-spr" }, "\u2026", -1);
|
||||
const _hoisted_17 = /* @__PURE__ */ createElementVNode("a", {
|
||||
href: "javascript:;",
|
||||
class: "layui-laypage-last",
|
||||
title: "\u5C3E\u9875"
|
||||
}, "14", -1);
|
||||
const _hoisted_18 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-right" }, null, -1);
|
||||
const _hoisted_19 = [
|
||||
_hoisted_18
|
||||
];
|
||||
const __default__ = {
|
||||
name: "LayIconPicker"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
page: { type: Boolean, default: false },
|
||||
modelValue: { default: "layui-icon-face-smile" },
|
||||
disabled: { type: Boolean, default: false },
|
||||
showSearch: { type: Boolean },
|
||||
contentClass: null,
|
||||
contentStyle: null
|
||||
},
|
||||
emits: ["update:modelValue", "change"],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
const selectedIcon = computed(() => props.modelValue);
|
||||
const dropdownRef = ref(null);
|
||||
const selectIcon = function(icon) {
|
||||
var _a;
|
||||
emit("update:modelValue", icon);
|
||||
emit("change", icon);
|
||||
(_a = dropdownRef.value) == null ? void 0 : _a.hide();
|
||||
};
|
||||
const icones = ref([]);
|
||||
const total = ref(iconfont.length);
|
||||
const totalPage = ref(total.value / 12);
|
||||
const currentPage = ref(1);
|
||||
if (props.page) {
|
||||
icones.value = iconfont.slice(0, 12);
|
||||
} else {
|
||||
icones.value = iconfont;
|
||||
}
|
||||
const next = () => {
|
||||
if (currentPage.value === totalPage.value) {
|
||||
return;
|
||||
}
|
||||
currentPage.value = currentPage.value + 1;
|
||||
const start = (currentPage.value - 1) * 12;
|
||||
const end = start + 12;
|
||||
icones.value = iconfont.slice(start, end);
|
||||
};
|
||||
const prev = () => {
|
||||
if (currentPage.value === 1) {
|
||||
return;
|
||||
}
|
||||
currentPage.value = currentPage.value - 1;
|
||||
const start = (currentPage.value - 1) * 12;
|
||||
const end = start + 12;
|
||||
icones.value = iconfont.slice(start, end);
|
||||
};
|
||||
const clear = () => {
|
||||
const start = (currentPage.value - 1) * 12;
|
||||
const end = start + 12;
|
||||
if (props.page) {
|
||||
icones.value = iconfont.slice(start, end);
|
||||
total.value = iconfont.length;
|
||||
totalPage.value = Math.ceil(iconfont.length / 12);
|
||||
} else {
|
||||
icones.value = iconfont;
|
||||
}
|
||||
};
|
||||
const search = (e) => {
|
||||
currentPage.value = 1;
|
||||
const start = (currentPage.value - 1) * 12;
|
||||
const end = start + 12;
|
||||
const text = e;
|
||||
if (text) {
|
||||
if (props.page) {
|
||||
icones.value = searchList(text, iconfont).slice(start, end);
|
||||
total.value = searchList(text, iconfont).length;
|
||||
totalPage.value = Math.ceil(searchList(text, iconfont).length / 12);
|
||||
} else {
|
||||
icones.value = searchList(text, iconfont);
|
||||
}
|
||||
} else {
|
||||
if (props.page) {
|
||||
icones.value = iconfont.slice(start, end);
|
||||
total.value = iconfont.length;
|
||||
totalPage.value = Math.ceil(iconfont.length / 12);
|
||||
} else {
|
||||
icones.value = iconfont;
|
||||
}
|
||||
}
|
||||
};
|
||||
const searchList = (str, container) => {
|
||||
var newList = [];
|
||||
var startChar = str.charAt(0);
|
||||
var strLen = str.length;
|
||||
for (var i = 0; i < container.length; i++) {
|
||||
var obj = container[i];
|
||||
var isMatch = false;
|
||||
for (var p in obj) {
|
||||
if (typeof obj[p] == "function") {
|
||||
obj[p]();
|
||||
} else {
|
||||
var curItem = "";
|
||||
if (obj[p] != null) {
|
||||
curItem = obj[p];
|
||||
}
|
||||
for (var j = 0; j < curItem.length; j++) {
|
||||
if (curItem.charAt(j) == startChar) {
|
||||
if (curItem.substring(j).substring(0, strLen) == str) {
|
||||
isMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isMatch) {
|
||||
newList.push(obj);
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createBlock(_sfc_main$1, {
|
||||
ref_key: "dropdownRef",
|
||||
ref: dropdownRef,
|
||||
disabled: __props.disabled,
|
||||
contentClass: __props.contentClass,
|
||||
contentStyle: __props.contentStyle,
|
||||
updateAtScroll: ""
|
||||
}, {
|
||||
content: withCtx(() => [
|
||||
createElementVNode("div", _hoisted_3, [
|
||||
__props.showSearch ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
||||
createVNode(_sfc_main$2, {
|
||||
onInput: search,
|
||||
onClear: clear,
|
||||
autocomplete: "true",
|
||||
"allow-clear": true
|
||||
}, {
|
||||
prefix: withCtx(() => [
|
||||
_hoisted_5
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
])) : createCommentVNode("", true),
|
||||
createElementVNode("div", _hoisted_6, [
|
||||
createVNode(_sfc_main$3, {
|
||||
style: { "height": "200px" },
|
||||
thumbColor: "rgb(238, 238, 238)"
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createElementVNode("ul", null, [
|
||||
(openBlock(true), createElementBlock(Fragment, null, renderList(icones.value, (icon) => {
|
||||
return openBlock(), createElementBlock("li", {
|
||||
key: icon,
|
||||
class: normalizeClass([unref(selectedIcon) === icon.class ? "layui-this" : ""]),
|
||||
onClick: ($event) => selectIcon(icon.class)
|
||||
}, [
|
||||
createElementVNode("i", {
|
||||
class: normalizeClass(["layui-icon", [icon.class]])
|
||||
}, null, 2),
|
||||
createElementVNode("p", _hoisted_8, toDisplayString(icon.name), 1)
|
||||
], 10, _hoisted_7);
|
||||
}), 128))
|
||||
])
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
]),
|
||||
__props.page ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
||||
createElementVNode("div", _hoisted_10, [
|
||||
createElementVNode("span", _hoisted_11, "\u5171 " + toDisplayString(total.value) + " \u4E2A", 1),
|
||||
createElementVNode("a", {
|
||||
href: "javascript:;",
|
||||
class: normalizeClass(["layui-laypage-prev", [currentPage.value === 1 ? "layui-disabled" : ""]]),
|
||||
onClick: _cache[0] || (_cache[0] = ($event) => prev())
|
||||
}, _hoisted_13, 2),
|
||||
createElementVNode("span", _hoisted_14, [
|
||||
_hoisted_15,
|
||||
createElementVNode("em", null, toDisplayString(currentPage.value) + " / " + toDisplayString(totalPage.value), 1)
|
||||
]),
|
||||
_hoisted_16,
|
||||
_hoisted_17,
|
||||
createElementVNode("a", {
|
||||
href: "javascript:;",
|
||||
class: normalizeClass([[currentPage.value === totalPage.value ? "layui-disabled" : ""], "layui-laypage-next"]),
|
||||
onClick: _cache[1] || (_cache[1] = ($event) => next())
|
||||
}, _hoisted_19, 2)
|
||||
])
|
||||
])) : createCommentVNode("", true)
|
||||
])
|
||||
]),
|
||||
default: withCtx(() => [
|
||||
createElementVNode("div", {
|
||||
class: normalizeClass(["layui-inline layui-border-box layui-iconpicker layui-iconpicker-split", [{ "layui-colorpicker-disabled": __props.disabled }]])
|
||||
}, [
|
||||
createElementVNode("div", _hoisted_1, [
|
||||
createElementVNode("i", {
|
||||
class: normalizeClass(["layui-inline layui-icon", [unref(selectedIcon)]])
|
||||
}, null, 2)
|
||||
]),
|
||||
_hoisted_2
|
||||
], 2)
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["disabled", "contentClass", "contentStyle"]);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
374
package/component/es/index.js
Normal file
374
package/component/es/index.js
Normal file
File diff suppressed because one or more lines are too long
1
package/component/es/index/index.css
Normal file
1
package/component/es/index/index.css
Normal file
File diff suppressed because one or more lines are too long
1
package/component/es/input/index.css
Normal file
1
package/component/es/input/index.css
Normal file
@ -0,0 +1 @@
|
||||
: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}
|
5
package/component/es/input/index.js
Normal file
5
package/component/es/input/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
import "../badge/index2.js";
|
||||
export { c as default } from "./index2.js";
|
||||
import "vue";
|
||||
import "../checkbox/index2.js";
|
||||
import "../dropdownMenu/index2.js";
|
232
package/component/es/input/index2.js
Normal file
232
package/component/es/input/index2.js
Normal file
@ -0,0 +1,232 @@
|
||||
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 { _ 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 = {};
|
||||
const _hoisted_1$2 = {
|
||||
focusable: "false",
|
||||
class: "",
|
||||
"data-icon": "eye-invisible",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
fill: "currentColor",
|
||||
"aria-hidden": "true",
|
||||
viewBox: "64 64 896 896"
|
||||
};
|
||||
const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("path", { d: "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" }, null, -1);
|
||||
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("path", { d: "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" }, null, -1);
|
||||
const _hoisted_4$1 = [
|
||||
_hoisted_2$2,
|
||||
_hoisted_3$2
|
||||
];
|
||||
function _sfc_render$1(_ctx, _cache) {
|
||||
return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_4$1);
|
||||
}
|
||||
var PasswordIcon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
|
||||
const _sfc_main$1 = {};
|
||||
const _hoisted_1$1 = {
|
||||
focusable: "false",
|
||||
class: "",
|
||||
"data-icon": "eye",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
fill: "currentColor",
|
||||
"aria-hidden": "true",
|
||||
viewBox: "64 64 896 896"
|
||||
};
|
||||
const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", { d: "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" }, null, -1);
|
||||
const _hoisted_3$1 = [
|
||||
_hoisted_2$1
|
||||
];
|
||||
function _sfc_render(_ctx, _cache) {
|
||||
return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1);
|
||||
}
|
||||
var UnPasswordIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
|
||||
const _hoisted_1 = ["size"];
|
||||
const _hoisted_2 = {
|
||||
key: 0,
|
||||
class: "layui-input-prepend"
|
||||
};
|
||||
const _hoisted_3 = { class: "layui-input-wrapper" };
|
||||
const _hoisted_4 = {
|
||||
key: 0,
|
||||
class: "layui-input-prefix"
|
||||
};
|
||||
const _hoisted_5 = ["type", "name", "disabled", "placeholder", "autofocus", "autocomplete", "maxlength", "max", "min", "readonly", "value"];
|
||||
const _hoisted_6 = {
|
||||
key: 2,
|
||||
class: "layui-input-clear"
|
||||
};
|
||||
const _hoisted_7 = {
|
||||
key: 3,
|
||||
class: "layui-input-suffix"
|
||||
};
|
||||
const _hoisted_8 = {
|
||||
key: 1,
|
||||
class: "layui-input-append"
|
||||
};
|
||||
const __default__ = {
|
||||
name: "LayInput"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
name: null,
|
||||
type: null,
|
||||
prefixIcon: null,
|
||||
suffixIcon: null,
|
||||
modelValue: { default: "" },
|
||||
allowClear: { type: Boolean, default: false },
|
||||
autocomplete: null,
|
||||
placeholder: null,
|
||||
autofocus: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean, default: false },
|
||||
readonly: { type: Boolean, default: false },
|
||||
password: { type: Boolean, default: false },
|
||||
size: { default: "md" },
|
||||
maxlength: null,
|
||||
max: null,
|
||||
min: null
|
||||
},
|
||||
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 hasContent = computed(() => {
|
||||
var _a;
|
||||
return ((_a = props.modelValue) == null ? void 0 : _a.length) > 0;
|
||||
});
|
||||
const isPassword = computed(() => type.value == "password");
|
||||
const composing = ref(false);
|
||||
watch(() => props.type, () => {
|
||||
type.value = props.type;
|
||||
});
|
||||
watch(() => props.modelValue, () => {
|
||||
currentValue.value = String(props.modelValue == null ? "" : props.modelValue);
|
||||
});
|
||||
const onInput = function(event) {
|
||||
const inputElement = event.target;
|
||||
const value = inputElement.value;
|
||||
emit("input", value);
|
||||
if (composing.value)
|
||||
return;
|
||||
emit("update:modelValue", value);
|
||||
};
|
||||
const onClear = () => {
|
||||
emit("update:modelValue", "");
|
||||
emit("clear");
|
||||
};
|
||||
const onFocus = (event) => {
|
||||
emit("focus", event);
|
||||
};
|
||||
const onChange = (event) => {
|
||||
const inputElement = event.target;
|
||||
const value = inputElement.value;
|
||||
emit("change", value);
|
||||
};
|
||||
const onBlur = (event) => {
|
||||
if (props.type === "number") {
|
||||
onNumberBlur(event);
|
||||
}
|
||||
emit("blur", event);
|
||||
};
|
||||
const onNumberBlur = (event) => {
|
||||
let value = event.target.value;
|
||||
if (value === "") {
|
||||
value = props.min ? String(props.min) : "0";
|
||||
} else {
|
||||
if (props.max && props.max < Number(value))
|
||||
value = props.max.toString();
|
||||
if (props.min && props.min > Number(value))
|
||||
value = props.min.toString();
|
||||
}
|
||||
emit("update:modelValue", value);
|
||||
};
|
||||
const onCompositionstart = () => {
|
||||
composing.value = true;
|
||||
};
|
||||
const onCompositionend = (event) => {
|
||||
composing.value = false;
|
||||
onInput(event);
|
||||
};
|
||||
const classes = computed(() => {
|
||||
return {
|
||||
"layui-input-disabled": props.disabled,
|
||||
"layui-input-has-prefix": slots.prefix || props.prefixIcon
|
||||
};
|
||||
});
|
||||
const showPassword = () => {
|
||||
if (isPassword.value) {
|
||||
type.value = "text";
|
||||
} else {
|
||||
type.value = "password";
|
||||
}
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-input", unref(classes)]),
|
||||
size: __props.size
|
||||
}, [
|
||||
unref(slots).prepend ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
||||
renderSlot(_ctx.$slots, "prepend")
|
||||
])) : 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), {
|
||||
key: 1,
|
||||
type: props.prefixIcon,
|
||||
class: "layui-input-prefix-icon"
|
||||
}, null, 8, ["type"]))
|
||||
])) : createCommentVNode("", true),
|
||||
createElementVNode("input", {
|
||||
type: type.value,
|
||||
name: __props.name,
|
||||
disabled: __props.disabled,
|
||||
placeholder: __props.placeholder,
|
||||
autofocus: __props.autofocus,
|
||||
autocomplete: __props.autocomplete,
|
||||
maxlength: __props.maxlength,
|
||||
max: __props.max,
|
||||
min: __props.min,
|
||||
readonly: __props.readonly,
|
||||
value: currentValue.value,
|
||||
onInput,
|
||||
onChange,
|
||||
onFocus,
|
||||
onBlur,
|
||||
onCompositionstart,
|
||||
onCompositionend
|
||||
}, null, 40, _hoisted_5),
|
||||
__props.password && unref(hasContent) ? (openBlock(), createElementBlock("span", {
|
||||
key: 1,
|
||||
class: "layui-input-password",
|
||||
onClick: showPassword
|
||||
}, [
|
||||
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), {
|
||||
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), {
|
||||
key: 1,
|
||||
type: props.suffixIcon,
|
||||
class: "layui-input-suffix-icon"
|
||||
}, null, 8, ["type"]))
|
||||
])) : createCommentVNode("", true)
|
||||
]),
|
||||
unref(slots).append ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
||||
renderSlot(_ctx.$slots, "append")
|
||||
])) : createCommentVNode("", true)
|
||||
], 10, _hoisted_1);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { _sfc_main as _, component as c };
|
1
package/component/es/inputNumber/index.css
Normal file
1
package/component/es/inputNumber/index.css
Normal file
File diff suppressed because one or more lines are too long
207
package/component/es/inputNumber/index.js
Normal file
207
package/component/es/inputNumber/index.js
Normal file
File diff suppressed because one or more lines are too long
1
package/component/es/layout/index.css
Normal file
1
package/component/es/layout/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-header{box-sizing:border-box;height:60px}.layui-layout{flex:1;display:flex;flex-basis:auto;box-sizing:border-box}.layui-layout-vertical{flex-direction:column}.layui-layout-left{position:absolute!important;left:200px;top:0}.layui-layout-right{position:absolute!important;right:0;top:0}
|
40
package/component/es/layout/index.js
Normal file
40
package/component/es/layout/index.js
Normal file
@ -0,0 +1,40 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from "vue";
|
||||
import { _ as _sfc_main$1 } from "../header/index2.js";
|
||||
import { _ as _sfc_main$2 } from "../footer/index2.js";
|
||||
var index = /* @__PURE__ */ (() => ".layui-header{box-sizing:border-box;height:60px}.layui-layout{flex:1;display:flex;flex-basis:auto;box-sizing:border-box}.layui-layout-vertical{flex-direction:column}.layui-layout-left{position:absolute!important;left:200px;top:0}.layui-layout-right{position:absolute!important;right:0;top:0}\n")();
|
||||
const __default__ = {
|
||||
name: "LayLayout"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
isVertical: { type: Boolean, default: false }
|
||||
},
|
||||
setup(__props) {
|
||||
const slots = useSlots();
|
||||
const isVertical = computed(() => {
|
||||
if (!slots.default)
|
||||
return false;
|
||||
const vNodes = slots.default();
|
||||
return vNodes.some((vNode) => {
|
||||
const componentName = vNode.type.name;
|
||||
if (!componentName)
|
||||
return false;
|
||||
return [_sfc_main$1.name].includes(componentName) || [_sfc_main$2.name].includes(componentName);
|
||||
});
|
||||
});
|
||||
const classes = computed(() => {
|
||||
return ["layui-layout", { "layui-layout-vertical": isVertical.value }];
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("section", {
|
||||
class: normalizeClass(unref(classes))
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/line/index.css
Normal file
1
package/component/es/line/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-line-horizontal{position:relative;clear:both;width:100%;min-width:100%;max-width:100%;margin:var(--layui-line-margin) 0;border-bottom:var(--layui-line-border-width) var(--layui-line-border-style) var(--global-neutral-color-5);border-top-style:none;border-left-style:none;border-right-style:none}.layui-line-horizontal.layui-line-with-text{margin:14px 0}.layui-line-vertical{display:inline-block;min-width:1px;max-width:1px;height:1em;margin:0 var(--layui-line-margin);vertical-align:middle;border-left:var(--layui-line-border-width) var(--layui-line-border-style) var(--global-neutral-color-5);border-top-style:none;border-bottom-style:none;border-right-style:none}.layui-line-text{position:absolute;top:50%;box-sizing:border-box;padding:0 10px;color:currentColor;line-height:2;background-color:#fff;transform:translateY(-50%)}.layui-line-text-center{left:var(--layui-line-text-offset);transform:translate(-50%,-50%)}.layui-line-text-left{left:var(--layui-line-text-offset)}.layui-line-text-right{right:var(--layui-line-text-offset)}
|
72
package/component/es/line/index.js
Normal file
72
package/component/es/line/index.js
Normal file
@ -0,0 +1,72 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, renderSlot, createCommentVNode } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ".layui-line-horizontal{position:relative;clear:both;width:100%;min-width:100%;max-width:100%;margin:var(--layui-line-margin) 0;border-bottom:var(--layui-line-border-width) var(--layui-line-border-style) var(--global-neutral-color-5);border-top-style:none;border-left-style:none;border-right-style:none}.layui-line-horizontal.layui-line-with-text{margin:14px 0}.layui-line-vertical{display:inline-block;min-width:1px;max-width:1px;height:1em;margin:0 var(--layui-line-margin);vertical-align:middle;border-left:var(--layui-line-border-width) var(--layui-line-border-style) var(--global-neutral-color-5);border-top-style:none;border-bottom-style:none;border-right-style:none}.layui-line-text{position:absolute;top:50%;box-sizing:border-box;padding:0 10px;color:currentColor;line-height:2;background-color:#fff;transform:translateY(-50%)}.layui-line-text-center{left:var(--layui-line-text-offset);transform:translate(-50%,-50%)}.layui-line-text-left{left:var(--layui-line-text-offset)}.layui-line-text-right{right:var(--layui-line-text-offset)}\n")();
|
||||
const __default__ = {
|
||||
name: "LayLine"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
direction: { default: "horizontal" },
|
||||
contentPosition: { default: "center" },
|
||||
borderWidth: { default: "1px" },
|
||||
borderStyle: { default: "solid" },
|
||||
offset: { default: "25px" },
|
||||
theme: null,
|
||||
margin: { default: "8px" }
|
||||
},
|
||||
setup(__props) {
|
||||
var _a;
|
||||
const props = __props;
|
||||
const slots = useSlots();
|
||||
const lineTheme = [
|
||||
"red",
|
||||
"orange",
|
||||
"green",
|
||||
"cyan",
|
||||
"blue",
|
||||
"black",
|
||||
"gray"
|
||||
];
|
||||
const isBuiltInColor = lineTheme.includes((_a = props.theme) != null ? _a : "");
|
||||
const lineClass = computed(() => [
|
||||
`layui-line-${props.direction}`,
|
||||
{
|
||||
[`layui-border-${props.theme}`]: isBuiltInColor,
|
||||
[`layui-line-with-text`]: Boolean(slots.default)
|
||||
}
|
||||
]);
|
||||
const lineStyle = computed(() => ({
|
||||
"border-color": !isBuiltInColor ? props.theme : void 0,
|
||||
"--layui-line-border-width": props.borderWidth,
|
||||
"--layui-line-border-style": props.borderStyle,
|
||||
"--layui-line-margin": props.margin
|
||||
}));
|
||||
const lineTextStyle = computed(() => ({
|
||||
"--layui-line-text-offset": props.contentPosition != "center" ? props.offset : "50%",
|
||||
transform: calcTranslate()
|
||||
}));
|
||||
function calcTranslate() {
|
||||
if (props.offset.includes("%")) {
|
||||
return props.contentPosition === "right" ? "translate(50%, -50%)" : "translate(-50%, -50%)";
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(unref(lineClass)),
|
||||
style: normalizeStyle(unref(lineStyle))
|
||||
}, [
|
||||
_ctx.$slots.default && __props.direction === "horizontal" ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass([`layui-line-text layui-line-text-${__props.contentPosition}`]),
|
||||
style: normalizeStyle(unref(lineTextStyle))
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "default")
|
||||
], 6)) : createCommentVNode("", true)
|
||||
], 6);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
1
package/component/es/logo/index.css
Normal file
1
package/component/es/logo/index.css
Normal file
@ -0,0 +1 @@
|
||||
.layui-logo{left:0;top:0;width:200px;height:60px;line-height:60px;text-align:center;color:var(--global-primary-color);font-size:16px}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user