next-element-vue 0.3.1 → 0.3.3
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.css +3 -2
- package/dist/index.js +634 -172
- package/dist/index.min.js +3 -3
- package/dist/index.umd.js +636 -178
- package/dist/index.umd.min.js +3 -3
- package/dist/packages/components/crud-table/src/config.d.ts +3 -0
- package/dist/packages/components/crud-table-virtualized/src/index.test.d.ts +2 -2
- package/dist/packages/components/dialog/index.d.ts +9 -0
- package/dist/packages/components/dialog/src/index.d.ts +9 -0
- package/dist/packages/components/labelimg/index.d.ts +0 -9
- package/dist/packages/components/labelimg/src/hooks/canvas-context-hook.d.ts +1 -0
- package/dist/packages/components/labelimg/src/index.d.ts +0 -9
- package/dist/packages/components/labelimg/src/widgets/tool-header.d.ts +18 -0
- package/dist/packages/components/labelme/index.d.ts +54 -0
- package/dist/packages/components/labelme/src/config.d.ts +4 -0
- package/dist/packages/components/labelme/src/hooks/canvas-content.d.ts +40 -0
- package/dist/packages/components/labelme/src/index.d.ts +54 -0
- package/dist/packages/components/labelme/src/widgets/canvas-context.d.ts +34 -0
- package/dist/packages/components.d.ts +1 -0
- package/dist/packages/hooks/use-locale/index.d.ts +1 -0
- package/dist/packages/utils/theme.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 作 者:huangteng
|
|
4
4
|
* 邮 箱:htengweb@163.com
|
|
5
|
-
* 当前版本:0.3.
|
|
6
|
-
* 发布日期:2024-
|
|
5
|
+
* 当前版本:0.3.3 v
|
|
6
|
+
* 发布日期:2024-07-23
|
|
7
7
|
* 地 址:https://www.npmjs.com/package/next-element-vue
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -566,9 +566,9 @@ function getAllKeys(object) {
|
|
|
566
566
|
}(object, keys, getSymbols$1);
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
var DataView = getNative(root, "DataView"), Promise$1 = getNative(root, "Promise"), Set = getNative(root, "Set"), dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap), getTag = baseGetTag;
|
|
569
|
+
var DataView = getNative(root, "DataView"), Promise$1 = getNative(root, "Promise"), Set$1 = getNative(root, "Set"), dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap), getTag = baseGetTag;
|
|
570
570
|
|
|
571
|
-
(DataView && "[object DataView]" != getTag(new DataView(new ArrayBuffer(1))) || Map$1 && "[object Map]" != getTag(new Map$1) || Promise$1 && "[object Promise]" != getTag(Promise$1.resolve()) || Set && "[object Set]" != getTag(new Set) || WeakMap && "[object WeakMap]" != getTag(new WeakMap)) && (getTag = function(value) {
|
|
571
|
+
(DataView && "[object DataView]" != getTag(new DataView(new ArrayBuffer(1))) || Map$1 && "[object Map]" != getTag(new Map$1) || Promise$1 && "[object Promise]" != getTag(Promise$1.resolve()) || Set$1 && "[object Set]" != getTag(new Set$1) || WeakMap && "[object WeakMap]" != getTag(new WeakMap)) && (getTag = function(value) {
|
|
572
572
|
var result = baseGetTag(value), Ctor = "[object Object]" == result ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
573
573
|
if (ctorString) switch (ctorString) {
|
|
574
574
|
case dataViewCtorString:
|
|
@@ -1090,6 +1090,13 @@ function useChangeColor() {
|
|
|
1090
1090
|
for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
|
|
1091
1091
|
return hexs;
|
|
1092
1092
|
},
|
|
1093
|
+
hexToRgba: (str, alpha = 1) => {
|
|
1094
|
+
let hexs = "";
|
|
1095
|
+
if (!/^\#?[0-9A-Fa-f]{6}$/.test(str)) return ElMessage.warning("输入错误的hex"), "";
|
|
1096
|
+
hexs = (str = str.replace("#", "")).match(/../g);
|
|
1097
|
+
for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
|
|
1098
|
+
return `rgba(${hexs.join(",")},${alpha})`;
|
|
1099
|
+
},
|
|
1093
1100
|
rgbToHex: (r, g, b) => {
|
|
1094
1101
|
let reg = /^\d{1,3}$/;
|
|
1095
1102
|
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return ElMessage.warning("输入错误的rgb颜色值"),
|
|
@@ -1217,7 +1224,7 @@ const {getLightColor: getLightColor$4} = useChangeColor(), nextUseCssVar = (cssv
|
|
|
1217
1224
|
return main;
|
|
1218
1225
|
}, slots_config_headerMenu = "header-menu", slots_config_headerToolsPrefix = "header-tools-prefix", slots_config_headerToolsSuffix = "header-tools-suffix";
|
|
1219
1226
|
|
|
1220
|
-
var defaultConfig$
|
|
1227
|
+
var defaultConfig$5 = {
|
|
1221
1228
|
logo: "",
|
|
1222
1229
|
title: "Next Element Vue",
|
|
1223
1230
|
userName: "Admin",
|
|
@@ -1265,7 +1272,7 @@ var defaultConfig$4 = {
|
|
|
1265
1272
|
}
|
|
1266
1273
|
};
|
|
1267
1274
|
|
|
1268
|
-
const ns$
|
|
1275
|
+
const ns$l = useNamespace("text-ellipsis");
|
|
1269
1276
|
|
|
1270
1277
|
const NextTextEllipsis = withInstall(defineComponent({
|
|
1271
1278
|
name: "NextTextEllipsis",
|
|
@@ -1312,7 +1319,7 @@ const NextTextEllipsis = withInstall(defineComponent({
|
|
|
1312
1319
|
}
|
|
1313
1320
|
};
|
|
1314
1321
|
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
1315
|
-
class: [ ns$
|
|
1322
|
+
class: [ ns$l.b(), props.class ],
|
|
1316
1323
|
style: setWidth.value,
|
|
1317
1324
|
onMouseenter: onMouseenter
|
|
1318
1325
|
}, [ isTip.value ? createVNode(ElTooltip, {
|
|
@@ -1322,11 +1329,11 @@ const NextTextEllipsis = withInstall(defineComponent({
|
|
|
1322
1329
|
disabled: props.disabled
|
|
1323
1330
|
}, {
|
|
1324
1331
|
default: () => [ createVNode("span", {
|
|
1325
|
-
class: ns$
|
|
1332
|
+
class: ns$l.e("text"),
|
|
1326
1333
|
ref: ellipsisRef
|
|
1327
1334
|
}, [ slots.default ? slots.default() : props.content ]) ]
|
|
1328
1335
|
}) : createVNode("span", {
|
|
1329
|
-
class: ns$
|
|
1336
|
+
class: ns$l.e("text"),
|
|
1330
1337
|
ref: ellipsisRef
|
|
1331
1338
|
}, [ slots.default ? slots.default() : props.content ]) ]) ]);
|
|
1332
1339
|
}
|
|
@@ -2710,7 +2717,7 @@ const NextMenuItem = defineComponent({
|
|
|
2710
2717
|
}, null) ]
|
|
2711
2718
|
}))) ]) ]);
|
|
2712
2719
|
}
|
|
2713
|
-
}), ns$
|
|
2720
|
+
}), ns$k = useNamespace("menu");
|
|
2714
2721
|
|
|
2715
2722
|
const NextMenu = withInstall(defineComponent({
|
|
2716
2723
|
name: "NextMenu",
|
|
@@ -2738,13 +2745,13 @@ const NextMenu = withInstall(defineComponent({
|
|
|
2738
2745
|
}
|
|
2739
2746
|
},
|
|
2740
2747
|
setup(props) {
|
|
2741
|
-
provide("ns", ns$
|
|
2748
|
+
provide("ns", ns$k);
|
|
2742
2749
|
const router = getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, activePath = ref(currentPath);
|
|
2743
2750
|
watch((() => router.currentRoute?.value), (to => {
|
|
2744
2751
|
activePath.value = to.fullPath;
|
|
2745
2752
|
}));
|
|
2746
2753
|
return () => createVNode(Fragment, null, [ createVNode(ElMenu, {
|
|
2747
|
-
class: [ ns$
|
|
2754
|
+
class: [ ns$k.b(), props.className ],
|
|
2748
2755
|
style: props.style,
|
|
2749
2756
|
defaultActive: activePath.value,
|
|
2750
2757
|
router: props.router,
|
|
@@ -2752,7 +2759,7 @@ const NextMenu = withInstall(defineComponent({
|
|
|
2752
2759
|
ellipsis: !0
|
|
2753
2760
|
}, {
|
|
2754
2761
|
default: () => [ createVNode(Fragment, null, [ props.menuTree.map((item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : createVNode(ElSubMenu, {
|
|
2755
|
-
"popper-class": ns$
|
|
2762
|
+
"popper-class": ns$k.b("popper"),
|
|
2756
2763
|
index: item.path || item.id,
|
|
2757
2764
|
teleported: !0
|
|
2758
2765
|
}, {
|
|
@@ -2763,7 +2770,7 @@ const NextMenu = withInstall(defineComponent({
|
|
|
2763
2770
|
menuData: item.children
|
|
2764
2771
|
}, null)
|
|
2765
2772
|
}) : valueExist(item.meta?.isHide, !1) ? null : createVNode(ElMenuItem, {
|
|
2766
|
-
"popper-class": ns$
|
|
2773
|
+
"popper-class": ns$k.b("popper"),
|
|
2767
2774
|
index: item.path
|
|
2768
2775
|
}, {
|
|
2769
2776
|
default: () => [ createVNode(MenuItemTitle, {
|
|
@@ -2791,20 +2798,20 @@ var Sidebar$2 = defineComponent({
|
|
|
2791
2798
|
}
|
|
2792
2799
|
});
|
|
2793
2800
|
|
|
2794
|
-
const ns$
|
|
2801
|
+
const ns$j = useNamespace("layout-defaults");
|
|
2795
2802
|
|
|
2796
2803
|
var defaults = defineComponent({
|
|
2797
2804
|
props: {},
|
|
2798
|
-
setup: () => (provide("ns", ns$
|
|
2805
|
+
setup: () => (provide("ns", ns$j), {}),
|
|
2799
2806
|
render() {
|
|
2800
2807
|
const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {});
|
|
2801
2808
|
slots.menu;
|
|
2802
2809
|
const isTabs = ref(!!slots.tabs);
|
|
2803
2810
|
return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), createVNode(ElContainer, {
|
|
2804
|
-
class: ns$
|
|
2811
|
+
class: ns$j.b()
|
|
2805
2812
|
}, {
|
|
2806
2813
|
default: () => [ createVNode(Sidebar$2, null, null), createVNode("div", {
|
|
2807
|
-
class: [ ns$
|
|
2814
|
+
class: [ ns$j.b("content") ]
|
|
2808
2815
|
}, [ createVNode(Header$3, null, null), _config.showTabs ? slots.tabs ? slots.tabs?.() : createVNode(NextTabs, {
|
|
2809
2816
|
tabs: _config.tabs,
|
|
2810
2817
|
activeTab: _config.activeTab,
|
|
@@ -2812,7 +2819,7 @@ var defaults = defineComponent({
|
|
|
2812
2819
|
onSelect: (...arg) => _emit("tabsSelect", ...arg),
|
|
2813
2820
|
onClose: (...arg) => _emit("tabsClose", ...arg)
|
|
2814
2821
|
}, null) : null, createVNode("main", {
|
|
2815
|
-
class: [ ns$
|
|
2822
|
+
class: [ ns$j.bf("main"), ns$j.is("layout-tabs", isTabs.value) ]
|
|
2816
2823
|
}, [ slots.default?.() ]) ]) ]
|
|
2817
2824
|
});
|
|
2818
2825
|
}
|
|
@@ -2845,11 +2852,11 @@ var Header$2 = defineComponent({
|
|
|
2845
2852
|
}
|
|
2846
2853
|
});
|
|
2847
2854
|
|
|
2848
|
-
const ns$
|
|
2855
|
+
const ns$i = useNamespace("layout-transverse");
|
|
2849
2856
|
|
|
2850
2857
|
var transverse = defineComponent({
|
|
2851
2858
|
props: {},
|
|
2852
|
-
setup: () => (provide("ns", ns$
|
|
2859
|
+
setup: () => (provide("ns", ns$i), {}),
|
|
2853
2860
|
render() {
|
|
2854
2861
|
const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {}), __slots_header = {};
|
|
2855
2862
|
slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
|
|
@@ -2866,7 +2873,7 @@ var transverse = defineComponent({
|
|
|
2866
2873
|
onSelect: (...arg) => _emit("tabsSelect", ...arg),
|
|
2867
2874
|
onClose: (...arg) => _emit("tabsClose", ...arg)
|
|
2868
2875
|
}, null) : null, createVNode("main", {
|
|
2869
|
-
class: [ ns$
|
|
2876
|
+
class: [ ns$i.b("main"), ns$i.is("layout-tabs", isTabs.value) ]
|
|
2870
2877
|
}, [ slots.default?.() ]) ]);
|
|
2871
2878
|
var s;
|
|
2872
2879
|
}
|
|
@@ -2908,11 +2915,11 @@ var Header$1 = defineComponent({
|
|
|
2908
2915
|
}
|
|
2909
2916
|
});
|
|
2910
2917
|
|
|
2911
|
-
const ns$
|
|
2918
|
+
const ns$h = useNamespace("layout-columns");
|
|
2912
2919
|
|
|
2913
2920
|
var columns = defineComponent({
|
|
2914
2921
|
props: {},
|
|
2915
|
-
setup: () => (provide("ns", ns$
|
|
2922
|
+
setup: () => (provide("ns", ns$h), {}),
|
|
2916
2923
|
render() {
|
|
2917
2924
|
const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {}), __slots_header = {};
|
|
2918
2925
|
slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
|
|
@@ -2920,11 +2927,11 @@ var columns = defineComponent({
|
|
|
2920
2927
|
slots[slots_config_headerToolsSuffix] && (__slots_header[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2921
2928
|
const isTabs = ref(!!slots.tabs);
|
|
2922
2929
|
return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), createVNode(ElContainer, {
|
|
2923
|
-
class: ns$
|
|
2930
|
+
class: ns$h.b()
|
|
2924
2931
|
}, {
|
|
2925
2932
|
default: () => {
|
|
2926
2933
|
return [ createVNode(Sidebar$1, null, null), createVNode("div", {
|
|
2927
|
-
class: [ ns$
|
|
2934
|
+
class: [ ns$h.b("content") ]
|
|
2928
2935
|
}, [ createVNode(Header$1, null, (s = __slots_header, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? __slots_header : {
|
|
2929
2936
|
default: () => [ __slots_header ]
|
|
2930
2937
|
})), _config.showTabs ? slots.tabs ? slots.tabs?.() : createVNode(NextTabs, {
|
|
@@ -2934,7 +2941,7 @@ var columns = defineComponent({
|
|
|
2934
2941
|
onSelect: (...arg) => _emit("tabsSelect", ...arg),
|
|
2935
2942
|
onClose: (...arg) => _emit("tabsClose", ...arg)
|
|
2936
2943
|
}, null) : null, createVNode("main", {
|
|
2937
|
-
class: [ ns$
|
|
2944
|
+
class: [ ns$h.bf("main"), ns$h.is("layout-tabs", isTabs.value) ]
|
|
2938
2945
|
}, [ slots.default?.() ]) ]) ];
|
|
2939
2946
|
var s;
|
|
2940
2947
|
}
|
|
@@ -2980,21 +2987,21 @@ var Header = defineComponent({
|
|
|
2980
2987
|
}
|
|
2981
2988
|
});
|
|
2982
2989
|
|
|
2983
|
-
const ns$
|
|
2990
|
+
const ns$g = useNamespace("layout-classic");
|
|
2984
2991
|
|
|
2985
2992
|
var classic = defineComponent({
|
|
2986
2993
|
props: {},
|
|
2987
|
-
setup: () => (provide("ns", ns$
|
|
2988
|
-
ns: ns$
|
|
2994
|
+
setup: () => (provide("ns", ns$g), {
|
|
2995
|
+
ns: ns$g
|
|
2989
2996
|
}),
|
|
2990
2997
|
render() {
|
|
2991
2998
|
const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {});
|
|
2992
2999
|
slots.menu;
|
|
2993
3000
|
const isTabs = ref(!!slots.tabs);
|
|
2994
3001
|
return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), createVNode(Fragment, null, [ createVNode(Header, null, null), createVNode("div", {
|
|
2995
|
-
class: [ ns$
|
|
3002
|
+
class: [ ns$g.b("content"), ns$g.is("layout-tabs", isTabs.value) ]
|
|
2996
3003
|
}, [ createVNode(Sidebar, null, null), createVNode("div", {
|
|
2997
|
-
class: ns$
|
|
3004
|
+
class: ns$g.b("container")
|
|
2998
3005
|
}, [ _config.showTabs ? slots.tabs ? slots.tabs?.() : createVNode(NextTabs, {
|
|
2999
3006
|
tabs: _config.tabs,
|
|
3000
3007
|
activeTab: _config.activeTab,
|
|
@@ -3002,12 +3009,12 @@ var classic = defineComponent({
|
|
|
3002
3009
|
onSelect: (...arg) => _emit("tabsSelect", ...arg),
|
|
3003
3010
|
onClose: (...arg) => _emit("tabsClose", ...arg)
|
|
3004
3011
|
}, null) : null, createVNode("main", {
|
|
3005
|
-
class: [ ns$
|
|
3012
|
+
class: [ ns$g.b("main") ]
|
|
3006
3013
|
}, [ slots.default?.() ]) ]) ]) ]);
|
|
3007
3014
|
}
|
|
3008
3015
|
});
|
|
3009
3016
|
|
|
3010
|
-
const ns$
|
|
3017
|
+
const ns$f = useNamespace("layout"), layouts = {
|
|
3011
3018
|
defaults: markRaw(defaults),
|
|
3012
3019
|
transverse: markRaw(transverse),
|
|
3013
3020
|
columns: markRaw(columns),
|
|
@@ -3034,8 +3041,8 @@ const NextLayout = withInstall(defineComponent({
|
|
|
3034
3041
|
},
|
|
3035
3042
|
emits: [ "changeLanguage", "changeUserDropdown", "changeOptions", "tabsChange", "tabsSelect", "tabsClose" ],
|
|
3036
3043
|
setup(props, {slots: slots, emit: emit}) {
|
|
3037
|
-
const _config = ref(mergeWith(defaultConfig$
|
|
3038
|
-
provide("options", _config.value), provide("__ns__", ns$
|
|
3044
|
+
const _config = ref(mergeWith(defaultConfig$5, props.options, customizerCoverArray));
|
|
3045
|
+
provide("options", _config.value), provide("__ns__", ns$f), provide("__emit__", emit),
|
|
3039
3046
|
provide("__slots__", slots);
|
|
3040
3047
|
const updateOptions = cfg => {
|
|
3041
3048
|
_config.value = mergeWith(_config.value, cfg, customizerCoverArray), updateThemeColorCssVar(_config.value?.setting),
|
|
@@ -3059,15 +3066,15 @@ const NextLayout = withInstall(defineComponent({
|
|
|
3059
3066
|
const _activeSlots = {};
|
|
3060
3067
|
for (const key in slots) Object.prototype.hasOwnProperty.call(slots, key) && (_activeSlots[key] = () => slots[key]?.());
|
|
3061
3068
|
return createVNode("div", {
|
|
3062
|
-
class: [ ns$
|
|
3069
|
+
class: [ ns$f.b(), props.className ],
|
|
3063
3070
|
style: props.style
|
|
3064
3071
|
}, [ h(activeLayout.value, {}, {
|
|
3065
3072
|
..._activeSlots
|
|
3066
3073
|
}) ]);
|
|
3067
3074
|
}
|
|
3068
|
-
})), ns$
|
|
3075
|
+
})), ns$e = useNamespace("tabs");
|
|
3069
3076
|
|
|
3070
|
-
var Element$
|
|
3077
|
+
var Element$9 = defineComponent({
|
|
3071
3078
|
name: "NextTabs",
|
|
3072
3079
|
props: {
|
|
3073
3080
|
activeTab: {
|
|
@@ -3136,12 +3143,12 @@ var Element$8 = defineComponent({
|
|
|
3136
3143
|
tabsView.value.push(activeRoute)), emit("change", activeIndex.value, tabsView.value, "add");
|
|
3137
3144
|
}));
|
|
3138
3145
|
const renderContent = () => createVNode("nav", {
|
|
3139
|
-
class: ns$
|
|
3146
|
+
class: ns$e.b()
|
|
3140
3147
|
}, [ createVNode(ElScrollbar, null, {
|
|
3141
3148
|
default: () => [ createVNode("ul", {
|
|
3142
|
-
class: ns$
|
|
3149
|
+
class: ns$e.b("list")
|
|
3143
3150
|
}, [ tabsView.value.map(((tab, index) => tab ? createVNode("li", {
|
|
3144
|
-
class: [ "tab-item", ns$
|
|
3151
|
+
class: [ "tab-item", ns$e.is("active", activeIndex.value === index) ],
|
|
3145
3152
|
onClick: event => onClickTabItem(event, tab, index)
|
|
3146
3153
|
}, [ createVNode("i", {
|
|
3147
3154
|
class: [ "tab-icon", tab.meta?.icon ]
|
|
@@ -3172,11 +3179,11 @@ var Element$8 = defineComponent({
|
|
|
3172
3179
|
onCommand: onChange
|
|
3173
3180
|
}, {
|
|
3174
3181
|
default: () => createVNode("span", {
|
|
3175
|
-
class: ns$
|
|
3182
|
+
class: ns$e.b("tab-more")
|
|
3176
3183
|
}, [ createVNode("i", {
|
|
3177
|
-
class: [ ns$
|
|
3184
|
+
class: [ ns$e.be("tab-more", "box"), ns$e.be("tab-more", "top") ]
|
|
3178
3185
|
}, null), createVNode("i", {
|
|
3179
|
-
class: [ ns$
|
|
3186
|
+
class: [ ns$e.be("tab-more", "box"), ns$e.be("tab-more", "bottom") ]
|
|
3180
3187
|
}, null) ]),
|
|
3181
3188
|
dropdown: () => createVNode(ElDropdownMenu, null, {
|
|
3182
3189
|
default: () => [ createVNode(ElDropdownItem, {
|
|
@@ -3210,7 +3217,7 @@ var Element$8 = defineComponent({
|
|
|
3210
3217
|
}
|
|
3211
3218
|
});
|
|
3212
3219
|
|
|
3213
|
-
const NextTabs = withInstall(Element$
|
|
3220
|
+
const NextTabs = withInstall(Element$9), ns$d = useNamespace("container");
|
|
3214
3221
|
|
|
3215
3222
|
const NextContainer = withInstall(defineComponent({
|
|
3216
3223
|
name: "NextContainer",
|
|
@@ -3249,18 +3256,18 @@ const NextContainer = withInstall(defineComponent({
|
|
|
3249
3256
|
}), style;
|
|
3250
3257
|
}));
|
|
3251
3258
|
return () => props.scrollbar ? createVNode(ElScrollbar, {
|
|
3252
|
-
class: [ ns$
|
|
3259
|
+
class: [ ns$d.b(), props.className ],
|
|
3253
3260
|
style: props.style
|
|
3254
3261
|
}, {
|
|
3255
3262
|
default: () => [ slots.default?.() ]
|
|
3256
3263
|
}) : createVNode("div", {
|
|
3257
|
-
class: [ ns$
|
|
3264
|
+
class: [ ns$d.b(), props.className ],
|
|
3258
3265
|
style: {
|
|
3259
3266
|
...styles.value,
|
|
3260
3267
|
...props.style
|
|
3261
3268
|
}
|
|
3262
3269
|
}, [ props.card ? createVNode("div", {
|
|
3263
|
-
class: ns$
|
|
3270
|
+
class: ns$d.b("card")
|
|
3264
3271
|
}, [ slots.default?.() ]) : slots.default?.() ]);
|
|
3265
3272
|
}
|
|
3266
3273
|
}));
|
|
@@ -3338,7 +3345,7 @@ var defaultPropsConfig = {
|
|
|
3338
3345
|
|
|
3339
3346
|
const header_menu_slots_key = [ "menu-left-prefix", "menu-left-suffix", "menu-right-prefix", "menu-right-suffix" ], operation_column_slots_key = [ "operation-column-prefix", "operation-column-suffix" ];
|
|
3340
3347
|
|
|
3341
|
-
var defaultConfig$
|
|
3348
|
+
var defaultConfig$4 = {
|
|
3342
3349
|
initLoadData: !0,
|
|
3343
3350
|
defaultContentHeight: 300,
|
|
3344
3351
|
fullscreenchangeContentHeight: !1,
|
|
@@ -3370,6 +3377,8 @@ var defaultConfig$3 = {
|
|
|
3370
3377
|
settingBtn: !0,
|
|
3371
3378
|
operations: !0,
|
|
3372
3379
|
operationsWidth: 260,
|
|
3380
|
+
operationsHeaderAlign: "center",
|
|
3381
|
+
operationsColumnAlign: "center",
|
|
3373
3382
|
operationsBtnPlain: !1,
|
|
3374
3383
|
operationsBtnText: !0,
|
|
3375
3384
|
operationsBtnSize: "small",
|
|
@@ -3385,7 +3394,7 @@ var defaultConfig$3 = {
|
|
|
3385
3394
|
formColumnMinWidth: 350
|
|
3386
3395
|
};
|
|
3387
3396
|
|
|
3388
|
-
const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$
|
|
3397
|
+
const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$c = useNamespace("spin-loading");
|
|
3389
3398
|
|
|
3390
3399
|
var NextSpinLoading$1 = defineComponent({
|
|
3391
3400
|
name: "NextSpinLoading",
|
|
@@ -3420,22 +3429,22 @@ var NextSpinLoading$1 = defineComponent({
|
|
|
3420
3429
|
const _t = this.t, slots = this.$slots, props = this.$props, loadingText = props.tip || _t("next.loading");
|
|
3421
3430
|
return createVNode("div", {
|
|
3422
3431
|
ref: "elementInstance",
|
|
3423
|
-
class: [ ns$
|
|
3432
|
+
class: [ ns$c.b(), props.className ],
|
|
3424
3433
|
style: props.style
|
|
3425
3434
|
}, [ slots.default?.(), props.loading ? createVNode("div", {
|
|
3426
|
-
class: ns$
|
|
3435
|
+
class: ns$c.b("mask")
|
|
3427
3436
|
}, [ createVNode("span", {
|
|
3428
|
-
class: ns$
|
|
3437
|
+
class: ns$c.b("mask-dot")
|
|
3429
3438
|
}, [ createVNode("i", {
|
|
3430
|
-
class: ns$
|
|
3439
|
+
class: ns$c.be("mask", "dot-item")
|
|
3431
3440
|
}, null), createVNode("i", {
|
|
3432
|
-
class: ns$
|
|
3441
|
+
class: ns$c.be("mask", "dot-item")
|
|
3433
3442
|
}, null), createVNode("i", {
|
|
3434
|
-
class: ns$
|
|
3443
|
+
class: ns$c.be("mask", "dot-item")
|
|
3435
3444
|
}, null), createVNode("i", {
|
|
3436
|
-
class: ns$
|
|
3445
|
+
class: ns$c.be("mask", "dot-item")
|
|
3437
3446
|
}, null) ]), createVNode("span", {
|
|
3438
|
-
class: ns$
|
|
3447
|
+
class: ns$c.be("mask", "text")
|
|
3439
3448
|
}, [ loadingText ]) ]) : null ]);
|
|
3440
3449
|
}
|
|
3441
3450
|
}), SearchColumn = defineComponent({
|
|
@@ -3968,7 +3977,9 @@ const TableColumnDynamic = defineComponent({
|
|
|
3968
3977
|
}, mergeDicData = loopDicData(columnOption.dicData);
|
|
3969
3978
|
return createVNode("span", null, [ _formatterColumnValue(row[columnOption.prop], mergeDicData) ]);
|
|
3970
3979
|
}
|
|
3971
|
-
return null
|
|
3980
|
+
return columnOption.cellUnit ? createVNode(Fragment, null, [ createVNode("span", null, [ row[columnOption.prop] ]), createVNode("em", {
|
|
3981
|
+
class: "cell-unit"
|
|
3982
|
+
}, [ columnOption.cellUnit ]) ]) : null;
|
|
3972
3983
|
};
|
|
3973
3984
|
return () => createVNode(Fragment, null, [ !columnOption.hide && createVNode(ElTableColumn, {
|
|
3974
3985
|
prop: columnOption.prop,
|
|
@@ -4000,8 +4011,8 @@ var TableColumnOperations = defineComponent({
|
|
|
4000
4011
|
fixed: "right",
|
|
4001
4012
|
label: t("next.table.operation"),
|
|
4002
4013
|
width: options.operationsWidth,
|
|
4003
|
-
headerAlign: options.headerAlign,
|
|
4004
|
-
align: options.cellAlign
|
|
4014
|
+
headerAlign: valueExist(options.operationsHeaderAlign, options.headerAlign),
|
|
4015
|
+
align: valueExist(options.operationsColumnAlign, options.cellAlign)
|
|
4005
4016
|
}, {
|
|
4006
4017
|
default: scoped => createVNode(Fragment, null, [ slots["operation-column-prefix"]?.(scoped, {
|
|
4007
4018
|
text: btnText,
|
|
@@ -4125,7 +4136,7 @@ var TableColumnOperations = defineComponent({
|
|
|
4125
4136
|
}
|
|
4126
4137
|
});
|
|
4127
4138
|
|
|
4128
|
-
const ns$
|
|
4139
|
+
const ns$b = useNamespace("dialog");
|
|
4129
4140
|
|
|
4130
4141
|
var NextDialog$1 = defineComponent({
|
|
4131
4142
|
name: "NextDialog",
|
|
@@ -4154,6 +4165,10 @@ var NextDialog$1 = defineComponent({
|
|
|
4154
4165
|
type: Boolean,
|
|
4155
4166
|
default: !0
|
|
4156
4167
|
},
|
|
4168
|
+
showClose: {
|
|
4169
|
+
type: Boolean,
|
|
4170
|
+
default: !0
|
|
4171
|
+
},
|
|
4157
4172
|
appendToBody: {
|
|
4158
4173
|
type: Boolean,
|
|
4159
4174
|
default: !1
|
|
@@ -4191,7 +4206,7 @@ var NextDialog$1 = defineComponent({
|
|
|
4191
4206
|
return () => createVNode(Fragment, null, [ createVNode(ElDialog, {
|
|
4192
4207
|
modelValue: visible.value,
|
|
4193
4208
|
"onUpdate:modelValue": $event => visible.value = $event,
|
|
4194
|
-
class: ns$
|
|
4209
|
+
class: ns$b.b(),
|
|
4195
4210
|
title: props.title,
|
|
4196
4211
|
appendToBody: props.appendToBody,
|
|
4197
4212
|
"destroy-on-close": !0,
|
|
@@ -4208,18 +4223,18 @@ var NextDialog$1 = defineComponent({
|
|
|
4208
4223
|
}, {
|
|
4209
4224
|
default: () => [ slots.default?.() ],
|
|
4210
4225
|
header: ({close: close, titleId: titleId, titleClass: titleClass}) => createVNode("div", {
|
|
4211
|
-
class: ns$
|
|
4226
|
+
class: ns$b.b("header")
|
|
4212
4227
|
}, [ createVNode("h4", {
|
|
4213
4228
|
id: titleId,
|
|
4214
4229
|
class: titleClass
|
|
4215
4230
|
}, [ props.title ]), createVNode("div", {
|
|
4216
|
-
class: ns$
|
|
4231
|
+
class: ns$b.e("header-right")
|
|
4217
4232
|
}, [ props.fullscreenBtn && createVNode("span", {
|
|
4218
4233
|
class: "icon-fullscreen",
|
|
4219
4234
|
onClick: () => isFullscreen.value = !isFullscreen.value
|
|
4220
4235
|
}, [ createVNode(ElIcon, null, {
|
|
4221
4236
|
default: () => [ createVNode(full_screen_default, null, null) ]
|
|
4222
|
-
}) ]), createVNode("span", {
|
|
4237
|
+
}) ]), props.showClose && createVNode("span", {
|
|
4223
4238
|
class: "icon-close",
|
|
4224
4239
|
onClick: close
|
|
4225
4240
|
}, [ createVNode(ElIcon, {
|
|
@@ -4247,7 +4262,7 @@ const tableSelectConfig = {
|
|
|
4247
4262
|
operations: !1
|
|
4248
4263
|
};
|
|
4249
4264
|
|
|
4250
|
-
var defaultConfig$
|
|
4265
|
+
var defaultConfig$3 = {
|
|
4251
4266
|
size: "default",
|
|
4252
4267
|
colSpan: 8,
|
|
4253
4268
|
labelWidth: "6em",
|
|
@@ -4262,7 +4277,7 @@ var defaultConfig$2 = {
|
|
|
4262
4277
|
resetText: null
|
|
4263
4278
|
};
|
|
4264
4279
|
|
|
4265
|
-
const ns$
|
|
4280
|
+
const ns$a = useNamespace("form");
|
|
4266
4281
|
|
|
4267
4282
|
var NumberRangePicker = defineComponent({
|
|
4268
4283
|
name: "NumberRangePicker",
|
|
@@ -4302,7 +4317,7 @@ var NumberRangePicker = defineComponent({
|
|
|
4302
4317
|
}));
|
|
4303
4318
|
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
4304
4319
|
ref: numberRangeRef,
|
|
4305
|
-
class: ns$
|
|
4320
|
+
class: ns$a.e("number-range")
|
|
4306
4321
|
}, [ createVNode(ElInputNumber, {
|
|
4307
4322
|
modelValue: startNumber.value,
|
|
4308
4323
|
"onUpdate:modelValue": $event => startNumber.value = $event,
|
|
@@ -4312,7 +4327,7 @@ var NumberRangePicker = defineComponent({
|
|
|
4312
4327
|
disabled: disabled,
|
|
4313
4328
|
onChange: onChangeStart
|
|
4314
4329
|
}, null), createVNode("span", {
|
|
4315
|
-
class: ns$
|
|
4330
|
+
class: ns$a.em("number-range", "division")
|
|
4316
4331
|
}, [ t("next.date.rangeSeparator") ]), createVNode(ElInputNumber, {
|
|
4317
4332
|
modelValue: endNumber.value,
|
|
4318
4333
|
"onUpdate:modelValue": $event => endNumber.value = $event,
|
|
@@ -4331,7 +4346,7 @@ function _isSlot$3(s) {
|
|
|
4331
4346
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
|
|
4332
4347
|
}
|
|
4333
4348
|
|
|
4334
|
-
const ns$
|
|
4349
|
+
const ns$9 = useNamespace("form"), InputTableSelect = defineComponent({
|
|
4335
4350
|
name: "InputTableSelect",
|
|
4336
4351
|
props: {
|
|
4337
4352
|
modelValue: {
|
|
@@ -4359,7 +4374,7 @@ const ns$8 = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4359
4374
|
},
|
|
4360
4375
|
emits: [ "select" ],
|
|
4361
4376
|
setup(props, {emit: emit}) {
|
|
4362
|
-
const {t: t} = useLocale(), _disabled = props.disabled, _column = props.column, _placeholder = _column.placeholder || t("next.form.select") + _column.label, _tableDefaultConfig = deepClone(defaultConfig$
|
|
4377
|
+
const {t: t} = useLocale(), _disabled = props.disabled, _column = props.column, _placeholder = _column.placeholder || t("next.form.select") + _column.label, _tableDefaultConfig = deepClone(defaultConfig$4), _tableSelectConfig = deepClone(tableSelectConfig), _options = merge$1(_tableDefaultConfig, _tableSelectConfig, _column.tableSelect), tableSelectDialog = reactive({
|
|
4363
4378
|
visible: !1,
|
|
4364
4379
|
title: _column.label + t("next.form.tableSelect"),
|
|
4365
4380
|
dialogWidth: _options.dialogWidth
|
|
@@ -4430,18 +4445,18 @@ const ns$8 = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4430
4445
|
}, renderContent = () => {
|
|
4431
4446
|
let _slot, _slot2;
|
|
4432
4447
|
return createVNode(Fragment, null, [ createVNode("div", {
|
|
4433
|
-
class: [ "el-input", ns$
|
|
4448
|
+
class: [ "el-input", ns$9.e("input-table"), ns$9.is("disabled", _disabled) ]
|
|
4434
4449
|
}, [ createVNode("div", {
|
|
4435
4450
|
class: "el-input__wrapper"
|
|
4436
4451
|
}, [ tags?.value.length ? createVNode("span", {
|
|
4437
|
-
class: ns$
|
|
4452
|
+
class: ns$9.em("input-table", "value")
|
|
4438
4453
|
}, [ tags.value.map(((tag, index) => createVNode(ElTag, {
|
|
4439
4454
|
closable: !_disabled,
|
|
4440
4455
|
onClose: () => _onCloseTag(0, index)
|
|
4441
4456
|
}, {
|
|
4442
4457
|
default: () => [ tag.label ]
|
|
4443
4458
|
}))), tagsMore?.value?.length ? createVNode(ElTooltip, {
|
|
4444
|
-
"popper-class": ns$
|
|
4459
|
+
"popper-class": ns$9.e("tooltip-tags"),
|
|
4445
4460
|
placement: "bottom",
|
|
4446
4461
|
effect: "light"
|
|
4447
4462
|
}, {
|
|
@@ -4455,10 +4470,10 @@ const ns$8 = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4455
4470
|
default: () => [ tag.label ]
|
|
4456
4471
|
})))
|
|
4457
4472
|
}) : null ]) : createVNode("span", {
|
|
4458
|
-
class: ns$
|
|
4473
|
+
class: ns$9.em("input-table", "placeholder")
|
|
4459
4474
|
}, [ _placeholder ]) ]), createVNode(ElButton, {
|
|
4460
4475
|
type: "primary",
|
|
4461
|
-
class: ns$
|
|
4476
|
+
class: ns$9.em("input-table", "append"),
|
|
4462
4477
|
disabled: _disabled,
|
|
4463
4478
|
icon: search_default,
|
|
4464
4479
|
onClick: onClickTableDialog
|
|
@@ -4472,7 +4487,7 @@ const ns$8 = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4472
4487
|
onClose: onCloseTableDialog
|
|
4473
4488
|
}, {
|
|
4474
4489
|
default: () => [ createVNode("div", {
|
|
4475
|
-
class: ns$
|
|
4490
|
+
class: ns$9.em("input-table", "content")
|
|
4476
4491
|
}, [ createVNode(ElRadioGroup, {
|
|
4477
4492
|
modelValue: sinleSelection.value
|
|
4478
4493
|
}, {
|
|
@@ -4495,7 +4510,7 @@ const ns$8 = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4495
4510
|
}) ]
|
|
4496
4511
|
}) ]
|
|
4497
4512
|
}) ]), createVNode("div", {
|
|
4498
|
-
class: ns$
|
|
4513
|
+
class: ns$9.em("input-table", "footer")
|
|
4499
4514
|
}, [ createVNode(ElButton, {
|
|
4500
4515
|
onClick: onResetTableSelect
|
|
4501
4516
|
}, _isSlot$3(_slot = t("next.form.reset")) ? _slot : {
|
|
@@ -4511,7 +4526,7 @@ const ns$8 = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4511
4526
|
};
|
|
4512
4527
|
return () => createVNode(Fragment, null, [ renderContent() ]);
|
|
4513
4528
|
}
|
|
4514
|
-
}), ns$
|
|
4529
|
+
}), ns$8 = useNamespace("form");
|
|
4515
4530
|
|
|
4516
4531
|
var UploadImage = defineComponent({
|
|
4517
4532
|
name: "UploadImage",
|
|
@@ -4568,7 +4583,7 @@ var UploadImage = defineComponent({
|
|
|
4568
4583
|
let urls = [];
|
|
4569
4584
|
return "string" == typeof value ? urls = [ value ] : "[object Array]" === Object.prototype.toString.call(value) && (urls = value),
|
|
4570
4585
|
urls = urls.filter((url => !!url)), urls.length ? createVNode(ElImage, {
|
|
4571
|
-
class: ns$
|
|
4586
|
+
class: ns$8.e("preview-image"),
|
|
4572
4587
|
src: urls[0],
|
|
4573
4588
|
previewSrcList: urls,
|
|
4574
4589
|
"preview-teleported": !0,
|
|
@@ -4583,7 +4598,7 @@ var UploadImage = defineComponent({
|
|
|
4583
4598
|
})
|
|
4584
4599
|
}) : null;
|
|
4585
4600
|
})(), _disabled ? null : createVNode(ElUpload, {
|
|
4586
|
-
class: [ ns$
|
|
4601
|
+
class: [ ns$8.b("upload-image"), props.className ],
|
|
4587
4602
|
style: props.style,
|
|
4588
4603
|
"list-type": props.listType,
|
|
4589
4604
|
multiple: props.multiple,
|
|
@@ -4721,9 +4736,9 @@ function _isSlot$2(s) {
|
|
|
4721
4736
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
|
|
4722
4737
|
}
|
|
4723
4738
|
|
|
4724
|
-
const ns$
|
|
4739
|
+
const ns$7 = useNamespace("form");
|
|
4725
4740
|
|
|
4726
|
-
var Element$
|
|
4741
|
+
var Element$7 = defineComponent({
|
|
4727
4742
|
name: "NextForm",
|
|
4728
4743
|
props: {
|
|
4729
4744
|
options: {
|
|
@@ -4741,7 +4756,7 @@ var Element$6 = defineComponent({
|
|
|
4741
4756
|
},
|
|
4742
4757
|
emits: [ "submit", "close", "reset" ],
|
|
4743
4758
|
setup(props, {slots: slots, emit: emit, expose: expose}) {
|
|
4744
|
-
const _config = deepClone(defaultConfig$
|
|
4759
|
+
const _config = deepClone(defaultConfig$3), options = reactive(merge$1(_config, props.options)), _isEditing = computed((() => "boolean" != typeof options.isEditing || options.isEditing)), {t: t} = useLocale(), colSpan = ref(options.colSpan), formDatum = reactive(props.formDatum) || {}, formParams = reactive(merge$1({}, formDatum)), _formColumns = ref([]), formRules = reactive({});
|
|
4745
4760
|
watch((() => [ props.columns, props.formDatum ]), (() => {
|
|
4746
4761
|
(() => {
|
|
4747
4762
|
const columns = props.columns;
|
|
@@ -5092,7 +5107,7 @@ var Element$6 = defineComponent({
|
|
|
5092
5107
|
let _slot;
|
|
5093
5108
|
return createVNode(ElForm, {
|
|
5094
5109
|
ref: ruleFormRef,
|
|
5095
|
-
class: ns$
|
|
5110
|
+
class: ns$7.b(),
|
|
5096
5111
|
inline: !1,
|
|
5097
5112
|
model: formParams,
|
|
5098
5113
|
size: options.size
|
|
@@ -5112,7 +5127,7 @@ var Element$6 = defineComponent({
|
|
|
5112
5127
|
}, {
|
|
5113
5128
|
label: () => column.label ? createVNode(Fragment, null, [ createVNode(NextTextEllipsis, {
|
|
5114
5129
|
content: t(column.label),
|
|
5115
|
-
class: ns$
|
|
5130
|
+
class: ns$7.e("item-label")
|
|
5116
5131
|
}, null), column.tip ? createVNode(ElTooltip, {
|
|
5117
5132
|
effect: "dark",
|
|
5118
5133
|
content: column.tip,
|
|
@@ -5132,7 +5147,7 @@ var Element$6 = defineComponent({
|
|
|
5132
5147
|
})))) ? _slot : {
|
|
5133
5148
|
default: () => [ _slot ]
|
|
5134
5149
|
}), _isEditing.value && options.showFooter ? createVNode("div", {
|
|
5135
|
-
class: ns$
|
|
5150
|
+
class: ns$7.e("footer")
|
|
5136
5151
|
}, [ createVNode(ElButton, {
|
|
5137
5152
|
type: "primary",
|
|
5138
5153
|
loading: submitLoading.value,
|
|
@@ -5152,7 +5167,7 @@ var Element$6 = defineComponent({
|
|
|
5152
5167
|
}
|
|
5153
5168
|
});
|
|
5154
5169
|
|
|
5155
|
-
const NextTreeSelect = withInstall(treeSelect), NextForm = withInstall(Element$
|
|
5170
|
+
const NextTreeSelect = withInstall(treeSelect), NextForm = withInstall(Element$7);
|
|
5156
5171
|
|
|
5157
5172
|
var AddEditForm = defineComponent({
|
|
5158
5173
|
name: "AddEditForm",
|
|
@@ -5209,18 +5224,18 @@ function _isSlot(s) {
|
|
|
5209
5224
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
|
|
5210
5225
|
}
|
|
5211
5226
|
|
|
5212
|
-
const ns$
|
|
5227
|
+
const ns$6 = useNamespace("crud-table");
|
|
5213
5228
|
|
|
5214
|
-
var Element$
|
|
5229
|
+
var Element$6 = defineComponent({
|
|
5215
5230
|
name: "NextCrudTable",
|
|
5216
5231
|
props: defaultPropsConfig,
|
|
5217
5232
|
emits: [ "confirm-search", "clear-search", "change-pagination", "selection-change", "row-click", "row-contextmenu", "row-dblclick", "cell-click", "cell-dblclick", "cell-contextmenu", "cell-mouse-enter", "cell-mouse-leave", "expand-change", "click-add-edit", "close-add-edit", "view-add-edit", "delete-rows", "delete-row", "submit-form" ],
|
|
5218
5233
|
setup(props, {emit: emit, slots: slots, expose: expose}) {
|
|
5219
|
-
const _config = deepClone(defaultConfig$
|
|
5234
|
+
const _config = deepClone(defaultConfig$4), _options = computed((() => {
|
|
5220
5235
|
const cfg = unref(props.options);
|
|
5221
5236
|
return merge$1(_config, cfg);
|
|
5222
5237
|
})), options = unref(_options);
|
|
5223
|
-
provide("options", computed((() => _options.value))), provide("ns", ns$
|
|
5238
|
+
provide("options", computed((() => _options.value))), provide("ns", ns$6);
|
|
5224
5239
|
const {t: t} = useLocale(), _columns = ref(options.columns), _searchColumns = ref([]), _formColumns = ref([]), _updateColumnsAll = ops => {
|
|
5225
5240
|
((options, cb) => {
|
|
5226
5241
|
const _columns = reactive(options.columns), _loadDicData = col => {
|
|
@@ -5458,15 +5473,16 @@ var Element$5 = defineComponent({
|
|
|
5458
5473
|
getFormExpose: () => addEditFormRef.value?.getFormExpose(),
|
|
5459
5474
|
updateColumns: ops => {
|
|
5460
5475
|
_updateColumnsAll(ops);
|
|
5461
|
-
}
|
|
5476
|
+
},
|
|
5477
|
+
getSearchFormParams: () => _searchFormParams.value
|
|
5462
5478
|
});
|
|
5463
5479
|
return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ createVNode("div", {
|
|
5464
5480
|
ref: crudTableRef,
|
|
5465
|
-
class: [ ns$
|
|
5481
|
+
class: [ ns$6.b(), props.className ],
|
|
5466
5482
|
style: props.style
|
|
5467
5483
|
}, [ options.showSearchForm || options.showHeaderMenu ? createVNode("header", {
|
|
5468
5484
|
ref: headerRef,
|
|
5469
|
-
class: ns$
|
|
5485
|
+
class: ns$6.b("header")
|
|
5470
5486
|
}, [ options.showSearchForm && createVNode(HeaderSearch, {
|
|
5471
5487
|
columns: _searchColumns.value,
|
|
5472
5488
|
onZoomResize: updateTableContentHeight,
|
|
@@ -5485,7 +5501,7 @@ var Element$5 = defineComponent({
|
|
|
5485
5501
|
}, {
|
|
5486
5502
|
default: () => [ createVNode("div", {
|
|
5487
5503
|
ref: tableRef,
|
|
5488
|
-
class: ns$
|
|
5504
|
+
class: ns$6.b("content")
|
|
5489
5505
|
}, [ createVNode(ElTable, {
|
|
5490
5506
|
data: tableData.value,
|
|
5491
5507
|
height: tableContentHeight.value,
|
|
@@ -5548,7 +5564,7 @@ var Element$5 = defineComponent({
|
|
|
5548
5564
|
}) ]) ]
|
|
5549
5565
|
}), options.isPagination ? createVNode("div", {
|
|
5550
5566
|
ref: footerRef,
|
|
5551
|
-
class: ns$
|
|
5567
|
+
class: ns$6.b("footer")
|
|
5552
5568
|
}, [ createVNode(FooterPagination, {
|
|
5553
5569
|
page: props.page,
|
|
5554
5570
|
onChange: onChangePagination
|
|
@@ -5575,7 +5591,7 @@ var Element$5 = defineComponent({
|
|
|
5575
5591
|
}
|
|
5576
5592
|
});
|
|
5577
5593
|
|
|
5578
|
-
const NextCrudTable = withInstall(Element$
|
|
5594
|
+
const NextCrudTable = withInstall(Element$6);
|
|
5579
5595
|
|
|
5580
5596
|
var propsConfig = {
|
|
5581
5597
|
className: {
|
|
@@ -5606,15 +5622,15 @@ var propsConfig = {
|
|
|
5606
5622
|
total: 0
|
|
5607
5623
|
})
|
|
5608
5624
|
}
|
|
5609
|
-
}, defaultConfig$
|
|
5625
|
+
}, defaultConfig$2 = {};
|
|
5610
5626
|
|
|
5611
|
-
const ns$
|
|
5627
|
+
const ns$5 = useNamespace("crud-table-virtualized");
|
|
5612
5628
|
|
|
5613
5629
|
const NextCrudTableVirtualized = withInstall(defineComponent({
|
|
5614
5630
|
name: "NextCrudTableVirtualized",
|
|
5615
5631
|
props: propsConfig,
|
|
5616
5632
|
setup(props, {emit: emit}) {
|
|
5617
|
-
const _config = deepClone(defaultConfig$
|
|
5633
|
+
const _config = deepClone(defaultConfig$2), _options = computed((() => {
|
|
5618
5634
|
const cfg = unref(props.options);
|
|
5619
5635
|
return merge$1(_config, cfg);
|
|
5620
5636
|
})), options = unref(_options);
|
|
@@ -5629,7 +5645,7 @@ const NextCrudTableVirtualized = withInstall(defineComponent({
|
|
|
5629
5645
|
emit("close-add-edit");
|
|
5630
5646
|
};
|
|
5631
5647
|
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
5632
|
-
class: [ ns$
|
|
5648
|
+
class: [ ns$5.b(), props.className ]
|
|
5633
5649
|
}, [ createVNode(NextSpinLoading, null, null), createVNode(NextDialog, {
|
|
5634
5650
|
modelValue: addEditDialog.visible,
|
|
5635
5651
|
"onUpdate:modelValue": $event => addEditDialog.visible = $event,
|
|
@@ -5640,7 +5656,7 @@ const NextCrudTableVirtualized = withInstall(defineComponent({
|
|
|
5640
5656
|
onClose: onCloseAddEditDialog
|
|
5641
5657
|
}, null) ]) ]);
|
|
5642
5658
|
}
|
|
5643
|
-
})), NextSpinLoading = withInstall(NextSpinLoading$1), ns$
|
|
5659
|
+
})), NextSpinLoading = withInstall(NextSpinLoading$1), ns$4 = useNamespace("upload");
|
|
5644
5660
|
|
|
5645
5661
|
const NextUpload = withInstall(defineComponent({
|
|
5646
5662
|
name: "NextUpload",
|
|
@@ -5675,7 +5691,7 @@ const NextUpload = withInstall(defineComponent({
|
|
|
5675
5691
|
const slots = this.$slots, props = this.$props, emit = this.$emit, _t = this.t, uploadfilesPreview = ref([]), body = document.getElementsByTagName("body")[0];
|
|
5676
5692
|
let previewImagesContainer = null;
|
|
5677
5693
|
return createVNode(ElUpload, {
|
|
5678
|
-
class: [ ns$
|
|
5694
|
+
class: [ ns$4.b(), props.className ],
|
|
5679
5695
|
style: props.style,
|
|
5680
5696
|
"list-type": props.listType,
|
|
5681
5697
|
"auto-upload": !1,
|
|
@@ -5713,9 +5729,9 @@ const NextUpload = withInstall(defineComponent({
|
|
|
5713
5729
|
})
|
|
5714
5730
|
});
|
|
5715
5731
|
}
|
|
5716
|
-
})), ns$
|
|
5732
|
+
})), ns$3 = useNamespace("video-player");
|
|
5717
5733
|
|
|
5718
|
-
var Element$
|
|
5734
|
+
var Element$3 = defineComponent({
|
|
5719
5735
|
name: "NextVideoPlayer",
|
|
5720
5736
|
props: {
|
|
5721
5737
|
className: {
|
|
@@ -5788,7 +5804,7 @@ var Element$2 = defineComponent({
|
|
|
5788
5804
|
if (!classNames || !classNames.length) throw new Error("模型类别不能未空!");
|
|
5789
5805
|
container.innerHTML = "", tf.loadGraphModel(modelUrl).then((model => {
|
|
5790
5806
|
const canvas = document.createElement("canvas");
|
|
5791
|
-
canvas.className = ns$
|
|
5807
|
+
canvas.className = ns$3.b("recongition"), container.appendChild(canvas);
|
|
5792
5808
|
const ctx = canvas.getContext("2d"), detect_ctx = document.createElement("canvas").getContext("2d");
|
|
5793
5809
|
video.ontimeupdate = () => {
|
|
5794
5810
|
const {videoWidth: videoWidth, videoHeight: videoHeight, offsetTop: offsetTop, offsetLeft: offsetLeft} = video;
|
|
@@ -5959,13 +5975,13 @@ var Element$2 = defineComponent({
|
|
|
5959
5975
|
});
|
|
5960
5976
|
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
5961
5977
|
ref: videoBoxRef,
|
|
5962
|
-
class: [ ns$
|
|
5978
|
+
class: [ ns$3.b(), props.className ],
|
|
5963
5979
|
style: props.style
|
|
5964
5980
|
}, null) ]);
|
|
5965
5981
|
}
|
|
5966
5982
|
});
|
|
5967
5983
|
|
|
5968
|
-
const NextVideoPlayer = withInstall(Element$
|
|
5984
|
+
const NextVideoPlayer = withInstall(Element$3);
|
|
5969
5985
|
|
|
5970
5986
|
const NextDragResize = withInstall(defineComponent({
|
|
5971
5987
|
name: "NextDragResize",
|
|
@@ -5978,6 +5994,14 @@ var ToolHeader = defineComponent({
|
|
|
5978
5994
|
isFullscreen: {
|
|
5979
5995
|
type: Boolean,
|
|
5980
5996
|
default: !1
|
|
5997
|
+
},
|
|
5998
|
+
imageIndex: {
|
|
5999
|
+
type: Number,
|
|
6000
|
+
default: 0
|
|
6001
|
+
},
|
|
6002
|
+
imageLength: {
|
|
6003
|
+
type: Number,
|
|
6004
|
+
default: 0
|
|
5981
6005
|
}
|
|
5982
6006
|
},
|
|
5983
6007
|
emits: [ "fullscreen", "save" ],
|
|
@@ -5988,6 +6012,7 @@ var ToolHeader = defineComponent({
|
|
|
5988
6012
|
return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ createVNode("ul", {
|
|
5989
6013
|
class: [ _ns.be("header", "tool") ]
|
|
5990
6014
|
}, [ createVNode("li", {
|
|
6015
|
+
class: "hover",
|
|
5991
6016
|
onClick: () => emit("save")
|
|
5992
6017
|
}, [ createVNode("svg", {
|
|
5993
6018
|
t: "1719034799379",
|
|
@@ -6008,8 +6033,11 @@ var ToolHeader = defineComponent({
|
|
|
6008
6033
|
style: "padding-left: 3px"
|
|
6009
6034
|
}, [ t("next.labelimg.saveLabel") ]) ]) ]), createVNode("ul", {
|
|
6010
6035
|
class: [ _ns.be("header", "tool") ]
|
|
6011
|
-
}, [ createVNode("li", {
|
|
6012
|
-
style: "
|
|
6036
|
+
}, [ props.imageLength ? createVNode("li", null, [ createVNode("span", null, [ createTextVNode("第 "), props.imageIndex + 1, createTextVNode(" 张") ]), createVNode("em", {
|
|
6037
|
+
style: "padding: 0 5px;"
|
|
6038
|
+
}, [ createTextVNode("/") ]), createVNode("span", null, [ createTextVNode("共 "), props.imageLength, createTextVNode(" 张") ]) ]) : null, createVNode("li", {
|
|
6039
|
+
style: "margin-right: 30px;",
|
|
6040
|
+
class: "hover"
|
|
6013
6041
|
}, [ createVNode(ElPopover, {
|
|
6014
6042
|
trigger: "hover",
|
|
6015
6043
|
placement: "bottom",
|
|
@@ -6028,6 +6056,7 @@ var ToolHeader = defineComponent({
|
|
|
6028
6056
|
style: "font-size: 12px;white-space: nowrap;"
|
|
6029
6057
|
}, [ createVNode("li", null, [ createVNode("span", null, [ createTextVNode("W:") ]), createVNode("span", null, [ createTextVNode("鼠标移入图片中,长按W键,鼠标按下左键,移动鼠标开始绘制,鼠标抬起结束绘制") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("A:") ]), createVNode("span", null, [ createTextVNode("A键进入上一张图片进行标注") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("D:") ]), createVNode("span", null, [ createTextVNode("D键进入下一张图片进行标注") ]) ]) ])
|
|
6030
6058
|
}) ]), props.isFullscreen ? createVNode("li", {
|
|
6059
|
+
class: "hover",
|
|
6031
6060
|
onClick: () => switchFillscreen(!1)
|
|
6032
6061
|
}, [ createVNode(ElTooltip, {
|
|
6033
6062
|
placement: "top",
|
|
@@ -6047,6 +6076,7 @@ var ToolHeader = defineComponent({
|
|
|
6047
6076
|
"p-id": "5389"
|
|
6048
6077
|
}, null) ]) ]
|
|
6049
6078
|
}) ]) : createVNode("li", {
|
|
6079
|
+
class: "hover",
|
|
6050
6080
|
onClick: () => switchFillscreen(!0)
|
|
6051
6081
|
}, [ createVNode(ElTooltip, {
|
|
6052
6082
|
placement: "top",
|
|
@@ -6069,7 +6099,7 @@ var ToolHeader = defineComponent({
|
|
|
6069
6099
|
}
|
|
6070
6100
|
});
|
|
6071
6101
|
|
|
6072
|
-
const colors = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
|
|
6102
|
+
const colors$1 = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
|
|
6073
6103
|
const label_type = rect.type, x_center = rect.startX + rect.rectWidth / 2, y_center = rect.startY + rect.rectHeight / 2;
|
|
6074
6104
|
return [ label_type, parseFloat((x_center / rect.canvasWidth).toFixed(6)), parseFloat((y_center / rect.canvasHeight).toFixed(6)), parseFloat((rect.rectWidth / rect.canvasWidth).toFixed(6)), parseFloat((rect.rectHeight / rect.canvasHeight).toFixed(6)) ];
|
|
6075
6105
|
}, canvertToCanvas = (labelData, canvasWidth, canvasHeight) => {
|
|
@@ -6154,7 +6184,7 @@ var ContextMenuLabel = defineComponent({
|
|
|
6154
6184
|
}
|
|
6155
6185
|
}, [ createVNode("span", {
|
|
6156
6186
|
style: {
|
|
6157
|
-
"background-color": colors[index % colors.length]
|
|
6187
|
+
"background-color": colors$1[index % colors$1.length]
|
|
6158
6188
|
},
|
|
6159
6189
|
class: "label-line"
|
|
6160
6190
|
}, null), createVNode("span", null, [ name ]) ]))) ]), isValueExist(activateIndex.value) ? createVNode("div", {
|
|
@@ -6278,7 +6308,7 @@ var DraggableRect = defineComponent({
|
|
|
6278
6308
|
parentRect = props.parentEl.getBoundingClientRect(), document.addEventListener("mousemove", onMousemove),
|
|
6279
6309
|
document.addEventListener("mouseup", onMouseup);
|
|
6280
6310
|
})), onUnmounted((() => {
|
|
6281
|
-
document.removeEventListener("mousemove", onMousemove
|
|
6311
|
+
document.removeEventListener("mousemove", onMousemove), document.removeEventListener("mouseup", onMouseup);
|
|
6282
6312
|
})), {
|
|
6283
6313
|
onMousedown: e => {
|
|
6284
6314
|
e.preventDefault(), isDraggle.value = !0, draggleOffset.value.diff_x = e.offsetX,
|
|
@@ -6286,7 +6316,7 @@ var DraggableRect = defineComponent({
|
|
|
6286
6316
|
},
|
|
6287
6317
|
onMouseup: onMouseup,
|
|
6288
6318
|
onContextmenu: e => {
|
|
6289
|
-
e.preventDefault(), emit("contextmenu", e, rect.value);
|
|
6319
|
+
e.preventDefault(), e.preventDefault(), emit("contextmenu", e, rect.value);
|
|
6290
6320
|
},
|
|
6291
6321
|
rect: rect,
|
|
6292
6322
|
onMousedownDot: (e, corner) => {
|
|
@@ -6342,7 +6372,7 @@ var DraggableRect = defineComponent({
|
|
|
6342
6372
|
onMousedown: event => this.onMousedownDot(event, "bottomRight")
|
|
6343
6373
|
}, null) ]) ]);
|
|
6344
6374
|
}
|
|
6345
|
-
}), CanvasContext = defineComponent({
|
|
6375
|
+
}), CanvasContext$1 = defineComponent({
|
|
6346
6376
|
name: "NextCanvasContext",
|
|
6347
6377
|
props: {
|
|
6348
6378
|
classes: {
|
|
@@ -6408,7 +6438,7 @@ var DraggableRect = defineComponent({
|
|
|
6408
6438
|
const {ctx: ctx, labels: labels, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = options, updateLabels = () => {
|
|
6409
6439
|
ctx.clearRect(0, 0, canvasWidth, canvasHeight), ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
|
|
6410
6440
|
for (let i = 0; i < labels.length; i++) {
|
|
6411
|
-
const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors[type % colors.length];
|
|
6441
|
+
const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors$1[type % colors$1.length];
|
|
6412
6442
|
if (ctx.font = "bold 14px serif", ctx.textBaseline = "top", ctx.save(), ctx.strokeStyle = color,
|
|
6413
6443
|
ctx.strokeRect(startX, startY, rectWidth, rectHeight), isValueExist(rect.typeName) || isValueExist(rect.type)) {
|
|
6414
6444
|
const text = rect.typeName || rect.type;
|
|
@@ -6428,7 +6458,7 @@ var DraggableRect = defineComponent({
|
|
|
6428
6458
|
for (let i = 0; i < labels.length; i++) {
|
|
6429
6459
|
const rect = labels[i], {type: type, startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
|
|
6430
6460
|
x >= startX && x <= startX + rectWidth && y >= startY && y <= startY + rectHeight && (hit_rect = rect,
|
|
6431
|
-
hit_index = i, color = colors[type]);
|
|
6461
|
+
hit_index = i, color = colors$1[type]);
|
|
6432
6462
|
}
|
|
6433
6463
|
return {
|
|
6434
6464
|
hit_rect: hit_rect,
|
|
@@ -6448,26 +6478,13 @@ var DraggableRect = defineComponent({
|
|
|
6448
6478
|
});
|
|
6449
6479
|
drawBaseCanvas.value.updateLabels = updateLabels, drawBaseCanvas.value.addDrawRect = addDrawRect,
|
|
6450
6480
|
drawBaseCanvas.value.hitCanvasLabel = hitCanvasLabel;
|
|
6451
|
-
const {clearCanvas: clearCanvas} = ((canvas, callback, keyW) => {
|
|
6481
|
+
const {clearCanvas: clearCanvas, removeEventAll: removeEventAll} = ((canvas, callback, keyW) => {
|
|
6452
6482
|
const canvasWidth = canvas.width, canvasHeight = canvas.height, ctx = canvas?.getContext("2d"), clearCanvas = () => {
|
|
6453
6483
|
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
6454
6484
|
};
|
|
6455
6485
|
clearCanvas();
|
|
6456
6486
|
let startX, startY, endX, endY, isDrawing = !1, isRectDraw = !1, isWKeyPressed = !1;
|
|
6457
|
-
|
|
6458
|
-
"KeyW" === event.code && (isWKeyPressed = !0, canvas.style.cursor = "crosshair",
|
|
6459
|
-
canvas.style.zIndex = "11", keyW && keyW());
|
|
6460
|
-
})), document.addEventListener("keyup", (event => {
|
|
6461
|
-
isDrawing || "KeyW" === event.code && (isWKeyPressed = !1, canvas.style.cursor = "unset",
|
|
6462
|
-
canvas.style.zIndex = "0");
|
|
6463
|
-
})), canvas.addEventListener("mousedown", (e => {
|
|
6464
|
-
isWKeyPressed && (isDrawing = !0, startX = e.offsetX, startY = e.offsetY);
|
|
6465
|
-
})), canvas.addEventListener("mousemove", (e => {
|
|
6466
|
-
isDrawing && isWKeyPressed && (isRectDraw = !0, endX = e.offsetX, endY = e.offsetY,
|
|
6467
|
-
drawRect());
|
|
6468
|
-
})), canvas.addEventListener("mouseup", (() => {
|
|
6469
|
-
if (!isRectDraw) return;
|
|
6470
|
-
isDrawing = !1, isWKeyPressed = !1, canvas.style.cursor = "unset", canvas.style.zIndex = "0";
|
|
6487
|
+
const drawRectDone = () => {
|
|
6471
6488
|
const rectWidth = Math.abs(endX - startX), rectHeight = Math.abs(endY - startY);
|
|
6472
6489
|
startX > endX && (startX = endX), startY > endY && (startY = endY), callback && callback({
|
|
6473
6490
|
startX: startX,
|
|
@@ -6479,8 +6496,30 @@ var DraggableRect = defineComponent({
|
|
|
6479
6496
|
}, {
|
|
6480
6497
|
endX: endX,
|
|
6481
6498
|
endY: endY
|
|
6482
|
-
})
|
|
6483
|
-
}
|
|
6499
|
+
});
|
|
6500
|
+
}, documentKeydown = event => {
|
|
6501
|
+
"KeyW" === event.code && (isWKeyPressed = !0, canvas.style.cursor = "crosshair",
|
|
6502
|
+
canvas.style.zIndex = "11", keyW && keyW());
|
|
6503
|
+
}, documentKeyup = event => {
|
|
6504
|
+
isDrawing || "KeyW" === event.code && (isWKeyPressed = !1, canvas.style.cursor = "unset",
|
|
6505
|
+
canvas.style.zIndex = "0");
|
|
6506
|
+
}, documentMouseup = () => {
|
|
6507
|
+
isRectDraw && (isDrawing = !1, isWKeyPressed = !1, canvas.style.cursor = "unset",
|
|
6508
|
+
canvas.style.zIndex = "0", drawRectDone(), isRectDraw = !1);
|
|
6509
|
+
};
|
|
6510
|
+
document.addEventListener("keydown", documentKeydown), document.addEventListener("keyup", documentKeyup),
|
|
6511
|
+
document.addEventListener("mouseup", documentMouseup);
|
|
6512
|
+
const canvasMousedown = e => {
|
|
6513
|
+
isWKeyPressed && (isDrawing = !0, startX = e.offsetX, startY = e.offsetY);
|
|
6514
|
+
}, canvasMousemove = e => {
|
|
6515
|
+
isDrawing && isWKeyPressed && (isRectDraw = !0, endX = e.offsetX, endY = e.offsetY,
|
|
6516
|
+
drawRect());
|
|
6517
|
+
}, canvasMouseup = e => {
|
|
6518
|
+
e.stopPropagation(), isRectDraw && (isDrawing = !1, isWKeyPressed = !1, canvas.style.cursor = "unset",
|
|
6519
|
+
canvas.style.zIndex = "0", drawRectDone(), isRectDraw = !1);
|
|
6520
|
+
};
|
|
6521
|
+
canvas.addEventListener("mousedown", canvasMousedown), canvas.addEventListener("mousemove", canvasMousemove),
|
|
6522
|
+
canvas.addEventListener("mouseup", canvasMouseup);
|
|
6484
6523
|
const drawRect = (color = "#f30635") => {
|
|
6485
6524
|
clearCanvas(), ctx.strokeStyle = color, ctx.strokeRect(startX, startY, endX - startX, endY - startY);
|
|
6486
6525
|
};
|
|
@@ -6488,14 +6527,19 @@ var DraggableRect = defineComponent({
|
|
|
6488
6527
|
canvas: canvas,
|
|
6489
6528
|
ctx: ctx,
|
|
6490
6529
|
clearCanvas: clearCanvas,
|
|
6491
|
-
drawRect: drawRect
|
|
6530
|
+
drawRect: drawRect,
|
|
6531
|
+
removeEventAll: () => {
|
|
6532
|
+
document.removeEventListener("mousedown", documentKeydown), document.removeEventListener("keyup", documentKeyup),
|
|
6533
|
+
document.removeEventListener("mouseup", documentMouseup), canvas.removeEventListener("mousedown", canvasMousedown),
|
|
6534
|
+
canvas.removeEventListener("mousemove", canvasMousemove), canvas.removeEventListener("mouseup", canvasMouseup);
|
|
6535
|
+
}
|
|
6492
6536
|
};
|
|
6493
6537
|
})(canvasRectRef.value, ((rect, {endX: endX, endY: endY}) => {
|
|
6494
6538
|
activate_add_label.value = rect, drawBaseCanvas.value.addDrawRect(rect), updateContextmenuLabelFixed(endX, endY, rect);
|
|
6495
6539
|
}), (() => {
|
|
6496
6540
|
onCloseDraggableRectFixed();
|
|
6497
6541
|
}));
|
|
6498
|
-
drawBaseCanvas.value.clearCanvasRect = clearCanvas;
|
|
6542
|
+
drawBaseCanvas.value.clearCanvasRect = clearCanvas, drawBaseCanvas.value.removeEventAll = removeEventAll;
|
|
6499
6543
|
}, image.onerror = () => {
|
|
6500
6544
|
loadingImage.value = !1;
|
|
6501
6545
|
};
|
|
@@ -6527,6 +6571,8 @@ var DraggableRect = defineComponent({
|
|
|
6527
6571
|
renderImageLabel(rowInfo);
|
|
6528
6572
|
}
|
|
6529
6573
|
}));
|
|
6574
|
+
})), onUnmounted((() => {
|
|
6575
|
+
drawBaseCanvas.value.removeEventAll();
|
|
6530
6576
|
}));
|
|
6531
6577
|
const contextmenuLabelFixed = ref({
|
|
6532
6578
|
show: !1,
|
|
@@ -6602,8 +6648,8 @@ var DraggableRect = defineComponent({
|
|
|
6602
6648
|
onCloseContentmenuLabel: onCloseContentmenuLabel,
|
|
6603
6649
|
onSelectedLabel: (rect, index) => {
|
|
6604
6650
|
onCloseDraggableRectFixed(), nextTick((() => {
|
|
6605
|
-
const {startX: x, startY: y, type: type} = rect;
|
|
6606
|
-
updateDraggableRectFixed(x, y,
|
|
6651
|
+
const {startX: x, startY: y, type: type} = rect, color = colors$1[type];
|
|
6652
|
+
updateDraggableRectFixed(x, y, labels.value[index], index, color);
|
|
6607
6653
|
}));
|
|
6608
6654
|
},
|
|
6609
6655
|
onDeleteLabel: onDeleteLabel,
|
|
@@ -6683,12 +6729,12 @@ var DraggableRect = defineComponent({
|
|
|
6683
6729
|
})(rect, index)
|
|
6684
6730
|
}, [ createVNode("div", null, [ createVNode("span", {
|
|
6685
6731
|
style: {
|
|
6686
|
-
"background-color": colors[rect.type]
|
|
6732
|
+
"background-color": colors$1[rect.type]
|
|
6687
6733
|
},
|
|
6688
6734
|
class: "label-line"
|
|
6689
6735
|
}, null), createVNode("span", null, [ rect.typeName ]) ]), createVNode(ElPopconfirm, {
|
|
6690
6736
|
title: t("next.labelimg.confirmDeleteLabel"),
|
|
6691
|
-
width:
|
|
6737
|
+
width: 200,
|
|
6692
6738
|
onConfirm: () => (rect => {
|
|
6693
6739
|
emit("delete", rect);
|
|
6694
6740
|
})(rect)
|
|
@@ -6708,13 +6754,13 @@ var DraggableRect = defineComponent({
|
|
|
6708
6754
|
}, null) ]);
|
|
6709
6755
|
return () => createVNode(Fragment, null, [ renderContent() ]);
|
|
6710
6756
|
}
|
|
6711
|
-
}), defaultConfig = {
|
|
6757
|
+
}), defaultConfig$1 = {
|
|
6712
6758
|
minContentHeight: 500
|
|
6713
6759
|
};
|
|
6714
6760
|
|
|
6715
|
-
const ns$
|
|
6761
|
+
const ns$2 = useNamespace("labelimg");
|
|
6716
6762
|
|
|
6717
|
-
var Element = defineComponent({
|
|
6763
|
+
var Element$1 = defineComponent({
|
|
6718
6764
|
name: "NextLabelimg",
|
|
6719
6765
|
props: {
|
|
6720
6766
|
className: {
|
|
@@ -6725,10 +6771,6 @@ var Element = defineComponent({
|
|
|
6725
6771
|
type: Object,
|
|
6726
6772
|
default: () => ({})
|
|
6727
6773
|
},
|
|
6728
|
-
rowKey: {
|
|
6729
|
-
type: String,
|
|
6730
|
-
default: "id"
|
|
6731
|
-
},
|
|
6732
6774
|
options: {
|
|
6733
6775
|
type: Object,
|
|
6734
6776
|
default: () => ({})
|
|
@@ -6744,11 +6786,11 @@ var Element = defineComponent({
|
|
|
6744
6786
|
},
|
|
6745
6787
|
emits: [ "change", "save", "prev-click", "next-click" ],
|
|
6746
6788
|
setup(props, {emit: emit, slots: slots, expose: expose}) {
|
|
6747
|
-
const {t: t} = useLocale(), _config = deepClone(defaultConfig), _options = computed((() => {
|
|
6789
|
+
const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = computed((() => {
|
|
6748
6790
|
const cfg = unref(props.options);
|
|
6749
6791
|
return merge$1(_config, cfg);
|
|
6750
6792
|
})), options = unref(_options);
|
|
6751
|
-
provide("ns", ns$
|
|
6793
|
+
provide("ns", ns$2), provide("_emit", emit);
|
|
6752
6794
|
const activateNodeIndex = ref(0), classes = ref(props.classes), labelImages = ref(deepClone(props.data));
|
|
6753
6795
|
watch((() => props.data), (data => {
|
|
6754
6796
|
labelImages.value = deepClone(data);
|
|
@@ -6782,7 +6824,10 @@ var Element = defineComponent({
|
|
|
6782
6824
|
node: node,
|
|
6783
6825
|
label_txt: yolo_label.join("\n")
|
|
6784
6826
|
};
|
|
6785
|
-
}, isChangeNodeLabels = () =>
|
|
6827
|
+
}, isChangeNodeLabels = () => {
|
|
6828
|
+
const node = labelImages.value[activateNodeIndex.value];
|
|
6829
|
+
return isEqual(toRaw(node.labels).map((rect => convertToLabel(rect))), currentNode.value.labels.map((rect => convertToLabel(rect))));
|
|
6830
|
+
}, switchKeydownAD = e => {
|
|
6786
6831
|
const imageLength = labelImages.value.length;
|
|
6787
6832
|
"KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
|
|
6788
6833
|
activateNodeIndex.value < 0 && (activateNodeIndex.value = imageLength - 1));
|
|
@@ -6852,21 +6897,23 @@ var Element = defineComponent({
|
|
|
6852
6897
|
});
|
|
6853
6898
|
const renderContent = () => createVNode("div", {
|
|
6854
6899
|
ref: layoutLabelRef,
|
|
6855
|
-
class: [ ns$
|
|
6900
|
+
class: [ ns$2.b(), props.className, isFullscreen.value ? ns$2.b("fullscreen") : "" ],
|
|
6856
6901
|
style: {
|
|
6857
6902
|
...props.style
|
|
6858
6903
|
}
|
|
6859
6904
|
}, [ createVNode(NextSpinLoading$1, {
|
|
6860
6905
|
loading: loading.value,
|
|
6861
6906
|
tip: t("next.labelimg.saveTxt"),
|
|
6862
|
-
class: [ ns$
|
|
6907
|
+
class: [ ns$2.b("loading") ]
|
|
6863
6908
|
}, {
|
|
6864
6909
|
default: () => [ createVNode(ElScrollbar, null, {
|
|
6865
6910
|
default: () => [ createVNode("header", {
|
|
6866
6911
|
ref: headerRef,
|
|
6867
|
-
class: [ ns$
|
|
6912
|
+
class: [ ns$2.b("header") ]
|
|
6868
6913
|
}, [ slots.header ? slots.header() : createVNode(ToolHeader, {
|
|
6869
6914
|
isFullscreen: isFullscreen.value,
|
|
6915
|
+
imageIndex: activateNodeIndex.value,
|
|
6916
|
+
imageLength: labelImages.value.length,
|
|
6870
6917
|
onFullscreen: onSwitchFillscreen,
|
|
6871
6918
|
onSave: () => {
|
|
6872
6919
|
onChangeActivateNode(activateNodeIndex.value) || ElMessage({
|
|
@@ -6876,16 +6923,16 @@ var Element = defineComponent({
|
|
|
6876
6923
|
}
|
|
6877
6924
|
}, null) ]), createVNode("div", {
|
|
6878
6925
|
ref: mainRef,
|
|
6879
|
-
class: [ ns$
|
|
6926
|
+
class: [ ns$2.b("main") ]
|
|
6880
6927
|
}, [ createVNode(ElScrollbar, {
|
|
6881
|
-
class: [ ns$
|
|
6928
|
+
class: [ ns$2.be("main", "content") ]
|
|
6882
6929
|
}, {
|
|
6883
6930
|
default: () => [ createVNode("div", {
|
|
6884
|
-
class: [ ns$
|
|
6931
|
+
class: [ ns$2.be("main", "content") ],
|
|
6885
6932
|
style: {
|
|
6886
6933
|
height: mainContentHeight.value + "px"
|
|
6887
6934
|
}
|
|
6888
|
-
}, [ createVNode(CanvasContext, {
|
|
6935
|
+
}, [ createVNode(CanvasContext$1, {
|
|
6889
6936
|
ref: canvasContextRef,
|
|
6890
6937
|
contextClientHeight: mainContentHeight.value,
|
|
6891
6938
|
classes: classes.value,
|
|
@@ -6900,9 +6947,9 @@ var Element = defineComponent({
|
|
|
6900
6947
|
onSelect: onSelectLabelNode
|
|
6901
6948
|
}, null) ]), createVNode("footer", {
|
|
6902
6949
|
ref: footerRef,
|
|
6903
|
-
class: [ ns$
|
|
6950
|
+
class: [ ns$2.b("footer") ]
|
|
6904
6951
|
}, [ createVNode("div", {
|
|
6905
|
-
class: [ ns$
|
|
6952
|
+
class: [ ns$2.be("footer", "left") ]
|
|
6906
6953
|
}, [ createVNode(ElIcon, {
|
|
6907
6954
|
size: 24,
|
|
6908
6955
|
color: "#797979",
|
|
@@ -6910,10 +6957,10 @@ var Element = defineComponent({
|
|
|
6910
6957
|
}, {
|
|
6911
6958
|
default: () => [ createVNode(arrow_left_default, null, null) ]
|
|
6912
6959
|
}) ]), createVNode("div", {
|
|
6913
|
-
class: [ ns$
|
|
6960
|
+
class: [ ns$2.be("footer", "center") ]
|
|
6914
6961
|
}, [ createVNode(ElScrollbar, null, {
|
|
6915
6962
|
default: () => [ createVNode("ul", {
|
|
6916
|
-
class: [ ns$
|
|
6963
|
+
class: [ ns$2.bem("footer", "center", "list") ]
|
|
6917
6964
|
}, [ labelImages.value.map(((item, index) => createVNode("li", {
|
|
6918
6965
|
key: index,
|
|
6919
6966
|
onClick: () => onChangeActivateNode(index),
|
|
@@ -6929,7 +6976,7 @@ var Element = defineComponent({
|
|
|
6929
6976
|
fit: "cover"
|
|
6930
6977
|
}, null) ]))) ]) ]
|
|
6931
6978
|
}) ]), createVNode("div", {
|
|
6932
|
-
class: [ ns$
|
|
6979
|
+
class: [ ns$2.be("footer", "right") ]
|
|
6933
6980
|
}, [ createVNode(ElIcon, {
|
|
6934
6981
|
size: 24,
|
|
6935
6982
|
color: "#797979",
|
|
@@ -6943,7 +6990,7 @@ var Element = defineComponent({
|
|
|
6943
6990
|
}
|
|
6944
6991
|
});
|
|
6945
6992
|
|
|
6946
|
-
const ns = useNamespace("labelimg-preview");
|
|
6993
|
+
const ns$1 = useNamespace("labelimg-preview");
|
|
6947
6994
|
|
|
6948
6995
|
var preview = defineComponent({
|
|
6949
6996
|
name: "NextLabelimgPreview",
|
|
@@ -6980,7 +7027,7 @@ var preview = defineComponent({
|
|
|
6980
7027
|
canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
|
|
6981
7028
|
})(canvasWidth, canvasHeight), ctx.clearRect(0, 0, canvasWidth, canvasHeight), ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
|
|
6982
7029
|
for (let i = 0; i < labels.value.length; i++) {
|
|
6983
|
-
const rect = labels.value[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors[type % colors.length];
|
|
7030
|
+
const rect = labels.value[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors$1[type % colors$1.length];
|
|
6984
7031
|
if (ctx.font = "bold 14px serif", ctx.textBaseline = "top", ctx.save(), ctx.strokeStyle = color,
|
|
6985
7032
|
ctx.strokeRect(startX, startY, rectWidth, rectHeight), !isValueExist(rect.typeName)) {
|
|
6986
7033
|
const typeName = classes.value[rect.type];
|
|
@@ -7003,7 +7050,7 @@ var preview = defineComponent({
|
|
|
7003
7050
|
});
|
|
7004
7051
|
}));
|
|
7005
7052
|
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
7006
|
-
class: [ ns.b(), props.className ],
|
|
7053
|
+
class: [ ns$1.b(), props.className ],
|
|
7007
7054
|
style: {
|
|
7008
7055
|
...props.style
|
|
7009
7056
|
}
|
|
@@ -7013,7 +7060,421 @@ var preview = defineComponent({
|
|
|
7013
7060
|
}
|
|
7014
7061
|
});
|
|
7015
7062
|
|
|
7016
|
-
const NextLabelimg = withInstall(Element), NextLabelimgPreview = withInstall(preview);
|
|
7063
|
+
const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview), isPointInCircle = (mouseX, mouseY, circleX, circleY, radius) => Math.sqrt(Math.pow(mouseX - circleX, 2) + Math.pow(mouseY - circleY, 2)) < radius, vertexesUnique = vertexes => Array.from(new Set(vertexes.map((item => JSON.stringify(item))))).map((item => JSON.parse(item))), {hexToRgba: hexToRgba} = useChangeColor(), colors = [ "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ];
|
|
7064
|
+
|
|
7065
|
+
class CreatePolygonVertexes {
|
|
7066
|
+
canvas;
|
|
7067
|
+
ctx;
|
|
7068
|
+
vertexes;
|
|
7069
|
+
isDrawing;
|
|
7070
|
+
mouseOffset;
|
|
7071
|
+
vertexesObservers=[];
|
|
7072
|
+
destroyedObservers;
|
|
7073
|
+
constructor(canvas, ctx) {
|
|
7074
|
+
this.canvas = canvas, this.ctx = ctx, this.isDrawing = !1, this.vertexes = [], this.mouseOffset = {
|
|
7075
|
+
x: 0,
|
|
7076
|
+
y: 0
|
|
7077
|
+
}, canvas.addEventListener("click", this.canvasMouseClick.bind(this)), canvas.addEventListener("mousemove", this.canvasMousemove.bind(this)),
|
|
7078
|
+
canvas.addEventListener("dblclick", this.canvasMouseDblclick.bind(this)), this.vertexes = new Proxy(this.vertexes, {
|
|
7079
|
+
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7080
|
+
!0)
|
|
7081
|
+
}), this.mouseOffset = new Proxy(this.mouseOffset, {
|
|
7082
|
+
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7083
|
+
!0)
|
|
7084
|
+
});
|
|
7085
|
+
}
|
|
7086
|
+
notifyVertexChangeListeners() {
|
|
7087
|
+
this.vertexesObservers.forEach((listener => {
|
|
7088
|
+
listener(this.vertexes, this.mouseOffset);
|
|
7089
|
+
}));
|
|
7090
|
+
}
|
|
7091
|
+
vertexesChangeEventListener(listener) {
|
|
7092
|
+
this.vertexesObservers.push(listener);
|
|
7093
|
+
}
|
|
7094
|
+
notifyDestryedListerers() {
|
|
7095
|
+
this.destroyedObservers(this.vertexes);
|
|
7096
|
+
}
|
|
7097
|
+
onDestroyed(callback) {
|
|
7098
|
+
this.destroyedObservers = callback;
|
|
7099
|
+
}
|
|
7100
|
+
canvasMouseClick(e) {
|
|
7101
|
+
e.stopPropagation(), this.isDrawing = !0, this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
|
|
7102
|
+
this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes);
|
|
7103
|
+
}
|
|
7104
|
+
canvasMousemove(e) {
|
|
7105
|
+
e.stopPropagation(), this.isDrawing && (this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
|
|
7106
|
+
this.canvas.style.cursor = "crosshair");
|
|
7107
|
+
}
|
|
7108
|
+
canvasMouseDblclick(e) {
|
|
7109
|
+
e.stopPropagation(), this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
|
|
7110
|
+
this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes),
|
|
7111
|
+
this.notifyDestryedListerers(), this.destroyed();
|
|
7112
|
+
}
|
|
7113
|
+
destroyed() {
|
|
7114
|
+
this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.canvas.removeEventListener("click", this.canvasMouseClick),
|
|
7115
|
+
this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
|
|
7119
|
+
class EditPolygonPath {
|
|
7120
|
+
canvas;
|
|
7121
|
+
ctx;
|
|
7122
|
+
vertexes;
|
|
7123
|
+
isEditing;
|
|
7124
|
+
isMoveEditing;
|
|
7125
|
+
canClickEvent;
|
|
7126
|
+
pointVertexIndex;
|
|
7127
|
+
pointCentreIndex;
|
|
7128
|
+
vertexRadius;
|
|
7129
|
+
edgeCentreRadius;
|
|
7130
|
+
observers=[];
|
|
7131
|
+
constructor(canvas, ctx) {
|
|
7132
|
+
this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
|
|
7133
|
+
this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
|
|
7134
|
+
this.vertexRadius = 8, this.edgeCentreRadius = 5;
|
|
7135
|
+
}
|
|
7136
|
+
drawPolygonPath(vertexes, mouseX, mouseY) {
|
|
7137
|
+
const ctx = this.ctx;
|
|
7138
|
+
if (!vertexes.length) return;
|
|
7139
|
+
ctx.beginPath(), ctx.lineWidth = 3, ctx.strokeStyle = "#5470c6", ctx.fillStyle = hexToRgba("#5470c6", .2),
|
|
7140
|
+
ctx.moveTo(vertexes[0][0], vertexes[0][1]);
|
|
7141
|
+
for (let i = 1; i < vertexes.length; i++) {
|
|
7142
|
+
const [x, y] = vertexes[i];
|
|
7143
|
+
ctx.lineTo(x, y);
|
|
7144
|
+
}
|
|
7145
|
+
isNaN(mouseX) || isNaN(mouseY) || ctx.lineTo(mouseX, mouseY), ctx.closePath(), ctx.stroke(),
|
|
7146
|
+
ctx.fill();
|
|
7147
|
+
}
|
|
7148
|
+
drawPolygonEdgeCentre(vertexes) {
|
|
7149
|
+
const ctx = this.ctx;
|
|
7150
|
+
for (let i = 0; i < vertexes.length; i++) {
|
|
7151
|
+
const [x, y] = vertexes[i];
|
|
7152
|
+
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, this.vertexRadius, 0, 2 * Math.PI),
|
|
7153
|
+
ctx.closePath(), ctx.fill(), ctx.beginPath(), ctx.fillStyle = "#FFFFFF", ctx.arc(x, y, this.vertexRadius - 3, 0, 2 * Math.PI),
|
|
7154
|
+
ctx.closePath(), ctx.fill();
|
|
7155
|
+
}
|
|
7156
|
+
for (let i = 0; i < vertexes.length; i++) {
|
|
7157
|
+
const start = vertexes[i % vertexes.length], end = vertexes[(i + 1) % vertexes.length], x = start[0] + (end[0] - start[0]) / 2, y = start[1] + (end[1] - start[1]) / 2;
|
|
7158
|
+
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, this.edgeCentreRadius, 0, 2 * Math.PI),
|
|
7159
|
+
ctx.closePath(), ctx.fill();
|
|
7160
|
+
}
|
|
7161
|
+
}
|
|
7162
|
+
drawPolygon(vertexes, mouseOffset) {
|
|
7163
|
+
this.vertexes = vertexes, mouseOffset ? this.drawPolygonPath(vertexes, mouseOffset.x, mouseOffset.y) : (this.drawPolygonPath(vertexes),
|
|
7164
|
+
this.drawPolygonEdgeCentre(vertexes));
|
|
7165
|
+
}
|
|
7166
|
+
pointInVertexes(x, y) {
|
|
7167
|
+
const vertexes = this.vertexes;
|
|
7168
|
+
let aimIndex = null;
|
|
7169
|
+
for (let i = 0; i < vertexes.length; i++) {
|
|
7170
|
+
const [vertex_x, vertex_y] = vertexes[i];
|
|
7171
|
+
if (isPointInCircle(x, y, vertex_x, vertex_y, this.vertexRadius)) {
|
|
7172
|
+
this.canvas.style.cursor = "pointer", aimIndex = i;
|
|
7173
|
+
break;
|
|
7174
|
+
}
|
|
7175
|
+
this.canvas.style.cursor = "unset";
|
|
7176
|
+
}
|
|
7177
|
+
return aimIndex;
|
|
7178
|
+
}
|
|
7179
|
+
pointInEdgeCentre(x, y) {
|
|
7180
|
+
const vertexes = this.vertexes;
|
|
7181
|
+
let aimIndex = null;
|
|
7182
|
+
for (let i = 0; i < vertexes.length; i++) {
|
|
7183
|
+
const start = vertexes[i % vertexes.length], end = vertexes[(i + 1) % vertexes.length], vertex_x = start[0] + (end[0] - start[0]) / 2, vertex_y = start[1] + (end[1] - start[1]) / 2;
|
|
7184
|
+
if (isPointInCircle(x, y, vertex_x, vertex_y, this.edgeCentreRadius)) {
|
|
7185
|
+
this.canvas.style.cursor = "pointer", aimIndex = i;
|
|
7186
|
+
break;
|
|
7187
|
+
}
|
|
7188
|
+
this.canvas.style.cursor = "unset";
|
|
7189
|
+
}
|
|
7190
|
+
return aimIndex;
|
|
7191
|
+
}
|
|
7192
|
+
pointInVertexesOrEdgeCentre(x, y) {
|
|
7193
|
+
const vertexes = this.vertexes;
|
|
7194
|
+
for (let i = 0; i < vertexes.length; i++) {
|
|
7195
|
+
const [vertex_x, vertex_y] = vertexes[i], isInVertex = isPointInCircle(x, y, vertex_x, vertex_y, this.vertexRadius), start = vertexes[i % vertexes.length], end = vertexes[(i + 1) % vertexes.length], edge_center_x = start[0] + (end[0] - start[0]) / 2, edge_center_y = start[1] + (end[1] - start[1]) / 2, isInEdgeCenter = isPointInCircle(x, y, edge_center_x, edge_center_y, this.edgeCentreRadius);
|
|
7196
|
+
if (isInVertex || isInEdgeCenter) {
|
|
7197
|
+
this.canvas.style.cursor = "pointer";
|
|
7198
|
+
break;
|
|
7199
|
+
}
|
|
7200
|
+
this.canvas.style.cursor = "unset";
|
|
7201
|
+
}
|
|
7202
|
+
}
|
|
7203
|
+
notifyObservers() {
|
|
7204
|
+
this.observers.forEach((listener => {
|
|
7205
|
+
listener(this.vertexes);
|
|
7206
|
+
}));
|
|
7207
|
+
}
|
|
7208
|
+
updatePolygon(callback) {
|
|
7209
|
+
this.isEditing = !0, this.canvas.addEventListener("mousedown", this.canvasMousedown.bind(this)),
|
|
7210
|
+
this.canvas.addEventListener("mouseup", this.canvasMouseup.bind(this)), this.canvas.addEventListener("click", this.canvasMouseClick.bind(this)),
|
|
7211
|
+
this.canvas.addEventListener("mousemove", this.canvasMousemove.bind(this)), this.observers.push(callback);
|
|
7212
|
+
}
|
|
7213
|
+
canvasMousedown(e) {
|
|
7214
|
+
e.stopPropagation(), e.preventDefault(), this.canClickEvent = !0;
|
|
7215
|
+
const {offsetX: x, offsetY: y} = e;
|
|
7216
|
+
if (this.isEditing) {
|
|
7217
|
+
const vertex_i = this.pointInVertexes(x, y);
|
|
7218
|
+
isValueExist(vertex_i) && (this.isMoveEditing = !0, this.pointVertexIndex = vertex_i,
|
|
7219
|
+
this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
|
|
7220
|
+
const i = this.pointInEdgeCentre(x, y);
|
|
7221
|
+
isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ]));
|
|
7222
|
+
}
|
|
7223
|
+
setTimeout((() => {
|
|
7224
|
+
this.canClickEvent = !1;
|
|
7225
|
+
}), 200);
|
|
7226
|
+
}
|
|
7227
|
+
canvasMouseup(e) {
|
|
7228
|
+
e.stopPropagation(), e.preventDefault();
|
|
7229
|
+
const {offsetX: x, offsetY: y} = e;
|
|
7230
|
+
this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
|
|
7231
|
+
this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
|
|
7232
|
+
this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
|
|
7233
|
+
this.notifyObservers();
|
|
7234
|
+
}
|
|
7235
|
+
canvasMouseClick(e) {
|
|
7236
|
+
e.stopPropagation();
|
|
7237
|
+
const {offsetX: x, offsetY: y} = e;
|
|
7238
|
+
if (this.isEditing && this.canClickEvent) {
|
|
7239
|
+
e.stopImmediatePropagation();
|
|
7240
|
+
const i = this.pointInVertexes(x, y);
|
|
7241
|
+
if (isValueExist(i)) {
|
|
7242
|
+
if (this.vertexes.length <= 3) return;
|
|
7243
|
+
this.vertexes.splice(i, 1), this.drawPolygon(this.vertexes), this.notifyObservers();
|
|
7244
|
+
}
|
|
7245
|
+
}
|
|
7246
|
+
}
|
|
7247
|
+
canvasMousemove(e) {
|
|
7248
|
+
e.stopPropagation();
|
|
7249
|
+
const {offsetX: x, offsetY: y} = e;
|
|
7250
|
+
this.pointInVertexesOrEdgeCentre(x, y), this.isMoveEditing && (this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
|
|
7251
|
+
this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
|
|
7252
|
+
this.notifyObservers());
|
|
7253
|
+
}
|
|
7254
|
+
destroyed() {
|
|
7255
|
+
this.vertexes = [], this.observers = [], this.isEditing = !1, this.canvas.removeEventListener("mousedown", this.canvasMousedown),
|
|
7256
|
+
this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("click", this.canvasMouseClick),
|
|
7257
|
+
this.canvas.removeEventListener("mousemove", this.canvasMousemove);
|
|
7258
|
+
}
|
|
7259
|
+
}
|
|
7260
|
+
|
|
7261
|
+
class CreateDrawCanvas {
|
|
7262
|
+
canvas;
|
|
7263
|
+
ctx;
|
|
7264
|
+
image;
|
|
7265
|
+
canvasWidth;
|
|
7266
|
+
canvasHeight;
|
|
7267
|
+
paths;
|
|
7268
|
+
editDrawPolygon;
|
|
7269
|
+
createPolygonVertexes;
|
|
7270
|
+
editVertexes;
|
|
7271
|
+
editPolygonObservers=[];
|
|
7272
|
+
constructor(options) {
|
|
7273
|
+
const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, paths: paths} = options;
|
|
7274
|
+
this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
|
|
7275
|
+
this.canvasHeight = canvasHeight, this.paths = paths || [], this.editVertexes = [],
|
|
7276
|
+
this.render(), this.editDrawPolygon = new EditPolygonPath(canvas, ctx), this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx),
|
|
7277
|
+
this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
|
|
7278
|
+
this.render(), this.editDrawPolygon.drawPolygon(vertexes, mouseOffset), this.editVertexes = vertexes,
|
|
7279
|
+
this.notifyObservers();
|
|
7280
|
+
})), this.createPolygonVertexes.onDestroyed((vertexes => {
|
|
7281
|
+
this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editDrawPolygon.updatePolygon((vertexes => {
|
|
7282
|
+
this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editVertexes = vertexes,
|
|
7283
|
+
this.notifyObservers();
|
|
7284
|
+
}));
|
|
7285
|
+
}));
|
|
7286
|
+
}
|
|
7287
|
+
notifyObservers() {
|
|
7288
|
+
this.editPolygonObservers.forEach((listener => {
|
|
7289
|
+
listener(this.editVertexes);
|
|
7290
|
+
}));
|
|
7291
|
+
}
|
|
7292
|
+
updatePolygon(callback) {
|
|
7293
|
+
this.editPolygonObservers.push(callback);
|
|
7294
|
+
}
|
|
7295
|
+
drawPolygons(paths) {
|
|
7296
|
+
const ctx = this.ctx;
|
|
7297
|
+
for (let i = 0; i < paths.length; i++) {
|
|
7298
|
+
const path = paths[i].path;
|
|
7299
|
+
if (!path.length) return;
|
|
7300
|
+
const color = colors[i % colors.length];
|
|
7301
|
+
ctx.beginPath(), ctx.lineWidth = 2, ctx.strokeStyle = color, ctx.fillStyle = hexToRgba(color, .2),
|
|
7302
|
+
ctx.moveTo(path[0][0], path[0][1]);
|
|
7303
|
+
for (let i = 1; i < path.length; i++) {
|
|
7304
|
+
const [x, y] = path[i];
|
|
7305
|
+
ctx.lineTo(x, y);
|
|
7306
|
+
}
|
|
7307
|
+
ctx.closePath(), ctx.stroke(), ctx.fill();
|
|
7308
|
+
}
|
|
7309
|
+
}
|
|
7310
|
+
initCanvas=() => {
|
|
7311
|
+
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.ctx.drawImage(this.image, 0, 0, this.canvasWidth, this.canvasHeight),
|
|
7312
|
+
this.drawPolygons(this.paths);
|
|
7313
|
+
};
|
|
7314
|
+
render=() => {
|
|
7315
|
+
this.initCanvas();
|
|
7316
|
+
};
|
|
7317
|
+
destroyed() {
|
|
7318
|
+
this.paths = [], this.editDrawPolygon.destroyed(), this.createPolygonVertexes.destroyed();
|
|
7319
|
+
}
|
|
7320
|
+
}
|
|
7321
|
+
|
|
7322
|
+
var CanvasContext = defineComponent({
|
|
7323
|
+
props: {
|
|
7324
|
+
classes: {
|
|
7325
|
+
type: Array,
|
|
7326
|
+
default: () => []
|
|
7327
|
+
},
|
|
7328
|
+
contextClientHeight: {
|
|
7329
|
+
type: Number,
|
|
7330
|
+
default: null
|
|
7331
|
+
},
|
|
7332
|
+
rowInfo: {
|
|
7333
|
+
type: Object,
|
|
7334
|
+
default: () => ({})
|
|
7335
|
+
}
|
|
7336
|
+
},
|
|
7337
|
+
emits: [ "editPolygon" ],
|
|
7338
|
+
setup(props, {emit: emit}) {
|
|
7339
|
+
const ns = inject("ns", {}), canvasMainRef = ref(), canvasBaseRef = ref(), drawCanvas = ref(), loadingImage = ref(!1), renderImageLabel = rowInfo => {
|
|
7340
|
+
const clientHeight = canvasMainRef.value?.clientHeight, ctx = canvasBaseRef.value?.getContext("2d");
|
|
7341
|
+
if (rowInfo?.imageSrc) {
|
|
7342
|
+
const image = new Image;
|
|
7343
|
+
image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
|
|
7344
|
+
loadingImage.value = !1;
|
|
7345
|
+
let {width: width, height: height} = image;
|
|
7346
|
+
if (height > clientHeight) {
|
|
7347
|
+
const scale = height / clientHeight;
|
|
7348
|
+
height = clientHeight, image.style.height = height + "px", width /= scale;
|
|
7349
|
+
}
|
|
7350
|
+
const canvasHeight = height, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
|
|
7351
|
+
((canvasWidth, canvasHeight) => {
|
|
7352
|
+
canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
|
|
7353
|
+
canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
|
|
7354
|
+
canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
|
|
7355
|
+
})(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
|
|
7356
|
+
canvas: canvasBaseRef.value,
|
|
7357
|
+
ctx: ctx,
|
|
7358
|
+
image: image,
|
|
7359
|
+
canvasWidth: canvasWidth,
|
|
7360
|
+
canvasHeight: canvasHeight,
|
|
7361
|
+
scaleFactor: scaleFactor,
|
|
7362
|
+
paths: rowInfo.labels
|
|
7363
|
+
}), drawCanvas.value.updatePolygon((vertexes => {
|
|
7364
|
+
emit("editPolygon", {
|
|
7365
|
+
vertexes: vertexes,
|
|
7366
|
+
canvasWidth: canvasWidth,
|
|
7367
|
+
canvasHeight: canvasHeight
|
|
7368
|
+
});
|
|
7369
|
+
}));
|
|
7370
|
+
}, image.onerror = () => {
|
|
7371
|
+
loadingImage.value = !1;
|
|
7372
|
+
};
|
|
7373
|
+
}
|
|
7374
|
+
};
|
|
7375
|
+
onMounted((() => {
|
|
7376
|
+
watch((() => props.rowInfo), (info => {
|
|
7377
|
+
const rowInfo = toRaw(info);
|
|
7378
|
+
renderImageLabel(rowInfo);
|
|
7379
|
+
}), {
|
|
7380
|
+
deep: !0,
|
|
7381
|
+
immediate: !0
|
|
7382
|
+
}), watch((() => props.contextClientHeight), (height => {
|
|
7383
|
+
if (valueExist(height)) {
|
|
7384
|
+
canvasMainRef.value.style.height = height + "px";
|
|
7385
|
+
const rowInfo = toRaw(props.rowInfo);
|
|
7386
|
+
renderImageLabel(rowInfo);
|
|
7387
|
+
}
|
|
7388
|
+
}));
|
|
7389
|
+
}));
|
|
7390
|
+
return () => createVNode(Fragment, null, [ createVNode(NextSpinLoading, {
|
|
7391
|
+
loading: loadingImage.value,
|
|
7392
|
+
class: [ ns.b("loading") ]
|
|
7393
|
+
}, {
|
|
7394
|
+
default: () => [ createVNode("div", {
|
|
7395
|
+
ref: canvasMainRef,
|
|
7396
|
+
class: [ ns.b("canvas") ]
|
|
7397
|
+
}, [ createVNode("canvas", {
|
|
7398
|
+
ref: canvasBaseRef,
|
|
7399
|
+
class: [ ns.be("canvas", "context") ]
|
|
7400
|
+
}, null) ]) ]
|
|
7401
|
+
}) ]);
|
|
7402
|
+
}
|
|
7403
|
+
}), defaultConfig = {
|
|
7404
|
+
minContentHeight: 500
|
|
7405
|
+
};
|
|
7406
|
+
|
|
7407
|
+
const ns = useNamespace("labelme");
|
|
7408
|
+
|
|
7409
|
+
const NextLabelme = withInstall(defineComponent({
|
|
7410
|
+
name: "NextLabelme",
|
|
7411
|
+
props: {
|
|
7412
|
+
className: {
|
|
7413
|
+
type: String,
|
|
7414
|
+
default: ""
|
|
7415
|
+
},
|
|
7416
|
+
style: {
|
|
7417
|
+
type: Object,
|
|
7418
|
+
default: () => ({})
|
|
7419
|
+
},
|
|
7420
|
+
options: {
|
|
7421
|
+
type: Object,
|
|
7422
|
+
default: () => ({})
|
|
7423
|
+
},
|
|
7424
|
+
classes: {
|
|
7425
|
+
type: Array,
|
|
7426
|
+
default: () => []
|
|
7427
|
+
},
|
|
7428
|
+
data: {
|
|
7429
|
+
type: Array,
|
|
7430
|
+
default: () => []
|
|
7431
|
+
}
|
|
7432
|
+
},
|
|
7433
|
+
emits: [ "change", "edit-polygon" ],
|
|
7434
|
+
setup(props, {emit: emit}) {
|
|
7435
|
+
const _config = deepClone(defaultConfig), _options = computed((() => {
|
|
7436
|
+
const cfg = unref(props.options);
|
|
7437
|
+
return merge$1(_config, cfg);
|
|
7438
|
+
})), options = unref(_options);
|
|
7439
|
+
provide("ns", ns), useLocale();
|
|
7440
|
+
const activateNodeIndex = ref(0), classes = ref(props.classes), labelImages = ref(deepClone(props.data));
|
|
7441
|
+
watch((() => props.data), (data => {
|
|
7442
|
+
labelImages.value = deepClone(data);
|
|
7443
|
+
}), {
|
|
7444
|
+
deep: !0
|
|
7445
|
+
}), watch((() => props.data.length), (() => {
|
|
7446
|
+
activateNodeIndex.value = 0;
|
|
7447
|
+
})), watch((() => props.classes), (val => {
|
|
7448
|
+
classes.value = val;
|
|
7449
|
+
}), {
|
|
7450
|
+
deep: !0
|
|
7451
|
+
});
|
|
7452
|
+
const currentNode = computed((() => {
|
|
7453
|
+
if (!labelImages.value) return {};
|
|
7454
|
+
const node = labelImages.value[activateNodeIndex.value] || {};
|
|
7455
|
+
return deepClone(node);
|
|
7456
|
+
})), mainContentHeight = ref(options.minContentHeight), mainRef = ref(), isFullscreen = ref(!1), onEditPlygonChange = plygon => {
|
|
7457
|
+
emit("edit-polygon", plygon);
|
|
7458
|
+
};
|
|
7459
|
+
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
7460
|
+
class: [ ns.b(), props.className, isFullscreen.value ? ns.b("fullscreen") : "" ],
|
|
7461
|
+
style: {
|
|
7462
|
+
...props.style
|
|
7463
|
+
}
|
|
7464
|
+
}, [ createVNode("div", {
|
|
7465
|
+
ref: mainRef,
|
|
7466
|
+
class: [ ns.b("main") ]
|
|
7467
|
+
}, [ createVNode("div", {
|
|
7468
|
+
class: [ ns.be("main", "content") ],
|
|
7469
|
+
style: {
|
|
7470
|
+
height: mainContentHeight.value + "px"
|
|
7471
|
+
}
|
|
7472
|
+
}, [ createVNode(CanvasContext, {
|
|
7473
|
+
rowInfo: currentNode.value,
|
|
7474
|
+
onEditPolygon: onEditPlygonChange
|
|
7475
|
+
}, null) ]) ]) ]) ]);
|
|
7476
|
+
}
|
|
7477
|
+
}));
|
|
7017
7478
|
|
|
7018
7479
|
var components = Object.freeze({
|
|
7019
7480
|
__proto__: null,
|
|
@@ -7025,6 +7486,7 @@ var components = Object.freeze({
|
|
|
7025
7486
|
NextForm: NextForm,
|
|
7026
7487
|
NextLabelimg: NextLabelimg,
|
|
7027
7488
|
NextLabelimgPreview: NextLabelimgPreview,
|
|
7489
|
+
NextLabelme: NextLabelme,
|
|
7028
7490
|
NextLayout: NextLayout,
|
|
7029
7491
|
NextMenu: NextMenu,
|
|
7030
7492
|
NextSpinLoading: NextSpinLoading,
|
|
@@ -7067,7 +7529,7 @@ const zoomDialog = app => {
|
|
|
7067
7529
|
}));
|
|
7068
7530
|
}
|
|
7069
7531
|
});
|
|
7070
|
-
}, version = "0.3.
|
|
7532
|
+
}, version = "0.3.3", install = function(app) {
|
|
7071
7533
|
Object.keys(components).forEach((key => {
|
|
7072
7534
|
const component = components[key];
|
|
7073
7535
|
app.component(component.name, component);
|
|
@@ -7077,8 +7539,8 @@ const zoomDialog = app => {
|
|
|
7077
7539
|
};
|
|
7078
7540
|
|
|
7079
7541
|
var index = {
|
|
7080
|
-
version: "0.3.
|
|
7542
|
+
version: "0.3.3",
|
|
7081
7543
|
install: install
|
|
7082
7544
|
};
|
|
7083
7545
|
|
|
7084
|
-
export { NextContainer, NextCrudTable, NextCrudTableVirtualized, NextDialog, NextDragResize, NextForm, NextLabelimg, NextLabelimgPreview, NextLayout, NextMenu, NextSpinLoading, NextTabs, NextTextEllipsis, NextTreeSelect, NextUpload, NextVideoPlayer, buildLocaleContext, buildTranslator, index as default, defaultNamespace, install, localeContextKey, localeLang, namespaceContextKey, nextUseCssTheme, nextUseCssVar, translate, updateThemeColor, updateThemeColorCssVar, useDetectVideo, useGetDerivedNamespace, useLanguage, useLocale, useNamespace, version };
|
|
7546
|
+
export { NextContainer, NextCrudTable, NextCrudTableVirtualized, NextDialog, NextDragResize, NextForm, NextLabelimg, NextLabelimgPreview, NextLabelme, NextLayout, NextMenu, NextSpinLoading, NextTabs, NextTextEllipsis, NextTreeSelect, NextUpload, NextVideoPlayer, buildLocaleContext, buildTranslator, index as default, defaultNamespace, install, localeContextKey, localeLang, namespaceContextKey, nextUseCssTheme, nextUseCssVar, translate, updateThemeColor, updateThemeColorCssVar, useDetectVideo, useGetDerivedNamespace, useLanguage, useLocale, useNamespace, version };
|