next-element-vue 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 作 者:huangteng
|
|
4
4
|
* 邮 箱:htengweb@163.com
|
|
5
|
-
* 当前版本:0.5.
|
|
6
|
-
* 发布日期:2024-12-
|
|
5
|
+
* 当前版本:0.5.1 v
|
|
6
|
+
* 发布日期:2024-12-28
|
|
7
7
|
* 地 址:https://www.npmjs.com/package/next-element-vue
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -995,8 +995,12 @@
|
|
|
995
995
|
}, localeContextKey = elementPlus.localeContextKey, useLocale = localeOverrides => {
|
|
996
996
|
const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
|
|
997
997
|
return buildLocaleContext(vue.computed((() => locale?.value || zhcnLocale)));
|
|
998
|
-
};
|
|
998
|
+
}, reg_hex = /^#([0-9A-F]{3}|[0-9A-F]{6}|[0-9A-F]{8})$/i, reg_rgba = /^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/i;
|
|
999
999
|
function useChangeColor() {
|
|
1000
|
+
const rgbaToHex = rgba => {
|
|
1001
|
+
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map((value => parseFloat(value))), [r, g, b] = rgbaValues;
|
|
1002
|
+
return `#${[ r, g, b ].map((value => Math.round(value).toString(16).padStart(2, "0"))).join("")}`.toUpperCase();
|
|
1003
|
+
};
|
|
1000
1004
|
return {
|
|
1001
1005
|
hexToRgb: str => {
|
|
1002
1006
|
let hexs = "";
|
|
@@ -1022,17 +1026,24 @@
|
|
|
1022
1026
|
for (let i = 0; i < 3; i++) 1 == hexs[i].length && (hexs[i] = `0${hexs[i]}`);
|
|
1023
1027
|
return `#${hexs.join("")}`;
|
|
1024
1028
|
},
|
|
1029
|
+
rgbaToHex: rgbaToHex,
|
|
1030
|
+
rgbaToHexAlpha: rgba => {
|
|
1031
|
+
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map((value => parseFloat(value))), [r, g, b, a] = rgbaValues, alpha = Math.round(255 * a).toString(16).padStart(2, "0");
|
|
1032
|
+
return `#${[ r, g, b ].map((value => Math.round(value).toString(16).padStart(2, "0"))).join("")}${alpha}`.toUpperCase();
|
|
1033
|
+
},
|
|
1025
1034
|
getDarkColor: (color, level) => {
|
|
1026
|
-
|
|
1035
|
+
let _color = color;
|
|
1036
|
+
if (reg_rgba.test(_color) && (_color = rgbaToHex(_color)), !reg_hex.test(_color)) return elementPlus.ElMessage.warning("输入错误的hex颜色值"),
|
|
1027
1037
|
"";
|
|
1028
|
-
let rgb = useChangeColor().hexToRgb(
|
|
1038
|
+
let rgb = useChangeColor().hexToRgb(_color);
|
|
1029
1039
|
for (let i = 0; i < 3; i++) rgb[i] = Math.floor(rgb[i] * (1 - level));
|
|
1030
1040
|
return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
1031
1041
|
},
|
|
1032
1042
|
getLightColor: (color, level) => {
|
|
1033
|
-
|
|
1043
|
+
let _color = color;
|
|
1044
|
+
if (reg_rgba.test(_color) && (_color = rgbaToHex(_color)), !reg_hex.test(_color)) return elementPlus.ElMessage.warning("输入错误的hex颜色值"),
|
|
1034
1045
|
"";
|
|
1035
|
-
let rgb = useChangeColor().hexToRgb(
|
|
1046
|
+
let rgb = useChangeColor().hexToRgb(_color);
|
|
1036
1047
|
for (let i = 0; i < 3; i++) rgb[i] = Math.floor((255 - rgb[i]) * level + rgb[i]);
|
|
1037
1048
|
return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
1038
1049
|
}
|
|
@@ -1569,6 +1580,7 @@
|
|
|
1569
1580
|
modelValue: settingConfig.themeColor,
|
|
1570
1581
|
"onUpdate:modelValue": $event => settingConfig.themeColor = $event,
|
|
1571
1582
|
predefine: [ "#409eff", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585", "#FB07A0" ],
|
|
1583
|
+
"show-alpha": !0,
|
|
1572
1584
|
onChange: _onChangeThemeColor
|
|
1573
1585
|
}, null) ]) ]), vue.createVNode("div", {
|
|
1574
1586
|
class: _ns.b("config-bar-item")
|
|
@@ -1596,6 +1608,7 @@
|
|
|
1596
1608
|
modelValue: settingConfig.headerBarColor,
|
|
1597
1609
|
"onUpdate:modelValue": $event => settingConfig.headerBarColor = $event,
|
|
1598
1610
|
predefine: [ "#282c34", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585", "#FB07A0" ],
|
|
1611
|
+
"show-alpha": !0,
|
|
1599
1612
|
onChange: color => _onChangeColor(color, "headerBarColor", "--next-layout-bg-color")
|
|
1600
1613
|
}, null) ]) ]), vue.createVNode("div", {
|
|
1601
1614
|
class: _ns.b("config-bar-item")
|
|
@@ -1607,6 +1620,7 @@
|
|
|
1607
1620
|
modelValue: settingConfig.headerBarFontColor,
|
|
1608
1621
|
"onUpdate:modelValue": $event => settingConfig.headerBarFontColor = $event,
|
|
1609
1622
|
predefine: [ "#282c34", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585", "#FB07A0" ],
|
|
1623
|
+
"show-alpha": !0,
|
|
1610
1624
|
onChange: color => _onChangeColor(color, "headerBarFontColor", "--next-layout-font-color")
|
|
1611
1625
|
}, null) ]) ]), vue.createVNode("div", {
|
|
1612
1626
|
class: _ns.b("config-bar-item")
|
|
@@ -2869,15 +2883,16 @@
|
|
|
2869
2883
|
var s;
|
|
2870
2884
|
}
|
|
2871
2885
|
});
|
|
2872
|
-
const
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
if (
|
|
2886
|
+
const findGrandfatherNode = (path, tree) => {
|
|
2887
|
+
let parentNode = null;
|
|
2888
|
+
const loopNodes = (nodes, currentParent) => {
|
|
2889
|
+
for (const node of nodes) {
|
|
2890
|
+
if (node.path === path) return parentNode = currentParent, !0;
|
|
2891
|
+
if (node.children && loopNodes(node.children, currentParent ?? node)) return !0;
|
|
2878
2892
|
}
|
|
2879
|
-
|
|
2880
|
-
|
|
2893
|
+
return !1;
|
|
2894
|
+
};
|
|
2895
|
+
return loopNodes(tree, null), parentNode;
|
|
2881
2896
|
}, ns$h = useNamespace("menu");
|
|
2882
2897
|
var MenuTop = vue.defineComponent({
|
|
2883
2898
|
props: {
|
|
@@ -2896,10 +2911,12 @@
|
|
|
2896
2911
|
},
|
|
2897
2912
|
setup(props) {
|
|
2898
2913
|
vue.provide("ns", ns$h);
|
|
2899
|
-
const updateSubmentTree = vue.inject("updateSubmentTree"), router = vue.getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, parentNode =
|
|
2900
|
-
parentNode?.id && updateSubmentTree(parentNode.children),
|
|
2901
|
-
|
|
2902
|
-
|
|
2914
|
+
const updateSubmentTree = vue.inject("updateSubmentTree"), router = vue.getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, parentNode = findGrandfatherNode(currentPath, props.menuTree), activeMenuId = vue.ref(parentNode?.id);
|
|
2915
|
+
parentNode?.id && 1 === parentNode.meta?.level && updateSubmentTree(parentNode.children),
|
|
2916
|
+
vue.watch((() => router.currentRoute?.value), (to => {
|
|
2917
|
+
const parentNode = findGrandfatherNode(to.fullPath, props.menuTree);
|
|
2918
|
+
if (activeMenuId.value = parentNode?.id, !parentNode) return updateSubmentTree([]);
|
|
2919
|
+
parentNode?.id && 1 === parentNode.meta?.level && updateSubmentTree(parentNode.children);
|
|
2903
2920
|
}));
|
|
2904
2921
|
const findTreeFirst = tree => {
|
|
2905
2922
|
let result = tree[0];
|
|
@@ -8266,7 +8283,7 @@
|
|
|
8266
8283
|
})(app);
|
|
8267
8284
|
};
|
|
8268
8285
|
var index = {
|
|
8269
|
-
version: "0.5.
|
|
8286
|
+
version: "0.5.1",
|
|
8270
8287
|
install: install
|
|
8271
8288
|
};
|
|
8272
8289
|
exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
|
|
@@ -8314,7 +8331,7 @@
|
|
|
8314
8331
|
}), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
|
|
8315
8332
|
const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
|
|
8316
8333
|
localeRef.value.name = lang, localeRef.value.next = nextLang.next;
|
|
8317
|
-
}, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.5.
|
|
8334
|
+
}, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.5.1",
|
|
8318
8335
|
Object.defineProperty(exports, "__esModule", {
|
|
8319
8336
|
value: !0
|
|
8320
8337
|
});
|