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.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
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
|
|
|
@@ -13,8 +13,6 @@ import { localeContextKey as localeContextKey$1, ElMessage, ElTooltip, ElScrollb
|
|
|
13
13
|
|
|
14
14
|
import { useDateFormat, useNow, useFullscreen } from "@vueuse/core";
|
|
15
15
|
|
|
16
|
-
import * as tf from "@tensorflow/tfjs";
|
|
17
|
-
|
|
18
16
|
import videojs from "video.js";
|
|
19
17
|
|
|
20
18
|
import "video.js/dist/video-js.css";
|
|
@@ -31,7 +29,7 @@ const defaultNamespace = "next", _bem = (namespace, block, blockSuffix, element,
|
|
|
31
29
|
modifier && (cls += `--${modifier}`), cls;
|
|
32
30
|
}, namespaceContextKey = Symbol("namespaceContextKey"), useGetDerivedNamespace = namespaceOverrides => {
|
|
33
31
|
const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref("next")) : ref("next"));
|
|
34
|
-
return computed((
|
|
32
|
+
return computed(() => unref(derivedNamespace) || "next");
|
|
35
33
|
}, useNamespace = (block, namespaceOverrides) => {
|
|
36
34
|
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
37
35
|
return {
|
|
@@ -256,7 +254,7 @@ function isArrayLike(value) {
|
|
|
256
254
|
}
|
|
257
255
|
|
|
258
256
|
function createAssigner(assigner) {
|
|
259
|
-
return baseRest(
|
|
257
|
+
return baseRest(function(object, sources) {
|
|
260
258
|
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
|
|
261
259
|
for (customizer = assigner.length > 3 && "function" == typeof customizer ? (length--,
|
|
262
260
|
customizer) : void 0, guard && function(value, index, object) {
|
|
@@ -269,7 +267,7 @@ function createAssigner(assigner) {
|
|
|
269
267
|
source && assigner(object, source, index, customizer);
|
|
270
268
|
}
|
|
271
269
|
return object;
|
|
272
|
-
})
|
|
270
|
+
});
|
|
273
271
|
}
|
|
274
272
|
|
|
275
273
|
var objectProto$a = Object.prototype;
|
|
@@ -468,16 +466,16 @@ function memoize(func, resolver) {
|
|
|
468
466
|
memoize.Cache = MapCache;
|
|
469
467
|
|
|
470
468
|
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, reEscapeChar = /\\(\\)?/g, stringToPath = function(func) {
|
|
471
|
-
var result = memoize(func,
|
|
469
|
+
var result = memoize(func, function(key) {
|
|
472
470
|
return 500 === cache.size && cache.clear(), key;
|
|
473
|
-
})
|
|
471
|
+
}), cache = result.cache;
|
|
474
472
|
return result;
|
|
475
|
-
}(
|
|
473
|
+
}(function(string) {
|
|
476
474
|
var result = [];
|
|
477
|
-
return 46 === string.charCodeAt(0) && result.push(""), string.replace(rePropName,
|
|
475
|
+
return 46 === string.charCodeAt(0) && result.push(""), string.replace(rePropName, function(match, number, quote, subString) {
|
|
478
476
|
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
|
|
479
|
-
})
|
|
480
|
-
})
|
|
477
|
+
}), result;
|
|
478
|
+
});
|
|
481
479
|
|
|
482
480
|
function castPath(value, object) {
|
|
483
481
|
return isArray(value) ? value : function(value, object) {
|
|
@@ -541,9 +539,9 @@ var propertyIsEnumerable = Object.prototype.propertyIsEnumerable, nativeGetSymbo
|
|
|
541
539
|
predicate(value, index, array) && (result[resIndex++] = value);
|
|
542
540
|
}
|
|
543
541
|
return result;
|
|
544
|
-
}(nativeGetSymbols(object),
|
|
542
|
+
}(nativeGetSymbols(object), function(symbol) {
|
|
545
543
|
return propertyIsEnumerable.call(object, symbol);
|
|
546
|
-
}))
|
|
544
|
+
}));
|
|
547
545
|
} : function() {
|
|
548
546
|
return [];
|
|
549
547
|
};
|
|
@@ -620,10 +618,10 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
620
618
|
break;
|
|
621
619
|
}
|
|
622
620
|
if (seen) {
|
|
623
|
-
if (!arraySome(other,
|
|
621
|
+
if (!arraySome(other, function(othValue, othIndex) {
|
|
624
622
|
if (key = othIndex, !seen.has(key) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex);
|
|
625
623
|
var key;
|
|
626
|
-
}))
|
|
624
|
+
})) {
|
|
627
625
|
result = !1;
|
|
628
626
|
break;
|
|
629
627
|
}
|
|
@@ -637,16 +635,16 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
637
635
|
|
|
638
636
|
function mapToArray(map) {
|
|
639
637
|
var index = -1, result = Array(map.size);
|
|
640
|
-
return map.forEach(
|
|
638
|
+
return map.forEach(function(value, key) {
|
|
641
639
|
result[++index] = [ key, value ];
|
|
642
|
-
})
|
|
640
|
+
}), result;
|
|
643
641
|
}
|
|
644
642
|
|
|
645
643
|
function setToArray(set) {
|
|
646
644
|
var index = -1, result = Array(set.size);
|
|
647
|
-
return set.forEach(
|
|
645
|
+
return set.forEach(function(value) {
|
|
648
646
|
result[++index] = value;
|
|
649
|
-
})
|
|
647
|
+
}), result;
|
|
650
648
|
}
|
|
651
649
|
|
|
652
650
|
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
@@ -793,21 +791,25 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
|
|
|
793
791
|
}
|
|
794
792
|
|
|
795
793
|
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
796
|
-
object !== source && baseFor(source,
|
|
794
|
+
object !== source && baseFor(source, function(srcValue, key) {
|
|
797
795
|
if (stack || (stack = new Stack), isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); else {
|
|
798
796
|
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
|
799
797
|
void 0 === newValue && (newValue = srcValue), assignMergeValue(object, key, newValue);
|
|
800
798
|
}
|
|
801
|
-
}
|
|
799
|
+
}, keysIn);
|
|
802
800
|
}
|
|
803
801
|
|
|
804
|
-
var mergeWith = createAssigner(
|
|
802
|
+
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
805
803
|
baseMerge(object, source, srcIndex, customizer);
|
|
806
|
-
})
|
|
804
|
+
});
|
|
807
805
|
|
|
808
|
-
|
|
806
|
+
function isEqual(value, other) {
|
|
807
|
+
return baseIsEqual(value, other);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
var merge = createAssigner(function(object, source, srcIndex) {
|
|
809
811
|
baseMerge(object, source, srcIndex);
|
|
810
|
-
})
|
|
812
|
+
}), zhcnLocale = {
|
|
811
813
|
name: "zh-cn",
|
|
812
814
|
next: {
|
|
813
815
|
loading: "加载中...",
|
|
@@ -887,9 +889,18 @@ var merge = createAssigner((function(object, source, srcIndex) {
|
|
|
887
889
|
},
|
|
888
890
|
labelme: {
|
|
889
891
|
saveLabel: "保存",
|
|
892
|
+
confirmDeleteLabel: "确定要删除该标注吗?",
|
|
893
|
+
emptyLabelText: "暂无标签数据",
|
|
890
894
|
createPolygon: "创建多边形",
|
|
891
895
|
editPolygon: "编辑多边形",
|
|
892
|
-
deletePolyton: "删除多边形"
|
|
896
|
+
deletePolyton: "删除多边形",
|
|
897
|
+
createRectangle: "创建矩形",
|
|
898
|
+
createCircle: "创建圆形",
|
|
899
|
+
selectClasses: "选择标签",
|
|
900
|
+
emptyClassesText: "暂无标注",
|
|
901
|
+
deleteClasses: "删除标注",
|
|
902
|
+
labelGroupId: "分组ID",
|
|
903
|
+
labelDescription: "标注描述"
|
|
893
904
|
}
|
|
894
905
|
}
|
|
895
906
|
}, enLocale = {
|
|
@@ -972,9 +983,18 @@ var merge = createAssigner((function(object, source, srcIndex) {
|
|
|
972
983
|
},
|
|
973
984
|
labelme: {
|
|
974
985
|
saveLabel: "saving...",
|
|
986
|
+
confirmDeleteLabel: "Are you sure you want to delete this annotation?",
|
|
987
|
+
emptyLabelText: "No label data",
|
|
975
988
|
createPolygon: "create polygon",
|
|
976
989
|
editPolygon: "edit polygon",
|
|
977
|
-
|
|
990
|
+
deletePolygon: "delete polygon",
|
|
991
|
+
createRectangle: "create rectangle",
|
|
992
|
+
createCircle: "create circle",
|
|
993
|
+
selectClasses: "select classes",
|
|
994
|
+
emptyClassesText: "No label classes",
|
|
995
|
+
deleteClasses: "delete classes",
|
|
996
|
+
labelGroupId: "Group ID",
|
|
997
|
+
labelDescription: "label description"
|
|
978
998
|
}
|
|
979
999
|
}
|
|
980
1000
|
}, zhtwLocale = {
|
|
@@ -1048,15 +1068,27 @@ var merge = createAssigner((function(object, source, srcIndex) {
|
|
|
1048
1068
|
},
|
|
1049
1069
|
labelimg: {
|
|
1050
1070
|
saveTxt: "保存中...",
|
|
1051
|
-
emptyLabelText: "
|
|
1052
|
-
confirmDeleteLabel: "
|
|
1053
|
-
saveLabel: "
|
|
1054
|
-
instructions: "
|
|
1055
|
-
labelNoUpdate: "
|
|
1056
|
-
zoomRestore: "
|
|
1071
|
+
emptyLabelText: "暂暫無標註數據",
|
|
1072
|
+
confirmDeleteLabel: "確定要刪除該標註嗎?",
|
|
1073
|
+
saveLabel: "保存當前標註",
|
|
1074
|
+
instructions: "使用說明",
|
|
1075
|
+
labelNoUpdate: "暫無標籤數據更新",
|
|
1076
|
+
zoomRestore: "還原"
|
|
1057
1077
|
},
|
|
1058
1078
|
labelme: {
|
|
1059
|
-
saveLabel: "保存"
|
|
1079
|
+
saveLabel: "保存",
|
|
1080
|
+
confirmDeleteLabel: "確定要刪除該標註嗎?",
|
|
1081
|
+
emptyLabelText: "暫無標註數據",
|
|
1082
|
+
createPolygon: "創城多邊形",
|
|
1083
|
+
editPolygon: "編輯多邊形",
|
|
1084
|
+
deletePolygon: "刪除多邊形",
|
|
1085
|
+
createRectangle: "創建矩形",
|
|
1086
|
+
createCircle: "創建圓形",
|
|
1087
|
+
selectClasses: "選擇標籤",
|
|
1088
|
+
emptyClassesText: "咱無標註",
|
|
1089
|
+
deleteClasses: "刪除標註",
|
|
1090
|
+
labelGroupId: "分組ID",
|
|
1091
|
+
labelDescription: "標註描述"
|
|
1060
1092
|
}
|
|
1061
1093
|
}
|
|
1062
1094
|
};
|
|
@@ -1071,8 +1103,8 @@ const localeLang = {
|
|
|
1071
1103
|
[zhtwLocale.name]: {
|
|
1072
1104
|
...zhtwLocale
|
|
1073
1105
|
}
|
|
1074
|
-
}, translate = (path, option, locale) => get(locale, path, path)?.replace(/\{(\w+)\}/g, (
|
|
1075
|
-
const lang = computed((
|
|
1106
|
+
}, translate = (path, option, locale) => get(locale, path, path)?.replace(/\{(\w+)\}/g, (_, key) => `${option?.[key] ?? `{${key}}`}`), buildTranslator = locale => (path, option) => translate(path, option, unref(locale)), buildLocaleContext = locale => {
|
|
1107
|
+
const lang = computed(() => unref(locale).name), localeRef = isRef(locale) ? locale : ref(locale), nextLang = localeLang[lang.value] || localeLang["zh-cn"];
|
|
1076
1108
|
return localeRef.value.next = nextLang.next, {
|
|
1077
1109
|
lang: lang,
|
|
1078
1110
|
locale: localeRef,
|
|
@@ -1080,7 +1112,7 @@ const localeLang = {
|
|
|
1080
1112
|
};
|
|
1081
1113
|
}, localeContextKey = localeContextKey$1, useLocale = localeOverrides => {
|
|
1082
1114
|
const locale = localeOverrides || inject(localeContextKey, ref());
|
|
1083
|
-
return buildLocaleContext(computed((
|
|
1115
|
+
return buildLocaleContext(computed(() => locale?.value || zhcnLocale));
|
|
1084
1116
|
}, useLanguage = (locale, lang) => {
|
|
1085
1117
|
const localeRef = isRef(locale) ? locale : ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
|
|
1086
1118
|
localeRef.value.name = lang, localeRef.value.next = nextLang.next;
|
|
@@ -1088,8 +1120,8 @@ const localeLang = {
|
|
|
1088
1120
|
|
|
1089
1121
|
function useChangeColor() {
|
|
1090
1122
|
const rgbaToHex = rgba => {
|
|
1091
|
-
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map(
|
|
1092
|
-
return `#${[ r, g, b ].map(
|
|
1123
|
+
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map(value => parseFloat(value)), [r, g, b] = rgbaValues;
|
|
1124
|
+
return `#${[ r, g, b ].map(value => Math.round(value).toString(16).padStart(2, "0")).join("")}`.toUpperCase();
|
|
1093
1125
|
};
|
|
1094
1126
|
return {
|
|
1095
1127
|
hexToRgb: str => {
|
|
@@ -1116,8 +1148,8 @@ function useChangeColor() {
|
|
|
1116
1148
|
},
|
|
1117
1149
|
rgbaToHex: rgbaToHex,
|
|
1118
1150
|
rgbaToHexAlpha: rgba => {
|
|
1119
|
-
const rgbaValues = rgba.replace(/^rgba?\(|\s+|\)$/g, "").split(",").map(
|
|
1120
|
-
return `#${[ r, g, b ].map(
|
|
1151
|
+
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");
|
|
1152
|
+
return `#${[ r, g, b ].map(value => Math.round(value).toString(16).padStart(2, "0")).join("")}${alpha}`.toUpperCase();
|
|
1121
1153
|
},
|
|
1122
1154
|
getDarkColor: (color, level) => {
|
|
1123
1155
|
let _color = color;
|
|
@@ -1160,9 +1192,9 @@ const {getLightColor: getLightColor$5} = useChangeColor(), nextUseCssVar = (cssv
|
|
|
1160
1192
|
}, detectVideoFrame = async (video, model, ctx, tf, classNames, classInput = [], detect_ctx, success) => {
|
|
1161
1193
|
const {videoWidth: videoWidth, videoHeight: videoHeight} = video;
|
|
1162
1194
|
if (!videoWidth || !videoHeight) return;
|
|
1163
|
-
let [modelWeight, modelHeight] = model.inputs[0].shape.slice(1, 3), input = tf.tidy((
|
|
1195
|
+
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));
|
|
1164
1196
|
ctx.clearRect(0, 0, videoWidth, videoHeight), detect_ctx.clearRect(0, 0, videoWidth, videoHeight),
|
|
1165
|
-
await model.executeAsync(input).then(
|
|
1197
|
+
await model.executeAsync(input).then(async res => {
|
|
1166
1198
|
let [boxes, scores, classes, valid_detections] = res;
|
|
1167
1199
|
for (let i = 0; i < valid_detections.dataSync()[0]; ++i) {
|
|
1168
1200
|
let [x0, y0, x1, y1] = boxes.dataSync().slice(4 * i, 4 * (i + 1));
|
|
@@ -1180,7 +1212,7 @@ const {getLightColor: getLightColor$5} = useChangeColor(), nextUseCssVar = (cssv
|
|
|
1180
1212
|
if (classInput?.length) for (let k = 0; k < classInput.length; k++) {
|
|
1181
1213
|
const item = classInput[k];
|
|
1182
1214
|
if (item.cls == cls && Number(score) > item.score) {
|
|
1183
|
-
const target = classNames.find(
|
|
1215
|
+
const target = classNames.find(o => o.value == cls);
|
|
1184
1216
|
if (target) {
|
|
1185
1217
|
const name = target.label;
|
|
1186
1218
|
drawOutcome(name, score, await drawVideoFrame(video, detect_ctx)), drawOutcome(name, score, ctx),
|
|
@@ -1188,14 +1220,14 @@ const {getLightColor: getLightColor$5} = useChangeColor(), nextUseCssVar = (cssv
|
|
|
1188
1220
|
}
|
|
1189
1221
|
}
|
|
1190
1222
|
} else if (score > .5) {
|
|
1191
|
-
const target = classNames.find(
|
|
1223
|
+
const target = classNames.find(o => o.value == cls);
|
|
1192
1224
|
if (target) {
|
|
1193
1225
|
drawOutcome(target.label || "", score, ctx);
|
|
1194
1226
|
}
|
|
1195
1227
|
}
|
|
1196
1228
|
}
|
|
1197
1229
|
input.dispose(), tf.dispose(res);
|
|
1198
|
-
})
|
|
1230
|
+
});
|
|
1199
1231
|
}, drawVideoFrame = (videoElement, ctx) => {
|
|
1200
1232
|
const width = videoElement.videoWidth, height = videoElement.videoHeight, mediaRatio = width / height, canvasRatio = width / height, sw = width, sh = height;
|
|
1201
1233
|
let dx, dy, dw, dh;
|
|
@@ -1204,8 +1236,8 @@ const {getLightColor: getLightColor$5} = useChangeColor(), nextUseCssVar = (cssv
|
|
|
1204
1236
|
dh = height, dx = 0, dy = 0) : mediaRatio < canvasRatio && (dw = height * mediaRatio,
|
|
1205
1237
|
dh = height, dx = Math.round((width - dw) / 2), dy = 0), ctx.drawImage(videoElement, 0, 0, sw, sh, dx, dy, dw, dh),
|
|
1206
1238
|
ctx;
|
|
1207
|
-
}, useDetectVideo =
|
|
1208
|
-
detectVideoFrameImage: ({container: container, video: video, modelUrl: modelUrl, classNames: classNames, classInput: classInput = []}, success, error) => modelUrl ? classNames ? void tf.loadGraphModel(modelUrl).then(
|
|
1239
|
+
}, useDetectVideo = tf => ({
|
|
1240
|
+
detectVideoFrameImage: ({container: container, video: video, modelUrl: modelUrl, classNames: classNames, classInput: classInput = []}, success, error) => modelUrl ? classNames ? void tf.loadGraphModel(modelUrl).then(model => {
|
|
1209
1241
|
const canvas = document.createElement("canvas"), ctx = canvas.getContext("2d");
|
|
1210
1242
|
canvas.style.position = "absolute", canvas.style.zIndex = "99", canvas.style.pointerEvents = "none",
|
|
1211
1243
|
container && container.appendChild(canvas);
|
|
@@ -1216,7 +1248,7 @@ const {getLightColor: getLightColor$5} = useChangeColor(), nextUseCssVar = (cssv
|
|
|
1216
1248
|
canvas.style.left = offsetLeft + "px", canvas.style.width = clientWidth + "px",
|
|
1217
1249
|
canvas.style.height = clientHeight + "px", detectCanvas.width = videoWidth, detectCanvas.height = videoHeight,
|
|
1218
1250
|
detectCanvas.style.width = clientWidth + "px", detectCanvas.style.height = clientHeight + "px",
|
|
1219
|
-
detectVideoFrame(video, model, ctx, tf, classNames, classInput, detect_ctx, (
|
|
1251
|
+
detectVideoFrame(video, model, ctx, tf, classNames, classInput, detect_ctx, (name, score) => {
|
|
1220
1252
|
const type = "image/png";
|
|
1221
1253
|
let imageDataURL = canvas.toDataURL(type, .92).replace(type, "image/octet-stream");
|
|
1222
1254
|
imageDataURL = imageDataURL.replace(/^data:image\/[^;]+/, "data:application/octet-stream");
|
|
@@ -1230,9 +1262,9 @@ const {getLightColor: getLightColor$5} = useChangeColor(), nextUseCssVar = (cssv
|
|
|
1230
1262
|
canvas: canvas,
|
|
1231
1263
|
imageDataURL: imageDataURL
|
|
1232
1264
|
});
|
|
1233
|
-
})
|
|
1265
|
+
});
|
|
1234
1266
|
};
|
|
1235
|
-
})
|
|
1267
|
+
}) : (error && error("模型类别不能未空"), !1) : (error && error("模型文件地址不能为空"), !1)
|
|
1236
1268
|
}), withInstall = (main, extra) => (main.install = app => {
|
|
1237
1269
|
for (const comp of [ main, ...Object.values({}) ]) app.component(comp.name, comp);
|
|
1238
1270
|
}, main), slots_config_headerMenu = "header-menu", slots_config_headerToolsPrefix = "header-tools-prefix", slots_config_headerToolsSuffix = "header-tools-suffix";
|
|
@@ -1317,14 +1349,14 @@ const NextTextEllipsis = withInstall(defineComponent({
|
|
|
1317
1349
|
}
|
|
1318
1350
|
},
|
|
1319
1351
|
setup(props, {slots: slots}) {
|
|
1320
|
-
const isTip = ref(!1), setWidth = computed((
|
|
1352
|
+
const isTip = ref(!1), setWidth = computed(() => {
|
|
1321
1353
|
const width = props.width;
|
|
1322
1354
|
let style = {
|
|
1323
1355
|
textAlign: props.textAlign
|
|
1324
1356
|
};
|
|
1325
1357
|
return width && ("string" == typeof width ? style.width = width : "number" == typeof width && (style.width = width + "px")),
|
|
1326
1358
|
style;
|
|
1327
|
-
})
|
|
1359
|
+
}), ellipsisRef = ref(), onMouseenter = () => {
|
|
1328
1360
|
try {
|
|
1329
1361
|
const dom = ellipsisRef.value;
|
|
1330
1362
|
dom && dom.scrollWidth && dom.scrollWidth > dom.offsetWidth ? isTip.value = !0 : isTip.value = !1;
|
|
@@ -1481,6 +1513,19 @@ var LogoView = defineComponent({
|
|
|
1481
1513
|
fill: "currentColor",
|
|
1482
1514
|
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"
|
|
1483
1515
|
}) ]))
|
|
1516
|
+
}), edit_default = defineComponent({
|
|
1517
|
+
name: "Edit",
|
|
1518
|
+
__name: "edit",
|
|
1519
|
+
setup: __props => (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
1520
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1521
|
+
viewBox: "0 0 1024 1024"
|
|
1522
|
+
}, [ createElementVNode("path", {
|
|
1523
|
+
fill: "currentColor",
|
|
1524
|
+
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"
|
|
1525
|
+
}), createElementVNode("path", {
|
|
1526
|
+
fill: "currentColor",
|
|
1527
|
+
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"
|
|
1528
|
+
}) ]))
|
|
1484
1529
|
}), full_screen_default = defineComponent({
|
|
1485
1530
|
name: "FullScreen",
|
|
1486
1531
|
__name: "full-screen",
|
|
@@ -1836,14 +1881,14 @@ var stateHandler$1 = {
|
|
|
1836
1881
|
if (!element.contentDocument) {
|
|
1837
1882
|
var state = getState(element);
|
|
1838
1883
|
return state.checkForObjectDocumentTimeoutId && window.clearTimeout(state.checkForObjectDocumentTimeoutId),
|
|
1839
|
-
void (state.checkForObjectDocumentTimeoutId = setTimeout(
|
|
1884
|
+
void (state.checkForObjectDocumentTimeoutId = setTimeout(function() {
|
|
1840
1885
|
state.checkForObjectDocumentTimeoutId = 0, getDocument(element, callback);
|
|
1841
|
-
}
|
|
1886
|
+
}, 100));
|
|
1842
1887
|
}
|
|
1843
1888
|
callback(element.contentDocument);
|
|
1844
|
-
}(this,
|
|
1889
|
+
}(this, function(objectDocument) {
|
|
1845
1890
|
callback(element);
|
|
1846
|
-
})
|
|
1891
|
+
});
|
|
1847
1892
|
}, browserDetector$1.isIE() || (object.data = "about:blank"), getState(element) && (element.appendChild(object),
|
|
1848
1893
|
getState(element).object = object, browserDetector$1.isIE() && (object.data = "about:blank"));
|
|
1849
1894
|
}
|
|
@@ -2046,7 +2091,7 @@ var stateHandler$1 = {
|
|
|
2046
2091
|
function updateDetectorElements(done) {
|
|
2047
2092
|
var width = element.offsetWidth, height = element.offsetHeight, sizeChanged = width !== getState(element).lastWidth || height !== getState(element).lastHeight;
|
|
2048
2093
|
debug("Storing current size", width, height), storeCurrentSize(element, width, height),
|
|
2049
|
-
batchProcessor.add(0,
|
|
2094
|
+
batchProcessor.add(0, function() {
|
|
2050
2095
|
if (sizeChanged) if (getState(element)) if (areElementsInjected()) {
|
|
2051
2096
|
if (options.debug) {
|
|
2052
2097
|
var w = element.offsetWidth, h = element.offsetHeight;
|
|
@@ -2054,11 +2099,11 @@ var stateHandler$1 = {
|
|
|
2054
2099
|
}
|
|
2055
2100
|
updateChildSizes(element, width, height);
|
|
2056
2101
|
} else debug("Aborting because element container has not been initialized"); else debug("Aborting because element has been uninstalled");
|
|
2057
|
-
})
|
|
2102
|
+
}), batchProcessor.add(1, function() {
|
|
2058
2103
|
getState(element) ? areElementsInjected() ? positionScrollbars(element, width, height) : debug("Aborting because element container has not been initialized") : debug("Aborting because element has been uninstalled");
|
|
2059
|
-
})
|
|
2104
|
+
}), sizeChanged && done && batchProcessor.add(2, function() {
|
|
2060
2105
|
getState(element) ? areElementsInjected() ? done() : debug("Aborting because element container has not been initialized") : debug("Aborting because element has been uninstalled");
|
|
2061
|
-
})
|
|
2106
|
+
});
|
|
2062
2107
|
}
|
|
2063
2108
|
function areElementsInjected() {
|
|
2064
2109
|
return !!getState(element).container;
|
|
@@ -2068,9 +2113,9 @@ var stateHandler$1 = {
|
|
|
2068
2113
|
var state = getState(element);
|
|
2069
2114
|
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..."),
|
|
2070
2115
|
state.lastNotifiedWidth = state.lastWidth, state.lastNotifiedHeight = state.lastHeight,
|
|
2071
|
-
void forEach$1(getState(element).listeners,
|
|
2116
|
+
void forEach$1(getState(element).listeners, function(listener) {
|
|
2072
2117
|
listener(element);
|
|
2073
|
-
}))
|
|
2118
|
+
}));
|
|
2074
2119
|
}
|
|
2075
2120
|
function handleScroll() {
|
|
2076
2121
|
debug("Scroll detected."), isUnrendered(element) ? debug("Scroll event fired while unrendered. Ignoring...") : updateDetectorElements(notifyListenersIfNeeded);
|
|
@@ -2139,9 +2184,9 @@ function isCollection(obj) {
|
|
|
2139
2184
|
function toArray(collection) {
|
|
2140
2185
|
if (Array.isArray(collection)) return collection;
|
|
2141
2186
|
var array = [];
|
|
2142
|
-
return forEach(collection,
|
|
2187
|
+
return forEach(collection, function(obj) {
|
|
2143
2188
|
array.push(obj);
|
|
2144
|
-
})
|
|
2189
|
+
}), array;
|
|
2145
2190
|
}
|
|
2146
2191
|
|
|
2147
2192
|
function isElement(obj) {
|
|
@@ -2188,9 +2233,9 @@ var elementResizeDetector = function(options) {
|
|
|
2188
2233
|
listenTo: function(options, elements, listener) {
|
|
2189
2234
|
function onResizeCallback(element) {
|
|
2190
2235
|
var listeners = eventListenerHandler.get(element);
|
|
2191
|
-
forEach(listeners,
|
|
2236
|
+
forEach(listeners, function(listener) {
|
|
2192
2237
|
listener(element);
|
|
2193
|
-
})
|
|
2238
|
+
});
|
|
2194
2239
|
}
|
|
2195
2240
|
function addListener(callOnAdd, element, listener) {
|
|
2196
2241
|
eventListenerHandler.add(element, listener), callOnAdd && listener(element);
|
|
@@ -2201,20 +2246,20 @@ var elementResizeDetector = function(options) {
|
|
|
2201
2246
|
if (!isCollection(elements)) return reporter.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
|
|
2202
2247
|
elements = toArray(elements);
|
|
2203
2248
|
}
|
|
2204
|
-
var elementsReady = 0, callOnAdd = getOption(options, "callOnAdd", globalOptions.callOnAdd), onReadyCallback = getOption(options, "onReady",
|
|
2205
|
-
forEach(elements,
|
|
2249
|
+
var elementsReady = 0, callOnAdd = getOption(options, "callOnAdd", globalOptions.callOnAdd), onReadyCallback = getOption(options, "onReady", function() {}), debug = getOption(options, "debug", globalOptions.debug);
|
|
2250
|
+
forEach(elements, function(element) {
|
|
2206
2251
|
stateHandler.getState(element) || (stateHandler.initState(element), idHandler.set(element));
|
|
2207
2252
|
var id = idHandler.get(element);
|
|
2208
2253
|
if (debug && reporter.log("Attaching listener to element", id, element), !elementUtils.isDetectable(element)) return debug && reporter.log(id, "Not detectable."),
|
|
2209
2254
|
elementUtils.isBusy(element) ? (debug && reporter.log(id, "System busy making it detectable"),
|
|
2210
2255
|
addListener(callOnAdd, element, listener), onReadyCallbacks[id] = onReadyCallbacks[id] || [],
|
|
2211
|
-
void onReadyCallbacks[id].push(
|
|
2256
|
+
void onReadyCallbacks[id].push(function() {
|
|
2212
2257
|
++elementsReady === elements.length && onReadyCallback();
|
|
2213
|
-
}))
|
|
2258
|
+
})) : (debug && reporter.log(id, "Making detectable..."), elementUtils.markBusy(element, !0),
|
|
2214
2259
|
detectionStrategy.makeDetectable({
|
|
2215
2260
|
debug: debug,
|
|
2216
2261
|
important: importantCssRules
|
|
2217
|
-
}, element,
|
|
2262
|
+
}, element, function(element) {
|
|
2218
2263
|
if (debug && reporter.log(id, "onElementDetectable"), stateHandler.getState(element)) {
|
|
2219
2264
|
elementUtils.markAsDetectable(element), elementUtils.markBusy(element, !1), detectionStrategy.addListener(element, onResizeCallback),
|
|
2220
2265
|
addListener(callOnAdd, element, listener);
|
|
@@ -2223,15 +2268,15 @@ var elementResizeDetector = function(options) {
|
|
|
2223
2268
|
var width = element.offsetWidth, height = element.offsetHeight;
|
|
2224
2269
|
state.startSize.width === width && state.startSize.height === height || onResizeCallback(element);
|
|
2225
2270
|
}
|
|
2226
|
-
onReadyCallbacks[id] && forEach(onReadyCallbacks[id],
|
|
2271
|
+
onReadyCallbacks[id] && forEach(onReadyCallbacks[id], function(callback) {
|
|
2227
2272
|
callback();
|
|
2228
|
-
})
|
|
2273
|
+
});
|
|
2229
2274
|
} else debug && reporter.log(id, "Element uninstalled before being detectable.");
|
|
2230
2275
|
delete onReadyCallbacks[id], ++elementsReady === elements.length && onReadyCallback();
|
|
2231
|
-
}))
|
|
2276
|
+
}));
|
|
2232
2277
|
debug && reporter.log(id, "Already detecable, adding listener."), addListener(callOnAdd, element, listener),
|
|
2233
2278
|
elementsReady++;
|
|
2234
|
-
})
|
|
2279
|
+
}), elementsReady === elements.length && onReadyCallback();
|
|
2235
2280
|
},
|
|
2236
2281
|
removeListener: eventListenerHandler.removeListener,
|
|
2237
2282
|
removeAllListeners: eventListenerHandler.removeAllListeners,
|
|
@@ -2241,10 +2286,10 @@ var elementResizeDetector = function(options) {
|
|
|
2241
2286
|
if (!isCollection(elements)) return reporter.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
|
|
2242
2287
|
elements = toArray(elements);
|
|
2243
2288
|
}
|
|
2244
|
-
forEach(elements,
|
|
2289
|
+
forEach(elements, function(element) {
|
|
2245
2290
|
eventListenerHandler.removeAllListeners(element), detectionStrategy.uninstall(element),
|
|
2246
2291
|
stateHandler.cleanState(element);
|
|
2247
|
-
})
|
|
2292
|
+
});
|
|
2248
2293
|
},
|
|
2249
2294
|
initDocument: function(targetDocument) {
|
|
2250
2295
|
detectionStrategy.initDocument && detectionStrategy.initDocument(targetDocument);
|
|
@@ -2262,13 +2307,13 @@ var elementResizeDetectorMaker = getDefaultExportFromCjs(elementResizeDetector);
|
|
|
2262
2307
|
const elementResize = (el, cb) => {
|
|
2263
2308
|
const erd = elementResizeDetectorMaker();
|
|
2264
2309
|
let timer = null;
|
|
2265
|
-
erd.listenTo(el, (
|
|
2266
|
-
null !== timer && clearTimeout(timer), timer = setTimeout((
|
|
2310
|
+
erd.listenTo(el, () => {
|
|
2311
|
+
null !== timer && clearTimeout(timer), timer = setTimeout(() => {
|
|
2267
2312
|
cb && cb(el), clearTimeout(timer);
|
|
2268
|
-
}
|
|
2269
|
-
})
|
|
2270
|
-
erd.removeListener(el, (
|
|
2271
|
-
})
|
|
2313
|
+
}, 200);
|
|
2314
|
+
}), onUnmounted(() => {
|
|
2315
|
+
erd.removeListener(el, () => {});
|
|
2316
|
+
});
|
|
2272
2317
|
}, deepClone = source => {
|
|
2273
2318
|
if (null == source) return source;
|
|
2274
2319
|
let target;
|
|
@@ -2299,7 +2344,26 @@ const elementResize = (el, cb) => {
|
|
|
2299
2344
|
}), {
|
|
2300
2345
|
target: target,
|
|
2301
2346
|
source: source
|
|
2302
|
-
})
|
|
2347
|
+
}), timeUniqueId = () => {
|
|
2348
|
+
const dateStr = ((date, format = "yyyy-MM-dd") => {
|
|
2349
|
+
if ("Invalid Date" != date) {
|
|
2350
|
+
const o = {
|
|
2351
|
+
"M+": date.getMonth() + 1,
|
|
2352
|
+
"d+": date.getDate(),
|
|
2353
|
+
"h+": date.getHours(),
|
|
2354
|
+
"m+": date.getMinutes(),
|
|
2355
|
+
"s+": date.getSeconds(),
|
|
2356
|
+
"q+": Math.floor((date.getMonth() + 3) / 3),
|
|
2357
|
+
S: date.getMilliseconds()
|
|
2358
|
+
};
|
|
2359
|
+
/(y+)/.test(format) && (format = format.replace(RegExp.$1, (date.getFullYear() + "").substring(4 - RegExp.$1.length)));
|
|
2360
|
+
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)));
|
|
2361
|
+
return format;
|
|
2362
|
+
}
|
|
2363
|
+
return "";
|
|
2364
|
+
})(new Date, "yyyyMMddhhmmsss"), num = dateStr + Math.random().toString(10).substring(2, 8);
|
|
2365
|
+
return String(num);
|
|
2366
|
+
};
|
|
2303
2367
|
|
|
2304
2368
|
var LayoutSetting = defineComponent({
|
|
2305
2369
|
setup() {
|
|
@@ -2434,7 +2498,7 @@ var LayoutSetting = defineComponent({
|
|
|
2434
2498
|
default: () => [ createTextVNode("布局方式") ]
|
|
2435
2499
|
}), createVNode("ul", {
|
|
2436
2500
|
class: _ns.b("config-bar-layout")
|
|
2437
|
-
}, [ layouts.map(
|
|
2501
|
+
}, [ layouts.map(item => createVNode("li", {
|
|
2438
2502
|
class: [ _ns.be("config-bar-layout", item.type), _ns.is("active", settingConfig.layout === item.type) ],
|
|
2439
2503
|
onClick: event => ((event, layout) => {
|
|
2440
2504
|
event.stopPropagation(), settingConfig.layout = layout.type, _changeUpdateOptions();
|
|
@@ -2445,7 +2509,7 @@ var LayoutSetting = defineComponent({
|
|
|
2445
2509
|
class: "layout-box"
|
|
2446
2510
|
}, [ createVNode("p", {
|
|
2447
2511
|
class: "layout-text"
|
|
2448
|
-
}, [ item.text ]) ]) ]), createVNode("aside", null, null) ]))
|
|
2512
|
+
}, [ item.text ]) ]) ]), createVNode("aside", null, null) ])) ]), createVNode("div", {
|
|
2449
2513
|
class: _ns.b("config-bar-item"),
|
|
2450
2514
|
style: {
|
|
2451
2515
|
"margin-top": "20px"
|
|
@@ -2466,7 +2530,7 @@ var LayoutSetting = defineComponent({
|
|
|
2466
2530
|
|
|
2467
2531
|
var HeaderTools = defineComponent({
|
|
2468
2532
|
setup() {
|
|
2469
|
-
const locale = inject(localeContextKey, ref()), config = inject("options", {}), {t: t} = useLocale(), {toggle: toggle, isFullscreen: isFullscreen} = useFullscreen(), language = ref(computed((
|
|
2533
|
+
const locale = inject(localeContextKey, ref()), config = inject("options", {}), {t: t} = useLocale(), {toggle: toggle, isFullscreen: isFullscreen} = useFullscreen(), language = ref(computed(() => config.language).value), settingDrawer = ref(!1);
|
|
2470
2534
|
return {
|
|
2471
2535
|
locale: locale,
|
|
2472
2536
|
config: config,
|
|
@@ -2474,13 +2538,17 @@ var HeaderTools = defineComponent({
|
|
|
2474
2538
|
toggle: toggle,
|
|
2475
2539
|
isFullscreen: isFullscreen,
|
|
2476
2540
|
language: language,
|
|
2477
|
-
settingDrawer: settingDrawer
|
|
2541
|
+
settingDrawer: settingDrawer,
|
|
2542
|
+
openSettingDrawer: () => {
|
|
2543
|
+
settingDrawer.value = !0;
|
|
2544
|
+
},
|
|
2545
|
+
closeSettingDrawer: () => {
|
|
2546
|
+
settingDrawer.value = !1;
|
|
2547
|
+
}
|
|
2478
2548
|
};
|
|
2479
2549
|
},
|
|
2480
2550
|
render() {
|
|
2481
|
-
const _ns = inject("__ns__", {}), _config = this.config, _emit = inject("__emit__", {}), slots = this.$slots, _t = this.t, isFullscreen = this.isFullscreen, profile_url = _config.profile, _userDropdown = _config.userDropdown, _languageDropdown = _config.languageDropdown
|
|
2482
|
-
this.settingDrawer = !1;
|
|
2483
|
-
};
|
|
2551
|
+
const _ns = inject("__ns__", {}), _config = this.config, _emit = inject("__emit__", {}), slots = this.$slots, _t = this.t, isFullscreen = this.isFullscreen, profile_url = _config.profile, _userDropdown = _config.userDropdown, _languageDropdown = _config.languageDropdown;
|
|
2484
2552
|
return createVNode(Fragment, null, [ createVNode("ul", {
|
|
2485
2553
|
class: _ns.b("header-tools")
|
|
2486
2554
|
}, [ slots[slots_config_headerToolsPrefix]?.(), createVNode("li", null, [ createVNode(ElDropdown, {
|
|
@@ -2515,12 +2583,12 @@ var HeaderTools = defineComponent({
|
|
|
2515
2583
|
}) ]),
|
|
2516
2584
|
dropdown: () => {
|
|
2517
2585
|
let _slot;
|
|
2518
|
-
return createVNode(ElDropdownMenu, null, "function" == typeof (s = _slot = _languageDropdown.map(
|
|
2586
|
+
return createVNode(ElDropdownMenu, null, "function" == typeof (s = _slot = _languageDropdown.map(item => createVNode(ElDropdownItem, {
|
|
2519
2587
|
command: item.value,
|
|
2520
2588
|
disabled: this.language === item.value
|
|
2521
2589
|
}, {
|
|
2522
2590
|
default: () => [ item.label ]
|
|
2523
|
-
})))
|
|
2591
|
+
}))) || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? _slot : {
|
|
2524
2592
|
default: () => [ _slot ]
|
|
2525
2593
|
});
|
|
2526
2594
|
var s;
|
|
@@ -2576,7 +2644,7 @@ var HeaderTools = defineComponent({
|
|
|
2576
2644
|
default: () => [ createVNode(arrow_down_default, null, null) ]
|
|
2577
2645
|
}) ]),
|
|
2578
2646
|
dropdown: () => createVNode(ElDropdownMenu, null, {
|
|
2579
|
-
default: () => [ _userDropdown?.map(
|
|
2647
|
+
default: () => [ _userDropdown?.map(item => createVNode(ElDropdownItem, {
|
|
2580
2648
|
command: item.value,
|
|
2581
2649
|
divided: !!item.divided
|
|
2582
2650
|
}, {
|
|
@@ -2586,16 +2654,14 @@ var HeaderTools = defineComponent({
|
|
|
2586
2654
|
}, null) : null, item.iconfont ? createVNode("i", {
|
|
2587
2655
|
class: item.iconfont
|
|
2588
2656
|
}, null) : null, _t(item.label) ]
|
|
2589
|
-
}))
|
|
2657
|
+
})) ]
|
|
2590
2658
|
})
|
|
2591
2659
|
}) ]), createVNode("li", null, [ createVNode("span", {
|
|
2592
2660
|
style: {
|
|
2593
2661
|
display: "inline-block",
|
|
2594
2662
|
lineHeight: 1
|
|
2595
2663
|
},
|
|
2596
|
-
onClick:
|
|
2597
|
-
this.settingDrawer = !0;
|
|
2598
|
-
}
|
|
2664
|
+
onClick: this.openSettingDrawer
|
|
2599
2665
|
}, [ createVNode(ElIcon, {
|
|
2600
2666
|
size: 16
|
|
2601
2667
|
}, {
|
|
@@ -2611,7 +2677,7 @@ var HeaderTools = defineComponent({
|
|
|
2611
2677
|
size: "380px",
|
|
2612
2678
|
class: _ns.be("drawer", "setting"),
|
|
2613
2679
|
"destroy-on-close": !0,
|
|
2614
|
-
beforeClose:
|
|
2680
|
+
beforeClose: this.closeSettingDrawer
|
|
2615
2681
|
}, {
|
|
2616
2682
|
default: () => [ createVNode(LayoutSetting, null, null) ]
|
|
2617
2683
|
}) ]
|
|
@@ -2626,12 +2692,12 @@ var Header$4 = defineComponent({
|
|
|
2626
2692
|
ns: inject("ns", {})
|
|
2627
2693
|
}),
|
|
2628
2694
|
render() {
|
|
2629
|
-
const slots = this.$slots, _ns = this.ns, _config = inject("options", {}), headerStyle = computed((
|
|
2695
|
+
const slots = this.$slots, _ns = this.ns, _config = inject("options", {}), headerStyle = computed(() => {
|
|
2630
2696
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2631
2697
|
return isHeaderBarColorGradual ? {
|
|
2632
2698
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$4(color, .5)})`
|
|
2633
2699
|
} : "";
|
|
2634
|
-
})
|
|
2700
|
+
}), __slots_header_tools = {};
|
|
2635
2701
|
return slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2636
2702
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]()),
|
|
2637
2703
|
createVNode("header", {
|
|
@@ -2686,8 +2752,8 @@ const NextMenuItem = defineComponent({
|
|
|
2686
2752
|
}
|
|
2687
2753
|
},
|
|
2688
2754
|
setup(props) {
|
|
2689
|
-
const _ns = inject("ns", {}), menuTree = computed((
|
|
2690
|
-
return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ menuTree.map(
|
|
2755
|
+
const _ns = inject("ns", {}), menuTree = computed(() => props.menuData).value;
|
|
2756
|
+
return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ menuTree.map(item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : createVNode(ElSubMenu, {
|
|
2691
2757
|
"popper-class": _ns.b("popper"),
|
|
2692
2758
|
index: item.path || item.id,
|
|
2693
2759
|
teleported: !0
|
|
@@ -2704,7 +2770,7 @@ const NextMenuItem = defineComponent({
|
|
|
2704
2770
|
default: () => [ createVNode(MenuItemTitle, {
|
|
2705
2771
|
meta: item.meta
|
|
2706
2772
|
}, null) ]
|
|
2707
|
-
}))
|
|
2773
|
+
})) ]) ]);
|
|
2708
2774
|
}
|
|
2709
2775
|
}), ns$n = useNamespace("menu");
|
|
2710
2776
|
|
|
@@ -2736,9 +2802,9 @@ const NextMenu = withInstall(defineComponent({
|
|
|
2736
2802
|
setup(props) {
|
|
2737
2803
|
provide("ns", ns$n);
|
|
2738
2804
|
const router = getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, activePath = ref(currentPath);
|
|
2739
|
-
watch((
|
|
2805
|
+
watch(() => router.currentRoute?.value, to => {
|
|
2740
2806
|
activePath.value = to.fullPath;
|
|
2741
|
-
})
|
|
2807
|
+
});
|
|
2742
2808
|
return () => createVNode(Fragment, null, [ createVNode(ElMenu, {
|
|
2743
2809
|
class: [ ns$n.b(), props.className ],
|
|
2744
2810
|
style: props.style,
|
|
@@ -2748,7 +2814,7 @@ const NextMenu = withInstall(defineComponent({
|
|
|
2748
2814
|
mode: props.mode,
|
|
2749
2815
|
ellipsis: !0
|
|
2750
2816
|
}, {
|
|
2751
|
-
default: () => [ createVNode(Fragment, null, [ props.menuTree.map(
|
|
2817
|
+
default: () => [ createVNode(Fragment, null, [ props.menuTree.map(item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : createVNode(ElSubMenu, {
|
|
2752
2818
|
"popper-class": ns$n.b("popper"),
|
|
2753
2819
|
index: item.path || item.id,
|
|
2754
2820
|
teleported: !0
|
|
@@ -2766,7 +2832,7 @@ const NextMenu = withInstall(defineComponent({
|
|
|
2766
2832
|
default: () => [ createVNode(MenuItemTitle, {
|
|
2767
2833
|
meta: item.meta
|
|
2768
2834
|
}, null) ]
|
|
2769
|
-
}))
|
|
2835
|
+
})) ]) ]
|
|
2770
2836
|
}) ]);
|
|
2771
2837
|
}
|
|
2772
2838
|
}));
|
|
@@ -2827,12 +2893,12 @@ const {getLightColor: getLightColor$3} = useChangeColor();
|
|
|
2827
2893
|
|
|
2828
2894
|
var Header$3 = defineComponent({
|
|
2829
2895
|
setup(props, {slots: slots}) {
|
|
2830
|
-
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed((
|
|
2896
|
+
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed(() => {
|
|
2831
2897
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2832
2898
|
return isHeaderBarColorGradual ? {
|
|
2833
2899
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$3(color, .5)})`
|
|
2834
2900
|
} : "";
|
|
2835
|
-
})
|
|
2901
|
+
}), __slots_header_tools = {};
|
|
2836
2902
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2837
2903
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2838
2904
|
return () => {
|
|
@@ -2886,12 +2952,12 @@ const {getLightColor: getLightColor$2} = useChangeColor();
|
|
|
2886
2952
|
|
|
2887
2953
|
var Header$2 = defineComponent({
|
|
2888
2954
|
setup(props, {slots: slots}) {
|
|
2889
|
-
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed((
|
|
2955
|
+
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed(() => {
|
|
2890
2956
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2891
2957
|
return isHeaderBarColorGradual ? {
|
|
2892
2958
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$2(color, .5)})`
|
|
2893
2959
|
} : "";
|
|
2894
|
-
})
|
|
2960
|
+
}), __slots_header_tools = {};
|
|
2895
2961
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2896
2962
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2897
2963
|
return () => {
|
|
@@ -2961,12 +3027,12 @@ const {getLightColor: getLightColor$1} = useChangeColor();
|
|
|
2961
3027
|
|
|
2962
3028
|
var Header$1 = defineComponent({
|
|
2963
3029
|
setup(props, {slots: slots}) {
|
|
2964
|
-
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed((
|
|
3030
|
+
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed(() => {
|
|
2965
3031
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
2966
3032
|
return isHeaderBarColorGradual ? {
|
|
2967
3033
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor$1(color, .5)})`
|
|
2968
3034
|
} : "";
|
|
2969
|
-
})
|
|
3035
|
+
}), __slots_header_tools = {};
|
|
2970
3036
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
2971
3037
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
2972
3038
|
return () => {
|
|
@@ -3065,11 +3131,11 @@ var MenuTop = defineComponent({
|
|
|
3065
3131
|
provide("ns", ns$i);
|
|
3066
3132
|
const updateSubmentTree = inject("updateSubmentTree"), router = getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, parentNode = findGrandfatherNode(currentPath, props.menuTree), activeMenuId = ref(parentNode?.id);
|
|
3067
3133
|
parentNode?.id && 1 === parentNode.meta?.level && updateSubmentTree(parentNode.children),
|
|
3068
|
-
watch((
|
|
3134
|
+
watch(() => router.currentRoute?.value, to => {
|
|
3069
3135
|
const parentNode = findGrandfatherNode(to.fullPath, props.menuTree);
|
|
3070
3136
|
if (activeMenuId.value = parentNode?.id, !parentNode) return updateSubmentTree([]);
|
|
3071
3137
|
parentNode?.id && 1 === parentNode.meta?.level && updateSubmentTree(parentNode.children);
|
|
3072
|
-
})
|
|
3138
|
+
});
|
|
3073
3139
|
const findTreeFirst = tree => {
|
|
3074
3140
|
let result = tree[0];
|
|
3075
3141
|
for (let i = 0; i < tree.length; i++) {
|
|
@@ -3085,19 +3151,20 @@ var MenuTop = defineComponent({
|
|
|
3085
3151
|
mode: "horizontal",
|
|
3086
3152
|
ellipsis: !0
|
|
3087
3153
|
}, {
|
|
3088
|
-
default: () => [ createVNode(Fragment, null, [ props.menuTree.map(
|
|
3154
|
+
default: () => [ createVNode(Fragment, null, [ props.menuTree.map(item => valueExist(item.meta?.isHide, !1) ? null : createVNode(ElMenuItem, {
|
|
3089
3155
|
index: item.id,
|
|
3090
3156
|
onClick: val => ((val, item) => {
|
|
3091
3157
|
if (updateSubmentTree(item.children), item.children?.length) {
|
|
3092
3158
|
const firstNode = findTreeFirst(item.children);
|
|
3093
|
-
router.push(firstNode.path);
|
|
3094
|
-
}
|
|
3159
|
+
return void router.push(firstNode.path);
|
|
3160
|
+
}
|
|
3161
|
+
router.push(item.path);
|
|
3095
3162
|
})(0, item)
|
|
3096
3163
|
}, {
|
|
3097
3164
|
default: () => [ createVNode(MenuItemTitle, {
|
|
3098
3165
|
meta: item.meta
|
|
3099
3166
|
}, null) ]
|
|
3100
|
-
}))
|
|
3167
|
+
})) ]) ]
|
|
3101
3168
|
});
|
|
3102
3169
|
return () => createVNode(Fragment, null, [ renderContent() ]);
|
|
3103
3170
|
}
|
|
@@ -3107,12 +3174,12 @@ const {getLightColor: getLightColor} = useChangeColor();
|
|
|
3107
3174
|
|
|
3108
3175
|
var Header = defineComponent({
|
|
3109
3176
|
setup(props, {slots: slots}) {
|
|
3110
|
-
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed((
|
|
3177
|
+
const _ns = inject("ns", {}), _config = inject("options", {}), headerStyle = computed(() => {
|
|
3111
3178
|
const {isHeaderBarColorGradual: isHeaderBarColorGradual, headerBarColor: color} = _config.setting;
|
|
3112
3179
|
return isHeaderBarColorGradual ? {
|
|
3113
3180
|
background: `linear-gradient(to bottom , ${color}, ${getLightColor(color, .5)})`
|
|
3114
3181
|
} : "";
|
|
3115
|
-
})
|
|
3182
|
+
}), __slots_header_tools = {};
|
|
3116
3183
|
slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
|
|
3117
3184
|
slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
|
|
3118
3185
|
return () => {
|
|
@@ -3150,11 +3217,11 @@ var composite = defineComponent({
|
|
|
3150
3217
|
setup() {
|
|
3151
3218
|
provide("ns", ns$h);
|
|
3152
3219
|
const submenuTree = ref([]);
|
|
3153
|
-
return provide("submenuTree", submenuTree), provide("updateSubmentTree",
|
|
3154
|
-
submenuTree.value = [], nextTick((
|
|
3220
|
+
return provide("submenuTree", submenuTree), provide("updateSubmentTree", val => {
|
|
3221
|
+
submenuTree.value = [], nextTick(() => {
|
|
3155
3222
|
submenuTree.value = val;
|
|
3156
|
-
})
|
|
3157
|
-
})
|
|
3223
|
+
});
|
|
3224
|
+
}), {
|
|
3158
3225
|
ns: ns$h,
|
|
3159
3226
|
submenuTree: submenuTree
|
|
3160
3227
|
};
|
|
@@ -3221,9 +3288,9 @@ const NextLayout = withInstall(defineComponent({
|
|
|
3221
3288
|
_config.value = mergeWith(_config.value, cfg, customizerCoverArray), updateThemeColorCssVar(_config.value?.setting),
|
|
3222
3289
|
emit("changeOptions", _config.value);
|
|
3223
3290
|
};
|
|
3224
|
-
return provide("updateOptions", updateOptions), watch((
|
|
3291
|
+
return provide("updateOptions", updateOptions), watch(() => props.options, cfg => {
|
|
3225
3292
|
updateOptions(cfg);
|
|
3226
|
-
}
|
|
3293
|
+
}, {
|
|
3227
3294
|
deep: !0,
|
|
3228
3295
|
immediate: !0
|
|
3229
3296
|
}), {
|
|
@@ -3233,9 +3300,9 @@ const NextLayout = withInstall(defineComponent({
|
|
|
3233
3300
|
},
|
|
3234
3301
|
render() {
|
|
3235
3302
|
const props = this.$props, slots = this.$slots, layout = this.options.setting?.layout || "transverse", activeLayout = ref(layouts[layout]);
|
|
3236
|
-
watchEffect((
|
|
3303
|
+
watchEffect(() => {
|
|
3237
3304
|
activeLayout.value = layouts[layout], activeLayout.value || (activeLayout.value = layouts.transverse);
|
|
3238
|
-
})
|
|
3305
|
+
});
|
|
3239
3306
|
const _activeSlots = {};
|
|
3240
3307
|
for (const key in slots) Object.prototype.hasOwnProperty.call(slots, key) && (_activeSlots[key] = () => slots[key]?.());
|
|
3241
3308
|
return createVNode("div", {
|
|
@@ -3261,7 +3328,7 @@ var Element$a = defineComponent({
|
|
|
3261
3328
|
},
|
|
3262
3329
|
emits: [ "change", "select", "close" ],
|
|
3263
3330
|
setup(props, {emit: emit}) {
|
|
3264
|
-
const {t: t} = useLocale(), router = getCurrentInstance().appContext.config.globalProperties.$router, _activeTab = computed((
|
|
3331
|
+
const {t: t} = useLocale(), router = getCurrentInstance().appContext.config.globalProperties.$router, _activeTab = computed(() => router.currentRoute.value.path), _tabs = computed(() => props.tabs), defaultIndex = _tabs.value?.findIndex(v => v.path === _activeTab.value);
|
|
3265
3332
|
if (defaultIndex < 0) {
|
|
3266
3333
|
const tab = _tabs.value[0];
|
|
3267
3334
|
tab && tab.path && router.replace({
|
|
@@ -3269,7 +3336,7 @@ var Element$a = defineComponent({
|
|
|
3269
3336
|
});
|
|
3270
3337
|
}
|
|
3271
3338
|
const activeIndex = ref(defaultIndex), tabsView = ref(_tabs.value), onChange = command => {
|
|
3272
|
-
const active = _activeTab.value, len = tabsView.value.length, i = tabsView.value.findIndex(
|
|
3339
|
+
const active = _activeTab.value, len = tabsView.value.length, i = tabsView.value.findIndex(v => v.path === active);
|
|
3273
3340
|
switch (command) {
|
|
3274
3341
|
case "other":
|
|
3275
3342
|
i > -1 && (activeIndex.value = 1, tabsView.value = [ tabsView.value[0], tabsView.value[i] ]);
|
|
@@ -3305,7 +3372,7 @@ var Element$a = defineComponent({
|
|
|
3305
3372
|
params: tab.params || {}
|
|
3306
3373
|
}), router.push(to), emit("select", tab, index);
|
|
3307
3374
|
};
|
|
3308
|
-
watch((
|
|
3375
|
+
watch(() => router.currentRoute?.value, to => {
|
|
3309
3376
|
const {tagTitle: tagTitle} = to.query, activeRoute = {
|
|
3310
3377
|
name: to.name,
|
|
3311
3378
|
title: tagTitle || to.meta?.title,
|
|
@@ -3313,16 +3380,16 @@ var Element$a = defineComponent({
|
|
|
3313
3380
|
meta: to.meta,
|
|
3314
3381
|
params: to.params,
|
|
3315
3382
|
query: to.query
|
|
3316
|
-
}, i = tabsView.value.findIndex(
|
|
3383
|
+
}, i = tabsView.value.findIndex(v => v.path === to.path);
|
|
3317
3384
|
i > -1 ? (activeIndex.value = i, tabsView.value[i] = activeRoute) : (activeIndex.value = tabsView.value.length,
|
|
3318
3385
|
tabsView.value.push(activeRoute)), emit("change", activeIndex.value, tabsView.value, "add");
|
|
3319
|
-
})
|
|
3386
|
+
});
|
|
3320
3387
|
const renderContent = () => createVNode("nav", {
|
|
3321
3388
|
class: ns$f.b()
|
|
3322
3389
|
}, [ createVNode(ElScrollbar, null, {
|
|
3323
3390
|
default: () => [ createVNode("ul", {
|
|
3324
3391
|
class: ns$f.b("list")
|
|
3325
|
-
}, [ tabsView.value.map((
|
|
3392
|
+
}, [ tabsView.value.map((tab, index) => tab ? createVNode("li", {
|
|
3326
3393
|
class: [ "tab-item", ns$f.is("active", activeIndex.value === index) ],
|
|
3327
3394
|
onClick: event => onClickTabItem(event, tab, index)
|
|
3328
3395
|
}, [ createVNode("i", {
|
|
@@ -3343,14 +3410,14 @@ var Element$a = defineComponent({
|
|
|
3343
3410
|
}), router.push(to), emit("close", prevTag, tabsView.value);
|
|
3344
3411
|
}
|
|
3345
3412
|
tabsView.value.splice(index, 1);
|
|
3346
|
-
const i = tabsView.value.findIndex(
|
|
3413
|
+
const i = tabsView.value.findIndex(v => v.path === active) || 0;
|
|
3347
3414
|
activeIndex.value = i > -1 ? i : 0, emit("change", activeIndex.value, tabsView.value, "close");
|
|
3348
3415
|
})(event, tab, index)
|
|
3349
3416
|
}, [ createVNode(ElIcon, {
|
|
3350
3417
|
class: "tab-close"
|
|
3351
3418
|
}, {
|
|
3352
3419
|
default: () => [ createVNode(close_default, null, null) ]
|
|
3353
|
-
}) ]) ]) : null)
|
|
3420
|
+
}) ]) ]) : null) ]) ]
|
|
3354
3421
|
}), createVNode(ElDropdown, {
|
|
3355
3422
|
"show-timeout": 80,
|
|
3356
3423
|
"hide-timeout": 80,
|
|
@@ -3422,7 +3489,7 @@ const NextContainer = withInstall(defineComponent({
|
|
|
3422
3489
|
}
|
|
3423
3490
|
},
|
|
3424
3491
|
setup(props, {slots: slots}) {
|
|
3425
|
-
const styles = computed((
|
|
3492
|
+
const styles = computed(() => {
|
|
3426
3493
|
let style = {};
|
|
3427
3494
|
const padding = props.padding;
|
|
3428
3495
|
return "boolean" == typeof padding ? style = padding ? {
|
|
@@ -3432,7 +3499,7 @@ const NextContainer = withInstall(defineComponent({
|
|
|
3432
3499
|
} : "number" == typeof padding && (style = {
|
|
3433
3500
|
padding: padding + "px"
|
|
3434
3501
|
}), style;
|
|
3435
|
-
})
|
|
3502
|
+
});
|
|
3436
3503
|
return () => (() => {
|
|
3437
3504
|
if (props.scrollbar) {
|
|
3438
3505
|
const scrollStyle = {
|
|
@@ -3461,10 +3528,6 @@ const NextContainer = withInstall(defineComponent({
|
|
|
3461
3528
|
}
|
|
3462
3529
|
}));
|
|
3463
3530
|
|
|
3464
|
-
function isEqual(value, other) {
|
|
3465
|
-
return baseIsEqual(value, other);
|
|
3466
|
-
}
|
|
3467
|
-
|
|
3468
3531
|
var defaultPropsConfig = {
|
|
3469
3532
|
className: {
|
|
3470
3533
|
type: String,
|
|
@@ -3654,9 +3717,9 @@ var NextSpinLoading$1 = defineComponent({
|
|
|
3654
3717
|
},
|
|
3655
3718
|
setup(props, {slots: slots}) {
|
|
3656
3719
|
const _options = inject("options", {}), options = isRef(_options) ? unref(_options) : _options, {t: t} = useLocale(), ns = inject("ns", {}), columns = ref(props.columns);
|
|
3657
|
-
watch((
|
|
3720
|
+
watch(() => props.columns, () => {
|
|
3658
3721
|
columns.value = props.columns;
|
|
3659
|
-
}
|
|
3722
|
+
}, {
|
|
3660
3723
|
deep: !0
|
|
3661
3724
|
});
|
|
3662
3725
|
const formParams = reactive(props.formParams), _defaultDisabledDate = time => time.getTime() > Date.now(), _defaultShortcuts = [ {
|
|
@@ -3763,10 +3826,10 @@ var NextSpinLoading$1 = defineComponent({
|
|
|
3763
3826
|
"collapse-tags": !0,
|
|
3764
3827
|
"collapse-tags-tooltip": !0
|
|
3765
3828
|
}, {
|
|
3766
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
3829
|
+
default: () => [ col.dicData && col.dicData.map(item => createVNode(ElOption, {
|
|
3767
3830
|
value: item.value,
|
|
3768
3831
|
label: item.label
|
|
3769
|
-
}, null))
|
|
3832
|
+
}, null)) ]
|
|
3770
3833
|
});
|
|
3771
3834
|
}
|
|
3772
3835
|
if ("date" === col.type) {
|
|
@@ -3856,7 +3919,7 @@ var NextSpinLoading$1 = defineComponent({
|
|
|
3856
3919
|
onChange: (...arg) => col.onChange?.(...arg, col, formParams)
|
|
3857
3920
|
}, null) : void 0;
|
|
3858
3921
|
};
|
|
3859
|
-
return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ columns.value.map(
|
|
3922
|
+
return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ columns.value.map(col => !col.hide && createVNode(ElCol, {
|
|
3860
3923
|
span: props.searchSpan,
|
|
3861
3924
|
class: ns.b("header-search-item")
|
|
3862
3925
|
}, {
|
|
@@ -3868,11 +3931,11 @@ var NextSpinLoading$1 = defineComponent({
|
|
|
3868
3931
|
}, null) : null,
|
|
3869
3932
|
default: () => renderColItemContent(col)
|
|
3870
3933
|
}) ]
|
|
3871
|
-
}))
|
|
3934
|
+
})) ]) ]);
|
|
3872
3935
|
}
|
|
3873
3936
|
});
|
|
3874
3937
|
|
|
3875
|
-
function _isSlot$
|
|
3938
|
+
function _isSlot$6(s) {
|
|
3876
3939
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
|
|
3877
3940
|
}
|
|
3878
3941
|
|
|
@@ -3887,13 +3950,13 @@ var HeaderSearch = defineComponent({
|
|
|
3887
3950
|
emits: [ "confirmSearch", "clearSearch", "zoomResize" ],
|
|
3888
3951
|
setup(props, {emit: emit, slots: slots}) {
|
|
3889
3952
|
const _options = inject("options", {}), options = isRef(_options) ? unref(_options) : _options, ns = inject("ns", {}), {t: t} = useLocale(), searchFormSlots = inject("searchFormSlots"), searchFrom_slots = {};
|
|
3890
|
-
searchFormSlots.value.forEach(
|
|
3953
|
+
searchFormSlots.value.forEach(slotName => {
|
|
3891
3954
|
searchFrom_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
3892
|
-
})
|
|
3955
|
+
});
|
|
3893
3956
|
const searchParams = reactive({}), columns = ref(props.columns), _initSearchFormParams = () => {
|
|
3894
|
-
columns.value.forEach(
|
|
3957
|
+
columns.value.forEach(col => {
|
|
3895
3958
|
searchParams[col.prop] = "", isValueExist(col.defaultValue) && (searchParams[col.prop] = col.defaultValue);
|
|
3896
|
-
})
|
|
3959
|
+
});
|
|
3897
3960
|
};
|
|
3898
3961
|
_initSearchFormParams();
|
|
3899
3962
|
const onConfirmSearch = () => {
|
|
@@ -3901,9 +3964,9 @@ var HeaderSearch = defineComponent({
|
|
|
3901
3964
|
}, onClearSearch = () => {
|
|
3902
3965
|
_initSearchFormParams(), onConfirmSearch(), emit("clearSearch");
|
|
3903
3966
|
}, searchSpan = ref(options.searchSpan), columnsLength = columns.value.length, sliceIndex = ref(columnsLength), showColumns = ref(columns.value), moreColumns = ref([]), isColumnMinWidth = ref(!1), {proxy: proxy} = getCurrentInstance();
|
|
3904
|
-
onMounted((
|
|
3967
|
+
onMounted(() => {
|
|
3905
3968
|
const tableSearchFormEl = proxy.$refs.tableSearchForm?.$el;
|
|
3906
|
-
tableSearchFormEl && elementResize(tableSearchFormEl,
|
|
3969
|
+
tableSearchFormEl && elementResize(tableSearchFormEl, el => {
|
|
3907
3970
|
(el => {
|
|
3908
3971
|
const formWidth = el.clientWidth, minWidth = options.searchColumnMinWidth;
|
|
3909
3972
|
let span = Math.floor(formWidth / minWidth);
|
|
@@ -3917,8 +3980,8 @@ var HeaderSearch = defineComponent({
|
|
|
3917
3980
|
const columnWidth = Math.floor(formWidth / span);
|
|
3918
3981
|
isColumnMinWidth.value = columnWidth < minWidth;
|
|
3919
3982
|
})(el), emit("zoomResize");
|
|
3920
|
-
})
|
|
3921
|
-
})
|
|
3983
|
+
});
|
|
3984
|
+
});
|
|
3922
3985
|
const isExpand = ref(!1), onSwitchExpand = () => {
|
|
3923
3986
|
isExpand.value = !isExpand.value;
|
|
3924
3987
|
};
|
|
@@ -3937,13 +4000,13 @@ var HeaderSearch = defineComponent({
|
|
|
3937
4000
|
searchSpan: searchSpan.value,
|
|
3938
4001
|
columns: showColumns.value,
|
|
3939
4002
|
formParams: searchParams
|
|
3940
|
-
}, _isSlot$
|
|
4003
|
+
}, _isSlot$6(searchFrom_slots) ? searchFrom_slots : {
|
|
3941
4004
|
default: () => [ searchFrom_slots ]
|
|
3942
4005
|
}), isExpand.value ? createVNode(SearchColumn, {
|
|
3943
4006
|
searchSpan: searchSpan.value,
|
|
3944
4007
|
columns: moreColumns.value,
|
|
3945
4008
|
formParams: searchParams
|
|
3946
|
-
}, _isSlot$
|
|
4009
|
+
}, _isSlot$6(searchFrom_slots) ? searchFrom_slots : {
|
|
3947
4010
|
default: () => [ searchFrom_slots ]
|
|
3948
4011
|
}) : null, createVNode(ElCol, {
|
|
3949
4012
|
span: searchSpan.value,
|
|
@@ -4066,14 +4129,17 @@ var HeaderSearch = defineComponent({
|
|
|
4066
4129
|
setup: () => ({}),
|
|
4067
4130
|
emits: [ "clickAdd", "clickRefresh", "deleteRows" ],
|
|
4068
4131
|
render() {
|
|
4069
|
-
const _options = inject("options", {}), options = isRef(_options) ? unref(_options) : _options, {t: t} = useLocale(), ns = inject("ns", {}), multipleSelection = inject("multipleSelection"), multipleSelectionLength = computed((
|
|
4132
|
+
const _options = inject("options", {}), options = isRef(_options) ? unref(_options) : _options, {t: t} = useLocale(), ns = inject("ns", {}), multipleSelection = inject("multipleSelection"), multipleSelectionLength = computed(() => multipleSelection.value.length), onClickRefresh = () => {
|
|
4133
|
+
this.$emit("clickRefresh");
|
|
4134
|
+
}, drawerSettingRef = ref(), slotProps = {
|
|
4135
|
+
size: options.size,
|
|
4136
|
+
refresh: onClickRefresh
|
|
4137
|
+
};
|
|
4070
4138
|
return createVNode("div", {
|
|
4071
4139
|
class: ns.b("header-menu")
|
|
4072
4140
|
}, [ createVNode("div", {
|
|
4073
4141
|
class: ns.b("header-menu-left")
|
|
4074
|
-
}, [ this.$slots["menu-left-prefix"]?.({
|
|
4075
|
-
size: options.size
|
|
4076
|
-
}), options.addBtn && createVNode(ElButton, {
|
|
4142
|
+
}, [ this.$slots["menu-left-prefix"]?.(slotProps), options.addBtn && createVNode(ElButton, {
|
|
4077
4143
|
type: "primary",
|
|
4078
4144
|
size: options.size,
|
|
4079
4145
|
onClick: () => {
|
|
@@ -4089,39 +4155,33 @@ var HeaderSearch = defineComponent({
|
|
|
4089
4155
|
size: options.size,
|
|
4090
4156
|
disabled: !multipleSelectionLength.value,
|
|
4091
4157
|
onClick: () => {
|
|
4092
|
-
const selection = unref(toRaw(multipleSelection.value.map(
|
|
4158
|
+
const selection = unref(toRaw(multipleSelection.value.map(row => toRaw(row))));
|
|
4093
4159
|
ElMessageBox.confirm(t("next.table.message.batchDeleteTip"), t("next.table.message.tip"), {
|
|
4094
4160
|
type: "warning",
|
|
4095
4161
|
showClose: !1,
|
|
4096
4162
|
center: !1,
|
|
4097
4163
|
confirmButtonText: t("next.table.message.confirmButtonText"),
|
|
4098
4164
|
cancelButtonText: t("next.table.message.cancelButtonText")
|
|
4099
|
-
}).then((
|
|
4165
|
+
}).then(() => {
|
|
4100
4166
|
this.$emit("deleteRows", selection);
|
|
4101
|
-
})
|
|
4167
|
+
}).catch(() => {
|
|
4102
4168
|
ElMessage({
|
|
4103
4169
|
type: "info",
|
|
4104
4170
|
message: t("next.table.message.cancelBatchDelete")
|
|
4105
4171
|
});
|
|
4106
|
-
})
|
|
4172
|
+
});
|
|
4107
4173
|
}
|
|
4108
4174
|
}, {
|
|
4109
4175
|
icon: () => createVNode(ElIcon, null, {
|
|
4110
4176
|
default: () => [ createVNode(delete_default, null, null) ]
|
|
4111
4177
|
}),
|
|
4112
4178
|
default: () => t("next.table.batchDelete")
|
|
4113
|
-
}), this.$slots["menu-left-suffix"]?.({
|
|
4114
|
-
size: options.size
|
|
4115
|
-
}) ]), createVNode("div", {
|
|
4179
|
+
}), this.$slots["menu-left-suffix"]?.(slotProps) ]), createVNode("div", {
|
|
4116
4180
|
class: ns.b("header-menu-right")
|
|
4117
|
-
}, [ this.$slots["menu-right-prefix"]?.({
|
|
4118
|
-
size: options.size
|
|
4119
|
-
}), options.refreshBtn && createVNode(ElButton, {
|
|
4181
|
+
}, [ this.$slots["menu-right-prefix"]?.(slotProps), options.refreshBtn && createVNode(ElButton, {
|
|
4120
4182
|
circle: !0,
|
|
4121
4183
|
size: options.size,
|
|
4122
|
-
onClick:
|
|
4123
|
-
this.$emit("clickRefresh");
|
|
4124
|
-
}
|
|
4184
|
+
onClick: onClickRefresh
|
|
4125
4185
|
}, {
|
|
4126
4186
|
icon: () => createVNode(ElIcon, null, {
|
|
4127
4187
|
default: () => [ createVNode(refresh_default, null, null) ]
|
|
@@ -4136,9 +4196,7 @@ var HeaderSearch = defineComponent({
|
|
|
4136
4196
|
icon: () => createVNode(ElIcon, null, {
|
|
4137
4197
|
default: () => [ createVNode(tools_default, null, null) ]
|
|
4138
4198
|
})
|
|
4139
|
-
}), this.$slots["menu-right-suffix"]?.({
|
|
4140
|
-
size: options.size
|
|
4141
|
-
}) ]), createVNode(DrawerSetting, {
|
|
4199
|
+
}), this.$slots["menu-right-suffix"]?.(slotProps) ]), createVNode(DrawerSetting, {
|
|
4142
4200
|
ref: drawerSettingRef
|
|
4143
4201
|
}, null) ]);
|
|
4144
4202
|
}
|
|
@@ -4154,28 +4212,28 @@ const TableColumnDynamic = defineComponent({
|
|
|
4154
4212
|
},
|
|
4155
4213
|
setup(props, {slots: slots}) {
|
|
4156
4214
|
const columnSlots = inject("columnSlots"), column_slots = {};
|
|
4157
|
-
columnSlots.value.forEach(
|
|
4215
|
+
columnSlots.value.forEach(slotName => {
|
|
4158
4216
|
column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
4159
|
-
})
|
|
4217
|
+
});
|
|
4160
4218
|
const _options = inject("options", {}), options = isRef(_options) ? 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) => {
|
|
4161
4219
|
if (Array.isArray(value)) {
|
|
4162
4220
|
const temp = [];
|
|
4163
|
-
return value.forEach(
|
|
4221
|
+
return value.forEach(val => {
|
|
4164
4222
|
temp.push(_formatterColumnValue(val, dicData));
|
|
4165
|
-
})
|
|
4223
|
+
}), temp.join(_separator);
|
|
4166
4224
|
}
|
|
4167
|
-
const item = dicData.find(
|
|
4225
|
+
const item = dicData.find(o => o[_dicKey] == value);
|
|
4168
4226
|
return item ? item[_dicLabel] : value;
|
|
4169
4227
|
}, renderCustomItem = (row, $index) => {
|
|
4170
4228
|
const prop = columnOption.prop, _prop = prop?.replace(/\./g, "-");
|
|
4171
|
-
if (columnOption.children?.length > 0) return createVNode(Fragment, null, [ columnOption.children.map(
|
|
4229
|
+
if (columnOption.children?.length > 0) return createVNode(Fragment, null, [ columnOption.children.map(column => {
|
|
4172
4230
|
return createVNode(TableColumnDynamic, {
|
|
4173
4231
|
columnOption: column
|
|
4174
4232
|
}, "function" == typeof (s = column_slots) || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? column_slots : {
|
|
4175
4233
|
default: () => [ column_slots ]
|
|
4176
4234
|
});
|
|
4177
4235
|
var s;
|
|
4178
|
-
})
|
|
4236
|
+
}) ]);
|
|
4179
4237
|
if (slots[columnSlotName(_prop)]) {
|
|
4180
4238
|
const btnCfg = {
|
|
4181
4239
|
text: options.operationsBtnText,
|
|
@@ -4192,7 +4250,7 @@ const TableColumnDynamic = defineComponent({
|
|
|
4192
4250
|
if (columnOption.dicData?.length > 0) {
|
|
4193
4251
|
const loopDicData = list => {
|
|
4194
4252
|
const temp = [];
|
|
4195
|
-
return list.forEach(
|
|
4253
|
+
return list.forEach(node => {
|
|
4196
4254
|
const item = {
|
|
4197
4255
|
...node
|
|
4198
4256
|
};
|
|
@@ -4201,7 +4259,7 @@ const TableColumnDynamic = defineComponent({
|
|
|
4201
4259
|
temp.push(...child), delete item.children;
|
|
4202
4260
|
}
|
|
4203
4261
|
temp.push(item);
|
|
4204
|
-
})
|
|
4262
|
+
}), temp;
|
|
4205
4263
|
}, mergeDicData = loopDicData(columnOption.dicData);
|
|
4206
4264
|
return createVNode("span", null, [ _formatterColumnValue(row[prop], mergeDicData) ]);
|
|
4207
4265
|
}
|
|
@@ -4234,10 +4292,10 @@ var TableColumnOperations = defineComponent({
|
|
|
4234
4292
|
name: "TableColumnOperations",
|
|
4235
4293
|
emits: [ "editRow", "viewRow", "deleteRow" ],
|
|
4236
4294
|
setup(props, {emit: emit, slots: slots}) {
|
|
4237
|
-
const _options = inject("options"), options = isRef(_options) ? unref(_options) : _options, {t: t} = useLocale(), operationsShowText = computed((
|
|
4295
|
+
const _options = inject("options"), options = isRef(_options) ? unref(_options) : _options, {t: t} = useLocale(), operationsShowText = computed(() => {
|
|
4238
4296
|
const {operationsBtnPlain: operationsBtnPlain, operationsBtnText: operationsBtnText} = options;
|
|
4239
4297
|
return operationsBtnText || operationsBtnPlain;
|
|
4240
|
-
})
|
|
4298
|
+
}), renderContent = () => {
|
|
4241
4299
|
const btnText = options.operationsBtnText, btnPlain = options.operationsBtnPlain, btnSize = options.operationsBtnSize, btnCfg = {
|
|
4242
4300
|
text: btnText,
|
|
4243
4301
|
plain: btnPlain,
|
|
@@ -4317,14 +4375,14 @@ var TableColumnOperations = defineComponent({
|
|
|
4317
4375
|
center: !1,
|
|
4318
4376
|
confirmButtonText: t("next.table.message.confirmButtonText"),
|
|
4319
4377
|
cancelButtonText: t("next.table.message.cancelButtonText")
|
|
4320
|
-
}).then((
|
|
4378
|
+
}).then(() => {
|
|
4321
4379
|
emit("deleteRow", scoped);
|
|
4322
|
-
})
|
|
4380
|
+
}).catch(() => {
|
|
4323
4381
|
ElMessage({
|
|
4324
4382
|
type: "info",
|
|
4325
4383
|
message: t("next.table.message.cancelDelete")
|
|
4326
4384
|
});
|
|
4327
|
-
})
|
|
4385
|
+
});
|
|
4328
4386
|
})(scoped)
|
|
4329
4387
|
}, {
|
|
4330
4388
|
icon: () => createVNode(ElIcon, null, {
|
|
@@ -4443,9 +4501,9 @@ var NextDialog$1 = defineComponent({
|
|
|
4443
4501
|
emits: [ "close" ],
|
|
4444
4502
|
setup(props, {emit: emit, slots: slots}) {
|
|
4445
4503
|
const visible = ref(props.modelValue);
|
|
4446
|
-
watch((
|
|
4504
|
+
watch(() => props.modelValue, value => {
|
|
4447
4505
|
visible.value = value;
|
|
4448
|
-
})
|
|
4506
|
+
});
|
|
4449
4507
|
const onClose = () => {
|
|
4450
4508
|
visible.value = !1, emit("close");
|
|
4451
4509
|
}, isFullscreen = ref(props.fullscreen);
|
|
@@ -4555,13 +4613,13 @@ var NumberRangePicker = defineComponent({
|
|
|
4555
4613
|
}, onChangeEnd = num => {
|
|
4556
4614
|
endNumber.value = num, emit("change", [ startNumber.value, endNumber.value ]);
|
|
4557
4615
|
}, controls = ref(!0), numberRangeRef = ref();
|
|
4558
|
-
onMounted((
|
|
4616
|
+
onMounted(() => {
|
|
4559
4617
|
const element = numberRangeRef.value;
|
|
4560
|
-
elementResize(element,
|
|
4618
|
+
elementResize(element, el => {
|
|
4561
4619
|
const width = el.clientWidth;
|
|
4562
4620
|
controls.value = width > 200;
|
|
4563
|
-
})
|
|
4564
|
-
})
|
|
4621
|
+
});
|
|
4622
|
+
});
|
|
4565
4623
|
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
4566
4624
|
ref: numberRangeRef,
|
|
4567
4625
|
class: ns$b.e("number-range")
|
|
@@ -4589,7 +4647,7 @@ var NumberRangePicker = defineComponent({
|
|
|
4589
4647
|
|
|
4590
4648
|
const NextDialog = withInstall(NextDialog$1);
|
|
4591
4649
|
|
|
4592
|
-
function _isSlot$
|
|
4650
|
+
function _isSlot$4(s) {
|
|
4593
4651
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
|
|
4594
4652
|
}
|
|
4595
4653
|
|
|
@@ -4645,16 +4703,16 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4645
4703
|
},
|
|
4646
4704
|
data: []
|
|
4647
4705
|
}), onConfirmSearch = searchParams => {
|
|
4648
|
-
tableReactive.loading = !0, _options.loadData?.(searchParams, tableReactive.page,
|
|
4706
|
+
tableReactive.loading = !0, _options.loadData?.(searchParams, tableReactive.page, res => {
|
|
4649
4707
|
tableReactive.data = res.data || [], tableReactive.page.total = res.total || 0,
|
|
4650
4708
|
tableReactive.loading = !1;
|
|
4651
|
-
})
|
|
4709
|
+
});
|
|
4652
4710
|
}, multipleSelection = ref([]), sinleSelection = ref("");
|
|
4653
|
-
_column.tableSelectDefaultValue?.(props.formParams, _column,
|
|
4711
|
+
_column.tableSelectDefaultValue?.(props.formParams, _column, rows => {
|
|
4654
4712
|
rows?.length && (_column.tableSelectRows = rows, multipleSelection.value = rows,
|
|
4655
4713
|
sinleSelection.value = rows[0][propsValue]);
|
|
4656
|
-
})
|
|
4657
|
-
const _disabledSelect = computed((
|
|
4714
|
+
});
|
|
4715
|
+
const _disabledSelect = computed(() => "radio" === _options.selectType ? !sinleSelection.value : 0 === multipleSelection.value.length), onResetTableSelect = () => {
|
|
4658
4716
|
multipleSelection.value = [], sinleSelection.value = "";
|
|
4659
4717
|
}, onConfirmSelect = () => {
|
|
4660
4718
|
const rows = toRaw(multipleSelection.value), _rows = arrayObjNoRepeat(rows, propsValue);
|
|
@@ -4667,7 +4725,7 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4667
4725
|
value: value,
|
|
4668
4726
|
onChange: event => ((event, row) => {
|
|
4669
4727
|
if (event) multipleSelection.value.push(row); else {
|
|
4670
|
-
const index = multipleSelection.value.findIndex(
|
|
4728
|
+
const index = multipleSelection.value.findIndex(o => o[propsValue] === row[propsValue]);
|
|
4671
4729
|
-1 !== index && multipleSelection.value.splice(index, 1);
|
|
4672
4730
|
}
|
|
4673
4731
|
})(event, toRaw(row))
|
|
@@ -4678,30 +4736,30 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4678
4736
|
}
|
|
4679
4737
|
}, null);
|
|
4680
4738
|
}, tags = ref([]), tagsMore = ref([]), _updateTags = () => {
|
|
4681
|
-
const rows = arrayObjNoRepeat(multipleSelection.value, propsValue).map(
|
|
4739
|
+
const rows = arrayObjNoRepeat(multipleSelection.value, propsValue).map(row => ({
|
|
4682
4740
|
value: row[propsValue],
|
|
4683
4741
|
label: row[propsLabel]
|
|
4684
|
-
}))
|
|
4742
|
+
}));
|
|
4685
4743
|
rows.length > 1 ? (tags.value = rows.splice(0, 1), tagsMore.value = rows) : (tags.value = rows,
|
|
4686
4744
|
tagsMore.value = []);
|
|
4687
4745
|
};
|
|
4688
|
-
watch((
|
|
4746
|
+
watch(() => _column.tableSelectRows, () => {
|
|
4689
4747
|
_updateTags();
|
|
4690
|
-
}
|
|
4748
|
+
}, {
|
|
4691
4749
|
deep: !0,
|
|
4692
4750
|
immediate: !0
|
|
4693
4751
|
});
|
|
4694
4752
|
const _multipleSelection = ref([]);
|
|
4695
|
-
watch((
|
|
4696
|
-
_multipleSelection.value = multipleSelection.value.map(
|
|
4697
|
-
}
|
|
4753
|
+
watch(() => [ props.formParams[_column.prop], multipleSelection.value ], () => {
|
|
4754
|
+
_multipleSelection.value = multipleSelection.value.map(o => o[propsValue]), _updateTags();
|
|
4755
|
+
}, {
|
|
4698
4756
|
deep: !0,
|
|
4699
4757
|
immediate: !0
|
|
4700
4758
|
});
|
|
4701
4759
|
const _sinleSelection = ref(null);
|
|
4702
|
-
watch((
|
|
4760
|
+
watch(() => [ props.formParams[_column.prop], sinleSelection.value ], () => {
|
|
4703
4761
|
_sinleSelection.value = sinleSelection.value, _updateTags();
|
|
4704
|
-
}
|
|
4762
|
+
}, {
|
|
4705
4763
|
deep: !0,
|
|
4706
4764
|
immediate: !0
|
|
4707
4765
|
});
|
|
@@ -4717,12 +4775,12 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4717
4775
|
class: "el-input__wrapper"
|
|
4718
4776
|
}, [ tags?.value.length ? createVNode("span", {
|
|
4719
4777
|
class: ns$a.em("input-table", "value")
|
|
4720
|
-
}, [ tags.value.map((
|
|
4721
|
-
closable:
|
|
4778
|
+
}, [ tags.value.map((tag, index) => createVNode(ElTag, {
|
|
4779
|
+
closable: _closable,
|
|
4722
4780
|
onClose: () => _onCloseTag(0, index)
|
|
4723
4781
|
}, {
|
|
4724
4782
|
default: () => [ tag.label ]
|
|
4725
|
-
}))
|
|
4783
|
+
})), tagsMore?.value?.length ? createVNode(ElTooltip, {
|
|
4726
4784
|
"popper-class": ns$a.e("tooltip-tags"),
|
|
4727
4785
|
placement: "bottom",
|
|
4728
4786
|
effect: "light"
|
|
@@ -4730,12 +4788,12 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4730
4788
|
default: () => createVNode(ElTag, null, {
|
|
4731
4789
|
default: () => [ createTextVNode("+ "), tagsMore.value.length ]
|
|
4732
4790
|
}),
|
|
4733
|
-
content: () => tagsMore.value.map((
|
|
4734
|
-
closable:
|
|
4791
|
+
content: () => tagsMore.value.map((tag, index) => createVNode(ElTag, {
|
|
4792
|
+
closable: _closable,
|
|
4735
4793
|
onClose: () => _onCloseTag(0, index + 1)
|
|
4736
4794
|
}, {
|
|
4737
4795
|
default: () => [ tag.label ]
|
|
4738
|
-
}))
|
|
4796
|
+
}))
|
|
4739
4797
|
}) : null ]) : createVNode("span", {
|
|
4740
4798
|
class: ns$a.em("input-table", "placeholder")
|
|
4741
4799
|
}, [ _placeholder ]) ]), createVNode(ElButton, {
|
|
@@ -4804,13 +4862,13 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
|
|
|
4804
4862
|
class: ns$a.em("input-table", "footer")
|
|
4805
4863
|
}, [ createVNode(ElButton, {
|
|
4806
4864
|
onClick: onResetTableSelect
|
|
4807
|
-
}, _isSlot$
|
|
4865
|
+
}, _isSlot$4(_slot = t("next.form.reset")) ? _slot : {
|
|
4808
4866
|
default: () => [ _slot ]
|
|
4809
4867
|
}), createVNode(ElButton, {
|
|
4810
4868
|
type: "primary",
|
|
4811
4869
|
disabled: _disabledSelect.value,
|
|
4812
4870
|
onClick: onConfirmSelect
|
|
4813
|
-
}, _isSlot$
|
|
4871
|
+
}, _isSlot$4(_slot2 = t("next.form.confirm")) ? _slot2 : {
|
|
4814
4872
|
default: () => [ _slot2 ]
|
|
4815
4873
|
}) ]) ]
|
|
4816
4874
|
}) ]);
|
|
@@ -4873,7 +4931,7 @@ var UploadImage = defineComponent({
|
|
|
4873
4931
|
const value = this.defaultPreviewSrcList;
|
|
4874
4932
|
let urls = [];
|
|
4875
4933
|
return "string" == typeof value ? urls = [ value ] : "[object Array]" === Object.prototype.toString.call(value) && (urls = value),
|
|
4876
|
-
urls = urls.filter(
|
|
4934
|
+
urls = urls.filter(url => !!url), urls.length ? createVNode(ElImage, {
|
|
4877
4935
|
class: ns$9.e("preview-image"),
|
|
4878
4936
|
src: urls[0],
|
|
4879
4937
|
previewSrcList: urls,
|
|
@@ -4896,7 +4954,7 @@ var UploadImage = defineComponent({
|
|
|
4896
4954
|
limit: props.limit,
|
|
4897
4955
|
"auto-upload": !1,
|
|
4898
4956
|
"on-preview": uploadFile => {
|
|
4899
|
-
const body = document.getElementsByTagName("body")[0], initial = uploadfilesPreview.value.findIndex(
|
|
4957
|
+
const body = document.getElementsByTagName("body")[0], initial = uploadfilesPreview.value.findIndex(file => file.url === uploadFile.url) || 0;
|
|
4900
4958
|
previewImagesContainer && (render(null, previewImagesContainer), body.removeChild(previewImagesContainer)),
|
|
4901
4959
|
previewImagesContainer = document.createElement("div"), body.appendChild(previewImagesContainer);
|
|
4902
4960
|
const previewComponent = createVNode({
|
|
@@ -4904,7 +4962,7 @@ var UploadImage = defineComponent({
|
|
|
4904
4962
|
to: "body"
|
|
4905
4963
|
}, [ h(ElImageViewer, {
|
|
4906
4964
|
initialIndex: initial,
|
|
4907
|
-
"url-list": uploadfilesPreview.value.map(
|
|
4965
|
+
"url-list": uploadfilesPreview.value.map(file => file.url),
|
|
4908
4966
|
onClose: () => {
|
|
4909
4967
|
render(null, previewImagesContainer);
|
|
4910
4968
|
}
|
|
@@ -4958,9 +5016,9 @@ var UploadImage = defineComponent({
|
|
|
4958
5016
|
emits: [ "change", "node-click", "node-contextmenu", "check", "check-change", "node-expand", "node-collapse", "current-change" ],
|
|
4959
5017
|
setup(props, {emit: emit, expose: expose}) {
|
|
4960
5018
|
const {t: t} = useLocale(), _modelValue = ref(props.modelValue);
|
|
4961
|
-
watch((
|
|
5019
|
+
watch(() => props.modelValue, val => {
|
|
4962
5020
|
_modelValue.value = val;
|
|
4963
|
-
})
|
|
5021
|
+
});
|
|
4964
5022
|
const _column = props.column, valueKey = valueExist(_column.treeSelectProps?.value, _column.nodeKey, "id"), _formParams = props.formParams, _defaultProps = {
|
|
4965
5023
|
label: "label",
|
|
4966
5024
|
children: "children"
|
|
@@ -5044,14 +5102,14 @@ var UploadImage = defineComponent({
|
|
|
5044
5102
|
emits: [ "change", "clear", "expand-change", "visible-change", "remove-tag", "blur", "focus" ],
|
|
5045
5103
|
setup(props, {emit: emit, expose: expose}) {
|
|
5046
5104
|
const {t: t} = useLocale(), _modelValue = ref(props.modelValue);
|
|
5047
|
-
watch((
|
|
5105
|
+
watch(() => props.modelValue, val => {
|
|
5048
5106
|
_modelValue.value = val;
|
|
5049
|
-
})
|
|
5107
|
+
});
|
|
5050
5108
|
const _column = props.column, placeholder = _column.placeholder || t("next.form.select") + _column.label, _defaultProps = {
|
|
5051
5109
|
label: "label",
|
|
5052
5110
|
children: "children"
|
|
5053
5111
|
}, onChange = val => {
|
|
5054
|
-
const nodes = treeSelectRef.value.getCheckedNodes().map(
|
|
5112
|
+
const nodes = treeSelectRef.value.getCheckedNodes().map(item => item.data);
|
|
5055
5113
|
props.formParams[_column.prop] = val, _modelValue.value = val, emit("change", val, nodes);
|
|
5056
5114
|
}, treeSelectRef = ref(), getInstance = () => treeSelectRef.value;
|
|
5057
5115
|
_column.loadInstance && _column.loadInstance(getInstance()), expose({
|
|
@@ -5077,7 +5135,7 @@ var UploadImage = defineComponent({
|
|
|
5077
5135
|
}
|
|
5078
5136
|
});
|
|
5079
5137
|
|
|
5080
|
-
function _isSlot$
|
|
5138
|
+
function _isSlot$3(s) {
|
|
5081
5139
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
|
|
5082
5140
|
}
|
|
5083
5141
|
|
|
@@ -5101,8 +5159,8 @@ var Element$8 = defineComponent({
|
|
|
5101
5159
|
},
|
|
5102
5160
|
emits: [ "submit", "close", "reset" ],
|
|
5103
5161
|
setup(props, {slots: slots, emit: emit, expose: expose}) {
|
|
5104
|
-
const _config = deepClone(defaultConfig$3), options = reactive(merge(_config, props.options)), _isEditing = computed((
|
|
5105
|
-
watch((
|
|
5162
|
+
const _config = deepClone(defaultConfig$3), options = reactive(merge(_config, props.options)), _isEditing = computed(() => "boolean" != typeof options.isEditing || options.isEditing), {t: t} = useLocale(), colSpan = ref(options.colSpan), formDatum = reactive(props.formDatum) || {}, formParams = reactive(merge({}, formDatum)), _formColumns = ref([]), formRules = reactive({});
|
|
5163
|
+
watch(() => [ props.columns, props.formDatum ], () => {
|
|
5106
5164
|
(() => {
|
|
5107
5165
|
const columns = props.columns;
|
|
5108
5166
|
_formColumns.value = columns;
|
|
@@ -5115,41 +5173,41 @@ var Element$8 = defineComponent({
|
|
|
5115
5173
|
message: label + t("next.form.requiredInput"),
|
|
5116
5174
|
trigger: [ "blur", "change" ]
|
|
5117
5175
|
}), col.rules?.length && rules.push(...col.rules), formRules[col.prop] = rules,
|
|
5118
|
-
!col.dicData?.length && col.loadDicData && col.loadDicData(col,
|
|
5176
|
+
!col.dicData?.length && col.loadDicData && col.loadDicData(col, data => {
|
|
5119
5177
|
data?.length && (col.dicData = data);
|
|
5120
|
-
}
|
|
5178
|
+
}, formParams), "boolean" == typeof col.disabled && col.disabled || (col.disabled = !_isEditing.value);
|
|
5121
5179
|
}
|
|
5122
5180
|
})();
|
|
5123
|
-
}
|
|
5181
|
+
}, {
|
|
5124
5182
|
deep: !0,
|
|
5125
5183
|
immediate: !0
|
|
5126
5184
|
});
|
|
5127
5185
|
const formColumns = arrayObjNoRepeat(_formColumns.value, "prop"), spanResizeLoading = ref(!1);
|
|
5128
|
-
onMounted((
|
|
5186
|
+
onMounted(() => {
|
|
5129
5187
|
const formEl = ruleFormRef.value?.$el;
|
|
5130
5188
|
let timer = null;
|
|
5131
|
-
elementResize(formEl,
|
|
5132
|
-
null !== timer ? clearTimeout(timer) : spanResizeLoading.value = !0, timer = setTimeout((
|
|
5189
|
+
elementResize(formEl, el => {
|
|
5190
|
+
null !== timer ? clearTimeout(timer) : spanResizeLoading.value = !0, timer = setTimeout(() => {
|
|
5133
5191
|
colSpan.value = ((el, minWidth = 350) => {
|
|
5134
5192
|
const el_width = el.clientWidth;
|
|
5135
5193
|
let span = Math.floor(el_width / minWidth);
|
|
5136
5194
|
return span > 4 && (span = 4), Math.ceil(24 / span);
|
|
5137
5195
|
})(el, options.columnMinWidth), spanResizeLoading.value = !1, clearTimeout(timer);
|
|
5138
|
-
}
|
|
5139
|
-
})
|
|
5140
|
-
})
|
|
5196
|
+
}, 200);
|
|
5197
|
+
});
|
|
5198
|
+
});
|
|
5141
5199
|
const ruleFormRef = ref(), submitLoading = ref(!1), onSubmitAddEdit = async () => {
|
|
5142
5200
|
const formInstance = ruleFormRef.value;
|
|
5143
|
-
formInstance && await formInstance.validate((
|
|
5201
|
+
formInstance && await formInstance.validate((valid, fields) => {
|
|
5144
5202
|
if (valid) {
|
|
5145
5203
|
const params = toRaw(formParams);
|
|
5146
|
-
submitLoading.value = !0, emit("submit", params, (
|
|
5204
|
+
submitLoading.value = !0, emit("submit", params, () => {
|
|
5147
5205
|
submitLoading.value = !1, emit("close");
|
|
5148
|
-
}
|
|
5206
|
+
}, () => {
|
|
5149
5207
|
submitLoading.value = !1;
|
|
5150
|
-
})
|
|
5208
|
+
});
|
|
5151
5209
|
} else console.error("error submit!", fields);
|
|
5152
|
-
})
|
|
5210
|
+
});
|
|
5153
5211
|
}, onResetForm = () => {
|
|
5154
5212
|
const formInstance = ruleFormRef.value;
|
|
5155
5213
|
formInstance && (formInstance.resetFields(), submitLoading.value = !1, emit("reset", formParams));
|
|
@@ -5299,12 +5357,12 @@ var Element$8 = defineComponent({
|
|
|
5299
5357
|
"collapse-tags-tooltip": !0,
|
|
5300
5358
|
onChange: event => col.onChange?.(event, col, formParams, formColumns)
|
|
5301
5359
|
}, {
|
|
5302
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
5360
|
+
default: () => [ col.dicData && col.dicData.map(item => createVNode(ElOption, {
|
|
5303
5361
|
key: item.value,
|
|
5304
5362
|
value: item.value,
|
|
5305
5363
|
label: item.label,
|
|
5306
5364
|
disabled: valueExist(item.disabled, !1)
|
|
5307
|
-
}, null))
|
|
5365
|
+
}, null)) ]
|
|
5308
5366
|
});
|
|
5309
5367
|
}
|
|
5310
5368
|
if ("time" === col.type) {
|
|
@@ -5333,13 +5391,13 @@ var Element$8 = defineComponent({
|
|
|
5333
5391
|
readonly: valueExist(col.readonly, !1),
|
|
5334
5392
|
onChange: event => col.onChange?.(event, col, formParams, formColumns)
|
|
5335
5393
|
}, {
|
|
5336
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
5394
|
+
default: () => [ col.dicData && col.dicData.map(item => createVNode(ElRadio, {
|
|
5337
5395
|
key: item.value,
|
|
5338
5396
|
value: item.value,
|
|
5339
5397
|
disabled: valueExist(item.disabled, !1)
|
|
5340
5398
|
}, {
|
|
5341
5399
|
default: () => [ item.label ]
|
|
5342
|
-
}))
|
|
5400
|
+
})) ]
|
|
5343
5401
|
});
|
|
5344
5402
|
if ("checkbox" === col.type) return isValueExist(formParams[col.prop]) || (formParams[col.prop] = []),
|
|
5345
5403
|
createVNode(ElCheckboxGroup, {
|
|
@@ -5349,13 +5407,13 @@ var Element$8 = defineComponent({
|
|
|
5349
5407
|
readonly: valueExist(col.readonly, !1),
|
|
5350
5408
|
onChange: event => col.onChange?.(event, col, formParams, formColumns)
|
|
5351
5409
|
}, {
|
|
5352
|
-
default: () => [ col.dicData && col.dicData.map(
|
|
5410
|
+
default: () => [ col.dicData && col.dicData.map(item => createVNode(ElCheckbox, {
|
|
5353
5411
|
key: item.value,
|
|
5354
5412
|
label: item.value,
|
|
5355
5413
|
disabled: valueExist(item.disabled, !1)
|
|
5356
5414
|
}, {
|
|
5357
5415
|
default: () => [ item.label ]
|
|
5358
|
-
}))
|
|
5416
|
+
})) ]
|
|
5359
5417
|
});
|
|
5360
5418
|
if ("date" === col.type) {
|
|
5361
5419
|
const placeholder = col.placeholder || t("next.form.select") + col.label;
|
|
@@ -5454,10 +5512,10 @@ var Element$8 = defineComponent({
|
|
|
5454
5512
|
onSelect: rows => ((rows, col) => {
|
|
5455
5513
|
rows && (col.tableSelectRows = rows);
|
|
5456
5514
|
const {value: value} = col.tableSelectProps || {};
|
|
5457
|
-
formParams[col.prop] = rows.map(
|
|
5515
|
+
formParams[col.prop] = rows.map(row => row[value || "value"]), col.onTableSelect?.(formParams, rows, col),
|
|
5458
5516
|
ruleFormRef.value?.validateField(col.prop);
|
|
5459
5517
|
})(rows, col)
|
|
5460
|
-
}, _isSlot$
|
|
5518
|
+
}, _isSlot$3(_slots) ? _slots : {
|
|
5461
5519
|
default: () => [ _slots ]
|
|
5462
5520
|
});
|
|
5463
5521
|
}
|
|
@@ -5496,19 +5554,20 @@ var Element$8 = defineComponent({
|
|
|
5496
5554
|
let _slot2;
|
|
5497
5555
|
return createVNode(NextSpinLoading, {
|
|
5498
5556
|
loading: spanResizeLoading.value
|
|
5499
|
-
}, _isSlot$
|
|
5557
|
+
}, _isSlot$3(_slot2 = (() => {
|
|
5500
5558
|
let _slot;
|
|
5501
5559
|
return createVNode(ElForm, {
|
|
5502
5560
|
ref: ruleFormRef,
|
|
5503
5561
|
class: ns$8.b(),
|
|
5504
5562
|
inline: !1,
|
|
5505
5563
|
model: formParams,
|
|
5506
|
-
size: options.size
|
|
5564
|
+
size: options.size,
|
|
5565
|
+
"label-position": valueExist(options.labelPosition, "left")
|
|
5507
5566
|
}, {
|
|
5508
5567
|
default: () => [ createVNode(ElRow, {
|
|
5509
5568
|
gutter: 20
|
|
5510
|
-
}, _isSlot$
|
|
5511
|
-
span: valueExist(column.span, colSpan.value)
|
|
5569
|
+
}, _isSlot$3(_slot = formColumns.map(column => !column.hide && createVNode(ElCol, {
|
|
5570
|
+
span: valueExist(options.colSpanFixed, column.span, colSpan.value)
|
|
5512
5571
|
}, {
|
|
5513
5572
|
default: () => [ createVNode(ElFormItem, {
|
|
5514
5573
|
prop: column.prop,
|
|
@@ -5535,7 +5594,7 @@ var Element$8 = defineComponent({
|
|
|
5535
5594
|
}) : null ]) : null,
|
|
5536
5595
|
default: () => renderFormItem(column)
|
|
5537
5596
|
}) ]
|
|
5538
|
-
})))
|
|
5597
|
+
}))) ? _slot : {
|
|
5539
5598
|
default: () => [ _slot ]
|
|
5540
5599
|
}), _isEditing.value && options.showFooter ? createVNode("div", {
|
|
5541
5600
|
class: ns$8.e("footer")
|
|
@@ -5579,13 +5638,13 @@ var AddEditForm = defineComponent({
|
|
|
5579
5638
|
emits: [ "close", "submit" ],
|
|
5580
5639
|
setup(props, {slots: slots, emit: emit, expose: expose}) {
|
|
5581
5640
|
const addEditFormSlots = inject("addEditFormSlots"), form_slots = {};
|
|
5582
|
-
addEditFormSlots.value.forEach(
|
|
5641
|
+
addEditFormSlots.value.forEach(slotName => {
|
|
5583
5642
|
form_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5584
|
-
})
|
|
5643
|
+
});
|
|
5585
5644
|
const _options = inject("options", {}), options = deepClone(isRef(_options) ? unref(_options) : _options);
|
|
5586
5645
|
options.columnMinWidth = options.formColumnMinWidth, options.isEditing = props.isEditing;
|
|
5587
|
-
const formRef = ref(), formDatum = deepClone(isRef(props.formDatum) ? unref(props.formDatum) : props.formDatum), _columns = deepClone(props.columns).map(
|
|
5588
|
-
col))
|
|
5646
|
+
const formRef = ref(), formDatum = deepClone(isRef(props.formDatum) ? unref(props.formDatum) : props.formDatum), _columns = deepClone(props.columns).map(col => (col.hide = valueExist(col.formHide, col.hide, !1),
|
|
5647
|
+
col)), onSubmit = (...arg) => {
|
|
5589
5648
|
emit("submit", ...arg);
|
|
5590
5649
|
};
|
|
5591
5650
|
expose({
|
|
@@ -5611,7 +5670,7 @@ var AddEditForm = defineComponent({
|
|
|
5611
5670
|
}
|
|
5612
5671
|
});
|
|
5613
5672
|
|
|
5614
|
-
function _isSlot(s) {
|
|
5673
|
+
function _isSlot$1(s) {
|
|
5615
5674
|
return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
|
|
5616
5675
|
}
|
|
5617
5676
|
|
|
@@ -5622,25 +5681,25 @@ var Element$7 = defineComponent({
|
|
|
5622
5681
|
props: defaultPropsConfig,
|
|
5623
5682
|
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" ],
|
|
5624
5683
|
setup(props, {emit: emit, slots: slots, expose: expose}) {
|
|
5625
|
-
const _config = deepClone(defaultConfig$4), _options = computed((
|
|
5684
|
+
const _config = deepClone(defaultConfig$4), _options = computed(() => {
|
|
5626
5685
|
const cfg = unref(props.options);
|
|
5627
5686
|
return merge(_config, cfg);
|
|
5628
|
-
})
|
|
5629
|
-
provide("options", computed((
|
|
5687
|
+
}), options = unref(_options);
|
|
5688
|
+
provide("options", computed(() => _options.value)), provide("ns", ns$7);
|
|
5630
5689
|
const {t: t} = useLocale(), _columns = ref(options.columns), _searchColumns = ref([]), _formColumns = ref([]), _updateColumnsAll = ops => {
|
|
5631
5690
|
((options, cb) => {
|
|
5632
5691
|
const _columns = reactive(options.columns), _loadDicData = col => {
|
|
5633
|
-
!col.dicData?.length && col.loadDicData && col.loadDicData(col,
|
|
5692
|
+
!col.dicData?.length && col.loadDicData && col.loadDicData(col, data => {
|
|
5634
5693
|
data?.length && (col.dicData = data);
|
|
5635
|
-
})
|
|
5694
|
+
});
|
|
5636
5695
|
}, loopTableColumns = list => {
|
|
5637
5696
|
let cols = [];
|
|
5638
|
-
return list.forEach(
|
|
5697
|
+
return list.forEach(col => {
|
|
5639
5698
|
_loadDicData(col), cols.push(col), col.children?.length && (cols.push(...loopTableColumns(col.children)),
|
|
5640
5699
|
col.children && delete col.children);
|
|
5641
|
-
})
|
|
5642
|
-
}, evenTableColumns = loopTableColumns(_columns), formColumns = options.formColumns.map(
|
|
5643
|
-
col))
|
|
5700
|
+
}), cols;
|
|
5701
|
+
}, evenTableColumns = loopTableColumns(_columns), formColumns = options.formColumns.map(col => (_loadDicData(col),
|
|
5702
|
+
col)), _formColumns = evenTableColumns.concat(formColumns).map(col => {
|
|
5644
5703
|
const item = {
|
|
5645
5704
|
prop: col.prop,
|
|
5646
5705
|
label: valueExist(col.formLabel, col.label, ""),
|
|
@@ -5690,7 +5749,7 @@ var Element$7 = defineComponent({
|
|
|
5690
5749
|
};
|
|
5691
5750
|
return !col.dicData?.length && col.loadDicData && shareObjectProperty(item, col, "dicData"),
|
|
5692
5751
|
item;
|
|
5693
|
-
})
|
|
5752
|
+
}).filter(o => o.sort && o.prop).sort((a, b) => a.sort - b.sort), _formatSearchColumn = (col, index) => {
|
|
5694
5753
|
const item = {
|
|
5695
5754
|
prop: col.prop,
|
|
5696
5755
|
type: valueExist(col.searchType, col.type),
|
|
@@ -5727,21 +5786,21 @@ var Element$7 = defineComponent({
|
|
|
5727
5786
|
};
|
|
5728
5787
|
return !col.dicData?.length && col.loadDicData && shareObjectProperty(item, col, "dicData"),
|
|
5729
5788
|
item;
|
|
5730
|
-
}, initSearchColumns = options.searchColumns.map((
|
|
5731
|
-
_formatSearchColumn(col, index)))
|
|
5789
|
+
}, initSearchColumns = options.searchColumns.map((col, index) => (_loadDicData(col),
|
|
5790
|
+
_formatSearchColumn(col, index))), initSearchColumnsLength = initSearchColumns.length, mergeSearchColumns = initSearchColumns.concat((list => {
|
|
5732
5791
|
let cols = [];
|
|
5733
|
-
return list.forEach((
|
|
5792
|
+
return list.forEach((col, index) => {
|
|
5734
5793
|
col.searchType && cols.push(_formatSearchColumn(col, index + initSearchColumnsLength));
|
|
5735
|
-
})
|
|
5736
|
-
})(evenTableColumns)), _searchColumns = arrayObjNoRepeat(mergeSearchColumns.sort((
|
|
5794
|
+
}), cols;
|
|
5795
|
+
})(evenTableColumns)), _searchColumns = arrayObjNoRepeat(mergeSearchColumns.sort((a, b) => a.sort - b.sort), "prop");
|
|
5737
5796
|
cb && cb({
|
|
5738
5797
|
formColumns: _formColumns,
|
|
5739
5798
|
searchColumns: _searchColumns,
|
|
5740
5799
|
columns: _columns
|
|
5741
5800
|
});
|
|
5742
|
-
})(ops, (
|
|
5801
|
+
})(ops, ({formColumns: formColumns, searchColumns: searchColumns, columns: columns}) => {
|
|
5743
5802
|
_searchColumns.value = searchColumns, _formColumns.value = formColumns, _columns.value = columns;
|
|
5744
|
-
})
|
|
5803
|
+
});
|
|
5745
5804
|
}, tableData = ref(props.data), _searchFormParams = ref((() => {
|
|
5746
5805
|
const list = _searchColumns.value;
|
|
5747
5806
|
let params = {};
|
|
@@ -5759,33 +5818,33 @@ var Element$7 = defineComponent({
|
|
|
5759
5818
|
}, onClickRefresh = () => {
|
|
5760
5819
|
onConfirmSearch(_searchFormParams.value);
|
|
5761
5820
|
};
|
|
5762
|
-
watch((
|
|
5821
|
+
watch(() => props.data, list => {
|
|
5763
5822
|
tableData.value = list;
|
|
5764
|
-
}
|
|
5823
|
+
}, {
|
|
5765
5824
|
immediate: !0
|
|
5766
|
-
}), watch((
|
|
5825
|
+
}), watch(() => _options, ops => {
|
|
5767
5826
|
_updateColumnsAll(ops.value);
|
|
5768
|
-
}
|
|
5827
|
+
}, {
|
|
5769
5828
|
deep: !0,
|
|
5770
5829
|
immediate: !0
|
|
5771
5830
|
});
|
|
5772
5831
|
const tableContentHeight = ref(options.defaultContentHeight), crudTableRef = ref(), headerRef = ref(), tableRef = ref(), footerRef = ref(), addEditFormRef = ref(null), updateTableContentHeight = () => {
|
|
5773
|
-
nextTick((
|
|
5832
|
+
nextTick(() => {
|
|
5774
5833
|
const contentHeight = (crudTableRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
|
|
5775
5834
|
tableContentHeight.value = contentHeight;
|
|
5776
|
-
})
|
|
5835
|
+
});
|
|
5777
5836
|
}, fullscreenChangeListener = event => {
|
|
5778
5837
|
"F11" !== event.key && "fullscreenchange" !== event.type || updateTableContentHeight();
|
|
5779
5838
|
};
|
|
5780
|
-
onMounted((
|
|
5781
|
-
elementResize(crudTableRef.value, (
|
|
5839
|
+
onMounted(() => {
|
|
5840
|
+
elementResize(crudTableRef.value, () => {
|
|
5782
5841
|
updateTableContentHeight();
|
|
5783
|
-
})
|
|
5842
|
+
}), options.initLoadData && onConfirmSearch(_searchFormParams.value), options.fullscreenchangeContentHeight && (document.addEventListener("fullscreenchange", fullscreenChangeListener),
|
|
5784
5843
|
document.addEventListener("keydown", fullscreenChangeListener));
|
|
5785
|
-
})
|
|
5844
|
+
}), onUnmounted(() => {
|
|
5786
5845
|
options.fullscreenchangeContentHeight && (document.removeEventListener("fullscreenchange", fullscreenChangeListener),
|
|
5787
5846
|
document.removeEventListener("keydown", fullscreenChangeListener));
|
|
5788
|
-
})
|
|
5847
|
+
});
|
|
5789
5848
|
const onChangePagination = page => {
|
|
5790
5849
|
props.page.pageIndex = page.pageIndex, props.page.pageSize = page.pageSize, emit("change-pagination", page),
|
|
5791
5850
|
onConfirmSearch(_searchFormParams.value);
|
|
@@ -5801,30 +5860,30 @@ var Element$7 = defineComponent({
|
|
|
5801
5860
|
}), onClickHeaderAdd = (row = {}) => {
|
|
5802
5861
|
const {dialogTitle: dialogTitle} = options;
|
|
5803
5862
|
addEditDialog.isEditing = !0, addEditDialog.title = dialogTitle + " " + t("next.table.add"),
|
|
5804
|
-
addEditDialog.rowInfo = row, emit("click-add-edit", row, options), nextTick((
|
|
5863
|
+
addEditDialog.rowInfo = row, emit("click-add-edit", row, options), nextTick(() => {
|
|
5805
5864
|
addEditDialog.visible = !0;
|
|
5806
|
-
})
|
|
5865
|
+
});
|
|
5807
5866
|
}, onClickDeleteRows = rows => {
|
|
5808
|
-
emit("delete-rows", rows, (
|
|
5867
|
+
emit("delete-rows", rows, () => {
|
|
5809
5868
|
onClickRefresh();
|
|
5810
|
-
})
|
|
5869
|
+
});
|
|
5811
5870
|
}, onClickDeleteRow = scoped => {
|
|
5812
|
-
emit("delete-row", scoped, (
|
|
5871
|
+
emit("delete-row", scoped, () => {
|
|
5813
5872
|
onClickRefresh();
|
|
5814
|
-
})
|
|
5873
|
+
});
|
|
5815
5874
|
}, onClickRowEdit = scoped => {
|
|
5816
5875
|
const {dialogTitle: dialogTitle} = options;
|
|
5817
5876
|
addEditDialog.isEditing = !0, addEditDialog.title = dialogTitle + " " + t("next.table.edit"),
|
|
5818
5877
|
addEditDialog.rowInfo = scoped.row, emit("click-add-edit", scoped.row, options),
|
|
5819
|
-
nextTick((
|
|
5878
|
+
nextTick(() => {
|
|
5820
5879
|
addEditDialog.visible = !0;
|
|
5821
|
-
})
|
|
5880
|
+
});
|
|
5822
5881
|
}, onClickRowView = scoped => {
|
|
5823
5882
|
const {dialogTitle: dialogTitle} = options;
|
|
5824
5883
|
addEditDialog.isEditing = !1, addEditDialog.title = dialogTitle + " " + t("next.table.view"),
|
|
5825
|
-
addEditDialog.rowInfo = scoped.row, emit("view-add-edit", scoped.row), nextTick((
|
|
5884
|
+
addEditDialog.rowInfo = scoped.row, emit("view-add-edit", scoped.row), nextTick(() => {
|
|
5826
5885
|
addEditDialog.visible = !0;
|
|
5827
|
-
})
|
|
5886
|
+
});
|
|
5828
5887
|
}, onCloseAddEditDialog = () => {
|
|
5829
5888
|
addEditDialog.visible = !1, addEditDialog.title = "", addEditDialog.rowInfo = {},
|
|
5830
5889
|
emit("close-add-edit");
|
|
@@ -5837,31 +5896,31 @@ var Element$7 = defineComponent({
|
|
|
5837
5896
|
const _customRowIndex = index => {
|
|
5838
5897
|
const {pageIndex: pageIndex, pageSize: pageSize} = props.page;
|
|
5839
5898
|
return (pageIndex - 1) * pageSize + (index + 1);
|
|
5840
|
-
}, _sortNumberMinWidth = computed((
|
|
5899
|
+
}, _sortNumberMinWidth = computed(() => {
|
|
5841
5900
|
const {total: total} = props.page, tempElement = document.createElement("span");
|
|
5842
5901
|
tempElement.innerText = total, tempElement.style.visibility = "hidden", document.body.appendChild(tempElement);
|
|
5843
5902
|
const width = tempElement.getBoundingClientRect().width, minWidth = Math.ceil(width) + 25;
|
|
5844
5903
|
return document.body.removeChild(tempElement), minWidth > 50 ? minWidth : 50;
|
|
5845
|
-
})
|
|
5846
|
-
searchFormSlots.value.forEach(
|
|
5904
|
+
}), searchFrom_slots = {};
|
|
5905
|
+
searchFormSlots.value.forEach(slotName => {
|
|
5847
5906
|
searchFrom_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5848
|
-
})
|
|
5907
|
+
});
|
|
5849
5908
|
const column_slots = {};
|
|
5850
|
-
columnSlots.value.forEach(
|
|
5909
|
+
columnSlots.value.forEach(slotName => {
|
|
5851
5910
|
column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5852
|
-
})
|
|
5911
|
+
});
|
|
5853
5912
|
const addEditForm_slots = {};
|
|
5854
|
-
addEditFormSlots.value.forEach(
|
|
5913
|
+
addEditFormSlots.value.forEach(slotName => {
|
|
5855
5914
|
addEditForm_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5856
|
-
})
|
|
5915
|
+
});
|
|
5857
5916
|
const headerMenu_solts = {};
|
|
5858
|
-
header_menu_slots_key.forEach(
|
|
5917
|
+
header_menu_slots_key.forEach(slotName => {
|
|
5859
5918
|
headerMenu_solts[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5860
|
-
})
|
|
5919
|
+
});
|
|
5861
5920
|
const operation_column_slots = {};
|
|
5862
|
-
operation_column_slots_key.forEach(
|
|
5921
|
+
operation_column_slots_key.forEach(slotName => {
|
|
5863
5922
|
operation_column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
|
|
5864
|
-
})
|
|
5923
|
+
});
|
|
5865
5924
|
expose({
|
|
5866
5925
|
onClickRowAdd: onClickHeaderAdd,
|
|
5867
5926
|
columns: _columns.value,
|
|
@@ -5886,13 +5945,13 @@ var Element$7 = defineComponent({
|
|
|
5886
5945
|
onZoomResize: updateTableContentHeight,
|
|
5887
5946
|
onConfirmSearch: onConfirmSearch,
|
|
5888
5947
|
onClearSearch: onClearSearch
|
|
5889
|
-
}, _isSlot(searchFrom_slots) ? searchFrom_slots : {
|
|
5948
|
+
}, _isSlot$1(searchFrom_slots) ? searchFrom_slots : {
|
|
5890
5949
|
default: () => [ searchFrom_slots ]
|
|
5891
5950
|
}), options.showHeaderMenu && createVNode(HeaderMenu, {
|
|
5892
5951
|
onClickAdd: onClickHeaderAdd,
|
|
5893
5952
|
onDeleteRows: onClickDeleteRows,
|
|
5894
5953
|
onClickRefresh: onClickRefresh
|
|
5895
|
-
}, _isSlot(headerMenu_solts) ? headerMenu_solts : {
|
|
5954
|
+
}, _isSlot$1(headerMenu_solts) ? headerMenu_solts : {
|
|
5896
5955
|
default: () => [ headerMenu_solts ]
|
|
5897
5956
|
}), slots["table-head-tip"]?.() ]) : null, createVNode(NextSpinLoading$1, {
|
|
5898
5957
|
loading: props.loading
|
|
@@ -5943,16 +6002,16 @@ var Element$7 = defineComponent({
|
|
|
5943
6002
|
fixed: "left",
|
|
5944
6003
|
headerAlign: options.headerAlign,
|
|
5945
6004
|
align: options.cellAlign
|
|
5946
|
-
}, null) : null, slots.default?.(), _columns.value.map(
|
|
6005
|
+
}, null) : null, slots.default?.(), _columns.value.map(col => createVNode(TableColumnDynamic, {
|
|
5947
6006
|
columnOption: col,
|
|
5948
6007
|
key: col.prop
|
|
5949
|
-
}, _isSlot(column_slots) ? column_slots : {
|
|
6008
|
+
}, _isSlot$1(column_slots) ? column_slots : {
|
|
5950
6009
|
default: () => [ column_slots ]
|
|
5951
|
-
}))
|
|
6010
|
+
})), options.operations ? createVNode(TableColumnOperations, {
|
|
5952
6011
|
onEditRow: onClickRowEdit,
|
|
5953
6012
|
onViewRow: onClickRowView,
|
|
5954
6013
|
onDeleteRow: onClickDeleteRow
|
|
5955
|
-
}, _isSlot(operation_column_slots) ? operation_column_slots : {
|
|
6014
|
+
}, _isSlot$1(operation_column_slots) ? operation_column_slots : {
|
|
5956
6015
|
default: () => [ operation_column_slots ]
|
|
5957
6016
|
}) : null ],
|
|
5958
6017
|
empty: () => createVNode(ElEmpty, {
|
|
@@ -5982,7 +6041,7 @@ var Element$7 = defineComponent({
|
|
|
5982
6041
|
isEditing: addEditDialog.isEditing,
|
|
5983
6042
|
onClose: onCloseAddEditDialog,
|
|
5984
6043
|
onSubmit: onSubmitAddEditDialog
|
|
5985
|
-
}, _isSlot(addEditForm_slots) ? addEditForm_slots : {
|
|
6044
|
+
}, _isSlot$1(addEditForm_slots) ? addEditForm_slots : {
|
|
5986
6045
|
default: () => [ addEditForm_slots ]
|
|
5987
6046
|
})
|
|
5988
6047
|
}) ]) ]) ]);
|
|
@@ -6028,11 +6087,11 @@ const NextCrudTableVirtualized = withInstall(defineComponent({
|
|
|
6028
6087
|
name: "NextCrudTableVirtualized",
|
|
6029
6088
|
props: propsConfig,
|
|
6030
6089
|
setup(props, {emit: emit}) {
|
|
6031
|
-
const _config = deepClone(defaultConfig$2), _options = computed((
|
|
6090
|
+
const _config = deepClone(defaultConfig$2), _options = computed(() => {
|
|
6032
6091
|
const cfg = unref(props.options);
|
|
6033
6092
|
return merge(_config, cfg);
|
|
6034
|
-
})
|
|
6035
|
-
provide("options", computed((
|
|
6093
|
+
}), options = unref(_options);
|
|
6094
|
+
provide("options", computed(() => _options.value));
|
|
6036
6095
|
const {t: t} = useLocale(), addEditDialog = reactive({
|
|
6037
6096
|
visible: !1,
|
|
6038
6097
|
title: t("next.table.add"),
|
|
@@ -6094,7 +6153,7 @@ const NextUpload = withInstall(defineComponent({
|
|
|
6094
6153
|
"list-type": props.listType,
|
|
6095
6154
|
"auto-upload": !1,
|
|
6096
6155
|
"on-preview": uploadFile => {
|
|
6097
|
-
const initial = uploadfilesPreview.value.findIndex(
|
|
6156
|
+
const initial = uploadfilesPreview.value.findIndex(file => file.url === uploadFile.url) || 0;
|
|
6098
6157
|
previewImagesContainer && (render(null, previewImagesContainer), body.removeChild(previewImagesContainer)),
|
|
6099
6158
|
previewImagesContainer = document.createElement("div"), body.appendChild(previewImagesContainer);
|
|
6100
6159
|
const previewComponent = createVNode({
|
|
@@ -6102,7 +6161,7 @@ const NextUpload = withInstall(defineComponent({
|
|
|
6102
6161
|
to: "body"
|
|
6103
6162
|
}, [ h(ElImageViewer, {
|
|
6104
6163
|
initialIndex: initial,
|
|
6105
|
-
"url-list": uploadfilesPreview.value.map(
|
|
6164
|
+
"url-list": uploadfilesPreview.value.map(file => file.url),
|
|
6106
6165
|
onClose: () => {
|
|
6107
6166
|
render(null, previewImagesContainer);
|
|
6108
6167
|
}
|
|
@@ -6157,13 +6216,17 @@ var Element$4 = defineComponent({
|
|
|
6157
6216
|
type: Boolean,
|
|
6158
6217
|
default: !0
|
|
6159
6218
|
},
|
|
6219
|
+
tf: {
|
|
6220
|
+
type: Object,
|
|
6221
|
+
default: null
|
|
6222
|
+
},
|
|
6160
6223
|
tensorflow: {
|
|
6161
6224
|
type: Object
|
|
6162
6225
|
}
|
|
6163
6226
|
},
|
|
6164
6227
|
emits: [ "loaded", "play", "error", "detector" ],
|
|
6165
6228
|
setup(props, {emit: emit, expose: expose}) {
|
|
6166
|
-
const {lang: lang} = useLocale(), localeLang = {
|
|
6229
|
+
const _tf = props.tf || window.tf, {lang: lang} = useLocale(), localeLang = {
|
|
6167
6230
|
"zh-cn": zhCN,
|
|
6168
6231
|
en: En,
|
|
6169
6232
|
"zh-tw": zhTW
|
|
@@ -6196,34 +6259,35 @@ var Element$4 = defineComponent({
|
|
|
6196
6259
|
default: () => h(camera_default)
|
|
6197
6260
|
}) ])
|
|
6198
6261
|
});
|
|
6199
|
-
player.value.on("loadedmetadata", (
|
|
6262
|
+
player.value.on("loadedmetadata", () => {
|
|
6200
6263
|
render(screenshotBtn, container);
|
|
6201
|
-
})
|
|
6264
|
+
});
|
|
6202
6265
|
}, _loadModelDetectFrame = (container, video) => {
|
|
6203
6266
|
if (!props.tensorflow) return;
|
|
6267
|
+
if (!_tf) throw new Error("请先引入 @tensorflow/tfjs 模块!");
|
|
6204
6268
|
const {modelUrl: modelUrl, classNames: classNames} = props.tensorflow;
|
|
6205
6269
|
if (!modelUrl) throw new Error("模型文件地址不能未空!");
|
|
6206
6270
|
if (!classNames || !classNames.length) throw new Error("模型类别不能未空!");
|
|
6207
|
-
container.innerHTML = "",
|
|
6271
|
+
container.innerHTML = "", _tf?.loadGraphModel(modelUrl).then(model => {
|
|
6208
6272
|
const canvas = document.createElement("canvas");
|
|
6209
6273
|
canvas.className = ns$4.b("recongition"), container.appendChild(canvas);
|
|
6210
6274
|
const ctx = canvas.getContext("2d"), detect_ctx = document.createElement("canvas").getContext("2d");
|
|
6211
6275
|
video.ontimeupdate = () => {
|
|
6212
6276
|
const {videoWidth: videoWidth, videoHeight: videoHeight, offsetTop: offsetTop, offsetLeft: offsetLeft} = video;
|
|
6213
6277
|
canvas.width = videoWidth, canvas.height = videoHeight, canvas.style.top = offsetTop + "px",
|
|
6214
|
-
canvas.style.left = offsetLeft + "px", detectVideoFrame(video, model, ctx,
|
|
6278
|
+
canvas.style.left = offsetLeft + "px", detectVideoFrame(video, model, ctx, _tf, classNames, [], detect_ctx);
|
|
6215
6279
|
}, modelRef.value = model, detectFrameCanvas.value = canvas;
|
|
6216
|
-
})
|
|
6280
|
+
});
|
|
6217
6281
|
};
|
|
6218
|
-
onUnmounted((
|
|
6219
|
-
modelRef.value && (
|
|
6282
|
+
onUnmounted(() => {
|
|
6283
|
+
modelRef.value && (_tf?.dispose(), modelRef.value.dispose(), modelRef.value = null),
|
|
6220
6284
|
player.value && (player.value.mse && (player.value.mse.endOfStream(), player.value.mse.unload(),
|
|
6221
6285
|
player.value.mse = null), player.value.pause(), player.value.dispose(), player.value = null),
|
|
6222
6286
|
playerFlv.value && (playerFlv.value.pause(), playerFlv.value.unload(), playerFlv.value.detachMediaElement(),
|
|
6223
6287
|
playerFlv.value.destroy(), playerFlv.value = null), playerMpgets.value && (playerMpgets.value.pause(),
|
|
6224
6288
|
playerMpgets.value.unload(), playerMpgets.value.detachMediaElement(), playerMpgets.value.destroy(),
|
|
6225
6289
|
playerMpgets.value = null), videoBoxRef.value && render(null, videoBoxRef.value);
|
|
6226
|
-
})
|
|
6290
|
+
});
|
|
6227
6291
|
const switchVideo = url => {
|
|
6228
6292
|
if (!url) return (() => {
|
|
6229
6293
|
const container = videoBoxRef.value, video = document.createElement("video");
|
|
@@ -6238,9 +6302,9 @@ var Element$4 = defineComponent({
|
|
|
6238
6302
|
sources: []
|
|
6239
6303
|
});
|
|
6240
6304
|
const canvasContainer = document.createElement("div");
|
|
6241
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6305
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6242
6306
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6243
|
-
})
|
|
6307
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6244
6308
|
player: player.value,
|
|
6245
6309
|
video: video
|
|
6246
6310
|
});
|
|
@@ -6269,9 +6333,9 @@ var Element$4 = defineComponent({
|
|
|
6269
6333
|
};
|
|
6270
6334
|
player.value = videojs(video, options);
|
|
6271
6335
|
const canvasContainer = document.createElement("div");
|
|
6272
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6336
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6273
6337
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6274
|
-
})
|
|
6338
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6275
6339
|
player: player.value,
|
|
6276
6340
|
video: video
|
|
6277
6341
|
});
|
|
@@ -6292,9 +6356,9 @@ var Element$4 = defineComponent({
|
|
|
6292
6356
|
};
|
|
6293
6357
|
player.value = videojs(video, options);
|
|
6294
6358
|
const canvasContainer = document.createElement("div");
|
|
6295
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6359
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6296
6360
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6297
|
-
})
|
|
6361
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6298
6362
|
player: player.value,
|
|
6299
6363
|
video: video
|
|
6300
6364
|
});
|
|
@@ -6318,13 +6382,13 @@ var Element$4 = defineComponent({
|
|
|
6318
6382
|
type: "flv",
|
|
6319
6383
|
isLive: !0,
|
|
6320
6384
|
url: url
|
|
6321
|
-
}), playerMpgets.value.attachMediaElement(video), playerMpgets.value.load(), playerMpgets.value.on("error", (
|
|
6385
|
+
}), playerMpgets.value.attachMediaElement(video), playerMpgets.value.load(), playerMpgets.value.on("error", () => {
|
|
6322
6386
|
emit("error", video);
|
|
6323
|
-
})
|
|
6387
|
+
}), _createScreenshotBtn(container);
|
|
6324
6388
|
const canvasContainer = document.createElement("div");
|
|
6325
|
-
container.children[0].appendChild(canvasContainer), playerMpgets.value.on("metadata_arrived", (
|
|
6389
|
+
container.children[0].appendChild(canvasContainer), playerMpgets.value.on("metadata_arrived", () => {
|
|
6326
6390
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6327
|
-
})
|
|
6391
|
+
}), emit("loaded", {
|
|
6328
6392
|
player: player.value,
|
|
6329
6393
|
video: video
|
|
6330
6394
|
});
|
|
@@ -6352,19 +6416,19 @@ var Element$4 = defineComponent({
|
|
|
6352
6416
|
url: url
|
|
6353
6417
|
}), playerFlv.value.attachMediaElement(video), playerFlv.value.load());
|
|
6354
6418
|
const canvasContainer = document.createElement("div");
|
|
6355
|
-
container.children[0].appendChild(canvasContainer), player.value.on("play", (
|
|
6419
|
+
container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
|
|
6356
6420
|
emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
|
|
6357
|
-
})
|
|
6421
|
+
}), _createScreenshotBtn(container), emit("loaded", {
|
|
6358
6422
|
player: player.value,
|
|
6359
6423
|
video: video
|
|
6360
6424
|
});
|
|
6361
6425
|
})(url);
|
|
6362
6426
|
};
|
|
6363
|
-
onMounted((
|
|
6364
|
-
nextTick((
|
|
6427
|
+
onMounted(() => {
|
|
6428
|
+
nextTick(() => {
|
|
6365
6429
|
switchVideo(videoSrc);
|
|
6366
|
-
})
|
|
6367
|
-
})
|
|
6430
|
+
});
|
|
6431
|
+
});
|
|
6368
6432
|
expose({
|
|
6369
6433
|
getElement: () => {
|
|
6370
6434
|
const container = videoBoxRef.value, palyerContainer = container.children[0];
|
|
@@ -6558,7 +6622,7 @@ const colors$1 = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba2
|
|
|
6558
6622
|
};
|
|
6559
6623
|
};
|
|
6560
6624
|
|
|
6561
|
-
var ContextMenuLabel = defineComponent({
|
|
6625
|
+
var ContextMenuLabel$1 = defineComponent({
|
|
6562
6626
|
props: {
|
|
6563
6627
|
labelRect: {
|
|
6564
6628
|
type: Object,
|
|
@@ -6580,10 +6644,10 @@ var ContextMenuLabel = defineComponent({
|
|
|
6580
6644
|
}, onDelete = () => {
|
|
6581
6645
|
emit("delete", props.activateRect);
|
|
6582
6646
|
}, activateIndex = ref();
|
|
6583
|
-
watch((
|
|
6647
|
+
watch(() => props.activateRect, () => {
|
|
6584
6648
|
const {type: type} = props.activateRect;
|
|
6585
6649
|
activateIndex.value = isValueExist(type) ? type : null;
|
|
6586
|
-
}
|
|
6650
|
+
}, {
|
|
6587
6651
|
deep: !0,
|
|
6588
6652
|
immediate: !0
|
|
6589
6653
|
});
|
|
@@ -6591,18 +6655,18 @@ var ContextMenuLabel = defineComponent({
|
|
|
6591
6655
|
width: 0,
|
|
6592
6656
|
height: 0
|
|
6593
6657
|
});
|
|
6594
|
-
onMounted((
|
|
6658
|
+
onMounted(() => {
|
|
6595
6659
|
const {clientWidth: clientWidth, clientHeight: clientHeight} = labelMenuRef.value;
|
|
6596
6660
|
labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
|
|
6597
|
-
})
|
|
6598
|
-
const labelMenuRef = ref(), labelStyleFixed = computed((
|
|
6661
|
+
});
|
|
6662
|
+
const labelMenuRef = ref(), labelStyleFixed = computed(() => {
|
|
6599
6663
|
const {left: left, top: top} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - window.innerHeight;
|
|
6600
6664
|
let y = top;
|
|
6601
6665
|
return height_diff > 0 && (y -= height_diff), {
|
|
6602
6666
|
top: y + "px",
|
|
6603
6667
|
left: left + "px"
|
|
6604
6668
|
};
|
|
6605
|
-
})
|
|
6669
|
+
}), renderContent = () => createVNode("div", {
|
|
6606
6670
|
ref: labelMenuRef,
|
|
6607
6671
|
class: [ ns.b("contextmenu-label") ],
|
|
6608
6672
|
style: labelStyleFixed.value
|
|
@@ -6617,7 +6681,7 @@ var ContextMenuLabel = defineComponent({
|
|
|
6617
6681
|
default: () => [ createVNode(close_default, null, null) ]
|
|
6618
6682
|
}) ]), createVNode("ul", {
|
|
6619
6683
|
class: "label-main"
|
|
6620
|
-
}, [ props.classes.map((
|
|
6684
|
+
}, [ props.classes.map((name, index) => createVNode("li", {
|
|
6621
6685
|
key: index,
|
|
6622
6686
|
onClick: () => (index => {
|
|
6623
6687
|
activateIndex.value = index, emit("select", index);
|
|
@@ -6630,7 +6694,7 @@ var ContextMenuLabel = defineComponent({
|
|
|
6630
6694
|
"background-color": colors$1[index % colors$1.length]
|
|
6631
6695
|
},
|
|
6632
6696
|
class: "label-line"
|
|
6633
|
-
}, null), createVNode("span", null, [ name ]) ]))
|
|
6697
|
+
}, null), createVNode("span", null, [ name ]) ])) ]), isValueExist(activateIndex.value) ? createVNode("div", {
|
|
6634
6698
|
style: "margin: 10px auto 0"
|
|
6635
6699
|
}, [ createVNode(ElButton, {
|
|
6636
6700
|
icon: delete_default,
|
|
@@ -6681,12 +6745,12 @@ class CanvasSceneDragZoom {
|
|
|
6681
6745
|
});
|
|
6682
6746
|
}
|
|
6683
6747
|
notifyObservers(scale, offset) {
|
|
6684
|
-
this.observers.forEach(
|
|
6748
|
+
this.observers.forEach(listener => {
|
|
6685
6749
|
listener({
|
|
6686
6750
|
scale: scale,
|
|
6687
6751
|
...offset
|
|
6688
6752
|
});
|
|
6689
|
-
})
|
|
6753
|
+
});
|
|
6690
6754
|
}
|
|
6691
6755
|
changeZoom(callback) {
|
|
6692
6756
|
this.observers.push(callback);
|
|
@@ -6844,12 +6908,12 @@ var DraggableRect = defineComponent({
|
|
|
6844
6908
|
rect.value.rectWidth = newWidth;
|
|
6845
6909
|
}
|
|
6846
6910
|
};
|
|
6847
|
-
return onMounted((
|
|
6911
|
+
return onMounted(() => {
|
|
6848
6912
|
parentRect = props.parentEl.getBoundingClientRect(), document.addEventListener("mousemove", onMousemove),
|
|
6849
6913
|
document.addEventListener("mouseup", onMouseup);
|
|
6850
|
-
})
|
|
6914
|
+
}), onUnmounted(() => {
|
|
6851
6915
|
document.removeEventListener("mousemove", onMousemove), document.removeEventListener("mouseup", onMouseup);
|
|
6852
|
-
})
|
|
6916
|
+
}), {
|
|
6853
6917
|
onMousedown: e => {
|
|
6854
6918
|
e.preventDefault(), isDraggle.value = !0, draggleOffset.value.diff_x = e.offsetX,
|
|
6855
6919
|
draggleOffset.value.diff_y = e.offsetY;
|
|
@@ -6946,11 +7010,11 @@ var DraggableRect = defineComponent({
|
|
|
6946
7010
|
const _labels = deepClone(labels.value);
|
|
6947
7011
|
let yolo_label = [];
|
|
6948
7012
|
return {
|
|
6949
|
-
rects: _labels.map(
|
|
7013
|
+
rects: _labels.map(rect => {
|
|
6950
7014
|
delete rect.typeName;
|
|
6951
7015
|
const label_rect = convertToLabel(rect);
|
|
6952
7016
|
return yolo_label.push(label_rect.join(" ")), toRaw(rect);
|
|
6953
|
-
})
|
|
7017
|
+
}),
|
|
6954
7018
|
label_txt: yolo_label.join("\n")
|
|
6955
7019
|
};
|
|
6956
7020
|
}, setContainerWidthHeight = (canvasWidth, canvasHeight) => {
|
|
@@ -6986,11 +7050,11 @@ var DraggableRect = defineComponent({
|
|
|
6986
7050
|
originHeight: image.height
|
|
6987
7051
|
};
|
|
6988
7052
|
})(image);
|
|
6989
|
-
labels.value = ((rowInfo, originWidth, originHeight) => rowInfo.labels ? rowInfo.labels.map(
|
|
7053
|
+
labels.value = ((rowInfo, originWidth, originHeight) => rowInfo.labels ? rowInfo.labels.map(rect => {
|
|
6990
7054
|
const typeName = props.classes[rect.type];
|
|
6991
7055
|
return typeName && (rect.typeName = typeName), rect.originWidth || (rect.originWidth = originWidth),
|
|
6992
7056
|
rect.originHeight || (rect.originHeight = originHeight), rect;
|
|
6993
|
-
})
|
|
7057
|
+
}) : [])(rowInfo, originWidth, originHeight), image.style.width = canvasWidth + "px",
|
|
6994
7058
|
image.style.height = canvasHeight + "px", setContainerWidthHeight(canvasWidth, canvasHeight),
|
|
6995
7059
|
labels.value = ((labels, canvasHeight) => {
|
|
6996
7060
|
let scale_rects = [];
|
|
@@ -7116,7 +7180,7 @@ var DraggableRect = defineComponent({
|
|
|
7116
7180
|
canvas: canvasRectRef.value,
|
|
7117
7181
|
originWidth: originWidth,
|
|
7118
7182
|
originHeight: originHeight
|
|
7119
|
-
}, (
|
|
7183
|
+
}, (rect, {endX: endX, endY: endY}) => {
|
|
7120
7184
|
activate_add_label.value = rect;
|
|
7121
7185
|
const newRect = ((rect, scaleOffset) => {
|
|
7122
7186
|
const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect, {scale: scale, x: x, y: y} = scaleOffset;
|
|
@@ -7132,51 +7196,51 @@ var DraggableRect = defineComponent({
|
|
|
7132
7196
|
};
|
|
7133
7197
|
})(rect, scaleTranslateManager.scaleTranslate.value);
|
|
7134
7198
|
drawBaseCanvas.value.addDrawRect(newRect), updateContextmenuLabelFixed(endX, endY, newRect);
|
|
7135
|
-
}
|
|
7199
|
+
}, () => {
|
|
7136
7200
|
onCloseDraggableRectFixed();
|
|
7137
|
-
})
|
|
7201
|
+
});
|
|
7138
7202
|
drawBaseCanvas.value.clearCanvasRect = clearCanvas, drawBaseCanvas.value.removeEventAll = removeEventAll,
|
|
7139
|
-
canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom(
|
|
7203
|
+
canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom(scaleOffset => {
|
|
7140
7204
|
scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawBaseCanvas.value.updateLabels();
|
|
7141
|
-
})
|
|
7205
|
+
});
|
|
7142
7206
|
}, image.onerror = () => {
|
|
7143
7207
|
loadingImage.value = !1;
|
|
7144
7208
|
};
|
|
7145
7209
|
}
|
|
7146
|
-
canvasBaseRef.value.addEventListener("contextmenu",
|
|
7210
|
+
canvasBaseRef.value.addEventListener("contextmenu", e => {
|
|
7147
7211
|
e.preventDefault();
|
|
7148
7212
|
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);
|
|
7149
|
-
onCloseContentmenuLabel(), onCloseDraggableRectFixed(), hit_rect && nextTick((
|
|
7213
|
+
onCloseContentmenuLabel(), onCloseDraggableRectFixed(), hit_rect && nextTick(() => {
|
|
7150
7214
|
updateContextmenuLabelFixed(offsetX, offsetY, hit_rect);
|
|
7151
|
-
})
|
|
7152
|
-
})
|
|
7215
|
+
});
|
|
7216
|
+
}), canvasBaseRef.value.addEventListener("click", e => {
|
|
7153
7217
|
if (e.ctrlKey) return;
|
|
7154
7218
|
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);
|
|
7155
|
-
onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && nextTick((
|
|
7219
|
+
onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && nextTick(() => {
|
|
7156
7220
|
updateDraggableRectFixed(offsetX, offsetY, hit_rect, hit_index, color);
|
|
7157
|
-
})
|
|
7158
|
-
})
|
|
7221
|
+
});
|
|
7222
|
+
});
|
|
7159
7223
|
};
|
|
7160
|
-
onMounted((
|
|
7161
|
-
watch((
|
|
7224
|
+
onMounted(() => {
|
|
7225
|
+
watch(() => props.rowInfo, info => {
|
|
7162
7226
|
const rowInfo = toRaw(info);
|
|
7163
7227
|
renderImageLabel(rowInfo);
|
|
7164
|
-
}
|
|
7228
|
+
}, {
|
|
7165
7229
|
deep: !0,
|
|
7166
7230
|
immediate: !0
|
|
7167
|
-
}), watch((
|
|
7231
|
+
}), watch(() => props.classes, () => {
|
|
7168
7232
|
const rowInfo = toRaw(props.rowInfo);
|
|
7169
7233
|
renderImageLabel(rowInfo);
|
|
7170
|
-
})
|
|
7234
|
+
}), watch(() => props.contextClientHeight, height => {
|
|
7171
7235
|
if (valueExist(height)) {
|
|
7172
7236
|
canvasMainRef.value.style.height = height + "px";
|
|
7173
7237
|
const rowInfo = toRaw(props.rowInfo);
|
|
7174
7238
|
renderImageLabel(rowInfo);
|
|
7175
7239
|
}
|
|
7176
|
-
})
|
|
7177
|
-
})
|
|
7240
|
+
});
|
|
7241
|
+
}), onUnmounted(() => {
|
|
7178
7242
|
drawBaseCanvas.value.removeEventAll?.(), canvasDragZoom.value.destroy();
|
|
7179
|
-
})
|
|
7243
|
+
});
|
|
7180
7244
|
const contextmenuLabelFixed = ref({
|
|
7181
7245
|
show: !1,
|
|
7182
7246
|
top: 0,
|
|
@@ -7192,7 +7256,7 @@ var DraggableRect = defineComponent({
|
|
|
7192
7256
|
contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
|
|
7193
7257
|
contextmenuLabelFixed.value.activateRect = null, activate_add_label.value = null,
|
|
7194
7258
|
drawBaseCanvas.value.updateLabels(), drawBaseCanvas.value.clearCanvasRect();
|
|
7195
|
-
}, contextmenuLabelRect = computed((
|
|
7259
|
+
}, contextmenuLabelRect = computed(() => {
|
|
7196
7260
|
const {top: top, left: left, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = contextmenuLabelFixed.value;
|
|
7197
7261
|
return {
|
|
7198
7262
|
top: top,
|
|
@@ -7200,7 +7264,7 @@ var DraggableRect = defineComponent({
|
|
|
7200
7264
|
canvasWidth: canvasWidth,
|
|
7201
7265
|
canvasHeight: canvasHeight
|
|
7202
7266
|
};
|
|
7203
|
-
})
|
|
7267
|
+
}), draggableRectFixed = ref({
|
|
7204
7268
|
show: !1,
|
|
7205
7269
|
top: 0,
|
|
7206
7270
|
left: 0,
|
|
@@ -7220,27 +7284,27 @@ var DraggableRect = defineComponent({
|
|
|
7220
7284
|
draggableRectFixed.value.activateIndex = null, draggableRectFixed.value.color = null;
|
|
7221
7285
|
}, onDraggleRectResize = rect => {
|
|
7222
7286
|
draggableRectFixed.value.activateRect = rect;
|
|
7223
|
-
const i = labels.value.findIndex(
|
|
7287
|
+
const i = labels.value.findIndex(o => isEqual(o, rect));
|
|
7224
7288
|
i > -1 && labels.value.splice(i, 1, rect), drawBaseCanvas.value.updateLabels();
|
|
7225
7289
|
const {rects: rects, label_txt: label_txt} = formatLabelsType();
|
|
7226
7290
|
_emit("change", rects, label_txt), emit("change", rects, label_txt);
|
|
7227
7291
|
}, onContextmenuDraggable = (e, rect) => {
|
|
7228
7292
|
e.preventDefault();
|
|
7229
7293
|
const rect_x = e.offsetX, rect_y = e.offsetY, x = rect_x + rect.startX, y = rect_y + rect.startY;
|
|
7230
|
-
onCloseContentmenuLabel(), nextTick((
|
|
7294
|
+
onCloseContentmenuLabel(), nextTick(() => {
|
|
7231
7295
|
updateContextmenuLabelFixed(x, y, rect);
|
|
7232
|
-
})
|
|
7296
|
+
});
|
|
7233
7297
|
}, activate_add_label = ref(), onSelectLabel = type => {
|
|
7234
7298
|
activate_add_label.value.type = type;
|
|
7235
7299
|
const typeName = props.classes[type];
|
|
7236
7300
|
typeName && (activate_add_label.value.typeName = typeName);
|
|
7237
|
-
const i = labels.value.findIndex(
|
|
7301
|
+
const i = labels.value.findIndex(o => isEqual(o, activate_add_label.value));
|
|
7238
7302
|
i > -1 ? labels.value.splice(i, 1, activate_add_label.value) : labels.value.push(activate_add_label.value),
|
|
7239
7303
|
onCloseContentmenuLabel();
|
|
7240
7304
|
const {rects: rects, label_txt: label_txt} = formatLabelsType();
|
|
7241
7305
|
_emit("change", rects, label_txt), emit("change", rects, label_txt);
|
|
7242
7306
|
}, onDeleteLabel = rect => {
|
|
7243
|
-
const i = labels.value.findIndex(
|
|
7307
|
+
const i = labels.value.findIndex(o => isEqual(o, rect));
|
|
7244
7308
|
labels.value.splice(i, 1), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
|
|
7245
7309
|
drawBaseCanvas.value.updateLabels();
|
|
7246
7310
|
const {rects: rects, label_txt: label_txt} = formatLabelsType();
|
|
@@ -7250,18 +7314,18 @@ var DraggableRect = defineComponent({
|
|
|
7250
7314
|
onCloseDraggableRectFixed: onCloseDraggableRectFixed,
|
|
7251
7315
|
onCloseContentmenuLabel: onCloseContentmenuLabel,
|
|
7252
7316
|
onSelectedLabel: (rect, index) => {
|
|
7253
|
-
onCloseDraggableRectFixed(), nextTick((
|
|
7317
|
+
onCloseDraggableRectFixed(), nextTick(() => {
|
|
7254
7318
|
const {startX: x, startY: y, type: type} = rect, color = colors$1[type];
|
|
7255
7319
|
updateDraggableRectFixed(x, y, labels.value[index], index, color);
|
|
7256
|
-
})
|
|
7320
|
+
});
|
|
7257
7321
|
},
|
|
7258
7322
|
onDeleteLabel: onDeleteLabel,
|
|
7259
7323
|
rerenderImage: () => {
|
|
7260
7324
|
setContainerWidthHeight(0, 0), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
|
|
7261
|
-
nextTick((
|
|
7325
|
+
nextTick(() => {
|
|
7262
7326
|
const rowInfo = toRaw(props.rowInfo);
|
|
7263
7327
|
renderImageLabel(rowInfo);
|
|
7264
|
-
})
|
|
7328
|
+
});
|
|
7265
7329
|
},
|
|
7266
7330
|
resetScaleOffset: () => {
|
|
7267
7331
|
canvasDragZoom.value.reset();
|
|
@@ -7281,7 +7345,7 @@ var DraggableRect = defineComponent({
|
|
|
7281
7345
|
}, null), createVNode("canvas", {
|
|
7282
7346
|
ref: canvasRectRef,
|
|
7283
7347
|
class: [ ns.be("canvas", "rect") ]
|
|
7284
|
-
}, null), contextmenuLabelFixed.value.show ? createVNode(ContextMenuLabel, {
|
|
7348
|
+
}, null), contextmenuLabelFixed.value.show ? createVNode(ContextMenuLabel$1, {
|
|
7285
7349
|
labelRect: contextmenuLabelRect.value,
|
|
7286
7350
|
classes: props.classes,
|
|
7287
7351
|
activateRect: contextmenuLabelFixed.value.activateRect,
|
|
@@ -7297,7 +7361,7 @@ var DraggableRect = defineComponent({
|
|
|
7297
7361
|
}, null) : null ]) ]
|
|
7298
7362
|
}) ]);
|
|
7299
7363
|
}
|
|
7300
|
-
}), RightLabel = defineComponent({
|
|
7364
|
+
}), RightLabel$1 = defineComponent({
|
|
7301
7365
|
props: {
|
|
7302
7366
|
contentHeight: {
|
|
7303
7367
|
type: Number
|
|
@@ -7313,16 +7377,16 @@ var DraggableRect = defineComponent({
|
|
|
7313
7377
|
},
|
|
7314
7378
|
emits: [ "delete", "select" ],
|
|
7315
7379
|
setup(props, {emit: emit}) {
|
|
7316
|
-
const {t: t} = useLocale(), ns = inject("ns", {}), labels = ref([]), formatLabelsTypeName = labels => labels.length ? labels.map(
|
|
7380
|
+
const {t: t} = useLocale(), ns = inject("ns", {}), labels = ref([]), formatLabelsTypeName = labels => labels.length ? labels.map(rect => {
|
|
7317
7381
|
const typeName = props.classes[rect.type];
|
|
7318
7382
|
return typeName && (rect.typeName = typeName), rect;
|
|
7319
|
-
})
|
|
7320
|
-
watch((
|
|
7383
|
+
}) : [];
|
|
7384
|
+
watch(() => props.classes, () => {
|
|
7321
7385
|
labels.value = formatLabelsTypeName(labels.value);
|
|
7322
|
-
})
|
|
7386
|
+
}), watch(() => props.labels, rects => {
|
|
7323
7387
|
const _rects = toRaw(rects);
|
|
7324
7388
|
labels.value = formatLabelsTypeName(_rects);
|
|
7325
|
-
}
|
|
7389
|
+
}, {
|
|
7326
7390
|
deep: !0,
|
|
7327
7391
|
immediate: !0
|
|
7328
7392
|
});
|
|
@@ -7331,7 +7395,7 @@ var DraggableRect = defineComponent({
|
|
|
7331
7395
|
style: {
|
|
7332
7396
|
height: props.contentHeight + "px"
|
|
7333
7397
|
}
|
|
7334
|
-
}, [ labels.value.length ? createVNode("ul", null, [ labels.value.map((
|
|
7398
|
+
}, [ labels.value.length ? createVNode("ul", null, [ labels.value.map((rect, index) => createVNode("li", {
|
|
7335
7399
|
key: index,
|
|
7336
7400
|
onClick: () => ((rect, index) => {
|
|
7337
7401
|
emit("select", rect, index);
|
|
@@ -7357,8 +7421,8 @@ var DraggableRect = defineComponent({
|
|
|
7357
7421
|
}, {
|
|
7358
7422
|
default: () => [ createVNode(delete_default, null, null) ]
|
|
7359
7423
|
})
|
|
7360
|
-
}) ]))
|
|
7361
|
-
"image-size":
|
|
7424
|
+
}) ])) ]) : createVNode(ElEmpty, {
|
|
7425
|
+
"image-size": 100,
|
|
7362
7426
|
description: t("next.labelimg.emptyLabelText")
|
|
7363
7427
|
}, null) ]);
|
|
7364
7428
|
return () => createVNode(Fragment, null, [ renderContent() ]);
|
|
@@ -7395,47 +7459,47 @@ var Element$1 = defineComponent({
|
|
|
7395
7459
|
},
|
|
7396
7460
|
emits: [ "change", "save", "prev-click", "next-click" ],
|
|
7397
7461
|
setup(props, {emit: emit, slots: slots, expose: expose}) {
|
|
7398
|
-
const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = computed((
|
|
7462
|
+
const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = computed(() => {
|
|
7399
7463
|
const cfg = unref(props.options);
|
|
7400
7464
|
return merge(_config, cfg);
|
|
7401
|
-
})
|
|
7465
|
+
}), options = unref(_options);
|
|
7402
7466
|
provide("ns", ns$2), provide("_emit", emit);
|
|
7403
7467
|
const activateNodeIndex = ref(0), classes = ref(props.classes), labelImages = ref(deepClone(props.data));
|
|
7404
|
-
watch((
|
|
7468
|
+
watch(() => props.data, data => {
|
|
7405
7469
|
labelImages.value = deepClone(data);
|
|
7406
|
-
}
|
|
7470
|
+
}, {
|
|
7407
7471
|
deep: !0
|
|
7408
|
-
}), watch((
|
|
7472
|
+
}), watch(() => props.data.length, () => {
|
|
7409
7473
|
activateNodeIndex.value = 0;
|
|
7410
|
-
})
|
|
7474
|
+
}), watch(() => props.classes, val => {
|
|
7411
7475
|
classes.value = val;
|
|
7412
|
-
}
|
|
7476
|
+
}, {
|
|
7413
7477
|
deep: !0
|
|
7414
7478
|
});
|
|
7415
|
-
const currentNode = computed((
|
|
7479
|
+
const currentNode = computed(() => {
|
|
7416
7480
|
if (!labelImages.value) return {};
|
|
7417
7481
|
const node = labelImages.value[activateNodeIndex.value] || {};
|
|
7418
7482
|
return deepClone(node);
|
|
7419
|
-
})
|
|
7420
|
-
watch((
|
|
7483
|
+
}), activateNodeLabels = ref(currentNode.value.labels || []);
|
|
7484
|
+
watch(() => currentNode.value, () => {
|
|
7421
7485
|
activateNodeLabels.value = currentNode.value.labels || [];
|
|
7422
|
-
})
|
|
7486
|
+
});
|
|
7423
7487
|
const onChangeNodeRect = rects => {
|
|
7424
7488
|
currentNode.value.labels = rects, activateNodeLabels.value = rects;
|
|
7425
7489
|
}, loading = ref(!1), formatNodeLabels = () => {
|
|
7426
7490
|
const node = currentNode.value;
|
|
7427
7491
|
let yolo_label = [];
|
|
7428
|
-
return node.labels.forEach(
|
|
7492
|
+
return node.labels.forEach(rect => {
|
|
7429
7493
|
delete rect.typeName;
|
|
7430
7494
|
const label_rect = convertToLabel(rect);
|
|
7431
7495
|
yolo_label.push(label_rect.join(" "));
|
|
7432
|
-
})
|
|
7496
|
+
}), {
|
|
7433
7497
|
node: node,
|
|
7434
7498
|
label_txt: yolo_label.join("\n")
|
|
7435
7499
|
};
|
|
7436
7500
|
}, isChangeNodeLabels = () => {
|
|
7437
7501
|
const node = labelImages.value[activateNodeIndex.value];
|
|
7438
|
-
return isEqual(toRaw(node.labels).map(
|
|
7502
|
+
return isEqual(toRaw(node.labels).map(rect => convertToLabel(rect)), currentNode.value.labels.map(rect => convertToLabel(rect)));
|
|
7439
7503
|
}, switchKeydownAD = e => {
|
|
7440
7504
|
const imageLength = labelImages.value.length;
|
|
7441
7505
|
"KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
|
|
@@ -7450,12 +7514,12 @@ var Element$1 = defineComponent({
|
|
|
7450
7514
|
emit("save", {
|
|
7451
7515
|
node: node,
|
|
7452
7516
|
label_txt: label_txt
|
|
7453
|
-
},
|
|
7517
|
+
}, imageItem => {
|
|
7454
7518
|
labelImages.value[activateNodeIndex.value] = imageItem || node, switchKeydownAD(e),
|
|
7455
7519
|
loading.value = !1;
|
|
7456
|
-
}
|
|
7520
|
+
}, () => {
|
|
7457
7521
|
loading.value = !1;
|
|
7458
|
-
})
|
|
7522
|
+
});
|
|
7459
7523
|
}, onChangeActivateNode = index => {
|
|
7460
7524
|
if (loading.value) return;
|
|
7461
7525
|
loading.value = !0;
|
|
@@ -7464,16 +7528,16 @@ var Element$1 = defineComponent({
|
|
|
7464
7528
|
loading.value = !1, !1) : (emit("save", {
|
|
7465
7529
|
node: node,
|
|
7466
7530
|
label_txt: label_txt
|
|
7467
|
-
},
|
|
7531
|
+
}, imageItem => {
|
|
7468
7532
|
labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
|
|
7469
7533
|
loading.value = !1, scaleTranslate.value = {
|
|
7470
7534
|
scale: 1,
|
|
7471
7535
|
x: 0,
|
|
7472
7536
|
y: 0
|
|
7473
7537
|
};
|
|
7474
|
-
}
|
|
7538
|
+
}, () => {
|
|
7475
7539
|
loading.value = !1;
|
|
7476
|
-
})
|
|
7540
|
+
}), !0);
|
|
7477
7541
|
}, onPaginationPrev = () => {
|
|
7478
7542
|
const imageLength = labelImages.value.length;
|
|
7479
7543
|
let i = activateNodeIndex.value - 1;
|
|
@@ -7483,26 +7547,26 @@ var Element$1 = defineComponent({
|
|
|
7483
7547
|
let i = activateNodeIndex.value + 1;
|
|
7484
7548
|
i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
|
|
7485
7549
|
}, canvasContextRef = ref(), layoutLabelRef = ref(), headerRef = ref(), mainRef = ref(), footerRef = ref(), mainContentHeight = ref(options.minContentHeight), updateMainContentHeight = () => {
|
|
7486
|
-
nextTick((
|
|
7550
|
+
nextTick(() => {
|
|
7487
7551
|
const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
|
|
7488
7552
|
mainContentHeight.value = contentHeight;
|
|
7489
|
-
})
|
|
7553
|
+
});
|
|
7490
7554
|
};
|
|
7491
|
-
onMounted((
|
|
7492
|
-
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (
|
|
7555
|
+
onMounted(() => {
|
|
7556
|
+
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, () => {
|
|
7493
7557
|
updateMainContentHeight();
|
|
7494
|
-
})
|
|
7495
|
-
})
|
|
7558
|
+
}), window.addEventListener("resize", updateMainContentHeight);
|
|
7559
|
+
}), onUnmounted(() => {
|
|
7496
7560
|
document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
|
|
7497
|
-
})
|
|
7561
|
+
});
|
|
7498
7562
|
const onSelectLabelNode = (rect, index) => {
|
|
7499
7563
|
canvasContextRef.value.onSelectedLabel(rect, index);
|
|
7500
7564
|
}, onDeleteLabelNode = rect => {
|
|
7501
7565
|
canvasContextRef.value.onDeleteLabel(rect);
|
|
7502
7566
|
}, isFullscreen = ref(!1), onSwitchFillscreen = val => {
|
|
7503
|
-
isFullscreen.value = val, updateMainContentHeight(), nextTick((
|
|
7567
|
+
isFullscreen.value = val, updateMainContentHeight(), nextTick(() => {
|
|
7504
7568
|
canvasContextRef.value.rerenderImage();
|
|
7505
|
-
})
|
|
7569
|
+
});
|
|
7506
7570
|
}, scaleTranslate = ref({
|
|
7507
7571
|
scale: 1,
|
|
7508
7572
|
x: 0,
|
|
@@ -7564,7 +7628,7 @@ var Element$1 = defineComponent({
|
|
|
7564
7628
|
rowInfo: currentNode.value,
|
|
7565
7629
|
onChange: onChangeNodeRect
|
|
7566
7630
|
}, null) ]) ]
|
|
7567
|
-
}), createVNode(RightLabel, {
|
|
7631
|
+
}), createVNode(RightLabel$1, {
|
|
7568
7632
|
contentHeight: mainContentHeight.value,
|
|
7569
7633
|
classes: classes.value,
|
|
7570
7634
|
labels: activateNodeLabels.value,
|
|
@@ -7586,7 +7650,7 @@ var Element$1 = defineComponent({
|
|
|
7586
7650
|
}, [ createVNode(ElScrollbar, null, {
|
|
7587
7651
|
default: () => [ createVNode("ul", {
|
|
7588
7652
|
class: [ ns$2.bem("footer", "center", "list") ]
|
|
7589
|
-
}, [ labelImages.value.map((
|
|
7653
|
+
}, [ labelImages.value.map((item, index) => createVNode("li", {
|
|
7590
7654
|
key: index,
|
|
7591
7655
|
onClick: () => onChangeActivateNode(index),
|
|
7592
7656
|
class: {
|
|
@@ -7599,7 +7663,7 @@ var Element$1 = defineComponent({
|
|
|
7599
7663
|
"max-scale": 2,
|
|
7600
7664
|
"min-scale": .2,
|
|
7601
7665
|
fit: "cover"
|
|
7602
|
-
}, null) ]))
|
|
7666
|
+
}, null) ])) ]) ]
|
|
7603
7667
|
}) ]), createVNode("div", {
|
|
7604
7668
|
class: [ ns$2.be("footer", "right") ]
|
|
7605
7669
|
}, [ createVNode(ElIcon, {
|
|
@@ -7667,13 +7731,13 @@ var preview = defineComponent({
|
|
|
7667
7731
|
};
|
|
7668
7732
|
}
|
|
7669
7733
|
};
|
|
7670
|
-
onMounted((
|
|
7671
|
-
watch((
|
|
7734
|
+
onMounted(() => {
|
|
7735
|
+
watch(() => props.src, () => {
|
|
7672
7736
|
renderImageAndLabel();
|
|
7673
|
-
}
|
|
7737
|
+
}, {
|
|
7674
7738
|
immediate: !0
|
|
7675
7739
|
});
|
|
7676
|
-
})
|
|
7740
|
+
});
|
|
7677
7741
|
return () => createVNode(Fragment, null, [ createVNode("div", {
|
|
7678
7742
|
class: [ ns$1.b(), props.className ],
|
|
7679
7743
|
style: {
|
|
@@ -7685,84 +7749,292 @@ var preview = defineComponent({
|
|
|
7685
7749
|
}
|
|
7686
7750
|
});
|
|
7687
7751
|
|
|
7688
|
-
const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview)
|
|
7689
|
-
const [x, y] = vertex;
|
|
7690
|
-
return isMultiply ? [ x * scaleX, y * scaleY ] : [ x / scaleX, y / scaleY ];
|
|
7691
|
-
})(item, scaleX, scaleY, isMultiply))) : [], {hexToRgba: hexToRgba} = useChangeColor(), colors = [ "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ];
|
|
7752
|
+
const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview);
|
|
7692
7753
|
|
|
7693
|
-
|
|
7694
|
-
canvas;
|
|
7695
|
-
ctx;
|
|
7696
|
-
vertexes;
|
|
7697
|
-
isDrawing;
|
|
7698
|
-
mouseOffset;
|
|
7699
|
-
vertexesObservers=[];
|
|
7700
|
-
destroyedObservers;
|
|
7701
|
-
constructor(canvas, ctx) {
|
|
7702
|
-
this.canvas = canvas, this.ctx = ctx, this.isDrawing = !1, this.vertexes = [], this.mouseOffset = {
|
|
7703
|
-
x: 0,
|
|
7704
|
-
y: 0
|
|
7705
|
-
}, canvas.addEventListener("click", this.canvasMouseClick.bind(this)), canvas.addEventListener("mousemove", this.canvasMousemove.bind(this)),
|
|
7706
|
-
canvas.addEventListener("dblclick", this.canvasMouseDblclick.bind(this)), this.vertexes = new Proxy(this.vertexes, {
|
|
7707
|
-
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7708
|
-
!0)
|
|
7709
|
-
}), this.mouseOffset = new Proxy(this.mouseOffset, {
|
|
7710
|
-
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7711
|
-
!0)
|
|
7712
|
-
});
|
|
7713
|
-
}
|
|
7714
|
-
notifyVertexChangeListeners() {
|
|
7715
|
-
this.vertexesObservers.forEach((listener => {
|
|
7716
|
-
listener(this.vertexes, this.mouseOffset);
|
|
7717
|
-
}));
|
|
7718
|
-
}
|
|
7719
|
-
vertexesChangeEventListener(listener) {
|
|
7720
|
-
this.vertexesObservers.push(listener);
|
|
7721
|
-
}
|
|
7722
|
-
notifyDestryedListerers() {
|
|
7723
|
-
this.destroyedObservers(this.vertexes);
|
|
7724
|
-
}
|
|
7725
|
-
onDestroyed(callback) {
|
|
7726
|
-
this.destroyedObservers = callback;
|
|
7727
|
-
}
|
|
7728
|
-
canvasMouseClick(e) {
|
|
7729
|
-
e.stopPropagation(), this.isDrawing = !0, this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY;
|
|
7730
|
-
const [x, y] = [ e.offsetX, e.offsetY ];
|
|
7731
|
-
let is_add = !0;
|
|
7732
|
-
for (let i = 0; i < this.vertexes.length; i++) {
|
|
7733
|
-
const p = this.vertexes[i];
|
|
7734
|
-
if (Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2) < 8) {
|
|
7735
|
-
is_add = !1;
|
|
7736
|
-
break;
|
|
7737
|
-
}
|
|
7738
|
-
}
|
|
7739
|
-
is_add && this.vertexes.push([ x, y ]), this.vertexes = vertexesUnique(this.vertexes);
|
|
7740
|
-
}
|
|
7741
|
-
canvasMousemove(e) {
|
|
7742
|
-
e.stopPropagation(), this.isDrawing && (this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
|
|
7743
|
-
this.canvas.style.cursor = "crosshair");
|
|
7744
|
-
}
|
|
7745
|
-
canvasMouseDblclick(e) {
|
|
7746
|
-
e.stopPropagation(), this.isDrawing && (this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
|
|
7747
|
-
this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes)),
|
|
7748
|
-
this.notifyDestryedListerers(), this.destroy();
|
|
7749
|
-
}
|
|
7750
|
-
destroy() {
|
|
7751
|
-
this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.destroyedObservers = () => {
|
|
7752
|
-
this.canvas.removeEventListener("click", this.canvasMouseClick);
|
|
7753
|
-
}, this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
|
|
7754
|
-
}
|
|
7755
|
-
}
|
|
7754
|
+
var ShapeType, ToolsHandleType;
|
|
7756
7755
|
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7756
|
+
!function(ShapeType) {
|
|
7757
|
+
ShapeType.Polygon = "polygon", ShapeType.Rectangle = "rectangle", ShapeType.Circle = "circle";
|
|
7758
|
+
}(ShapeType || (ShapeType = {})), function(ToolsHandleType) {
|
|
7759
|
+
ToolsHandleType.CREATE_POLYGON = "createPolygon", ToolsHandleType.EDIT_SHAPE = "editShape",
|
|
7760
|
+
ToolsHandleType.CREATE_RECTANGLE = "createRectangle", ToolsHandleType.CREATE_CIRCLE = "createCircle";
|
|
7761
|
+
}(ToolsHandleType || (ToolsHandleType = {}));
|
|
7762
|
+
|
|
7763
|
+
const colors = [ "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ];
|
|
7764
|
+
|
|
7765
|
+
var defaultConfig = {
|
|
7766
|
+
minContentHeight: 500
|
|
7767
|
+
};
|
|
7768
|
+
|
|
7769
|
+
var ContextMenuLabel = defineComponent({
|
|
7770
|
+
props: {
|
|
7771
|
+
fixed: {
|
|
7772
|
+
type: Object,
|
|
7773
|
+
default: () => ({})
|
|
7774
|
+
},
|
|
7775
|
+
classes: {
|
|
7776
|
+
type: Array,
|
|
7777
|
+
default: () => []
|
|
7778
|
+
},
|
|
7779
|
+
activateShape: {
|
|
7780
|
+
type: Object,
|
|
7781
|
+
default: null
|
|
7782
|
+
}
|
|
7783
|
+
},
|
|
7784
|
+
emits: [ "close", "select", "delete" ],
|
|
7785
|
+
setup(props, {emit: emit}) {
|
|
7786
|
+
const {t: t} = useLocale(), ns = inject("ns", {}), groupId = ref(props.activateShape.group_id || ""), description = ref(props.activateShape.description || ""), onClose = () => {
|
|
7787
|
+
emit("close");
|
|
7788
|
+
}, onDelete = () => {
|
|
7789
|
+
emit("delete", props.activateShape);
|
|
7790
|
+
}, activateIndex = ref();
|
|
7791
|
+
watch(() => props.activateShape, () => {
|
|
7792
|
+
const {label: label} = props.activateShape;
|
|
7793
|
+
activateIndex.value = isValueExist(label) ? label : null;
|
|
7794
|
+
}, {
|
|
7795
|
+
deep: !0,
|
|
7796
|
+
immediate: !0
|
|
7797
|
+
});
|
|
7798
|
+
const labelRectWidthHeight = ref({
|
|
7799
|
+
width: 0,
|
|
7800
|
+
height: 0
|
|
7801
|
+
});
|
|
7802
|
+
onMounted(() => {
|
|
7803
|
+
const {clientWidth: clientWidth, clientHeight: clientHeight} = labelMenuRef.value;
|
|
7804
|
+
labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
|
|
7805
|
+
});
|
|
7806
|
+
const labelMenuRef = ref(), labelStyleFixed = computed(() => {
|
|
7807
|
+
const {left: left, top: top} = props.fixed, height_diff = top + labelRectWidthHeight.value.height - window.innerHeight;
|
|
7808
|
+
let y = top;
|
|
7809
|
+
return height_diff > 0 && (y -= height_diff), {
|
|
7810
|
+
top: y + "px",
|
|
7811
|
+
left: left + "px"
|
|
7812
|
+
};
|
|
7813
|
+
}), renderContent = () => {
|
|
7814
|
+
let _slot;
|
|
7815
|
+
return createVNode(Teleport, {
|
|
7816
|
+
to: "body"
|
|
7817
|
+
}, {
|
|
7818
|
+
default: () => {
|
|
7819
|
+
return [ createVNode("div", {
|
|
7820
|
+
ref: labelMenuRef,
|
|
7821
|
+
class: [ ns.b("contextmenu-label") ],
|
|
7822
|
+
style: labelStyleFixed.value
|
|
7823
|
+
}, [ createVNode("div", {
|
|
7824
|
+
class: "label-head"
|
|
7825
|
+
}, [ createVNode("span", {
|
|
7826
|
+
style: "padding-right: 30px"
|
|
7827
|
+
}, [ t("next.labelme.selectClasses") ]), createVNode(ElIcon, {
|
|
7828
|
+
size: 16,
|
|
7829
|
+
onClick: onClose
|
|
7830
|
+
}, {
|
|
7831
|
+
default: () => [ createVNode(close_default, null, null) ]
|
|
7832
|
+
}) ]), props.classes.length ? createVNode(Fragment, null, [ createVNode(ElInput, {
|
|
7833
|
+
modelValue: groupId.value,
|
|
7834
|
+
"onUpdate:modelValue": $event => groupId.value = $event,
|
|
7835
|
+
placeholder: t("next.labelme.labelGroupId"),
|
|
7836
|
+
size: "small",
|
|
7837
|
+
maxLength: 30
|
|
7838
|
+
}, null), createVNode("ul", {
|
|
7839
|
+
class: "label-main"
|
|
7840
|
+
}, [ props.classes.map((name, index) => createVNode("li", {
|
|
7841
|
+
key: index,
|
|
7842
|
+
onClick: () => (label => {
|
|
7843
|
+
activateIndex.value = label;
|
|
7844
|
+
const shape = {
|
|
7845
|
+
...props.activateShape,
|
|
7846
|
+
label: label,
|
|
7847
|
+
description: description.value,
|
|
7848
|
+
group_id: groupId.value
|
|
7849
|
+
};
|
|
7850
|
+
emit("select", label, shape);
|
|
7851
|
+
})(name),
|
|
7852
|
+
class: {
|
|
7853
|
+
"activate-label": activateIndex.value === name
|
|
7854
|
+
}
|
|
7855
|
+
}, [ createVNode("span", {
|
|
7856
|
+
style: {
|
|
7857
|
+
"background-color": colors[index % colors.length]
|
|
7858
|
+
},
|
|
7859
|
+
class: "label-line"
|
|
7860
|
+
}, null), createVNode("span", null, [ name ]) ])) ]), createVNode(ElInput, {
|
|
7861
|
+
modelValue: description.value,
|
|
7862
|
+
"onUpdate:modelValue": $event => description.value = $event,
|
|
7863
|
+
placeholder: t("next.labelme.labelDescription"),
|
|
7864
|
+
size: "small",
|
|
7865
|
+
type: "textarea",
|
|
7866
|
+
rows: 2,
|
|
7867
|
+
resize: "none",
|
|
7868
|
+
maxLength: 100
|
|
7869
|
+
}, null) ]) : createVNode(ElEmpty, {
|
|
7870
|
+
"image-size": 50,
|
|
7871
|
+
description: t("next.labelme.emptyClassesText"),
|
|
7872
|
+
style: {
|
|
7873
|
+
padding: 0
|
|
7874
|
+
}
|
|
7875
|
+
}, null), isValueExist(activateIndex.value) ? createVNode("div", {
|
|
7876
|
+
style: "margin: 10px auto 0"
|
|
7877
|
+
}, [ createVNode(ElButton, {
|
|
7878
|
+
icon: delete_default,
|
|
7879
|
+
plain: !0,
|
|
7880
|
+
size: "small",
|
|
7881
|
+
type: "danger",
|
|
7882
|
+
onClick: onDelete
|
|
7883
|
+
}, (s = _slot = t("next.labelme.deleteClasses"), "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? _slot : {
|
|
7884
|
+
default: () => [ _slot ]
|
|
7885
|
+
})) ]) : null ]) ];
|
|
7886
|
+
var s;
|
|
7887
|
+
}
|
|
7888
|
+
});
|
|
7889
|
+
};
|
|
7890
|
+
return () => createVNode(Fragment, null, [ renderContent() ]);
|
|
7891
|
+
}
|
|
7892
|
+
});
|
|
7893
|
+
|
|
7894
|
+
const printsToPath = vertexes => {
|
|
7895
|
+
const path = new Path2D;
|
|
7896
|
+
if (vertexes.length) {
|
|
7897
|
+
path.moveTo(vertexes[0][0], vertexes[0][1]);
|
|
7898
|
+
for (let i = 1; i < vertexes.length; i++) {
|
|
7899
|
+
const [x, y] = vertexes[i];
|
|
7900
|
+
path.lineTo(x, y);
|
|
7901
|
+
}
|
|
7902
|
+
}
|
|
7903
|
+
return path;
|
|
7904
|
+
}, isPointInPath = (px, py, vertexes, ctx) => {
|
|
7905
|
+
const path = printsToPath(vertexes);
|
|
7906
|
+
return path.closePath(), ctx.isPointInPath(path, px, py);
|
|
7907
|
+
}, 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 => {
|
|
7908
|
+
const transformMatrix = ctx.getTransform(), {a: scaleX, b: skewY, e: translateX, f: translateY} = transformMatrix;
|
|
7909
|
+
return {
|
|
7910
|
+
scale: Math.hypot(scaleX, skewY),
|
|
7911
|
+
translateX: translateX,
|
|
7912
|
+
translateY: translateY
|
|
7913
|
+
};
|
|
7914
|
+
}, vertexesToImageScale = (vertexes, scaleX, scaleY, isMultiply = !0) => vertexes?.length ? vertexes.map(item => ((vertex, scaleX, scaleY, isMultiply = !0) => {
|
|
7915
|
+
const [x, y] = vertex;
|
|
7916
|
+
return isMultiply ? [ x * scaleX, y * scaleY ] : [ x / scaleX, y / scaleY ];
|
|
7917
|
+
})(item, scaleX, scaleY, isMultiply)) : [], vertexeTransform = (vertex, scaleOffset) => {
|
|
7918
|
+
const {scale: scale, x: offsetX, y: offsetY} = scaleOffset, [x, y] = vertex;
|
|
7919
|
+
return [ (x - offsetX) / scale, (y - offsetY) / scale ];
|
|
7920
|
+
}, {hexToRgba: hexToRgba$2} = useChangeColor();
|
|
7921
|
+
|
|
7922
|
+
class CreatePolygon {
|
|
7923
|
+
canvas;
|
|
7924
|
+
ctx;
|
|
7925
|
+
vertexes;
|
|
7926
|
+
isDrawing;
|
|
7927
|
+
mouseOffset;
|
|
7928
|
+
vertexesObservers=[];
|
|
7929
|
+
destroyedObservers=[];
|
|
7930
|
+
constructor(canvas, ctx) {
|
|
7931
|
+
this.canvas = canvas, this.ctx = ctx, this.isDrawing = !1, this.vertexes = [], this.mouseOffset = {
|
|
7932
|
+
x: 0,
|
|
7933
|
+
y: 0
|
|
7934
|
+
}, this.vertexes = new Proxy(this.vertexes, {
|
|
7935
|
+
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7936
|
+
!0)
|
|
7937
|
+
}), this.mouseOffset = new Proxy(this.mouseOffset, {
|
|
7938
|
+
set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
|
|
7939
|
+
!0)
|
|
7940
|
+
}), this.canvasMouseClick = this.canvasMouseClick.bind(this), this.canvasMouseDblclick = this.canvasMouseDblclick.bind(this),
|
|
7941
|
+
this.canvasMousemove = this.canvasMousemove.bind(this);
|
|
7942
|
+
}
|
|
7943
|
+
notifyVertexChangeListeners() {
|
|
7944
|
+
this.vertexesObservers.forEach(listener => {
|
|
7945
|
+
listener(this.vertexes, this.mouseOffset);
|
|
7946
|
+
});
|
|
7947
|
+
}
|
|
7948
|
+
vertexesChangeEventListener(listener) {
|
|
7949
|
+
this.vertexesObservers.push(listener);
|
|
7950
|
+
}
|
|
7951
|
+
notifyAddCompletedListener() {
|
|
7952
|
+
this.destroyedObservers.forEach(listener => {
|
|
7953
|
+
listener(this.vertexes, this.mouseOffset);
|
|
7954
|
+
});
|
|
7955
|
+
}
|
|
7956
|
+
addCompleted(callback) {
|
|
7957
|
+
this.destroyedObservers.push(callback);
|
|
7958
|
+
}
|
|
7959
|
+
transformMousePoint(e) {
|
|
7960
|
+
const {scale: scale, translateX: translateX, translateY: translateY} = getTranslateAndScale(this.ctx);
|
|
7961
|
+
return vertexeTransform([ e.offsetX, e.offsetY ], {
|
|
7962
|
+
scale: scale,
|
|
7963
|
+
x: translateX,
|
|
7964
|
+
y: translateY
|
|
7965
|
+
});
|
|
7966
|
+
}
|
|
7967
|
+
triggerCreatePolygon() {
|
|
7968
|
+
this.isDrawing = !0, this.canvas.addEventListener("click", this.canvasMouseClick),
|
|
7969
|
+
this.canvas.addEventListener("mousemove", this.canvasMousemove), this.canvas.addEventListener("dblclick", this.canvasMouseDblclick);
|
|
7970
|
+
}
|
|
7971
|
+
canvasMouseClick(e) {
|
|
7972
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
7973
|
+
this.isDrawing = !0;
|
|
7974
|
+
const [x, y] = this.transformMousePoint(e);
|
|
7975
|
+
this.mouseOffset.x = x, this.mouseOffset.y = y;
|
|
7976
|
+
let is_add = !0;
|
|
7977
|
+
for (let i = 0; i < this.vertexes.length; i++) {
|
|
7978
|
+
const p = this.vertexes[i];
|
|
7979
|
+
if (Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2) < 8) {
|
|
7980
|
+
is_add = !1;
|
|
7981
|
+
break;
|
|
7982
|
+
}
|
|
7983
|
+
}
|
|
7984
|
+
is_add && this.vertexes.push([ x, y ]), this.vertexes = vertexesUnique(this.vertexes);
|
|
7985
|
+
}
|
|
7986
|
+
canvasMousemove(e) {
|
|
7987
|
+
if (e.stopPropagation(), e.preventDefault(), !e.ctrlKey && this.isDrawing) {
|
|
7988
|
+
const [x, y] = this.transformMousePoint(e);
|
|
7989
|
+
this.mouseOffset.x = x, this.mouseOffset.y = y, this.canvas.style.cursor = "crosshair";
|
|
7990
|
+
}
|
|
7991
|
+
}
|
|
7992
|
+
canvasMouseDblclick(e) {
|
|
7993
|
+
if (e.stopPropagation(), e.preventDefault(), !e.ctrlKey) {
|
|
7994
|
+
if (this.isDrawing) {
|
|
7995
|
+
this.canvas.style.cursor = "unset";
|
|
7996
|
+
const [x, y] = this.transformMousePoint(e);
|
|
7997
|
+
this.mouseOffset.x = x, this.mouseOffset.y = y, this.vertexes.push([ x, y ]), this.vertexes = vertexesUnique(this.vertexes);
|
|
7998
|
+
}
|
|
7999
|
+
this.notifyAddCompletedListener(), this.isDrawing = !1;
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
8002
|
+
drawPolygon(vertexes) {
|
|
8003
|
+
const ctx = this.ctx;
|
|
8004
|
+
if (!vertexes.length) return;
|
|
8005
|
+
const {scale: scale} = getTranslateAndScale(this.ctx);
|
|
8006
|
+
ctx.save();
|
|
8007
|
+
const {x: x, y: y} = this.mouseOffset, path = printsToPath([ ...vertexes, [ x, y ] ]);
|
|
8008
|
+
path.closePath();
|
|
8009
|
+
ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.setLineDash([ 5, 5 ]), ctx.strokeStyle = "#5470c6",
|
|
8010
|
+
ctx.fillStyle = hexToRgba$2("#5470c6", .2), ctx.stroke(path), ctx.fill(path), ctx.fillStyle = "#5470c6";
|
|
8011
|
+
for (let i = 0; i < vertexes.length; i++) {
|
|
8012
|
+
const [x, y] = vertexes[i];
|
|
8013
|
+
ctx.beginPath(), ctx.arc(x, y, 5 / scale, 0, 2 * Math.PI), ctx.fill();
|
|
8014
|
+
}
|
|
8015
|
+
ctx.restore();
|
|
8016
|
+
}
|
|
8017
|
+
reset() {
|
|
8018
|
+
this.isDrawing = !0, this.vertexes.length = 0, this.mouseOffset.x = 0, this.mouseOffset.y = 0;
|
|
8019
|
+
}
|
|
8020
|
+
destroy() {
|
|
8021
|
+
this.isDrawing = !1, this.vertexes.length = 0, this.mouseOffset.x = 0, this.mouseOffset.y = 0,
|
|
8022
|
+
this.canvas.style.cursor = "unset", this.canvas.removeEventListener("click", this.canvasMouseClick),
|
|
8023
|
+
this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
|
|
8024
|
+
}
|
|
8025
|
+
}
|
|
8026
|
+
|
|
8027
|
+
const {hexToRgba: hexToRgba$1} = useChangeColor();
|
|
8028
|
+
|
|
8029
|
+
class EditPolygon {
|
|
8030
|
+
canvas;
|
|
8031
|
+
ctx;
|
|
8032
|
+
vertexes;
|
|
8033
|
+
isEditing;
|
|
8034
|
+
isMoveEditing;
|
|
8035
|
+
canClickEvent;
|
|
8036
|
+
pointVertexIndex;
|
|
8037
|
+
pointCentreIndex;
|
|
7766
8038
|
vertexRadius;
|
|
7767
8039
|
edgeCentreRadius;
|
|
7768
8040
|
pointRecover;
|
|
@@ -7771,7 +8043,9 @@ class EditPolygonPath {
|
|
|
7771
8043
|
constructor(canvas, ctx) {
|
|
7772
8044
|
this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
|
|
7773
8045
|
this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
|
|
7774
|
-
this.vertexRadius = 8, this.edgeCentreRadius = 5, this.pointRecover = []
|
|
8046
|
+
this.vertexRadius = 8, this.edgeCentreRadius = 5, this.pointRecover = [], this.canvasMousedown = this.canvasMousedown.bind(this),
|
|
8047
|
+
this.canvasMouseup = this.canvasMouseup.bind(this), this.canvasMousemove = this.canvasMousemove.bind(this),
|
|
8048
|
+
this.canvasMouseClick = this.canvasMouseClick.bind(this);
|
|
7775
8049
|
}
|
|
7776
8050
|
notifyEditPolygonObserver() {
|
|
7777
8051
|
this.editPolygonObserver?.(this.vertexes);
|
|
@@ -7780,45 +8054,55 @@ class EditPolygonPath {
|
|
|
7780
8054
|
this.editPolygonObserver = callback;
|
|
7781
8055
|
}
|
|
7782
8056
|
getTransformPoint(x, y) {
|
|
7783
|
-
const
|
|
7784
|
-
return [
|
|
8057
|
+
const {scale: scale, translateX: translateX, translateY: translateY} = getTranslateAndScale(this.ctx);
|
|
8058
|
+
return vertexeTransform([ x, y ], {
|
|
8059
|
+
scale: scale,
|
|
8060
|
+
x: translateX,
|
|
8061
|
+
y: translateY
|
|
8062
|
+
});
|
|
7785
8063
|
}
|
|
7786
8064
|
drawPolygonPath(vertexes, mouseX, mouseY) {
|
|
7787
8065
|
const ctx = this.ctx;
|
|
7788
8066
|
if (!vertexes.length) return;
|
|
7789
|
-
|
|
7790
|
-
ctx.
|
|
8067
|
+
const {scale: scale} = getTranslateAndScale(this.ctx);
|
|
8068
|
+
ctx.save(), ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.strokeStyle = "#5470c6",
|
|
8069
|
+
ctx.fillStyle = hexToRgba$1("#5470c6", .2), ctx.moveTo(vertexes[0][0], vertexes[0][1]);
|
|
7791
8070
|
for (let i = 1; i < vertexes.length; i++) {
|
|
7792
8071
|
const [x, y] = vertexes[i];
|
|
7793
8072
|
ctx.lineTo(x, y);
|
|
7794
8073
|
}
|
|
7795
8074
|
isNaN(mouseX) || isNaN(mouseY) || ctx.lineTo(mouseX, mouseY), ctx.closePath(), ctx.stroke(),
|
|
7796
|
-
ctx.fill();
|
|
8075
|
+
ctx.fill(), ctx.restore();
|
|
7797
8076
|
}
|
|
7798
8077
|
drawPolygonEdgeCentre(vertexes) {
|
|
7799
|
-
const ctx = this.ctx;
|
|
8078
|
+
const ctx = this.ctx, {scale: scale} = getTranslateAndScale(this.ctx), _vertexRadius = this.vertexRadius / scale, _edgeCentreRadius = this.edgeCentreRadius / scale, _vertexCentreRadius = Math.max(1, _vertexRadius - _edgeCentreRadius);
|
|
8079
|
+
ctx.save();
|
|
7800
8080
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7801
8081
|
const [x, y] = vertexes[i];
|
|
7802
|
-
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y,
|
|
7803
|
-
ctx.closePath(), ctx.fill(), ctx.beginPath(), ctx.fillStyle = "#FFFFFF", ctx.arc(x, y,
|
|
8082
|
+
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, _vertexRadius, 0, 2 * Math.PI),
|
|
8083
|
+
ctx.closePath(), ctx.fill(), ctx.beginPath(), ctx.fillStyle = "#FFFFFF", ctx.arc(x, y, _vertexCentreRadius, 0, 2 * Math.PI),
|
|
7804
8084
|
ctx.closePath(), ctx.fill();
|
|
7805
8085
|
}
|
|
7806
8086
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7807
8087
|
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;
|
|
7808
|
-
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y,
|
|
8088
|
+
ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, _edgeCentreRadius, 0, 2 * Math.PI),
|
|
7809
8089
|
ctx.closePath(), ctx.fill();
|
|
7810
8090
|
}
|
|
8091
|
+
ctx.restore();
|
|
8092
|
+
}
|
|
8093
|
+
render() {
|
|
8094
|
+
this.drawPolygonPath(this.vertexes), this.drawPolygonEdgeCentre(this.vertexes);
|
|
7811
8095
|
}
|
|
7812
8096
|
drawPolygon(vertexes, mouseOffset) {
|
|
7813
8097
|
this.vertexes = vertexes, mouseOffset ? this.drawPolygonPath(vertexes, mouseOffset.x, mouseOffset.y) : (this.drawPolygonPath(vertexes),
|
|
7814
8098
|
this.drawPolygonEdgeCentre(vertexes));
|
|
7815
8099
|
}
|
|
7816
8100
|
pointInVertexes(x, y) {
|
|
7817
|
-
const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
|
|
8101
|
+
const [_x, _y] = this.getTransformPoint(x, y), {scale: scale} = getTranslateAndScale(this.ctx), _vertexRadius = this.vertexRadius / scale, vertexes = this.vertexes;
|
|
7818
8102
|
let aimIndex = null;
|
|
7819
8103
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7820
8104
|
const [vertex_x, vertex_y] = vertexes[i];
|
|
7821
|
-
if (isPointInCircle(_x, _y, vertex_x, vertex_y,
|
|
8105
|
+
if (isPointInCircle(_x, _y, vertex_x, vertex_y, _vertexRadius)) {
|
|
7822
8106
|
this.canvas.style.cursor = "pointer", aimIndex = i;
|
|
7823
8107
|
break;
|
|
7824
8108
|
}
|
|
@@ -7827,11 +8111,11 @@ class EditPolygonPath {
|
|
|
7827
8111
|
return aimIndex;
|
|
7828
8112
|
}
|
|
7829
8113
|
pointInEdgeCentre(x, y) {
|
|
7830
|
-
const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
|
|
8114
|
+
const [_x, _y] = this.getTransformPoint(x, y), {scale: scale} = getTranslateAndScale(this.ctx), _edgeCentreRadius = this.edgeCentreRadius / scale, vertexes = this.vertexes;
|
|
7831
8115
|
let aimIndex = null;
|
|
7832
8116
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7833
8117
|
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;
|
|
7834
|
-
if (isPointInCircle(_x, _y, vertex_x, vertex_y,
|
|
8118
|
+
if (isPointInCircle(_x, _y, vertex_x, vertex_y, _edgeCentreRadius)) {
|
|
7835
8119
|
this.canvas.style.cursor = "pointer", aimIndex = i;
|
|
7836
8120
|
break;
|
|
7837
8121
|
}
|
|
@@ -7840,9 +8124,9 @@ class EditPolygonPath {
|
|
|
7840
8124
|
return aimIndex;
|
|
7841
8125
|
}
|
|
7842
8126
|
pointInVertexesOrEdgeCentre(x, y) {
|
|
7843
|
-
const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
|
|
8127
|
+
const [_x, _y] = this.getTransformPoint(x, y), {scale: scale} = getTranslateAndScale(this.ctx), _vertexRadius = this.vertexRadius / scale, _edgeCentreRadius = this.edgeCentreRadius / scale, vertexes = this.vertexes;
|
|
7844
8128
|
for (let i = 0; i < vertexes.length; i++) {
|
|
7845
|
-
const [vertex_x, vertex_y] = vertexes[i], isInVertex = isPointInCircle(_x, _y, vertex_x, vertex_y,
|
|
8129
|
+
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);
|
|
7846
8130
|
if (isInVertex || isInEdgeCenter) {
|
|
7847
8131
|
this.canvas.style.cursor = "pointer";
|
|
7848
8132
|
break;
|
|
@@ -7851,17 +8135,18 @@ class EditPolygonPath {
|
|
|
7851
8135
|
}
|
|
7852
8136
|
}
|
|
7853
8137
|
notifyObservers() {
|
|
7854
|
-
this.observers.forEach(
|
|
8138
|
+
this.observers.forEach(listener => {
|
|
7855
8139
|
listener(this.vertexes);
|
|
7856
|
-
})
|
|
8140
|
+
});
|
|
7857
8141
|
}
|
|
7858
8142
|
updatePolygon(callback) {
|
|
7859
|
-
this.isEditing = !0, this.canvas.addEventListener("mousedown", this.canvasMousedown
|
|
7860
|
-
this.canvas.addEventListener("mouseup", this.canvasMouseup
|
|
7861
|
-
this.canvas.addEventListener("
|
|
8143
|
+
this.isEditing = !0, this.canvas.addEventListener("mousedown", this.canvasMousedown),
|
|
8144
|
+
this.canvas.addEventListener("mouseup", this.canvasMouseup), this.canvas.addEventListener("mousemove", this.canvasMousemove),
|
|
8145
|
+
this.canvas.addEventListener("click", this.canvasMouseClick), this.observers.push(callback);
|
|
7862
8146
|
}
|
|
7863
8147
|
canvasMousedown(e) {
|
|
7864
|
-
e.stopPropagation(), e.preventDefault(),
|
|
8148
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
8149
|
+
this.canClickEvent = !0;
|
|
7865
8150
|
const {offsetX: x, offsetY: y} = e;
|
|
7866
8151
|
this.pointRecover = [ x, y ];
|
|
7867
8152
|
const vertex_i = this.pointInVertexes(x, y);
|
|
@@ -7869,13 +8154,13 @@ class EditPolygonPath {
|
|
|
7869
8154
|
this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
|
|
7870
8155
|
const i = this.pointInEdgeCentre(x, y);
|
|
7871
8156
|
isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ])),
|
|
7872
|
-
setTimeout((
|
|
8157
|
+
setTimeout(() => {
|
|
7873
8158
|
this.canClickEvent = !1;
|
|
7874
|
-
}
|
|
8159
|
+
}, 200);
|
|
7875
8160
|
}
|
|
7876
8161
|
canvasMouseup(e) {
|
|
7877
|
-
e.stopPropagation(), e.preventDefault();
|
|
7878
|
-
let {offsetX:
|
|
8162
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
8163
|
+
let {offsetX: offsetX, offsetY: offsetY} = e, [x, y] = this.getTransformPoint(offsetX, offsetY);
|
|
7879
8164
|
this.vertexes = vertexesUnique(this.vertexes);
|
|
7880
8165
|
for (let i = 0; i < this.vertexes.length; i++) {
|
|
7881
8166
|
const p = this.vertexes[i], radius = Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2);
|
|
@@ -7890,7 +8175,7 @@ class EditPolygonPath {
|
|
|
7890
8175
|
this.drawPolygon(this.vertexes), this.notifyObservers(), this.notifyEditPolygonObserver();
|
|
7891
8176
|
}
|
|
7892
8177
|
canvasMouseClick(e) {
|
|
7893
|
-
e.stopPropagation();
|
|
8178
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
7894
8179
|
const {offsetX: x, offsetY: y} = e;
|
|
7895
8180
|
if (this.canClickEvent) {
|
|
7896
8181
|
const i = this.pointInVertexes(x, y);
|
|
@@ -7902,126 +8187,208 @@ class EditPolygonPath {
|
|
|
7902
8187
|
}
|
|
7903
8188
|
}
|
|
7904
8189
|
canvasMousemove(e) {
|
|
7905
|
-
e.stopPropagation();
|
|
7906
|
-
const {offsetX:
|
|
7907
|
-
this.pointInVertexesOrEdgeCentre(
|
|
8190
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
8191
|
+
const {offsetX: offsetX, offsetY: offsetY} = e;
|
|
8192
|
+
this.pointInVertexesOrEdgeCentre(offsetX, offsetY);
|
|
8193
|
+
const [x, y] = this.getTransformPoint(offsetX, offsetY);
|
|
8194
|
+
this.isMoveEditing && (this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
|
|
7908
8195
|
this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
|
|
7909
8196
|
this.notifyObservers());
|
|
7910
8197
|
}
|
|
7911
8198
|
destroy() {
|
|
7912
8199
|
this.vertexes = [], this.observers = [], this.isEditing = !1, this.canvas.removeEventListener("mousedown", this.canvasMousedown),
|
|
7913
|
-
this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("
|
|
7914
|
-
this.canvas.removeEventListener("
|
|
8200
|
+
this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("mousemove", this.canvasMousemove),
|
|
8201
|
+
this.canvas.removeEventListener("click", this.canvasMouseClick);
|
|
7915
8202
|
}
|
|
7916
8203
|
}
|
|
7917
8204
|
|
|
8205
|
+
const {hexToRgba: hexToRgba} = useChangeColor();
|
|
8206
|
+
|
|
7918
8207
|
class CreateDrawCanvas {
|
|
7919
8208
|
canvas;
|
|
7920
8209
|
ctx;
|
|
7921
8210
|
image;
|
|
7922
8211
|
canvasWidth;
|
|
7923
8212
|
canvasHeight;
|
|
7924
|
-
|
|
8213
|
+
imageScaleX;
|
|
8214
|
+
imageScaleY;
|
|
7925
8215
|
labels;
|
|
7926
|
-
|
|
7927
|
-
scaleY;
|
|
8216
|
+
createPolygon;
|
|
7928
8217
|
editDrawPolygon;
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
8218
|
+
addVertexes=[];
|
|
8219
|
+
createCompleteSubscribers=new Set;
|
|
8220
|
+
editingShape;
|
|
8221
|
+
editVertexes=[];
|
|
8222
|
+
editingSubscribers=new Set;
|
|
7933
8223
|
constructor(options) {
|
|
7934
|
-
const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight,
|
|
8224
|
+
const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, imageScaleX: imageScaleX, imageScaleY: imageScaleY, labels: labels} = options;
|
|
7935
8225
|
this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
|
|
7936
|
-
this.canvasHeight = canvasHeight, this.
|
|
7937
|
-
this.
|
|
7938
|
-
this.
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
this.
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
})
|
|
7950
|
-
|
|
8226
|
+
this.canvasHeight = canvasHeight, this.imageScaleX = imageScaleX, this.imageScaleY = imageScaleY,
|
|
8227
|
+
this.labels = labels || {}, this.createPolygon = new CreatePolygon(canvas, ctx),
|
|
8228
|
+
this.editDrawPolygon = new EditPolygon(canvas, ctx), this.createPolygon.vertexesChangeEventListener(vertexes => {
|
|
8229
|
+
this.render(), this.createPolygon.drawPolygon(vertexes), this.addVertexes = vertexes;
|
|
8230
|
+
}), this.createPolygon.addCompleted((vertexes, mouseOffset) => {
|
|
8231
|
+
this.addVertexes = vertexes;
|
|
8232
|
+
const {scale: scale, translateX: translateX, translateY: translateY} = getTranslateAndScale(this.ctx), [x, y] = ((vertex, scaleOffset) => {
|
|
8233
|
+
const {scale: scale, x: offsetX, y: offsetY} = scaleOffset, [x, y] = vertex;
|
|
8234
|
+
return [ x * scale + offsetX, y * scale + offsetY ];
|
|
8235
|
+
})([ mouseOffset.x, mouseOffset.y ], {
|
|
8236
|
+
scale: scale,
|
|
8237
|
+
x: translateX,
|
|
8238
|
+
y: translateY
|
|
8239
|
+
});
|
|
8240
|
+
this.notifyCreateComplete({
|
|
8241
|
+
x: x,
|
|
8242
|
+
y: y
|
|
8243
|
+
});
|
|
8244
|
+
}), this.render(), this.onMouseDown = this.onMouseDown.bind(this), this.onMouseMove = this.onMouseMove.bind(this),
|
|
8245
|
+
this.onMouseUp = this.onMouseUp.bind(this), this.onMouseClick = this.onMouseClick.bind(this),
|
|
8246
|
+
this.onMouseDoubleClick = this.onMouseDoubleClick.bind(this);
|
|
7951
8247
|
}
|
|
7952
|
-
|
|
7953
|
-
this.
|
|
7954
|
-
listener(this.editVertexes);
|
|
7955
|
-
}));
|
|
8248
|
+
subscribeCreateComplete(callback) {
|
|
8249
|
+
this.createCompleteSubscribers.add(callback);
|
|
7956
8250
|
}
|
|
7957
|
-
|
|
7958
|
-
this.
|
|
8251
|
+
unsubscribeCreateComplete(callback) {
|
|
8252
|
+
this.createCompleteSubscribers.delete(callback);
|
|
7959
8253
|
}
|
|
7960
|
-
|
|
7961
|
-
this.
|
|
8254
|
+
notifyCreateComplete(mouseOffset) {
|
|
8255
|
+
this.createCompleteSubscribers.forEach(listener => {
|
|
8256
|
+
listener(this.addVertexes, mouseOffset);
|
|
8257
|
+
});
|
|
8258
|
+
}
|
|
8259
|
+
createPolygonEventListener() {
|
|
8260
|
+
this.createPolygon.triggerCreatePolygon();
|
|
8261
|
+
}
|
|
8262
|
+
subscribeEditing(callback) {
|
|
8263
|
+
this.editingSubscribers.add(callback);
|
|
8264
|
+
}
|
|
8265
|
+
unsubscribeEditing(callback) {
|
|
8266
|
+
this.editingSubscribers.delete(callback);
|
|
8267
|
+
}
|
|
8268
|
+
notifyEditing() {
|
|
8269
|
+
this.editingSubscribers.forEach(listener => {
|
|
8270
|
+
listener(this.editVertexes, this.editingShape);
|
|
8271
|
+
});
|
|
8272
|
+
}
|
|
8273
|
+
resetAllInstance() {
|
|
8274
|
+
this.createPolygon.destroy(), this.editDrawPolygon.destroy(), this.onEditorEnd();
|
|
7962
8275
|
}
|
|
7963
|
-
|
|
7964
|
-
this.
|
|
8276
|
+
closeCreateOrEditor() {
|
|
8277
|
+
this.createPolygon.reset();
|
|
7965
8278
|
}
|
|
7966
|
-
|
|
7967
|
-
const ctx = this.ctx, {scale: scale} =
|
|
8279
|
+
drawShapes(shapes) {
|
|
8280
|
+
const ctx = this.ctx, {scale: scale} = getTranslateAndScale(ctx);
|
|
7968
8281
|
for (let i = 0; i < shapes.length; i++) {
|
|
7969
|
-
const
|
|
7970
|
-
if (
|
|
7971
|
-
const
|
|
7972
|
-
|
|
7973
|
-
const
|
|
7974
|
-
ctx.
|
|
7975
|
-
|
|
7976
|
-
const [x, y] = path[i];
|
|
7977
|
-
ctx.lineTo(x, y);
|
|
7978
|
-
}
|
|
7979
|
-
ctx.closePath(), ctx.stroke(), ctx.fill();
|
|
8282
|
+
const shape = shapes[i];
|
|
8283
|
+
if (shape.id === this.editingShape?.id) continue;
|
|
8284
|
+
const points = vertexesToImageScale(shape.points, this.imageScaleX, this.imageScaleY);
|
|
8285
|
+
if (!points.length) continue;
|
|
8286
|
+
const path = printsToPath(points), color = colors[i % colors.length];
|
|
8287
|
+
path.closePath(), ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.strokeStyle = color,
|
|
8288
|
+
ctx.fillStyle = hexToRgba(color, .2), ctx.stroke(path), ctx.fill(path);
|
|
7980
8289
|
}
|
|
7981
8290
|
}
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
8291
|
+
updateTransform(scaleOffseet) {
|
|
8292
|
+
const ctx = this.ctx, {scale: scale, x: x, y: y} = scaleOffseet;
|
|
8293
|
+
ctx.translate(x, y), ctx.scale(scale, scale);
|
|
8294
|
+
}
|
|
8295
|
+
updateLabelInfo(labelInfo) {
|
|
8296
|
+
this.labels = labelInfo, this.render();
|
|
8297
|
+
}
|
|
8298
|
+
addShape(shape) {
|
|
8299
|
+
this.labels.shapes.push(shape), this.render(), this.createPolygon.reset();
|
|
8300
|
+
}
|
|
8301
|
+
deleteShape(shape) {
|
|
8302
|
+
const index = this.labels.shapes.findIndex(item => item.id === shape.id);
|
|
8303
|
+
-1 !== index && this.labels.shapes.splice(index, 1);
|
|
8304
|
+
}
|
|
7988
8305
|
render=() => {
|
|
7989
|
-
|
|
7990
|
-
|
|
8306
|
+
const ctx = this.ctx;
|
|
8307
|
+
ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight), ctx.drawImage(this.image, 0, 0, this.canvasWidth, this.canvasHeight),
|
|
8308
|
+
ctx.save();
|
|
8309
|
+
const shapes = this.labels.shapes;
|
|
8310
|
+
shapes?.length && this.drawShapes(shapes), this.editDrawPolygon.render(), ctx.restore();
|
|
7991
8311
|
};
|
|
8312
|
+
mouseHitShape(event) {
|
|
8313
|
+
const {offsetX: x, offsetY: y} = event, shapes = this.labels.shapes;
|
|
8314
|
+
let hit = !1, hitShape = null;
|
|
8315
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
8316
|
+
const shape = shapes[i], points = vertexesToImageScale(shape.points, this.imageScaleX, this.imageScaleY);
|
|
8317
|
+
if (points.length && shape.shape_type === ShapeType.Polygon) {
|
|
8318
|
+
if (isPointInPath(x, y, points, this.ctx)) {
|
|
8319
|
+
hit = !0, hitShape = shape;
|
|
8320
|
+
break;
|
|
8321
|
+
}
|
|
8322
|
+
}
|
|
8323
|
+
}
|
|
8324
|
+
return this.canvas.style.cursor = hit ? "pointer" : "default", hitShape;
|
|
8325
|
+
}
|
|
8326
|
+
triggerShapeEdit(shape) {
|
|
8327
|
+
this.render(), this.editDrawPolygon.destroy(), this.editingShape = shape, this.render();
|
|
8328
|
+
const points = vertexesToImageScale(shape.points, this.imageScaleX, this.imageScaleY);
|
|
8329
|
+
this.editDrawPolygon.drawPolygon(points), this.editDrawPolygon.updatePolygon(vertexes => {
|
|
8330
|
+
this.editVertexes = vertexes, this.render();
|
|
8331
|
+
}), this.editDrawPolygon.onEditPolygon(vertexes => {
|
|
8332
|
+
this.editVertexes = vertexes, this.notifyEditing();
|
|
8333
|
+
});
|
|
8334
|
+
}
|
|
8335
|
+
onMouseDoubleClick(e) {
|
|
8336
|
+
e.stopPropagation(), e.preventDefault();
|
|
8337
|
+
this.mouseHitShape(e) || (this.editingShape = null, this.editVertexes = [], this.editDrawPolygon.destroy(),
|
|
8338
|
+
this.render());
|
|
8339
|
+
}
|
|
8340
|
+
onMouseClick(e) {
|
|
8341
|
+
if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
|
|
8342
|
+
const hitShape = this.mouseHitShape(e);
|
|
8343
|
+
this.editVertexes.length && !hitShape || (hitShape ? this.triggerShapeEdit(hitShape) : (this.editingShape = null,
|
|
8344
|
+
this.editVertexes = [], this.editDrawPolygon.destroy(), this.render()));
|
|
8345
|
+
}
|
|
8346
|
+
onMouseDown(e) {
|
|
8347
|
+
e.stopPropagation(), e.preventDefault(), this.mouseHitShape(e), e.ctrlKey;
|
|
8348
|
+
}
|
|
8349
|
+
onMouseMove(e) {
|
|
8350
|
+
e.stopPropagation(), e.preventDefault(), e.ctrlKey || this.editingShape || this.mouseHitShape(e);
|
|
8351
|
+
}
|
|
8352
|
+
onMouseUp(e) {
|
|
8353
|
+
e.stopPropagation(), e.preventDefault(), e.ctrlKey || this.mouseHitShape(e);
|
|
8354
|
+
}
|
|
8355
|
+
onEditorStart() {
|
|
8356
|
+
this.canvas.addEventListener("mousedown", this.onMouseDown), this.canvas.addEventListener("mousemove", this.onMouseMove),
|
|
8357
|
+
this.canvas.addEventListener("mouseup", this.onMouseUp), this.canvas.addEventListener("click", this.onMouseClick),
|
|
8358
|
+
this.canvas.addEventListener("dblclick", this.onMouseDoubleClick);
|
|
8359
|
+
}
|
|
8360
|
+
onEditorEnd() {
|
|
8361
|
+
this.editVertexes = [], this.editingShape = null, this.editDrawPolygon.destroy(),
|
|
8362
|
+
this.canvas.removeEventListener("mousedown", this.onMouseDown), this.canvas.removeEventListener("mousemove", this.onMouseMove),
|
|
8363
|
+
this.canvas.removeEventListener("mouseup", this.onMouseUp), this.canvas.removeEventListener("click", this.onMouseClick),
|
|
8364
|
+
this.canvas.removeEventListener("dblclick", this.onMouseDoubleClick);
|
|
8365
|
+
}
|
|
7992
8366
|
destroy() {
|
|
7993
|
-
this.labels = {}, this.editDrawPolygon.destroy(), this.
|
|
8367
|
+
this.labels = {}, this.editDrawPolygon.destroy(), this.createPolygon.destroy(),
|
|
8368
|
+
this.onEditorEnd();
|
|
7994
8369
|
}
|
|
7995
8370
|
}
|
|
7996
8371
|
|
|
7997
8372
|
var CanvasContext = defineComponent({
|
|
7998
8373
|
props: {
|
|
7999
|
-
classes: {
|
|
8000
|
-
type: Array,
|
|
8001
|
-
default: () => []
|
|
8002
|
-
},
|
|
8003
8374
|
contextClientHeight: {
|
|
8004
8375
|
type: Number,
|
|
8005
8376
|
default: null
|
|
8006
8377
|
},
|
|
8007
|
-
|
|
8378
|
+
labelInfo: {
|
|
8008
8379
|
type: Object,
|
|
8009
8380
|
default: () => ({})
|
|
8010
8381
|
}
|
|
8011
8382
|
},
|
|
8012
|
-
emits: [ "editPolygon", "changePolygon" ],
|
|
8383
|
+
emits: [ "editPolygon", "changePolygon", "updateLabelInfo" ],
|
|
8013
8384
|
setup(props, {emit: emit, expose: expose}) {
|
|
8014
|
-
const ns = inject("ns", {}), scaleTranslateManager = inject("scaleTranslateManager", {}), mainBasaeRef = ref(), canvasMainRef = ref(), canvasBaseRef = ref(), drawCanvas = ref(), canvasDragZoom = ref(),
|
|
8015
|
-
canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
|
|
8016
|
-
canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
|
|
8017
|
-
canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
|
|
8018
|
-
}, loadingImage = ref(!1), renderImageLabel = rowInfo => {
|
|
8385
|
+
const ns = inject("ns", {}), classes = inject("classes", ref([])), toolsActive = inject("toolsActive", {}), scaleTranslateManager = inject("scaleTranslateManager", {}), mainBasaeRef = ref(), canvasMainRef = ref(), canvasBaseRef = ref(), drawCanvas = ref(), canvasDragZoom = ref(), _labelInfo = ref(props.labelInfo), loadingImage = ref(!1), renderImageLabel = rowInfo => {
|
|
8019
8386
|
const ctx = canvasBaseRef.value?.getContext("2d");
|
|
8020
8387
|
if (rowInfo?.imageSrc) {
|
|
8021
8388
|
const image = new Image;
|
|
8022
8389
|
image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
|
|
8023
8390
|
loadingImage.value = !1;
|
|
8024
|
-
const {canvasWidth: canvasWidth, canvasHeight: canvasHeight,
|
|
8391
|
+
const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleX: scaleX, scaleY: scaleY, originWidth: originWidth, originHeight: originHeight} = (image => {
|
|
8025
8392
|
const clientWidth = mainBasaeRef.value?.elementInstance.clientWidth, clientHeight = mainBasaeRef.value?.elementInstance.clientHeight;
|
|
8026
8393
|
let {width: width, height: height} = image, scaleFactor = 1;
|
|
8027
8394
|
const aspect_ratio = width / height;
|
|
@@ -8047,61 +8414,88 @@ var CanvasContext = defineComponent({
|
|
|
8047
8414
|
};
|
|
8048
8415
|
})(image);
|
|
8049
8416
|
image.style.width = canvasWidth + "px", image.style.height = canvasHeight + "px",
|
|
8050
|
-
|
|
8417
|
+
((canvasWidth, canvasHeight) => {
|
|
8418
|
+
canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
|
|
8419
|
+
canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
|
|
8420
|
+
canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
|
|
8421
|
+
})(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
|
|
8051
8422
|
canvas: canvasBaseRef.value,
|
|
8052
8423
|
ctx: ctx,
|
|
8053
8424
|
image: image,
|
|
8054
8425
|
canvasWidth: canvasWidth,
|
|
8055
8426
|
canvasHeight: canvasHeight,
|
|
8056
|
-
scaleFactor: scaleFactor,
|
|
8057
8427
|
labels: rowInfo.labels,
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8428
|
+
imageScaleX: scaleX,
|
|
8429
|
+
imageScaleY: scaleY
|
|
8430
|
+
}), canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom(scaleOffset => {
|
|
8431
|
+
scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawCanvas.value.updateTransform(scaleOffset),
|
|
8432
|
+
drawCanvas.value.render();
|
|
8433
|
+
}), drawCanvas.value.subscribeCreateComplete((vertexes, mouseOffset) => {
|
|
8434
|
+
const new_vertexes = vertexesToImageScale(vertexes, scaleX, scaleY, !1), shape = {
|
|
8435
|
+
id: timeUniqueId(),
|
|
8436
|
+
shape_type: ShapeType.Polygon,
|
|
8437
|
+
points: new_vertexes
|
|
8438
|
+
};
|
|
8439
|
+
updateContextmenuLabelFixed(mouseOffset.x, mouseOffset.y, shape);
|
|
8440
|
+
}), drawCanvas.value.subscribeEditing((vertexes, shape) => {
|
|
8441
|
+
const new_vertexes = vertexesToImageScale(vertexes, scaleX, scaleY, !1), index = _labelInfo.value.labels.shapes?.findIndex(item => item.id === shape.id);
|
|
8442
|
+
-1 !== index && (_labelInfo.value.labels.shapes[index] = {
|
|
8443
|
+
...shape,
|
|
8444
|
+
points: new_vertexes
|
|
8445
|
+
}), _labelInfo.value.labels.imageWidth = originWidth, _labelInfo.value.labels.imageHeight = originHeight,
|
|
8446
|
+
emit("editPolygon", _labelInfo.value);
|
|
8447
|
+
}), watch(() => toolsActive.value, () => {
|
|
8448
|
+
drawCanvas.value.resetAllInstance(), toolsActive.value === ToolsHandleType.CREATE_POLYGON ? drawCanvas.value.createPolygonEventListener() : toolsActive.value === ToolsHandleType.EDIT_SHAPE && drawCanvas.value.onEditorStart();
|
|
8449
|
+
}, {
|
|
8450
|
+
immediate: !0
|
|
8451
|
+
});
|
|
8077
8452
|
}, image.onerror = () => {
|
|
8078
8453
|
loadingImage.value = !1;
|
|
8079
8454
|
};
|
|
8080
8455
|
}
|
|
8081
8456
|
};
|
|
8082
|
-
onMounted((
|
|
8083
|
-
watch((
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
deep: !0,
|
|
8088
|
-
immediate: !0
|
|
8089
|
-
}), watch((() => props.contextClientHeight), (height => {
|
|
8090
|
-
if (valueExist(height)) {
|
|
8091
|
-
canvasMainRef.value.style.height = height + "px";
|
|
8092
|
-
const rowInfo = toRaw(props.rowInfo);
|
|
8093
|
-
renderImageLabel(rowInfo);
|
|
8094
|
-
}
|
|
8095
|
-
}));
|
|
8096
|
-
})), onUnmounted((() => {
|
|
8457
|
+
onMounted(() => {
|
|
8458
|
+
renderImageLabel(_labelInfo.value), watch(() => props.contextClientHeight, height => {
|
|
8459
|
+
valueExist(height) && (canvasMainRef.value.style.height = height + "px", renderImageLabel(_labelInfo.value));
|
|
8460
|
+
});
|
|
8461
|
+
}), onUnmounted(() => {
|
|
8097
8462
|
drawCanvas.value.destroy(), canvasDragZoom.value.destroy();
|
|
8098
|
-
})
|
|
8463
|
+
});
|
|
8464
|
+
const contextmenuLabelFixed = ref({
|
|
8465
|
+
show: !1,
|
|
8466
|
+
top: 0,
|
|
8467
|
+
left: 0,
|
|
8468
|
+
activateShape: null
|
|
8469
|
+
}), onCloseContentmenuLabel = () => {
|
|
8470
|
+
contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
|
|
8471
|
+
contextmenuLabelFixed.value.activateShape = null, drawCanvas.value.closeCreateOrEditor();
|
|
8472
|
+
}, updateContextmenuLabelFixed = (x, y, shape) => {
|
|
8473
|
+
const contextRect = canvasBaseRef.value.getBoundingClientRect();
|
|
8474
|
+
contextmenuLabelFixed.value.show = !0, contextmenuLabelFixed.value.left = x + contextRect.x,
|
|
8475
|
+
contextmenuLabelFixed.value.top = y + contextRect.y, contextmenuLabelFixed.value.canvasWidth = canvasBaseRef.value.width,
|
|
8476
|
+
contextmenuLabelFixed.value.canvasHeight = canvasBaseRef.value.height, contextmenuLabelFixed.value.activateShape = shape;
|
|
8477
|
+
}, contextmenuLabelRect = computed(() => {
|
|
8478
|
+
const {top: top, left: left, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = contextmenuLabelFixed.value;
|
|
8479
|
+
return {
|
|
8480
|
+
top: top,
|
|
8481
|
+
left: left,
|
|
8482
|
+
canvasWidth: canvasWidth,
|
|
8483
|
+
canvasHeight: canvasHeight
|
|
8484
|
+
};
|
|
8485
|
+
}), onSelectLabel = (label, shape) => {
|
|
8486
|
+
const index = _labelInfo.value.labels.shapes?.findIndex(item => item.id === shape.id);
|
|
8487
|
+
-1 === index ? _labelInfo.value.labels.shapes.push(toRaw(shape)) : _labelInfo.value.labels.shapes[index] = toRaw(shape),
|
|
8488
|
+
emit("updateLabelInfo", _labelInfo.value), onCloseContentmenuLabel(), drawCanvas.value.updateLabelInfo(_labelInfo.value.labels);
|
|
8489
|
+
}, onDeleteLabel = shape => {
|
|
8490
|
+
const index = _labelInfo.value.labels.shapes?.findIndex(item => item.id === shape.id);
|
|
8491
|
+
-1 !== index && _labelInfo.value.labels.shapes.splice(index, 1), emit("updateLabelInfo", _labelInfo.value),
|
|
8492
|
+
onCloseContentmenuLabel(), drawCanvas.value.updateLabelInfo(_labelInfo.value.labels);
|
|
8493
|
+
};
|
|
8099
8494
|
return expose({
|
|
8100
8495
|
rerenderImage: () => {
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
}));
|
|
8496
|
+
onCloseContentmenuLabel(), nextTick(() => {
|
|
8497
|
+
renderImageLabel(_labelInfo.value);
|
|
8498
|
+
});
|
|
8105
8499
|
},
|
|
8106
8500
|
resetScaleOffset: () => {
|
|
8107
8501
|
canvasDragZoom.value.reset();
|
|
@@ -8120,7 +8514,14 @@ var CanvasContext = defineComponent({
|
|
|
8120
8514
|
}, [ createVNode("canvas", {
|
|
8121
8515
|
ref: canvasBaseRef,
|
|
8122
8516
|
class: [ ns.be("canvas", "context") ]
|
|
8123
|
-
}, null)
|
|
8517
|
+
}, null), contextmenuLabelFixed.value.show ? createVNode(ContextMenuLabel, {
|
|
8518
|
+
fixed: contextmenuLabelRect.value,
|
|
8519
|
+
classes: classes.value,
|
|
8520
|
+
activateShape: contextmenuLabelFixed.value.activateShape,
|
|
8521
|
+
onClose: onCloseContentmenuLabel,
|
|
8522
|
+
onSelect: onSelectLabel,
|
|
8523
|
+
onDelete: onDeleteLabel
|
|
8524
|
+
}, null) : null ]) ]
|
|
8124
8525
|
}) ]);
|
|
8125
8526
|
}
|
|
8126
8527
|
}), HeaderTool = defineComponent({
|
|
@@ -8165,64 +8566,10 @@ var CanvasContext = defineComponent({
|
|
|
8165
8566
|
"p-id": "4274"
|
|
8166
8567
|
}, null) ]), createVNode("p", {
|
|
8167
8568
|
class: "label-text"
|
|
8168
|
-
}, [ t("next.labelme.saveLabel") ]) ]), createVNode("
|
|
8169
|
-
class: "tool-item"
|
|
8170
|
-
}, [ createVNode("svg", {
|
|
8171
|
-
t: "1721826305513",
|
|
8172
|
-
class: "icon",
|
|
8173
|
-
viewBox: "0 0 1025 1024",
|
|
8174
|
-
version: "1.1",
|
|
8175
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8176
|
-
"p-id": "6215",
|
|
8177
|
-
width: "18",
|
|
8178
|
-
height: "18"
|
|
8179
|
-
}, [ createVNode("path", {
|
|
8180
|
-
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",
|
|
8181
|
-
"p-id": "6216"
|
|
8182
|
-
}, null), createVNode("path", {
|
|
8183
|
-
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",
|
|
8184
|
-
"p-id": "6217"
|
|
8185
|
-
}, null) ]), createVNode("p", {
|
|
8186
|
-
class: "label-text"
|
|
8187
|
-
}, [ t("next.labelme.createPolygon") ]) ]), createVNode("li", {
|
|
8188
|
-
class: "tool-item"
|
|
8189
|
-
}, [ createVNode("svg", {
|
|
8190
|
-
t: "1721826424613",
|
|
8191
|
-
class: "icon",
|
|
8192
|
-
viewBox: "0 0 1024 1024",
|
|
8193
|
-
version: "1.1",
|
|
8194
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8195
|
-
"p-id": "7356",
|
|
8196
|
-
width: "18",
|
|
8197
|
-
height: "18"
|
|
8198
|
-
}, [ createVNode("path", {
|
|
8199
|
-
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",
|
|
8200
|
-
"p-id": "7357"
|
|
8201
|
-
}, null) ]), createVNode("p", {
|
|
8202
|
-
class: "label-text"
|
|
8203
|
-
}, [ t("next.labelme.editPolygon") ]) ]), createVNode("li", {
|
|
8204
|
-
class: "tool-item"
|
|
8205
|
-
}, [ createVNode("svg", {
|
|
8206
|
-
t: "1721826579655",
|
|
8207
|
-
class: "icon",
|
|
8208
|
-
viewBox: "0 0 1024 1024",
|
|
8209
|
-
version: "1.1",
|
|
8210
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8211
|
-
"p-id": "10996",
|
|
8212
|
-
width: "18",
|
|
8213
|
-
height: "18"
|
|
8214
|
-
}, [ createVNode("path", {
|
|
8215
|
-
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",
|
|
8216
|
-
"p-id": "10997"
|
|
8217
|
-
}, null), createVNode("path", {
|
|
8218
|
-
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",
|
|
8219
|
-
"p-id": "10998"
|
|
8220
|
-
}, null) ]), createVNode("p", {
|
|
8221
|
-
class: "label-text"
|
|
8222
|
-
}, [ t("next.labelme.deletePolyton") ]) ]) ]), createVNode("ul", {
|
|
8569
|
+
}, [ t("next.labelme.saveLabel") ]) ]) ]), createVNode("ul", {
|
|
8223
8570
|
class: [ _ns.be("header", "tool") ]
|
|
8224
8571
|
}, [ createVNode("li", {
|
|
8225
|
-
class: "
|
|
8572
|
+
class: "tool-item",
|
|
8226
8573
|
onClick: () => scaleTranslateManager.onResetScaleTranslate()
|
|
8227
8574
|
}, [ createVNode("svg", {
|
|
8228
8575
|
t: "1725840994827",
|
|
@@ -8238,7 +8585,9 @@ var CanvasContext = defineComponent({
|
|
|
8238
8585
|
"p-id": "6052"
|
|
8239
8586
|
}, null) ]), createVNode("span", {
|
|
8240
8587
|
style: "padding-left: 3px"
|
|
8241
|
-
}, [ t("next.labelimg.zoomRestore") ]) ]), createVNode("li",
|
|
8588
|
+
}, [ t("next.labelimg.zoomRestore") ]) ]), createVNode("li", {
|
|
8589
|
+
style: "color: #999; user-select: none; cursor: default;"
|
|
8590
|
+
}, [ createVNode("span", null, [ createTextVNode("缩放比例") ]), createVNode("span", null, [ parseInt((100 * scaleTranslate.value.scale).toString()), createTextVNode("%") ]), createVNode("span", {
|
|
8242
8591
|
style: "padding: 0 10px;"
|
|
8243
8592
|
}, [ createTextVNode("偏移量") ]), createVNode("span", {
|
|
8244
8593
|
style: "min-width: 120px; text-align: left;"
|
|
@@ -8263,7 +8612,7 @@ var CanvasContext = defineComponent({
|
|
|
8263
8612
|
}) ]),
|
|
8264
8613
|
default: () => createVNode("ul", {
|
|
8265
8614
|
style: "font-size: 12px;white-space: nowrap;"
|
|
8266
|
-
}, [ createVNode("li", null, [ createVNode("span", null, [ createTextVNode("A:") ]), createVNode("span", null, [ createTextVNode("A键进入上一张图片进行标注") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("D:") ]), createVNode("span", null, [ createTextVNode("D键进入下一张图片进行标注") ]) ]) ])
|
|
8615
|
+
}, [ createVNode("li", null, [ createVNode("span", null, [ createTextVNode("A:") ]), createVNode("span", null, [ createTextVNode("A键进入上一张图片进行标注") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("D:") ]), createVNode("span", null, [ createTextVNode("D键进入下一张图片进行标注") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("Ctrl+鼠标:") ]), createVNode("span", null, [ createTextVNode("按住Ctrl键+鼠标滚动可以缩放图片,按住Ctrl+左键拖动可以移动图片") ]) ]) ])
|
|
8267
8616
|
}) ]), props.isFullscreen ? createVNode("li", {
|
|
8268
8617
|
class: "tool-item",
|
|
8269
8618
|
onClick: () => switchFillscreen(!1)
|
|
@@ -8306,9 +8655,195 @@ var CanvasContext = defineComponent({
|
|
|
8306
8655
|
}, null) ]) ]
|
|
8307
8656
|
}) ]) ]) ]) ]);
|
|
8308
8657
|
}
|
|
8309
|
-
}),
|
|
8310
|
-
|
|
8311
|
-
|
|
8658
|
+
}), LeftTools = defineComponent({
|
|
8659
|
+
props: {},
|
|
8660
|
+
emits: [ "change" ],
|
|
8661
|
+
setup(props, {emit: emit}) {
|
|
8662
|
+
const {t: t} = useLocale(), _ns = inject("ns", {}), toolsActive = inject("toolsActive", {}), changeToolsActive = inject("changeToolsActive"), onClickToolsActive = type => {
|
|
8663
|
+
changeToolsActive(type), emit("change", type);
|
|
8664
|
+
};
|
|
8665
|
+
return () => createVNode(Fragment, null, [ createVNode("ul", {
|
|
8666
|
+
class: [ _ns.be("main", "left-tools") ]
|
|
8667
|
+
}, [ createVNode("li", {
|
|
8668
|
+
class: [ "tool-item", {
|
|
8669
|
+
"active-tool": toolsActive.value === ToolsHandleType.CREATE_POLYGON
|
|
8670
|
+
} ],
|
|
8671
|
+
onClick: () => onClickToolsActive(ToolsHandleType.CREATE_POLYGON)
|
|
8672
|
+
}, [ createVNode("svg", {
|
|
8673
|
+
t: "1757513720352",
|
|
8674
|
+
class: "icon",
|
|
8675
|
+
viewBox: "0 0 1024 1024",
|
|
8676
|
+
version: "1.1",
|
|
8677
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8678
|
+
"p-id": "4548",
|
|
8679
|
+
width: "18",
|
|
8680
|
+
height: "18"
|
|
8681
|
+
}, [ createVNode("path", {
|
|
8682
|
+
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",
|
|
8683
|
+
"p-id": "4549"
|
|
8684
|
+
}, null) ]), createVNode("p", {
|
|
8685
|
+
class: "label-text"
|
|
8686
|
+
}, [ t("next.labelme.createPolygon") ]) ]), createVNode("li", {
|
|
8687
|
+
class: [ "tool-item", {
|
|
8688
|
+
"active-tool": toolsActive.value === ToolsHandleType.EDIT_SHAPE
|
|
8689
|
+
} ],
|
|
8690
|
+
onClick: () => onClickToolsActive(ToolsHandleType.EDIT_SHAPE)
|
|
8691
|
+
}, [ createVNode("svg", {
|
|
8692
|
+
t: "1757513760776",
|
|
8693
|
+
class: "icon",
|
|
8694
|
+
viewBox: "0 0 1025 1024",
|
|
8695
|
+
version: "1.1",
|
|
8696
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8697
|
+
"p-id": "4712",
|
|
8698
|
+
width: "18",
|
|
8699
|
+
height: "18"
|
|
8700
|
+
}, [ createVNode("path", {
|
|
8701
|
+
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",
|
|
8702
|
+
"p-id": "4713"
|
|
8703
|
+
}, null), createVNode("path", {
|
|
8704
|
+
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",
|
|
8705
|
+
"p-id": "4714"
|
|
8706
|
+
}, null) ]), createVNode("p", {
|
|
8707
|
+
class: "label-text"
|
|
8708
|
+
}, [ t("next.labelme.editPolygon") ]) ]), createVNode("li", {
|
|
8709
|
+
class: [ "tool-item", {
|
|
8710
|
+
"active-tool": toolsActive.value === ToolsHandleType.CREATE_RECTANGLE
|
|
8711
|
+
} ],
|
|
8712
|
+
onClick: () => onClickToolsActive(ToolsHandleType.CREATE_RECTANGLE)
|
|
8713
|
+
}, [ createVNode("svg", {
|
|
8714
|
+
t: "1757513985670",
|
|
8715
|
+
class: "icon",
|
|
8716
|
+
viewBox: "0 0 1024 1024",
|
|
8717
|
+
version: "1.1",
|
|
8718
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8719
|
+
"p-id": "7834",
|
|
8720
|
+
width: "18",
|
|
8721
|
+
height: "18"
|
|
8722
|
+
}, [ createVNode("path", {
|
|
8723
|
+
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",
|
|
8724
|
+
"p-id": "7835"
|
|
8725
|
+
}, null), createVNode("path", {
|
|
8726
|
+
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",
|
|
8727
|
+
"p-id": "7836"
|
|
8728
|
+
}, null) ]), createVNode("p", {
|
|
8729
|
+
class: "label-text"
|
|
8730
|
+
}, [ t("next.labelme.createRectangle") ]) ]), createVNode("li", {
|
|
8731
|
+
class: [ "tool-item", {
|
|
8732
|
+
"active-tool": toolsActive.value === ToolsHandleType.CREATE_CIRCLE
|
|
8733
|
+
} ],
|
|
8734
|
+
onClick: () => onClickToolsActive(ToolsHandleType.CREATE_CIRCLE)
|
|
8735
|
+
}, [ createVNode("svg", {
|
|
8736
|
+
t: "1757514108844",
|
|
8737
|
+
class: "icon",
|
|
8738
|
+
viewBox: "0 0 1024 1024",
|
|
8739
|
+
version: "1.1",
|
|
8740
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8741
|
+
"p-id": "8822",
|
|
8742
|
+
width: "18",
|
|
8743
|
+
height: "18"
|
|
8744
|
+
}, [ createVNode("path", {
|
|
8745
|
+
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",
|
|
8746
|
+
"p-id": "8823"
|
|
8747
|
+
}, null) ]), createVNode("p", {
|
|
8748
|
+
class: "label-text"
|
|
8749
|
+
}, [ t("next.labelme.createCircle") ]) ]) ]) ]);
|
|
8750
|
+
}
|
|
8751
|
+
}), RightLabel = defineComponent({
|
|
8752
|
+
props: {
|
|
8753
|
+
shapes: {
|
|
8754
|
+
type: Array,
|
|
8755
|
+
default: () => []
|
|
8756
|
+
}
|
|
8757
|
+
},
|
|
8758
|
+
emits: [ "delete", "update" ],
|
|
8759
|
+
setup(props, {emit: emit}) {
|
|
8760
|
+
const {t: t} = useLocale(), _ns = inject("ns", {}), classes = inject("classes", ref([])), _classes = unref(classes), formatlabelColor = lebel => {
|
|
8761
|
+
const index = _classes.findIndex(item => item === lebel);
|
|
8762
|
+
return -1 === index ? "#5470c6" : colors[index];
|
|
8763
|
+
}, shapes = toRef(props, "shapes"), formColumns = [ {
|
|
8764
|
+
prop: "group_id",
|
|
8765
|
+
label: t("next.labelme.labelGroupId"),
|
|
8766
|
+
type: "input"
|
|
8767
|
+
}, {
|
|
8768
|
+
prop: "description",
|
|
8769
|
+
label: t("next.labelme.labelDescription"),
|
|
8770
|
+
type: "textarea"
|
|
8771
|
+
} ], shapeEditDialog = reactive({
|
|
8772
|
+
visible: !1,
|
|
8773
|
+
title: "",
|
|
8774
|
+
shapeInfo: {}
|
|
8775
|
+
}), onCloseShapeEditDialog = () => {
|
|
8776
|
+
shapeEditDialog.visible = !1, shapeEditDialog.title = "", shapeEditDialog.shapeInfo = {};
|
|
8777
|
+
}, onSubmitShapeChange = (shape, done) => {
|
|
8778
|
+
emit("update", deepClone(shape)), done(), onCloseShapeEditDialog();
|
|
8779
|
+
}, renderContent = () => createVNode("div", {
|
|
8780
|
+
class: [ _ns.be("main", "right-label") ]
|
|
8781
|
+
}, [ shapes.value.length ? createVNode("ul", null, [ shapes.value.map((shape, index) => createVNode("li", {
|
|
8782
|
+
class: [ _ns.be("right-label", "label-item") ],
|
|
8783
|
+
key: index
|
|
8784
|
+
}, [ createVNode("div", {
|
|
8785
|
+
class: [ _ns.be("right-label", "label-content") ]
|
|
8786
|
+
}, [ createVNode("span", {
|
|
8787
|
+
class: "label-line",
|
|
8788
|
+
style: {
|
|
8789
|
+
backgroundColor: formatlabelColor(shape.label)
|
|
8790
|
+
}
|
|
8791
|
+
}, null), createVNode("span", null, [ shape.label, shape.group_id ? ` ( ${shape.group_id} )` : null ]) ]), createVNode("div", {
|
|
8792
|
+
class: [ _ns.be("right-label", "label-btns") ]
|
|
8793
|
+
}, [ createVNode(ElIcon, {
|
|
8794
|
+
size: 16,
|
|
8795
|
+
style: {
|
|
8796
|
+
marginRight: "6px"
|
|
8797
|
+
},
|
|
8798
|
+
onClick: event => {
|
|
8799
|
+
event.preventDefault(), event.stopPropagation(), (shape => {
|
|
8800
|
+
shapeEditDialog.visible = !0, shapeEditDialog.title = shape.label, shapeEditDialog.shapeInfo = shape;
|
|
8801
|
+
})(shape);
|
|
8802
|
+
}
|
|
8803
|
+
}, {
|
|
8804
|
+
default: () => [ createVNode(edit_default, null, null) ]
|
|
8805
|
+
}), createVNode(ElPopconfirm, {
|
|
8806
|
+
title: t("next.labelme.confirmDeleteLabel"),
|
|
8807
|
+
width: 200,
|
|
8808
|
+
onConfirm: () => (shape => {
|
|
8809
|
+
emit("delete", shape);
|
|
8810
|
+
})(shape)
|
|
8811
|
+
}, {
|
|
8812
|
+
reference: () => createVNode(ElIcon, {
|
|
8813
|
+
size: 16,
|
|
8814
|
+
color: "#ff0000",
|
|
8815
|
+
onClick: event => {
|
|
8816
|
+
event.preventDefault(), event.stopPropagation();
|
|
8817
|
+
}
|
|
8818
|
+
}, {
|
|
8819
|
+
default: () => [ createVNode(delete_default, null, null) ]
|
|
8820
|
+
})
|
|
8821
|
+
}) ]) ])) ]) : createVNode(ElEmpty, {
|
|
8822
|
+
"image-size": 100,
|
|
8823
|
+
description: t("next.labelme.emptyLabelText")
|
|
8824
|
+
}, null), createVNode(NextDialog, {
|
|
8825
|
+
modelValue: shapeEditDialog.visible,
|
|
8826
|
+
"onUpdate:modelValue": $event => shapeEditDialog.visible = $event,
|
|
8827
|
+
title: shapeEditDialog.title,
|
|
8828
|
+
width: 350,
|
|
8829
|
+
fullscreen: !1,
|
|
8830
|
+
fullscreenBtn: !1,
|
|
8831
|
+
closeOnClickModal: !0,
|
|
8832
|
+
onClose: onCloseShapeEditDialog
|
|
8833
|
+
}, {
|
|
8834
|
+
default: () => [ createVNode(NextForm, {
|
|
8835
|
+
options: {
|
|
8836
|
+
labelPosition: "top",
|
|
8837
|
+
colSpanFixed: 24
|
|
8838
|
+
},
|
|
8839
|
+
columns: formColumns,
|
|
8840
|
+
formDatum: shapeEditDialog.shapeInfo,
|
|
8841
|
+
onSubmit: onSubmitShapeChange
|
|
8842
|
+
}, null) ]
|
|
8843
|
+
}) ]);
|
|
8844
|
+
return () => createVNode(Fragment, null, [ renderContent() ]);
|
|
8845
|
+
}
|
|
8846
|
+
});
|
|
8312
8847
|
|
|
8313
8848
|
const ns = useNamespace("labelme");
|
|
8314
8849
|
|
|
@@ -8338,40 +8873,50 @@ var Element = defineComponent({
|
|
|
8338
8873
|
},
|
|
8339
8874
|
emits: [ "change", "save", "edit-polygon", "change-polygon", "prev-click", "next-click" ],
|
|
8340
8875
|
setup(props, {emit: emit, slots: slots}) {
|
|
8341
|
-
const _config = deepClone(defaultConfig), _options = computed((
|
|
8876
|
+
const _config = deepClone(defaultConfig), _options = computed(() => {
|
|
8342
8877
|
const cfg = unref(props.options);
|
|
8343
8878
|
return merge(_config, cfg);
|
|
8344
|
-
})
|
|
8879
|
+
}), options = unref(_options);
|
|
8345
8880
|
provide("ns", ns);
|
|
8346
|
-
const {t: t} = useLocale(), activateNodeIndex = ref(0), classes = ref(props.classes)
|
|
8347
|
-
|
|
8881
|
+
const {t: t} = useLocale(), activateNodeIndex = ref(0), classes = ref(props.classes);
|
|
8882
|
+
provide("classes", classes);
|
|
8883
|
+
const toolsActive = ref("");
|
|
8884
|
+
provide("toolsActive", toolsActive), provide("changeToolsActive", val => {
|
|
8885
|
+
toolsActive.value = val;
|
|
8886
|
+
});
|
|
8887
|
+
const labelImages = ref(deepClone(props.data));
|
|
8888
|
+
watch(() => props.data, data => {
|
|
8348
8889
|
labelImages.value = deepClone(data);
|
|
8349
|
-
}
|
|
8890
|
+
}, {
|
|
8350
8891
|
deep: !0
|
|
8351
|
-
}), watch((
|
|
8892
|
+
}), watch(() => props.data.length, () => {
|
|
8352
8893
|
activateNodeIndex.value = 0;
|
|
8353
|
-
})), watch((() => props.classes), (val => {
|
|
8354
|
-
classes.value = val;
|
|
8355
|
-
}), {
|
|
8356
|
-
deep: !0
|
|
8357
8894
|
});
|
|
8358
|
-
const currentNode = computed((
|
|
8895
|
+
const currentNode = computed(() => {
|
|
8359
8896
|
if (!labelImages.value) return {};
|
|
8360
8897
|
const node = labelImages.value[activateNodeIndex.value] || {};
|
|
8361
8898
|
return deepClone(node);
|
|
8362
|
-
})
|
|
8363
|
-
|
|
8899
|
+
}), onUpdateLabelInfo = val => {
|
|
8900
|
+
labelImages.value[activateNodeIndex.value] = val;
|
|
8901
|
+
}, onDeleteLabelShape = shape => {
|
|
8902
|
+
const node = currentNode.value, index = node.labels?.shapes?.findIndex(item => item.id === shape.id);
|
|
8903
|
+
-1 !== index && node.labels.shapes.splice(index, 1), labelImages.value[activateNodeIndex.value] = node;
|
|
8904
|
+
}, onUpdateLabelShape = shape => {
|
|
8905
|
+
const node = currentNode.value, index = node.labels?.shapes?.findIndex(item => item.id === shape.id);
|
|
8906
|
+
-1 !== index && (node.labels.shapes[index] = shape), labelImages.value[activateNodeIndex.value] = node;
|
|
8907
|
+
}, loading = ref(!1), mainContentHeight = ref(options.minContentHeight), canvasContextRef = ref(), layoutLabelRef = ref(), headerRef = ref(), mainRef = ref(), footerRef = ref(), updateMainContentHeight = () => {
|
|
8908
|
+
nextTick(() => {
|
|
8364
8909
|
const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
|
|
8365
8910
|
mainContentHeight.value = contentHeight;
|
|
8366
|
-
})
|
|
8911
|
+
});
|
|
8367
8912
|
};
|
|
8368
|
-
onMounted((
|
|
8369
|
-
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (
|
|
8913
|
+
onMounted(() => {
|
|
8914
|
+
document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, () => {
|
|
8370
8915
|
updateMainContentHeight();
|
|
8371
|
-
})
|
|
8372
|
-
})
|
|
8916
|
+
}), window.addEventListener("resize", updateMainContentHeight);
|
|
8917
|
+
}), onUnmounted(() => {
|
|
8373
8918
|
document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
|
|
8374
|
-
})
|
|
8919
|
+
});
|
|
8375
8920
|
const onKeydownPrevNext = () => {}, onPaginationPrev = () => {
|
|
8376
8921
|
const imageLength = labelImages.value.length;
|
|
8377
8922
|
let i = activateNodeIndex.value - 1;
|
|
@@ -8386,20 +8931,20 @@ var Element = defineComponent({
|
|
|
8386
8931
|
const node = currentNode.value;
|
|
8387
8932
|
return emit("save", {
|
|
8388
8933
|
node: node
|
|
8389
|
-
},
|
|
8934
|
+
}, imageItem => {
|
|
8390
8935
|
labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
|
|
8391
8936
|
loading.value = !1;
|
|
8392
|
-
}
|
|
8937
|
+
}, () => {
|
|
8393
8938
|
loading.value = !1;
|
|
8394
|
-
})
|
|
8939
|
+
}), !0;
|
|
8395
8940
|
}, isFullscreen = ref(!1), onSwitchFillscreen = val => {
|
|
8396
|
-
isFullscreen.value = val, updateMainContentHeight(), nextTick((
|
|
8941
|
+
isFullscreen.value = val, updateMainContentHeight(), nextTick(() => {
|
|
8397
8942
|
canvasContextRef.value.rerenderImage();
|
|
8398
|
-
})
|
|
8943
|
+
});
|
|
8399
8944
|
}, onChangePolygon = node => {
|
|
8400
8945
|
currentNode.value.labels = node, emit("change-polygon", node);
|
|
8401
|
-
},
|
|
8402
|
-
|
|
8946
|
+
}, onEditPolygon = node => {
|
|
8947
|
+
emit("edit-polygon", node);
|
|
8403
8948
|
}, onToolHeaderSave = () => {
|
|
8404
8949
|
onChangeActivateNode(activateNodeIndex.value) || ElMessage({
|
|
8405
8950
|
type: "info",
|
|
@@ -8443,17 +8988,22 @@ var Element = defineComponent({
|
|
|
8443
8988
|
}, null) ]), createVNode("div", {
|
|
8444
8989
|
ref: mainRef,
|
|
8445
8990
|
class: [ ns.b("main") ]
|
|
8446
|
-
}, [ createVNode("div", {
|
|
8991
|
+
}, [ createVNode(LeftTools, null, null), createVNode("div", {
|
|
8447
8992
|
class: [ ns.be("main", "content") ],
|
|
8448
8993
|
style: {
|
|
8449
8994
|
height: mainContentHeight.value + "px"
|
|
8450
8995
|
}
|
|
8451
8996
|
}, [ createVNode(CanvasContext, {
|
|
8452
8997
|
ref: canvasContextRef,
|
|
8453
|
-
|
|
8454
|
-
onEditPolygon:
|
|
8455
|
-
onChangePolygon: onChangePolygon
|
|
8456
|
-
|
|
8998
|
+
labelInfo: currentNode.value,
|
|
8999
|
+
onEditPolygon: onEditPolygon,
|
|
9000
|
+
onChangePolygon: onChangePolygon,
|
|
9001
|
+
onUpdateLabelInfo: onUpdateLabelInfo
|
|
9002
|
+
}, null) ]), createVNode(RightLabel, {
|
|
9003
|
+
shapes: currentNode.value.labels?.shapes,
|
|
9004
|
+
onUpdate: onUpdateLabelShape,
|
|
9005
|
+
onDelete: onDeleteLabelShape
|
|
9006
|
+
}, null) ]), createVNode("footer", {
|
|
8457
9007
|
ref: footerRef,
|
|
8458
9008
|
class: [ ns.b("footer") ]
|
|
8459
9009
|
}, [ createVNode("div", {
|
|
@@ -8469,7 +9019,7 @@ var Element = defineComponent({
|
|
|
8469
9019
|
}, [ createVNode(ElScrollbar, null, {
|
|
8470
9020
|
default: () => [ createVNode("ul", {
|
|
8471
9021
|
class: [ ns.bem("footer", "center", "list") ]
|
|
8472
|
-
}, [ labelImages.value.map((
|
|
9022
|
+
}, [ labelImages.value.map((item, index) => createVNode("li", {
|
|
8473
9023
|
key: index,
|
|
8474
9024
|
onClick: () => onChangeActivateNode(index),
|
|
8475
9025
|
class: {
|
|
@@ -8482,7 +9032,7 @@ var Element = defineComponent({
|
|
|
8482
9032
|
"max-scale": 2,
|
|
8483
9033
|
"min-scale": .2,
|
|
8484
9034
|
fit: "cover"
|
|
8485
|
-
}, null) ]))
|
|
9035
|
+
}, null) ])) ]) ]
|
|
8486
9036
|
}) ]), createVNode("div", {
|
|
8487
9037
|
class: [ ns.be("footer", "right") ]
|
|
8488
9038
|
}, [ createVNode(ElIcon, {
|
|
@@ -8531,7 +9081,7 @@ const zoomDialog = app => {
|
|
|
8531
9081
|
var value;
|
|
8532
9082
|
zoomDomBindData[1] = zoomDomBindData[1] ? zoomDomBindData[1] : ".el-dialog__body",
|
|
8533
9083
|
zoomDomBindData[2] = void 0 !== zoomDomBindData[2] && zoomDomBindData[2], zoomDomBindData[3] = void 0 === zoomDomBindData[3] || zoomDomBindData[3],
|
|
8534
|
-
nextTick((
|
|
9084
|
+
nextTick(() => {
|
|
8535
9085
|
const zoomDom = document.querySelector(zoomDomBindData[1]), zoomDomBox = document.querySelector(zoomDomBindData[0]), zoomHandleEl = document.createElement("div");
|
|
8536
9086
|
zoomHandleEl.className = "dialog-zoom", zoomHandleEl.onmouseenter = () => {
|
|
8537
9087
|
zoomHandleEl.onmousedown = e => {
|
|
@@ -8552,23 +9102,23 @@ const zoomDialog = app => {
|
|
|
8552
9102
|
};
|
|
8553
9103
|
};
|
|
8554
9104
|
}, zoomDomBox.appendChild(zoomHandleEl);
|
|
8555
|
-
})
|
|
9105
|
+
});
|
|
8556
9106
|
}
|
|
8557
9107
|
});
|
|
8558
|
-
}, configProviderContextKey = Symbol("configProviderContextKey"), version = "0.
|
|
8559
|
-
if (Object.keys(components).forEach(
|
|
9108
|
+
}, configProviderContextKey = Symbol("configProviderContextKey"), version = "0.6.0", install = function(app, options) {
|
|
9109
|
+
if (Object.keys(components).forEach(key => {
|
|
8560
9110
|
const component = components[key];
|
|
8561
9111
|
app.component(component.name, component);
|
|
8562
|
-
})
|
|
9112
|
+
}), (app => {
|
|
8563
9113
|
zoomDialog(app);
|
|
8564
9114
|
})(app), options) {
|
|
8565
9115
|
const inSetup = !!getCurrentInstance();
|
|
8566
|
-
(app?.provide ?? (inSetup ? provide : void 0))(configProviderContextKey, computed((
|
|
9116
|
+
(app?.provide ?? (inSetup ? provide : void 0))(configProviderContextKey, computed(() => options));
|
|
8567
9117
|
}
|
|
8568
9118
|
};
|
|
8569
9119
|
|
|
8570
9120
|
var index = {
|
|
8571
|
-
version: "0.
|
|
9121
|
+
version: "0.6.0",
|
|
8572
9122
|
install: install
|
|
8573
9123
|
};
|
|
8574
9124
|
|