next-element-vue 0.5.9 → 0.6.0
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 +2 -2
- package/dist/index.js +1321 -771
- package/dist/index.min.js +3 -3
- package/dist/index.umd.js +1303 -774
- package/dist/index.umd.min.js +3 -3
- package/dist/packages/components/form/src/widgets/upload-image.d.ts +6 -4
- package/dist/packages/components/labelme/src/config.d.ts +17 -1
- package/dist/packages/components/labelme/src/core/CreatePolygon.d.ts +28 -0
- package/dist/packages/components/labelme/src/core/EditPolygon.d.ts +36 -0
- package/dist/packages/components/labelme/src/core/utils.d.ts +90 -0
- package/dist/packages/components/labelme/src/hooks/canvas-content-hook.d.ts +39 -30
- package/dist/packages/components/labelme/src/widgets/canvas-context.d.ts +5 -13
- package/dist/packages/components/labelme/src/widgets/contextmenu-label.d.ts +38 -0
- package/dist/packages/components/labelme/src/widgets/left-tools.d.ts +4 -0
- package/dist/packages/components/labelme/src/widgets/right-label.d.ts +19 -0
- package/dist/packages/components/layout/src/widgets/header-tools.d.ts +2 -0
- package/dist/packages/components/video-player/index.d.ts +9 -0
- package/dist/packages/components/video-player/src/hook.d.ts +1 -1
- package/dist/packages/components/video-player/src/index.d.ts +9 -0
- package/dist/packages/hooks/global-hook.d.ts +12 -0
- package/dist/packages/hooks/use-locale/index.d.ts +31 -1
- package/dist/packages/locale/lang/en.d.ts +10 -1
- package/dist/packages/locale/lang/zh-cn.d.ts +9 -0
- package/dist/packages/locale/lang/zh-tw.d.ts +12 -0
- package/package.json +12 -7
- /package/dist/packages/components/crud-table-virtualized/src/{index.test.d.ts → index-demo.d.ts} +0 -0
package/dist/index.umd.js
CHANGED
|
@@ -2,37 +2,22 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 作 者:huangteng
|
|
4
4
|
* 邮 箱:htengweb@163.com
|
|
5
|
-
* 当前版本:0.
|
|
6
|
-
* 发布日期:2025-
|
|
5
|
+
* 当前版本:0.6.0 v
|
|
6
|
+
* 发布日期:2025-09-15
|
|
7
7
|
* 地 址:https://www.npmjs.com/package/next-element-vue
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
!function(global, factory) {
|
|
11
|
-
"object" == typeof exports && "undefined" != typeof module ? factory(exports, require("vue"), require("element-plus"), require("@vueuse/core"), require("
|
|
12
|
-
}(this,
|
|
11
|
+
"object" == typeof exports && "undefined" != typeof module ? factory(exports, require("vue"), require("element-plus"), require("@vueuse/core"), require("video.js"), require("video.js/dist/video-js.css"), require("video.js/dist/lang/zh-CN.json"), require("video.js/dist/lang/en.json"), require("video.js/dist/lang/zh-TW.json")) : "function" == typeof define && define.amd ? define([ "exports", "vue", "element-plus", "@vueuse/core", "video.js", "video.js/dist/video-js.css", "video.js/dist/lang/zh-CN.json", "video.js/dist/lang/en.json", "video.js/dist/lang/zh-TW.json" ], factory) : factory((global = "undefined" != typeof globalThis ? globalThis : global || self).NEXT_ELEMENT = {}, global.Vue, global.ElementPlus, global.VueuseCore, global.videojs, null, global.zhCN, global.En, global.zhTW);
|
|
12
|
+
}(this, function(exports, vue, elementPlus, core, videojs, videoJs_css, zhCN, En, zhTW) {
|
|
13
13
|
"use strict";
|
|
14
|
-
function _interopNamespaceDefault(e) {
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
return e && Object.keys(e).forEach((function(k) {
|
|
17
|
-
if ("default" !== k) {
|
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
-
enumerable: !0,
|
|
21
|
-
get: function() {
|
|
22
|
-
return e[k];
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
})), n.default = e, Object.freeze(n);
|
|
27
|
-
}
|
|
28
|
-
var tf__namespace = _interopNamespaceDefault(tf);
|
|
29
14
|
const _bem = (namespace, block, blockSuffix, element, modifier) => {
|
|
30
15
|
let cls = `${namespace}-${block}`;
|
|
31
16
|
return blockSuffix && (cls += `-${blockSuffix}`), element && (cls += `__${element}`),
|
|
32
17
|
modifier && (cls += `--${modifier}`), cls;
|
|
33
18
|
}, namespaceContextKey = Symbol("namespaceContextKey"), useGetDerivedNamespace = namespaceOverrides => {
|
|
34
19
|
const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref("next")) : vue.ref("next"));
|
|
35
|
-
return vue.computed((
|
|
20
|
+
return vue.computed(() => vue.unref(derivedNamespace) || "next");
|
|
36
21
|
}, useNamespace = (block, namespaceOverrides) => {
|
|
37
22
|
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
38
23
|
return {
|
|
@@ -227,7 +212,7 @@
|
|
|
227
212
|
return null != value && isLength(value.length) && !isFunction(value);
|
|
228
213
|
}
|
|
229
214
|
function createAssigner(assigner) {
|
|
230
|
-
return baseRest(
|
|
215
|
+
return baseRest(function(object, sources) {
|
|
231
216
|
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
|
|
232
217
|
for (customizer = assigner.length > 3 && "function" == typeof customizer ? (length--,
|
|
233
218
|
customizer) : void 0, guard && function(value, index, object) {
|
|
@@ -240,7 +225,7 @@
|
|
|
240
225
|
source && assigner(object, source, index, customizer);
|
|
241
226
|
}
|
|
242
227
|
return object;
|
|
243
|
-
})
|
|
228
|
+
});
|
|
244
229
|
}
|
|
245
230
|
var objectProto$a = Object.prototype;
|
|
246
231
|
function isPrototype(value) {
|
|
@@ -408,16 +393,16 @@
|
|
|
408
393
|
}
|
|
409
394
|
memoize.Cache = MapCache;
|
|
410
395
|
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, reEscapeChar = /\\(\\)?/g, stringToPath = function(func) {
|
|
411
|
-
var result = memoize(func,
|
|
396
|
+
var result = memoize(func, function(key) {
|
|
412
397
|
return 500 === cache.size && cache.clear(), key;
|
|
413
|
-
})
|
|
398
|
+
}), cache = result.cache;
|
|
414
399
|
return result;
|
|
415
|
-
}(
|
|
400
|
+
}(function(string) {
|
|
416
401
|
var result = [];
|
|
417
|
-
return 46 === string.charCodeAt(0) && result.push(""), string.replace(rePropName,
|
|
402
|
+
return 46 === string.charCodeAt(0) && result.push(""), string.replace(rePropName, function(match, number, quote, subString) {
|
|
418
403
|
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
|
|
419
|
-
})
|
|
420
|
-
})
|
|
404
|
+
}), result;
|
|
405
|
+
});
|
|
421
406
|
function castPath(value, object) {
|
|
422
407
|
return isArray(value) ? value : function(value, object) {
|
|
423
408
|
if (isArray(value)) return !1;
|
|
@@ -472,9 +457,9 @@
|
|
|
472
457
|
predicate(value, index, array) && (result[resIndex++] = value);
|
|
473
458
|
}
|
|
474
459
|
return result;
|
|
475
|
-
}(nativeGetSymbols(object),
|
|
460
|
+
}(nativeGetSymbols(object), function(symbol) {
|
|
476
461
|
return propertyIsEnumerable.call(object, symbol);
|
|
477
|
-
}))
|
|
462
|
+
}));
|
|
478
463
|
} : function() {
|
|
479
464
|
return [];
|
|
480
465
|
};
|
|
@@ -542,10 +527,10 @@
|
|
|
542
527
|
break;
|
|
543
528
|
}
|
|
544
529
|
if (seen) {
|
|
545
|
-
if (!arraySome(other,
|
|
530
|
+
if (!arraySome(other, function(othValue, othIndex) {
|
|
546
531
|
if (key = othIndex, !seen.has(key) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex);
|
|
547
532
|
var key;
|
|
548
|
-
}))
|
|
533
|
+
})) {
|
|
549
534
|
result = !1;
|
|
550
535
|
break;
|
|
551
536
|
}
|
|
@@ -558,15 +543,15 @@
|
|
|
558
543
|
}
|
|
559
544
|
function mapToArray(map) {
|
|
560
545
|
var index = -1, result = Array(map.size);
|
|
561
|
-
return map.forEach(
|
|
546
|
+
return map.forEach(function(value, key) {
|
|
562
547
|
result[++index] = [ key, value ];
|
|
563
|
-
})
|
|
548
|
+
}), result;
|
|
564
549
|
}
|
|
565
550
|
function setToArray(set) {
|
|
566
551
|
var index = -1, result = Array(set.size);
|
|
567
|
-
return set.forEach(
|
|
552
|
+
return set.forEach(function(value) {
|
|
568
553
|
result[++index] = value;
|
|
569
|
-
})
|
|
554
|
+
}), result;
|
|
570
555
|
}
|
|
571
556
|
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
572
557
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
@@ -702,19 +687,22 @@
|
|
|
702
687
|
}
|
|
703
688
|
}
|
|
704
689
|
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
705
|
-
object !== source && baseFor(source,
|
|
690
|
+
object !== source && baseFor(source, function(srcValue, key) {
|
|
706
691
|
if (stack || (stack = new Stack), isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); else {
|
|
707
692
|
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
|
708
693
|
void 0 === newValue && (newValue = srcValue), assignMergeValue(object, key, newValue);
|
|
709
694
|
}
|
|
710
|
-
}
|
|
695
|
+
}, keysIn);
|
|
711
696
|
}
|
|
712
|
-
var mergeWith = createAssigner(
|
|
697
|
+
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
713
698
|
baseMerge(object, source, srcIndex, customizer);
|
|
714
|
-
})
|
|
715
|
-
|
|
699
|
+
});
|
|
700
|
+
function isEqual(value, other) {
|
|
701
|
+
return baseIsEqual(value, other);
|
|
702
|
+
}
|
|
703
|
+
var merge = createAssigner(function(object, source, srcIndex) {
|
|
716
704
|
baseMerge(object, source, srcIndex);
|
|
717
|
-
})
|
|
705
|
+
}), zhcnLocale = {
|
|
718
706
|
name: "zh-cn",
|
|
719
707
|
next: {
|
|
720
708
|
loading: "加载中...",
|
|
@@ -794,9 +782,18 @@
|
|
|
794
782
|
},
|
|
795
783
|
labelme: {
|
|
796
784
|
saveLabel: "保存",
|
|
785
|
+
confirmDeleteLabel: "确定要删除该标注吗?",
|
|
786
|
+
emptyLabelText: "暂无标签数据",
|
|
797
787
|
createPolygon: "创建多边形",
|
|
798
788
|
editPolygon: "编辑多边形",
|
|
799
|
-
deletePolyton: "删除多边形"
|
|
789
|
+
deletePolyton: "删除多边形",
|
|
790
|
+
createRectangle: "创建矩形",
|
|
791
|
+
createCircle: "创建圆形",
|
|
792
|
+
selectClasses: "选择标签",
|
|
793
|
+
emptyClassesText: "暂无标注",
|
|
794
|
+
deleteClasses: "删除标注",
|
|
795
|
+
labelGroupId: "分组ID",
|
|
796
|
+
labelDescription: "标注描述"
|
|
800
797
|
}
|
|
801
798
|
}
|
|
802
799
|
}, enLocale = {
|
|
@@ -879,9 +876,18 @@
|
|
|
879
876
|
},
|
|
880
877
|
labelme: {
|
|
881
878
|
saveLabel: "saving...",
|
|
879
|
+
confirmDeleteLabel: "Are you sure you want to delete this annotation?",
|
|
880
|
+
emptyLabelText: "No label data",
|
|
882
881
|
createPolygon: "create polygon",
|
|
883
882
|
editPolygon: "edit polygon",
|
|
884
|
-
|
|
883
|
+
deletePolygon: "delete polygon",
|
|
884
|
+
createRectangle: "create rectangle",
|
|
885
|
+
createCircle: "create circle",
|
|
886
|
+
selectClasses: "select classes",
|
|
887
|
+
emptyClassesText: "No label classes",
|
|
888
|
+
deleteClasses: "delete classes",
|
|
889
|
+
labelGroupId: "Group ID",
|
|
890
|
+
labelDescription: "label description"
|
|
885
891
|
}
|
|
886
892
|
}
|
|
887
893
|
}, zhtwLocale = {
|
|
@@ -955,15 +961,27 @@
|
|
|
955
961
|
},
|
|
956
962
|
labelimg: {
|
|
957
963
|
saveTxt: "保存中...",
|
|
958
|
-
emptyLabelText: "
|
|
959
|
-
confirmDeleteLabel: "
|
|
960
|
-
saveLabel: "
|
|
961
|
-
instructions: "
|
|
962
|
-
labelNoUpdate: "
|
|
963
|
-
zoomRestore: "
|
|
964
|
+
emptyLabelText: "暂暫無標註數據",
|
|
965
|
+
confirmDeleteLabel: "確定要刪除該標註嗎?",
|
|
966
|
+
saveLabel: "保存當前標註",
|
|
967
|
+
instructions: "使用說明",
|
|
968
|
+
labelNoUpdate: "暫無標籤數據更新",
|
|
969
|
+
zoomRestore: "還原"
|
|
964
970
|
},
|
|
965
971
|
labelme: {
|
|
966
|
-
saveLabel: "保存"
|
|
972
|
+
saveLabel: "保存",
|
|
973
|
+
confirmDeleteLabel: "確定要刪除該標註嗎?",
|
|
974
|
+
emptyLabelText: "暫無標註數據",
|
|
975
|
+
createPolygon: "創城多邊形",
|
|
976
|
+
editPolygon: "編輯多邊形",
|
|
977
|
+
deletePolygon: "刪除多邊形",
|
|
978
|
+
createRectangle: "創建矩形",
|
|
979
|
+
createCircle: "創建圓形",
|
|
980
|
+
selectClasses: "選擇標籤",
|
|
981
|
+
emptyClassesText: "咱無標註",
|
|
982
|
+
deleteClasses: "刪除標註",
|
|
983
|
+
labelGroupId: "分組ID",
|
|
984
|
+
labelDescription: "標註描述"
|
|
967
985
|
}
|
|
968
986
|
}
|
|
969
987
|
};
|
|
@@ -977,8 +995,8 @@
|
|
|
977
995
|
[zhtwLocale.name]: {
|
|
978
996
|
...zhtwLocale
|
|
979
997
|
}
|
|
980
|
-
}, translate = (path, option, locale) => get(locale, path, path)?.replace(/\{(\w+)\}/g, (
|
|
981
|
-
const lang = vue.computed((
|
|
998
|
+
}, translate = (path, option, locale) => get(locale, path, path)?.replace(/\{(\w+)\}/g, (_, key) => `${option?.[key] ?? `{${key}}`}`), buildTranslator = locale => (path, option) => translate(path, option, vue.unref(locale)), buildLocaleContext = locale => {
|
|
999
|
+
const lang = vue.computed(() => vue.unref(locale).name), localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang.value] || localeLang["zh-cn"];
|
|
982
1000
|
return localeRef.value.next = nextLang.next, {
|
|
983
1001
|
lang: lang,
|
|
984
1002
|
locale: localeRef,
|
|
@@ -986,12 +1004,12 @@
|
|
|
986
1004
|
};
|
|
987
1005
|
}, localeContextKey = elementPlus.localeContextKey, useLocale = localeOverrides => {
|
|
988
1006
|
const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
|
|
989
|
-
return buildLocaleContext(vue.computed((
|
|
1007
|
+
return buildLocaleContext(vue.computed(() => locale?.value || zhcnLocale));
|
|
990
1008
|
}, 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;
|
|
991
1009
|
function useChangeColor() {
|
|
992
1010
|
const rgbaToHex = rgba => {
|
|
993
|
-
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map(
|
|
994
|
-
return `#${[ r, g, b ].map(
|
|
1011
|
+
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map(value => parseFloat(value)), [r, g, b] = rgbaValues;
|
|
1012
|
+
return `#${[ r, g, b ].map(value => Math.round(value).toString(16).padStart(2, "0")).join("")}`.toUpperCase();
|
|
995
1013
|
};
|
|
996
1014
|
return {
|
|
997
1015
|
hexToRgb: str => {
|
|
@@ -1020,8 +1038,8 @@
|
|
|
1020
1038
|
},
|
|
1021
1039
|
rgbaToHex: rgbaToHex,
|
|
1022
1040
|
rgbaToHexAlpha: rgba => {
|
|
1023
|
-
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map(
|
|
1024
|
-
return `#${[ r, g, b ].map(
|
|
1041
|
+
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");
|
|
1042
|
+
return `#${[ r, g, b ].map(value => Math.round(value).toString(16).padStart(2, "0")).join("")}${alpha}`.toUpperCase();
|
|
1025
1043
|
},
|
|
1026
1044
|
getDarkColor: (color, level) => {
|
|
1027
1045
|
let _color = color;
|
|
@@ -1061,9 +1079,9 @@
|
|
|
1061
1079
|
}, detectVideoFrame = async (video, model, ctx, tf, classNames, classInput = [], detect_ctx, success) => {
|
|
1062
1080
|
const {videoWidth: videoWidth, videoHeight: videoHeight} = video;
|
|
1063
1081
|
if (!videoWidth || !videoHeight) return;
|
|
1064
|
-
let [modelWeight, modelHeight] = model.inputs[0].shape.slice(1, 3), input = tf.tidy((
|
|
1082
|
+
let [modelWeight, modelHeight] = model.inputs[0].shape.slice(1, 3), input = tf.tidy(() => tf.image.resizeBilinear(tf.browser.fromPixels(video), [ modelWeight, modelHeight ]).div(255).expandDims(0));
|
|
1065
1083
|
ctx.clearRect(0, 0, videoWidth, videoHeight), detect_ctx.clearRect(0, 0, videoWidth, videoHeight),
|
|
1066
|
-
await model.executeAsync(input).then(
|
|
1084
|
+
await model.executeAsync(input).then(async res => {
|
|
1067
1085
|
let [boxes, scores, classes, valid_detections] = res;
|
|
1068
1086
|
for (let i = 0; i < valid_detections.dataSync()[0]; ++i) {
|
|
1069
1087
|
let [x0, y0, x1, y1] = boxes.dataSync().slice(4 * i, 4 * (i + 1));
|
|
@@ -1081,7 +1099,7 @@
|
|
|
1081
1099
|
if (classInput?.length) for (let k = 0; k < classInput.length; k++) {
|
|
1082
1100
|
const item = classInput[k];
|
|
1083
1101
|
if (item.cls == cls && Number(score) > item.score) {
|
|
1084
|
-
const target = classNames.find(
|
|
1102
|
+
const target = classNames.find(o => o.value == cls);
|
|
1085
1103
|
if (target) {
|
|
1086
1104
|
const name = target.label;
|
|
1087
1105
|
drawOutcome(name, score, await drawVideoFrame(video, detect_ctx)), drawOutcome(name, score, ctx),
|
|
@@ -1089,14 +1107,14 @@
|
|
|
1089
1107
|
}
|
|
1090
1108
|
}
|
|
1091
1109
|
} else if (score > .5) {
|
|
1092
|
-
const target = classNames.find(
|
|
1110
|
+
const target = classNames.find(o => o.value == cls);
|
|
1093
1111
|
if (target) {
|
|
1094
1112
|
drawOutcome(target.label || "", score, ctx);
|
|
1095
1113
|
}
|
|
1096
1114
|
}
|
|
1097
1115
|
}
|
|
1098
1116
|
input.dispose(), tf.dispose(res);
|
|
1099
|
-
})
|
|
1117
|
+
});
|
|
1100
1118
|
}, drawVideoFrame = (videoElement, ctx) => {
|
|
1101
1119
|
const width = videoElement.videoWidth, height = videoElement.videoHeight, mediaRatio = width / height, canvasRatio = width / height, sw = width, sh = height;
|
|
1102
1120
|
let dx, dy, dw, dh;
|
|
@@ -1186,14 +1204,14 @@
|
|
|
1186
1204
|
}
|
|
1187
1205
|
},
|
|
1188
1206
|
setup(props, {slots: slots}) {
|
|
1189
|
-
const isTip = vue.ref(!1), setWidth = vue.computed((
|
|
1207
|
+
const isTip = vue.ref(!1), setWidth = vue.computed(() => {
|
|
1190
1208
|
const width = props.width;
|
|
1191
1209
|
let style = {
|
|
1192
1210
|
textAlign: props.textAlign
|
|
1193
1211
|
};
|
|
1194
1212
|
return width && ("string" == typeof width ? style.width = width : "number" == typeof width && (style.width = width + "px")),
|
|
1195
1213
|
style;
|
|
1196
|
-
})
|
|
1214
|
+
}), ellipsisRef = vue.ref(), onMouseenter = () => {
|
|
1197
1215
|
try {
|
|
1198
1216
|
const dom = ellipsisRef.value;
|
|
1199
1217
|
dom && dom.scrollWidth && dom.scrollWidth > dom.offsetWidth ? isTip.value = !0 : isTip.value = !1;
|
|
@@ -1349,6 +1367,19 @@
|
|
|
1349
1367
|
fill: "currentColor",
|
|
1350
1368
|
d: "m199.04 672.64 193.984 112 224-387.968-193.92-112-224 388.032zm-23.872 60.16 32.896 148.288 144.896-45.696zM455.04 229.248l193.92 112 56.704-98.112-193.984-112-56.64 98.112zM104.32 708.8l384-665.024 304.768 175.936L409.152 884.8h.064l-248.448 78.336zm384 254.272v-64h448v64h-448z"
|
|
1351
1369
|
}) ]))
|
|
1370
|
+
}), edit_default = vue.defineComponent({
|
|
1371
|
+
name: "Edit",
|
|
1372
|
+
__name: "edit",
|
|
1373
|
+
setup: __props => (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
|
|
1374
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1375
|
+
viewBox: "0 0 1024 1024"
|
|
1376
|
+
}, [ vue.createElementVNode("path", {
|
|
1377
|
+
fill: "currentColor",
|
|
1378
|
+
d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"
|
|
1379
|
+
}), vue.createElementVNode("path", {
|
|
1380
|
+
fill: "currentColor",
|
|
1381
|
+
d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
|
|
1382
|
+
}) ]))
|
|
1352
1383
|
}), full_screen_default = vue.defineComponent({
|
|
1353
1384
|
name: "FullScreen",
|
|
1354
1385
|
__name: "full-screen",
|
|
@@ -1693,14 +1724,14 @@
|
|
|
1693
1724
|
if (!element.contentDocument) {
|
|
1694
1725
|
var state = getState(element);
|
|
1695
1726
|
return state.checkForObjectDocumentTimeoutId && window.clearTimeout(state.checkForObjectDocumentTimeoutId),
|
|
1696
|
-
void (state.checkForObjectDocumentTimeoutId = setTimeout(
|
|
1727
|
+
void (state.checkForObjectDocumentTimeoutId = setTimeout(function() {
|
|
1697
1728
|
state.checkForObjectDocumentTimeoutId = 0, getDocument(element, callback);
|
|
1698
|
-
}
|
|
1729
|
+
}, 100));
|
|
1699
1730
|
}
|
|
1700
1731
|
callback(element.contentDocument);
|
|
1701
|
-
}(this,
|
|
1732
|
+
}(this, function(objectDocument) {
|
|
1702
1733
|
callback(element);
|
|
1703
|
-
})
|
|
1734
|
+
});
|
|
1704
1735
|
}, browserDetector$1.isIE() || (object.data = "about:blank"), getState(element) && (element.appendChild(object),
|
|
1705
1736
|
getState(element).object = object, browserDetector$1.isIE() && (object.data = "about:blank"));
|
|
1706
1737
|
}
|
|
@@ -1903,7 +1934,7 @@
|
|
|
1903
1934
|
function updateDetectorElements(done) {
|
|
1904
1935
|
var width = element.offsetWidth, height = element.offsetHeight, sizeChanged = width !== getState(element).lastWidth || height !== getState(element).lastHeight;
|
|
1905
1936
|
debug("Storing current size", width, height), storeCurrentSize(element, width, height),
|
|
1906
|
-
batchProcessor.add(0,
|
|
1937
|
+
batchProcessor.add(0, function() {
|
|
1907
1938
|
if (sizeChanged) if (getState(element)) if (areElementsInjected()) {
|
|
1908
1939
|
if (options.debug) {
|
|
1909
1940
|
var w = element.offsetWidth, h = element.offsetHeight;
|
|
@@ -1911,11 +1942,11 @@
|
|
|
1911
1942
|
}
|
|
1912
1943
|
updateChildSizes(element, width, height);
|
|
1913
1944
|
} else debug("Aborting because element container has not been initialized"); else debug("Aborting because element has been uninstalled");
|
|
1914
|
-
})
|
|
1945
|
+
}), batchProcessor.add(1, function() {
|
|
1915
1946
|
getState(element) ? areElementsInjected() ? positionScrollbars(element, width, height) : debug("Aborting because element container has not been initialized") : debug("Aborting because element has been uninstalled");
|
|
1916
|
-
})
|
|
1947
|
+
}), sizeChanged && done && batchProcessor.add(2, function() {
|
|
1917
1948
|
getState(element) ? areElementsInjected() ? done() : debug("Aborting because element container has not been initialized") : debug("Aborting because element has been uninstalled");
|
|
1918
|
-
})
|
|
1949
|
+
});
|
|
1919
1950
|
}
|
|
1920
1951
|
function areElementsInjected() {
|
|
1921
1952
|
return !!getState(element).container;
|
|
@@ -1925,9 +1956,9 @@
|
|
|
1925
1956
|
var state = getState(element);
|
|
1926
1957
|
return void 0 === getState(element).lastNotifiedWidth && state.lastWidth === state.startSize.width && state.lastHeight === state.startSize.height ? debug("Not notifying: Size is the same as the start size, and there has been no notification yet.") : state.lastWidth === state.lastNotifiedWidth && state.lastHeight === state.lastNotifiedHeight ? debug("Not notifying: Size already notified") : (debug("Current size not notified, notifying..."),
|
|
1927
1958
|
state.lastNotifiedWidth = state.lastWidth, state.lastNotifiedHeight = state.lastHeight,
|
|
1928
|
-
void forEach$1(getState(element).listeners,
|
|
1959
|
+
void forEach$1(getState(element).listeners, function(listener) {
|
|
1929
1960
|
listener(element);
|
|
1930
|
-
}))
|
|
1961
|
+
}));
|
|
1931
1962
|
}
|
|
1932
1963
|
function handleScroll() {
|
|
1933
1964
|
debug("Scroll detected."), isUnrendered(element) ? debug("Scroll event fired while unrendered. Ignoring...") : updateDetectorElements(notifyListenersIfNeeded);
|
|
@@ -1994,9 +2025,9 @@
|
|
|
1994
2025
|
function toArray(collection) {
|
|
1995
2026
|
if (Array.isArray(collection)) return collection;
|
|
1996
2027
|
var array = [];
|
|
1997
|
-
return forEach(collection,
|
|
2028
|
+
return forEach(collection, function(obj) {
|
|
1998
2029
|
array.push(obj);
|
|
1999
|
-
})
|
|
2030
|
+
}), array;
|
|
2000
2031
|
}
|
|
2001
2032
|
function isElement(obj) {
|
|
2002
2033
|
return obj && 1 === obj.nodeType;
|
|
@@ -2041,9 +2072,9 @@
|
|
|
2041
2072
|
listenTo: function(options, elements, listener) {
|
|
2042
2073
|
function onResizeCallback(element) {
|
|
2043
2074
|
var listeners = eventListenerHandler.get(element);
|
|
2044
|
-
forEach(listeners,
|
|
2075
|
+
forEach(listeners, function(listener) {
|
|
2045
2076
|
listener(element);
|
|
2046
|
-
})
|
|
2077
|
+
});
|
|
2047
2078
|
}
|
|
2048
2079
|
function addListener(callOnAdd, element, listener) {
|
|
2049
2080
|
eventListenerHandler.add(element, listener), callOnAdd && listener(element);
|
|
@@ -2054,20 +2085,20 @@
|
|
|
2054
2085
|
if (!isCollection(elements)) return reporter.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
|
|
2055
2086
|
elements = toArray(elements);
|
|
2056
2087
|
}
|
|
2057
|
-
var elementsReady = 0, callOnAdd = getOption(options, "callOnAdd", globalOptions.callOnAdd), onReadyCallback = getOption(options, "onReady",
|
|
2058
|
-
forEach(elements,
|
|
2088
|
+
var elementsReady = 0, callOnAdd = getOption(options, "callOnAdd", globalOptions.callOnAdd), onReadyCallback = getOption(options, "onReady", function() {}), debug = getOption(options, "debug", globalOptions.debug);
|
|
2089
|
+
forEach(elements, function(element) {
|
|
2059
2090
|
stateHandler.getState(element) || (stateHandler.initState(element), idHandler.set(element));
|
|
2060
2091
|
var id = idHandler.get(element);
|
|
2061
2092
|
if (debug && reporter.log("Attaching listener to element", id, element), !elementUtils.isDetectable(element)) return debug && reporter.log(id, "Not detectable."),
|
|
2062
2093
|
elementUtils.isBusy(element) ? (debug && reporter.log(id, "System busy making it detectable"),
|
|
2063
2094
|
addListener(callOnAdd, element, listener), onReadyCallbacks[id] = onReadyCallbacks[id] || [],
|
|
2064
|
-
void onReadyCallbacks[id].push(
|
|
2095
|
+
void onReadyCallbacks[id].push(function() {
|
|
2065
2096
|
++elementsReady === elements.length && onReadyCallback();
|
|
2066
|
-
}))
|
|
2097
|
+
})) : (debug && reporter.log(id, "Making detectable..."), elementUtils.markBusy(element, !0),
|
|
2067
2098
|
detectionStrategy.makeDetectable({
|
|
2068
2099
|
debug: debug,
|
|
2069
2100
|
important: importantCssRules
|
|
2070
|
-
}, element,
|
|
2101
|
+
}, element, function(element) {
|
|
2071
2102
|
if (debug && reporter.log(id, "onElementDetectable"), stateHandler.getState(element)) {
|
|
2072
2103
|
elementUtils.markAsDetectable(element), elementUtils.markBusy(element, !1), detectionStrategy.addListener(element, onResizeCallback),
|
|
2073
2104
|
addListener(callOnAdd, element, listener);
|
|
@@ -2076,15 +2107,15 @@
|
|
|
2076
2107
|
var width = element.offsetWidth, height = element.offsetHeight;
|
|
2077
2108
|
state.startSize.width === width && state.startSize.height === height || onResizeCallback(element);
|
|
2078
2109
|
}
|
|
2079
|
-
onReadyCallbacks[id] && forEach(onReadyCallbacks[id],
|
|
2110
|
+
onReadyCallbacks[id] && forEach(onReadyCallbacks[id], function(callback) {
|
|
2080
2111
|
callback();
|
|
2081
|
-
})
|
|
2112
|
+
});
|
|
2082
2113
|
} else debug && reporter.log(id, "Element uninstalled before being detectable.");
|
|
2083
2114
|
delete onReadyCallbacks[id], ++elementsReady === elements.length && onReadyCallback();
|
|
2084
|
-
}))
|
|
2115
|
+
}));
|
|
2085
2116
|
debug && reporter.log(id, "Already detecable, adding listener."), addListener(callOnAdd, element, listener),
|
|
2086
2117
|
elementsReady++;
|
|
2087
|
-
})
|
|
2118
|
+
}), elementsReady === elements.length && onReadyCallback();
|
|
2088
2119
|
},
|
|
2089
2120
|
removeListener: eventListenerHandler.removeListener,
|
|
2090
2121
|
removeAllListeners: eventListenerHandler.removeAllListeners,
|
|
@@ -2094,10 +2125,10 @@
|
|
|
2094
2125
|
if (!isCollection(elements)) return reporter.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
|
|
2095
2126
|
elements = toArray(elements);
|
|
2096
2127
|
}
|
|
2097
|
-
forEach(elements,
|
|
2128
|
+
forEach(elements, function(element) {
|
|
2098
2129
|
eventListenerHandler.removeAllListeners(element), detectionStrategy.uninstall(element),
|
|
2099
2130
|
stateHandler.cleanState(element);
|
|
2100
|
-
})
|
|
2131
|
+
});
|
|
2101
2132
|
},
|
|
2102
2133
|
initDocument: function(targetDocument) {
|
|
2103
2134
|
detectionStrategy.initDocument && detectionStrategy.initDocument(targetDocument);
|
|
@@ -2112,13 +2143,13 @@
|
|
|
2112
2143
|
const elementResize = (el, cb) => {
|
|
2113
2144
|
const erd = elementResizeDetectorMaker();
|
|
2114
2145
|
let timer = null;
|
|
2115
|
-
erd.listenTo(el, (
|
|
2116
|
-
null !== timer && clearTimeout(timer), timer = setTimeout((
|
|
2146
|
+
erd.listenTo(el, () => {
|
|
2147
|
+
null !== timer && clearTimeout(timer), timer = setTimeout(() => {
|
|
2117
2148
|
cb && cb(el), clearTimeout(timer);
|
|
2118
|
-
}
|
|
2119
|
-
})
|
|
2120
|
-
erd.removeListener(el, (
|
|
2121
|
-
})
|
|
2149
|
+
}, 200);
|
|
2150
|
+
}), vue.onUnmounted(() => {
|
|
2151
|
+
erd.removeListener(el, () => {});
|
|
2152
|
+
});
|
|
2122
2153
|
}, deepClone = source => {
|
|
2123
2154
|
if (null == source) return source;
|
|
2124
2155
|
let target;
|
|
@@ -2149,7 +2180,26 @@
|
|
|
2149
2180
|
}), {
|
|
2150
2181
|
target: target,
|
|
2151
2182
|
source: source
|
|
2152
|
-
})
|
|
2183
|
+
}), timeUniqueId = () => {
|
|
2184
|
+
const dateStr = ((date, format = "yyyy-MM-dd") => {
|
|
2185
|
+
if ("Invalid Date" != date) {
|
|
2186
|
+
const o = {
|
|
2187
|
+
"M+": date.getMonth() + 1,
|
|
2188
|
+
"d+": date.getDate(),
|
|
2189
|
+
"h+": date.getHours(),
|
|
2190
|
+
"m+": date.getMinutes(),
|
|
2191
|
+
"s+": date.getSeconds(),
|
|
2192
|
+
"q+": Math.floor((date.getMonth() + 3) / 3),
|
|
2193
|
+
S: date.getMilliseconds()
|
|
2194
|
+
};
|
|
2195
|
+
/(y+)/.test(format) && (format = format.replace(RegExp.$1, (date.getFullYear() + "").substring(4 - RegExp.$1.length)));
|
|
2196
|
+
for (const k in o) new RegExp("(" + k + ")").test(format) && (format = format.replace(RegExp.$1, 1 == RegExp.$1.length ? o[k] : ("00" + o[k]).substring(("" + o[k]).length)));
|
|
2197
|
+
return format;
|
|
2198
|
+
}
|
|
2199
|
+
return "";
|
|
2200
|
+
})(new Date, "yyyyMMddhhmmsss"), num = dateStr + Math.random().toString(10).substring(2, 8);
|
|
2201
|
+
return String(num);
|
|
2202
|
+
};
|
|
2153
2203
|
var LayoutSetting = vue.defineComponent({
|
|
2154
2204
|
setup() {
|
|
2155
2205
|
const config = vue.inject("options", {});
|
|
@@ -2283,7 +2333,7 @@
|
|
|
2283
2333
|
default: () => [ vue.createTextVNode("布局方式") ]
|
|
2284
2334
|
}), vue.createVNode("ul", {
|
|
2285
2335
|
class: _ns.b("config-bar-layout")
|
|
2286
|
-
}, [ layouts.map(
|
|
2336
|
+
}, [ layouts.map(item => vue.createVNode("li", {
|
|
2287
2337
|
class: [ _ns.be("config-bar-layout", item.type), _ns.is("active", settingConfig.layout === item.type) ],
|
|
2288
2338
|
onClick: event => ((event, layout) => {
|
|
2289
2339
|
event.stopPropagation(), settingConfig.layout = layout.type, _changeUpdateOptions();
|
|
@@ -2294,7 +2344,7 @@
|
|
|
2294
2344
|
class: "layout-box"
|
|
2295
2345
|
}, [ vue.createVNode("p", {
|
|
2296
2346
|
class: "layout-text"
|
|
2297
|
-
}, [ item.text ]) ]) ]), vue.createVNode("aside", null, null) ]))
|
|
2347
|
+
}, [ item.text ]) ]) ]), vue.createVNode("aside", null, null) ])) ]), vue.createVNode("div", {
|
|
2298
2348
|
class: _ns.b("config-bar-item"),
|
|
2299
2349
|
style: {
|
|
2300
2350
|
"margin-top": "20px"
|
|
@@ -2314,7 +2364,7 @@
|
|
|
2314
2364
|
});
|
|
2315
2365
|
var HeaderTools = vue.defineComponent({
|
|
2316
2366
|
setup() {
|
|
2317
|
-
const locale = vue.inject(localeContextKey, vue.ref()), config = vue.inject("options", {}), {t: t} = useLocale(), {toggle: toggle, isFullscreen: isFullscreen} = core.useFullscreen(), language = vue.ref(vue.computed((
|
|
2367
|
+
const locale = vue.inject(localeContextKey, vue.ref()), config = vue.inject("options", {}), {t: t} = useLocale(), {toggle: toggle, isFullscreen: isFullscreen} = core.useFullscreen(), language = vue.ref(vue.computed(() => config.language).value), settingDrawer = vue.ref(!1);
|
|
2318
2368
|
return {
|
|
2319
2369
|
locale: locale,
|
|
2320
2370
|
config: config,
|
|
@@ -2322,13 +2372,17 @@
|
|
|
2322
2372
|
toggle: toggle,
|
|
2323
2373
|
isFullscreen: isFullscreen,
|
|
2324
2374
|
language: language,
|
|
2325
|
-
settingDrawer: settingDrawer
|
|
2375
|
+
settingDrawer: settingDrawer,
|
|
2376
|
+
openSettingDrawer: () => {
|
|
2377
|
+
settingDrawer.value = !0;
|
|
2378
|
+
},
|
|
2379
|
+
closeSettingDrawer: () => {
|
|
2380
|
+
settingDrawer.value = !1;
|
|
2381
|
+
}
|
|
2326
2382
|
};
|
|
2327
2383
|
},
|
|
2328
2384
|
render() {
|
|
2329
|
-
const _ns = vue.inject("__ns__", {}), _config = this.config, _emit = vue.inject("__emit__", {}), slots = this.$slots, _t = this.t, isFullscreen = this.isFullscreen, profile_url = _config.profile, _userDropdown = _config.userDropdown, _languageDropdown = _config.languageDropdown
|
|
2330
|
-
this.settingDrawer = !1;
|
|
2331
|
-
};
|
|
2385
|
+
const _ns = vue.inject("__ns__", {}), _config = this.config, _emit = vue.inject("__emit__", {}), slots = this.$slots, _t = this.t, isFullscreen = this.isFullscreen, profile_url = _config.profile, _userDropdown = _config.userDropdown, _languageDropdown = _config.languageDropdown;
|
|
2332
2386
|
return vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", {
|
|
2333
2387
|
class: _ns.b("header-tools")
|
|
2334
2388
|
}, [ slots[slots_config_headerToolsPrefix]?.(), vue.createVNode("li", null, [ vue.createVNode(elementPlus.ElDropdown, {
|
|
@@ -2363,12 +2417,12 @@
|
|
|
2363
2417
|
}) ]),
|
|
2364
2418
|
dropdown: () => {
|
|
2365
2419
|
let _slot;
|
|
2366
|
-
return vue.createVNode(elementPlus.ElDropdownMenu, null, "function" == typeof (s = _slot = _languageDropdown.map(
|
|
2420
|
+
return vue.createVNode(elementPlus.ElDropdownMenu, null, "function" == typeof (s = _slot = _languageDropdown.map(item => vue.createVNode(elementPlus.ElDropdownItem, {
|
|
2367
2421
|
command: item.value,
|
|
2368
2422
|
disabled: this.language === item.value
|
|
2369
2423
|
}, {
|
|
2370
2424
|
default: () => [ item.label ]
|
|
2371
|
-
})))
|
|
2425
|
+
}))) || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? _slot : {
|
|
2372
2426
|
default: () => [ _slot ]
|
|
2373
2427
|
});
|
|
2374
2428
|
var s;
|
|
@@ -2424,7 +2478,7 @@
|
|
|
2424
2478
|
default: () => [ vue.createVNode(arrow_down_default, null, null) ]
|
|
2425
2479
|
}) ]),
|
|
2426
2480
|
dropdown: () => vue.createVNode(elementPlus.ElDropdownMenu, null, {
|
|
2427
|
-
default: () => [ _userDropdown?.map(
|
|
2481
|
+
default: () => [ _userDropdown?.map(item => vue.createVNode(elementPlus.ElDropdownItem, {
|
|
2428
2482
|
command: item.value,
|
|
2429
2483
|
divided: !!item.divided
|
|
2430
2484
|
}, {
|
|
@@ -2434,16 +2488,14 @@
|
|
|
2434
2488
|
}, null) : null, item.iconfont ? vue.createVNode("i", {
|
|
2435
2489
|
class: item.iconfont
|
|
2436
2490
|
}, null) : null, _t(item.label) ]
|
|
2437
|
-
}))
|
|
2491
|
+
})) ]
|
|
2438
2492
|
})
|
|
2439
2493
|
}) ]), vue.createVNode("li", null, [ vue.createVNode("span", {
|
|
2440
2494
|
style: {
|
|
2441
2495
|
display: "inline-block",
|
|
2442
2496
|
lineHeight: 1
|
|
2443
2497
|
},
|
|
2444
|
-
onClick:
|
|
2445
|
-
this.settingDrawer = !0;
|
|
2446
|
-
}
|
|
2498
|
+
onClick: this.openSettingDrawer
|
|
2447
2499
|
}, [ vue.createVNode(elementPlus.ElIcon, {
|
|
2448
2500
|
size: 16
|
|
2449
2501
|
}, {
|
|
@@ -2459,7 +2511,7 @@
|
|
|
2459
2511
|
size: "380px",
|
|
2460
2512
|
class: _ns.be("drawer", "setting"),
|
|
2461
2513
|
"destroy-on-close": !0,
|
|
2462
|
-
beforeClose:
|
|
2514
|
+
beforeClose: this.closeSettingDrawer
|
|
2463
2515
|
}, {
|
|
2464
2516
|
default: () => [ vue.createVNode(LayoutSetting, null, null) ]
|
|
2465
2517
|
}) ]
|
|
@@ -2472,12 +2524,12 @@
|
|
|
2472
2524
|
ns: vue.inject("ns", {})
|
|
2473
2525
|
}),
|
|
2474
2526
|
render() {
|
|
2475
|
-
const slots = this.$slots, _ns = this.ns, _config = vue.inject("options", {}), headerStyle = vue.computed((
|
|
2527
|
+
const slots = this.$slots, _ns = this.ns, _config = vue.inject("options", {}), headerStyle = vue.computed(() => {
|
|
2476
2528
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2477
2529
|
return isHeaderBarColorGradual ? {
|
|
2478
2530
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$4(color, .5)})`
|
|
2479
2531
|
} : "";
|
|
2480
|
-
})
|
|
2532
|
+
}), __slots_header_tools = {};
|
|
2481
2533
|
return slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2482
2534
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]()),
|
|
2483
2535
|
vue.createVNode("header", {
|
|
@@ -2531,8 +2583,8 @@
|
|
|
2531
2583
|
}
|
|
2532
2584
|
},
|
|
2533
2585
|
setup(props) {
|
|
2534
|
-
const _ns = vue.inject("ns", {}), menuTree = vue.computed((
|
|
2535
|
-
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ menuTree.map(
|
|
2586
|
+
const _ns = vue.inject("ns", {}), menuTree = vue.computed(() => props.menuData).value;
|
|
2587
|
+
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ menuTree.map(item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : vue.createVNode(elementPlus.ElSubMenu, {
|
|
2536
2588
|
"popper-class": _ns.b("popper"),
|
|
2537
2589
|
index: item.path || item.id,
|
|
2538
2590
|
teleported: !0
|
|
@@ -2549,7 +2601,7 @@
|
|
|
2549
2601
|
default: () => [ vue.createVNode(MenuItemTitle, {
|
|
2550
2602
|
meta: item.meta
|
|
2551
2603
|
}, null) ]
|
|
2552
|
-
}))
|
|
2604
|
+
})) ]) ]);
|
|
2553
2605
|
}
|
|
2554
2606
|
}), ns$n = useNamespace("menu");
|
|
2555
2607
|
const NextMenu = withInstall(vue.defineComponent({
|
|
@@ -2580,9 +2632,9 @@
|
|
|
2580
2632
|
setup(props) {
|
|
2581
2633
|
vue.provide("ns", ns$n);
|
|
2582
2634
|
const router = vue.getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, activePath = vue.ref(currentPath);
|
|
2583
|
-
vue.watch((
|
|
2635
|
+
vue.watch(() => router.currentRoute?.value, to => {
|
|
2584
2636
|
activePath.value = to.fullPath;
|
|
2585
|
-
})
|
|
2637
|
+
});
|
|
2586
2638
|
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(elementPlus.ElMenu, {
|
|
2587
2639
|
class: [ ns$n.b(), props.className ],
|
|
2588
2640
|
style: props.style,
|
|
@@ -2592,7 +2644,7 @@
|
|
|
2592
2644
|
mode: props.mode,
|
|
2593
2645
|
ellipsis: !0
|
|
2594
2646
|
}, {
|
|
2595
|
-
default: () => [ vue.createVNode(vue.Fragment, null, [ props.menuTree.map(
|
|
2647
|
+
default: () => [ vue.createVNode(vue.Fragment, null, [ props.menuTree.map(item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : vue.createVNode(elementPlus.ElSubMenu, {
|
|
2596
2648
|
"popper-class": ns$n.b("popper"),
|
|
2597
2649
|
index: item.path || item.id,
|
|
2598
2650
|
teleported: !0
|
|
@@ -2610,7 +2662,7 @@
|
|
|
2610
2662
|
default: () => [ vue.createVNode(MenuItemTitle, {
|
|
2611
2663
|
meta: item.meta
|
|
2612
2664
|
}, null) ]
|
|
2613
|
-
}))
|
|
2665
|
+
})) ]) ]
|
|
2614
2666
|
}) ]);
|
|
2615
2667
|
}
|
|
2616
2668
|
}));
|
|
@@ -2666,12 +2718,12 @@
|
|
|
2666
2718
|
const {getLightColor: getLightColor$3} = useChangeColor();
|
|
2667
2719
|
var Header$3 = vue.defineComponent({
|
|
2668
2720
|
setup(props, {slots: slots}) {
|
|
2669
|
-
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed((
|
|
2721
|
+
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed(() => {
|
|
2670
2722
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2671
2723
|
return isHeaderBarColorGradual ? {
|
|
2672
2724
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$3(color, .5)})`
|
|
2673
2725
|
} : "";
|
|
2674
|
-
})
|
|
2726
|
+
}), __slots_header_tools = {};
|
|
2675
2727
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2676
2728
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2677
2729
|
return () => {
|
|
@@ -2721,12 +2773,12 @@
|
|
|
2721
2773
|
const {getLightColor: getLightColor$2} = useChangeColor();
|
|
2722
2774
|
var Header$2 = vue.defineComponent({
|
|
2723
2775
|
setup(props, {slots: slots}) {
|
|
2724
|
-
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed((
|
|
2776
|
+
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed(() => {
|
|
2725
2777
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2726
2778
|
return isHeaderBarColorGradual ? {
|
|
2727
2779
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$2(color, .5)})`
|
|
2728
2780
|
} : "";
|
|
2729
|
-
})
|
|
2781
|
+
}), __slots_header_tools = {};
|
|
2730
2782
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2731
2783
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2732
2784
|
return () => {
|
|
@@ -2792,12 +2844,12 @@
|
|
|
2792
2844
|
const {getLightColor: getLightColor$1} = useChangeColor();
|
|
2793
2845
|
var Header$1 = vue.defineComponent({
|
|
2794
2846
|
setup(props, {slots: slots}) {
|
|
2795
|
-
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed((
|
|
2847
|
+
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed(() => {
|
|
2796
2848
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2797
2849
|
return isHeaderBarColorGradual ? {
|
|
2798
2850
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$1(color, .5)})`
|
|
2799
2851
|
} : "";
|
|
2800
|
-
})
|
|
2852
|
+
}), __slots_header_tools = {};
|
|
2801
2853
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2802
2854
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2803
2855
|
return () => {
|
|
@@ -2892,11 +2944,11 @@
|
|
|
2892
2944
|
vue.provide("ns", ns$i);
|
|
2893
2945
|
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);
|
|
2894
2946
|
parentNode?.id && 1 === parentNode.meta?.level && updateSubmentTree(parentNode.children),
|
|
2895
|
-
vue.watch((
|
|
2947
|
+
vue.watch(() => router.currentRoute?.value, to => {
|
|
2896
2948
|
const parentNode = findGrandfatherNode(to.fullPath, props.menuTree);
|
|
2897
2949
|
if (activeMenuId.value = parentNode?.id, !parentNode) return updateSubmentTree([]);
|
|
2898
2950
|
parentNode?.id && 1 === parentNode.meta?.level && updateSubmentTree(parentNode.children);
|
|
2899
|
-
})
|
|
2951
|
+
});
|
|
2900
2952
|
const findTreeFirst = tree => {
|
|
2901
2953
|
let result = tree[0];
|
|
2902
2954
|
for (let i = 0; i < tree.length; i++) {
|
|
@@ -2912,19 +2964,20 @@
|
|
|
2912
2964
|
mode: "horizontal",
|
|
2913
2965
|
ellipsis: !0
|
|
2914
2966
|
}, {
|
|
2915
|
-
default: () => [ vue.createVNode(vue.Fragment, null, [ props.menuTree.map(
|
|
2967
|
+
default: () => [ vue.createVNode(vue.Fragment, null, [ props.menuTree.map(item => valueExist(item.meta?.isHide, !1) ? null : vue.createVNode(elementPlus.ElMenuItem, {
|
|
2916
2968
|
index: item.id,
|
|
2917
2969
|
onClick: val => ((val, item) => {
|
|
2918
2970
|
if (updateSubmentTree(item.children), item.children?.length) {
|
|
2919
2971
|
const firstNode = findTreeFirst(item.children);
|
|
2920
|
-
router.push(firstNode.path);
|
|
2921
|
-
}
|
|
2972
|
+
return void router.push(firstNode.path);
|
|
2973
|
+
}
|
|
2974
|
+
router.push(item.path);
|
|
2922
2975
|
})(0, item)
|
|
2923
2976
|
}, {
|
|
2924
2977
|
default: () => [ vue.createVNode(MenuItemTitle, {
|
|
2925
2978
|
meta: item.meta
|
|
2926
2979
|
}, null) ]
|
|
2927
|
-
}))
|
|
2980
|
+
})) ]) ]
|
|
2928
2981
|
});
|
|
2929
2982
|
return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
|
|
2930
2983
|
}
|
|
@@ -2932,12 +2985,12 @@
|
|
|
2932
2985
|
const {getLightColor: getLightColor} = useChangeColor();
|
|
2933
2986
|
var Header = vue.defineComponent({
|
|
2934
2987
|
setup(props, {slots: slots}) {
|
|
2935
|
-
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed((
|
|
2988
|
+
const _ns = vue.inject("ns", {}), _config = vue.inject("options", {}), headerStyle = vue.computed(() => {
|
|
2936
2989
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2937
2990
|
return isHeaderBarColorGradual ? {
|
|
2938
2991
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor(color, .5)})`
|
|
2939
2992
|
} : "";
|
|
2940
|
-
})
|
|
2993
|
+
}), __slots_header_tools = {};
|
|
2941
2994
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2942
2995
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2943
2996
|
return () => {
|
|
@@ -2973,11 +3026,11 @@
|
|
|
2973
3026
|
setup() {
|
|
2974
3027
|
vue.provide("ns", ns$h);
|
|
2975
3028
|
const submenuTree = vue.ref([]);
|
|
2976
|
-
return vue.provide("submenuTree", submenuTree), vue.provide("updateSubmentTree",
|
|
2977
|
-
submenuTree.value = [], vue.nextTick((
|
|
3029
|
+
return vue.provide("submenuTree", submenuTree), vue.provide("updateSubmentTree", val => {
|
|
3030
|
+
submenuTree.value = [], vue.nextTick(() => {
|
|
2978
3031
|
submenuTree.value = val;
|
|
2979
|
-
})
|
|
2980
|
-
})
|
|
3032
|
+
});
|
|
3033
|
+
}), {
|
|
2981
3034
|
ns: ns$h,
|
|
2982
3035
|
submenuTree: submenuTree
|
|
2983
3036
|
};
|
|
@@ -3042,9 +3095,9 @@
|
|
|
3042
3095
|
_config.value = mergeWith(_config.value, cfg, customizerCoverArray), updateThemeColorCssVar(_config.value?.setting),
|
|
3043
3096
|
emit("changeOptions", _config.value);
|
|
3044
3097
|
};
|
|
3045
|
-
return vue.provide("updateOptions", updateOptions), vue.watch((
|
|
3098
|
+
return vue.provide("updateOptions", updateOptions), vue.watch(() => props.options, cfg => {
|
|
3046
3099
|
updateOptions(cfg);
|
|
3047
|
-
}
|
|
3100
|
+
}, {
|
|
3048
3101
|
deep: !0,
|
|
3049
3102
|
immediate: !0
|
|
3050
3103
|
}), {
|
|
@@ -3054,9 +3107,9 @@
|
|
|
3054
3107
|
},
|
|
3055
3108
|
render() {
|
|
3056
3109
|
const props = this.$props, slots = this.$slots, layout = this.options.setting?.layout || "transverse", activeLayout = vue.ref(layouts[layout]);
|
|
3057
|
-
vue.watchEffect((
|
|
3110
|
+
vue.watchEffect(() => {
|
|
3058
3111
|
activeLayout.value = layouts[layout], activeLayout.value || (activeLayout.value = layouts.transverse);
|
|
3059
|
-
})
|
|
3112
|
+
});
|
|
3060
3113
|
const _activeSlots = {};
|
|
3061
3114
|
for (const key in slots) Object.prototype.hasOwnProperty.call(slots, key) && (_activeSlots[key] = () => slots[key]?.());
|
|
3062
3115
|
return vue.createVNode("div", {
|
|
@@ -3081,7 +3134,7 @@
|
|
|
3081
3134
|
},
|
|
3082
3135
|
emits: [ "change", "select", "close" ],
|
|
3083
3136
|
setup(props, {emit: emit}) {
|
|
3084
|
-
const {t: t} = useLocale(), router = vue.getCurrentInstance().appContext.config.globalProperties.$router, _activeTab = vue.computed((
|
|
3137
|
+
const {t: t} = useLocale(), router = vue.getCurrentInstance().appContext.config.globalProperties.$router, _activeTab = vue.computed(() => router.currentRoute.value.path), _tabs = vue.computed(() => props.tabs), defaultIndex = _tabs.value?.findIndex(v => v.path === _activeTab.value);
|
|
3085
3138
|
if (defaultIndex < 0) {
|
|
3086
3139
|
const tab = _tabs.value[0];
|
|
3087
3140
|
tab && tab.path && router.replace({
|
|
@@ -3089,7 +3142,7 @@
|
|
|
3089
3142
|
});
|
|
3090
3143
|
}
|
|
3091
3144
|
const activeIndex = vue.ref(defaultIndex), tabsView = vue.ref(_tabs.value), onChange = command => {
|
|
3092
|
-
const active = _activeTab.value, len = tabsView.value.length, i = tabsView.value.findIndex(
|
|
3145
|
+
const active = _activeTab.value, len = tabsView.value.length, i = tabsView.value.findIndex(v => v.path === active);
|
|
3093
3146
|
switch (command) {
|
|
3094
3147
|
case "other":
|
|
3095
3148
|
i > -1 && (activeIndex.value = 1, tabsView.value = [ tabsView.value[0], tabsView.value[i] ]);
|
|
@@ -3125,7 +3178,7 @@
|
|
|
3125
3178
|
params: tab.params || {}
|
|
3126
3179
|
}), router.push(to), emit("select", tab, index);
|
|
3127
3180
|
};
|
|
3128
|
-
vue.watch((
|
|
3181
|
+
vue.watch(() => router.currentRoute?.value, to => {
|
|
3129
3182
|
const {tagTitle: tagTitle} = to.query, activeRoute = {
|
|
3130
3183
|
name: to.name,
|
|
3131
3184
|
title: tagTitle || to.meta?.title,
|
|
@@ -3133,16 +3186,16 @@
|
|
|
3133
3186
|
meta: to.meta,
|
|
3134
3187
|
params: to.params,
|
|
3135
3188
|
query: to.query
|
|
3136
|
-
}, i = tabsView.value.findIndex(
|
|
3189
|
+
}, i = tabsView.value.findIndex(v => v.path === to.path);
|
|
3137
3190
|
i > -1 ? (activeIndex.value = i, tabsView.value[i] = activeRoute) : (activeIndex.value = tabsView.value.length,
|
|
3138
3191
|
tabsView.value.push(activeRoute)), emit("change", activeIndex.value, tabsView.value, "add");
|
|
3139
|
-
})
|
|
3192
|
+
});
|
|
3140
3193
|
const renderContent = () => vue.createVNode("nav", {
|
|
3141
3194
|
class: ns$f.b()
|
|
3142
3195
|
}, [ vue.createVNode(elementPlus.ElScrollbar, null, {
|
|
3143
3196
|
default: () => [ vue.createVNode("ul", {
|
|
3144
3197
|
class: ns$f.b("list")
|
|
3145
|
-
}, [ tabsView.value.map((
|
|
3198
|
+
}, [ tabsView.value.map((tab, index) => tab ? vue.createVNode("li", {
|
|
3146
3199
|
class: [ "tab-item", ns$f.is("active", activeIndex.value === index) ],
|
|
3147
3200
|
onClick: event => onClickTabItem(event, tab, index)
|
|
3148
3201
|
}, [ vue.createVNode("i", {
|
|
@@ -3163,14 +3216,14 @@
|
|
|
3163
3216
|
}), router.push(to), emit("close", prevTag, tabsView.value);
|
|
3164
3217
|
}
|
|
3165
3218
|
tabsView.value.splice(index, 1);
|
|
3166
|
-
const i = tabsView.value.findIndex(
|
|
3219
|
+
const i = tabsView.value.findIndex(v => v.path === active) || 0;
|
|
3167
3220
|
activeIndex.value = i > -1 ? i : 0, emit("change", activeIndex.value, tabsView.value, "close");
|
|
3168
3221
|
})(event, tab, index)
|
|
3169
3222
|
}, [ vue.createVNode(elementPlus.ElIcon, {
|
|
3170
3223
|
class: "tab-close"
|
|
3171
3224
|
}, {
|
|
3172
3225
|
default: () => [ vue.createVNode(close_default, null, null) ]
|
|
3173
|
-
}) ]) ]) : null)
|
|
3226
|
+
}) ]) ]) : null) ]) ]
|
|
3174
3227
|
}), vue.createVNode(elementPlus.ElDropdown, {
|
|
3175
3228
|
"show-timeout": 80,
|
|
3176
3229
|
"hide-timeout": 80,
|
|
@@ -3240,7 +3293,7 @@
|
|
|
3240
3293
|
}
|
|
3241
3294
|
},
|
|
3242
3295
|
setup(props, {slots: slots}) {
|
|
3243
|
-
const styles = vue.computed((
|
|
3296
|
+
const styles = vue.computed(() => {
|
|
3244
3297
|
let style = {};
|
|
3245
3298
|
const padding = props.padding;
|
|
3246
3299
|
return "boolean" == typeof padding ? style = padding ? {
|
|
@@ -3250,7 +3303,7 @@
|
|
|
3250
3303
|
} : "number" == typeof padding && (style = {
|
|
3251
3304
|
padding: padding + "px"
|
|
3252
3305
|
}), style;
|
|
3253
|
-
})
|
|
3306
|
+
});
|
|
3254
3307
|
return () => (() => {
|
|
3255
3308
|
if (props.scrollbar) {
|
|
3256
3309
|
const scrollStyle = {
|
|
@@ -3278,9 +3331,6 @@
|
|
|
3278
3331
|
})();
|
|
3279
3332
|
}
|
|
3280
3333
|
}));
|
|
3281
|
-
function isEqual(value, other) {
|
|
3282
|
-
return baseIsEqual(value, other);
|
|
3283
|
-
}
|
|
3284
3334
|
var defaultPropsConfig = {
|
|
3285
3335
|
className: {
|
|
3286
3336
|
type: String,
|
|
@@ -3466,9 +3516,9 @@
|
|
|
3466
3516
|
},
|
|
3467
3517
|
setup(props, {slots: slots}) {
|
|
3468
3518
|
const _options = vue.inject("options", {}), options = vue.isRef(_options) ? vue.unref(_options) : _options, {t: t} = useLocale(), ns = vue.inject("ns", {}), columns = vue.ref(props.columns);
|
|
3469
|
-
vue.watch((
|
|
3519
|
+
vue.watch(() => props.columns, () => {
|
|
3470
3520
|
columns.value = props.columns;
|
|
3471
|
-
}
|
|
3521
|
+
}, {
|
|
3472
3522
|
deep: !0
|
|
3473
3523
|
});
|
|
3474
3524
|
const formParams = vue.reactive(props.formParams), _defaultDisabledDate = time => time.getTime() > Date.now(), _defaultShortcuts = [ {
|
|
@@ -3575,10 +3625,10 @@
|
|
|
3575
3625
|
"collapse-tags": !0,
|
|
3576
3626
|
"collapse-tags-tooltip": !0
|
|
3577
3627
|
}, {
|
|
3578
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
3628
|
+
default: () => [ col.dicData && col.dicData.map(item => vue.createVNode(elementPlus.ElOption, {
|
|
3579
3629
|
value: item.value,
|
|
3580
3630
|
label: item.label
|
|
3581
|
-
}, null))
|
|
3631
|
+
}, null)) ]
|
|
3582
3632
|
});
|
|
3583
3633
|
}
|
|
3584
3634
|
if ("date" === col.type) {
|
|
@@ -3668,7 +3718,7 @@
|
|
|
3668
3718
|
onChange: (...arg) => col.onChange?.(...arg, col, formParams)
|
|
3669
3719
|
}, null) : void 0;
|
|
3670
3720
|
};
|
|
3671
|
-
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ columns.value.map(
|
|
3721
|
+
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ columns.value.map(col => !col.hide && vue.createVNode(elementPlus.ElCol, {
|
|
3672
3722
|
span: props.searchSpan,
|
|
3673
3723
|
class: ns.b("header-search-item")
|
|
3674
3724
|
}, {
|
|
@@ -3680,10 +3730,10 @@
|
|
|
3680
3730
|
}, null) : null,
|
|
3681
3731
|
default: () => renderColItemContent(col)
|
|
3682
3732
|
}) ]
|
|
3683
|
-
}))
|
|
3733
|
+
})) ]) ]);
|
|
3684
3734
|
}
|
|
3685
3735
|
});
|
|
3686
|
-
function _isSlot$
|
|
3736
|
+
function _isSlot$6(s) {
|
|
3687
3737
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
|
|
3688
3738
|
}
|
|
3689
3739
|
var HeaderSearch = vue.defineComponent({
|
|
@@ -3697,13 +3747,13 @@
|
|
|
3697
3747
|
emits: [ "confirmSearch", "clearSearch", "zoomResize" ],
|
|
3698
3748
|
setup(props, {emit: emit, slots: slots}) {
|
|
3699
3749
|
const _options = vue.inject("options", {}), options = vue.isRef(_options) ? vue.unref(_options) : _options, ns = vue.inject("ns", {}), {t: t} = useLocale(), searchFormSlots = vue.inject("searchFormSlots"), searchFrom_slots = {};
|
|
3700
|
-
searchFormSlots.value.forEach(
|
|
3750
|
+
searchFormSlots.value.forEach(slotName => {
|
|
3701
3751
|
searchFrom_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
3702
|
-
})
|
|
3752
|
+
});
|
|
3703
3753
|
const searchParams = vue.reactive({}), columns = vue.ref(props.columns), _initSearchFormParams = () => {
|
|
3704
|
-
columns.value.forEach(
|
|
3754
|
+
columns.value.forEach(col => {
|
|
3705
3755
|
searchParams[col.prop] = "", isValueExist(col.defaultValue) && (searchParams[col.prop] = col.defaultValue);
|
|
3706
|
-
})
|
|
3756
|
+
});
|
|
3707
3757
|
};
|
|
3708
3758
|
_initSearchFormParams();
|
|
3709
3759
|
const onConfirmSearch = () => {
|
|
@@ -3711,9 +3761,9 @@
|
|
|
3711
3761
|
}, onClearSearch = () => {
|
|
3712
3762
|
_initSearchFormParams(), onConfirmSearch(), emit("clearSearch");
|
|
3713
3763
|
}, searchSpan = vue.ref(options.searchSpan), columnsLength = columns.value.length, sliceIndex = vue.ref(columnsLength), showColumns = vue.ref(columns.value), moreColumns = vue.ref([]), isColumnMinWidth = vue.ref(!1), {proxy: proxy} = vue.getCurrentInstance();
|
|
3714
|
-
vue.onMounted((
|
|
3764
|
+
vue.onMounted(() => {
|
|
3715
3765
|
const tableSearchFormEl = proxy.$refs.tableSearchForm?.$el;
|
|
3716
|
-
tableSearchFormEl && elementResize(tableSearchFormEl,
|
|
3766
|
+
tableSearchFormEl && elementResize(tableSearchFormEl, el => {
|
|
3717
3767
|
(el => {
|
|
3718
3768
|
const formWidth = el.clientWidth, minWidth = options.searchColumnMinWidth;
|
|
3719
3769
|
let span = Math.floor(formWidth / minWidth);
|
|
@@ -3727,8 +3777,8 @@
|
|
|
3727
3777
|
const columnWidth = Math.floor(formWidth / span);
|
|
3728
3778
|
isColumnMinWidth.value = columnWidth < minWidth;
|
|
3729
3779
|
})(el), emit("zoomResize");
|
|
3730
|
-
})
|
|
3731
|
-
})
|
|
3780
|
+
});
|
|
3781
|
+
});
|
|
3732
3782
|
const isExpand = vue.ref(!1), onSwitchExpand = () => {
|
|
3733
3783
|
isExpand.value = !isExpand.value;
|
|
3734
3784
|
};
|
|
@@ -3747,13 +3797,13 @@
|
|
|
3747
3797
|
searchSpan: searchSpan.value,
|
|
3748
3798
|
columns: showColumns.value,
|
|
3749
3799
|
formParams: searchParams
|
|
3750
|
-
}, _isSlot$
|
|
3800
|
+
}, _isSlot$6(searchFrom_slots) ? searchFrom_slots : {
|
|
3751
3801
|
default: () => [ searchFrom_slots ]
|
|
3752
3802
|
}), isExpand.value ? vue.createVNode(SearchColumn, {
|
|
3753
3803
|
searchSpan: searchSpan.value,
|
|
3754
3804
|
columns: moreColumns.value,
|
|
3755
3805
|
formParams: searchParams
|
|
3756
|
-
}, _isSlot$
|
|
3806
|
+
}, _isSlot$6(searchFrom_slots) ? searchFrom_slots : {
|
|
3757
3807
|
default: () => [ searchFrom_slots ]
|
|
3758
3808
|
}) : null, vue.createVNode(elementPlus.ElCol, {
|
|
3759
3809
|
span: searchSpan.value,
|
|
@@ -3876,14 +3926,17 @@
|
|
|
3876
3926
|
setup: () => ({}),
|
|
3877
3927
|
emits: [ "clickAdd", "clickRefresh", "deleteRows" ],
|
|
3878
3928
|
render() {
|
|
3879
|
-
const _options = vue.inject("options", {}), options = vue.isRef(_options) ? vue.unref(_options) : _options, {t: t} = useLocale(), ns = vue.inject("ns", {}), multipleSelection = vue.inject("multipleSelection"), multipleSelectionLength = vue.computed((
|
|
3929
|
+
const _options = vue.inject("options", {}), options = vue.isRef(_options) ? vue.unref(_options) : _options, {t: t} = useLocale(), ns = vue.inject("ns", {}), multipleSelection = vue.inject("multipleSelection"), multipleSelectionLength = vue.computed(() => multipleSelection.value.length), onClickRefresh = () => {
|
|
3930
|
+
this.$emit("clickRefresh");
|
|
3931
|
+
}, drawerSettingRef = vue.ref(), slotProps = {
|
|
3932
|
+
size: options.size,
|
|
3933
|
+
refresh: onClickRefresh
|
|
3934
|
+
};
|
|
3880
3935
|
return vue.createVNode("div", {
|
|
3881
3936
|
class: ns.b("header-menu")
|
|
3882
3937
|
}, [ vue.createVNode("div", {
|
|
3883
3938
|
class: ns.b("header-menu-left")
|
|
3884
|
-
}, [ this.$slots["menu-left-prefix"]?.({
|
|
3885
|
-
size: options.size
|
|
3886
|
-
}), options.addBtn && vue.createVNode(elementPlus.ElButton, {
|
|
3939
|
+
}, [ this.$slots["menu-left-prefix"]?.(slotProps), options.addBtn && vue.createVNode(elementPlus.ElButton, {
|
|
3887
3940
|
type: "primary",
|
|
3888
3941
|
size: options.size,
|
|
3889
3942
|
onClick: () => {
|
|
@@ -3899,39 +3952,33 @@
|
|
|
3899
3952
|
size: options.size,
|
|
3900
3953
|
disabled: !multipleSelectionLength.value,
|
|
3901
3954
|
onClick: () => {
|
|
3902
|
-
const selection = vue.unref(vue.toRaw(multipleSelection.value.map(
|
|
3955
|
+
const selection = vue.unref(vue.toRaw(multipleSelection.value.map(row => vue.toRaw(row))));
|
|
3903
3956
|
elementPlus.ElMessageBox.confirm(t("next.table.message.batchDeleteTip"), t("next.table.message.tip"), {
|
|
3904
3957
|
type: "warning",
|
|
3905
3958
|
showClose: !1,
|
|
3906
3959
|
center: !1,
|
|
3907
3960
|
confirmButtonText: t("next.table.message.confirmButtonText"),
|
|
3908
3961
|
cancelButtonText: t("next.table.message.cancelButtonText")
|
|
3909
|
-
}).then((
|
|
3962
|
+
}).then(() => {
|
|
3910
3963
|
this.$emit("deleteRows", selection);
|
|
3911
|
-
})
|
|
3964
|
+
}).catch(() => {
|
|
3912
3965
|
elementPlus.ElMessage({
|
|
3913
3966
|
type: "info",
|
|
3914
3967
|
message: t("next.table.message.cancelBatchDelete")
|
|
3915
3968
|
});
|
|
3916
|
-
})
|
|
3969
|
+
});
|
|
3917
3970
|
}
|
|
3918
3971
|
}, {
|
|
3919
3972
|
icon: () => vue.createVNode(elementPlus.ElIcon, null, {
|
|
3920
3973
|
default: () => [ vue.createVNode(delete_default, null, null) ]
|
|
3921
3974
|
}),
|
|
3922
3975
|
default: () => t("next.table.batchDelete")
|
|
3923
|
-
}), this.$slots["menu-left-suffix"]?.({
|
|
3924
|
-
size: options.size
|
|
3925
|
-
}) ]), vue.createVNode("div", {
|
|
3976
|
+
}), this.$slots["menu-left-suffix"]?.(slotProps) ]), vue.createVNode("div", {
|
|
3926
3977
|
class: ns.b("header-menu-right")
|
|
3927
|
-
}, [ this.$slots["menu-right-prefix"]?.({
|
|
3928
|
-
size: options.size
|
|
3929
|
-
}), options.refreshBtn && vue.createVNode(elementPlus.ElButton, {
|
|
3978
|
+
}, [ this.$slots["menu-right-prefix"]?.(slotProps), options.refreshBtn && vue.createVNode(elementPlus.ElButton, {
|
|
3930
3979
|
circle: !0,
|
|
3931
3980
|
size: options.size,
|
|
3932
|
-
onClick:
|
|
3933
|
-
this.$emit("clickRefresh");
|
|
3934
|
-
}
|
|
3981
|
+
onClick: onClickRefresh
|
|
3935
3982
|
}, {
|
|
3936
3983
|
icon: () => vue.createVNode(elementPlus.ElIcon, null, {
|
|
3937
3984
|
default: () => [ vue.createVNode(refresh_default, null, null) ]
|
|
@@ -3946,9 +3993,7 @@
|
|
|
3946
3993
|
icon: () => vue.createVNode(elementPlus.ElIcon, null, {
|
|
3947
3994
|
default: () => [ vue.createVNode(tools_default, null, null) ]
|
|
3948
3995
|
})
|
|
3949
|
-
}), this.$slots["menu-right-suffix"]?.({
|
|
3950
|
-
size: options.size
|
|
3951
|
-
}) ]), vue.createVNode(DrawerSetting, {
|
|
3996
|
+
}), this.$slots["menu-right-suffix"]?.(slotProps) ]), vue.createVNode(DrawerSetting, {
|
|
3952
3997
|
ref: drawerSettingRef
|
|
3953
3998
|
}, null) ]);
|
|
3954
3999
|
}
|
|
@@ -3963,28 +4008,28 @@
|
|
|
3963
4008
|
},
|
|
3964
4009
|
setup(props, {slots: slots}) {
|
|
3965
4010
|
const columnSlots = vue.inject("columnSlots"), column_slots = {};
|
|
3966
|
-
columnSlots.value.forEach(
|
|
4011
|
+
columnSlots.value.forEach(slotName => {
|
|
3967
4012
|
column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
3968
|
-
})
|
|
4013
|
+
});
|
|
3969
4014
|
const _options = vue.inject("options", {}), options = vue.isRef(_options) ? vue.unref(_options) : _options, columnOption = props.columnOption, _dicKey = valueExist(columnOption.dicKey, "value"), _dicLabel = valueExist(columnOption.dicLabel, columnOption.treeSelectProps?.label, "label"), _separator = valueExist(columnOption.treeSelectProps?.separator, ","), _formatterColumnValue = (value, dicData) => {
|
|
3970
4015
|
if (Array.isArray(value)) {
|
|
3971
4016
|
const temp = [];
|
|
3972
|
-
return value.forEach(
|
|
4017
|
+
return value.forEach(val => {
|
|
3973
4018
|
temp.push(_formatterColumnValue(val, dicData));
|
|
3974
|
-
})
|
|
4019
|
+
}), temp.join(_separator);
|
|
3975
4020
|
}
|
|
3976
|
-
const item = dicData.find(
|
|
4021
|
+
const item = dicData.find(o => o[_dicKey] == value);
|
|
3977
4022
|
return item ? item[_dicLabel] : value;
|
|
3978
4023
|
}, renderCustomItem = (row, $index) => {
|
|
3979
4024
|
const prop = columnOption.prop, _prop = prop?.replace(/\./g, "-");
|
|
3980
|
-
if (columnOption.children?.length > 0) return vue.createVNode(vue.Fragment, null, [ columnOption.children.map(
|
|
4025
|
+
if (columnOption.children?.length > 0) return vue.createVNode(vue.Fragment, null, [ columnOption.children.map(column => {
|
|
3981
4026
|
return vue.createVNode(TableColumnDynamic, {
|
|
3982
4027
|
columnOption: column
|
|
3983
4028
|
}, "function" == typeof (s = column_slots) || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? column_slots : {
|
|
3984
4029
|
default: () => [ column_slots ]
|
|
3985
4030
|
});
|
|
3986
4031
|
var s;
|
|
3987
|
-
})
|
|
4032
|
+
}) ]);
|
|
3988
4033
|
if (slots[columnSlotName(_prop)]) {
|
|
3989
4034
|
const btnCfg = {
|
|
3990
4035
|
text: options.operationsBtnText,
|
|
@@ -4001,7 +4046,7 @@
|
|
|
4001
4046
|
if (columnOption.dicData?.length > 0) {
|
|
4002
4047
|
const loopDicData = list => {
|
|
4003
4048
|
const temp = [];
|
|
4004
|
-
return list.forEach(
|
|
4049
|
+
return list.forEach(node => {
|
|
4005
4050
|
const item = {
|
|
4006
4051
|
...node
|
|
4007
4052
|
};
|
|
@@ -4010,7 +4055,7 @@
|
|
|
4010
4055
|
temp.push(...child), delete item.children;
|
|
4011
4056
|
}
|
|
4012
4057
|
temp.push(item);
|
|
4013
|
-
})
|
|
4058
|
+
}), temp;
|
|
4014
4059
|
}, mergeDicData = loopDicData(columnOption.dicData);
|
|
4015
4060
|
return vue.createVNode("span", null, [ _formatterColumnValue(row[prop], mergeDicData) ]);
|
|
4016
4061
|
}
|
|
@@ -4042,10 +4087,10 @@
|
|
|
4042
4087
|
name: "TableColumnOperations",
|
|
4043
4088
|
emits: [ "editRow", "viewRow", "deleteRow" ],
|
|
4044
4089
|
setup(props, {emit: emit, slots: slots}) {
|
|
4045
|
-
const _options = vue.inject("options"), options = vue.isRef(_options) ? vue.unref(_options) : _options, {t: t} = useLocale(), operationsShowText = vue.computed((
|
|
4090
|
+
const _options = vue.inject("options"), options = vue.isRef(_options) ? vue.unref(_options) : _options, {t: t} = useLocale(), operationsShowText = vue.computed(() => {
|
|
4046
4091
|
const {operationsBtnPlain: operationsBtnPlain, operationsBtnText: operationsBtnText} = options;
|
|
4047
4092
|
return operationsBtnText || operationsBtnPlain;
|
|
4048
|
-
})
|
|
4093
|
+
}), renderContent = () => {
|
|
4049
4094
|
const btnText = options.operationsBtnText, btnPlain = options.operationsBtnPlain, btnSize = options.operationsBtnSize, btnCfg = {
|
|
4050
4095
|
text: btnText,
|
|
4051
4096
|
plain: btnPlain,
|
|
@@ -4125,14 +4170,14 @@
|
|
|
4125
4170
|
center: !1,
|
|
4126
4171
|
confirmButtonText: t("next.table.message.confirmButtonText"),
|
|
4127
4172
|
cancelButtonText: t("next.table.message.cancelButtonText")
|
|
4128
|
-
}).then((
|
|
4173
|
+
}).then(() => {
|
|
4129
4174
|
emit("deleteRow", scoped);
|
|
4130
|
-
})
|
|
4175
|
+
}).catch(() => {
|
|
4131
4176
|
elementPlus.ElMessage({
|
|
4132
4177
|
type: "info",
|
|
4133
4178
|
message: t("next.table.message.cancelDelete")
|
|
4134
4179
|
});
|
|
4135
|
-
})
|
|
4180
|
+
});
|
|
4136
4181
|
})(scoped)
|
|
4137
4182
|
}, {
|
|
4138
4183
|
icon: () => vue.createVNode(elementPlus.ElIcon, null, {
|
|
@@ -4249,9 +4294,9 @@
|
|
|
4249
4294
|
emits: [ "close" ],
|
|
4250
4295
|
setup(props, {emit: emit, slots: slots}) {
|
|
4251
4296
|
const visible = vue.ref(props.modelValue);
|
|
4252
|
-
vue.watch((
|
|
4297
|
+
vue.watch(() => props.modelValue, value => {
|
|
4253
4298
|
visible.value = value;
|
|
4254
|
-
})
|
|
4299
|
+
});
|
|
4255
4300
|
const onClose = () => {
|
|
4256
4301
|
visible.value = !1, emit("close");
|
|
4257
4302
|
}, isFullscreen = vue.ref(props.fullscreen);
|
|
@@ -4357,13 +4402,13 @@
|
|
|
4357
4402
|
}, onChangeEnd = num => {
|
|
4358
4403
|
endNumber.value = num, emit("change", [ startNumber.value, endNumber.value ]);
|
|
4359
4404
|
}, controls = vue.ref(!0), numberRangeRef = vue.ref();
|
|
4360
|
-
vue.onMounted((
|
|
4405
|
+
vue.onMounted(() => {
|
|
4361
4406
|
const element = numberRangeRef.value;
|
|
4362
|
-
elementResize(element,
|
|
4407
|
+
elementResize(element, el => {
|
|
4363
4408
|
const width = el.clientWidth;
|
|
4364
4409
|
controls.value = width > 200;
|
|
4365
|
-
})
|
|
4366
|
-
})
|
|
4410
|
+
});
|
|
4411
|
+
});
|
|
4367
4412
|
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
|
|
4368
4413
|
ref: numberRangeRef,
|
|
4369
4414
|
class: ns$b.e("number-range")
|
|
@@ -4389,7 +4434,7 @@
|
|
|
4389
4434
|
}
|
|
4390
4435
|
});
|
|
4391
4436
|
const NextDialog = withInstall(NextDialog$1);
|
|
4392
|
-
function _isSlot$
|
|
4437
|
+
function _isSlot$4(s) {
|
|
4393
4438
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
|
|
4394
4439
|
}
|
|
4395
4440
|
const ns$a = useNamespace("form"), InputTableSelect = vue.defineComponent({
|
|
@@ -4444,16 +4489,16 @@
|
|
|
4444
4489
|
},
|
|
4445
4490
|
data: []
|
|
4446
4491
|
}), onConfirmSearch = searchParams => {
|
|
4447
|
-
tableReactive.loading = !0, _options.loadData?.(searchParams, tableReactive.page,
|
|
4492
|
+
tableReactive.loading = !0, _options.loadData?.(searchParams, tableReactive.page, res => {
|
|
4448
4493
|
tableReactive.data = res.data || [], tableReactive.page.total = res.total || 0,
|
|
4449
4494
|
tableReactive.loading = !1;
|
|
4450
|
-
})
|
|
4495
|
+
});
|
|
4451
4496
|
}, multipleSelection = vue.ref([]), sinleSelection = vue.ref("");
|
|
4452
|
-
_column.tableSelectDefaultValue?.(props.formParams, _column,
|
|
4497
|
+
_column.tableSelectDefaultValue?.(props.formParams, _column, rows => {
|
|
4453
4498
|
rows?.length && (_column.tableSelectRows = rows, multipleSelection.value = rows,
|
|
4454
4499
|
sinleSelection.value = rows[0][propsValue]);
|
|
4455
|
-
})
|
|
4456
|
-
const _disabledSelect = vue.computed((
|
|
4500
|
+
});
|
|
4501
|
+
const _disabledSelect = vue.computed(() => "radio" === _options.selectType ? !sinleSelection.value : 0 === multipleSelection.value.length), onResetTableSelect = () => {
|
|
4457
4502
|
multipleSelection.value = [], sinleSelection.value = "";
|
|
4458
4503
|
}, onConfirmSelect = () => {
|
|
4459
4504
|
const rows = vue.toRaw(multipleSelection.value), _rows = arrayObjNoRepeat(rows, propsValue);
|
|
@@ -4466,7 +4511,7 @@
|
|
|
4466
4511
|
value: value,
|
|
4467
4512
|
onChange: event => ((event, row) => {
|
|
4468
4513
|
if (event) multipleSelection.value.push(row); else {
|
|
4469
|
-
const index = multipleSelection.value.findIndex(
|
|
4514
|
+
const index = multipleSelection.value.findIndex(o => o[propsValue] === row[propsValue]);
|
|
4470
4515
|
-1 !== index && multipleSelection.value.splice(index, 1);
|
|
4471
4516
|
}
|
|
4472
4517
|
})(event, vue.toRaw(row))
|
|
@@ -4477,30 +4522,30 @@
|
|
|
4477
4522
|
}
|
|
4478
4523
|
}, null);
|
|
4479
4524
|
}, tags = vue.ref([]), tagsMore = vue.ref([]), _updateTags = () => {
|
|
4480
|
-
const rows = arrayObjNoRepeat(multipleSelection.value, propsValue).map(
|
|
4525
|
+
const rows = arrayObjNoRepeat(multipleSelection.value, propsValue).map(row => ({
|
|
4481
4526
|
value: row[propsValue],
|
|
4482
4527
|
label: row[propsLabel]
|
|
4483
|
-
}))
|
|
4528
|
+
}));
|
|
4484
4529
|
rows.length > 1 ? (tags.value = rows.splice(0, 1), tagsMore.value = rows) : (tags.value = rows,
|
|
4485
4530
|
tagsMore.value = []);
|
|
4486
4531
|
};
|
|
4487
|
-
vue.watch((
|
|
4532
|
+
vue.watch(() => _column.tableSelectRows, () => {
|
|
4488
4533
|
_updateTags();
|
|
4489
|
-
}
|
|
4534
|
+
}, {
|
|
4490
4535
|
deep: !0,
|
|
4491
4536
|
immediate: !0
|
|
4492
4537
|
});
|
|
4493
4538
|
const _multipleSelection = vue.ref([]);
|
|
4494
|
-
vue.watch((
|
|
4495
|
-
_multipleSelection.value = multipleSelection.value.map(
|
|
4496
|
-
}
|
|
4539
|
+
vue.watch(() => [ props.formParams[_column.prop], multipleSelection.value ], () => {
|
|
4540
|
+
_multipleSelection.value = multipleSelection.value.map(o => o[propsValue]), _updateTags();
|
|
4541
|
+
}, {
|
|
4497
4542
|
deep: !0,
|
|
4498
4543
|
immediate: !0
|
|
4499
4544
|
});
|
|
4500
4545
|
const _sinleSelection = vue.ref(null);
|
|
4501
|
-
vue.watch((
|
|
4546
|
+
vue.watch(() => [ props.formParams[_column.prop], sinleSelection.value ], () => {
|
|
4502
4547
|
_sinleSelection.value = sinleSelection.value, _updateTags();
|
|
4503
|
-
}
|
|
4548
|
+
}, {
|
|
4504
4549
|
deep: !0,
|
|
4505
4550
|
immediate: !0
|
|
4506
4551
|
});
|
|
@@ -4516,12 +4561,12 @@
|
|
|
4516
4561
|
class: "el-input__wrapper"
|
|
4517
4562
|
}, [ tags?.value.length ? vue.createVNode("span", {
|
|
4518
4563
|
class: ns$a.em("input-table", "value")
|
|
4519
|
-
}, [ tags.value.map((
|
|
4520
|
-
closable:
|
|
4564
|
+
}, [ tags.value.map((tag, index) => vue.createVNode(elementPlus.ElTag, {
|
|
4565
|
+
closable: _closable,
|
|
4521
4566
|
onClose: () => _onCloseTag(0, index)
|
|
4522
4567
|
}, {
|
|
4523
4568
|
default: () => [ tag.label ]
|
|
4524
|
-
}))
|
|
4569
|
+
})), tagsMore?.value?.length ? vue.createVNode(elementPlus.ElTooltip, {
|
|
4525
4570
|
"popper-class": ns$a.e("tooltip-tags"),
|
|
4526
4571
|
placement: "bottom",
|
|
4527
4572
|
effect: "light"
|
|
@@ -4529,12 +4574,12 @@
|
|
|
4529
4574
|
default: () => vue.createVNode(elementPlus.ElTag, null, {
|
|
4530
4575
|
default: () => [ vue.createTextVNode("+ "), tagsMore.value.length ]
|
|
4531
4576
|
}),
|
|
4532
|
-
content: () => tagsMore.value.map((
|
|
4533
|
-
closable:
|
|
4577
|
+
content: () => tagsMore.value.map((tag, index) => vue.createVNode(elementPlus.ElTag, {
|
|
4578
|
+
closable: _closable,
|
|
4534
4579
|
onClose: () => _onCloseTag(0, index + 1)
|
|
4535
4580
|
}, {
|
|
4536
4581
|
default: () => [ tag.label ]
|
|
4537
|
-
}))
|
|
4582
|
+
}))
|
|
4538
4583
|
}) : null ]) : vue.createVNode("span", {
|
|
4539
4584
|
class: ns$a.em("input-table", "placeholder")
|
|
4540
4585
|
}, [ _placeholder ]) ]), vue.createVNode(elementPlus.ElButton, {
|
|
@@ -4603,13 +4648,13 @@
|
|
|
4603
4648
|
class: ns$a.em("input-table", "footer")
|
|
4604
4649
|
}, [ vue.createVNode(elementPlus.ElButton, {
|
|
4605
4650
|
onClick: onResetTableSelect
|
|
4606
|
-
}, _isSlot$
|
|
4651
|
+
}, _isSlot$4(_slot = t("next.form.reset")) ? _slot : {
|
|
4607
4652
|
default: () => [ _slot ]
|
|
4608
4653
|
}), vue.createVNode(elementPlus.ElButton, {
|
|
4609
4654
|
type: "primary",
|
|
4610
4655
|
disabled: _disabledSelect.value,
|
|
4611
4656
|
onClick: onConfirmSelect
|
|
4612
|
-
}, _isSlot$
|
|
4657
|
+
}, _isSlot$4(_slot2 = t("next.form.confirm")) ? _slot2 : {
|
|
4613
4658
|
default: () => [ _slot2 ]
|
|
4614
4659
|
}) ]) ]
|
|
4615
4660
|
}) ]);
|
|
@@ -4671,7 +4716,7 @@
|
|
|
4671
4716
|
const value = this.defaultPreviewSrcList;
|
|
4672
4717
|
let urls = [];
|
|
4673
4718
|
return "string" == typeof value ? urls = [ value ] : "[object Array]" === Object.prototype.toString.call(value) && (urls = value),
|
|
4674
|
-
urls = urls.filter(
|
|
4719
|
+
urls = urls.filter(url => !!url), urls.length ? vue.createVNode(elementPlus.ElImage, {
|
|
4675
4720
|
class: ns$9.e("preview-image"),
|
|
4676
4721
|
src: urls[0],
|
|
4677
4722
|
previewSrcList: urls,
|
|
@@ -4694,7 +4739,7 @@
|
|
|
4694
4739
|
limit: props.limit,
|
|
4695
4740
|
"auto-upload": !1,
|
|
4696
4741
|
"on-preview": uploadFile => {
|
|
4697
|
-
const body = document.getElementsByTagName("body")[0], initial = uploadfilesPreview.value.findIndex(
|
|
4742
|
+
const body = document.getElementsByTagName("body")[0], initial = uploadfilesPreview.value.findIndex(file => file.url === uploadFile.url) || 0;
|
|
4698
4743
|
previewImagesContainer && (vue.render(null, previewImagesContainer), body.removeChild(previewImagesContainer)),
|
|
4699
4744
|
previewImagesContainer = document.createElement("div"), body.appendChild(previewImagesContainer);
|
|
4700
4745
|
const previewComponent = vue.createVNode({
|
|
@@ -4702,7 +4747,7 @@
|
|
|
4702
4747
|
to: "body"
|
|
4703
4748
|
}, [ vue.h(elementPlus.ElImageViewer, {
|
|
4704
4749
|
initialIndex: initial,
|
|
4705
|
-
"url-list": uploadfilesPreview.value.map(
|
|
4750
|
+
"url-list": uploadfilesPreview.value.map(file => file.url),
|
|
4706
4751
|
onClose: () => {
|
|
4707
4752
|
vue.render(null, previewImagesContainer);
|
|
4708
4753
|
}
|
|
@@ -4756,9 +4801,9 @@
|
|
|
4756
4801
|
emits: [ "change", "node-click", "node-contextmenu", "check", "check-change", "node-expand", "node-collapse", "current-change" ],
|
|
4757
4802
|
setup(props, {emit: emit, expose: expose}) {
|
|
4758
4803
|
const {t: t} = useLocale(), _modelValue = vue.ref(props.modelValue);
|
|
4759
|
-
vue.watch((
|
|
4804
|
+
vue.watch(() => props.modelValue, val => {
|
|
4760
4805
|
_modelValue.value = val;
|
|
4761
|
-
})
|
|
4806
|
+
});
|
|
4762
4807
|
const _column = props.column, valueKey = valueExist(_column.treeSelectProps?.value, _column.nodeKey, "id"), _formParams = props.formParams, _defaultProps = {
|
|
4763
4808
|
label: "label",
|
|
4764
4809
|
children: "children"
|
|
@@ -4842,14 +4887,14 @@
|
|
|
4842
4887
|
emits: [ "change", "clear", "expand-change", "visible-change", "remove-tag", "blur", "focus" ],
|
|
4843
4888
|
setup(props, {emit: emit, expose: expose}) {
|
|
4844
4889
|
const {t: t} = useLocale(), _modelValue = vue.ref(props.modelValue);
|
|
4845
|
-
vue.watch((
|
|
4890
|
+
vue.watch(() => props.modelValue, val => {
|
|
4846
4891
|
_modelValue.value = val;
|
|
4847
|
-
})
|
|
4892
|
+
});
|
|
4848
4893
|
const _column = props.column, placeholder = _column.placeholder || t("next.form.select") + _column.label, _defaultProps = {
|
|
4849
4894
|
label: "label",
|
|
4850
4895
|
children: "children"
|
|
4851
4896
|
}, onChange = val => {
|
|
4852
|
-
const nodes = treeSelectRef.value.getCheckedNodes().map(
|
|
4897
|
+
const nodes = treeSelectRef.value.getCheckedNodes().map(item => item.data);
|
|
4853
4898
|
props.formParams[_column.prop] = val, _modelValue.value = val, emit("change", val, nodes);
|
|
4854
4899
|
}, treeSelectRef = vue.ref(), getInstance = () => treeSelectRef.value;
|
|
4855
4900
|
_column.loadInstance && _column.loadInstance(getInstance()), expose({
|
|
@@ -4874,7 +4919,7 @@
|
|
|
4874
4919
|
}, null) ]);
|
|
4875
4920
|
}
|
|
4876
4921
|
});
|
|
4877
|
-
function _isSlot$
|
|
4922
|
+
function _isSlot$3(s) {
|
|
4878
4923
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
|
|
4879
4924
|
}
|
|
4880
4925
|
const ns$8 = useNamespace("form");
|
|
@@ -4896,8 +4941,8 @@
|
|
|
4896
4941
|
},
|
|
4897
4942
|
emits: [ "submit", "close", "reset" ],
|
|
4898
4943
|
setup(props, {slots: slots, emit: emit, expose: expose}) {
|
|
4899
|
-
const _config = deepClone(defaultConfig$3), options = vue.reactive(merge(_config, props.options)), _isEditing = vue.computed((
|
|
4900
|
-
vue.watch((
|
|
4944
|
+
const _config = deepClone(defaultConfig$3), options = vue.reactive(merge(_config, props.options)), _isEditing = vue.computed(() => "boolean" != typeof options.isEditing || options.isEditing), {t: t} = useLocale(), colSpan = vue.ref(options.colSpan), formDatum = vue.reactive(props.formDatum) || {}, formParams = vue.reactive(merge({}, formDatum)), _formColumns = vue.ref([]), formRules = vue.reactive({});
|
|
4945
|
+
vue.watch(() => [ props.columns, props.formDatum ], () => {
|
|
4901
4946
|
(() => {
|
|
4902
4947
|
const columns = props.columns;
|
|
4903
4948
|
_formColumns.value = columns;
|
|
@@ -4910,41 +4955,41 @@
|
|
|
4910
4955
|
message: label + t("next.form.requiredInput"),
|
|
4911
4956
|
trigger: [ "blur", "change" ]
|
|
4912
4957
|
}), col.rules?.length && rules.push(...col.rules), formRules[col.prop] = rules,
|
|
4913
|
-
!col.dicData?.length && col.loadDicData && col.loadDicData(col,
|
|
4958
|
+
!col.dicData?.length && col.loadDicData && col.loadDicData(col, data => {
|
|
4914
4959
|
data?.length && (col.dicData = data);
|
|
4915
|
-
}
|
|
4960
|
+
}, formParams), "boolean" == typeof col.disabled && col.disabled || (col.disabled = !_isEditing.value);
|
|
4916
4961
|
}
|
|
4917
4962
|
})();
|
|
4918
|
-
}
|
|
4963
|
+
}, {
|
|
4919
4964
|
deep: !0,
|
|
4920
4965
|
immediate: !0
|
|
4921
4966
|
});
|
|
4922
4967
|
const formColumns = arrayObjNoRepeat(_formColumns.value, "prop"), spanResizeLoading = vue.ref(!1);
|
|
4923
|
-
vue.onMounted((
|
|
4968
|
+
vue.onMounted(() => {
|
|
4924
4969
|
const formEl = ruleFormRef.value?.$el;
|
|
4925
4970
|
let timer = null;
|
|
4926
|
-
elementResize(formEl,
|
|
4927
|
-
null !== timer ? clearTimeout(timer) : spanResizeLoading.value = !0, timer = setTimeout((
|
|
4971
|
+
elementResize(formEl, el => {
|
|
4972
|
+
null !== timer ? clearTimeout(timer) : spanResizeLoading.value = !0, timer = setTimeout(() => {
|
|
4928
4973
|
colSpan.value = ((el, minWidth = 350) => {
|
|
4929
4974
|
const el_width = el.clientWidth;
|
|
4930
4975
|
let span = Math.floor(el_width / minWidth);
|
|
4931
4976
|
return span > 4 && (span = 4), Math.ceil(24 / span);
|
|
4932
4977
|
})(el, options.columnMinWidth), spanResizeLoading.value = !1, clearTimeout(timer);
|
|
4933
|
-
}
|
|
4934
|
-
})
|
|
4935
|
-
})
|
|
4978
|
+
}, 200);
|
|
4979
|
+
});
|
|
4980
|
+
});
|
|
4936
4981
|
const ruleFormRef = vue.ref(), submitLoading = vue.ref(!1), onSubmitAddEdit = async () => {
|
|
4937
4982
|
const formInstance = ruleFormRef.value;
|
|
4938
|
-
formInstance && await formInstance.validate((
|
|
4983
|
+
formInstance && await formInstance.validate((valid, fields) => {
|
|
4939
4984
|
if (valid) {
|
|
4940
4985
|
const params = vue.toRaw(formParams);
|
|
4941
|
-
submitLoading.value = !0, emit("submit", params, (
|
|
4986
|
+
submitLoading.value = !0, emit("submit", params, () => {
|
|
4942
4987
|
submitLoading.value = !1, emit("close");
|
|
4943
|
-
}
|
|
4988
|
+
}, () => {
|
|
4944
4989
|
submitLoading.value = !1;
|
|
4945
|
-
})
|
|
4990
|
+
});
|
|
4946
4991
|
} else console.error("error submit!", fields);
|
|
4947
|
-
})
|
|
4992
|
+
});
|
|
4948
4993
|
}, onResetForm = () => {
|
|
4949
4994
|
const formInstance = ruleFormRef.value;
|
|
4950
4995
|
formInstance && (formInstance.resetFields(), submitLoading.value = !1, emit("reset", formParams));
|
|
@@ -5094,12 +5139,12 @@
|
|
|
5094
5139
|
"collapse-tags-tooltip": !0,
|
|
5095
5140
|
onChange: event => col.onChange?.(event, col, formParams, formColumns)
|
|
5096
5141
|
}, {
|
|
5097
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
5142
|
+
default: () => [ col.dicData && col.dicData.map(item => vue.createVNode(elementPlus.ElOption, {
|
|
5098
5143
|
key: item.value,
|
|
5099
5144
|
value: item.value,
|
|
5100
5145
|
label: item.label,
|
|
5101
5146
|
disabled: valueExist(item.disabled, !1)
|
|
5102
|
-
}, null))
|
|
5147
|
+
}, null)) ]
|
|
5103
5148
|
});
|
|
5104
5149
|
}
|
|
5105
5150
|
if ("time" === col.type) {
|
|
@@ -5128,13 +5173,13 @@
|
|
|
5128
5173
|
readonly: valueExist(col.readonly, !1),
|
|
5129
5174
|
onChange: event => col.onChange?.(event, col, formParams, formColumns)
|
|
5130
5175
|
}, {
|
|
5131
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
5176
|
+
default: () => [ col.dicData && col.dicData.map(item => vue.createVNode(elementPlus.ElRadio, {
|
|
5132
5177
|
key: item.value,
|
|
5133
5178
|
value: item.value,
|
|
5134
5179
|
disabled: valueExist(item.disabled, !1)
|
|
5135
5180
|
}, {
|
|
5136
5181
|
default: () => [ item.label ]
|
|
5137
|
-
}))
|
|
5182
|
+
})) ]
|
|
5138
5183
|
});
|
|
5139
5184
|
if ("checkbox" === col.type) return isValueExist(formParams[col.prop]) || (formParams[col.prop] = []),
|
|
5140
5185
|
vue.createVNode(elementPlus.ElCheckboxGroup, {
|
|
@@ -5144,13 +5189,13 @@
|
|
|
5144
5189
|
readonly: valueExist(col.readonly, !1),
|
|
5145
5190
|
onChange: event => col.onChange?.(event, col, formParams, formColumns)
|
|
5146
5191
|
}, {
|
|
5147
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
5192
|
+
default: () => [ col.dicData && col.dicData.map(item => vue.createVNode(elementPlus.ElCheckbox, {
|
|
5148
5193
|
key: item.value,
|
|
5149
5194
|
label: item.value,
|
|
5150
5195
|
disabled: valueExist(item.disabled, !1)
|
|
5151
5196
|
}, {
|
|
5152
5197
|
default: () => [ item.label ]
|
|
5153
|
-
}))
|
|
5198
|
+
})) ]
|
|
5154
5199
|
});
|
|
5155
5200
|
if ("date" === col.type) {
|
|
5156
5201
|
const placeholder = col.placeholder || t("next.form.select") + col.label;
|
|
@@ -5249,10 +5294,10 @@
|
|
|
5249
5294
|
onSelect: rows => ((rows, col) => {
|
|
5250
5295
|
rows && (col.tableSelectRows = rows);
|
|
5251
5296
|
const {value: value} = col.tableSelectProps || {};
|
|
5252
|
-
formParams[col.prop] = rows.map(
|
|
5297
|
+
formParams[col.prop] = rows.map(row => row[value || "value"]), col.onTableSelect?.(formParams, rows, col),
|
|
5253
5298
|
ruleFormRef.value?.validateField(col.prop);
|
|
5254
5299
|
})(rows, col)
|
|
5255
|
-
}, _isSlot$
|
|
5300
|
+
}, _isSlot$3(_slots) ? _slots : {
|
|
5256
5301
|
default: () => [ _slots ]
|
|
5257
5302
|
});
|
|
5258
5303
|
}
|
|
@@ -5291,19 +5336,20 @@
|
|
|
5291
5336
|
let _slot2;
|
|
5292
5337
|
return vue.createVNode(NextSpinLoading, {
|
|
5293
5338
|
loading: spanResizeLoading.value
|
|
5294
|
-
}, _isSlot$
|
|
5339
|
+
}, _isSlot$3(_slot2 = (() => {
|
|
5295
5340
|
let _slot;
|
|
5296
5341
|
return vue.createVNode(elementPlus.ElForm, {
|
|
5297
5342
|
ref: ruleFormRef,
|
|
5298
5343
|
class: ns$8.b(),
|
|
5299
5344
|
inline: !1,
|
|
5300
5345
|
model: formParams,
|
|
5301
|
-
size: options.size
|
|
5346
|
+
size: options.size,
|
|
5347
|
+
"label-position": valueExist(options.labelPosition, "left")
|
|
5302
5348
|
}, {
|
|
5303
5349
|
default: () => [ vue.createVNode(elementPlus.ElRow, {
|
|
5304
5350
|
gutter: 20
|
|
5305
|
-
}, _isSlot$
|
|
5306
|
-
span: valueExist(column.span, colSpan.value)
|
|
5351
|
+
}, _isSlot$3(_slot = formColumns.map(column => !column.hide && vue.createVNode(elementPlus.ElCol, {
|
|
5352
|
+
span: valueExist(options.colSpanFixed, column.span, colSpan.value)
|
|
5307
5353
|
}, {
|
|
5308
5354
|
default: () => [ vue.createVNode(elementPlus.ElFormItem, {
|
|
5309
5355
|
prop: column.prop,
|
|
@@ -5330,7 +5376,7 @@
|
|
|
5330
5376
|
}) : null ]) : null,
|
|
5331
5377
|
default: () => renderFormItem(column)
|
|
5332
5378
|
}) ]
|
|
5333
|
-
})))
|
|
5379
|
+
}))) ? _slot : {
|
|
5334
5380
|
default: () => [ _slot ]
|
|
5335
5381
|
}), _isEditing.value && options.showFooter ? vue.createVNode("div", {
|
|
5336
5382
|
class: ns$8.e("footer")
|
|
@@ -5372,13 +5418,13 @@
|
|
|
5372
5418
|
emits: [ "close", "submit" ],
|
|
5373
5419
|
setup(props, {slots: slots, emit: emit, expose: expose}) {
|
|
5374
5420
|
const addEditFormSlots = vue.inject("addEditFormSlots"), form_slots = {};
|
|
5375
|
-
addEditFormSlots.value.forEach(
|
|
5421
|
+
addEditFormSlots.value.forEach(slotName => {
|
|
5376
5422
|
form_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5377
|
-
})
|
|
5423
|
+
});
|
|
5378
5424
|
const _options = vue.inject("options", {}), options = deepClone(vue.isRef(_options) ? vue.unref(_options) : _options);
|
|
5379
5425
|
options.columnMinWidth = options.formColumnMinWidth, options.isEditing = props.isEditing;
|
|
5380
|
-
const formRef = vue.ref(), formDatum = deepClone(vue.isRef(props.formDatum) ? vue.unref(props.formDatum) : props.formDatum), _columns = deepClone(props.columns).map(
|
|
5381
|
-
col))
|
|
5426
|
+
const formRef = vue.ref(), formDatum = deepClone(vue.isRef(props.formDatum) ? vue.unref(props.formDatum) : props.formDatum), _columns = deepClone(props.columns).map(col => (col.hide = valueExist(col.formHide, col.hide, !1),
|
|
5427
|
+
col)), onSubmit = (...arg) => {
|
|
5382
5428
|
emit("submit", ...arg);
|
|
5383
5429
|
};
|
|
5384
5430
|
expose({
|
|
@@ -5403,7 +5449,7 @@
|
|
|
5403
5449
|
return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
|
|
5404
5450
|
}
|
|
5405
5451
|
});
|
|
5406
|
-
function _isSlot(s) {
|
|
5452
|
+
function _isSlot$1(s) {
|
|
5407
5453
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
|
|
5408
5454
|
}
|
|
5409
5455
|
const ns$7 = useNamespace("crud-table");
|
|
@@ -5412,25 +5458,25 @@
|
|
|
5412
5458
|
props: defaultPropsConfig,
|
|
5413
5459
|
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" ],
|
|
5414
5460
|
setup(props, {emit: emit, slots: slots, expose: expose}) {
|
|
5415
|
-
const _config = deepClone(defaultConfig$4), _options = vue.computed((
|
|
5461
|
+
const _config = deepClone(defaultConfig$4), _options = vue.computed(() => {
|
|
5416
5462
|
const cfg = vue.unref(props.options);
|
|
5417
5463
|
return merge(_config, cfg);
|
|
5418
|
-
})
|
|
5419
|
-
vue.provide("options", vue.computed((
|
|
5464
|
+
}), options = vue.unref(_options);
|
|
5465
|
+
vue.provide("options", vue.computed(() => _options.value)), vue.provide("ns", ns$7);
|
|
5420
5466
|
const {t: t} = useLocale(), _columns = vue.ref(options.columns), _searchColumns = vue.ref([]), _formColumns = vue.ref([]), _updateColumnsAll = ops => {
|
|
5421
5467
|
((options, cb) => {
|
|
5422
5468
|
const _columns = vue.reactive(options.columns), _loadDicData = col => {
|
|
5423
|
-
!col.dicData?.length && col.loadDicData && col.loadDicData(col,
|
|
5469
|
+
!col.dicData?.length && col.loadDicData && col.loadDicData(col, data => {
|
|
5424
5470
|
data?.length && (col.dicData = data);
|
|
5425
|
-
})
|
|
5471
|
+
});
|
|
5426
5472
|
}, loopTableColumns = list => {
|
|
5427
5473
|
let cols = [];
|
|
5428
|
-
return list.forEach(
|
|
5474
|
+
return list.forEach(col => {
|
|
5429
5475
|
_loadDicData(col), cols.push(col), col.children?.length && (cols.push(...loopTableColumns(col.children)),
|
|
5430
5476
|
col.children && delete col.children);
|
|
5431
|
-
})
|
|
5432
|
-
}, evenTableColumns = loopTableColumns(_columns), formColumns = options.formColumns.map(
|
|
5433
|
-
col))
|
|
5477
|
+
}), cols;
|
|
5478
|
+
}, evenTableColumns = loopTableColumns(_columns), formColumns = options.formColumns.map(col => (_loadDicData(col),
|
|
5479
|
+
col)), _formColumns = evenTableColumns.concat(formColumns).map(col => {
|
|
5434
5480
|
const item = {
|
|
5435
5481
|
prop: col.prop,
|
|
5436
5482
|
label: valueExist(col.formLabel, col.label, ""),
|
|
@@ -5480,7 +5526,7 @@
|
|
|
5480
5526
|
};
|
|
5481
5527
|
return !col.dicData?.length && col.loadDicData && shareObjectProperty(item, col, "dicData"),
|
|
5482
5528
|
item;
|
|
5483
|
-
})
|
|
5529
|
+
}).filter(o => o.sort && o.prop).sort((a, b) => a.sort - b.sort), _formatSearchColumn = (col, index) => {
|
|
5484
5530
|
const item = {
|
|
5485
5531
|
prop: col.prop,
|
|
5486
5532
|
type: valueExist(col.searchType, col.type),
|
|
@@ -5517,21 +5563,21 @@
|
|
|
5517
5563
|
};
|
|
5518
5564
|
return !col.dicData?.length && col.loadDicData && shareObjectProperty(item, col, "dicData"),
|
|
5519
5565
|
item;
|
|
5520
|
-
}, initSearchColumns = options.searchColumns.map((
|
|
5521
|
-
_formatSearchColumn(col, index)))
|
|
5566
|
+
}, initSearchColumns = options.searchColumns.map((col, index) => (_loadDicData(col),
|
|
5567
|
+
_formatSearchColumn(col, index))), initSearchColumnsLength = initSearchColumns.length, mergeSearchColumns = initSearchColumns.concat((list => {
|
|
5522
5568
|
let cols = [];
|
|
5523
|
-
return list.forEach((
|
|
5569
|
+
return list.forEach((col, index) => {
|
|
5524
5570
|
col.searchType && cols.push(_formatSearchColumn(col, index + initSearchColumnsLength));
|
|
5525
|
-
})
|
|
5526
|
-
})(evenTableColumns)), _searchColumns = arrayObjNoRepeat(mergeSearchColumns.sort((
|
|
5571
|
+
}), cols;
|
|
5572
|
+
})(evenTableColumns)), _searchColumns = arrayObjNoRepeat(mergeSearchColumns.sort((a, b) => a.sort - b.sort), "prop");
|
|
5527
5573
|
cb && cb({
|
|
5528
5574
|
formColumns: _formColumns,
|
|
5529
5575
|
searchColumns: _searchColumns,
|
|
5530
5576
|
columns: _columns
|
|
5531
5577
|
});
|
|
5532
|
-
})(ops, (
|
|
5578
|
+
})(ops, ({formColumns: formColumns, searchColumns: searchColumns, columns: columns}) => {
|
|
5533
5579
|
_searchColumns.value = searchColumns, _formColumns.value = formColumns, _columns.value = columns;
|
|
5534
|
-
})
|
|
5580
|
+
});
|
|
5535
5581
|
}, tableData = vue.ref(props.data), _searchFormParams = vue.ref((() => {
|
|
5536
5582
|
const list = _searchColumns.value;
|
|
5537
5583
|
let params = {};
|
|
@@ -5549,33 +5595,33 @@
|
|
|
5549
5595
|
}, onClickRefresh = () => {
|
|
5550
5596
|
onConfirmSearch(_searchFormParams.value);
|
|
5551
5597
|
};
|
|
5552
|
-
vue.watch((
|
|
5598
|
+
vue.watch(() => props.data, list => {
|
|
5553
5599
|
tableData.value = list;
|
|
5554
|
-
}
|
|
5600
|
+
}, {
|
|
5555
5601
|
immediate: !0
|
|
5556
|
-
}), vue.watch((
|
|
5602
|
+
}), vue.watch(() => _options, ops => {
|
|
5557
5603
|
_updateColumnsAll(ops.value);
|
|
5558
|
-
}
|
|
5604
|
+
}, {
|
|
5559
5605
|
deep: !0,
|
|
5560
5606
|
immediate: !0
|
|
5561
5607
|
});
|
|
5562
5608
|
const tableContentHeight = vue.ref(options.defaultContentHeight), crudTableRef = vue.ref(), headerRef = vue.ref(), tableRef = vue.ref(), footerRef = vue.ref(), addEditFormRef = vue.ref(null), updateTableContentHeight = () => {
|
|
5563
|
-
vue.nextTick((
|
|
5609
|
+
vue.nextTick(() => {
|
|
5564
5610
|
const contentHeight = (crudTableRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
|
|
5565
5611
|
tableContentHeight.value = contentHeight;
|
|
5566
|
-
})
|
|
5612
|
+
});
|
|
5567
5613
|
}, fullscreenChangeListener = event => {
|
|
5568
5614
|
"F11" !== event.key && "fullscreenchange" !== event.type || updateTableContentHeight();
|
|
5569
5615
|
};
|
|
5570
|
-
vue.onMounted((
|
|
5571
|
-
elementResize(crudTableRef.value, (
|
|
5616
|
+
vue.onMounted(() => {
|
|
5617
|
+
elementResize(crudTableRef.value, () => {
|
|
5572
5618
|
updateTableContentHeight();
|
|
5573
|
-
})
|
|
5619
|
+
}), options.initLoadData && onConfirmSearch(_searchFormParams.value), options.fullscreenchangeContentHeight && (document.addEventListener("fullscreenchange", fullscreenChangeListener),
|
|
5574
5620
|
document.addEventListener("keydown", fullscreenChangeListener));
|
|
5575
|
-
})
|
|
5621
|
+
}), vue.onUnmounted(() => {
|
|
5576
5622
|
options.fullscreenchangeContentHeight && (document.removeEventListener("fullscreenchange", fullscreenChangeListener),
|
|
5577
5623
|
document.removeEventListener("keydown", fullscreenChangeListener));
|
|
5578
|
-
})
|
|
5624
|
+
});
|
|
5579
5625
|
const onChangePagination = page => {
|
|
5580
5626
|
props.page.pageIndex = page.pageIndex, props.page.pageSize = page.pageSize, emit("change-pagination", page),
|
|
5581
5627
|
onConfirmSearch(_searchFormParams.value);
|
|
@@ -5591,30 +5637,30 @@
|
|
|
5591
5637
|
}), onClickHeaderAdd = (row = {}) => {
|
|
5592
5638
|
const {dialogTitle: dialogTitle} = options;
|
|
5593
5639
|
addEditDialog.isEditing = !0, addEditDialog.title = dialogTitle + " " + t("next.table.add"),
|
|
5594
|
-
addEditDialog.rowInfo = row, emit("click-add-edit", row, options), vue.nextTick((
|
|
5640
|
+
addEditDialog.rowInfo = row, emit("click-add-edit", row, options), vue.nextTick(() => {
|
|
5595
5641
|
addEditDialog.visible = !0;
|
|
5596
|
-
})
|
|
5642
|
+
});
|
|
5597
5643
|
}, onClickDeleteRows = rows => {
|
|
5598
|
-
emit("delete-rows", rows, (
|
|
5644
|
+
emit("delete-rows", rows, () => {
|
|
5599
5645
|
onClickRefresh();
|
|
5600
|
-
})
|
|
5646
|
+
});
|
|
5601
5647
|
}, onClickDeleteRow = scoped => {
|
|
5602
|
-
emit("delete-row", scoped, (
|
|
5648
|
+
emit("delete-row", scoped, () => {
|
|
5603
5649
|
onClickRefresh();
|
|
5604
|
-
})
|
|
5650
|
+
});
|
|
5605
5651
|
}, onClickRowEdit = scoped => {
|
|
5606
5652
|
const {dialogTitle: dialogTitle} = options;
|
|
5607
5653
|
addEditDialog.isEditing = !0, addEditDialog.title = dialogTitle + " " + t("next.table.edit"),
|
|
5608
5654
|
addEditDialog.rowInfo = scoped.row, emit("click-add-edit", scoped.row, options),
|
|
5609
|
-
vue.nextTick((
|
|
5655
|
+
vue.nextTick(() => {
|
|
5610
5656
|
addEditDialog.visible = !0;
|
|
5611
|
-
})
|
|
5657
|
+
});
|
|
5612
5658
|
}, onClickRowView = scoped => {
|
|
5613
5659
|
const {dialogTitle: dialogTitle} = options;
|
|
5614
5660
|
addEditDialog.isEditing = !1, addEditDialog.title = dialogTitle + " " + t("next.table.view"),
|
|
5615
|
-
addEditDialog.rowInfo = scoped.row, emit("view-add-edit", scoped.row), vue.nextTick((
|
|
5661
|
+
addEditDialog.rowInfo = scoped.row, emit("view-add-edit", scoped.row), vue.nextTick(() => {
|
|
5616
5662
|
addEditDialog.visible = !0;
|
|
5617
|
-
})
|
|
5663
|
+
});
|
|
5618
5664
|
}, onCloseAddEditDialog = () => {
|
|
5619
5665
|
addEditDialog.visible = !1, addEditDialog.title = "", addEditDialog.rowInfo = {},
|
|
5620
5666
|
emit("close-add-edit");
|
|
@@ -5627,31 +5673,31 @@
|
|
|
5627
5673
|
const _customRowIndex = index => {
|
|
5628
5674
|
const {pageIndex: pageIndex, pageSize: pageSize} = props.page;
|
|
5629
5675
|
return (pageIndex - 1) * pageSize + (index + 1);
|
|
5630
|
-
}, _sortNumberMinWidth = vue.computed((
|
|
5676
|
+
}, _sortNumberMinWidth = vue.computed(() => {
|
|
5631
5677
|
const {total: total} = props.page, tempElement = document.createElement("span");
|
|
5632
5678
|
tempElement.innerText = total, tempElement.style.visibility = "hidden", document.body.appendChild(tempElement);
|
|
5633
5679
|
const width = tempElement.getBoundingClientRect().width, minWidth = Math.ceil(width) + 25;
|
|
5634
5680
|
return document.body.removeChild(tempElement), minWidth > 50 ? minWidth : 50;
|
|
5635
|
-
})
|
|
5636
|
-
searchFormSlots.value.forEach(
|
|
5681
|
+
}), searchFrom_slots = {};
|
|
5682
|
+
searchFormSlots.value.forEach(slotName => {
|
|
5637
5683
|
searchFrom_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5638
|
-
})
|
|
5684
|
+
});
|
|
5639
5685
|
const column_slots = {};
|
|
5640
|
-
columnSlots.value.forEach(
|
|
5686
|
+
columnSlots.value.forEach(slotName => {
|
|
5641
5687
|
column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5642
|
-
})
|
|
5688
|
+
});
|
|
5643
5689
|
const addEditForm_slots = {};
|
|
5644
|
-
addEditFormSlots.value.forEach(
|
|
5690
|
+
addEditFormSlots.value.forEach(slotName => {
|
|
5645
5691
|
addEditForm_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5646
|
-
})
|
|
5692
|
+
});
|
|
5647
5693
|
const headerMenu_solts = {};
|
|
5648
|
-
header_menu_slots_key.forEach(
|
|
5694
|
+
header_menu_slots_key.forEach(slotName => {
|
|
5649
5695
|
headerMenu_solts[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5650
|
-
})
|
|
5696
|
+
});
|
|
5651
5697
|
const operation_column_slots = {};
|
|
5652
|
-
operation_column_slots_key.forEach(
|
|
5698
|
+
operation_column_slots_key.forEach(slotName => {
|
|
5653
5699
|
operation_column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5654
|
-
})
|
|
5700
|
+
});
|
|
5655
5701
|
expose({
|
|
5656
5702
|
onClickRowAdd: onClickHeaderAdd,
|
|
5657
5703
|
columns: _columns.value,
|
|
@@ -5676,13 +5722,13 @@
|
|
|
5676
5722
|
onZoomResize: updateTableContentHeight,
|
|
5677
5723
|
onConfirmSearch: onConfirmSearch,
|
|
5678
5724
|
onClearSearch: onClearSearch
|
|
5679
|
-
}, _isSlot(searchFrom_slots) ? searchFrom_slots : {
|
|
5725
|
+
}, _isSlot$1(searchFrom_slots) ? searchFrom_slots : {
|
|
5680
5726
|
default: () => [ searchFrom_slots ]
|
|
5681
5727
|
}), options.showHeaderMenu && vue.createVNode(HeaderMenu, {
|
|
5682
5728
|
onClickAdd: onClickHeaderAdd,
|
|
5683
5729
|
onDeleteRows: onClickDeleteRows,
|
|
5684
5730
|
onClickRefresh: onClickRefresh
|
|
5685
|
-
}, _isSlot(headerMenu_solts) ? headerMenu_solts : {
|
|
5731
|
+
}, _isSlot$1(headerMenu_solts) ? headerMenu_solts : {
|
|
5686
5732
|
default: () => [ headerMenu_solts ]
|
|
5687
5733
|
}), slots["table-head-tip"]?.() ]) : null, vue.createVNode(NextSpinLoading$1, {
|
|
5688
5734
|
loading: props.loading
|
|
@@ -5733,16 +5779,16 @@
|
|
|
5733
5779
|
fixed: "left",
|
|
5734
5780
|
headerAlign: options.headerAlign,
|
|
5735
5781
|
align: options.cellAlign
|
|
5736
|
-
}, null) : null, slots.default?.(), _columns.value.map(
|
|
5782
|
+
}, null) : null, slots.default?.(), _columns.value.map(col => vue.createVNode(TableColumnDynamic, {
|
|
5737
5783
|
columnOption: col,
|
|
5738
5784
|
key: col.prop
|
|
5739
|
-
}, _isSlot(column_slots) ? column_slots : {
|
|
5785
|
+
}, _isSlot$1(column_slots) ? column_slots : {
|
|
5740
5786
|
default: () => [ column_slots ]
|
|
5741
|
-
}))
|
|
5787
|
+
})), options.operations ? vue.createVNode(TableColumnOperations, {
|
|
5742
5788
|
onEditRow: onClickRowEdit,
|
|
5743
5789
|
onViewRow: onClickRowView,
|
|
5744
5790
|
onDeleteRow: onClickDeleteRow
|
|
5745
|
-
}, _isSlot(operation_column_slots) ? operation_column_slots : {
|
|
5791
|
+
}, _isSlot$1(operation_column_slots) ? operation_column_slots : {
|
|
5746
5792
|
default: () => [ operation_column_slots ]
|
|
5747
5793
|
}) : null ],
|
|
5748
5794
|
empty: () => vue.createVNode(elementPlus.ElEmpty, {
|
|
@@ -5772,7 +5818,7 @@
|
|
|
5772
5818
|
isEditing: addEditDialog.isEditing,
|
|
5773
5819
|
onClose: onCloseAddEditDialog,
|
|
5774
5820
|
onSubmit: onSubmitAddEditDialog
|
|
5775
|
-
}, _isSlot(addEditForm_slots) ? addEditForm_slots : {
|
|
5821
|
+
}, _isSlot$1(addEditForm_slots) ? addEditForm_slots : {
|
|
5776
5822
|
default: () => [ addEditForm_slots ]
|
|
5777
5823
|
})
|
|
5778
5824
|
}) ]) ]) ]);
|
|
@@ -5814,11 +5860,11 @@
|
|
|
5814
5860
|
name: "NextCrudTableVirtualized",
|
|
5815
5861
|
props: propsConfig,
|
|
5816
5862
|
setup(props, {emit: emit}) {
|
|
5817
|
-
const _config = deepClone(defaultConfig$2), _options = vue.computed((
|
|
5863
|
+
const _config = deepClone(defaultConfig$2), _options = vue.computed(() => {
|
|
5818
5864
|
const cfg = vue.unref(props.options);
|
|
5819
5865
|
return merge(_config, cfg);
|
|
5820
|
-
})
|
|
5821
|
-
vue.provide("options", vue.computed((
|
|
5866
|
+
}), options = vue.unref(_options);
|
|
5867
|
+
vue.provide("options", vue.computed(() => _options.value));
|
|
5822
5868
|
const {t: t} = useLocale(), addEditDialog = vue.reactive({
|
|
5823
5869
|
visible: !1,
|
|
5824
5870
|
title: t("next.table.add"),
|
|
@@ -5879,7 +5925,7 @@
|
|
|
5879
5925
|
"list-type": props.listType,
|
|
5880
5926
|
"auto-upload": !1,
|
|
5881
5927
|
"on-preview": uploadFile => {
|
|
5882
|
-
const initial = uploadfilesPreview.value.findIndex(
|
|
5928
|
+
const initial = uploadfilesPreview.value.findIndex(file => file.url === uploadFile.url) || 0;
|
|
5883
5929
|
previewImagesContainer && (vue.render(null, previewImagesContainer), body.removeChild(previewImagesContainer)),
|
|
5884
5930
|
previewImagesContainer = document.createElement("div"), body.appendChild(previewImagesContainer);
|
|
5885
5931
|
const previewComponent = vue.createVNode({
|
|
@@ -5887,7 +5933,7 @@
|
|
|
5887
5933
|
to: "body"
|
|
5888
5934
|
}, [ vue.h(elementPlus.ElImageViewer, {
|
|
5889
5935
|
initialIndex: initial,
|
|
5890
|
-
"url-list": uploadfilesPreview.value.map(
|
|
5936
|
+
"url-list": uploadfilesPreview.value.map(file => file.url),
|
|
5891
5937
|
onClose: () => {
|
|
5892
5938
|
vue.render(null, previewImagesContainer);
|
|
5893
5939
|
}
|
|
@@ -5941,13 +5987,17 @@
|
|
|
5941
5987
|
type: Boolean,
|
|
5942
5988
|
default: !0
|
|
5943
5989
|
},
|
|
5990
|
+
tf: {
|
|
5991
|
+
type: Object,
|
|
5992
|
+
default: null
|
|
5993
|
+
},
|
|
5944
5994
|
tensorflow: {
|
|
5945
5995
|
type: Object
|
|
5946
5996
|
}
|
|
5947
5997
|
},
|
|
5948
5998
|
emits: [ "loaded", "play", "error", "detector" ],
|
|
5949
5999
|
setup(props, {emit: emit, expose: expose}) {
|
|
5950
|
-
const {lang: lang} = useLocale(), localeLang = {
|
|
6000
|
+
const _tf = props.tf || window.tf, {lang: lang} = useLocale(), localeLang = {
|
|
5951
6001
|
"zh-cn": zhCN,
|
|
5952
6002
|
en: En,
|
|
5953
6003
|
"zh-tw": zhTW
|
|
@@ -5980,34 +6030,35 @@
|
|
|
5980
6030
|
default: () => vue.h(camera_default)
|
|
5981
6031
|
}) ])
|
|
5982
6032
|
});
|
|
5983
|
-
player.value.on("loadedmetadata", (
|
|
6033
|
+
player.value.on("loadedmetadata", () => {
|
|
5984
6034
|
vue.render(screenshotBtn, container);
|
|
5985
|
-
})
|
|
6035
|
+
});
|
|
5986
6036
|
}, _loadModelDetectFrame = (container, video) => {
|
|
5987
6037
|
if (!props.tensorflow) return;
|
|
6038
|
+
if (!_tf) throw new Error("请先引入 @tensorflow/tfjs 模块!");
|
|
5988
6039
|
const {modelUrl: modelUrl, classNames: classNames} = props.tensorflow;
|
|
5989
6040
|
if (!modelUrl) throw new Error("模型文件地址不能未空!");
|
|
5990
6041
|
if (!classNames || !classNames.length) throw new Error("模型类别不能未空!");
|
|
5991
|
-
container.innerHTML = "",
|
|
6042
|
+
container.innerHTML = "", _tf?.loadGraphModel(modelUrl).then(model => {
|
|
5992
6043
|
const canvas = document.createElement("canvas");
|
|
5993
6044
|
canvas.className = ns$4.b("recongition"), container.appendChild(canvas);
|
|
5994
6045
|
const ctx = canvas.getContext("2d"), detect_ctx = document.createElement("canvas").getContext("2d");
|
|
5995
6046
|
video.ontimeupdate = () => {
|
|
5996
6047
|
const {videoWidth: videoWidth, videoHeight: videoHeight, offsetTop: offsetTop, offsetLeft: offsetLeft} = video;
|
|
5997
6048
|
canvas.width = videoWidth, canvas.height = videoHeight, canvas.style.top = offsetTop + "px",
|
|
5998
|
-
canvas.style.left = offsetLeft + "px", detectVideoFrame(video, model, ctx,
|
|
6049
|
+
canvas.style.left = offsetLeft + "px", detectVideoFrame(video, model, ctx, _tf, classNames, [], detect_ctx);
|
|
5999
6050
|
}, modelRef.value = model, detectFrameCanvas.value = canvas;
|
|
6000
|
-
})
|
|
6051
|
+
});
|
|
6001
6052
|
};
|
|
6002
|
-
vue.onUnmounted((
|
|
6003
|
-
modelRef.value && (
|
|
6053
|
+
vue.onUnmounted(() => {
|
|
6054
|
+
modelRef.value && (_tf?.dispose(), modelRef.value.dispose(), modelRef.value = null),
|
|
6004
6055
|
player.value && (player.value.mse && (player.value.mse.endOfStream(), player.value.mse.unload(),
|
|
6005
6056
|
player.value.mse = null), player.value.pause(), player.value.dispose(), player.value = null),
|
|
6006
6057
|
playerFlv.value && (playerFlv.value.pause(), playerFlv.value.unload(), playerFlv.value.detachMediaElement(),
|
|
6007
6058
|
playerFlv.value.destroy(), playerFlv.value = null), playerMpgets.value && (playerMpgets.value.pause(),
|
|
6008
6059
|
playerMpgets.value.unload(), playerMpgets.value.detachMediaElement(), playerMpgets.value.destroy(),
|
|
6009
6060
|
playerMpgets.value = null), videoBoxRef.value && vue.render(null, videoBoxRef.value);
|
|
6010
|
-
})
|
|
6061
|
+
});
|
|
6011
6062
|
const switchVideo = url => {
|
|
6012
6063
|
if (!url) return (() => {
|
|
6013
6064
|
const container = videoBoxRef.value, video = document.createElement("video");
|
|
@@ -6022,9 +6073,9 @@
|
|
|
6022
6073
|
sources: []
|
|
6023
6074
|
});
|
|
6024
6075
|
const canvasContainer = document.createElement("div");
|
|
6025
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6076
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6026
6077
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6027
|
-
})
|
|
6078
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6028
6079
|
player: player.value,
|
|
6029
6080
|
video: video
|
|
6030
6081
|
});
|
|
@@ -6053,9 +6104,9 @@
|
|
|
6053
6104
|
};
|
|
6054
6105
|
player.value = videojs(video, options);
|
|
6055
6106
|
const canvasContainer = document.createElement("div");
|
|
6056
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6107
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6057
6108
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6058
|
-
})
|
|
6109
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6059
6110
|
player: player.value,
|
|
6060
6111
|
video: video
|
|
6061
6112
|
});
|
|
@@ -6076,9 +6127,9 @@
|
|
|
6076
6127
|
};
|
|
6077
6128
|
player.value = videojs(video, options);
|
|
6078
6129
|
const canvasContainer = document.createElement("div");
|
|
6079
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6130
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6080
6131
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6081
|
-
})
|
|
6132
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6082
6133
|
player: player.value,
|
|
6083
6134
|
video: video
|
|
6084
6135
|
});
|
|
@@ -6102,13 +6153,13 @@
|
|
|
6102
6153
|
type: "flv",
|
|
6103
6154
|
isLive: !0,
|
|
6104
6155
|
url: url
|
|
6105
|
-
}), playerMpgets.value.attachMediaElement(video), playerMpgets.value.load(), playerMpgets.value.on("error", (
|
|
6156
|
+
}), playerMpgets.value.attachMediaElement(video), playerMpgets.value.load(), playerMpgets.value.on("error", () => {
|
|
6106
6157
|
emit("error", video);
|
|
6107
|
-
})
|
|
6158
|
+
}), _createScreenshotBtn(container);
|
|
6108
6159
|
const canvasContainer = document.createElement("div");
|
|
6109
|
-
container.children[0].appendChild(canvasContainer), playerMpgets.value.on("metadata_arrived", (
|
|
6160
|
+
container.children[0].appendChild(canvasContainer), playerMpgets.value.on("metadata_arrived", () => {
|
|
6110
6161
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6111
|
-
})
|
|
6162
|
+
}), emit("loaded", {
|
|
6112
6163
|
player: player.value,
|
|
6113
6164
|
video: video
|
|
6114
6165
|
});
|
|
@@ -6136,19 +6187,19 @@
|
|
|
6136
6187
|
url: url
|
|
6137
6188
|
}), playerFlv.value.attachMediaElement(video), playerFlv.value.load());
|
|
6138
6189
|
const canvasContainer = document.createElement("div");
|
|
6139
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6190
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6140
6191
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6141
|
-
})
|
|
6192
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6142
6193
|
player: player.value,
|
|
6143
6194
|
video: video
|
|
6144
6195
|
});
|
|
6145
6196
|
})(url);
|
|
6146
6197
|
};
|
|
6147
|
-
vue.onMounted((
|
|
6148
|
-
vue.nextTick((
|
|
6198
|
+
vue.onMounted(() => {
|
|
6199
|
+
vue.nextTick(() => {
|
|
6149
6200
|
switchVideo(videoSrc);
|
|
6150
|
-
})
|
|
6151
|
-
})
|
|
6201
|
+
});
|
|
6202
|
+
});
|
|
6152
6203
|
expose({
|
|
6153
6204
|
getElement: () => {
|
|
6154
6205
|
const container = videoBoxRef.value, palyerContainer = container.children[0];
|
|
@@ -6336,7 +6387,7 @@
|
|
|
6336
6387
|
canvasHeight: canvasHeight
|
|
6337
6388
|
};
|
|
6338
6389
|
};
|
|
6339
|
-
var ContextMenuLabel = vue.defineComponent({
|
|
6390
|
+
var ContextMenuLabel$1 = vue.defineComponent({
|
|
6340
6391
|
props: {
|
|
6341
6392
|
labelRect: {
|
|
6342
6393
|
type: Object,
|
|
@@ -6358,10 +6409,10 @@
|
|
|
6358
6409
|
}, onDelete = () => {
|
|
6359
6410
|
emit("delete", props.activateRect);
|
|
6360
6411
|
}, activateIndex = vue.ref();
|
|
6361
|
-
vue.watch((
|
|
6412
|
+
vue.watch(() => props.activateRect, () => {
|
|
6362
6413
|
const {type: type} = props.activateRect;
|
|
6363
6414
|
activateIndex.value = isValueExist(type) ? type : null;
|
|
6364
|
-
}
|
|
6415
|
+
}, {
|
|
6365
6416
|
deep: !0,
|
|
6366
6417
|
immediate: !0
|
|
6367
6418
|
});
|
|
@@ -6369,18 +6420,18 @@
|
|
|
6369
6420
|
width: 0,
|
|
6370
6421
|
height: 0
|
|
6371
6422
|
});
|
|
6372
|
-
vue.onMounted((
|
|
6423
|
+
vue.onMounted(() => {
|
|
6373
6424
|
const {clientWidth: clientWidth, clientHeight: clientHeight} = labelMenuRef.value;
|
|
6374
6425
|
labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
|
|
6375
|
-
})
|
|
6376
|
-
const labelMenuRef = vue.ref(), labelStyleFixed = vue.computed((
|
|
6426
|
+
});
|
|
6427
|
+
const labelMenuRef = vue.ref(), labelStyleFixed = vue.computed(() => {
|
|
6377
6428
|
const {left: left, top: top} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - window.innerHeight;
|
|
6378
6429
|
let y = top;
|
|
6379
6430
|
return height_diff > 0 && (y -= height_diff), {
|
|
6380
6431
|
top: y + "px",
|
|
6381
6432
|
left: left + "px"
|
|
6382
6433
|
};
|
|
6383
|
-
})
|
|
6434
|
+
}), renderContent = () => vue.createVNode("div", {
|
|
6384
6435
|
ref: labelMenuRef,
|
|
6385
6436
|
class: [ ns.b("contextmenu-label") ],
|
|
6386
6437
|
style: labelStyleFixed.value
|
|
@@ -6395,7 +6446,7 @@
|
|
|
6395
6446
|
default: () => [ vue.createVNode(close_default, null, null) ]
|
|
6396
6447
|
}) ]), vue.createVNode("ul", {
|
|
6397
6448
|
class: "label-main"
|
|
6398
|
-
}, [ props.classes.map((
|
|
6449
|
+
}, [ props.classes.map((name, index) => vue.createVNode("li", {
|
|
6399
6450
|
key: index,
|
|
6400
6451
|
onClick: () => (index => {
|
|
6401
6452
|
activateIndex.value = index, emit("select", index);
|
|
@@ -6408,7 +6459,7 @@
|
|
|
6408
6459
|
"background-color": colors$1[index % colors$1.length]
|
|
6409
6460
|
},
|
|
6410
6461
|
class: "label-line"
|
|
6411
|
-
}, null), vue.createVNode("span", null, [ name ]) ]))
|
|
6462
|
+
}, null), vue.createVNode("span", null, [ name ]) ])) ]), isValueExist(activateIndex.value) ? vue.createVNode("div", {
|
|
6412
6463
|
style: "margin: 10px auto 0"
|
|
6413
6464
|
}, [ vue.createVNode(elementPlus.ElButton, {
|
|
6414
6465
|
icon: delete_default,
|
|
@@ -6458,12 +6509,12 @@
|
|
|
6458
6509
|
});
|
|
6459
6510
|
}
|
|
6460
6511
|
notifyObservers(scale, offset) {
|
|
6461
|
-
this.observers.forEach(
|
|
6512
|
+
this.observers.forEach(listener => {
|
|
6462
6513
|
listener({
|
|
6463
6514
|
scale: scale,
|
|
6464
6515
|
...offset
|
|
6465
6516
|
});
|
|
6466
|
-
})
|
|
6517
|
+
});
|
|
6467
6518
|
}
|
|
6468
6519
|
changeZoom(callback) {
|
|
6469
6520
|
this.observers.push(callback);
|
|
@@ -6619,12 +6670,12 @@
|
|
|
6619
6670
|
rect.value.rectWidth = newWidth;
|
|
6620
6671
|
}
|
|
6621
6672
|
};
|
|
6622
|
-
return vue.onMounted((
|
|
6673
|
+
return vue.onMounted(() => {
|
|
6623
6674
|
parentRect = props.parentEl.getBoundingClientRect(), document.addEventListener("mousemove", onMousemove),
|
|
6624
6675
|
document.addEventListener("mouseup", onMouseup);
|
|
6625
|
-
})
|
|
6676
|
+
}), vue.onUnmounted(() => {
|
|
6626
6677
|
document.removeEventListener("mousemove", onMousemove), document.removeEventListener("mouseup", onMouseup);
|
|
6627
|
-
})
|
|
6678
|
+
}), {
|
|
6628
6679
|
onMousedown: e => {
|
|
6629
6680
|
e.preventDefault(), isDraggle.value = !0, draggleOffset.value.diff_x = e.offsetX,
|
|
6630
6681
|
draggleOffset.value.diff_y = e.offsetY;
|
|
@@ -6721,11 +6772,11 @@
|
|
|
6721
6772
|
const _labels = deepClone(labels.value);
|
|
6722
6773
|
let yolo_label = [];
|
|
6723
6774
|
return {
|
|
6724
|
-
rects: _labels.map(
|
|
6775
|
+
rects: _labels.map(rect => {
|
|
6725
6776
|
delete rect.typeName;
|
|
6726
6777
|
const label_rect = convertToLabel(rect);
|
|
6727
6778
|
return yolo_label.push(label_rect.join(" ")), vue.toRaw(rect);
|
|
6728
|
-
})
|
|
6779
|
+
}),
|
|
6729
6780
|
label_txt: yolo_label.join("\n")
|
|
6730
6781
|
};
|
|
6731
6782
|
}, setContainerWidthHeight = (canvasWidth, canvasHeight) => {
|
|
@@ -6761,11 +6812,11 @@
|
|
|
6761
6812
|
originHeight: image.height
|
|
6762
6813
|
};
|
|
6763
6814
|
})(image);
|
|
6764
|
-
labels.value = ((rowInfo, originWidth, originHeight) => rowInfo.labels ? rowInfo.labels.map(
|
|
6815
|
+
labels.value = ((rowInfo, originWidth, originHeight) => rowInfo.labels ? rowInfo.labels.map(rect => {
|
|
6765
6816
|
const typeName = props.classes[rect.type];
|
|
6766
6817
|
return typeName && (rect.typeName = typeName), rect.originWidth || (rect.originWidth = originWidth),
|
|
6767
6818
|
rect.originHeight || (rect.originHeight = originHeight), rect;
|
|
6768
|
-
})
|
|
6819
|
+
}) : [])(rowInfo, originWidth, originHeight), image.style.width = canvasWidth + "px",
|
|
6769
6820
|
image.style.height = canvasHeight + "px", setContainerWidthHeight(canvasWidth, canvasHeight),
|
|
6770
6821
|
labels.value = ((labels, canvasHeight) => {
|
|
6771
6822
|
let scale_rects = [];
|
|
@@ -6891,7 +6942,7 @@
|
|
|
6891
6942
|
canvas: canvasRectRef.value,
|
|
6892
6943
|
originWidth: originWidth,
|
|
6893
6944
|
originHeight: originHeight
|
|
6894
|
-
}, (
|
|
6945
|
+
}, (rect, {endX: endX, endY: endY}) => {
|
|
6895
6946
|
activate_add_label.value = rect;
|
|
6896
6947
|
const newRect = ((rect, scaleOffset) => {
|
|
6897
6948
|
const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect, {scale: scale, x: x, y: y} = scaleOffset;
|
|
@@ -6907,51 +6958,51 @@
|
|
|
6907
6958
|
};
|
|
6908
6959
|
})(rect, scaleTranslateManager.scaleTranslate.value);
|
|
6909
6960
|
drawBaseCanvas.value.addDrawRect(newRect), updateContextmenuLabelFixed(endX, endY, newRect);
|
|
6910
|
-
}
|
|
6961
|
+
}, () => {
|
|
6911
6962
|
onCloseDraggableRectFixed();
|
|
6912
|
-
})
|
|
6963
|
+
});
|
|
6913
6964
|
drawBaseCanvas.value.clearCanvasRect = clearCanvas, drawBaseCanvas.value.removeEventAll = removeEventAll,
|
|
6914
|
-
canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom(
|
|
6965
|
+
canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom(scaleOffset => {
|
|
6915
6966
|
scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawBaseCanvas.value.updateLabels();
|
|
6916
|
-
})
|
|
6967
|
+
});
|
|
6917
6968
|
}, image.onerror = () => {
|
|
6918
6969
|
loadingImage.value = !1;
|
|
6919
6970
|
};
|
|
6920
6971
|
}
|
|
6921
|
-
canvasBaseRef.value.addEventListener("contextmenu",
|
|
6972
|
+
canvasBaseRef.value.addEventListener("contextmenu", e => {
|
|
6922
6973
|
e.preventDefault();
|
|
6923
6974
|
const offsetX = e.offsetX, offsetY = e.offsetY, {scale: scale, x: x, y: y} = scaleTranslateManager.scaleTranslate.value, new_x = Math.floor((offsetX - x) / scale), new_y = Math.floor((offsetY - y) / scale), {hit_rect: hit_rect} = drawBaseCanvas.value.hitCanvasLabel(new_x, new_y);
|
|
6924
|
-
onCloseContentmenuLabel(), onCloseDraggableRectFixed(), hit_rect && vue.nextTick((
|
|
6975
|
+
onCloseContentmenuLabel(), onCloseDraggableRectFixed(), hit_rect && vue.nextTick(() => {
|
|
6925
6976
|
updateContextmenuLabelFixed(offsetX, offsetY, hit_rect);
|
|
6926
|
-
})
|
|
6927
|
-
})
|
|
6977
|
+
});
|
|
6978
|
+
}), canvasBaseRef.value.addEventListener("click", e => {
|
|
6928
6979
|
if (e.ctrlKey) return;
|
|
6929
6980
|
const offsetX = e.offsetX, offsetY = e.offsetY, {scale: scale, x: x, y: y} = scaleTranslateManager.scaleTranslate.value, new_x = Math.floor((offsetX - x) / scale), new_y = Math.floor((offsetY - y) / scale), {hit_rect: hit_rect, hit_index: hit_index, color: color} = drawBaseCanvas.value.hitCanvasLabel(new_x, new_y);
|
|
6930
|
-
onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && vue.nextTick((
|
|
6981
|
+
onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && vue.nextTick(() => {
|
|
6931
6982
|
updateDraggableRectFixed(offsetX, offsetY, hit_rect, hit_index, color);
|
|
6932
|
-
})
|
|
6933
|
-
})
|
|
6983
|
+
});
|
|
6984
|
+
});
|
|
6934
6985
|
};
|
|
6935
|
-
vue.onMounted((
|
|
6936
|
-
vue.watch((
|
|
6986
|
+
vue.onMounted(() => {
|
|
6987
|
+
vue.watch(() => props.rowInfo, info => {
|
|
6937
6988
|
const rowInfo = vue.toRaw(info);
|
|
6938
6989
|
renderImageLabel(rowInfo);
|
|
6939
|
-
}
|
|
6990
|
+
}, {
|
|
6940
6991
|
deep: !0,
|
|
6941
6992
|
immediate: !0
|
|
6942
|
-
}), vue.watch((
|
|
6993
|
+
}), vue.watch(() => props.classes, () => {
|
|
6943
6994
|
const rowInfo = vue.toRaw(props.rowInfo);
|
|
6944
6995
|
renderImageLabel(rowInfo);
|
|
6945
|
-
})
|
|
6996
|
+
}), vue.watch(() => props.contextClientHeight, height => {
|
|
6946
6997
|
if (valueExist(height)) {
|
|
6947
6998
|
canvasMainRef.value.style.height = height + "px";
|
|
6948
6999
|
const rowInfo = vue.toRaw(props.rowInfo);
|
|
6949
7000
|
renderImageLabel(rowInfo);
|
|
6950
7001
|
}
|
|
6951
|
-
})
|
|
6952
|
-
})
|
|
7002
|
+
});
|
|
7003
|
+
}), vue.onUnmounted(() => {
|
|
6953
7004
|
drawBaseCanvas.value.removeEventAll?.(), canvasDragZoom.value.destroy();
|
|
6954
|
-
})
|
|
7005
|
+
});
|
|
6955
7006
|
const contextmenuLabelFixed = vue.ref({
|
|
6956
7007
|
show: !1,
|
|
6957
7008
|
top: 0,
|
|
@@ -6967,7 +7018,7 @@
|
|
|
6967
7018
|
contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
|
|
6968
7019
|
contextmenuLabelFixed.value.activateRect = null, activate_add_label.value = null,
|
|
6969
7020
|
drawBaseCanvas.value.updateLabels(), drawBaseCanvas.value.clearCanvasRect();
|
|
6970
|
-
}, contextmenuLabelRect = vue.computed((
|
|
7021
|
+
}, contextmenuLabelRect = vue.computed(() => {
|
|
6971
7022
|
const {top: top, left: left, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = contextmenuLabelFixed.value;
|
|
6972
7023
|
return {
|
|
6973
7024
|
top: top,
|
|
@@ -6975,7 +7026,7 @@
|
|
|
6975
7026
|
canvasWidth: canvasWidth,
|
|
6976
7027
|
canvasHeight: canvasHeight
|
|
6977
7028
|
};
|
|
6978
|
-
})
|
|
7029
|
+
}), draggableRectFixed = vue.ref({
|
|
6979
7030
|
show: !1,
|
|
6980
7031
|
top: 0,
|
|
6981
7032
|
left: 0,
|
|
@@ -6995,27 +7046,27 @@
|
|
|
6995
7046
|
draggableRectFixed.value.activateIndex = null, draggableRectFixed.value.color = null;
|
|
6996
7047
|
}, onDraggleRectResize = rect => {
|
|
6997
7048
|
draggableRectFixed.value.activateRect = rect;
|
|
6998
|
-
const i = labels.value.findIndex(
|
|
7049
|
+
const i = labels.value.findIndex(o => isEqual(o, rect));
|
|
6999
7050
|
i > -1 && labels.value.splice(i, 1, rect), drawBaseCanvas.value.updateLabels();
|
|
7000
7051
|
const {rects: rects, label_txt: label_txt} = formatLabelsType();
|
|
7001
7052
|
_emit("change", rects, label_txt), emit("change", rects, label_txt);
|
|
7002
7053
|
}, onContextmenuDraggable = (e, rect) => {
|
|
7003
7054
|
e.preventDefault();
|
|
7004
7055
|
const rect_x = e.offsetX, rect_y = e.offsetY, x = rect_x + rect.startX, y = rect_y + rect.startY;
|
|
7005
|
-
onCloseContentmenuLabel(), vue.nextTick((
|
|
7056
|
+
onCloseContentmenuLabel(), vue.nextTick(() => {
|
|
7006
7057
|
updateContextmenuLabelFixed(x, y, rect);
|
|
7007
|
-
})
|
|
7058
|
+
});
|
|
7008
7059
|
}, activate_add_label = vue.ref(), onSelectLabel = type => {
|
|
7009
7060
|
activate_add_label.value.type = type;
|
|
7010
7061
|
const typeName = props.classes[type];
|
|
7011
7062
|
typeName && (activate_add_label.value.typeName = typeName);
|
|
7012
|
-
const i = labels.value.findIndex(
|
|
7063
|
+
const i = labels.value.findIndex(o => isEqual(o, activate_add_label.value));
|
|
7013
7064
|
i > -1 ? labels.value.splice(i, 1, activate_add_label.value) : labels.value.push(activate_add_label.value),
|
|
7014
7065
|
onCloseContentmenuLabel();
|
|
7015
7066
|
const {rects: rects, label_txt: label_txt} = formatLabelsType();
|
|
7016
7067
|
_emit("change", rects, label_txt), emit("change", rects, label_txt);
|
|
7017
7068
|
}, onDeleteLabel = rect => {
|
|
7018
|
-
const i = labels.value.findIndex(
|
|
7069
|
+
const i = labels.value.findIndex(o => isEqual(o, rect));
|
|
7019
7070
|
labels.value.splice(i, 1), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
|
|
7020
7071
|
drawBaseCanvas.value.updateLabels();
|
|
7021
7072
|
const {rects: rects, label_txt: label_txt} = formatLabelsType();
|
|
@@ -7025,18 +7076,18 @@
|
|
|
7025
7076
|
onCloseDraggableRectFixed: onCloseDraggableRectFixed,
|
|
7026
7077
|
onCloseContentmenuLabel: onCloseContentmenuLabel,
|
|
7027
7078
|
onSelectedLabel: (rect, index) => {
|
|
7028
|
-
onCloseDraggableRectFixed(), vue.nextTick((
|
|
7079
|
+
onCloseDraggableRectFixed(), vue.nextTick(() => {
|
|
7029
7080
|
const {startX: x, startY: y, type: type} = rect, color = colors$1[type];
|
|
7030
7081
|
updateDraggableRectFixed(x, y, labels.value[index], index, color);
|
|
7031
|
-
})
|
|
7082
|
+
});
|
|
7032
7083
|
},
|
|
7033
7084
|
onDeleteLabel: onDeleteLabel,
|
|
7034
7085
|
rerenderImage: () => {
|
|
7035
7086
|
setContainerWidthHeight(0, 0), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
|
|
7036
|
-
vue.nextTick((
|
|
7087
|
+
vue.nextTick(() => {
|
|
7037
7088
|
const rowInfo = vue.toRaw(props.rowInfo);
|
|
7038
7089
|
renderImageLabel(rowInfo);
|
|
7039
|
-
})
|
|
7090
|
+
});
|
|
7040
7091
|
},
|
|
7041
7092
|
resetScaleOffset: () => {
|
|
7042
7093
|
canvasDragZoom.value.reset();
|
|
@@ -7056,7 +7107,7 @@
|
|
|
7056
7107
|
}, null), vue.createVNode("canvas", {
|
|
7057
7108
|
ref: canvasRectRef,
|
|
7058
7109
|
class: [ ns.be("canvas", "rect") ]
|
|
7059
|
-
}, null), contextmenuLabelFixed.value.show ? vue.createVNode(ContextMenuLabel, {
|
|
7110
|
+
}, null), contextmenuLabelFixed.value.show ? vue.createVNode(ContextMenuLabel$1, {
|
|
7060
7111
|
labelRect: contextmenuLabelRect.value,
|
|
7061
7112
|
classes: props.classes,
|
|
7062
7113
|
activateRect: contextmenuLabelFixed.value.activateRect,
|
|
@@ -7072,7 +7123,7 @@
|
|
|
7072
7123
|
}, null) : null ]) ]
|
|
7073
7124
|
}) ]);
|
|
7074
7125
|
}
|
|
7075
|
-
}), RightLabel = vue.defineComponent({
|
|
7126
|
+
}), RightLabel$1 = vue.defineComponent({
|
|
7076
7127
|
props: {
|
|
7077
7128
|
contentHeight: {
|
|
7078
7129
|
type: Number
|
|
@@ -7088,16 +7139,16 @@
|
|
|
7088
7139
|
},
|
|
7089
7140
|
emits: [ "delete", "select" ],
|
|
7090
7141
|
setup(props, {emit: emit}) {
|
|
7091
|
-
const {t: t} = useLocale(), ns = vue.inject("ns", {}), labels = vue.ref([]), formatLabelsTypeName = labels => labels.length ? labels.map(
|
|
7142
|
+
const {t: t} = useLocale(), ns = vue.inject("ns", {}), labels = vue.ref([]), formatLabelsTypeName = labels => labels.length ? labels.map(rect => {
|
|
7092
7143
|
const typeName = props.classes[rect.type];
|
|
7093
7144
|
return typeName && (rect.typeName = typeName), rect;
|
|
7094
|
-
})
|
|
7095
|
-
vue.watch((
|
|
7145
|
+
}) : [];
|
|
7146
|
+
vue.watch(() => props.classes, () => {
|
|
7096
7147
|
labels.value = formatLabelsTypeName(labels.value);
|
|
7097
|
-
})
|
|
7148
|
+
}), vue.watch(() => props.labels, rects => {
|
|
7098
7149
|
const _rects = vue.toRaw(rects);
|
|
7099
7150
|
labels.value = formatLabelsTypeName(_rects);
|
|
7100
|
-
}
|
|
7151
|
+
}, {
|
|
7101
7152
|
deep: !0,
|
|
7102
7153
|
immediate: !0
|
|
7103
7154
|
});
|
|
@@ -7106,7 +7157,7 @@
|
|
|
7106
7157
|
style: {
|
|
7107
7158
|
height: props.contentHeight + "px"
|
|
7108
7159
|
}
|
|
7109
|
-
}, [ labels.value.length ? vue.createVNode("ul", null, [ labels.value.map((
|
|
7160
|
+
}, [ labels.value.length ? vue.createVNode("ul", null, [ labels.value.map((rect, index) => vue.createVNode("li", {
|
|
7110
7161
|
key: index,
|
|
7111
7162
|
onClick: () => ((rect, index) => {
|
|
7112
7163
|
emit("select", rect, index);
|
|
@@ -7132,8 +7183,8 @@
|
|
|
7132
7183
|
}, {
|
|
7133
7184
|
default: () => [ vue.createVNode(delete_default, null, null) ]
|
|
7134
7185
|
})
|
|
7135
|
-
}) ]))
|
|
7136
|
-
"image-size":
|
|
7186
|
+
}) ])) ]) : vue.createVNode(elementPlus.ElEmpty, {
|
|
7187
|
+
"image-size": 100,
|
|
7137
7188
|
description: t("next.labelimg.emptyLabelText")
|
|
7138
7189
|
}, null) ]);
|
|
7139
7190
|
return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
|
|
@@ -7168,47 +7219,47 @@
|
|
|
7168
7219
|
},
|
|
7169
7220
|
emits: [ "change", "save", "prev-click", "next-click" ],
|
|
7170
7221
|
setup(props, {emit: emit, slots: slots, expose: expose}) {
|
|
7171
|
-
const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = vue.computed((
|
|
7222
|
+
const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = vue.computed(() => {
|
|
7172
7223
|
const cfg = vue.unref(props.options);
|
|
7173
7224
|
return merge(_config, cfg);
|
|
7174
|
-
})
|
|
7225
|
+
}), options = vue.unref(_options);
|
|
7175
7226
|
vue.provide("ns", ns$2), vue.provide("_emit", emit);
|
|
7176
7227
|
const activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes), labelImages = vue.ref(deepClone(props.data));
|
|
7177
|
-
vue.watch((
|
|
7228
|
+
vue.watch(() => props.data, data => {
|
|
7178
7229
|
labelImages.value = deepClone(data);
|
|
7179
|
-
}
|
|
7230
|
+
}, {
|
|
7180
7231
|
deep: !0
|
|
7181
|
-
}), vue.watch((
|
|
7232
|
+
}), vue.watch(() => props.data.length, () => {
|
|
7182
7233
|
activateNodeIndex.value = 0;
|
|
7183
|
-
})
|
|
7234
|
+
}), vue.watch(() => props.classes, val => {
|
|
7184
7235
|
classes.value = val;
|
|
7185
|
-
}
|
|
7236
|
+
}, {
|
|
7186
7237
|
deep: !0
|
|
7187
7238
|
});
|
|
7188
|
-
const currentNode = vue.computed((
|
|
7239
|
+
const currentNode = vue.computed(() => {
|
|
7189
7240
|
if (!labelImages.value) return {};
|
|
7190
7241
|
const node = labelImages.value[activateNodeIndex.value] || {};
|
|
7191
7242
|
return deepClone(node);
|
|
7192
|
-
})
|
|
7193
|
-
vue.watch((
|
|
7243
|
+
}), activateNodeLabels = vue.ref(currentNode.value.labels || []);
|
|
7244
|
+
vue.watch(() => currentNode.value, () => {
|
|
7194
7245
|
activateNodeLabels.value = currentNode.value.labels || [];
|
|
7195
|
-
})
|
|
7246
|
+
});
|
|
7196
7247
|
const onChangeNodeRect = rects => {
|
|
7197
7248
|
currentNode.value.labels = rects, activateNodeLabels.value = rects;
|
|
7198
7249
|
}, loading = vue.ref(!1), formatNodeLabels = () => {
|
|
7199
7250
|
const node = currentNode.value;
|
|
7200
7251
|
let yolo_label = [];
|
|
7201
|
-
return node.labels.forEach(
|
|
7252
|
+
return node.labels.forEach(rect => {
|
|
7202
7253
|
delete rect.typeName;
|
|
7203
7254
|
const label_rect = convertToLabel(rect);
|
|
7204
7255
|
yolo_label.push(label_rect.join(" "));
|
|
7205
|
-
})
|
|
7256
|
+
}), {
|
|
7206
7257
|
node: node,
|
|
7207
7258
|
label_txt: yolo_label.join("\n")
|
|
7208
7259
|
};
|
|
7209
7260
|
}, isChangeNodeLabels = () => {
|
|
7210
7261
|
const node = labelImages.value[activateNodeIndex.value];
|
|
7211
|
-
return isEqual(vue.toRaw(node.labels).map(
|
|
7262
|
+
return isEqual(vue.toRaw(node.labels).map(rect => convertToLabel(rect)), currentNode.value.labels.map(rect => convertToLabel(rect)));
|
|
7212
7263
|
}, switchKeydownAD = e => {
|
|
7213
7264
|
const imageLength = labelImages.value.length;
|
|
7214
7265
|
"KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
|
|
@@ -7223,12 +7274,12 @@
|
|
|
7223
7274
|
emit("save", {
|
|
7224
7275
|
node: node,
|
|
7225
7276
|
label_txt: label_txt
|
|
7226
|
-
},
|
|
7277
|
+
}, imageItem => {
|
|
7227
7278
|
labelImages.value[activateNodeIndex.value] = imageItem || node, switchKeydownAD(e),
|
|
7228
7279
|
loading.value = !1;
|
|
7229
|
-
}
|
|
7280
|
+
}, () => {
|
|
7230
7281
|
loading.value = !1;
|
|
7231
|
-
})
|
|
7282
|
+
});
|
|
7232
7283
|
}, onChangeActivateNode = index => {
|
|
7233
7284
|
if (loading.value) return;
|
|
7234
7285
|
loading.value = !0;
|
|
@@ -7237,16 +7288,16 @@
|
|
|
7237
7288
|
loading.value = !1, !1) : (emit("save", {
|
|
7238
7289
|
node: node,
|
|
7239
7290
|
label_txt: label_txt
|
|
7240
|
-
},
|
|
7291
|
+
}, imageItem => {
|
|
7241
7292
|
labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
|
|
7242
7293
|
loading.value = !1, scaleTranslate.value = {
|
|
7243
7294
|
scale: 1,
|
|
7244
7295
|
x: 0,
|
|
7245
7296
|
y: 0
|
|
7246
7297
|
};
|
|
7247
|
-
}
|
|
7298
|
+
}, () => {
|
|
7248
7299
|
loading.value = !1;
|
|
7249
|
-
})
|
|
7300
|
+
}), !0);
|
|
7250
7301
|
}, onPaginationPrev = () => {
|
|
7251
7302
|
const imageLength = labelImages.value.length;
|
|
7252
7303
|
let i = activateNodeIndex.value - 1;
|
|
@@ -7256,26 +7307,26 @@
|
|
|
7256
7307
|
let i = activateNodeIndex.value + 1;
|
|
7257
7308
|
i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
|
|
7258
7309
|
}, canvasContextRef = vue.ref(), layoutLabelRef = vue.ref(), headerRef = vue.ref(), mainRef = vue.ref(), footerRef = vue.ref(), mainContentHeight = vue.ref(options.minContentHeight), updateMainContentHeight = () => {
|
|
7259
|
-
vue.nextTick((
|
|
7310
|
+
vue.nextTick(() => {
|
|
7260
7311
|
const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
|
|
7261
7312
|
mainContentHeight.value = contentHeight;
|
|
7262
|
-
})
|
|
7313
|
+
});
|
|
7263
7314
|
};
|
|
7264
|
-
vue.onMounted((
|
|
7265
|
-
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (
|
|
7315
|
+
vue.onMounted(() => {
|
|
7316
|
+
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, () => {
|
|
7266
7317
|
updateMainContentHeight();
|
|
7267
|
-
})
|
|
7268
|
-
})
|
|
7318
|
+
}), window.addEventListener("resize", updateMainContentHeight);
|
|
7319
|
+
}), vue.onUnmounted(() => {
|
|
7269
7320
|
document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
|
|
7270
|
-
})
|
|
7321
|
+
});
|
|
7271
7322
|
const onSelectLabelNode = (rect, index) => {
|
|
7272
7323
|
canvasContextRef.value.onSelectedLabel(rect, index);
|
|
7273
7324
|
}, onDeleteLabelNode = rect => {
|
|
7274
7325
|
canvasContextRef.value.onDeleteLabel(rect);
|
|
7275
7326
|
}, isFullscreen = vue.ref(!1), onSwitchFillscreen = val => {
|
|
7276
|
-
isFullscreen.value = val, updateMainContentHeight(), vue.nextTick((
|
|
7327
|
+
isFullscreen.value = val, updateMainContentHeight(), vue.nextTick(() => {
|
|
7277
7328
|
canvasContextRef.value.rerenderImage();
|
|
7278
|
-
})
|
|
7329
|
+
});
|
|
7279
7330
|
}, scaleTranslate = vue.ref({
|
|
7280
7331
|
scale: 1,
|
|
7281
7332
|
x: 0,
|
|
@@ -7337,7 +7388,7 @@
|
|
|
7337
7388
|
rowInfo: currentNode.value,
|
|
7338
7389
|
onChange: onChangeNodeRect
|
|
7339
7390
|
}, null) ]) ]
|
|
7340
|
-
}), vue.createVNode(RightLabel, {
|
|
7391
|
+
}), vue.createVNode(RightLabel$1, {
|
|
7341
7392
|
contentHeight: mainContentHeight.value,
|
|
7342
7393
|
classes: classes.value,
|
|
7343
7394
|
labels: activateNodeLabels.value,
|
|
@@ -7359,7 +7410,7 @@
|
|
|
7359
7410
|
}, [ vue.createVNode(elementPlus.ElScrollbar, null, {
|
|
7360
7411
|
default: () => [ vue.createVNode("ul", {
|
|
7361
7412
|
class: [ ns$2.bem("footer", "center", "list") ]
|
|
7362
|
-
}, [ labelImages.value.map((
|
|
7413
|
+
}, [ labelImages.value.map((item, index) => vue.createVNode("li", {
|
|
7363
7414
|
key: index,
|
|
7364
7415
|
onClick: () => onChangeActivateNode(index),
|
|
7365
7416
|
class: {
|
|
@@ -7372,7 +7423,7 @@
|
|
|
7372
7423
|
"max-scale": 2,
|
|
7373
7424
|
"min-scale": .2,
|
|
7374
7425
|
fit: "cover"
|
|
7375
|
-
}, null) ]))
|
|
7426
|
+
}, null) ])) ]) ]
|
|
7376
7427
|
}) ]), vue.createVNode("div", {
|
|
7377
7428
|
class: [ ns$2.be("footer", "right") ]
|
|
7378
7429
|
}, [ vue.createVNode(elementPlus.ElIcon, {
|
|
@@ -7438,13 +7489,13 @@
|
|
|
7438
7489
|
};
|
|
7439
7490
|
}
|
|
7440
7491
|
};
|
|
7441
|
-
vue.onMounted((
|
|
7442
|
-
vue.watch((
|
|
7492
|
+
vue.onMounted(() => {
|
|
7493
|
+
vue.watch(() => props.src, () => {
|
|
7443
7494
|
renderImageAndLabel();
|
|
7444
|
-
}
|
|
7495
|
+
}, {
|
|
7445
7496
|
immediate: !0
|
|
7446
7497
|
});
|
|
7447
|
-
})
|
|
7498
|
+
});
|
|
7448
7499
|
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
|
|
7449
7500
|
class: [ ns$1.b(), props.className ],
|
|
7450
7501
|
style: {
|
|
@@ -7455,74 +7506,275 @@
|
|
|
7455
7506
|
}, null) ]) ]);
|
|
7456
7507
|
}
|
|
7457
7508
|
});
|
|
7458
|
-
const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview)
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
notifyVertexChangeListeners() {
|
|
7484
|
-
this.vertexesObservers.forEach((listener => {
|
|
7485
|
-
listener(this.vertexes, this.mouseOffset);
|
|
7486
|
-
}));
|
|
7487
|
-
}
|
|
7488
|
-
vertexesChangeEventListener(listener) {
|
|
7489
|
-
this.vertexesObservers.push(listener);
|
|
7490
|
-
}
|
|
7491
|
-
notifyDestryedListerers() {
|
|
7492
|
-
this.destroyedObservers(this.vertexes);
|
|
7493
|
-
}
|
|
7494
|
-
onDestroyed(callback) {
|
|
7495
|
-
this.destroyedObservers = callback;
|
|
7496
|
-
}
|
|
7497
|
-
canvasMouseClick(e) {
|
|
7498
|
-
e.stopPropagation(), this.isDrawing = !0, this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY;
|
|
7499
|
-
const [x, y] = [ e.offsetX, e.offsetY ];
|
|
7500
|
-
let is_add = !0;
|
|
7501
|
-
for (let i = 0; i < this.vertexes.length; i++) {
|
|
7502
|
-
const p = this.vertexes[i];
|
|
7503
|
-
if (Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2) < 8) {
|
|
7504
|
-
is_add = !1;
|
|
7505
|
-
break;
|
|
7506
|
-
}
|
|
7509
|
+
const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview);
|
|
7510
|
+
var ShapeType, ToolsHandleType;
|
|
7511
|
+
!function(ShapeType) {
|
|
7512
|
+
ShapeType.Polygon = "polygon", ShapeType.Rectangle = "rectangle", ShapeType.Circle = "circle";
|
|
7513
|
+
}(ShapeType || (ShapeType = {})), function(ToolsHandleType) {
|
|
7514
|
+
ToolsHandleType.CREATE_POLYGON = "createPolygon", ToolsHandleType.EDIT_SHAPE = "editShape",
|
|
7515
|
+
ToolsHandleType.CREATE_RECTANGLE = "createRectangle", ToolsHandleType.CREATE_CIRCLE = "createCircle";
|
|
7516
|
+
}(ToolsHandleType || (ToolsHandleType = {}));
|
|
7517
|
+
const colors = [ "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ];
|
|
7518
|
+
var defaultConfig = {
|
|
7519
|
+
minContentHeight: 500
|
|
7520
|
+
};
|
|
7521
|
+
var ContextMenuLabel = vue.defineComponent({
|
|
7522
|
+
props: {
|
|
7523
|
+
fixed: {
|
|
7524
|
+
type: Object,
|
|
7525
|
+
default: () => ({})
|
|
7526
|
+
},
|
|
7527
|
+
classes: {
|
|
7528
|
+
type: Array,
|
|
7529
|
+
default: () => []
|
|
7530
|
+
},
|
|
7531
|
+
activateShape: {
|
|
7532
|
+
type: Object,
|
|
7533
|
+
default: null
|
|
7507
7534
|
}
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7535
|
+
},
|
|
7536
|
+
emits: [ "close", "select", "delete" ],
|
|
7537
|
+
setup(props, {emit: emit}) {
|
|
7538
|
+
const {t: t} = useLocale(), ns = vue.inject("ns", {}), groupId = vue.ref(props.activateShape.group_id || ""), description = vue.ref(props.activateShape.description || ""), onClose = () => {
|
|
7539
|
+
emit("close");
|
|
7540
|
+
}, onDelete = () => {
|
|
7541
|
+
emit("delete", props.activateShape);
|
|
7542
|
+
}, activateIndex = vue.ref();
|
|
7543
|
+
vue.watch(() => props.activateShape, () => {
|
|
7544
|
+
const {label: label} = props.activateShape;
|
|
7545
|
+
activateIndex.value = isValueExist(label) ? label : null;
|
|
7546
|
+
}, {
|
|
7547
|
+
deep: !0,
|
|
7548
|
+
immediate: !0
|
|
7549
|
+
});
|
|
7550
|
+
const labelRectWidthHeight = vue.ref({
|
|
7551
|
+
width: 0,
|
|
7552
|
+
height: 0
|
|
7553
|
+
});
|
|
7554
|
+
vue.onMounted(() => {
|
|
7555
|
+
const {clientWidth: clientWidth, clientHeight: clientHeight} = labelMenuRef.value;
|
|
7556
|
+
labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
|
|
7557
|
+
});
|
|
7558
|
+
const labelMenuRef = vue.ref(), labelStyleFixed = vue.computed(() => {
|
|
7559
|
+
const {left: left, top: top} = props.fixed, height_diff = top + labelRectWidthHeight.value.height - window.innerHeight;
|
|
7560
|
+
let y = top;
|
|
7561
|
+
return height_diff > 0 && (y -= height_diff), {
|
|
7562
|
+
top: y + "px",
|
|
7563
|
+
left: left + "px"
|
|
7564
|
+
};
|
|
7565
|
+
}), renderContent = () => {
|
|
7566
|
+
let _slot;
|
|
7567
|
+
return vue.createVNode(vue.Teleport, {
|
|
7568
|
+
to: "body"
|
|
7569
|
+
}, {
|
|
7570
|
+
default: () => {
|
|
7571
|
+
return [ vue.createVNode("div", {
|
|
7572
|
+
ref: labelMenuRef,
|
|
7573
|
+
class: [ ns.b("contextmenu-label") ],
|
|
7574
|
+
style: labelStyleFixed.value
|
|
7575
|
+
}, [ vue.createVNode("div", {
|
|
7576
|
+
class: "label-head"
|
|
7577
|
+
}, [ vue.createVNode("span", {
|
|
7578
|
+
style: "padding-right: 30px"
|
|
7579
|
+
}, [ t("next.labelme.selectClasses") ]), vue.createVNode(elementPlus.ElIcon, {
|
|
7580
|
+
size: 16,
|
|
7581
|
+
onClick: onClose
|
|
7582
|
+
}, {
|
|
7583
|
+
default: () => [ vue.createVNode(close_default, null, null) ]
|
|
7584
|
+
}) ]), props.classes.length ? vue.createVNode(vue.Fragment, null, [ vue.createVNode(elementPlus.ElInput, {
|
|
7585
|
+
modelValue: groupId.value,
|
|
7586
|
+
"onUpdate:modelValue": $event => groupId.value = $event,
|
|
7587
|
+
placeholder: t("next.labelme.labelGroupId"),
|
|
7588
|
+
size: "small",
|
|
7589
|
+
maxLength: 30
|
|
7590
|
+
}, null), vue.createVNode("ul", {
|
|
7591
|
+
class: "label-main"
|
|
7592
|
+
}, [ props.classes.map((name, index) => vue.createVNode("li", {
|
|
7593
|
+
key: index,
|
|
7594
|
+
onClick: () => (label => {
|
|
7595
|
+
activateIndex.value = label;
|
|
7596
|
+
const shape = {
|
|
7597
|
+
...props.activateShape,
|
|
7598
|
+
label: label,
|
|
7599
|
+
description: description.value,
|
|
7600
|
+
group_id: groupId.value
|
|
7601
|
+
};
|
|
7602
|
+
emit("select", label, shape);
|
|
7603
|
+
})(name),
|
|
7604
|
+
class: {
|
|
7605
|
+
"activate-label": activateIndex.value === name
|
|
7606
|
+
}
|
|
7607
|
+
}, [ vue.createVNode("span", {
|
|
7608
|
+
style: {
|
|
7609
|
+
"background-color": colors[index % colors.length]
|
|
7610
|
+
},
|
|
7611
|
+
class: "label-line"
|
|
7612
|
+
}, null), vue.createVNode("span", null, [ name ]) ])) ]), vue.createVNode(elementPlus.ElInput, {
|
|
7613
|
+
modelValue: description.value,
|
|
7614
|
+
"onUpdate:modelValue": $event => description.value = $event,
|
|
7615
|
+
placeholder: t("next.labelme.labelDescription"),
|
|
7616
|
+
size: "small",
|
|
7617
|
+
type: "textarea",
|
|
7618
|
+
rows: 2,
|
|
7619
|
+
resize: "none",
|
|
7620
|
+
maxLength: 100
|
|
7621
|
+
}, null) ]) : vue.createVNode(elementPlus.ElEmpty, {
|
|
7622
|
+
"image-size": 50,
|
|
7623
|
+
description: t("next.labelme.emptyClassesText"),
|
|
7624
|
+
style: {
|
|
7625
|
+
padding: 0
|
|
7626
|
+
}
|
|
7627
|
+
}, null), isValueExist(activateIndex.value) ? vue.createVNode("div", {
|
|
7628
|
+
style: "margin: 10px auto 0"
|
|
7629
|
+
}, [ vue.createVNode(elementPlus.ElButton, {
|
|
7630
|
+
icon: delete_default,
|
|
7631
|
+
plain: !0,
|
|
7632
|
+
size: "small",
|
|
7633
|
+
type: "danger",
|
|
7634
|
+
onClick: onDelete
|
|
7635
|
+
}, (s = _slot = t("next.labelme.deleteClasses"), "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? _slot : {
|
|
7636
|
+
default: () => [ _slot ]
|
|
7637
|
+
})) ]) : null ]) ];
|
|
7638
|
+
var s;
|
|
7639
|
+
}
|
|
7640
|
+
});
|
|
7641
|
+
};
|
|
7642
|
+
return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
|
|
7643
|
+
}
|
|
7644
|
+
});
|
|
7645
|
+
const printsToPath = vertexes => {
|
|
7646
|
+
const path = new Path2D;
|
|
7647
|
+
if (vertexes.length) {
|
|
7648
|
+
path.moveTo(vertexes[0][0], vertexes[0][1]);
|
|
7649
|
+
for (let i = 1; i < vertexes.length; i++) {
|
|
7650
|
+
const [x, y] = vertexes[i];
|
|
7651
|
+
path.lineTo(x, y);
|
|
7652
|
+
}
|
|
7653
|
+
}
|
|
7654
|
+
return path;
|
|
7655
|
+
}, isPointInPath = (px, py, vertexes, ctx) => {
|
|
7656
|
+
const path = printsToPath(vertexes);
|
|
7657
|
+
return path.closePath(), ctx.isPointInPath(path, px, py);
|
|
7658
|
+
}, 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)), getTranslateAndScale = ctx => {
|
|
7659
|
+
const transformMatrix = ctx.getTransform(), {a: scaleX, b: skewY, e: translateX, f: translateY} = transformMatrix;
|
|
7660
|
+
return {
|
|
7661
|
+
scale: Math.hypot(scaleX, skewY),
|
|
7662
|
+
translateX: translateX,
|
|
7663
|
+
translateY: translateY
|
|
7664
|
+
};
|
|
7665
|
+
}, vertexesToImageScale = (vertexes, scaleX, scaleY, isMultiply = !0) => vertexes?.length ? vertexes.map(item => ((vertex, scaleX, scaleY, isMultiply = !0) => {
|
|
7666
|
+
const [x, y] = vertex;
|
|
7667
|
+
return isMultiply ? [ x * scaleX, y * scaleY ] : [ x / scaleX, y / scaleY ];
|
|
7668
|
+
})(item, scaleX, scaleY, isMultiply)) : [], vertexeTransform = (vertex, scaleOffset) => {
|
|
7669
|
+
const {scale: scale, x: offsetX, y: offsetY} = scaleOffset, [x, y] = vertex;
|
|
7670
|
+
return [ (x - offsetX) / scale, (y - offsetY) / scale ];
|
|
7671
|
+
}, {hexToRgba: hexToRgba$2} = useChangeColor();
|
|
7672
|
+
class CreatePolygon {
|
|
7673
|
+
canvas;
|
|
7674
|
+
ctx;
|
|
7675
|
+
vertexes;
|
|
7676
|
+
isDrawing;
|
|
7677
|
+
mouseOffset;
|
|
7678
|
+
vertexesObservers=[];
|
|
7679
|
+
destroyedObservers=[];
|
|
7680
|
+
constructor(canvas, ctx) {
|
|
7681
|
+
this.canvas = canvas, this.ctx = ctx, this.isDrawing = !1, this.vertexes = [], this.mouseOffset = {
|
|
7682
|
+
x: 0,
|
|
7683
|
+
y: 0
|
|
7684
|
+
}, this.vertexes = new Proxy(this.vertexes, {
|
|
7685
|
+
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7686
|
+
!0)
|
|
7687
|
+
}), this.mouseOffset = new Proxy(this.mouseOffset, {
|
|
7688
|
+
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7689
|
+
!0)
|
|
7690
|
+
}), this.canvasMouseClick = this.canvasMouseClick.bind(this), this.canvasMouseDblclick = this.canvasMouseDblclick.bind(this),
|
|
7691
|
+
this.canvasMousemove = this.canvasMousemove.bind(this);
|
|
7692
|
+
}
|
|
7693
|
+
notifyVertexChangeListeners() {
|
|
7694
|
+
this.vertexesObservers.forEach(listener => {
|
|
7695
|
+
listener(this.vertexes, this.mouseOffset);
|
|
7696
|
+
});
|
|
7697
|
+
}
|
|
7698
|
+
vertexesChangeEventListener(listener) {
|
|
7699
|
+
this.vertexesObservers.push(listener);
|
|
7700
|
+
}
|
|
7701
|
+
notifyAddCompletedListener() {
|
|
7702
|
+
this.destroyedObservers.forEach(listener => {
|
|
7703
|
+
listener(this.vertexes, this.mouseOffset);
|
|
7704
|
+
});
|
|
7705
|
+
}
|
|
7706
|
+
addCompleted(callback) {
|
|
7707
|
+
this.destroyedObservers.push(callback);
|
|
7708
|
+
}
|
|
7709
|
+
transformMousePoint(e) {
|
|
7710
|
+
const {scale: scale, translateX: translateX, translateY: translateY} = getTranslateAndScale(this.ctx);
|
|
7711
|
+
return vertexeTransform([ e.offsetX, e.offsetY ], {
|
|
7712
|
+
scale: scale,
|
|
7713
|
+
x: translateX,
|
|
7714
|
+
y: translateY
|
|
7715
|
+
});
|
|
7716
|
+
}
|
|
7717
|
+
triggerCreatePolygon() {
|
|
7718
|
+
this.isDrawing = !0, this.canvas.addEventListener("click", this.canvasMouseClick),
|
|
7719
|
+
this.canvas.addEventListener("mousemove", this.canvasMousemove), this.canvas.addEventListener("dblclick", this.canvasMouseDblclick);
|
|
7720
|
+
}
|
|
7721
|
+
canvasMouseClick(e) {
|
|
7722
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
7723
|
+
this.isDrawing = !0;
|
|
7724
|
+
const [x, y] = this.transformMousePoint(e);
|
|
7725
|
+
this.mouseOffset.x = x, this.mouseOffset.y = y;
|
|
7726
|
+
let is_add = !0;
|
|
7727
|
+
for (let i = 0; i < this.vertexes.length; i++) {
|
|
7728
|
+
const p = this.vertexes[i];
|
|
7729
|
+
if (Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2) < 8) {
|
|
7730
|
+
is_add = !1;
|
|
7731
|
+
break;
|
|
7732
|
+
}
|
|
7733
|
+
}
|
|
7734
|
+
is_add && this.vertexes.push([ x, y ]), this.vertexes = vertexesUnique(this.vertexes);
|
|
7735
|
+
}
|
|
7736
|
+
canvasMousemove(e) {
|
|
7737
|
+
if (e.stopPropagation(), e.preventDefault(), !e.ctrlKey && this.isDrawing) {
|
|
7738
|
+
const [x, y] = this.transformMousePoint(e);
|
|
7739
|
+
this.mouseOffset.x = x, this.mouseOffset.y = y, this.canvas.style.cursor = "crosshair";
|
|
7740
|
+
}
|
|
7741
|
+
}
|
|
7742
|
+
canvasMouseDblclick(e) {
|
|
7743
|
+
if (e.stopPropagation(), e.preventDefault(), !e.ctrlKey) {
|
|
7744
|
+
if (this.isDrawing) {
|
|
7745
|
+
this.canvas.style.cursor = "unset";
|
|
7746
|
+
const [x, y] = this.transformMousePoint(e);
|
|
7747
|
+
this.mouseOffset.x = x, this.mouseOffset.y = y, this.vertexes.push([ x, y ]), this.vertexes = vertexesUnique(this.vertexes);
|
|
7748
|
+
}
|
|
7749
|
+
this.notifyAddCompletedListener(), this.isDrawing = !1;
|
|
7750
|
+
}
|
|
7751
|
+
}
|
|
7752
|
+
drawPolygon(vertexes) {
|
|
7753
|
+
const ctx = this.ctx;
|
|
7754
|
+
if (!vertexes.length) return;
|
|
7755
|
+
const {scale: scale} = getTranslateAndScale(this.ctx);
|
|
7756
|
+
ctx.save();
|
|
7757
|
+
const {x: x, y: y} = this.mouseOffset, path = printsToPath([ ...vertexes, [ x, y ] ]);
|
|
7758
|
+
path.closePath();
|
|
7759
|
+
ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.setLineDash([ 5, 5 ]), ctx.strokeStyle = "#5470c6",
|
|
7760
|
+
ctx.fillStyle = hexToRgba$2("#5470c6", .2), ctx.stroke(path), ctx.fill(path), ctx.fillStyle = "#5470c6";
|
|
7761
|
+
for (let i = 0; i < vertexes.length; i++) {
|
|
7762
|
+
const [x, y] = vertexes[i];
|
|
7763
|
+
ctx.beginPath(), ctx.arc(x, y, 5 / scale, 0, 2 * Math.PI), ctx.fill();
|
|
7764
|
+
}
|
|
7765
|
+
ctx.restore();
|
|
7766
|
+
}
|
|
7767
|
+
reset() {
|
|
7768
|
+
this.isDrawing = !0, this.vertexes.length = 0, this.mouseOffset.x = 0, this.mouseOffset.y = 0;
|
|
7769
|
+
}
|
|
7519
7770
|
destroy() {
|
|
7520
|
-
this.isDrawing = !1, this.vertexes =
|
|
7521
|
-
|
|
7522
|
-
|
|
7771
|
+
this.isDrawing = !1, this.vertexes.length = 0, this.mouseOffset.x = 0, this.mouseOffset.y = 0,
|
|
7772
|
+
this.canvas.style.cursor = "unset", this.canvas.removeEventListener("click", this.canvasMouseClick),
|
|
7773
|
+
this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
|
|
7523
7774
|
}
|
|
7524
7775
|
}
|
|
7525
|
-
|
|
7776
|
+
const {hexToRgba: hexToRgba$1} = useChangeColor();
|
|
7777
|
+
class EditPolygon {
|
|
7526
7778
|
canvas;
|
|
7527
7779
|
ctx;
|
|
7528
7780
|
vertexes;
|
|
@@ -7539,7 +7791,9 @@
|
|
|
7539
7791
|
constructor(canvas, ctx) {
|
|
7540
7792
|
this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
|
|
7541
7793
|
this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
|
|
7542
|
-
this.vertexRadius = 8, this.edgeCentreRadius = 5, this.pointRecover = []
|
|
7794
|
+
this.vertexRadius = 8, this.edgeCentreRadius = 5, this.pointRecover = [], this.canvasMousedown = this.canvasMousedown.bind(this),
|
|
7795
|
+
this.canvasMouseup = this.canvasMouseup.bind(this), this.canvasMousemove = this.canvasMousemove.bind(this),
|
|
7796
|
+
this.canvasMouseClick = this.canvasMouseClick.bind(this);
|
|
7543
7797
|
}
|
|
7544
7798
|
notifyEditPolygonObserver() {
|
|
7545
7799
|
this.editPolygonObserver?.(this.vertexes);
|
|
@@ -7548,45 +7802,55 @@
|
|
|
7548
7802
|
this.editPolygonObserver = callback;
|
|
7549
7803
|
}
|
|
7550
7804
|
getTransformPoint(x, y) {
|
|
7551
|
-
const
|
|
7552
|
-
return [
|
|
7805
|
+
const {scale: scale, translateX: translateX, translateY: translateY} = getTranslateAndScale(this.ctx);
|
|
7806
|
+
return vertexeTransform([ x, y ], {
|
|
7807
|
+
scale: scale,
|
|
7808
|
+
x: translateX,
|
|
7809
|
+
y: translateY
|
|
7810
|
+
});
|
|
7553
7811
|
}
|
|
7554
7812
|
drawPolygonPath(vertexes, mouseX, mouseY) {
|
|
7555
7813
|
const ctx = this.ctx;
|
|
7556
7814
|
if (!vertexes.length) return;
|
|
7557
|
-
|
|
7558
|
-
ctx.
|
|
7815
|
+
const {scale: scale} = getTranslateAndScale(this.ctx);
|
|
7816
|
+
ctx.save(), ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.strokeStyle = "#5470c6",
|
|
7817
|
+
ctx.fillStyle = hexToRgba$1("#5470c6", .2), ctx.moveTo(vertexes[0][0], vertexes[0][1]);
|
|
7559
7818
|
for (let i = 1; i < vertexes.length; i++) {
|
|
7560
7819
|
const [x, y] = vertexes[i];
|
|
7561
7820
|
ctx.lineTo(x, y);
|
|
7562
7821
|
}
|
|
7563
7822
|
isNaN(mouseX) || isNaN(mouseY) || ctx.lineTo(mouseX, mouseY), ctx.closePath(), ctx.stroke(),
|
|
7564
|
-
ctx.fill();
|
|
7823
|
+
ctx.fill(), ctx.restore();
|
|
7565
7824
|
}
|
|
7566
7825
|
drawPolygonEdgeCentre(vertexes) {
|
|
7567
|
-
const ctx = this.ctx;
|
|
7826
|
+
const ctx = this.ctx, {scale: scale} = getTranslateAndScale(this.ctx), _vertexRadius = this.vertexRadius / scale, _edgeCentreRadius = this.edgeCentreRadius / scale, _vertexCentreRadius = Math.max(1, _vertexRadius - _edgeCentreRadius);
|
|
7827
|
+
ctx.save();
|
|
7568
7828
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7569
7829
|
const [x, y] = vertexes[i];
|
|
7570
|
-
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y,
|
|
7571
|
-
ctx.closePath(), ctx.fill(), ctx.beginPath(), ctx.fillStyle = "#FFFFFF", ctx.arc(x, y,
|
|
7830
|
+
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, _vertexRadius, 0, 2 * Math.PI),
|
|
7831
|
+
ctx.closePath(), ctx.fill(), ctx.beginPath(), ctx.fillStyle = "#FFFFFF", ctx.arc(x, y, _vertexCentreRadius, 0, 2 * Math.PI),
|
|
7572
7832
|
ctx.closePath(), ctx.fill();
|
|
7573
7833
|
}
|
|
7574
7834
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7575
7835
|
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;
|
|
7576
|
-
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y,
|
|
7836
|
+
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, _edgeCentreRadius, 0, 2 * Math.PI),
|
|
7577
7837
|
ctx.closePath(), ctx.fill();
|
|
7578
7838
|
}
|
|
7839
|
+
ctx.restore();
|
|
7840
|
+
}
|
|
7841
|
+
render() {
|
|
7842
|
+
this.drawPolygonPath(this.vertexes), this.drawPolygonEdgeCentre(this.vertexes);
|
|
7579
7843
|
}
|
|
7580
7844
|
drawPolygon(vertexes, mouseOffset) {
|
|
7581
7845
|
this.vertexes = vertexes, mouseOffset ? this.drawPolygonPath(vertexes, mouseOffset.x, mouseOffset.y) : (this.drawPolygonPath(vertexes),
|
|
7582
7846
|
this.drawPolygonEdgeCentre(vertexes));
|
|
7583
7847
|
}
|
|
7584
7848
|
pointInVertexes(x, y) {
|
|
7585
|
-
const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
|
|
7849
|
+
const [_x, _y] = this.getTransformPoint(x, y), {scale: scale} = getTranslateAndScale(this.ctx), _vertexRadius = this.vertexRadius / scale, vertexes = this.vertexes;
|
|
7586
7850
|
let aimIndex = null;
|
|
7587
7851
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7588
7852
|
const [vertex_x, vertex_y] = vertexes[i];
|
|
7589
|
-
if (isPointInCircle(_x, _y, vertex_x, vertex_y,
|
|
7853
|
+
if (isPointInCircle(_x, _y, vertex_x, vertex_y, _vertexRadius)) {
|
|
7590
7854
|
this.canvas.style.cursor = "pointer", aimIndex = i;
|
|
7591
7855
|
break;
|
|
7592
7856
|
}
|
|
@@ -7595,11 +7859,11 @@
|
|
|
7595
7859
|
return aimIndex;
|
|
7596
7860
|
}
|
|
7597
7861
|
pointInEdgeCentre(x, y) {
|
|
7598
|
-
const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
|
|
7862
|
+
const [_x, _y] = this.getTransformPoint(x, y), {scale: scale} = getTranslateAndScale(this.ctx), _edgeCentreRadius = this.edgeCentreRadius / scale, vertexes = this.vertexes;
|
|
7599
7863
|
let aimIndex = null;
|
|
7600
7864
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7601
7865
|
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;
|
|
7602
|
-
if (isPointInCircle(_x, _y, vertex_x, vertex_y,
|
|
7866
|
+
if (isPointInCircle(_x, _y, vertex_x, vertex_y, _edgeCentreRadius)) {
|
|
7603
7867
|
this.canvas.style.cursor = "pointer", aimIndex = i;
|
|
7604
7868
|
break;
|
|
7605
7869
|
}
|
|
@@ -7608,9 +7872,9 @@
|
|
|
7608
7872
|
return aimIndex;
|
|
7609
7873
|
}
|
|
7610
7874
|
pointInVertexesOrEdgeCentre(x, y) {
|
|
7611
|
-
const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
|
|
7875
|
+
const [_x, _y] = this.getTransformPoint(x, y), {scale: scale} = getTranslateAndScale(this.ctx), _vertexRadius = this.vertexRadius / scale, _edgeCentreRadius = this.edgeCentreRadius / scale, vertexes = this.vertexes;
|
|
7612
7876
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7613
|
-
const [vertex_x, vertex_y] = vertexes[i], isInVertex = isPointInCircle(_x, _y, vertex_x, vertex_y,
|
|
7877
|
+
const [vertex_x, vertex_y] = vertexes[i], isInVertex = isPointInCircle(_x, _y, vertex_x, vertex_y, _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, _edgeCentreRadius);
|
|
7614
7878
|
if (isInVertex || isInEdgeCenter) {
|
|
7615
7879
|
this.canvas.style.cursor = "pointer";
|
|
7616
7880
|
break;
|
|
@@ -7619,17 +7883,18 @@
|
|
|
7619
7883
|
}
|
|
7620
7884
|
}
|
|
7621
7885
|
notifyObservers() {
|
|
7622
|
-
this.observers.forEach(
|
|
7886
|
+
this.observers.forEach(listener => {
|
|
7623
7887
|
listener(this.vertexes);
|
|
7624
|
-
})
|
|
7888
|
+
});
|
|
7625
7889
|
}
|
|
7626
7890
|
updatePolygon(callback) {
|
|
7627
|
-
this.isEditing = !0, this.canvas.addEventListener("mousedown", this.canvasMousedown
|
|
7628
|
-
this.canvas.addEventListener("mouseup", this.canvasMouseup
|
|
7629
|
-
this.canvas.addEventListener("
|
|
7891
|
+
this.isEditing = !0, this.canvas.addEventListener("mousedown", this.canvasMousedown),
|
|
7892
|
+
this.canvas.addEventListener("mouseup", this.canvasMouseup), this.canvas.addEventListener("mousemove", this.canvasMousemove),
|
|
7893
|
+
this.canvas.addEventListener("click", this.canvasMouseClick), this.observers.push(callback);
|
|
7630
7894
|
}
|
|
7631
7895
|
canvasMousedown(e) {
|
|
7632
|
-
e.stopPropagation(), e.preventDefault(),
|
|
7896
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
7897
|
+
this.canClickEvent = !0;
|
|
7633
7898
|
const {offsetX: x, offsetY: y} = e;
|
|
7634
7899
|
this.pointRecover = [ x, y ];
|
|
7635
7900
|
const vertex_i = this.pointInVertexes(x, y);
|
|
@@ -7637,13 +7902,13 @@
|
|
|
7637
7902
|
this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
|
|
7638
7903
|
const i = this.pointInEdgeCentre(x, y);
|
|
7639
7904
|
isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ])),
|
|
7640
|
-
setTimeout((
|
|
7905
|
+
setTimeout(() => {
|
|
7641
7906
|
this.canClickEvent = !1;
|
|
7642
|
-
}
|
|
7907
|
+
}, 200);
|
|
7643
7908
|
}
|
|
7644
7909
|
canvasMouseup(e) {
|
|
7645
|
-
e.stopPropagation(), e.preventDefault();
|
|
7646
|
-
let {offsetX:
|
|
7910
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
7911
|
+
let {offsetX: offsetX, offsetY: offsetY} = e, [x, y] = this.getTransformPoint(offsetX, offsetY);
|
|
7647
7912
|
this.vertexes = vertexesUnique(this.vertexes);
|
|
7648
7913
|
for (let i = 0; i < this.vertexes.length; i++) {
|
|
7649
7914
|
const p = this.vertexes[i], radius = Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2);
|
|
@@ -7658,7 +7923,7 @@
|
|
|
7658
7923
|
this.drawPolygon(this.vertexes), this.notifyObservers(), this.notifyEditPolygonObserver();
|
|
7659
7924
|
}
|
|
7660
7925
|
canvasMouseClick(e) {
|
|
7661
|
-
e.stopPropagation();
|
|
7926
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
7662
7927
|
const {offsetX: x, offsetY: y} = e;
|
|
7663
7928
|
if (this.canClickEvent) {
|
|
7664
7929
|
const i = this.pointInVertexes(x, y);
|
|
@@ -7670,124 +7935,205 @@
|
|
|
7670
7935
|
}
|
|
7671
7936
|
}
|
|
7672
7937
|
canvasMousemove(e) {
|
|
7673
|
-
e.stopPropagation();
|
|
7674
|
-
const {offsetX:
|
|
7675
|
-
this.pointInVertexesOrEdgeCentre(
|
|
7938
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
7939
|
+
const {offsetX: offsetX, offsetY: offsetY} = e;
|
|
7940
|
+
this.pointInVertexesOrEdgeCentre(offsetX, offsetY);
|
|
7941
|
+
const [x, y] = this.getTransformPoint(offsetX, offsetY);
|
|
7942
|
+
this.isMoveEditing && (this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
|
|
7676
7943
|
this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
|
|
7677
7944
|
this.notifyObservers());
|
|
7678
7945
|
}
|
|
7679
7946
|
destroy() {
|
|
7680
7947
|
this.vertexes = [], this.observers = [], this.isEditing = !1, this.canvas.removeEventListener("mousedown", this.canvasMousedown),
|
|
7681
|
-
this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("
|
|
7682
|
-
this.canvas.removeEventListener("
|
|
7948
|
+
this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("mousemove", this.canvasMousemove),
|
|
7949
|
+
this.canvas.removeEventListener("click", this.canvasMouseClick);
|
|
7683
7950
|
}
|
|
7684
7951
|
}
|
|
7952
|
+
const {hexToRgba: hexToRgba} = useChangeColor();
|
|
7685
7953
|
class CreateDrawCanvas {
|
|
7686
7954
|
canvas;
|
|
7687
7955
|
ctx;
|
|
7688
7956
|
image;
|
|
7689
7957
|
canvasWidth;
|
|
7690
7958
|
canvasHeight;
|
|
7691
|
-
|
|
7959
|
+
imageScaleX;
|
|
7960
|
+
imageScaleY;
|
|
7692
7961
|
labels;
|
|
7693
|
-
|
|
7694
|
-
scaleY;
|
|
7962
|
+
createPolygon;
|
|
7695
7963
|
editDrawPolygon;
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7964
|
+
addVertexes=[];
|
|
7965
|
+
createCompleteSubscribers=new Set;
|
|
7966
|
+
editingShape;
|
|
7967
|
+
editVertexes=[];
|
|
7968
|
+
editingSubscribers=new Set;
|
|
7700
7969
|
constructor(options) {
|
|
7701
|
-
const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight,
|
|
7970
|
+
const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, imageScaleX: imageScaleX, imageScaleY: imageScaleY, labels: labels} = options;
|
|
7702
7971
|
this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
|
|
7703
|
-
this.canvasHeight = canvasHeight, this.
|
|
7704
|
-
this.
|
|
7705
|
-
this.
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
this.
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
})
|
|
7717
|
-
|
|
7972
|
+
this.canvasHeight = canvasHeight, this.imageScaleX = imageScaleX, this.imageScaleY = imageScaleY,
|
|
7973
|
+
this.labels = labels || {}, this.createPolygon = new CreatePolygon(canvas, ctx),
|
|
7974
|
+
this.editDrawPolygon = new EditPolygon(canvas, ctx), this.createPolygon.vertexesChangeEventListener(vertexes => {
|
|
7975
|
+
this.render(), this.createPolygon.drawPolygon(vertexes), this.addVertexes = vertexes;
|
|
7976
|
+
}), this.createPolygon.addCompleted((vertexes, mouseOffset) => {
|
|
7977
|
+
this.addVertexes = vertexes;
|
|
7978
|
+
const {scale: scale, translateX: translateX, translateY: translateY} = getTranslateAndScale(this.ctx), [x, y] = ((vertex, scaleOffset) => {
|
|
7979
|
+
const {scale: scale, x: offsetX, y: offsetY} = scaleOffset, [x, y] = vertex;
|
|
7980
|
+
return [ x * scale + offsetX, y * scale + offsetY ];
|
|
7981
|
+
})([ mouseOffset.x, mouseOffset.y ], {
|
|
7982
|
+
scale: scale,
|
|
7983
|
+
x: translateX,
|
|
7984
|
+
y: translateY
|
|
7985
|
+
});
|
|
7986
|
+
this.notifyCreateComplete({
|
|
7987
|
+
x: x,
|
|
7988
|
+
y: y
|
|
7989
|
+
});
|
|
7990
|
+
}), this.render(), this.onMouseDown = this.onMouseDown.bind(this), this.onMouseMove = this.onMouseMove.bind(this),
|
|
7991
|
+
this.onMouseUp = this.onMouseUp.bind(this), this.onMouseClick = this.onMouseClick.bind(this),
|
|
7992
|
+
this.onMouseDoubleClick = this.onMouseDoubleClick.bind(this);
|
|
7718
7993
|
}
|
|
7719
|
-
|
|
7720
|
-
this.
|
|
7721
|
-
listener(this.editVertexes);
|
|
7722
|
-
}));
|
|
7994
|
+
subscribeCreateComplete(callback) {
|
|
7995
|
+
this.createCompleteSubscribers.add(callback);
|
|
7723
7996
|
}
|
|
7724
|
-
|
|
7725
|
-
this.
|
|
7997
|
+
unsubscribeCreateComplete(callback) {
|
|
7998
|
+
this.createCompleteSubscribers.delete(callback);
|
|
7726
7999
|
}
|
|
7727
|
-
|
|
7728
|
-
this.
|
|
8000
|
+
notifyCreateComplete(mouseOffset) {
|
|
8001
|
+
this.createCompleteSubscribers.forEach(listener => {
|
|
8002
|
+
listener(this.addVertexes, mouseOffset);
|
|
8003
|
+
});
|
|
8004
|
+
}
|
|
8005
|
+
createPolygonEventListener() {
|
|
8006
|
+
this.createPolygon.triggerCreatePolygon();
|
|
8007
|
+
}
|
|
8008
|
+
subscribeEditing(callback) {
|
|
8009
|
+
this.editingSubscribers.add(callback);
|
|
8010
|
+
}
|
|
8011
|
+
unsubscribeEditing(callback) {
|
|
8012
|
+
this.editingSubscribers.delete(callback);
|
|
8013
|
+
}
|
|
8014
|
+
notifyEditing() {
|
|
8015
|
+
this.editingSubscribers.forEach(listener => {
|
|
8016
|
+
listener(this.editVertexes, this.editingShape);
|
|
8017
|
+
});
|
|
8018
|
+
}
|
|
8019
|
+
resetAllInstance() {
|
|
8020
|
+
this.createPolygon.destroy(), this.editDrawPolygon.destroy(), this.onEditorEnd();
|
|
7729
8021
|
}
|
|
7730
|
-
|
|
7731
|
-
this.
|
|
8022
|
+
closeCreateOrEditor() {
|
|
8023
|
+
this.createPolygon.reset();
|
|
7732
8024
|
}
|
|
7733
|
-
|
|
7734
|
-
const ctx = this.ctx, {scale: scale} =
|
|
8025
|
+
drawShapes(shapes) {
|
|
8026
|
+
const ctx = this.ctx, {scale: scale} = getTranslateAndScale(ctx);
|
|
7735
8027
|
for (let i = 0; i < shapes.length; i++) {
|
|
7736
|
-
const
|
|
7737
|
-
if (
|
|
7738
|
-
const
|
|
7739
|
-
|
|
7740
|
-
const
|
|
7741
|
-
ctx.
|
|
7742
|
-
|
|
7743
|
-
const [x, y] = path[i];
|
|
7744
|
-
ctx.lineTo(x, y);
|
|
7745
|
-
}
|
|
7746
|
-
ctx.closePath(), ctx.stroke(), ctx.fill();
|
|
8028
|
+
const shape = shapes[i];
|
|
8029
|
+
if (shape.id === this.editingShape?.id) continue;
|
|
8030
|
+
const points = vertexesToImageScale(shape.points, this.imageScaleX, this.imageScaleY);
|
|
8031
|
+
if (!points.length) continue;
|
|
8032
|
+
const path = printsToPath(points), color = colors[i % colors.length];
|
|
8033
|
+
path.closePath(), ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.strokeStyle = color,
|
|
8034
|
+
ctx.fillStyle = hexToRgba(color, .2), ctx.stroke(path), ctx.fill(path);
|
|
7747
8035
|
}
|
|
7748
8036
|
}
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
8037
|
+
updateTransform(scaleOffseet) {
|
|
8038
|
+
const ctx = this.ctx, {scale: scale, x: x, y: y} = scaleOffseet;
|
|
8039
|
+
ctx.translate(x, y), ctx.scale(scale, scale);
|
|
8040
|
+
}
|
|
8041
|
+
updateLabelInfo(labelInfo) {
|
|
8042
|
+
this.labels = labelInfo, this.render();
|
|
8043
|
+
}
|
|
8044
|
+
addShape(shape) {
|
|
8045
|
+
this.labels.shapes.push(shape), this.render(), this.createPolygon.reset();
|
|
8046
|
+
}
|
|
8047
|
+
deleteShape(shape) {
|
|
8048
|
+
const index = this.labels.shapes.findIndex(item => item.id === shape.id);
|
|
8049
|
+
-1 !== index && this.labels.shapes.splice(index, 1);
|
|
8050
|
+
}
|
|
7755
8051
|
render=() => {
|
|
7756
|
-
|
|
7757
|
-
|
|
8052
|
+
const ctx = this.ctx;
|
|
8053
|
+
ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight), ctx.drawImage(this.image, 0, 0, this.canvasWidth, this.canvasHeight),
|
|
8054
|
+
ctx.save();
|
|
8055
|
+
const shapes = this.labels.shapes;
|
|
8056
|
+
shapes?.length && this.drawShapes(shapes), this.editDrawPolygon.render(), ctx.restore();
|
|
7758
8057
|
};
|
|
8058
|
+
mouseHitShape(event) {
|
|
8059
|
+
const {offsetX: x, offsetY: y} = event, shapes = this.labels.shapes;
|
|
8060
|
+
let hit = !1, hitShape = null;
|
|
8061
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
8062
|
+
const shape = shapes[i], points = vertexesToImageScale(shape.points, this.imageScaleX, this.imageScaleY);
|
|
8063
|
+
if (points.length && shape.shape_type === ShapeType.Polygon) {
|
|
8064
|
+
if (isPointInPath(x, y, points, this.ctx)) {
|
|
8065
|
+
hit = !0, hitShape = shape;
|
|
8066
|
+
break;
|
|
8067
|
+
}
|
|
8068
|
+
}
|
|
8069
|
+
}
|
|
8070
|
+
return this.canvas.style.cursor = hit ? "pointer" : "default", hitShape;
|
|
8071
|
+
}
|
|
8072
|
+
triggerShapeEdit(shape) {
|
|
8073
|
+
this.render(), this.editDrawPolygon.destroy(), this.editingShape = shape, this.render();
|
|
8074
|
+
const points = vertexesToImageScale(shape.points, this.imageScaleX, this.imageScaleY);
|
|
8075
|
+
this.editDrawPolygon.drawPolygon(points), this.editDrawPolygon.updatePolygon(vertexes => {
|
|
8076
|
+
this.editVertexes = vertexes, this.render();
|
|
8077
|
+
}), this.editDrawPolygon.onEditPolygon(vertexes => {
|
|
8078
|
+
this.editVertexes = vertexes, this.notifyEditing();
|
|
8079
|
+
});
|
|
8080
|
+
}
|
|
8081
|
+
onMouseDoubleClick(e) {
|
|
8082
|
+
e.stopPropagation(), e.preventDefault();
|
|
8083
|
+
this.mouseHitShape(e) || (this.editingShape = null, this.editVertexes = [], this.editDrawPolygon.destroy(),
|
|
8084
|
+
this.render());
|
|
8085
|
+
}
|
|
8086
|
+
onMouseClick(e) {
|
|
8087
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
8088
|
+
const hitShape = this.mouseHitShape(e);
|
|
8089
|
+
this.editVertexes.length && !hitShape || (hitShape ? this.triggerShapeEdit(hitShape) : (this.editingShape = null,
|
|
8090
|
+
this.editVertexes = [], this.editDrawPolygon.destroy(), this.render()));
|
|
8091
|
+
}
|
|
8092
|
+
onMouseDown(e) {
|
|
8093
|
+
e.stopPropagation(), e.preventDefault(), this.mouseHitShape(e), e.ctrlKey;
|
|
8094
|
+
}
|
|
8095
|
+
onMouseMove(e) {
|
|
8096
|
+
e.stopPropagation(), e.preventDefault(), e.ctrlKey || this.editingShape || this.mouseHitShape(e);
|
|
8097
|
+
}
|
|
8098
|
+
onMouseUp(e) {
|
|
8099
|
+
e.stopPropagation(), e.preventDefault(), e.ctrlKey || this.mouseHitShape(e);
|
|
8100
|
+
}
|
|
8101
|
+
onEditorStart() {
|
|
8102
|
+
this.canvas.addEventListener("mousedown", this.onMouseDown), this.canvas.addEventListener("mousemove", this.onMouseMove),
|
|
8103
|
+
this.canvas.addEventListener("mouseup", this.onMouseUp), this.canvas.addEventListener("click", this.onMouseClick),
|
|
8104
|
+
this.canvas.addEventListener("dblclick", this.onMouseDoubleClick);
|
|
8105
|
+
}
|
|
8106
|
+
onEditorEnd() {
|
|
8107
|
+
this.editVertexes = [], this.editingShape = null, this.editDrawPolygon.destroy(),
|
|
8108
|
+
this.canvas.removeEventListener("mousedown", this.onMouseDown), this.canvas.removeEventListener("mousemove", this.onMouseMove),
|
|
8109
|
+
this.canvas.removeEventListener("mouseup", this.onMouseUp), this.canvas.removeEventListener("click", this.onMouseClick),
|
|
8110
|
+
this.canvas.removeEventListener("dblclick", this.onMouseDoubleClick);
|
|
8111
|
+
}
|
|
7759
8112
|
destroy() {
|
|
7760
|
-
this.labels = {}, this.editDrawPolygon.destroy(), this.
|
|
8113
|
+
this.labels = {}, this.editDrawPolygon.destroy(), this.createPolygon.destroy(),
|
|
8114
|
+
this.onEditorEnd();
|
|
7761
8115
|
}
|
|
7762
8116
|
}
|
|
7763
8117
|
var CanvasContext = vue.defineComponent({
|
|
7764
8118
|
props: {
|
|
7765
|
-
classes: {
|
|
7766
|
-
type: Array,
|
|
7767
|
-
default: () => []
|
|
7768
|
-
},
|
|
7769
8119
|
contextClientHeight: {
|
|
7770
8120
|
type: Number,
|
|
7771
8121
|
default: null
|
|
7772
8122
|
},
|
|
7773
|
-
|
|
8123
|
+
labelInfo: {
|
|
7774
8124
|
type: Object,
|
|
7775
8125
|
default: () => ({})
|
|
7776
8126
|
}
|
|
7777
8127
|
},
|
|
7778
|
-
emits: [ "editPolygon", "changePolygon" ],
|
|
8128
|
+
emits: [ "editPolygon", "changePolygon", "updateLabelInfo" ],
|
|
7779
8129
|
setup(props, {emit: emit, expose: expose}) {
|
|
7780
|
-
const ns = vue.inject("ns", {}), scaleTranslateManager = vue.inject("scaleTranslateManager", {}), mainBasaeRef = vue.ref(), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), canvasDragZoom = vue.ref(),
|
|
7781
|
-
canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
|
|
7782
|
-
canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
|
|
7783
|
-
canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
|
|
7784
|
-
}, loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
|
|
8130
|
+
const ns = vue.inject("ns", {}), classes = vue.inject("classes", vue.ref([])), toolsActive = vue.inject("toolsActive", {}), scaleTranslateManager = vue.inject("scaleTranslateManager", {}), mainBasaeRef = vue.ref(), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), canvasDragZoom = vue.ref(), _labelInfo = vue.ref(props.labelInfo), loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
|
|
7785
8131
|
const ctx = canvasBaseRef.value?.getContext("2d");
|
|
7786
8132
|
if (rowInfo?.imageSrc) {
|
|
7787
8133
|
const image = new Image;
|
|
7788
8134
|
image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
|
|
7789
8135
|
loadingImage.value = !1;
|
|
7790
|
-
const {canvasWidth: canvasWidth, canvasHeight: canvasHeight,
|
|
8136
|
+
const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleX: scaleX, scaleY: scaleY, originWidth: originWidth, originHeight: originHeight} = (image => {
|
|
7791
8137
|
const clientWidth = mainBasaeRef.value?.elementInstance.clientWidth, clientHeight = mainBasaeRef.value?.elementInstance.clientHeight;
|
|
7792
8138
|
let {width: width, height: height} = image, scaleFactor = 1;
|
|
7793
8139
|
const aspect_ratio = width / height;
|
|
@@ -7813,61 +8159,88 @@
|
|
|
7813
8159
|
};
|
|
7814
8160
|
})(image);
|
|
7815
8161
|
image.style.width = canvasWidth + "px", image.style.height = canvasHeight + "px",
|
|
7816
|
-
|
|
8162
|
+
((canvasWidth, canvasHeight) => {
|
|
8163
|
+
canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
|
|
8164
|
+
canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
|
|
8165
|
+
canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
|
|
8166
|
+
})(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
|
|
7817
8167
|
canvas: canvasBaseRef.value,
|
|
7818
8168
|
ctx: ctx,
|
|
7819
8169
|
image: image,
|
|
7820
8170
|
canvasWidth: canvasWidth,
|
|
7821
8171
|
canvasHeight: canvasHeight,
|
|
7822
|
-
scaleFactor: scaleFactor,
|
|
7823
8172
|
labels: rowInfo.labels,
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
8173
|
+
imageScaleX: scaleX,
|
|
8174
|
+
imageScaleY: scaleY
|
|
8175
|
+
}), canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom(scaleOffset => {
|
|
8176
|
+
scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawCanvas.value.updateTransform(scaleOffset),
|
|
8177
|
+
drawCanvas.value.render();
|
|
8178
|
+
}), drawCanvas.value.subscribeCreateComplete((vertexes, mouseOffset) => {
|
|
8179
|
+
const new_vertexes = vertexesToImageScale(vertexes, scaleX, scaleY, !1), shape = {
|
|
8180
|
+
id: timeUniqueId(),
|
|
8181
|
+
shape_type: ShapeType.Polygon,
|
|
8182
|
+
points: new_vertexes
|
|
8183
|
+
};
|
|
8184
|
+
updateContextmenuLabelFixed(mouseOffset.x, mouseOffset.y, shape);
|
|
8185
|
+
}), drawCanvas.value.subscribeEditing((vertexes, shape) => {
|
|
8186
|
+
const new_vertexes = vertexesToImageScale(vertexes, scaleX, scaleY, !1), index = _labelInfo.value.labels.shapes?.findIndex(item => item.id === shape.id);
|
|
8187
|
+
-1 !== index && (_labelInfo.value.labels.shapes[index] = {
|
|
8188
|
+
...shape,
|
|
8189
|
+
points: new_vertexes
|
|
8190
|
+
}), _labelInfo.value.labels.imageWidth = originWidth, _labelInfo.value.labels.imageHeight = originHeight,
|
|
8191
|
+
emit("editPolygon", _labelInfo.value);
|
|
8192
|
+
}), vue.watch(() => toolsActive.value, () => {
|
|
8193
|
+
drawCanvas.value.resetAllInstance(), toolsActive.value === ToolsHandleType.CREATE_POLYGON ? drawCanvas.value.createPolygonEventListener() : toolsActive.value === ToolsHandleType.EDIT_SHAPE && drawCanvas.value.onEditorStart();
|
|
8194
|
+
}, {
|
|
8195
|
+
immediate: !0
|
|
8196
|
+
});
|
|
7843
8197
|
}, image.onerror = () => {
|
|
7844
8198
|
loadingImage.value = !1;
|
|
7845
8199
|
};
|
|
7846
8200
|
}
|
|
7847
8201
|
};
|
|
7848
|
-
vue.onMounted((
|
|
7849
|
-
vue.watch((
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
deep: !0,
|
|
7854
|
-
immediate: !0
|
|
7855
|
-
}), vue.watch((() => props.contextClientHeight), (height => {
|
|
7856
|
-
if (valueExist(height)) {
|
|
7857
|
-
canvasMainRef.value.style.height = height + "px";
|
|
7858
|
-
const rowInfo = vue.toRaw(props.rowInfo);
|
|
7859
|
-
renderImageLabel(rowInfo);
|
|
7860
|
-
}
|
|
7861
|
-
}));
|
|
7862
|
-
})), vue.onUnmounted((() => {
|
|
8202
|
+
vue.onMounted(() => {
|
|
8203
|
+
renderImageLabel(_labelInfo.value), vue.watch(() => props.contextClientHeight, height => {
|
|
8204
|
+
valueExist(height) && (canvasMainRef.value.style.height = height + "px", renderImageLabel(_labelInfo.value));
|
|
8205
|
+
});
|
|
8206
|
+
}), vue.onUnmounted(() => {
|
|
7863
8207
|
drawCanvas.value.destroy(), canvasDragZoom.value.destroy();
|
|
7864
|
-
})
|
|
8208
|
+
});
|
|
8209
|
+
const contextmenuLabelFixed = vue.ref({
|
|
8210
|
+
show: !1,
|
|
8211
|
+
top: 0,
|
|
8212
|
+
left: 0,
|
|
8213
|
+
activateShape: null
|
|
8214
|
+
}), onCloseContentmenuLabel = () => {
|
|
8215
|
+
contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
|
|
8216
|
+
contextmenuLabelFixed.value.activateShape = null, drawCanvas.value.closeCreateOrEditor();
|
|
8217
|
+
}, updateContextmenuLabelFixed = (x, y, shape) => {
|
|
8218
|
+
const contextRect = canvasBaseRef.value.getBoundingClientRect();
|
|
8219
|
+
contextmenuLabelFixed.value.show = !0, contextmenuLabelFixed.value.left = x + contextRect.x,
|
|
8220
|
+
contextmenuLabelFixed.value.top = y + contextRect.y, contextmenuLabelFixed.value.canvasWidth = canvasBaseRef.value.width,
|
|
8221
|
+
contextmenuLabelFixed.value.canvasHeight = canvasBaseRef.value.height, contextmenuLabelFixed.value.activateShape = shape;
|
|
8222
|
+
}, contextmenuLabelRect = vue.computed(() => {
|
|
8223
|
+
const {top: top, left: left, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = contextmenuLabelFixed.value;
|
|
8224
|
+
return {
|
|
8225
|
+
top: top,
|
|
8226
|
+
left: left,
|
|
8227
|
+
canvasWidth: canvasWidth,
|
|
8228
|
+
canvasHeight: canvasHeight
|
|
8229
|
+
};
|
|
8230
|
+
}), onSelectLabel = (label, shape) => {
|
|
8231
|
+
const index = _labelInfo.value.labels.shapes?.findIndex(item => item.id === shape.id);
|
|
8232
|
+
-1 === index ? _labelInfo.value.labels.shapes.push(vue.toRaw(shape)) : _labelInfo.value.labels.shapes[index] = vue.toRaw(shape),
|
|
8233
|
+
emit("updateLabelInfo", _labelInfo.value), onCloseContentmenuLabel(), drawCanvas.value.updateLabelInfo(_labelInfo.value.labels);
|
|
8234
|
+
}, onDeleteLabel = shape => {
|
|
8235
|
+
const index = _labelInfo.value.labels.shapes?.findIndex(item => item.id === shape.id);
|
|
8236
|
+
-1 !== index && _labelInfo.value.labels.shapes.splice(index, 1), emit("updateLabelInfo", _labelInfo.value),
|
|
8237
|
+
onCloseContentmenuLabel(), drawCanvas.value.updateLabelInfo(_labelInfo.value.labels);
|
|
8238
|
+
};
|
|
7865
8239
|
return expose({
|
|
7866
8240
|
rerenderImage: () => {
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
}));
|
|
8241
|
+
onCloseContentmenuLabel(), vue.nextTick(() => {
|
|
8242
|
+
renderImageLabel(_labelInfo.value);
|
|
8243
|
+
});
|
|
7871
8244
|
},
|
|
7872
8245
|
resetScaleOffset: () => {
|
|
7873
8246
|
canvasDragZoom.value.reset();
|
|
@@ -7886,7 +8259,14 @@
|
|
|
7886
8259
|
}, [ vue.createVNode("canvas", {
|
|
7887
8260
|
ref: canvasBaseRef,
|
|
7888
8261
|
class: [ ns.be("canvas", "context") ]
|
|
7889
|
-
}, null)
|
|
8262
|
+
}, null), contextmenuLabelFixed.value.show ? vue.createVNode(ContextMenuLabel, {
|
|
8263
|
+
fixed: contextmenuLabelRect.value,
|
|
8264
|
+
classes: classes.value,
|
|
8265
|
+
activateShape: contextmenuLabelFixed.value.activateShape,
|
|
8266
|
+
onClose: onCloseContentmenuLabel,
|
|
8267
|
+
onSelect: onSelectLabel,
|
|
8268
|
+
onDelete: onDeleteLabel
|
|
8269
|
+
}, null) : null ]) ]
|
|
7890
8270
|
}) ]);
|
|
7891
8271
|
}
|
|
7892
8272
|
}), HeaderTool = vue.defineComponent({
|
|
@@ -7931,64 +8311,10 @@
|
|
|
7931
8311
|
"p-id": "4274"
|
|
7932
8312
|
}, null) ]), vue.createVNode("p", {
|
|
7933
8313
|
class: "label-text"
|
|
7934
|
-
}, [ t("next.labelme.saveLabel") ]) ]), vue.createVNode("
|
|
7935
|
-
class: "tool-item"
|
|
7936
|
-
}, [ vue.createVNode("svg", {
|
|
7937
|
-
t: "1721826305513",
|
|
7938
|
-
class: "icon",
|
|
7939
|
-
viewBox: "0 0 1025 1024",
|
|
7940
|
-
version: "1.1",
|
|
7941
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7942
|
-
"p-id": "6215",
|
|
7943
|
-
width: "18",
|
|
7944
|
-
height: "18"
|
|
7945
|
-
}, [ vue.createVNode("path", {
|
|
7946
|
-
d: "M358.5 1021.5c-52.93 0-96-43.07-96-96 0-13.12 2.6-25.84 7.74-37.81l0.12-0.27-141.99-184.66-0.34 0.11a95.806 95.806 0 0 1-29.53 4.64c-52.93 0-96-43.07-96-96s43.07-96 96-96c7.56 0 15.09 0.89 22.41 2.64l0.36 0.09 213.67-370.08-0.16-0.25c-9.34-15.12-14.28-32.54-14.28-50.39 0-52.93 43.07-96 96-96 40.36 0 76.66 25.5 90.34 63.46l0.09 0.26 300.27 61.72 0.19-0.26c18.01-25.16 47.21-40.18 78.11-40.18 52.93 0 96 43.07 96 96 0 36.49-20.26 69.36-52.88 85.79l-0.31 0.16 41.76 393.5 0.25 0.12a96.184 96.184 0 0 1 39.11 34.79c9.85 15.41 15.06 33.27 15.06 51.65 0 52.93-43.07 96-96 96-31.18 0-60.53-15.24-78.52-40.76l-0.22-0.31-396.7 138.78-0.05 0.29c-8.2 45.76-47.94 78.97-94.5 78.97z m0-192c34.03 0 64.82 17.44 82.36 46.66l0.21 0.35L832.93 739.4l0.03-0.32c3.81-39.11 31.82-72.49 69.7-83.05l0.41-0.11-40.34-380.14-0.34-0.08c-39.73-9.82-68.86-43.81-72.49-84.56l-0.03-0.37-283.9-58.36-0.15 0.39c-7 17.7-19.01 32.81-34.72 43.69-16.08 11.13-34.96 17.02-54.59 17.02-9.75 0-19.37-1.46-28.59-4.33l-0.38-0.12L176.19 555.1l0.19 0.26c11.86 16.42 18.12 35.83 18.12 56.14 0 17.74-4.88 35.06-14.11 50.11l-0.18 0.29 136.28 177.25 0.37-0.18c13.04-6.28 27.05-9.47 41.64-9.47z",
|
|
7947
|
-
"p-id": "6216"
|
|
7948
|
-
}, null), vue.createVNode("path", {
|
|
7949
|
-
d: "M416.5 2c40.15 0 76.26 25.37 89.87 63.13l0.19 0.53 0.55 0.11 299.68 61.6 0.64 0.13 0.38-0.53c8.66-12.1 20.19-22.15 33.34-29.06C854.71 90.77 870.06 87 885.5 87c52.66 0 95.5 42.84 95.5 95.5 0 18.03-5.05 35.58-14.6 50.77a95.81 95.81 0 0 1-38 34.57l-0.62 0.31 0.07 0.69 41.7 392.88 0.06 0.55 0.5 0.24c15.91 7.71 29.36 19.68 38.91 34.61 9.8 15.33 14.98 33.09 14.98 51.38 0 52.66-42.84 95.5-95.5 95.5-31.02 0-60.22-15.16-78.11-40.55l-0.43-0.62-0.71 0.25-396.09 138.59-0.55 0.19-0.1 0.57c-3.9 21.77-15.4 41.67-32.39 56.03-17.2 14.54-39.08 22.54-61.62 22.54-52.66 0-95.5-42.84-95.5-95.5 0-13.05 2.59-25.71 7.7-37.61l0.23-0.54-0.36-0.46-141.59-184.16-0.43-0.56-0.67 0.22A95.43 95.43 0 0 1 98.5 707C45.84 707 3 664.16 3 611.5S45.84 516 98.5 516c7.52 0 15.01 0.88 22.29 2.62l0.73 0.17 0.37-0.65 213.33-369.5 0.3-0.52-0.31-0.51c-9.29-15.04-14.2-32.37-14.2-50.12C321 44.84 363.84 2 416.5 2m0 191c-9.7 0-19.27-1.45-28.44-4.31l-0.76-0.24-0.4 0.69-210.98 365.43-0.32 0.56 0.38 0.52C187.77 571.99 194 591.3 194 611.5c0 17.64-4.85 34.88-14.03 49.85l-0.36 0.59 0.42 0.55 135.82 176.65 0.5 0.64 0.73-0.35c12.97-6.26 26.91-9.43 41.42-9.43 16.79 0 33.3 4.42 47.75 12.78a96.095 96.095 0 0 1 34.18 33.63l0.42 0.7 0.77-0.27 391.17-136.87 0.6-0.21 0.06-0.64c1.88-19.33 9.53-37.41 22.11-52.28 12.44-14.71 28.77-25.2 47.22-30.35l0.82-0.23-0.09-0.84-40.26-379.37-0.07-0.7-0.68-0.17c-39.52-9.77-68.5-43.58-72.11-84.12l-0.07-0.74-0.73-0.15-283.12-58.2-0.82-0.17-0.31 0.78c-6.96 17.61-18.91 32.64-34.54 43.46-15.99 11.11-34.77 16.96-54.3 16.96m0-192C363.2 1 320 44.2 320 97.5c0 18.58 5.26 35.93 14.35 50.65l-213.33 369.5A96.669 96.669 0 0 0 98.5 515C45.2 515 2 558.2 2 611.5S45.2 708 98.5 708a96.5 96.5 0 0 0 29.69-4.66l141.59 184.15c-5 11.66-7.78 24.51-7.78 38.01 0 53.3 43.2 96.5 96.5 96.5 47.46 0 86.91-34.25 94.99-79.39l396.08-138.59C867.04 828.81 895.88 845 928.5 845c53.3 0 96.5-43.2 96.5-96.5 0-38.22-22.23-71.26-54.46-86.88l-41.7-392.88C960.37 252.86 982 220.21 982 182.5c0-53.3-43.2-96.5-96.5-96.5-32.37 0-61.01 15.94-78.51 40.39l-299.68-61.6C493.91 27.59 458.31 1 416.5 1z m0 193c40.77 0 75.63-25.28 89.77-61.03l283.12 58.2c3.69 41.4 33.52 75.27 72.87 85l40.26 379.37c-37.74 10.53-66.15 43.41-70.06 83.49L441.29 875.9c-16.87-28.1-47.63-46.9-82.79-46.9-15 0-29.2 3.42-41.86 9.53L180.82 661.88c8.99-14.66 14.18-31.91 14.18-50.38 0-21.07-6.76-40.56-18.22-56.43l210.98-365.42c9.08 2.83 18.73 4.35 28.74 4.35z",
|
|
7950
|
-
"p-id": "6217"
|
|
7951
|
-
}, null) ]), vue.createVNode("p", {
|
|
7952
|
-
class: "label-text"
|
|
7953
|
-
}, [ t("next.labelme.createPolygon") ]) ]), vue.createVNode("li", {
|
|
7954
|
-
class: "tool-item"
|
|
7955
|
-
}, [ vue.createVNode("svg", {
|
|
7956
|
-
t: "1721826424613",
|
|
7957
|
-
class: "icon",
|
|
7958
|
-
viewBox: "0 0 1024 1024",
|
|
7959
|
-
version: "1.1",
|
|
7960
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7961
|
-
"p-id": "7356",
|
|
7962
|
-
width: "18",
|
|
7963
|
-
height: "18"
|
|
7964
|
-
}, [ vue.createVNode("path", {
|
|
7965
|
-
d: "M102.4 870.4v51.2h102.4v51.2H51.2v-102.4h51.2z m870.4-51.2v153.6h-102.4v-51.2h51.2v-102.4h51.2zM409.6 921.6v51.2H358.4v-51.2h51.2z m102.4 0v51.2H460.8v-51.2h51.2z m102.4 0v51.2h-51.2v-51.2h51.2z m102.4 0v51.2h-51.2v-51.2h51.2z m102.4 0v51.2h-51.2v-51.2h51.2zM307.2 921.6v51.2H256v-51.2h51.2z m204.8-742.4a51.2 51.2 0 0 1 51.0464 55.0912l118.8352 68.608a102.4 102.4 0 1 1 96.1536 157.3888v155.136a51.2 51.2 0 1 1-51.6096 80.0256L556.3392 793.6a51.2 51.2 0 1 1-88.7296 0.0512l-169.984-98.2016A51.1488 51.1488 0 0 1 204.8 665.6a51.2 51.2 0 0 1 41.1136-50.176V408.576a51.2 51.2 0 1 1 51.712-79.9744l163.3792-94.3616L460.8 230.4a51.2 51.2 0 0 1 45.2096-50.8416zM102.4 768v51.2H51.2v-51.2h51.2z m870.4-51.2v51.2h-51.2v-51.2h51.2zM297.0624 412.8768l0.1024 222.208 1.024 1.536L486.4 745.2672v-188.928a51.2 51.2 0 0 1-25.2416-38.4L460.8 512v-0.8704L297.0624 412.8768z m399.0528 18.432L563.2 511.1808 563.2 512a51.2 51.2 0 0 1-25.5488 44.3392l-0.0512 188.8768 188.2624-108.6976 0.9216-1.28V452.096a102.6048 102.6048 0 0 1-30.6688-20.7872zM102.4 665.6v51.2H51.2v-51.2h51.2z m870.4-51.2v51.2h-51.2v-51.2h51.2zM102.4 563.2v51.2H51.2v-51.2h51.2z m870.4-51.2v51.2h-51.2v-51.2h51.2zM102.4 460.8v51.2H51.2V460.8h51.2z m387.584-184.1664L326.6048 370.8928l160.6144 96.256a50.8416 50.8416 0 0 1 18.7904-5.9904L512 460.8c9.0112 0 17.5104 2.3552 24.832 6.4l132.9664-79.7184a102.4 102.4 0 0 1-4.0448-34.7648l-131.7888-76.032a50.9952 50.9952 0 0 1-43.9808 0zM972.8 409.6v51.2h-51.2V409.6h51.2zM102.4 358.4v51.2H51.2V358.4h51.2z m870.4-51.2v51.2h-51.2V307.2h51.2zM102.4 256v51.2H51.2V256h51.2z m870.4-51.2v51.2h-51.2V204.8h51.2zM153.6 51.2v51.2H102.4v102.4H51.2V51.2h102.4z m819.2 0v102.4h-51.2V102.4h-102.4V51.2h153.6z m-409.6 0v51.2h-51.2V51.2h51.2z m102.4 0v51.2h-51.2V51.2h51.2z m102.4 0v51.2h-51.2V51.2h51.2zM256 51.2v51.2H204.8V51.2h51.2z m102.4 0v51.2H307.2V51.2h51.2z m102.4 0v51.2H409.6V51.2h51.2z",
|
|
7966
|
-
"p-id": "7357"
|
|
7967
|
-
}, null) ]), vue.createVNode("p", {
|
|
7968
|
-
class: "label-text"
|
|
7969
|
-
}, [ t("next.labelme.editPolygon") ]) ]), vue.createVNode("li", {
|
|
7970
|
-
class: "tool-item"
|
|
7971
|
-
}, [ vue.createVNode("svg", {
|
|
7972
|
-
t: "1721826579655",
|
|
7973
|
-
class: "icon",
|
|
7974
|
-
viewBox: "0 0 1024 1024",
|
|
7975
|
-
version: "1.1",
|
|
7976
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7977
|
-
"p-id": "10996",
|
|
7978
|
-
width: "18",
|
|
7979
|
-
height: "18"
|
|
7980
|
-
}, [ vue.createVNode("path", {
|
|
7981
|
-
d: "M847.743 223.953H640.639c-3.132-68.921-60.177-124.029-129.858-124.029s-126.726 55.108-129.858 124.029H173.256c-17.673 0-32 14.327-32 32s14.327 32 32 32h674.487c17.673 0 32-14.327 32-32s-14.327-32-32-32z m-336.962-60.03c34.379 0 62.689 26.426 65.718 60.029H445.064c3.029-33.603 31.338-60.029 65.717-60.029zM767.743 351.79c-17.673 0-32 14.327-32 32v478.173H288.256V383.79c0-17.673-14.327-32-32-32s-32 14.327-32 32v510.173c0 17.673 14.327 32 32 32h511.487c17.673 0 32-14.327 32-32V383.79c0-17.673-14.327-32-32-32z",
|
|
7982
|
-
"p-id": "10997"
|
|
7983
|
-
}, null), vue.createVNode("path", {
|
|
7984
|
-
d: "M449.306 732.802V448.208c0-17.673-14.327-32-32-32s-32 14.327-32 32v284.593c0 17.673 14.327 32 32 32s32-14.326 32-31.999z m191.534 0V448.208c0-17.673-14.327-32-32-32s-32 14.327-32 32v284.593c0 17.673 14.327 32 32 32s32-14.326 32-31.999z",
|
|
7985
|
-
"p-id": "10998"
|
|
7986
|
-
}, null) ]), vue.createVNode("p", {
|
|
7987
|
-
class: "label-text"
|
|
7988
|
-
}, [ t("next.labelme.deletePolyton") ]) ]) ]), vue.createVNode("ul", {
|
|
8314
|
+
}, [ t("next.labelme.saveLabel") ]) ]) ]), vue.createVNode("ul", {
|
|
7989
8315
|
class: [ _ns.be("header", "tool") ]
|
|
7990
8316
|
}, [ vue.createVNode("li", {
|
|
7991
|
-
class: "
|
|
8317
|
+
class: "tool-item",
|
|
7992
8318
|
onClick: () => scaleTranslateManager.onResetScaleTranslate()
|
|
7993
8319
|
}, [ vue.createVNode("svg", {
|
|
7994
8320
|
t: "1725840994827",
|
|
@@ -8004,7 +8330,9 @@
|
|
|
8004
8330
|
"p-id": "6052"
|
|
8005
8331
|
}, null) ]), vue.createVNode("span", {
|
|
8006
8332
|
style: "padding-left: 3px"
|
|
8007
|
-
}, [ t("next.labelimg.zoomRestore") ]) ]), vue.createVNode("li",
|
|
8333
|
+
}, [ t("next.labelimg.zoomRestore") ]) ]), vue.createVNode("li", {
|
|
8334
|
+
style: "color: #999; user-select: none; cursor: default;"
|
|
8335
|
+
}, [ vue.createVNode("span", null, [ vue.createTextVNode("缩放比例") ]), vue.createVNode("span", null, [ parseInt((100 * scaleTranslate.value.scale).toString()), vue.createTextVNode("%") ]), vue.createVNode("span", {
|
|
8008
8336
|
style: "padding: 0 10px;"
|
|
8009
8337
|
}, [ vue.createTextVNode("偏移量") ]), vue.createVNode("span", {
|
|
8010
8338
|
style: "min-width: 120px; text-align: left;"
|
|
@@ -8029,7 +8357,7 @@
|
|
|
8029
8357
|
}) ]),
|
|
8030
8358
|
default: () => vue.createVNode("ul", {
|
|
8031
8359
|
style: "font-size: 12px;white-space: nowrap;"
|
|
8032
|
-
}, [ vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("A:") ]), vue.createVNode("span", null, [ vue.createTextVNode("A键进入上一张图片进行标注") ]) ]), vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("D:") ]), vue.createVNode("span", null, [ vue.createTextVNode("D键进入下一张图片进行标注") ]) ]) ])
|
|
8360
|
+
}, [ vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("A:") ]), vue.createVNode("span", null, [ vue.createTextVNode("A键进入上一张图片进行标注") ]) ]), vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("D:") ]), vue.createVNode("span", null, [ vue.createTextVNode("D键进入下一张图片进行标注") ]) ]), vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("Ctrl+鼠标:") ]), vue.createVNode("span", null, [ vue.createTextVNode("按住Ctrl键+鼠标滚动可以缩放图片,按住Ctrl+左键拖动可以移动图片") ]) ]) ])
|
|
8033
8361
|
}) ]), props.isFullscreen ? vue.createVNode("li", {
|
|
8034
8362
|
class: "tool-item",
|
|
8035
8363
|
onClick: () => switchFillscreen(!1)
|
|
@@ -8072,9 +8400,195 @@
|
|
|
8072
8400
|
}, null) ]) ]
|
|
8073
8401
|
}) ]) ]) ]) ]);
|
|
8074
8402
|
}
|
|
8075
|
-
}),
|
|
8076
|
-
|
|
8077
|
-
|
|
8403
|
+
}), LeftTools = vue.defineComponent({
|
|
8404
|
+
props: {},
|
|
8405
|
+
emits: [ "change" ],
|
|
8406
|
+
setup(props, {emit: emit}) {
|
|
8407
|
+
const {t: t} = useLocale(), _ns = vue.inject("ns", {}), toolsActive = vue.inject("toolsActive", {}), changeToolsActive = vue.inject("changeToolsActive"), onClickToolsActive = type => {
|
|
8408
|
+
changeToolsActive(type), emit("change", type);
|
|
8409
|
+
};
|
|
8410
|
+
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", {
|
|
8411
|
+
class: [ _ns.be("main", "left-tools") ]
|
|
8412
|
+
}, [ vue.createVNode("li", {
|
|
8413
|
+
class: [ "tool-item", {
|
|
8414
|
+
"active-tool": toolsActive.value === ToolsHandleType.CREATE_POLYGON
|
|
8415
|
+
} ],
|
|
8416
|
+
onClick: () => onClickToolsActive(ToolsHandleType.CREATE_POLYGON)
|
|
8417
|
+
}, [ vue.createVNode("svg", {
|
|
8418
|
+
t: "1757513720352",
|
|
8419
|
+
class: "icon",
|
|
8420
|
+
viewBox: "0 0 1024 1024",
|
|
8421
|
+
version: "1.1",
|
|
8422
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8423
|
+
"p-id": "4548",
|
|
8424
|
+
width: "18",
|
|
8425
|
+
height: "18"
|
|
8426
|
+
}, [ vue.createVNode("path", {
|
|
8427
|
+
d: "M938.456035 455.122739a85.314185 85.314185 0 0 1-85.371061-85.314185c0-12.342119 2.900682-23.944848 7.678277-34.523807l-5.630736-3.241939 28.89307-48.970342 17.972855 10.351454c11.14772-5.346356 23.262334-8.872675 36.457595-8.872675a85.314185 85.314185 0 1 1 0 170.571494z m-56.648618 172.050273l33.898169-166.760793 56.307362 11.204596-33.898169 166.760794-56.307362-11.204597z m39.415153 94.528117l-5.403232 26.333645v0.170629l-0.056876 0.227504-0.056876 0.227505v0.170628l-0.056876 0.056876-0.056876 0.341257-13.138385 64.725028c21.27167 15.527182 36.002586 39.415153 36.002586 67.796339a85.314185 85.314185 0 0 1-85.371061 85.257309c-26.618026 0-49.425351-12.91088-65.066285-32.078133l-17.574722 1.933788-0.73939 0.056876-0.113752 0.056876-0.682513 0.056876h-0.170629l-0.113752 0.056876-108.007758 11.716482-6.31325-56.307362 113.809123-12.398995a84.631672 84.631672 0 0 1 79.114688-82.527255l17.688474-87.077345 56.307362 11.204596z m-289.328839-518.141483l28.89307-49.027219 148.844815 85.712318-28.893071 48.970342-148.844814-85.655441z m-74.39397-42.827721l-19.394758-11.147721c-14.844668 12.683376-33.556913 21.157918-54.657954 21.157918a84.745424 84.745424 0 0 1-30.940612-6.199497l-51.984776 47.605315-39.073897-41.576446 48.458457-44.363376A82.697883 82.697883 0 0 1 398.132864 85.427937a85.314185 85.314185 0 1 1 170.62837 0c0 5.118851-2.04754 9.612065-2.957559 14.446536l20.589157 11.830233-28.893071 49.027219zM172.050273 343.986794l126.264994-115.629159 39.073897 41.576446-126.264994 115.629159-39.073897-41.576446z m-23.489839 173.358424l-16.323447 7.166392a82.982264 82.982264 0 0 1-27.300539 12.000862l-8.8158 3.867576-0.853141-1.933788c-3.412567 0.398133-6.427002 1.990664-9.953322 1.990664a85.314185 85.314185 0 1 1 85.314185-85.314185c0 22.750449-9.213932 43.168978-23.717343 58.468655l1.649407 3.753824z m105.107076 233.13523l-52.439786 23.03483-53.804812-119.269231v-0.170628a8.531419 8.531419 0 0 1-0.682514-1.47878l-0.056876-0.056876-0.455009-1.137522H146.171637l-0.113752-0.284381-0.056876-0.113752-0.625638-1.478779-0.341256-0.682514-0.056877-0.113752-0.113752-0.284381-0.398133-0.796265v-0.113753l-0.227504-0.455009-0.056876-0.113752-0.056876-0.170628-0.056877-0.056876-0.056876-0.113753-0.056876-0.113752-0.056876-0.28438-0.398133-0.796266-12.342119-27.357415 52.439786-23.03483 70.071384 155.442445z m-17.404094 100.727614l52.439786-23.03483 12.342119 27.471168c4.038205-0.568761 7.564524-2.388797 11.773357-2.388797A85.314185 85.314185 0 1 1 227.447617 938.626664c0-22.067936 8.929551-41.690198 22.636697-56.819247l-13.820898-30.599355z m332.440941 50.562874l6.31325 56.364238-171.197131 18.655369-6.31325-56.364239 171.197131-18.655368z",
|
|
8428
|
+
"p-id": "4549"
|
|
8429
|
+
}, null) ]), vue.createVNode("p", {
|
|
8430
|
+
class: "label-text"
|
|
8431
|
+
}, [ t("next.labelme.createPolygon") ]) ]), vue.createVNode("li", {
|
|
8432
|
+
class: [ "tool-item", {
|
|
8433
|
+
"active-tool": toolsActive.value === ToolsHandleType.EDIT_SHAPE
|
|
8434
|
+
} ],
|
|
8435
|
+
onClick: () => onClickToolsActive(ToolsHandleType.EDIT_SHAPE)
|
|
8436
|
+
}, [ vue.createVNode("svg", {
|
|
8437
|
+
t: "1757513760776",
|
|
8438
|
+
class: "icon",
|
|
8439
|
+
viewBox: "0 0 1025 1024",
|
|
8440
|
+
version: "1.1",
|
|
8441
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8442
|
+
"p-id": "4712",
|
|
8443
|
+
width: "18",
|
|
8444
|
+
height: "18"
|
|
8445
|
+
}, [ vue.createVNode("path", {
|
|
8446
|
+
d: "M358.5 1021.5c-52.93 0-96-43.07-96-96 0-13.12 2.6-25.84 7.74-37.81l0.12-0.27-141.99-184.66-0.34 0.11a95.806 95.806 0 0 1-29.53 4.64c-52.93 0-96-43.07-96-96s43.07-96 96-96c7.56 0 15.09 0.89 22.41 2.64l0.36 0.09 213.67-370.08-0.16-0.25c-9.34-15.12-14.28-32.54-14.28-50.39 0-52.93 43.07-96 96-96 40.36 0 76.66 25.5 90.34 63.46l0.09 0.26 300.27 61.72 0.19-0.26c18.01-25.16 47.21-40.18 78.11-40.18 52.93 0 96 43.07 96 96 0 36.49-20.26 69.36-52.88 85.79l-0.31 0.16 41.76 393.5 0.25 0.12a96.184 96.184 0 0 1 39.11 34.79c9.85 15.41 15.06 33.27 15.06 51.65 0 52.93-43.07 96-96 96-31.18 0-60.53-15.24-78.52-40.76l-0.22-0.31-396.7 138.78-0.05 0.29c-8.2 45.76-47.94 78.97-94.5 78.97z m0-192c34.03 0 64.82 17.44 82.36 46.66l0.21 0.35L832.93 739.4l0.03-0.32c3.81-39.11 31.82-72.49 69.7-83.05l0.41-0.11-40.34-380.14-0.34-0.08c-39.73-9.82-68.86-43.81-72.49-84.56l-0.03-0.37-283.9-58.36-0.15 0.39c-7 17.7-19.01 32.81-34.72 43.69-16.08 11.13-34.96 17.02-54.59 17.02-9.75 0-19.37-1.46-28.59-4.33l-0.38-0.12L176.19 555.1l0.19 0.26c11.86 16.42 18.12 35.83 18.12 56.14 0 17.74-4.88 35.06-14.11 50.11l-0.18 0.29 136.28 177.25 0.37-0.18c13.04-6.28 27.05-9.47 41.64-9.47z",
|
|
8447
|
+
"p-id": "4713"
|
|
8448
|
+
}, null), vue.createVNode("path", {
|
|
8449
|
+
d: "M416.5 2c40.15 0 76.26 25.37 89.87 63.13l0.19 0.53 0.55 0.11 299.68 61.6 0.64 0.13 0.38-0.53c8.66-12.1 20.19-22.15 33.34-29.06C854.71 90.77 870.06 87 885.5 87c52.66 0 95.5 42.84 95.5 95.5 0 18.03-5.05 35.58-14.6 50.77a95.81 95.81 0 0 1-38 34.57l-0.62 0.31 0.07 0.69 41.7 392.88 0.06 0.55 0.5 0.24c15.91 7.71 29.36 19.68 38.91 34.61 9.8 15.33 14.98 33.09 14.98 51.38 0 52.66-42.84 95.5-95.5 95.5-31.02 0-60.22-15.16-78.11-40.55l-0.43-0.62-0.71 0.25-396.09 138.59-0.55 0.19-0.1 0.57c-3.9 21.77-15.4 41.67-32.39 56.03-17.2 14.54-39.08 22.54-61.62 22.54-52.66 0-95.5-42.84-95.5-95.5 0-13.05 2.59-25.71 7.7-37.61l0.23-0.54-0.36-0.46-141.59-184.16-0.43-0.56-0.67 0.22A95.43 95.43 0 0 1 98.5 707C45.84 707 3 664.16 3 611.5S45.84 516 98.5 516c7.52 0 15.01 0.88 22.29 2.62l0.73 0.17 0.37-0.65 213.33-369.5 0.3-0.52-0.31-0.51c-9.29-15.04-14.2-32.37-14.2-50.12C321 44.84 363.84 2 416.5 2m0 191c-9.7 0-19.27-1.45-28.44-4.31l-0.76-0.24-0.4 0.69-210.98 365.43-0.32 0.56 0.38 0.52C187.77 571.99 194 591.3 194 611.5c0 17.64-4.85 34.88-14.03 49.85l-0.36 0.59 0.42 0.55 135.82 176.65 0.5 0.64 0.73-0.35c12.97-6.26 26.91-9.43 41.42-9.43 16.79 0 33.3 4.42 47.75 12.78a96.095 96.095 0 0 1 34.18 33.63l0.42 0.7 0.77-0.27 391.17-136.87 0.6-0.21 0.06-0.64c1.88-19.33 9.53-37.41 22.11-52.28 12.44-14.71 28.77-25.2 47.22-30.35l0.82-0.23-0.09-0.84-40.26-379.37-0.07-0.7-0.68-0.17c-39.52-9.77-68.5-43.58-72.11-84.12l-0.07-0.74-0.73-0.15-283.12-58.2-0.82-0.17-0.31 0.78c-6.96 17.61-18.91 32.64-34.54 43.46-15.99 11.11-34.77 16.96-54.3 16.96m0-192C363.2 1 320 44.2 320 97.5c0 18.58 5.26 35.93 14.35 50.65l-213.33 369.5A96.669 96.669 0 0 0 98.5 515C45.2 515 2 558.2 2 611.5S45.2 708 98.5 708a96.5 96.5 0 0 0 29.69-4.66l141.59 184.15c-5 11.66-7.78 24.51-7.78 38.01 0 53.3 43.2 96.5 96.5 96.5 47.46 0 86.91-34.25 94.99-79.39l396.08-138.59C867.04 828.81 895.88 845 928.5 845c53.3 0 96.5-43.2 96.5-96.5 0-38.22-22.23-71.26-54.46-86.88l-41.7-392.88C960.37 252.86 982 220.21 982 182.5c0-53.3-43.2-96.5-96.5-96.5-32.37 0-61.01 15.94-78.51 40.39l-299.68-61.6C493.91 27.59 458.31 1 416.5 1z m0 193c40.77 0 75.63-25.28 89.77-61.03l283.12 58.2c3.69 41.4 33.52 75.27 72.87 85l40.26 379.37c-37.74 10.53-66.15 43.41-70.06 83.49L441.29 875.9c-16.87-28.1-47.63-46.9-82.79-46.9-15 0-29.2 3.42-41.86 9.53L180.82 661.88c8.99-14.66 14.18-31.91 14.18-50.38 0-21.07-6.76-40.56-18.22-56.43l210.98-365.42c9.08 2.83 18.73 4.35 28.74 4.35z",
|
|
8450
|
+
"p-id": "4714"
|
|
8451
|
+
}, null) ]), vue.createVNode("p", {
|
|
8452
|
+
class: "label-text"
|
|
8453
|
+
}, [ t("next.labelme.editPolygon") ]) ]), vue.createVNode("li", {
|
|
8454
|
+
class: [ "tool-item", {
|
|
8455
|
+
"active-tool": toolsActive.value === ToolsHandleType.CREATE_RECTANGLE
|
|
8456
|
+
} ],
|
|
8457
|
+
onClick: () => onClickToolsActive(ToolsHandleType.CREATE_RECTANGLE)
|
|
8458
|
+
}, [ vue.createVNode("svg", {
|
|
8459
|
+
t: "1757513985670",
|
|
8460
|
+
class: "icon",
|
|
8461
|
+
viewBox: "0 0 1024 1024",
|
|
8462
|
+
version: "1.1",
|
|
8463
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8464
|
+
"p-id": "7834",
|
|
8465
|
+
width: "18",
|
|
8466
|
+
height: "18"
|
|
8467
|
+
}, [ vue.createVNode("path", {
|
|
8468
|
+
d: "M273.9 168.3H739v37.1H273.9zM273.9 819.6H739v37.1H273.9zM165.812 740.898v-465.1h37.1v465.1zM821.11 740.896v-465.1h37.1v465.1z",
|
|
8469
|
+
"p-id": "7835"
|
|
8470
|
+
}, null), vue.createVNode("path", {
|
|
8471
|
+
d: "M184.7 66.2c-66.8 0-121 54.2-121 121s54.2 121 121 121 121-54.2 121-121-54.1-121-121-121z m-0.1 203.5c-45.7 0-82.7-37-82.7-82.7s37-82.7 82.7-82.7 82.7 37 82.7 82.7c0.1 45.7-37 82.7-82.7 82.7zM184.7 717.5c-66.8 0-121 54.2-121 121s54.2 121 121 121 121-54.2 121-121-54.1-121-121-121z m-0.1 203.6c-45.7 0-82.7-37-82.7-82.7s37-82.7 82.7-82.7 82.7 37 82.7 82.7c0.1 45.6-37 82.7-82.7 82.7zM840 717.5c-66.8 0-121 54.2-121 121s54.2 121 121 121 121-54.2 121-121-54.1-121-121-121z m-0.1 203.6c-45.7 0-82.7-37-82.7-82.7s37-82.7 82.7-82.7 82.7 37 82.7 82.7c0.1 45.6-37 82.7-82.7 82.7zM840 66.2c-66.8 0-121 54.2-121 121s54.2 121 121 121 121-54.2 121-121-54.1-121-121-121z m-0.1 203.5c-45.7 0-82.7-37-82.7-82.7s37-82.7 82.7-82.7 82.7 37 82.7 82.7c0.1 45.7-37 82.7-82.7 82.7z",
|
|
8472
|
+
"p-id": "7836"
|
|
8473
|
+
}, null) ]), vue.createVNode("p", {
|
|
8474
|
+
class: "label-text"
|
|
8475
|
+
}, [ t("next.labelme.createRectangle") ]) ]), vue.createVNode("li", {
|
|
8476
|
+
class: [ "tool-item", {
|
|
8477
|
+
"active-tool": toolsActive.value === ToolsHandleType.CREATE_CIRCLE
|
|
8478
|
+
} ],
|
|
8479
|
+
onClick: () => onClickToolsActive(ToolsHandleType.CREATE_CIRCLE)
|
|
8480
|
+
}, [ vue.createVNode("svg", {
|
|
8481
|
+
t: "1757514108844",
|
|
8482
|
+
class: "icon",
|
|
8483
|
+
viewBox: "0 0 1024 1024",
|
|
8484
|
+
version: "1.1",
|
|
8485
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8486
|
+
"p-id": "8822",
|
|
8487
|
+
width: "18",
|
|
8488
|
+
height: "18"
|
|
8489
|
+
}, [ vue.createVNode("path", {
|
|
8490
|
+
d: "M512 39.613153A472.386847 472.386847 0 1 1 39.613153 512 472.386847 472.386847 0 0 1 512 39.613153m0-39.613153a512 512 0 1 0 512 512A512 512 0 0 0 512 0z",
|
|
8491
|
+
"p-id": "8823"
|
|
8492
|
+
}, null) ]), vue.createVNode("p", {
|
|
8493
|
+
class: "label-text"
|
|
8494
|
+
}, [ t("next.labelme.createCircle") ]) ]) ]) ]);
|
|
8495
|
+
}
|
|
8496
|
+
}), RightLabel = vue.defineComponent({
|
|
8497
|
+
props: {
|
|
8498
|
+
shapes: {
|
|
8499
|
+
type: Array,
|
|
8500
|
+
default: () => []
|
|
8501
|
+
}
|
|
8502
|
+
},
|
|
8503
|
+
emits: [ "delete", "update" ],
|
|
8504
|
+
setup(props, {emit: emit}) {
|
|
8505
|
+
const {t: t} = useLocale(), _ns = vue.inject("ns", {}), classes = vue.inject("classes", vue.ref([])), _classes = vue.unref(classes), formatlabelColor = lebel => {
|
|
8506
|
+
const index = _classes.findIndex(item => item === lebel);
|
|
8507
|
+
return -1 === index ? "#5470c6" : colors[index];
|
|
8508
|
+
}, shapes = vue.toRef(props, "shapes"), formColumns = [ {
|
|
8509
|
+
prop: "group_id",
|
|
8510
|
+
label: t("next.labelme.labelGroupId"),
|
|
8511
|
+
type: "input"
|
|
8512
|
+
}, {
|
|
8513
|
+
prop: "description",
|
|
8514
|
+
label: t("next.labelme.labelDescription"),
|
|
8515
|
+
type: "textarea"
|
|
8516
|
+
} ], shapeEditDialog = vue.reactive({
|
|
8517
|
+
visible: !1,
|
|
8518
|
+
title: "",
|
|
8519
|
+
shapeInfo: {}
|
|
8520
|
+
}), onCloseShapeEditDialog = () => {
|
|
8521
|
+
shapeEditDialog.visible = !1, shapeEditDialog.title = "", shapeEditDialog.shapeInfo = {};
|
|
8522
|
+
}, onSubmitShapeChange = (shape, done) => {
|
|
8523
|
+
emit("update", deepClone(shape)), done(), onCloseShapeEditDialog();
|
|
8524
|
+
}, renderContent = () => vue.createVNode("div", {
|
|
8525
|
+
class: [ _ns.be("main", "right-label") ]
|
|
8526
|
+
}, [ shapes.value.length ? vue.createVNode("ul", null, [ shapes.value.map((shape, index) => vue.createVNode("li", {
|
|
8527
|
+
class: [ _ns.be("right-label", "label-item") ],
|
|
8528
|
+
key: index
|
|
8529
|
+
}, [ vue.createVNode("div", {
|
|
8530
|
+
class: [ _ns.be("right-label", "label-content") ]
|
|
8531
|
+
}, [ vue.createVNode("span", {
|
|
8532
|
+
class: "label-line",
|
|
8533
|
+
style: {
|
|
8534
|
+
backgroundColor: formatlabelColor(shape.label)
|
|
8535
|
+
}
|
|
8536
|
+
}, null), vue.createVNode("span", null, [ shape.label, shape.group_id ? ` ( ${shape.group_id} )` : null ]) ]), vue.createVNode("div", {
|
|
8537
|
+
class: [ _ns.be("right-label", "label-btns") ]
|
|
8538
|
+
}, [ vue.createVNode(elementPlus.ElIcon, {
|
|
8539
|
+
size: 16,
|
|
8540
|
+
style: {
|
|
8541
|
+
marginRight: "6px"
|
|
8542
|
+
},
|
|
8543
|
+
onClick: event => {
|
|
8544
|
+
event.preventDefault(), event.stopPropagation(), (shape => {
|
|
8545
|
+
shapeEditDialog.visible = !0, shapeEditDialog.title = shape.label, shapeEditDialog.shapeInfo = shape;
|
|
8546
|
+
})(shape);
|
|
8547
|
+
}
|
|
8548
|
+
}, {
|
|
8549
|
+
default: () => [ vue.createVNode(edit_default, null, null) ]
|
|
8550
|
+
}), vue.createVNode(elementPlus.ElPopconfirm, {
|
|
8551
|
+
title: t("next.labelme.confirmDeleteLabel"),
|
|
8552
|
+
width: 200,
|
|
8553
|
+
onConfirm: () => (shape => {
|
|
8554
|
+
emit("delete", shape);
|
|
8555
|
+
})(shape)
|
|
8556
|
+
}, {
|
|
8557
|
+
reference: () => vue.createVNode(elementPlus.ElIcon, {
|
|
8558
|
+
size: 16,
|
|
8559
|
+
color: "#ff0000",
|
|
8560
|
+
onClick: event => {
|
|
8561
|
+
event.preventDefault(), event.stopPropagation();
|
|
8562
|
+
}
|
|
8563
|
+
}, {
|
|
8564
|
+
default: () => [ vue.createVNode(delete_default, null, null) ]
|
|
8565
|
+
})
|
|
8566
|
+
}) ]) ])) ]) : vue.createVNode(elementPlus.ElEmpty, {
|
|
8567
|
+
"image-size": 100,
|
|
8568
|
+
description: t("next.labelme.emptyLabelText")
|
|
8569
|
+
}, null), vue.createVNode(NextDialog, {
|
|
8570
|
+
modelValue: shapeEditDialog.visible,
|
|
8571
|
+
"onUpdate:modelValue": $event => shapeEditDialog.visible = $event,
|
|
8572
|
+
title: shapeEditDialog.title,
|
|
8573
|
+
width: 350,
|
|
8574
|
+
fullscreen: !1,
|
|
8575
|
+
fullscreenBtn: !1,
|
|
8576
|
+
closeOnClickModal: !0,
|
|
8577
|
+
onClose: onCloseShapeEditDialog
|
|
8578
|
+
}, {
|
|
8579
|
+
default: () => [ vue.createVNode(NextForm, {
|
|
8580
|
+
options: {
|
|
8581
|
+
labelPosition: "top",
|
|
8582
|
+
colSpanFixed: 24
|
|
8583
|
+
},
|
|
8584
|
+
columns: formColumns,
|
|
8585
|
+
formDatum: shapeEditDialog.shapeInfo,
|
|
8586
|
+
onSubmit: onSubmitShapeChange
|
|
8587
|
+
}, null) ]
|
|
8588
|
+
}) ]);
|
|
8589
|
+
return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
|
|
8590
|
+
}
|
|
8591
|
+
});
|
|
8078
8592
|
const ns = useNamespace("labelme");
|
|
8079
8593
|
var Element = vue.defineComponent({
|
|
8080
8594
|
name: "NextLabelme",
|
|
@@ -8102,40 +8616,50 @@
|
|
|
8102
8616
|
},
|
|
8103
8617
|
emits: [ "change", "save", "edit-polygon", "change-polygon", "prev-click", "next-click" ],
|
|
8104
8618
|
setup(props, {emit: emit, slots: slots}) {
|
|
8105
|
-
const _config = deepClone(defaultConfig), _options = vue.computed((
|
|
8619
|
+
const _config = deepClone(defaultConfig), _options = vue.computed(() => {
|
|
8106
8620
|
const cfg = vue.unref(props.options);
|
|
8107
8621
|
return merge(_config, cfg);
|
|
8108
|
-
})
|
|
8622
|
+
}), options = vue.unref(_options);
|
|
8109
8623
|
vue.provide("ns", ns);
|
|
8110
|
-
const {t: t} = useLocale(), activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes)
|
|
8111
|
-
vue.
|
|
8624
|
+
const {t: t} = useLocale(), activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes);
|
|
8625
|
+
vue.provide("classes", classes);
|
|
8626
|
+
const toolsActive = vue.ref("");
|
|
8627
|
+
vue.provide("toolsActive", toolsActive), vue.provide("changeToolsActive", val => {
|
|
8628
|
+
toolsActive.value = val;
|
|
8629
|
+
});
|
|
8630
|
+
const labelImages = vue.ref(deepClone(props.data));
|
|
8631
|
+
vue.watch(() => props.data, data => {
|
|
8112
8632
|
labelImages.value = deepClone(data);
|
|
8113
|
-
}
|
|
8633
|
+
}, {
|
|
8114
8634
|
deep: !0
|
|
8115
|
-
}), vue.watch((
|
|
8635
|
+
}), vue.watch(() => props.data.length, () => {
|
|
8116
8636
|
activateNodeIndex.value = 0;
|
|
8117
|
-
})), vue.watch((() => props.classes), (val => {
|
|
8118
|
-
classes.value = val;
|
|
8119
|
-
}), {
|
|
8120
|
-
deep: !0
|
|
8121
8637
|
});
|
|
8122
|
-
const currentNode = vue.computed((
|
|
8638
|
+
const currentNode = vue.computed(() => {
|
|
8123
8639
|
if (!labelImages.value) return {};
|
|
8124
8640
|
const node = labelImages.value[activateNodeIndex.value] || {};
|
|
8125
8641
|
return deepClone(node);
|
|
8126
|
-
})
|
|
8127
|
-
|
|
8642
|
+
}), onUpdateLabelInfo = val => {
|
|
8643
|
+
labelImages.value[activateNodeIndex.value] = val;
|
|
8644
|
+
}, onDeleteLabelShape = shape => {
|
|
8645
|
+
const node = currentNode.value, index = node.labels?.shapes?.findIndex(item => item.id === shape.id);
|
|
8646
|
+
-1 !== index && node.labels.shapes.splice(index, 1), labelImages.value[activateNodeIndex.value] = node;
|
|
8647
|
+
}, onUpdateLabelShape = shape => {
|
|
8648
|
+
const node = currentNode.value, index = node.labels?.shapes?.findIndex(item => item.id === shape.id);
|
|
8649
|
+
-1 !== index && (node.labels.shapes[index] = shape), labelImages.value[activateNodeIndex.value] = node;
|
|
8650
|
+
}, loading = vue.ref(!1), mainContentHeight = vue.ref(options.minContentHeight), canvasContextRef = vue.ref(), layoutLabelRef = vue.ref(), headerRef = vue.ref(), mainRef = vue.ref(), footerRef = vue.ref(), updateMainContentHeight = () => {
|
|
8651
|
+
vue.nextTick(() => {
|
|
8128
8652
|
const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
|
|
8129
8653
|
mainContentHeight.value = contentHeight;
|
|
8130
|
-
})
|
|
8654
|
+
});
|
|
8131
8655
|
};
|
|
8132
|
-
vue.onMounted((
|
|
8133
|
-
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (
|
|
8656
|
+
vue.onMounted(() => {
|
|
8657
|
+
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, () => {
|
|
8134
8658
|
updateMainContentHeight();
|
|
8135
|
-
})
|
|
8136
|
-
})
|
|
8659
|
+
}), window.addEventListener("resize", updateMainContentHeight);
|
|
8660
|
+
}), vue.onUnmounted(() => {
|
|
8137
8661
|
document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
|
|
8138
|
-
})
|
|
8662
|
+
});
|
|
8139
8663
|
const onKeydownPrevNext = () => {}, onPaginationPrev = () => {
|
|
8140
8664
|
const imageLength = labelImages.value.length;
|
|
8141
8665
|
let i = activateNodeIndex.value - 1;
|
|
@@ -8150,20 +8674,20 @@
|
|
|
8150
8674
|
const node = currentNode.value;
|
|
8151
8675
|
return emit("save", {
|
|
8152
8676
|
node: node
|
|
8153
|
-
},
|
|
8677
|
+
}, imageItem => {
|
|
8154
8678
|
labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
|
|
8155
8679
|
loading.value = !1;
|
|
8156
|
-
}
|
|
8680
|
+
}, () => {
|
|
8157
8681
|
loading.value = !1;
|
|
8158
|
-
})
|
|
8682
|
+
}), !0;
|
|
8159
8683
|
}, isFullscreen = vue.ref(!1), onSwitchFillscreen = val => {
|
|
8160
|
-
isFullscreen.value = val, updateMainContentHeight(), vue.nextTick((
|
|
8684
|
+
isFullscreen.value = val, updateMainContentHeight(), vue.nextTick(() => {
|
|
8161
8685
|
canvasContextRef.value.rerenderImage();
|
|
8162
|
-
})
|
|
8686
|
+
});
|
|
8163
8687
|
}, onChangePolygon = node => {
|
|
8164
8688
|
currentNode.value.labels = node, emit("change-polygon", node);
|
|
8165
|
-
},
|
|
8166
|
-
|
|
8689
|
+
}, onEditPolygon = node => {
|
|
8690
|
+
emit("edit-polygon", node);
|
|
8167
8691
|
}, onToolHeaderSave = () => {
|
|
8168
8692
|
onChangeActivateNode(activateNodeIndex.value) || elementPlus.ElMessage({
|
|
8169
8693
|
type: "info",
|
|
@@ -8207,17 +8731,22 @@
|
|
|
8207
8731
|
}, null) ]), vue.createVNode("div", {
|
|
8208
8732
|
ref: mainRef,
|
|
8209
8733
|
class: [ ns.b("main") ]
|
|
8210
|
-
}, [ vue.createVNode("div", {
|
|
8734
|
+
}, [ vue.createVNode(LeftTools, null, null), vue.createVNode("div", {
|
|
8211
8735
|
class: [ ns.be("main", "content") ],
|
|
8212
8736
|
style: {
|
|
8213
8737
|
height: mainContentHeight.value + "px"
|
|
8214
8738
|
}
|
|
8215
8739
|
}, [ vue.createVNode(CanvasContext, {
|
|
8216
8740
|
ref: canvasContextRef,
|
|
8217
|
-
|
|
8218
|
-
onEditPolygon:
|
|
8219
|
-
onChangePolygon: onChangePolygon
|
|
8220
|
-
|
|
8741
|
+
labelInfo: currentNode.value,
|
|
8742
|
+
onEditPolygon: onEditPolygon,
|
|
8743
|
+
onChangePolygon: onChangePolygon,
|
|
8744
|
+
onUpdateLabelInfo: onUpdateLabelInfo
|
|
8745
|
+
}, null) ]), vue.createVNode(RightLabel, {
|
|
8746
|
+
shapes: currentNode.value.labels?.shapes,
|
|
8747
|
+
onUpdate: onUpdateLabelShape,
|
|
8748
|
+
onDelete: onDeleteLabelShape
|
|
8749
|
+
}, null) ]), vue.createVNode("footer", {
|
|
8221
8750
|
ref: footerRef,
|
|
8222
8751
|
class: [ ns.b("footer") ]
|
|
8223
8752
|
}, [ vue.createVNode("div", {
|
|
@@ -8233,7 +8762,7 @@
|
|
|
8233
8762
|
}, [ vue.createVNode(elementPlus.ElScrollbar, null, {
|
|
8234
8763
|
default: () => [ vue.createVNode("ul", {
|
|
8235
8764
|
class: [ ns.bem("footer", "center", "list") ]
|
|
8236
|
-
}, [ labelImages.value.map((
|
|
8765
|
+
}, [ labelImages.value.map((item, index) => vue.createVNode("li", {
|
|
8237
8766
|
key: index,
|
|
8238
8767
|
onClick: () => onChangeActivateNode(index),
|
|
8239
8768
|
class: {
|
|
@@ -8246,7 +8775,7 @@
|
|
|
8246
8775
|
"max-scale": 2,
|
|
8247
8776
|
"min-scale": .2,
|
|
8248
8777
|
fit: "cover"
|
|
8249
|
-
}, null) ]))
|
|
8778
|
+
}, null) ])) ]) ]
|
|
8250
8779
|
}) ]), vue.createVNode("div", {
|
|
8251
8780
|
class: [ ns.be("footer", "right") ]
|
|
8252
8781
|
}, [ vue.createVNode(elementPlus.ElIcon, {
|
|
@@ -8292,7 +8821,7 @@
|
|
|
8292
8821
|
var value;
|
|
8293
8822
|
zoomDomBindData[1] = zoomDomBindData[1] ? zoomDomBindData[1] : ".el-dialog__body",
|
|
8294
8823
|
zoomDomBindData[2] = void 0 !== zoomDomBindData[2] && zoomDomBindData[2], zoomDomBindData[3] = void 0 === zoomDomBindData[3] || zoomDomBindData[3],
|
|
8295
|
-
vue.nextTick((
|
|
8824
|
+
vue.nextTick(() => {
|
|
8296
8825
|
const zoomDom = document.querySelector(zoomDomBindData[1]), zoomDomBox = document.querySelector(zoomDomBindData[0]), zoomHandleEl = document.createElement("div");
|
|
8297
8826
|
zoomHandleEl.className = "dialog-zoom", zoomHandleEl.onmouseenter = () => {
|
|
8298
8827
|
zoomHandleEl.onmousedown = e => {
|
|
@@ -8313,22 +8842,22 @@
|
|
|
8313
8842
|
};
|
|
8314
8843
|
};
|
|
8315
8844
|
}, zoomDomBox.appendChild(zoomHandleEl);
|
|
8316
|
-
})
|
|
8845
|
+
});
|
|
8317
8846
|
}
|
|
8318
8847
|
});
|
|
8319
8848
|
}, configProviderContextKey = Symbol("configProviderContextKey"), install = function(app, options) {
|
|
8320
|
-
if (Object.keys(components).forEach(
|
|
8849
|
+
if (Object.keys(components).forEach(key => {
|
|
8321
8850
|
const component = components[key];
|
|
8322
8851
|
app.component(component.name, component);
|
|
8323
|
-
})
|
|
8852
|
+
}), (app => {
|
|
8324
8853
|
zoomDialog(app);
|
|
8325
8854
|
})(app), options) {
|
|
8326
8855
|
const inSetup = !!vue.getCurrentInstance();
|
|
8327
|
-
(app?.provide ?? (inSetup ? vue.provide : void 0))(configProviderContextKey, vue.computed((
|
|
8856
|
+
(app?.provide ?? (inSetup ? vue.provide : void 0))(configProviderContextKey, vue.computed(() => options));
|
|
8328
8857
|
}
|
|
8329
8858
|
};
|
|
8330
8859
|
var index = {
|
|
8331
|
-
version: "0.
|
|
8860
|
+
version: "0.6.0",
|
|
8332
8861
|
install: install
|
|
8333
8862
|
};
|
|
8334
8863
|
exports.NextCarousel = NextCarousel, exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable,
|
|
@@ -8344,8 +8873,8 @@
|
|
|
8344
8873
|
exports.namespaceContextKey = namespaceContextKey, exports.nextUseCssTheme = nextUseCssTheme,
|
|
8345
8874
|
exports.nextUseCssVar = nextUseCssVar, exports.translate = translate, exports.updateThemeColor = color => {
|
|
8346
8875
|
color && nextUseCssTheme("--el-color-primary", color);
|
|
8347
|
-
}, exports.updateThemeColorCssVar = updateThemeColorCssVar, exports.useDetectVideo =
|
|
8348
|
-
detectVideoFrameImage: ({container: container, video: video, modelUrl: modelUrl, classNames: classNames, classInput: classInput = []}, success, error) => modelUrl ? classNames ? void
|
|
8876
|
+
}, exports.updateThemeColorCssVar = updateThemeColorCssVar, exports.useDetectVideo = tf => ({
|
|
8877
|
+
detectVideoFrameImage: ({container: container, video: video, modelUrl: modelUrl, classNames: classNames, classInput: classInput = []}, success, error) => modelUrl ? classNames ? void tf.loadGraphModel(modelUrl).then(model => {
|
|
8349
8878
|
const canvas = document.createElement("canvas"), ctx = canvas.getContext("2d");
|
|
8350
8879
|
canvas.style.position = "absolute", canvas.style.zIndex = "99", canvas.style.pointerEvents = "none",
|
|
8351
8880
|
container && container.appendChild(canvas);
|
|
@@ -8356,7 +8885,7 @@
|
|
|
8356
8885
|
canvas.style.left = offsetLeft + "px", canvas.style.width = clientWidth + "px",
|
|
8357
8886
|
canvas.style.height = clientHeight + "px", detectCanvas.width = videoWidth, detectCanvas.height = videoHeight,
|
|
8358
8887
|
detectCanvas.style.width = clientWidth + "px", detectCanvas.style.height = clientHeight + "px",
|
|
8359
|
-
detectVideoFrame(video, model, ctx,
|
|
8888
|
+
detectVideoFrame(video, model, ctx, tf, classNames, classInput, detect_ctx, (name, score) => {
|
|
8360
8889
|
const type = "image/png";
|
|
8361
8890
|
let imageDataURL = canvas.toDataURL(type, .92).replace(type, "image/octet-stream");
|
|
8362
8891
|
imageDataURL = imageDataURL.replace(/^data:image\/[^;]+/, "data:application/octet-stream");
|
|
@@ -8370,14 +8899,14 @@
|
|
|
8370
8899
|
canvas: canvas,
|
|
8371
8900
|
imageDataURL: imageDataURL
|
|
8372
8901
|
});
|
|
8373
|
-
})
|
|
8902
|
+
});
|
|
8374
8903
|
};
|
|
8375
|
-
})
|
|
8904
|
+
}) : (error && error("模型类别不能未空"), !1) : (error && error("模型文件地址不能为空"), !1)
|
|
8376
8905
|
}), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
|
|
8377
8906
|
const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
|
|
8378
8907
|
localeRef.value.name = lang, localeRef.value.next = nextLang.next;
|
|
8379
|
-
}, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.
|
|
8908
|
+
}, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.6.0",
|
|
8380
8909
|
Object.defineProperty(exports, "__esModule", {
|
|
8381
8910
|
value: !0
|
|
8382
8911
|
});
|
|
8383
|
-
})
|
|
8912
|
+
});
|