next-element-vue 0.5.10 → 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.
Files changed (26) hide show
  1. package/dist/index.css +2 -2
  2. package/dist/index.js +1315 -760
  3. package/dist/index.min.js +3 -3
  4. package/dist/index.umd.js +1297 -763
  5. package/dist/index.umd.min.js +3 -3
  6. package/dist/packages/components/form/src/widgets/upload-image.d.ts +4 -4
  7. package/dist/packages/components/labelme/src/config.d.ts +17 -1
  8. package/dist/packages/components/labelme/src/core/CreatePolygon.d.ts +28 -0
  9. package/dist/packages/components/labelme/src/core/EditPolygon.d.ts +36 -0
  10. package/dist/packages/components/labelme/src/core/utils.d.ts +90 -0
  11. package/dist/packages/components/labelme/src/hooks/canvas-content-hook.d.ts +39 -30
  12. package/dist/packages/components/labelme/src/widgets/canvas-context.d.ts +5 -13
  13. package/dist/packages/components/labelme/src/widgets/contextmenu-label.d.ts +38 -0
  14. package/dist/packages/components/labelme/src/widgets/left-tools.d.ts +4 -0
  15. package/dist/packages/components/labelme/src/widgets/right-label.d.ts +19 -0
  16. package/dist/packages/components/layout/src/widgets/header-tools.d.ts +2 -0
  17. package/dist/packages/components/video-player/index.d.ts +9 -0
  18. package/dist/packages/components/video-player/src/hook.d.ts +1 -1
  19. package/dist/packages/components/video-player/src/index.d.ts +9 -0
  20. package/dist/packages/hooks/global-hook.d.ts +12 -0
  21. package/dist/packages/hooks/use-locale/index.d.ts +31 -1
  22. package/dist/packages/locale/lang/en.d.ts +10 -1
  23. package/dist/packages/locale/lang/zh-cn.d.ts +9 -0
  24. package/dist/packages/locale/lang/zh-tw.d.ts +12 -0
  25. package/package.json +10 -5
  26. /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.5.10 v
6
- * 发布日期:2025-04-30
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((() => unref(derivedNamespace) || "next"));
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((function(object, sources) {
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, (function(key) {
469
+ var result = memoize(func, function(key) {
472
470
  return 500 === cache.size && cache.clear(), key;
473
- })), cache = result.cache;
471
+ }), cache = result.cache;
474
472
  return result;
475
- }((function(string) {
473
+ }(function(string) {
476
474
  var result = [];
477
- return 46 === string.charCodeAt(0) && result.push(""), string.replace(rePropName, (function(match, number, quote, subString) {
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
- })), result;
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), (function(symbol) {
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, (function(othValue, othIndex) {
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((function(value, key) {
638
+ return map.forEach(function(value, key) {
641
639
  result[++index] = [ key, value ];
642
- })), result;
640
+ }), result;
643
641
  }
644
642
 
645
643
  function setToArray(set) {
646
644
  var index = -1, result = Array(set.size);
647
- return set.forEach((function(value) {
645
+ return set.forEach(function(value) {
648
646
  result[++index] = value;
649
- })), result;
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, (function(srcValue, key) {
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
- }), keysIn);
799
+ }, keysIn);
802
800
  }
803
801
 
804
- var mergeWith = createAssigner((function(object, source, srcIndex, customizer) {
802
+ var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
805
803
  baseMerge(object, source, srcIndex, customizer);
806
- }));
804
+ });
807
805
 
808
- var merge = createAssigner((function(object, source, srcIndex) {
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
- })), zhcnLocale = {
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
- deletePolyton: "delete polygon"
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, ((_, key) => `${option?.[key] ?? `{${key}}`}`)), buildTranslator = locale => (path, option) => translate(path, option, unref(locale)), buildLocaleContext = locale => {
1075
- const lang = computed((() => unref(locale).name)), localeRef = isRef(locale) ? locale : ref(locale), nextLang = localeLang[lang.value] || localeLang["zh-cn"];
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((() => locale?.value || zhcnLocale)));
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((value => parseFloat(value))), [r, g, b] = rgbaValues;
1092
- return `#${[ r, g, b ].map((value => Math.round(value).toString(16).padStart(2, "0"))).join("")}`.toUpperCase();
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((value => parseFloat(value))), [r, g, b, a] = rgbaValues, alpha = Math.round(255 * a).toString(16).padStart(2, "0");
1120
- return `#${[ r, g, b ].map((value => Math.round(value).toString(16).padStart(2, "0"))).join("")}${alpha}`.toUpperCase();
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((() => tf.image.resizeBilinear(tf.browser.fromPixels(video), [ modelWeight, modelHeight ]).div(255).expandDims(0)));
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((async res => {
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((o => o.value == cls));
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((o => o.value == cls));
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((model => {
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, ((name, score) => {
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
- })) : (error && error("模型类别不能未空"), !1) : (error && error("模型文件地址不能为空"), !1)
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
- })), ellipsisRef = ref(), onMouseenter = () => {
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((function() {
1884
+ void (state.checkForObjectDocumentTimeoutId = setTimeout(function() {
1840
1885
  state.checkForObjectDocumentTimeoutId = 0, getDocument(element, callback);
1841
- }), 100));
1886
+ }, 100));
1842
1887
  }
1843
1888
  callback(element.contentDocument);
1844
- }(this, (function(objectDocument) {
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, (function() {
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
- })), batchProcessor.add(1, (function() {
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
- })), sizeChanged && done && batchProcessor.add(2, (function() {
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, (function(listener) {
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, (function(obj) {
2187
+ return forEach(collection, function(obj) {
2143
2188
  array.push(obj);
2144
- })), array;
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, (function(listener) {
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", (function() {})), debug = getOption(options, "debug", globalOptions.debug);
2205
- forEach(elements, (function(element) {
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((function() {
2256
+ void onReadyCallbacks[id].push(function() {
2212
2257
  ++elementsReady === elements.length && onReadyCallback();
2213
- }))) : (debug && reporter.log(id, "Making detectable..."), elementUtils.markBusy(element, !0),
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, (function(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], (function(callback) {
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
- })), elementsReady === elements.length && onReadyCallback();
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, (function(element) {
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
- }), 200);
2269
- })), onUnmounted((() => {
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((item => createVNode("li", {
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) ]))) ]), createVNode("div", {
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((() => config.language)).value), settingDrawer = ref(!1);
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, _closeSettingDrawer = () => {
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((item => createVNode(ElDropdownItem, {
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
- })))) || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? _slot : {
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((item => createVNode(ElDropdownItem, {
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: _closeSettingDrawer
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
- })), __slots_header_tools = {};
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((() => props.menuData)).value;
2690
- return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ menuTree.map((item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : createVNode(ElSubMenu, {
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((() => router.currentRoute?.value), (to => {
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((item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : createVNode(ElSubMenu, {
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
- })), __slots_header_tools = {};
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
- })), __slots_header_tools = {};
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
- })), __slots_header_tools = {};
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((() => router.currentRoute?.value), (to => {
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((item => valueExist(item.meta?.isHide, !1) ? null : createVNode(ElMenuItem, {
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
- } else router.push(item.path);
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
- })), __slots_header_tools = {};
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", (val => {
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((() => props.options), (cfg => {
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((() => router.currentRoute.value.path)), _tabs = computed((() => props.tabs)), defaultIndex = _tabs.value?.findIndex((v => v.path === _activeTab.value));
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((v => v.path === active));
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((() => router.currentRoute?.value), (to => {
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((v => v.path === to.path));
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(((tab, index) => tab ? createVNode("li", {
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((v => v.path === active)) || 0;
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((() => props.columns), (() => {
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((item => createVNode(ElOption, {
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((col => !col.hide && createVNode(ElCol, {
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$5(s) {
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((slotName => {
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((col => {
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, (el => {
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$5(searchFrom_slots) ? searchFrom_slots : {
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$5(searchFrom_slots) ? searchFrom_slots : {
4009
+ }, _isSlot$6(searchFrom_slots) ? searchFrom_slots : {
3947
4010
  default: () => [ searchFrom_slots ]
3948
4011
  }) : null, createVNode(ElCol, {
3949
4012
  span: searchSpan.value,
@@ -4066,7 +4129,7 @@ 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((() => multipleSelection.value.length)), onClickRefresh = () => {
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 = () => {
4070
4133
  this.$emit("clickRefresh");
4071
4134
  }, drawerSettingRef = ref(), slotProps = {
4072
4135
  size: options.size,
@@ -4092,21 +4155,21 @@ var HeaderSearch = defineComponent({
4092
4155
  size: options.size,
4093
4156
  disabled: !multipleSelectionLength.value,
4094
4157
  onClick: () => {
4095
- const selection = unref(toRaw(multipleSelection.value.map((row => toRaw(row)))));
4158
+ const selection = unref(toRaw(multipleSelection.value.map(row => toRaw(row))));
4096
4159
  ElMessageBox.confirm(t("next.table.message.batchDeleteTip"), t("next.table.message.tip"), {
4097
4160
  type: "warning",
4098
4161
  showClose: !1,
4099
4162
  center: !1,
4100
4163
  confirmButtonText: t("next.table.message.confirmButtonText"),
4101
4164
  cancelButtonText: t("next.table.message.cancelButtonText")
4102
- }).then((() => {
4165
+ }).then(() => {
4103
4166
  this.$emit("deleteRows", selection);
4104
- })).catch((() => {
4167
+ }).catch(() => {
4105
4168
  ElMessage({
4106
4169
  type: "info",
4107
4170
  message: t("next.table.message.cancelBatchDelete")
4108
4171
  });
4109
- }));
4172
+ });
4110
4173
  }
4111
4174
  }, {
4112
4175
  icon: () => createVNode(ElIcon, null, {
@@ -4149,28 +4212,28 @@ const TableColumnDynamic = defineComponent({
4149
4212
  },
4150
4213
  setup(props, {slots: slots}) {
4151
4214
  const columnSlots = inject("columnSlots"), column_slots = {};
4152
- columnSlots.value.forEach((slotName => {
4215
+ columnSlots.value.forEach(slotName => {
4153
4216
  column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
4154
- }));
4217
+ });
4155
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) => {
4156
4219
  if (Array.isArray(value)) {
4157
4220
  const temp = [];
4158
- return value.forEach((val => {
4221
+ return value.forEach(val => {
4159
4222
  temp.push(_formatterColumnValue(val, dicData));
4160
- })), temp.join(_separator);
4223
+ }), temp.join(_separator);
4161
4224
  }
4162
- const item = dicData.find((o => o[_dicKey] == value));
4225
+ const item = dicData.find(o => o[_dicKey] == value);
4163
4226
  return item ? item[_dicLabel] : value;
4164
4227
  }, renderCustomItem = (row, $index) => {
4165
4228
  const prop = columnOption.prop, _prop = prop?.replace(/\./g, "-");
4166
- if (columnOption.children?.length > 0) return createVNode(Fragment, null, [ columnOption.children.map((column => {
4229
+ if (columnOption.children?.length > 0) return createVNode(Fragment, null, [ columnOption.children.map(column => {
4167
4230
  return createVNode(TableColumnDynamic, {
4168
4231
  columnOption: column
4169
4232
  }, "function" == typeof (s = column_slots) || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? column_slots : {
4170
4233
  default: () => [ column_slots ]
4171
4234
  });
4172
4235
  var s;
4173
- })) ]);
4236
+ }) ]);
4174
4237
  if (slots[columnSlotName(_prop)]) {
4175
4238
  const btnCfg = {
4176
4239
  text: options.operationsBtnText,
@@ -4187,7 +4250,7 @@ const TableColumnDynamic = defineComponent({
4187
4250
  if (columnOption.dicData?.length > 0) {
4188
4251
  const loopDicData = list => {
4189
4252
  const temp = [];
4190
- return list.forEach((node => {
4253
+ return list.forEach(node => {
4191
4254
  const item = {
4192
4255
  ...node
4193
4256
  };
@@ -4196,7 +4259,7 @@ const TableColumnDynamic = defineComponent({
4196
4259
  temp.push(...child), delete item.children;
4197
4260
  }
4198
4261
  temp.push(item);
4199
- })), temp;
4262
+ }), temp;
4200
4263
  }, mergeDicData = loopDicData(columnOption.dicData);
4201
4264
  return createVNode("span", null, [ _formatterColumnValue(row[prop], mergeDicData) ]);
4202
4265
  }
@@ -4229,10 +4292,10 @@ var TableColumnOperations = defineComponent({
4229
4292
  name: "TableColumnOperations",
4230
4293
  emits: [ "editRow", "viewRow", "deleteRow" ],
4231
4294
  setup(props, {emit: emit, slots: slots}) {
4232
- 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(() => {
4233
4296
  const {operationsBtnPlain: operationsBtnPlain, operationsBtnText: operationsBtnText} = options;
4234
4297
  return operationsBtnText || operationsBtnPlain;
4235
- })), renderContent = () => {
4298
+ }), renderContent = () => {
4236
4299
  const btnText = options.operationsBtnText, btnPlain = options.operationsBtnPlain, btnSize = options.operationsBtnSize, btnCfg = {
4237
4300
  text: btnText,
4238
4301
  plain: btnPlain,
@@ -4312,14 +4375,14 @@ var TableColumnOperations = defineComponent({
4312
4375
  center: !1,
4313
4376
  confirmButtonText: t("next.table.message.confirmButtonText"),
4314
4377
  cancelButtonText: t("next.table.message.cancelButtonText")
4315
- }).then((() => {
4378
+ }).then(() => {
4316
4379
  emit("deleteRow", scoped);
4317
- })).catch((() => {
4380
+ }).catch(() => {
4318
4381
  ElMessage({
4319
4382
  type: "info",
4320
4383
  message: t("next.table.message.cancelDelete")
4321
4384
  });
4322
- }));
4385
+ });
4323
4386
  })(scoped)
4324
4387
  }, {
4325
4388
  icon: () => createVNode(ElIcon, null, {
@@ -4438,9 +4501,9 @@ var NextDialog$1 = defineComponent({
4438
4501
  emits: [ "close" ],
4439
4502
  setup(props, {emit: emit, slots: slots}) {
4440
4503
  const visible = ref(props.modelValue);
4441
- watch((() => props.modelValue), (value => {
4504
+ watch(() => props.modelValue, value => {
4442
4505
  visible.value = value;
4443
- }));
4506
+ });
4444
4507
  const onClose = () => {
4445
4508
  visible.value = !1, emit("close");
4446
4509
  }, isFullscreen = ref(props.fullscreen);
@@ -4550,13 +4613,13 @@ var NumberRangePicker = defineComponent({
4550
4613
  }, onChangeEnd = num => {
4551
4614
  endNumber.value = num, emit("change", [ startNumber.value, endNumber.value ]);
4552
4615
  }, controls = ref(!0), numberRangeRef = ref();
4553
- onMounted((() => {
4616
+ onMounted(() => {
4554
4617
  const element = numberRangeRef.value;
4555
- elementResize(element, (el => {
4618
+ elementResize(element, el => {
4556
4619
  const width = el.clientWidth;
4557
4620
  controls.value = width > 200;
4558
- }));
4559
- }));
4621
+ });
4622
+ });
4560
4623
  return () => createVNode(Fragment, null, [ createVNode("div", {
4561
4624
  ref: numberRangeRef,
4562
4625
  class: ns$b.e("number-range")
@@ -4584,7 +4647,7 @@ var NumberRangePicker = defineComponent({
4584
4647
 
4585
4648
  const NextDialog = withInstall(NextDialog$1);
4586
4649
 
4587
- function _isSlot$3(s) {
4650
+ function _isSlot$4(s) {
4588
4651
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
4589
4652
  }
4590
4653
 
@@ -4640,16 +4703,16 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
4640
4703
  },
4641
4704
  data: []
4642
4705
  }), onConfirmSearch = searchParams => {
4643
- tableReactive.loading = !0, _options.loadData?.(searchParams, tableReactive.page, (res => {
4706
+ tableReactive.loading = !0, _options.loadData?.(searchParams, tableReactive.page, res => {
4644
4707
  tableReactive.data = res.data || [], tableReactive.page.total = res.total || 0,
4645
4708
  tableReactive.loading = !1;
4646
- }));
4709
+ });
4647
4710
  }, multipleSelection = ref([]), sinleSelection = ref("");
4648
- _column.tableSelectDefaultValue?.(props.formParams, _column, (rows => {
4711
+ _column.tableSelectDefaultValue?.(props.formParams, _column, rows => {
4649
4712
  rows?.length && (_column.tableSelectRows = rows, multipleSelection.value = rows,
4650
4713
  sinleSelection.value = rows[0][propsValue]);
4651
- }));
4652
- const _disabledSelect = computed((() => "radio" === _options.selectType ? !sinleSelection.value : 0 === multipleSelection.value.length)), onResetTableSelect = () => {
4714
+ });
4715
+ const _disabledSelect = computed(() => "radio" === _options.selectType ? !sinleSelection.value : 0 === multipleSelection.value.length), onResetTableSelect = () => {
4653
4716
  multipleSelection.value = [], sinleSelection.value = "";
4654
4717
  }, onConfirmSelect = () => {
4655
4718
  const rows = toRaw(multipleSelection.value), _rows = arrayObjNoRepeat(rows, propsValue);
@@ -4662,7 +4725,7 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
4662
4725
  value: value,
4663
4726
  onChange: event => ((event, row) => {
4664
4727
  if (event) multipleSelection.value.push(row); else {
4665
- const index = multipleSelection.value.findIndex((o => o[propsValue] === row[propsValue]));
4728
+ const index = multipleSelection.value.findIndex(o => o[propsValue] === row[propsValue]);
4666
4729
  -1 !== index && multipleSelection.value.splice(index, 1);
4667
4730
  }
4668
4731
  })(event, toRaw(row))
@@ -4673,30 +4736,30 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
4673
4736
  }
4674
4737
  }, null);
4675
4738
  }, tags = ref([]), tagsMore = ref([]), _updateTags = () => {
4676
- const rows = arrayObjNoRepeat(multipleSelection.value, propsValue).map((row => ({
4739
+ const rows = arrayObjNoRepeat(multipleSelection.value, propsValue).map(row => ({
4677
4740
  value: row[propsValue],
4678
4741
  label: row[propsLabel]
4679
- })));
4742
+ }));
4680
4743
  rows.length > 1 ? (tags.value = rows.splice(0, 1), tagsMore.value = rows) : (tags.value = rows,
4681
4744
  tagsMore.value = []);
4682
4745
  };
4683
- watch((() => _column.tableSelectRows), (() => {
4746
+ watch(() => _column.tableSelectRows, () => {
4684
4747
  _updateTags();
4685
- }), {
4748
+ }, {
4686
4749
  deep: !0,
4687
4750
  immediate: !0
4688
4751
  });
4689
4752
  const _multipleSelection = ref([]);
4690
- watch((() => [ props.formParams[_column.prop], multipleSelection.value ]), (() => {
4691
- _multipleSelection.value = multipleSelection.value.map((o => o[propsValue])), _updateTags();
4692
- }), {
4753
+ watch(() => [ props.formParams[_column.prop], multipleSelection.value ], () => {
4754
+ _multipleSelection.value = multipleSelection.value.map(o => o[propsValue]), _updateTags();
4755
+ }, {
4693
4756
  deep: !0,
4694
4757
  immediate: !0
4695
4758
  });
4696
4759
  const _sinleSelection = ref(null);
4697
- watch((() => [ props.formParams[_column.prop], sinleSelection.value ]), (() => {
4760
+ watch(() => [ props.formParams[_column.prop], sinleSelection.value ], () => {
4698
4761
  _sinleSelection.value = sinleSelection.value, _updateTags();
4699
- }), {
4762
+ }, {
4700
4763
  deep: !0,
4701
4764
  immediate: !0
4702
4765
  });
@@ -4712,12 +4775,12 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
4712
4775
  class: "el-input__wrapper"
4713
4776
  }, [ tags?.value.length ? createVNode("span", {
4714
4777
  class: ns$a.em("input-table", "value")
4715
- }, [ tags.value.map(((tag, index) => createVNode(ElTag, {
4716
- closable: !_closable,
4778
+ }, [ tags.value.map((tag, index) => createVNode(ElTag, {
4779
+ closable: _closable,
4717
4780
  onClose: () => _onCloseTag(0, index)
4718
4781
  }, {
4719
4782
  default: () => [ tag.label ]
4720
- }))), tagsMore?.value?.length ? createVNode(ElTooltip, {
4783
+ })), tagsMore?.value?.length ? createVNode(ElTooltip, {
4721
4784
  "popper-class": ns$a.e("tooltip-tags"),
4722
4785
  placement: "bottom",
4723
4786
  effect: "light"
@@ -4725,12 +4788,12 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
4725
4788
  default: () => createVNode(ElTag, null, {
4726
4789
  default: () => [ createTextVNode("+ "), tagsMore.value.length ]
4727
4790
  }),
4728
- content: () => tagsMore.value.map(((tag, index) => createVNode(ElTag, {
4729
- closable: !_closable,
4791
+ content: () => tagsMore.value.map((tag, index) => createVNode(ElTag, {
4792
+ closable: _closable,
4730
4793
  onClose: () => _onCloseTag(0, index + 1)
4731
4794
  }, {
4732
4795
  default: () => [ tag.label ]
4733
- })))
4796
+ }))
4734
4797
  }) : null ]) : createVNode("span", {
4735
4798
  class: ns$a.em("input-table", "placeholder")
4736
4799
  }, [ _placeholder ]) ]), createVNode(ElButton, {
@@ -4799,13 +4862,13 @@ const ns$a = useNamespace("form"), InputTableSelect = defineComponent({
4799
4862
  class: ns$a.em("input-table", "footer")
4800
4863
  }, [ createVNode(ElButton, {
4801
4864
  onClick: onResetTableSelect
4802
- }, _isSlot$3(_slot = t("next.form.reset")) ? _slot : {
4865
+ }, _isSlot$4(_slot = t("next.form.reset")) ? _slot : {
4803
4866
  default: () => [ _slot ]
4804
4867
  }), createVNode(ElButton, {
4805
4868
  type: "primary",
4806
4869
  disabled: _disabledSelect.value,
4807
4870
  onClick: onConfirmSelect
4808
- }, _isSlot$3(_slot2 = t("next.form.confirm")) ? _slot2 : {
4871
+ }, _isSlot$4(_slot2 = t("next.form.confirm")) ? _slot2 : {
4809
4872
  default: () => [ _slot2 ]
4810
4873
  }) ]) ]
4811
4874
  }) ]);
@@ -4868,7 +4931,7 @@ var UploadImage = defineComponent({
4868
4931
  const value = this.defaultPreviewSrcList;
4869
4932
  let urls = [];
4870
4933
  return "string" == typeof value ? urls = [ value ] : "[object Array]" === Object.prototype.toString.call(value) && (urls = value),
4871
- urls = urls.filter((url => !!url)), urls.length ? createVNode(ElImage, {
4934
+ urls = urls.filter(url => !!url), urls.length ? createVNode(ElImage, {
4872
4935
  class: ns$9.e("preview-image"),
4873
4936
  src: urls[0],
4874
4937
  previewSrcList: urls,
@@ -4891,7 +4954,7 @@ var UploadImage = defineComponent({
4891
4954
  limit: props.limit,
4892
4955
  "auto-upload": !1,
4893
4956
  "on-preview": uploadFile => {
4894
- const body = document.getElementsByTagName("body")[0], initial = uploadfilesPreview.value.findIndex((file => file.url === uploadFile.url)) || 0;
4957
+ const body = document.getElementsByTagName("body")[0], initial = uploadfilesPreview.value.findIndex(file => file.url === uploadFile.url) || 0;
4895
4958
  previewImagesContainer && (render(null, previewImagesContainer), body.removeChild(previewImagesContainer)),
4896
4959
  previewImagesContainer = document.createElement("div"), body.appendChild(previewImagesContainer);
4897
4960
  const previewComponent = createVNode({
@@ -4899,7 +4962,7 @@ var UploadImage = defineComponent({
4899
4962
  to: "body"
4900
4963
  }, [ h(ElImageViewer, {
4901
4964
  initialIndex: initial,
4902
- "url-list": uploadfilesPreview.value.map((file => file.url)),
4965
+ "url-list": uploadfilesPreview.value.map(file => file.url),
4903
4966
  onClose: () => {
4904
4967
  render(null, previewImagesContainer);
4905
4968
  }
@@ -4953,9 +5016,9 @@ var UploadImage = defineComponent({
4953
5016
  emits: [ "change", "node-click", "node-contextmenu", "check", "check-change", "node-expand", "node-collapse", "current-change" ],
4954
5017
  setup(props, {emit: emit, expose: expose}) {
4955
5018
  const {t: t} = useLocale(), _modelValue = ref(props.modelValue);
4956
- watch((() => props.modelValue), (val => {
5019
+ watch(() => props.modelValue, val => {
4957
5020
  _modelValue.value = val;
4958
- }));
5021
+ });
4959
5022
  const _column = props.column, valueKey = valueExist(_column.treeSelectProps?.value, _column.nodeKey, "id"), _formParams = props.formParams, _defaultProps = {
4960
5023
  label: "label",
4961
5024
  children: "children"
@@ -5039,14 +5102,14 @@ var UploadImage = defineComponent({
5039
5102
  emits: [ "change", "clear", "expand-change", "visible-change", "remove-tag", "blur", "focus" ],
5040
5103
  setup(props, {emit: emit, expose: expose}) {
5041
5104
  const {t: t} = useLocale(), _modelValue = ref(props.modelValue);
5042
- watch((() => props.modelValue), (val => {
5105
+ watch(() => props.modelValue, val => {
5043
5106
  _modelValue.value = val;
5044
- }));
5107
+ });
5045
5108
  const _column = props.column, placeholder = _column.placeholder || t("next.form.select") + _column.label, _defaultProps = {
5046
5109
  label: "label",
5047
5110
  children: "children"
5048
5111
  }, onChange = val => {
5049
- const nodes = treeSelectRef.value.getCheckedNodes().map((item => item.data));
5112
+ const nodes = treeSelectRef.value.getCheckedNodes().map(item => item.data);
5050
5113
  props.formParams[_column.prop] = val, _modelValue.value = val, emit("change", val, nodes);
5051
5114
  }, treeSelectRef = ref(), getInstance = () => treeSelectRef.value;
5052
5115
  _column.loadInstance && _column.loadInstance(getInstance()), expose({
@@ -5072,7 +5135,7 @@ var UploadImage = defineComponent({
5072
5135
  }
5073
5136
  });
5074
5137
 
5075
- function _isSlot$2(s) {
5138
+ function _isSlot$3(s) {
5076
5139
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
5077
5140
  }
5078
5141
 
@@ -5096,8 +5159,8 @@ var Element$8 = defineComponent({
5096
5159
  },
5097
5160
  emits: [ "submit", "close", "reset" ],
5098
5161
  setup(props, {slots: slots, emit: emit, expose: expose}) {
5099
- 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({});
5100
- watch((() => [ props.columns, props.formDatum ]), (() => {
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 ], () => {
5101
5164
  (() => {
5102
5165
  const columns = props.columns;
5103
5166
  _formColumns.value = columns;
@@ -5110,41 +5173,41 @@ var Element$8 = defineComponent({
5110
5173
  message: label + t("next.form.requiredInput"),
5111
5174
  trigger: [ "blur", "change" ]
5112
5175
  }), col.rules?.length && rules.push(...col.rules), formRules[col.prop] = rules,
5113
- !col.dicData?.length && col.loadDicData && col.loadDicData(col, (data => {
5176
+ !col.dicData?.length && col.loadDicData && col.loadDicData(col, data => {
5114
5177
  data?.length && (col.dicData = data);
5115
- }), formParams), "boolean" == typeof col.disabled && col.disabled || (col.disabled = !_isEditing.value);
5178
+ }, formParams), "boolean" == typeof col.disabled && col.disabled || (col.disabled = !_isEditing.value);
5116
5179
  }
5117
5180
  })();
5118
- }), {
5181
+ }, {
5119
5182
  deep: !0,
5120
5183
  immediate: !0
5121
5184
  });
5122
5185
  const formColumns = arrayObjNoRepeat(_formColumns.value, "prop"), spanResizeLoading = ref(!1);
5123
- onMounted((() => {
5186
+ onMounted(() => {
5124
5187
  const formEl = ruleFormRef.value?.$el;
5125
5188
  let timer = null;
5126
- elementResize(formEl, (el => {
5127
- null !== timer ? clearTimeout(timer) : spanResizeLoading.value = !0, timer = setTimeout((() => {
5189
+ elementResize(formEl, el => {
5190
+ null !== timer ? clearTimeout(timer) : spanResizeLoading.value = !0, timer = setTimeout(() => {
5128
5191
  colSpan.value = ((el, minWidth = 350) => {
5129
5192
  const el_width = el.clientWidth;
5130
5193
  let span = Math.floor(el_width / minWidth);
5131
5194
  return span > 4 && (span = 4), Math.ceil(24 / span);
5132
5195
  })(el, options.columnMinWidth), spanResizeLoading.value = !1, clearTimeout(timer);
5133
- }), 200);
5134
- }));
5135
- }));
5196
+ }, 200);
5197
+ });
5198
+ });
5136
5199
  const ruleFormRef = ref(), submitLoading = ref(!1), onSubmitAddEdit = async () => {
5137
5200
  const formInstance = ruleFormRef.value;
5138
- formInstance && await formInstance.validate(((valid, fields) => {
5201
+ formInstance && await formInstance.validate((valid, fields) => {
5139
5202
  if (valid) {
5140
5203
  const params = toRaw(formParams);
5141
- submitLoading.value = !0, emit("submit", params, (() => {
5204
+ submitLoading.value = !0, emit("submit", params, () => {
5142
5205
  submitLoading.value = !1, emit("close");
5143
- }), (() => {
5206
+ }, () => {
5144
5207
  submitLoading.value = !1;
5145
- }));
5208
+ });
5146
5209
  } else console.error("error submit!", fields);
5147
- }));
5210
+ });
5148
5211
  }, onResetForm = () => {
5149
5212
  const formInstance = ruleFormRef.value;
5150
5213
  formInstance && (formInstance.resetFields(), submitLoading.value = !1, emit("reset", formParams));
@@ -5294,12 +5357,12 @@ var Element$8 = defineComponent({
5294
5357
  "collapse-tags-tooltip": !0,
5295
5358
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
5296
5359
  }, {
5297
- default: () => [ col.dicData && col.dicData.map((item => createVNode(ElOption, {
5360
+ default: () => [ col.dicData && col.dicData.map(item => createVNode(ElOption, {
5298
5361
  key: item.value,
5299
5362
  value: item.value,
5300
5363
  label: item.label,
5301
5364
  disabled: valueExist(item.disabled, !1)
5302
- }, null))) ]
5365
+ }, null)) ]
5303
5366
  });
5304
5367
  }
5305
5368
  if ("time" === col.type) {
@@ -5328,13 +5391,13 @@ var Element$8 = defineComponent({
5328
5391
  readonly: valueExist(col.readonly, !1),
5329
5392
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
5330
5393
  }, {
5331
- default: () => [ col.dicData && col.dicData.map((item => createVNode(ElRadio, {
5394
+ default: () => [ col.dicData && col.dicData.map(item => createVNode(ElRadio, {
5332
5395
  key: item.value,
5333
5396
  value: item.value,
5334
5397
  disabled: valueExist(item.disabled, !1)
5335
5398
  }, {
5336
5399
  default: () => [ item.label ]
5337
- }))) ]
5400
+ })) ]
5338
5401
  });
5339
5402
  if ("checkbox" === col.type) return isValueExist(formParams[col.prop]) || (formParams[col.prop] = []),
5340
5403
  createVNode(ElCheckboxGroup, {
@@ -5344,13 +5407,13 @@ var Element$8 = defineComponent({
5344
5407
  readonly: valueExist(col.readonly, !1),
5345
5408
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
5346
5409
  }, {
5347
- default: () => [ col.dicData && col.dicData.map((item => createVNode(ElCheckbox, {
5410
+ default: () => [ col.dicData && col.dicData.map(item => createVNode(ElCheckbox, {
5348
5411
  key: item.value,
5349
5412
  label: item.value,
5350
5413
  disabled: valueExist(item.disabled, !1)
5351
5414
  }, {
5352
5415
  default: () => [ item.label ]
5353
- }))) ]
5416
+ })) ]
5354
5417
  });
5355
5418
  if ("date" === col.type) {
5356
5419
  const placeholder = col.placeholder || t("next.form.select") + col.label;
@@ -5449,10 +5512,10 @@ var Element$8 = defineComponent({
5449
5512
  onSelect: rows => ((rows, col) => {
5450
5513
  rows && (col.tableSelectRows = rows);
5451
5514
  const {value: value} = col.tableSelectProps || {};
5452
- formParams[col.prop] = rows.map((row => row[value || "value"])), col.onTableSelect?.(formParams, rows, col),
5515
+ formParams[col.prop] = rows.map(row => row[value || "value"]), col.onTableSelect?.(formParams, rows, col),
5453
5516
  ruleFormRef.value?.validateField(col.prop);
5454
5517
  })(rows, col)
5455
- }, _isSlot$2(_slots) ? _slots : {
5518
+ }, _isSlot$3(_slots) ? _slots : {
5456
5519
  default: () => [ _slots ]
5457
5520
  });
5458
5521
  }
@@ -5491,19 +5554,20 @@ var Element$8 = defineComponent({
5491
5554
  let _slot2;
5492
5555
  return createVNode(NextSpinLoading, {
5493
5556
  loading: spanResizeLoading.value
5494
- }, _isSlot$2(_slot2 = (() => {
5557
+ }, _isSlot$3(_slot2 = (() => {
5495
5558
  let _slot;
5496
5559
  return createVNode(ElForm, {
5497
5560
  ref: ruleFormRef,
5498
5561
  class: ns$8.b(),
5499
5562
  inline: !1,
5500
5563
  model: formParams,
5501
- size: options.size
5564
+ size: options.size,
5565
+ "label-position": valueExist(options.labelPosition, "left")
5502
5566
  }, {
5503
5567
  default: () => [ createVNode(ElRow, {
5504
5568
  gutter: 20
5505
- }, _isSlot$2(_slot = formColumns.map((column => !column.hide && createVNode(ElCol, {
5506
- 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)
5507
5571
  }, {
5508
5572
  default: () => [ createVNode(ElFormItem, {
5509
5573
  prop: column.prop,
@@ -5530,7 +5594,7 @@ var Element$8 = defineComponent({
5530
5594
  }) : null ]) : null,
5531
5595
  default: () => renderFormItem(column)
5532
5596
  }) ]
5533
- })))) ? _slot : {
5597
+ }))) ? _slot : {
5534
5598
  default: () => [ _slot ]
5535
5599
  }), _isEditing.value && options.showFooter ? createVNode("div", {
5536
5600
  class: ns$8.e("footer")
@@ -5574,13 +5638,13 @@ var AddEditForm = defineComponent({
5574
5638
  emits: [ "close", "submit" ],
5575
5639
  setup(props, {slots: slots, emit: emit, expose: expose}) {
5576
5640
  const addEditFormSlots = inject("addEditFormSlots"), form_slots = {};
5577
- addEditFormSlots.value.forEach((slotName => {
5641
+ addEditFormSlots.value.forEach(slotName => {
5578
5642
  form_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
5579
- }));
5643
+ });
5580
5644
  const _options = inject("options", {}), options = deepClone(isRef(_options) ? unref(_options) : _options);
5581
5645
  options.columnMinWidth = options.formColumnMinWidth, options.isEditing = props.isEditing;
5582
- 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),
5583
- col))), onSubmit = (...arg) => {
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) => {
5584
5648
  emit("submit", ...arg);
5585
5649
  };
5586
5650
  expose({
@@ -5606,7 +5670,7 @@ var AddEditForm = defineComponent({
5606
5670
  }
5607
5671
  });
5608
5672
 
5609
- function _isSlot(s) {
5673
+ function _isSlot$1(s) {
5610
5674
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
5611
5675
  }
5612
5676
 
@@ -5617,25 +5681,25 @@ var Element$7 = defineComponent({
5617
5681
  props: defaultPropsConfig,
5618
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" ],
5619
5683
  setup(props, {emit: emit, slots: slots, expose: expose}) {
5620
- const _config = deepClone(defaultConfig$4), _options = computed((() => {
5684
+ const _config = deepClone(defaultConfig$4), _options = computed(() => {
5621
5685
  const cfg = unref(props.options);
5622
5686
  return merge(_config, cfg);
5623
- })), options = unref(_options);
5624
- provide("options", computed((() => _options.value))), provide("ns", ns$7);
5687
+ }), options = unref(_options);
5688
+ provide("options", computed(() => _options.value)), provide("ns", ns$7);
5625
5689
  const {t: t} = useLocale(), _columns = ref(options.columns), _searchColumns = ref([]), _formColumns = ref([]), _updateColumnsAll = ops => {
5626
5690
  ((options, cb) => {
5627
5691
  const _columns = reactive(options.columns), _loadDicData = col => {
5628
- !col.dicData?.length && col.loadDicData && col.loadDicData(col, (data => {
5692
+ !col.dicData?.length && col.loadDicData && col.loadDicData(col, data => {
5629
5693
  data?.length && (col.dicData = data);
5630
- }));
5694
+ });
5631
5695
  }, loopTableColumns = list => {
5632
5696
  let cols = [];
5633
- return list.forEach((col => {
5697
+ return list.forEach(col => {
5634
5698
  _loadDicData(col), cols.push(col), col.children?.length && (cols.push(...loopTableColumns(col.children)),
5635
5699
  col.children && delete col.children);
5636
- })), cols;
5637
- }, evenTableColumns = loopTableColumns(_columns), formColumns = options.formColumns.map((col => (_loadDicData(col),
5638
- col))), _formColumns = evenTableColumns.concat(formColumns).map((col => {
5700
+ }), cols;
5701
+ }, evenTableColumns = loopTableColumns(_columns), formColumns = options.formColumns.map(col => (_loadDicData(col),
5702
+ col)), _formColumns = evenTableColumns.concat(formColumns).map(col => {
5639
5703
  const item = {
5640
5704
  prop: col.prop,
5641
5705
  label: valueExist(col.formLabel, col.label, ""),
@@ -5685,7 +5749,7 @@ var Element$7 = defineComponent({
5685
5749
  };
5686
5750
  return !col.dicData?.length && col.loadDicData && shareObjectProperty(item, col, "dicData"),
5687
5751
  item;
5688
- })).filter((o => o.sort && o.prop)).sort(((a, b) => a.sort - b.sort)), _formatSearchColumn = (col, index) => {
5752
+ }).filter(o => o.sort && o.prop).sort((a, b) => a.sort - b.sort), _formatSearchColumn = (col, index) => {
5689
5753
  const item = {
5690
5754
  prop: col.prop,
5691
5755
  type: valueExist(col.searchType, col.type),
@@ -5722,21 +5786,21 @@ var Element$7 = defineComponent({
5722
5786
  };
5723
5787
  return !col.dicData?.length && col.loadDicData && shareObjectProperty(item, col, "dicData"),
5724
5788
  item;
5725
- }, initSearchColumns = options.searchColumns.map(((col, index) => (_loadDicData(col),
5726
- _formatSearchColumn(col, index)))), initSearchColumnsLength = initSearchColumns.length, mergeSearchColumns = initSearchColumns.concat((list => {
5789
+ }, initSearchColumns = options.searchColumns.map((col, index) => (_loadDicData(col),
5790
+ _formatSearchColumn(col, index))), initSearchColumnsLength = initSearchColumns.length, mergeSearchColumns = initSearchColumns.concat((list => {
5727
5791
  let cols = [];
5728
- return list.forEach(((col, index) => {
5792
+ return list.forEach((col, index) => {
5729
5793
  col.searchType && cols.push(_formatSearchColumn(col, index + initSearchColumnsLength));
5730
- })), cols;
5731
- })(evenTableColumns)), _searchColumns = arrayObjNoRepeat(mergeSearchColumns.sort(((a, b) => a.sort - b.sort)), "prop");
5794
+ }), cols;
5795
+ })(evenTableColumns)), _searchColumns = arrayObjNoRepeat(mergeSearchColumns.sort((a, b) => a.sort - b.sort), "prop");
5732
5796
  cb && cb({
5733
5797
  formColumns: _formColumns,
5734
5798
  searchColumns: _searchColumns,
5735
5799
  columns: _columns
5736
5800
  });
5737
- })(ops, (({formColumns: formColumns, searchColumns: searchColumns, columns: columns}) => {
5801
+ })(ops, ({formColumns: formColumns, searchColumns: searchColumns, columns: columns}) => {
5738
5802
  _searchColumns.value = searchColumns, _formColumns.value = formColumns, _columns.value = columns;
5739
- }));
5803
+ });
5740
5804
  }, tableData = ref(props.data), _searchFormParams = ref((() => {
5741
5805
  const list = _searchColumns.value;
5742
5806
  let params = {};
@@ -5754,33 +5818,33 @@ var Element$7 = defineComponent({
5754
5818
  }, onClickRefresh = () => {
5755
5819
  onConfirmSearch(_searchFormParams.value);
5756
5820
  };
5757
- watch((() => props.data), (list => {
5821
+ watch(() => props.data, list => {
5758
5822
  tableData.value = list;
5759
- }), {
5823
+ }, {
5760
5824
  immediate: !0
5761
- }), watch((() => _options), (ops => {
5825
+ }), watch(() => _options, ops => {
5762
5826
  _updateColumnsAll(ops.value);
5763
- }), {
5827
+ }, {
5764
5828
  deep: !0,
5765
5829
  immediate: !0
5766
5830
  });
5767
5831
  const tableContentHeight = ref(options.defaultContentHeight), crudTableRef = ref(), headerRef = ref(), tableRef = ref(), footerRef = ref(), addEditFormRef = ref(null), updateTableContentHeight = () => {
5768
- nextTick((() => {
5832
+ nextTick(() => {
5769
5833
  const contentHeight = (crudTableRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
5770
5834
  tableContentHeight.value = contentHeight;
5771
- }));
5835
+ });
5772
5836
  }, fullscreenChangeListener = event => {
5773
5837
  "F11" !== event.key && "fullscreenchange" !== event.type || updateTableContentHeight();
5774
5838
  };
5775
- onMounted((() => {
5776
- elementResize(crudTableRef.value, (() => {
5839
+ onMounted(() => {
5840
+ elementResize(crudTableRef.value, () => {
5777
5841
  updateTableContentHeight();
5778
- })), options.initLoadData && onConfirmSearch(_searchFormParams.value), options.fullscreenchangeContentHeight && (document.addEventListener("fullscreenchange", fullscreenChangeListener),
5842
+ }), options.initLoadData && onConfirmSearch(_searchFormParams.value), options.fullscreenchangeContentHeight && (document.addEventListener("fullscreenchange", fullscreenChangeListener),
5779
5843
  document.addEventListener("keydown", fullscreenChangeListener));
5780
- })), onUnmounted((() => {
5844
+ }), onUnmounted(() => {
5781
5845
  options.fullscreenchangeContentHeight && (document.removeEventListener("fullscreenchange", fullscreenChangeListener),
5782
5846
  document.removeEventListener("keydown", fullscreenChangeListener));
5783
- }));
5847
+ });
5784
5848
  const onChangePagination = page => {
5785
5849
  props.page.pageIndex = page.pageIndex, props.page.pageSize = page.pageSize, emit("change-pagination", page),
5786
5850
  onConfirmSearch(_searchFormParams.value);
@@ -5796,30 +5860,30 @@ var Element$7 = defineComponent({
5796
5860
  }), onClickHeaderAdd = (row = {}) => {
5797
5861
  const {dialogTitle: dialogTitle} = options;
5798
5862
  addEditDialog.isEditing = !0, addEditDialog.title = dialogTitle + " " + t("next.table.add"),
5799
- addEditDialog.rowInfo = row, emit("click-add-edit", row, options), nextTick((() => {
5863
+ addEditDialog.rowInfo = row, emit("click-add-edit", row, options), nextTick(() => {
5800
5864
  addEditDialog.visible = !0;
5801
- }));
5865
+ });
5802
5866
  }, onClickDeleteRows = rows => {
5803
- emit("delete-rows", rows, (() => {
5867
+ emit("delete-rows", rows, () => {
5804
5868
  onClickRefresh();
5805
- }));
5869
+ });
5806
5870
  }, onClickDeleteRow = scoped => {
5807
- emit("delete-row", scoped, (() => {
5871
+ emit("delete-row", scoped, () => {
5808
5872
  onClickRefresh();
5809
- }));
5873
+ });
5810
5874
  }, onClickRowEdit = scoped => {
5811
5875
  const {dialogTitle: dialogTitle} = options;
5812
5876
  addEditDialog.isEditing = !0, addEditDialog.title = dialogTitle + " " + t("next.table.edit"),
5813
5877
  addEditDialog.rowInfo = scoped.row, emit("click-add-edit", scoped.row, options),
5814
- nextTick((() => {
5878
+ nextTick(() => {
5815
5879
  addEditDialog.visible = !0;
5816
- }));
5880
+ });
5817
5881
  }, onClickRowView = scoped => {
5818
5882
  const {dialogTitle: dialogTitle} = options;
5819
5883
  addEditDialog.isEditing = !1, addEditDialog.title = dialogTitle + " " + t("next.table.view"),
5820
- addEditDialog.rowInfo = scoped.row, emit("view-add-edit", scoped.row), nextTick((() => {
5884
+ addEditDialog.rowInfo = scoped.row, emit("view-add-edit", scoped.row), nextTick(() => {
5821
5885
  addEditDialog.visible = !0;
5822
- }));
5886
+ });
5823
5887
  }, onCloseAddEditDialog = () => {
5824
5888
  addEditDialog.visible = !1, addEditDialog.title = "", addEditDialog.rowInfo = {},
5825
5889
  emit("close-add-edit");
@@ -5832,31 +5896,31 @@ var Element$7 = defineComponent({
5832
5896
  const _customRowIndex = index => {
5833
5897
  const {pageIndex: pageIndex, pageSize: pageSize} = props.page;
5834
5898
  return (pageIndex - 1) * pageSize + (index + 1);
5835
- }, _sortNumberMinWidth = computed((() => {
5899
+ }, _sortNumberMinWidth = computed(() => {
5836
5900
  const {total: total} = props.page, tempElement = document.createElement("span");
5837
5901
  tempElement.innerText = total, tempElement.style.visibility = "hidden", document.body.appendChild(tempElement);
5838
5902
  const width = tempElement.getBoundingClientRect().width, minWidth = Math.ceil(width) + 25;
5839
5903
  return document.body.removeChild(tempElement), minWidth > 50 ? minWidth : 50;
5840
- })), searchFrom_slots = {};
5841
- searchFormSlots.value.forEach((slotName => {
5904
+ }), searchFrom_slots = {};
5905
+ searchFormSlots.value.forEach(slotName => {
5842
5906
  searchFrom_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
5843
- }));
5907
+ });
5844
5908
  const column_slots = {};
5845
- columnSlots.value.forEach((slotName => {
5909
+ columnSlots.value.forEach(slotName => {
5846
5910
  column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
5847
- }));
5911
+ });
5848
5912
  const addEditForm_slots = {};
5849
- addEditFormSlots.value.forEach((slotName => {
5913
+ addEditFormSlots.value.forEach(slotName => {
5850
5914
  addEditForm_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
5851
- }));
5915
+ });
5852
5916
  const headerMenu_solts = {};
5853
- header_menu_slots_key.forEach((slotName => {
5917
+ header_menu_slots_key.forEach(slotName => {
5854
5918
  headerMenu_solts[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
5855
- }));
5919
+ });
5856
5920
  const operation_column_slots = {};
5857
- operation_column_slots_key.forEach((slotName => {
5921
+ operation_column_slots_key.forEach(slotName => {
5858
5922
  operation_column_slots[slotName] = (...arg) => slots[slotName] && slots[slotName](...arg);
5859
- }));
5923
+ });
5860
5924
  expose({
5861
5925
  onClickRowAdd: onClickHeaderAdd,
5862
5926
  columns: _columns.value,
@@ -5881,13 +5945,13 @@ var Element$7 = defineComponent({
5881
5945
  onZoomResize: updateTableContentHeight,
5882
5946
  onConfirmSearch: onConfirmSearch,
5883
5947
  onClearSearch: onClearSearch
5884
- }, _isSlot(searchFrom_slots) ? searchFrom_slots : {
5948
+ }, _isSlot$1(searchFrom_slots) ? searchFrom_slots : {
5885
5949
  default: () => [ searchFrom_slots ]
5886
5950
  }), options.showHeaderMenu && createVNode(HeaderMenu, {
5887
5951
  onClickAdd: onClickHeaderAdd,
5888
5952
  onDeleteRows: onClickDeleteRows,
5889
5953
  onClickRefresh: onClickRefresh
5890
- }, _isSlot(headerMenu_solts) ? headerMenu_solts : {
5954
+ }, _isSlot$1(headerMenu_solts) ? headerMenu_solts : {
5891
5955
  default: () => [ headerMenu_solts ]
5892
5956
  }), slots["table-head-tip"]?.() ]) : null, createVNode(NextSpinLoading$1, {
5893
5957
  loading: props.loading
@@ -5938,16 +6002,16 @@ var Element$7 = defineComponent({
5938
6002
  fixed: "left",
5939
6003
  headerAlign: options.headerAlign,
5940
6004
  align: options.cellAlign
5941
- }, null) : null, slots.default?.(), _columns.value.map((col => createVNode(TableColumnDynamic, {
6005
+ }, null) : null, slots.default?.(), _columns.value.map(col => createVNode(TableColumnDynamic, {
5942
6006
  columnOption: col,
5943
6007
  key: col.prop
5944
- }, _isSlot(column_slots) ? column_slots : {
6008
+ }, _isSlot$1(column_slots) ? column_slots : {
5945
6009
  default: () => [ column_slots ]
5946
- }))), options.operations ? createVNode(TableColumnOperations, {
6010
+ })), options.operations ? createVNode(TableColumnOperations, {
5947
6011
  onEditRow: onClickRowEdit,
5948
6012
  onViewRow: onClickRowView,
5949
6013
  onDeleteRow: onClickDeleteRow
5950
- }, _isSlot(operation_column_slots) ? operation_column_slots : {
6014
+ }, _isSlot$1(operation_column_slots) ? operation_column_slots : {
5951
6015
  default: () => [ operation_column_slots ]
5952
6016
  }) : null ],
5953
6017
  empty: () => createVNode(ElEmpty, {
@@ -5977,7 +6041,7 @@ var Element$7 = defineComponent({
5977
6041
  isEditing: addEditDialog.isEditing,
5978
6042
  onClose: onCloseAddEditDialog,
5979
6043
  onSubmit: onSubmitAddEditDialog
5980
- }, _isSlot(addEditForm_slots) ? addEditForm_slots : {
6044
+ }, _isSlot$1(addEditForm_slots) ? addEditForm_slots : {
5981
6045
  default: () => [ addEditForm_slots ]
5982
6046
  })
5983
6047
  }) ]) ]) ]);
@@ -6023,11 +6087,11 @@ const NextCrudTableVirtualized = withInstall(defineComponent({
6023
6087
  name: "NextCrudTableVirtualized",
6024
6088
  props: propsConfig,
6025
6089
  setup(props, {emit: emit}) {
6026
- const _config = deepClone(defaultConfig$2), _options = computed((() => {
6090
+ const _config = deepClone(defaultConfig$2), _options = computed(() => {
6027
6091
  const cfg = unref(props.options);
6028
6092
  return merge(_config, cfg);
6029
- })), options = unref(_options);
6030
- provide("options", computed((() => _options.value)));
6093
+ }), options = unref(_options);
6094
+ provide("options", computed(() => _options.value));
6031
6095
  const {t: t} = useLocale(), addEditDialog = reactive({
6032
6096
  visible: !1,
6033
6097
  title: t("next.table.add"),
@@ -6089,7 +6153,7 @@ const NextUpload = withInstall(defineComponent({
6089
6153
  "list-type": props.listType,
6090
6154
  "auto-upload": !1,
6091
6155
  "on-preview": uploadFile => {
6092
- const initial = uploadfilesPreview.value.findIndex((file => file.url === uploadFile.url)) || 0;
6156
+ const initial = uploadfilesPreview.value.findIndex(file => file.url === uploadFile.url) || 0;
6093
6157
  previewImagesContainer && (render(null, previewImagesContainer), body.removeChild(previewImagesContainer)),
6094
6158
  previewImagesContainer = document.createElement("div"), body.appendChild(previewImagesContainer);
6095
6159
  const previewComponent = createVNode({
@@ -6097,7 +6161,7 @@ const NextUpload = withInstall(defineComponent({
6097
6161
  to: "body"
6098
6162
  }, [ h(ElImageViewer, {
6099
6163
  initialIndex: initial,
6100
- "url-list": uploadfilesPreview.value.map((file => file.url)),
6164
+ "url-list": uploadfilesPreview.value.map(file => file.url),
6101
6165
  onClose: () => {
6102
6166
  render(null, previewImagesContainer);
6103
6167
  }
@@ -6152,13 +6216,17 @@ var Element$4 = defineComponent({
6152
6216
  type: Boolean,
6153
6217
  default: !0
6154
6218
  },
6219
+ tf: {
6220
+ type: Object,
6221
+ default: null
6222
+ },
6155
6223
  tensorflow: {
6156
6224
  type: Object
6157
6225
  }
6158
6226
  },
6159
6227
  emits: [ "loaded", "play", "error", "detector" ],
6160
6228
  setup(props, {emit: emit, expose: expose}) {
6161
- const {lang: lang} = useLocale(), localeLang = {
6229
+ const _tf = props.tf || window.tf, {lang: lang} = useLocale(), localeLang = {
6162
6230
  "zh-cn": zhCN,
6163
6231
  en: En,
6164
6232
  "zh-tw": zhTW
@@ -6191,34 +6259,35 @@ var Element$4 = defineComponent({
6191
6259
  default: () => h(camera_default)
6192
6260
  }) ])
6193
6261
  });
6194
- player.value.on("loadedmetadata", (() => {
6262
+ player.value.on("loadedmetadata", () => {
6195
6263
  render(screenshotBtn, container);
6196
- }));
6264
+ });
6197
6265
  }, _loadModelDetectFrame = (container, video) => {
6198
6266
  if (!props.tensorflow) return;
6267
+ if (!_tf) throw new Error("请先引入 @tensorflow/tfjs 模块!");
6199
6268
  const {modelUrl: modelUrl, classNames: classNames} = props.tensorflow;
6200
6269
  if (!modelUrl) throw new Error("模型文件地址不能未空!");
6201
6270
  if (!classNames || !classNames.length) throw new Error("模型类别不能未空!");
6202
- container.innerHTML = "", tf.loadGraphModel(modelUrl).then((model => {
6271
+ container.innerHTML = "", _tf?.loadGraphModel(modelUrl).then(model => {
6203
6272
  const canvas = document.createElement("canvas");
6204
6273
  canvas.className = ns$4.b("recongition"), container.appendChild(canvas);
6205
6274
  const ctx = canvas.getContext("2d"), detect_ctx = document.createElement("canvas").getContext("2d");
6206
6275
  video.ontimeupdate = () => {
6207
6276
  const {videoWidth: videoWidth, videoHeight: videoHeight, offsetTop: offsetTop, offsetLeft: offsetLeft} = video;
6208
6277
  canvas.width = videoWidth, canvas.height = videoHeight, canvas.style.top = offsetTop + "px",
6209
- canvas.style.left = offsetLeft + "px", detectVideoFrame(video, model, ctx, tf, classNames, [], detect_ctx);
6278
+ canvas.style.left = offsetLeft + "px", detectVideoFrame(video, model, ctx, _tf, classNames, [], detect_ctx);
6210
6279
  }, modelRef.value = model, detectFrameCanvas.value = canvas;
6211
- }));
6280
+ });
6212
6281
  };
6213
- onUnmounted((() => {
6214
- modelRef.value && (tf.dispose(), modelRef.value.dispose(), modelRef.value = null),
6282
+ onUnmounted(() => {
6283
+ modelRef.value && (_tf?.dispose(), modelRef.value.dispose(), modelRef.value = null),
6215
6284
  player.value && (player.value.mse && (player.value.mse.endOfStream(), player.value.mse.unload(),
6216
6285
  player.value.mse = null), player.value.pause(), player.value.dispose(), player.value = null),
6217
6286
  playerFlv.value && (playerFlv.value.pause(), playerFlv.value.unload(), playerFlv.value.detachMediaElement(),
6218
6287
  playerFlv.value.destroy(), playerFlv.value = null), playerMpgets.value && (playerMpgets.value.pause(),
6219
6288
  playerMpgets.value.unload(), playerMpgets.value.detachMediaElement(), playerMpgets.value.destroy(),
6220
6289
  playerMpgets.value = null), videoBoxRef.value && render(null, videoBoxRef.value);
6221
- }));
6290
+ });
6222
6291
  const switchVideo = url => {
6223
6292
  if (!url) return (() => {
6224
6293
  const container = videoBoxRef.value, video = document.createElement("video");
@@ -6233,9 +6302,9 @@ var Element$4 = defineComponent({
6233
6302
  sources: []
6234
6303
  });
6235
6304
  const canvasContainer = document.createElement("div");
6236
- container.children[0].appendChild(canvasContainer), player.value.on("play", (() => {
6305
+ container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
6237
6306
  emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
6238
- })), _createScreenshotBtn(container), emit("loaded", {
6307
+ }), _createScreenshotBtn(container), emit("loaded", {
6239
6308
  player: player.value,
6240
6309
  video: video
6241
6310
  });
@@ -6264,9 +6333,9 @@ var Element$4 = defineComponent({
6264
6333
  };
6265
6334
  player.value = videojs(video, options);
6266
6335
  const canvasContainer = document.createElement("div");
6267
- container.children[0].appendChild(canvasContainer), player.value.on("play", (() => {
6336
+ container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
6268
6337
  emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
6269
- })), _createScreenshotBtn(container), emit("loaded", {
6338
+ }), _createScreenshotBtn(container), emit("loaded", {
6270
6339
  player: player.value,
6271
6340
  video: video
6272
6341
  });
@@ -6287,9 +6356,9 @@ var Element$4 = defineComponent({
6287
6356
  };
6288
6357
  player.value = videojs(video, options);
6289
6358
  const canvasContainer = document.createElement("div");
6290
- container.children[0].appendChild(canvasContainer), player.value.on("play", (() => {
6359
+ container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
6291
6360
  emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
6292
- })), _createScreenshotBtn(container), emit("loaded", {
6361
+ }), _createScreenshotBtn(container), emit("loaded", {
6293
6362
  player: player.value,
6294
6363
  video: video
6295
6364
  });
@@ -6313,13 +6382,13 @@ var Element$4 = defineComponent({
6313
6382
  type: "flv",
6314
6383
  isLive: !0,
6315
6384
  url: url
6316
- }), playerMpgets.value.attachMediaElement(video), playerMpgets.value.load(), playerMpgets.value.on("error", (() => {
6385
+ }), playerMpgets.value.attachMediaElement(video), playerMpgets.value.load(), playerMpgets.value.on("error", () => {
6317
6386
  emit("error", video);
6318
- })), _createScreenshotBtn(container);
6387
+ }), _createScreenshotBtn(container);
6319
6388
  const canvasContainer = document.createElement("div");
6320
- container.children[0].appendChild(canvasContainer), playerMpgets.value.on("metadata_arrived", (() => {
6389
+ container.children[0].appendChild(canvasContainer), playerMpgets.value.on("metadata_arrived", () => {
6321
6390
  emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
6322
- })), emit("loaded", {
6391
+ }), emit("loaded", {
6323
6392
  player: player.value,
6324
6393
  video: video
6325
6394
  });
@@ -6347,19 +6416,19 @@ var Element$4 = defineComponent({
6347
6416
  url: url
6348
6417
  }), playerFlv.value.attachMediaElement(video), playerFlv.value.load());
6349
6418
  const canvasContainer = document.createElement("div");
6350
- container.children[0].appendChild(canvasContainer), player.value.on("play", (() => {
6419
+ container.children[0].appendChild(canvasContainer), player.value.on("play", () => {
6351
6420
  emit("play", video, container), _loadModelDetectFrame(canvasContainer, video);
6352
- })), _createScreenshotBtn(container), emit("loaded", {
6421
+ }), _createScreenshotBtn(container), emit("loaded", {
6353
6422
  player: player.value,
6354
6423
  video: video
6355
6424
  });
6356
6425
  })(url);
6357
6426
  };
6358
- onMounted((() => {
6359
- nextTick((() => {
6427
+ onMounted(() => {
6428
+ nextTick(() => {
6360
6429
  switchVideo(videoSrc);
6361
- }));
6362
- }));
6430
+ });
6431
+ });
6363
6432
  expose({
6364
6433
  getElement: () => {
6365
6434
  const container = videoBoxRef.value, palyerContainer = container.children[0];
@@ -6553,7 +6622,7 @@ const colors$1 = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba2
6553
6622
  };
6554
6623
  };
6555
6624
 
6556
- var ContextMenuLabel = defineComponent({
6625
+ var ContextMenuLabel$1 = defineComponent({
6557
6626
  props: {
6558
6627
  labelRect: {
6559
6628
  type: Object,
@@ -6575,10 +6644,10 @@ var ContextMenuLabel = defineComponent({
6575
6644
  }, onDelete = () => {
6576
6645
  emit("delete", props.activateRect);
6577
6646
  }, activateIndex = ref();
6578
- watch((() => props.activateRect), (() => {
6647
+ watch(() => props.activateRect, () => {
6579
6648
  const {type: type} = props.activateRect;
6580
6649
  activateIndex.value = isValueExist(type) ? type : null;
6581
- }), {
6650
+ }, {
6582
6651
  deep: !0,
6583
6652
  immediate: !0
6584
6653
  });
@@ -6586,18 +6655,18 @@ var ContextMenuLabel = defineComponent({
6586
6655
  width: 0,
6587
6656
  height: 0
6588
6657
  });
6589
- onMounted((() => {
6658
+ onMounted(() => {
6590
6659
  const {clientWidth: clientWidth, clientHeight: clientHeight} = labelMenuRef.value;
6591
6660
  labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
6592
- }));
6593
- const labelMenuRef = ref(), labelStyleFixed = computed((() => {
6661
+ });
6662
+ const labelMenuRef = ref(), labelStyleFixed = computed(() => {
6594
6663
  const {left: left, top: top} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - window.innerHeight;
6595
6664
  let y = top;
6596
6665
  return height_diff > 0 && (y -= height_diff), {
6597
6666
  top: y + "px",
6598
6667
  left: left + "px"
6599
6668
  };
6600
- })), renderContent = () => createVNode("div", {
6669
+ }), renderContent = () => createVNode("div", {
6601
6670
  ref: labelMenuRef,
6602
6671
  class: [ ns.b("contextmenu-label") ],
6603
6672
  style: labelStyleFixed.value
@@ -6612,7 +6681,7 @@ var ContextMenuLabel = defineComponent({
6612
6681
  default: () => [ createVNode(close_default, null, null) ]
6613
6682
  }) ]), createVNode("ul", {
6614
6683
  class: "label-main"
6615
- }, [ props.classes.map(((name, index) => createVNode("li", {
6684
+ }, [ props.classes.map((name, index) => createVNode("li", {
6616
6685
  key: index,
6617
6686
  onClick: () => (index => {
6618
6687
  activateIndex.value = index, emit("select", index);
@@ -6625,7 +6694,7 @@ var ContextMenuLabel = defineComponent({
6625
6694
  "background-color": colors$1[index % colors$1.length]
6626
6695
  },
6627
6696
  class: "label-line"
6628
- }, null), createVNode("span", null, [ name ]) ]))) ]), isValueExist(activateIndex.value) ? createVNode("div", {
6697
+ }, null), createVNode("span", null, [ name ]) ])) ]), isValueExist(activateIndex.value) ? createVNode("div", {
6629
6698
  style: "margin: 10px auto 0"
6630
6699
  }, [ createVNode(ElButton, {
6631
6700
  icon: delete_default,
@@ -6676,12 +6745,12 @@ class CanvasSceneDragZoom {
6676
6745
  });
6677
6746
  }
6678
6747
  notifyObservers(scale, offset) {
6679
- this.observers.forEach((listener => {
6748
+ this.observers.forEach(listener => {
6680
6749
  listener({
6681
6750
  scale: scale,
6682
6751
  ...offset
6683
6752
  });
6684
- }));
6753
+ });
6685
6754
  }
6686
6755
  changeZoom(callback) {
6687
6756
  this.observers.push(callback);
@@ -6839,12 +6908,12 @@ var DraggableRect = defineComponent({
6839
6908
  rect.value.rectWidth = newWidth;
6840
6909
  }
6841
6910
  };
6842
- return onMounted((() => {
6911
+ return onMounted(() => {
6843
6912
  parentRect = props.parentEl.getBoundingClientRect(), document.addEventListener("mousemove", onMousemove),
6844
6913
  document.addEventListener("mouseup", onMouseup);
6845
- })), onUnmounted((() => {
6914
+ }), onUnmounted(() => {
6846
6915
  document.removeEventListener("mousemove", onMousemove), document.removeEventListener("mouseup", onMouseup);
6847
- })), {
6916
+ }), {
6848
6917
  onMousedown: e => {
6849
6918
  e.preventDefault(), isDraggle.value = !0, draggleOffset.value.diff_x = e.offsetX,
6850
6919
  draggleOffset.value.diff_y = e.offsetY;
@@ -6941,11 +7010,11 @@ var DraggableRect = defineComponent({
6941
7010
  const _labels = deepClone(labels.value);
6942
7011
  let yolo_label = [];
6943
7012
  return {
6944
- rects: _labels.map((rect => {
7013
+ rects: _labels.map(rect => {
6945
7014
  delete rect.typeName;
6946
7015
  const label_rect = convertToLabel(rect);
6947
7016
  return yolo_label.push(label_rect.join(" ")), toRaw(rect);
6948
- })),
7017
+ }),
6949
7018
  label_txt: yolo_label.join("\n")
6950
7019
  };
6951
7020
  }, setContainerWidthHeight = (canvasWidth, canvasHeight) => {
@@ -6981,11 +7050,11 @@ var DraggableRect = defineComponent({
6981
7050
  originHeight: image.height
6982
7051
  };
6983
7052
  })(image);
6984
- labels.value = ((rowInfo, originWidth, originHeight) => rowInfo.labels ? rowInfo.labels.map((rect => {
7053
+ labels.value = ((rowInfo, originWidth, originHeight) => rowInfo.labels ? rowInfo.labels.map(rect => {
6985
7054
  const typeName = props.classes[rect.type];
6986
7055
  return typeName && (rect.typeName = typeName), rect.originWidth || (rect.originWidth = originWidth),
6987
7056
  rect.originHeight || (rect.originHeight = originHeight), rect;
6988
- })) : [])(rowInfo, originWidth, originHeight), image.style.width = canvasWidth + "px",
7057
+ }) : [])(rowInfo, originWidth, originHeight), image.style.width = canvasWidth + "px",
6989
7058
  image.style.height = canvasHeight + "px", setContainerWidthHeight(canvasWidth, canvasHeight),
6990
7059
  labels.value = ((labels, canvasHeight) => {
6991
7060
  let scale_rects = [];
@@ -7111,7 +7180,7 @@ var DraggableRect = defineComponent({
7111
7180
  canvas: canvasRectRef.value,
7112
7181
  originWidth: originWidth,
7113
7182
  originHeight: originHeight
7114
- }, ((rect, {endX: endX, endY: endY}) => {
7183
+ }, (rect, {endX: endX, endY: endY}) => {
7115
7184
  activate_add_label.value = rect;
7116
7185
  const newRect = ((rect, scaleOffset) => {
7117
7186
  const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect, {scale: scale, x: x, y: y} = scaleOffset;
@@ -7127,51 +7196,51 @@ var DraggableRect = defineComponent({
7127
7196
  };
7128
7197
  })(rect, scaleTranslateManager.scaleTranslate.value);
7129
7198
  drawBaseCanvas.value.addDrawRect(newRect), updateContextmenuLabelFixed(endX, endY, newRect);
7130
- }), (() => {
7199
+ }, () => {
7131
7200
  onCloseDraggableRectFixed();
7132
- }));
7201
+ });
7133
7202
  drawBaseCanvas.value.clearCanvasRect = clearCanvas, drawBaseCanvas.value.removeEventAll = removeEventAll,
7134
- canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom((scaleOffset => {
7203
+ canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom(scaleOffset => {
7135
7204
  scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawBaseCanvas.value.updateLabels();
7136
- }));
7205
+ });
7137
7206
  }, image.onerror = () => {
7138
7207
  loadingImage.value = !1;
7139
7208
  };
7140
7209
  }
7141
- canvasBaseRef.value.addEventListener("contextmenu", (e => {
7210
+ canvasBaseRef.value.addEventListener("contextmenu", e => {
7142
7211
  e.preventDefault();
7143
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);
7144
- onCloseContentmenuLabel(), onCloseDraggableRectFixed(), hit_rect && nextTick((() => {
7213
+ onCloseContentmenuLabel(), onCloseDraggableRectFixed(), hit_rect && nextTick(() => {
7145
7214
  updateContextmenuLabelFixed(offsetX, offsetY, hit_rect);
7146
- }));
7147
- })), canvasBaseRef.value.addEventListener("click", (e => {
7215
+ });
7216
+ }), canvasBaseRef.value.addEventListener("click", e => {
7148
7217
  if (e.ctrlKey) return;
7149
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);
7150
- onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && nextTick((() => {
7219
+ onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && nextTick(() => {
7151
7220
  updateDraggableRectFixed(offsetX, offsetY, hit_rect, hit_index, color);
7152
- }));
7153
- }));
7221
+ });
7222
+ });
7154
7223
  };
7155
- onMounted((() => {
7156
- watch((() => props.rowInfo), (info => {
7224
+ onMounted(() => {
7225
+ watch(() => props.rowInfo, info => {
7157
7226
  const rowInfo = toRaw(info);
7158
7227
  renderImageLabel(rowInfo);
7159
- }), {
7228
+ }, {
7160
7229
  deep: !0,
7161
7230
  immediate: !0
7162
- }), watch((() => props.classes), (() => {
7231
+ }), watch(() => props.classes, () => {
7163
7232
  const rowInfo = toRaw(props.rowInfo);
7164
7233
  renderImageLabel(rowInfo);
7165
- })), watch((() => props.contextClientHeight), (height => {
7234
+ }), watch(() => props.contextClientHeight, height => {
7166
7235
  if (valueExist(height)) {
7167
7236
  canvasMainRef.value.style.height = height + "px";
7168
7237
  const rowInfo = toRaw(props.rowInfo);
7169
7238
  renderImageLabel(rowInfo);
7170
7239
  }
7171
- }));
7172
- })), onUnmounted((() => {
7240
+ });
7241
+ }), onUnmounted(() => {
7173
7242
  drawBaseCanvas.value.removeEventAll?.(), canvasDragZoom.value.destroy();
7174
- }));
7243
+ });
7175
7244
  const contextmenuLabelFixed = ref({
7176
7245
  show: !1,
7177
7246
  top: 0,
@@ -7187,7 +7256,7 @@ var DraggableRect = defineComponent({
7187
7256
  contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
7188
7257
  contextmenuLabelFixed.value.activateRect = null, activate_add_label.value = null,
7189
7258
  drawBaseCanvas.value.updateLabels(), drawBaseCanvas.value.clearCanvasRect();
7190
- }, contextmenuLabelRect = computed((() => {
7259
+ }, contextmenuLabelRect = computed(() => {
7191
7260
  const {top: top, left: left, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = contextmenuLabelFixed.value;
7192
7261
  return {
7193
7262
  top: top,
@@ -7195,7 +7264,7 @@ var DraggableRect = defineComponent({
7195
7264
  canvasWidth: canvasWidth,
7196
7265
  canvasHeight: canvasHeight
7197
7266
  };
7198
- })), draggableRectFixed = ref({
7267
+ }), draggableRectFixed = ref({
7199
7268
  show: !1,
7200
7269
  top: 0,
7201
7270
  left: 0,
@@ -7215,27 +7284,27 @@ var DraggableRect = defineComponent({
7215
7284
  draggableRectFixed.value.activateIndex = null, draggableRectFixed.value.color = null;
7216
7285
  }, onDraggleRectResize = rect => {
7217
7286
  draggableRectFixed.value.activateRect = rect;
7218
- const i = labels.value.findIndex((o => isEqual(o, rect)));
7287
+ const i = labels.value.findIndex(o => isEqual(o, rect));
7219
7288
  i > -1 && labels.value.splice(i, 1, rect), drawBaseCanvas.value.updateLabels();
7220
7289
  const {rects: rects, label_txt: label_txt} = formatLabelsType();
7221
7290
  _emit("change", rects, label_txt), emit("change", rects, label_txt);
7222
7291
  }, onContextmenuDraggable = (e, rect) => {
7223
7292
  e.preventDefault();
7224
7293
  const rect_x = e.offsetX, rect_y = e.offsetY, x = rect_x + rect.startX, y = rect_y + rect.startY;
7225
- onCloseContentmenuLabel(), nextTick((() => {
7294
+ onCloseContentmenuLabel(), nextTick(() => {
7226
7295
  updateContextmenuLabelFixed(x, y, rect);
7227
- }));
7296
+ });
7228
7297
  }, activate_add_label = ref(), onSelectLabel = type => {
7229
7298
  activate_add_label.value.type = type;
7230
7299
  const typeName = props.classes[type];
7231
7300
  typeName && (activate_add_label.value.typeName = typeName);
7232
- const i = labels.value.findIndex((o => isEqual(o, activate_add_label.value)));
7301
+ const i = labels.value.findIndex(o => isEqual(o, activate_add_label.value));
7233
7302
  i > -1 ? labels.value.splice(i, 1, activate_add_label.value) : labels.value.push(activate_add_label.value),
7234
7303
  onCloseContentmenuLabel();
7235
7304
  const {rects: rects, label_txt: label_txt} = formatLabelsType();
7236
7305
  _emit("change", rects, label_txt), emit("change", rects, label_txt);
7237
7306
  }, onDeleteLabel = rect => {
7238
- const i = labels.value.findIndex((o => isEqual(o, rect)));
7307
+ const i = labels.value.findIndex(o => isEqual(o, rect));
7239
7308
  labels.value.splice(i, 1), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
7240
7309
  drawBaseCanvas.value.updateLabels();
7241
7310
  const {rects: rects, label_txt: label_txt} = formatLabelsType();
@@ -7245,18 +7314,18 @@ var DraggableRect = defineComponent({
7245
7314
  onCloseDraggableRectFixed: onCloseDraggableRectFixed,
7246
7315
  onCloseContentmenuLabel: onCloseContentmenuLabel,
7247
7316
  onSelectedLabel: (rect, index) => {
7248
- onCloseDraggableRectFixed(), nextTick((() => {
7317
+ onCloseDraggableRectFixed(), nextTick(() => {
7249
7318
  const {startX: x, startY: y, type: type} = rect, color = colors$1[type];
7250
7319
  updateDraggableRectFixed(x, y, labels.value[index], index, color);
7251
- }));
7320
+ });
7252
7321
  },
7253
7322
  onDeleteLabel: onDeleteLabel,
7254
7323
  rerenderImage: () => {
7255
7324
  setContainerWidthHeight(0, 0), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
7256
- nextTick((() => {
7325
+ nextTick(() => {
7257
7326
  const rowInfo = toRaw(props.rowInfo);
7258
7327
  renderImageLabel(rowInfo);
7259
- }));
7328
+ });
7260
7329
  },
7261
7330
  resetScaleOffset: () => {
7262
7331
  canvasDragZoom.value.reset();
@@ -7276,7 +7345,7 @@ var DraggableRect = defineComponent({
7276
7345
  }, null), createVNode("canvas", {
7277
7346
  ref: canvasRectRef,
7278
7347
  class: [ ns.be("canvas", "rect") ]
7279
- }, null), contextmenuLabelFixed.value.show ? createVNode(ContextMenuLabel, {
7348
+ }, null), contextmenuLabelFixed.value.show ? createVNode(ContextMenuLabel$1, {
7280
7349
  labelRect: contextmenuLabelRect.value,
7281
7350
  classes: props.classes,
7282
7351
  activateRect: contextmenuLabelFixed.value.activateRect,
@@ -7292,7 +7361,7 @@ var DraggableRect = defineComponent({
7292
7361
  }, null) : null ]) ]
7293
7362
  }) ]);
7294
7363
  }
7295
- }), RightLabel = defineComponent({
7364
+ }), RightLabel$1 = defineComponent({
7296
7365
  props: {
7297
7366
  contentHeight: {
7298
7367
  type: Number
@@ -7308,16 +7377,16 @@ var DraggableRect = defineComponent({
7308
7377
  },
7309
7378
  emits: [ "delete", "select" ],
7310
7379
  setup(props, {emit: emit}) {
7311
- const {t: t} = useLocale(), ns = inject("ns", {}), labels = ref([]), formatLabelsTypeName = labels => labels.length ? labels.map((rect => {
7380
+ const {t: t} = useLocale(), ns = inject("ns", {}), labels = ref([]), formatLabelsTypeName = labels => labels.length ? labels.map(rect => {
7312
7381
  const typeName = props.classes[rect.type];
7313
7382
  return typeName && (rect.typeName = typeName), rect;
7314
- })) : [];
7315
- watch((() => props.classes), (() => {
7383
+ }) : [];
7384
+ watch(() => props.classes, () => {
7316
7385
  labels.value = formatLabelsTypeName(labels.value);
7317
- })), watch((() => props.labels), (rects => {
7386
+ }), watch(() => props.labels, rects => {
7318
7387
  const _rects = toRaw(rects);
7319
7388
  labels.value = formatLabelsTypeName(_rects);
7320
- }), {
7389
+ }, {
7321
7390
  deep: !0,
7322
7391
  immediate: !0
7323
7392
  });
@@ -7326,7 +7395,7 @@ var DraggableRect = defineComponent({
7326
7395
  style: {
7327
7396
  height: props.contentHeight + "px"
7328
7397
  }
7329
- }, [ labels.value.length ? createVNode("ul", null, [ labels.value.map(((rect, index) => createVNode("li", {
7398
+ }, [ labels.value.length ? createVNode("ul", null, [ labels.value.map((rect, index) => createVNode("li", {
7330
7399
  key: index,
7331
7400
  onClick: () => ((rect, index) => {
7332
7401
  emit("select", rect, index);
@@ -7352,8 +7421,8 @@ var DraggableRect = defineComponent({
7352
7421
  }, {
7353
7422
  default: () => [ createVNode(delete_default, null, null) ]
7354
7423
  })
7355
- }) ]))) ]) : createVNode(ElEmpty, {
7356
- "image-size": 120,
7424
+ }) ])) ]) : createVNode(ElEmpty, {
7425
+ "image-size": 100,
7357
7426
  description: t("next.labelimg.emptyLabelText")
7358
7427
  }, null) ]);
7359
7428
  return () => createVNode(Fragment, null, [ renderContent() ]);
@@ -7390,47 +7459,47 @@ var Element$1 = defineComponent({
7390
7459
  },
7391
7460
  emits: [ "change", "save", "prev-click", "next-click" ],
7392
7461
  setup(props, {emit: emit, slots: slots, expose: expose}) {
7393
- const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = computed((() => {
7462
+ const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = computed(() => {
7394
7463
  const cfg = unref(props.options);
7395
7464
  return merge(_config, cfg);
7396
- })), options = unref(_options);
7465
+ }), options = unref(_options);
7397
7466
  provide("ns", ns$2), provide("_emit", emit);
7398
7467
  const activateNodeIndex = ref(0), classes = ref(props.classes), labelImages = ref(deepClone(props.data));
7399
- watch((() => props.data), (data => {
7468
+ watch(() => props.data, data => {
7400
7469
  labelImages.value = deepClone(data);
7401
- }), {
7470
+ }, {
7402
7471
  deep: !0
7403
- }), watch((() => props.data.length), (() => {
7472
+ }), watch(() => props.data.length, () => {
7404
7473
  activateNodeIndex.value = 0;
7405
- })), watch((() => props.classes), (val => {
7474
+ }), watch(() => props.classes, val => {
7406
7475
  classes.value = val;
7407
- }), {
7476
+ }, {
7408
7477
  deep: !0
7409
7478
  });
7410
- const currentNode = computed((() => {
7479
+ const currentNode = computed(() => {
7411
7480
  if (!labelImages.value) return {};
7412
7481
  const node = labelImages.value[activateNodeIndex.value] || {};
7413
7482
  return deepClone(node);
7414
- })), activateNodeLabels = ref(currentNode.value.labels || []);
7415
- watch((() => currentNode.value), (() => {
7483
+ }), activateNodeLabels = ref(currentNode.value.labels || []);
7484
+ watch(() => currentNode.value, () => {
7416
7485
  activateNodeLabels.value = currentNode.value.labels || [];
7417
- }));
7486
+ });
7418
7487
  const onChangeNodeRect = rects => {
7419
7488
  currentNode.value.labels = rects, activateNodeLabels.value = rects;
7420
7489
  }, loading = ref(!1), formatNodeLabels = () => {
7421
7490
  const node = currentNode.value;
7422
7491
  let yolo_label = [];
7423
- return node.labels.forEach((rect => {
7492
+ return node.labels.forEach(rect => {
7424
7493
  delete rect.typeName;
7425
7494
  const label_rect = convertToLabel(rect);
7426
7495
  yolo_label.push(label_rect.join(" "));
7427
- })), {
7496
+ }), {
7428
7497
  node: node,
7429
7498
  label_txt: yolo_label.join("\n")
7430
7499
  };
7431
7500
  }, isChangeNodeLabels = () => {
7432
7501
  const node = labelImages.value[activateNodeIndex.value];
7433
- return isEqual(toRaw(node.labels).map((rect => convertToLabel(rect))), currentNode.value.labels.map((rect => convertToLabel(rect))));
7502
+ return isEqual(toRaw(node.labels).map(rect => convertToLabel(rect)), currentNode.value.labels.map(rect => convertToLabel(rect)));
7434
7503
  }, switchKeydownAD = e => {
7435
7504
  const imageLength = labelImages.value.length;
7436
7505
  "KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
@@ -7445,12 +7514,12 @@ var Element$1 = defineComponent({
7445
7514
  emit("save", {
7446
7515
  node: node,
7447
7516
  label_txt: label_txt
7448
- }, (imageItem => {
7517
+ }, imageItem => {
7449
7518
  labelImages.value[activateNodeIndex.value] = imageItem || node, switchKeydownAD(e),
7450
7519
  loading.value = !1;
7451
- }), (() => {
7520
+ }, () => {
7452
7521
  loading.value = !1;
7453
- }));
7522
+ });
7454
7523
  }, onChangeActivateNode = index => {
7455
7524
  if (loading.value) return;
7456
7525
  loading.value = !0;
@@ -7459,16 +7528,16 @@ var Element$1 = defineComponent({
7459
7528
  loading.value = !1, !1) : (emit("save", {
7460
7529
  node: node,
7461
7530
  label_txt: label_txt
7462
- }, (imageItem => {
7531
+ }, imageItem => {
7463
7532
  labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
7464
7533
  loading.value = !1, scaleTranslate.value = {
7465
7534
  scale: 1,
7466
7535
  x: 0,
7467
7536
  y: 0
7468
7537
  };
7469
- }), (() => {
7538
+ }, () => {
7470
7539
  loading.value = !1;
7471
- })), !0);
7540
+ }), !0);
7472
7541
  }, onPaginationPrev = () => {
7473
7542
  const imageLength = labelImages.value.length;
7474
7543
  let i = activateNodeIndex.value - 1;
@@ -7478,26 +7547,26 @@ var Element$1 = defineComponent({
7478
7547
  let i = activateNodeIndex.value + 1;
7479
7548
  i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
7480
7549
  }, canvasContextRef = ref(), layoutLabelRef = ref(), headerRef = ref(), mainRef = ref(), footerRef = ref(), mainContentHeight = ref(options.minContentHeight), updateMainContentHeight = () => {
7481
- nextTick((() => {
7550
+ nextTick(() => {
7482
7551
  const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
7483
7552
  mainContentHeight.value = contentHeight;
7484
- }));
7553
+ });
7485
7554
  };
7486
- onMounted((() => {
7487
- document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (() => {
7555
+ onMounted(() => {
7556
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, () => {
7488
7557
  updateMainContentHeight();
7489
- })), window.addEventListener("resize", updateMainContentHeight);
7490
- })), onUnmounted((() => {
7558
+ }), window.addEventListener("resize", updateMainContentHeight);
7559
+ }), onUnmounted(() => {
7491
7560
  document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
7492
- }));
7561
+ });
7493
7562
  const onSelectLabelNode = (rect, index) => {
7494
7563
  canvasContextRef.value.onSelectedLabel(rect, index);
7495
7564
  }, onDeleteLabelNode = rect => {
7496
7565
  canvasContextRef.value.onDeleteLabel(rect);
7497
7566
  }, isFullscreen = ref(!1), onSwitchFillscreen = val => {
7498
- isFullscreen.value = val, updateMainContentHeight(), nextTick((() => {
7567
+ isFullscreen.value = val, updateMainContentHeight(), nextTick(() => {
7499
7568
  canvasContextRef.value.rerenderImage();
7500
- }));
7569
+ });
7501
7570
  }, scaleTranslate = ref({
7502
7571
  scale: 1,
7503
7572
  x: 0,
@@ -7559,7 +7628,7 @@ var Element$1 = defineComponent({
7559
7628
  rowInfo: currentNode.value,
7560
7629
  onChange: onChangeNodeRect
7561
7630
  }, null) ]) ]
7562
- }), createVNode(RightLabel, {
7631
+ }), createVNode(RightLabel$1, {
7563
7632
  contentHeight: mainContentHeight.value,
7564
7633
  classes: classes.value,
7565
7634
  labels: activateNodeLabels.value,
@@ -7581,7 +7650,7 @@ var Element$1 = defineComponent({
7581
7650
  }, [ createVNode(ElScrollbar, null, {
7582
7651
  default: () => [ createVNode("ul", {
7583
7652
  class: [ ns$2.bem("footer", "center", "list") ]
7584
- }, [ labelImages.value.map(((item, index) => createVNode("li", {
7653
+ }, [ labelImages.value.map((item, index) => createVNode("li", {
7585
7654
  key: index,
7586
7655
  onClick: () => onChangeActivateNode(index),
7587
7656
  class: {
@@ -7594,7 +7663,7 @@ var Element$1 = defineComponent({
7594
7663
  "max-scale": 2,
7595
7664
  "min-scale": .2,
7596
7665
  fit: "cover"
7597
- }, null) ]))) ]) ]
7666
+ }, null) ])) ]) ]
7598
7667
  }) ]), createVNode("div", {
7599
7668
  class: [ ns$2.be("footer", "right") ]
7600
7669
  }, [ createVNode(ElIcon, {
@@ -7662,13 +7731,13 @@ var preview = defineComponent({
7662
7731
  };
7663
7732
  }
7664
7733
  };
7665
- onMounted((() => {
7666
- watch((() => props.src), (() => {
7734
+ onMounted(() => {
7735
+ watch(() => props.src, () => {
7667
7736
  renderImageAndLabel();
7668
- }), {
7737
+ }, {
7669
7738
  immediate: !0
7670
7739
  });
7671
- }));
7740
+ });
7672
7741
  return () => createVNode(Fragment, null, [ createVNode("div", {
7673
7742
  class: [ ns$1.b(), props.className ],
7674
7743
  style: {
@@ -7680,93 +7749,303 @@ var preview = defineComponent({
7680
7749
  }
7681
7750
  });
7682
7751
 
7683
- const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview), isPointInCircle = (mouseX, mouseY, circleX, circleY, radius) => Math.sqrt(Math.pow(mouseX - circleX, 2) + Math.pow(mouseY - circleY, 2)) < radius, vertexesUnique = vertexes => Array.from(new Set(vertexes.map((item => JSON.stringify(item))))).map((item => JSON.parse(item))), vertexesToScale = (vertexes, scaleX, scaleY, isMultiply = !0) => vertexes?.length ? vertexes.map((item => ((vertex, scaleX, scaleY, isMultiply = !0) => {
7684
- const [x, y] = vertex;
7685
- return isMultiply ? [ x * scaleX, y * scaleY ] : [ x / scaleX, y / scaleY ];
7686
- })(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);
7687
7753
 
7688
- class CreatePolygonVertexes {
7689
- canvas;
7690
- ctx;
7691
- vertexes;
7692
- isDrawing;
7693
- mouseOffset;
7694
- vertexesObservers=[];
7695
- destroyedObservers;
7696
- constructor(canvas, ctx) {
7697
- this.canvas = canvas, this.ctx = ctx, this.isDrawing = !1, this.vertexes = [], this.mouseOffset = {
7698
- x: 0,
7699
- y: 0
7700
- }, canvas.addEventListener("click", this.canvasMouseClick.bind(this)), canvas.addEventListener("mousemove", this.canvasMousemove.bind(this)),
7701
- canvas.addEventListener("dblclick", this.canvasMouseDblclick.bind(this)), this.vertexes = new Proxy(this.vertexes, {
7702
- set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
7703
- !0)
7704
- }), this.mouseOffset = new Proxy(this.mouseOffset, {
7705
- set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
7706
- !0)
7707
- });
7708
- }
7709
- notifyVertexChangeListeners() {
7710
- this.vertexesObservers.forEach((listener => {
7711
- listener(this.vertexes, this.mouseOffset);
7712
- }));
7713
- }
7714
- vertexesChangeEventListener(listener) {
7715
- this.vertexesObservers.push(listener);
7716
- }
7717
- notifyDestryedListerers() {
7718
- this.destroyedObservers(this.vertexes);
7719
- }
7720
- onDestroyed(callback) {
7721
- this.destroyedObservers = callback;
7722
- }
7723
- canvasMouseClick(e) {
7724
- e.stopPropagation(), this.isDrawing = !0, this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY;
7725
- const [x, y] = [ e.offsetX, e.offsetY ];
7726
- let is_add = !0;
7727
- for (let i = 0; i < this.vertexes.length; i++) {
7728
- const p = this.vertexes[i];
7729
- if (Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2) < 8) {
7730
- is_add = !1;
7731
- break;
7732
- }
7733
- }
7734
- is_add && this.vertexes.push([ x, y ]), this.vertexes = vertexesUnique(this.vertexes);
7735
- }
7736
- canvasMousemove(e) {
7737
- e.stopPropagation(), this.isDrawing && (this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
7738
- this.canvas.style.cursor = "crosshair");
7739
- }
7740
- canvasMouseDblclick(e) {
7741
- e.stopPropagation(), this.isDrawing && (this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
7742
- this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes)),
7743
- this.notifyDestryedListerers(), this.destroy();
7744
- }
7745
- destroy() {
7746
- this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.destroyedObservers = () => {
7747
- this.canvas.removeEventListener("click", this.canvasMouseClick);
7748
- }, this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
7749
- }
7750
- }
7754
+ var ShapeType, ToolsHandleType;
7751
7755
 
7752
- class EditPolygonPath {
7753
- canvas;
7754
- ctx;
7755
- vertexes;
7756
- isEditing;
7757
- isMoveEditing;
7758
- canClickEvent;
7759
- pointVertexIndex;
7760
- pointCentreIndex;
7761
- vertexRadius;
7762
- edgeCentreRadius;
7763
- pointRecover;
7764
- observers=[];
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;
8038
+ vertexRadius;
8039
+ edgeCentreRadius;
8040
+ pointRecover;
8041
+ observers=[];
7765
8042
  editPolygonObserver;
7766
8043
  constructor(canvas, ctx) {
7767
8044
  this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
7768
8045
  this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
7769
- 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);
7770
8049
  }
7771
8050
  notifyEditPolygonObserver() {
7772
8051
  this.editPolygonObserver?.(this.vertexes);
@@ -7775,45 +8054,55 @@ class EditPolygonPath {
7775
8054
  this.editPolygonObserver = callback;
7776
8055
  }
7777
8056
  getTransformPoint(x, y) {
7778
- const transformMatrix = this.ctx.getTransform(), scaleX = parseFloat(transformMatrix.a.toFixed(1)), scaleY = parseFloat(transformMatrix.d.toFixed(1)), translateX = Math.ceil(transformMatrix.e), translateY = Math.ceil(transformMatrix.f);
7779
- return [ Math.floor((x - translateX) / scaleX), Math.floor((y - translateY) / scaleY) ];
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
+ });
7780
8063
  }
7781
8064
  drawPolygonPath(vertexes, mouseX, mouseY) {
7782
8065
  const ctx = this.ctx;
7783
8066
  if (!vertexes.length) return;
7784
- ctx.beginPath(), ctx.lineWidth = 3, ctx.strokeStyle = "#5470c6", ctx.fillStyle = hexToRgba("#5470c6", .2),
7785
- ctx.moveTo(vertexes[0][0], vertexes[0][1]);
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]);
7786
8070
  for (let i = 1; i < vertexes.length; i++) {
7787
8071
  const [x, y] = vertexes[i];
7788
8072
  ctx.lineTo(x, y);
7789
8073
  }
7790
8074
  isNaN(mouseX) || isNaN(mouseY) || ctx.lineTo(mouseX, mouseY), ctx.closePath(), ctx.stroke(),
7791
- ctx.fill();
8075
+ ctx.fill(), ctx.restore();
7792
8076
  }
7793
8077
  drawPolygonEdgeCentre(vertexes) {
7794
- 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();
7795
8080
  for (let i = 0; i < vertexes.length; i++) {
7796
8081
  const [x, y] = vertexes[i];
7797
- ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, this.vertexRadius, 0, 2 * Math.PI),
7798
- ctx.closePath(), ctx.fill(), ctx.beginPath(), ctx.fillStyle = "#FFFFFF", ctx.arc(x, y, this.vertexRadius - 3, 0, 2 * Math.PI),
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),
7799
8084
  ctx.closePath(), ctx.fill();
7800
8085
  }
7801
8086
  for (let i = 0; i < vertexes.length; i++) {
7802
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;
7803
- ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, this.edgeCentreRadius, 0, 2 * Math.PI),
8088
+ ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, _edgeCentreRadius, 0, 2 * Math.PI),
7804
8089
  ctx.closePath(), ctx.fill();
7805
8090
  }
8091
+ ctx.restore();
8092
+ }
8093
+ render() {
8094
+ this.drawPolygonPath(this.vertexes), this.drawPolygonEdgeCentre(this.vertexes);
7806
8095
  }
7807
8096
  drawPolygon(vertexes, mouseOffset) {
7808
8097
  this.vertexes = vertexes, mouseOffset ? this.drawPolygonPath(vertexes, mouseOffset.x, mouseOffset.y) : (this.drawPolygonPath(vertexes),
7809
8098
  this.drawPolygonEdgeCentre(vertexes));
7810
8099
  }
7811
8100
  pointInVertexes(x, y) {
7812
- 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;
7813
8102
  let aimIndex = null;
7814
8103
  for (let i = 0; i < vertexes.length; i++) {
7815
8104
  const [vertex_x, vertex_y] = vertexes[i];
7816
- if (isPointInCircle(_x, _y, vertex_x, vertex_y, this.vertexRadius)) {
8105
+ if (isPointInCircle(_x, _y, vertex_x, vertex_y, _vertexRadius)) {
7817
8106
  this.canvas.style.cursor = "pointer", aimIndex = i;
7818
8107
  break;
7819
8108
  }
@@ -7822,11 +8111,11 @@ class EditPolygonPath {
7822
8111
  return aimIndex;
7823
8112
  }
7824
8113
  pointInEdgeCentre(x, y) {
7825
- 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;
7826
8115
  let aimIndex = null;
7827
8116
  for (let i = 0; i < vertexes.length; i++) {
7828
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;
7829
- if (isPointInCircle(_x, _y, vertex_x, vertex_y, this.edgeCentreRadius)) {
8118
+ if (isPointInCircle(_x, _y, vertex_x, vertex_y, _edgeCentreRadius)) {
7830
8119
  this.canvas.style.cursor = "pointer", aimIndex = i;
7831
8120
  break;
7832
8121
  }
@@ -7835,9 +8124,9 @@ class EditPolygonPath {
7835
8124
  return aimIndex;
7836
8125
  }
7837
8126
  pointInVertexesOrEdgeCentre(x, y) {
7838
- 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;
7839
8128
  for (let i = 0; i < vertexes.length; i++) {
7840
- const [vertex_x, vertex_y] = vertexes[i], isInVertex = isPointInCircle(_x, _y, vertex_x, vertex_y, this.vertexRadius), start = vertexes[i % vertexes.length], end = vertexes[(i + 1) % vertexes.length], edge_center_x = start[0] + (end[0] - start[0]) / 2, edge_center_y = start[1] + (end[1] - start[1]) / 2, isInEdgeCenter = isPointInCircle(_x, _y, edge_center_x, edge_center_y, this.edgeCentreRadius);
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);
7841
8130
  if (isInVertex || isInEdgeCenter) {
7842
8131
  this.canvas.style.cursor = "pointer";
7843
8132
  break;
@@ -7846,17 +8135,18 @@ class EditPolygonPath {
7846
8135
  }
7847
8136
  }
7848
8137
  notifyObservers() {
7849
- this.observers.forEach((listener => {
8138
+ this.observers.forEach(listener => {
7850
8139
  listener(this.vertexes);
7851
- }));
8140
+ });
7852
8141
  }
7853
8142
  updatePolygon(callback) {
7854
- this.isEditing = !0, this.canvas.addEventListener("mousedown", this.canvasMousedown.bind(this)),
7855
- this.canvas.addEventListener("mouseup", this.canvasMouseup.bind(this)), this.canvas.addEventListener("click", this.canvasMouseClick.bind(this)),
7856
- this.canvas.addEventListener("mousemove", this.canvasMousemove.bind(this)), this.observers.push(callback);
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);
7857
8146
  }
7858
8147
  canvasMousedown(e) {
7859
- e.stopPropagation(), e.preventDefault(), this.canClickEvent = !0;
8148
+ if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
8149
+ this.canClickEvent = !0;
7860
8150
  const {offsetX: x, offsetY: y} = e;
7861
8151
  this.pointRecover = [ x, y ];
7862
8152
  const vertex_i = this.pointInVertexes(x, y);
@@ -7864,13 +8154,13 @@ class EditPolygonPath {
7864
8154
  this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
7865
8155
  const i = this.pointInEdgeCentre(x, y);
7866
8156
  isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ])),
7867
- setTimeout((() => {
8157
+ setTimeout(() => {
7868
8158
  this.canClickEvent = !1;
7869
- }), 200);
8159
+ }, 200);
7870
8160
  }
7871
8161
  canvasMouseup(e) {
7872
- e.stopPropagation(), e.preventDefault();
7873
- let {offsetX: x, offsetY: y} = e;
8162
+ if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
8163
+ let {offsetX: offsetX, offsetY: offsetY} = e, [x, y] = this.getTransformPoint(offsetX, offsetY);
7874
8164
  this.vertexes = vertexesUnique(this.vertexes);
7875
8165
  for (let i = 0; i < this.vertexes.length; i++) {
7876
8166
  const p = this.vertexes[i], radius = Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2);
@@ -7885,7 +8175,7 @@ class EditPolygonPath {
7885
8175
  this.drawPolygon(this.vertexes), this.notifyObservers(), this.notifyEditPolygonObserver();
7886
8176
  }
7887
8177
  canvasMouseClick(e) {
7888
- e.stopPropagation();
8178
+ if (e.stopPropagation(), e.preventDefault(), e.ctrlKey) return;
7889
8179
  const {offsetX: x, offsetY: y} = e;
7890
8180
  if (this.canClickEvent) {
7891
8181
  const i = this.pointInVertexes(x, y);
@@ -7897,126 +8187,208 @@ class EditPolygonPath {
7897
8187
  }
7898
8188
  }
7899
8189
  canvasMousemove(e) {
7900
- e.stopPropagation();
7901
- const {offsetX: x, offsetY: y} = e;
7902
- this.pointInVertexesOrEdgeCentre(x, y), this.isMoveEditing && (this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
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 ]),
7903
8195
  this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
7904
8196
  this.notifyObservers());
7905
8197
  }
7906
8198
  destroy() {
7907
8199
  this.vertexes = [], this.observers = [], this.isEditing = !1, this.canvas.removeEventListener("mousedown", this.canvasMousedown),
7908
- this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("click", this.canvasMouseClick),
7909
- this.canvas.removeEventListener("mousemove", this.canvasMousemove);
8200
+ this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("mousemove", this.canvasMousemove),
8201
+ this.canvas.removeEventListener("click", this.canvasMouseClick);
7910
8202
  }
7911
8203
  }
7912
8204
 
8205
+ const {hexToRgba: hexToRgba} = useChangeColor();
8206
+
7913
8207
  class CreateDrawCanvas {
7914
8208
  canvas;
7915
8209
  ctx;
7916
8210
  image;
7917
8211
  canvasWidth;
7918
8212
  canvasHeight;
7919
- scaleOffset;
8213
+ imageScaleX;
8214
+ imageScaleY;
7920
8215
  labels;
7921
- scaleX;
7922
- scaleY;
8216
+ createPolygon;
7923
8217
  editDrawPolygon;
7924
- createPolygonVertexes;
7925
- editVertexes;
7926
- editPolygonObservers=[];
7927
- drawnPolygonObserver;
8218
+ addVertexes=[];
8219
+ createCompleteSubscribers=new Set;
8220
+ editingShape;
8221
+ editVertexes=[];
8222
+ editingSubscribers=new Set;
7928
8223
  constructor(options) {
7929
- const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, labels: labels, scaleX: scaleX, scaleY: scaleY, scaleOffset: scaleOffset} = options;
8224
+ const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, imageScaleX: imageScaleX, imageScaleY: imageScaleY, labels: labels} = options;
7930
8225
  this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
7931
- this.canvasHeight = canvasHeight, this.scaleOffset = scaleOffset, this.labels = labels || {},
7932
- this.scaleX = scaleX || 1, this.scaleY = scaleY || 1, this.editVertexes = [], this.render(),
7933
- this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx), this.editDrawPolygon = new EditPolygonPath(canvas, ctx),
7934
- this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
7935
- this.render(), this.editDrawPolygon.drawPolygon(vertexes, mouseOffset), this.editVertexes = vertexes,
7936
- this.notifyObservers();
7937
- })), this.createPolygonVertexes.onDestroyed((vertexes => {
7938
- this.editVertexes = vertexes, this.render(), this.editDrawPolygon.drawPolygon(vertexes),
7939
- this.editDrawPolygon.updatePolygon((vertexes => {
7940
- this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editVertexes = vertexes,
7941
- this.notifyObservers();
7942
- })), this.editDrawPolygon.onEditPolygon((vertexes => {
7943
- this.editVertexes = vertexes, this.notifyDrawnPolygonObservers();
7944
- })), this.notifyDrawnPolygonObservers();
7945
- }));
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);
7946
8247
  }
7947
- notifyObservers() {
7948
- this.editPolygonObservers.forEach((listener => {
7949
- listener(this.editVertexes);
7950
- }));
8248
+ subscribeCreateComplete(callback) {
8249
+ this.createCompleteSubscribers.add(callback);
7951
8250
  }
7952
- notifyDrawnPolygonObservers() {
7953
- this.drawnPolygonObserver?.(this.editVertexes);
8251
+ unsubscribeCreateComplete(callback) {
8252
+ this.createCompleteSubscribers.delete(callback);
7954
8253
  }
7955
- updatePolygon(callback) {
7956
- this.editPolygonObservers.push(callback);
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();
7957
8275
  }
7958
- onDrawnPolygon(callback) {
7959
- this.drawnPolygonObserver = callback;
8276
+ closeCreateOrEditor() {
8277
+ this.createPolygon.reset();
7960
8278
  }
7961
- drawPolygons(shapes) {
7962
- const ctx = this.ctx, {scale: scale} = this.scaleOffset.value, scaleX = this.scaleX, scaleY = this.scaleY;
8279
+ drawShapes(shapes) {
8280
+ const ctx = this.ctx, {scale: scale} = getTranslateAndScale(ctx);
7963
8281
  for (let i = 0; i < shapes.length; i++) {
7964
- const item = shapes[i], path = vertexesToScale(item.points, scaleX, scaleY);
7965
- if (!path.length) return;
7966
- const color = colors[i % colors.length];
7967
- ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.strokeStyle = color, ctx.fillStyle = hexToRgba(color, .2);
7968
- const startX = path[0][0], startY = path[0][1];
7969
- ctx.moveTo(startX, startY);
7970
- for (let i = 1; i < path.length; i++) {
7971
- const [x, y] = path[i];
7972
- ctx.lineTo(x, y);
7973
- }
7974
- 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);
7975
8289
  }
7976
8290
  }
7977
- drawCanvas=() => {
7978
- this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.ctx.drawImage(this.image, 0, 0, this.canvasWidth, this.canvasHeight),
7979
- this.ctx.save();
7980
- const shapes = this.labels.shapes;
7981
- shapes?.length && this.drawPolygons(shapes), this.ctx.restore();
7982
- };
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
+ }
7983
8305
  render=() => {
7984
- this.canvas.width = this.canvasWidth, this.scaleOffset.value && (this.ctx.translate(this.scaleOffset.value.x, this.scaleOffset.value.y),
7985
- this.ctx.scale(this.scaleOffset.value.scale, this.scaleOffset.value.scale)), this.drawCanvas();
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();
7986
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
+ }
7987
8366
  destroy() {
7988
- this.labels = {}, this.editDrawPolygon.destroy(), this.createPolygonVertexes.destroy();
8367
+ this.labels = {}, this.editDrawPolygon.destroy(), this.createPolygon.destroy(),
8368
+ this.onEditorEnd();
7989
8369
  }
7990
8370
  }
7991
8371
 
7992
8372
  var CanvasContext = defineComponent({
7993
8373
  props: {
7994
- classes: {
7995
- type: Array,
7996
- default: () => []
7997
- },
7998
8374
  contextClientHeight: {
7999
8375
  type: Number,
8000
8376
  default: null
8001
8377
  },
8002
- rowInfo: {
8378
+ labelInfo: {
8003
8379
  type: Object,
8004
8380
  default: () => ({})
8005
8381
  }
8006
8382
  },
8007
- emits: [ "editPolygon", "changePolygon" ],
8383
+ emits: [ "editPolygon", "changePolygon", "updateLabelInfo" ],
8008
8384
  setup(props, {emit: emit, expose: expose}) {
8009
- const ns = inject("ns", {}), scaleTranslateManager = inject("scaleTranslateManager", {}), mainBasaeRef = ref(), canvasMainRef = ref(), canvasBaseRef = ref(), drawCanvas = ref(), canvasDragZoom = ref(), setContainerWidthHeight = (canvasWidth, canvasHeight) => {
8010
- canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
8011
- canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
8012
- canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
8013
- }, 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 => {
8014
8386
  const ctx = canvasBaseRef.value?.getContext("2d");
8015
8387
  if (rowInfo?.imageSrc) {
8016
8388
  const image = new Image;
8017
8389
  image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
8018
8390
  loadingImage.value = !1;
8019
- const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleFactor: scaleFactor, scaleX: scaleX, scaleY: scaleY, originWidth: originWidth, originHeight: originHeight} = (image => {
8391
+ const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleX: scaleX, scaleY: scaleY, originWidth: originWidth, originHeight: originHeight} = (image => {
8020
8392
  const clientWidth = mainBasaeRef.value?.elementInstance.clientWidth, clientHeight = mainBasaeRef.value?.elementInstance.clientHeight;
8021
8393
  let {width: width, height: height} = image, scaleFactor = 1;
8022
8394
  const aspect_ratio = width / height;
@@ -8042,61 +8414,88 @@ var CanvasContext = defineComponent({
8042
8414
  };
8043
8415
  })(image);
8044
8416
  image.style.width = canvasWidth + "px", image.style.height = canvasHeight + "px",
8045
- setContainerWidthHeight(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
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({
8046
8422
  canvas: canvasBaseRef.value,
8047
8423
  ctx: ctx,
8048
8424
  image: image,
8049
8425
  canvasWidth: canvasWidth,
8050
8426
  canvasHeight: canvasHeight,
8051
- scaleFactor: scaleFactor,
8052
8427
  labels: rowInfo.labels,
8053
- scaleX: scaleX,
8054
- scaleY: scaleY,
8055
- scaleOffset: scaleTranslateManager.scaleTranslate
8056
- }), drawCanvas.value.updatePolygon((vertexes => {
8057
- emit("changePolygon", {
8058
- vertexes: vertexes,
8059
- canvasWidth: canvasWidth,
8060
- canvasHeight: canvasHeight
8061
- });
8062
- })), drawCanvas.value.onDrawnPolygon((vertexes => {
8063
- const new_vertexes = vertexesToScale(vertexes, scaleX, scaleY, !1);
8064
- emit("editPolygon", {
8065
- vertexes: new_vertexes,
8066
- originWidth: originWidth,
8067
- originHeight: originHeight
8068
- });
8069
- })), canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom((scaleOffset => {
8070
- scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawCanvas.value.render();
8071
- }));
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
+ });
8072
8452
  }, image.onerror = () => {
8073
8453
  loadingImage.value = !1;
8074
8454
  };
8075
8455
  }
8076
8456
  };
8077
- onMounted((() => {
8078
- watch((() => props.rowInfo), (info => {
8079
- const rowInfo = toRaw(info);
8080
- renderImageLabel(rowInfo);
8081
- }), {
8082
- deep: !0,
8083
- immediate: !0
8084
- }), watch((() => props.contextClientHeight), (height => {
8085
- if (valueExist(height)) {
8086
- canvasMainRef.value.style.height = height + "px";
8087
- const rowInfo = toRaw(props.rowInfo);
8088
- renderImageLabel(rowInfo);
8089
- }
8090
- }));
8091
- })), 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(() => {
8092
8462
  drawCanvas.value.destroy(), canvasDragZoom.value.destroy();
8093
- }));
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
+ };
8094
8494
  return expose({
8095
8495
  rerenderImage: () => {
8096
- setContainerWidthHeight(0, 0), nextTick((() => {
8097
- const rowInfo = toRaw(props.rowInfo);
8098
- renderImageLabel(rowInfo);
8099
- }));
8496
+ onCloseContentmenuLabel(), nextTick(() => {
8497
+ renderImageLabel(_labelInfo.value);
8498
+ });
8100
8499
  },
8101
8500
  resetScaleOffset: () => {
8102
8501
  canvasDragZoom.value.reset();
@@ -8115,7 +8514,14 @@ var CanvasContext = defineComponent({
8115
8514
  }, [ createVNode("canvas", {
8116
8515
  ref: canvasBaseRef,
8117
8516
  class: [ ns.be("canvas", "context") ]
8118
- }, 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 ]) ]
8119
8525
  }) ]);
8120
8526
  }
8121
8527
  }), HeaderTool = defineComponent({
@@ -8160,64 +8566,10 @@ var CanvasContext = defineComponent({
8160
8566
  "p-id": "4274"
8161
8567
  }, null) ]), createVNode("p", {
8162
8568
  class: "label-text"
8163
- }, [ t("next.labelme.saveLabel") ]) ]), createVNode("li", {
8164
- class: "tool-item"
8165
- }, [ createVNode("svg", {
8166
- t: "1721826305513",
8167
- class: "icon",
8168
- viewBox: "0 0 1025 1024",
8169
- version: "1.1",
8170
- xmlns: "http://www.w3.org/2000/svg",
8171
- "p-id": "6215",
8172
- width: "18",
8173
- height: "18"
8174
- }, [ createVNode("path", {
8175
- 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",
8176
- "p-id": "6216"
8177
- }, null), createVNode("path", {
8178
- 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",
8179
- "p-id": "6217"
8180
- }, null) ]), createVNode("p", {
8181
- class: "label-text"
8182
- }, [ t("next.labelme.createPolygon") ]) ]), createVNode("li", {
8183
- class: "tool-item"
8184
- }, [ createVNode("svg", {
8185
- t: "1721826424613",
8186
- class: "icon",
8187
- viewBox: "0 0 1024 1024",
8188
- version: "1.1",
8189
- xmlns: "http://www.w3.org/2000/svg",
8190
- "p-id": "7356",
8191
- width: "18",
8192
- height: "18"
8193
- }, [ createVNode("path", {
8194
- 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",
8195
- "p-id": "7357"
8196
- }, null) ]), createVNode("p", {
8197
- class: "label-text"
8198
- }, [ t("next.labelme.editPolygon") ]) ]), createVNode("li", {
8199
- class: "tool-item"
8200
- }, [ createVNode("svg", {
8201
- t: "1721826579655",
8202
- class: "icon",
8203
- viewBox: "0 0 1024 1024",
8204
- version: "1.1",
8205
- xmlns: "http://www.w3.org/2000/svg",
8206
- "p-id": "10996",
8207
- width: "18",
8208
- height: "18"
8209
- }, [ createVNode("path", {
8210
- 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",
8211
- "p-id": "10997"
8212
- }, null), createVNode("path", {
8213
- 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",
8214
- "p-id": "10998"
8215
- }, null) ]), createVNode("p", {
8216
- class: "label-text"
8217
- }, [ t("next.labelme.deletePolyton") ]) ]) ]), createVNode("ul", {
8569
+ }, [ t("next.labelme.saveLabel") ]) ]) ]), createVNode("ul", {
8218
8570
  class: [ _ns.be("header", "tool") ]
8219
8571
  }, [ createVNode("li", {
8220
- class: "hover",
8572
+ class: "tool-item",
8221
8573
  onClick: () => scaleTranslateManager.onResetScaleTranslate()
8222
8574
  }, [ createVNode("svg", {
8223
8575
  t: "1725840994827",
@@ -8233,7 +8585,9 @@ var CanvasContext = defineComponent({
8233
8585
  "p-id": "6052"
8234
8586
  }, null) ]), createVNode("span", {
8235
8587
  style: "padding-left: 3px"
8236
- }, [ t("next.labelimg.zoomRestore") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("缩放比例") ]), createVNode("span", null, [ parseInt((100 * scaleTranslate.value.scale).toString()), createTextVNode("%") ]), createVNode("span", {
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", {
8237
8591
  style: "padding: 0 10px;"
8238
8592
  }, [ createTextVNode("偏移量") ]), createVNode("span", {
8239
8593
  style: "min-width: 120px; text-align: left;"
@@ -8258,7 +8612,7 @@ var CanvasContext = defineComponent({
8258
8612
  }) ]),
8259
8613
  default: () => createVNode("ul", {
8260
8614
  style: "font-size: 12px;white-space: nowrap;"
8261
- }, [ 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+左键拖动可以移动图片") ]) ]) ])
8262
8616
  }) ]), props.isFullscreen ? createVNode("li", {
8263
8617
  class: "tool-item",
8264
8618
  onClick: () => switchFillscreen(!1)
@@ -8301,9 +8655,195 @@ var CanvasContext = defineComponent({
8301
8655
  }, null) ]) ]
8302
8656
  }) ]) ]) ]) ]);
8303
8657
  }
8304
- }), defaultConfig = {
8305
- minContentHeight: 500
8306
- };
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
+ });
8307
8847
 
8308
8848
  const ns = useNamespace("labelme");
8309
8849
 
@@ -8333,40 +8873,50 @@ var Element = defineComponent({
8333
8873
  },
8334
8874
  emits: [ "change", "save", "edit-polygon", "change-polygon", "prev-click", "next-click" ],
8335
8875
  setup(props, {emit: emit, slots: slots}) {
8336
- const _config = deepClone(defaultConfig), _options = computed((() => {
8876
+ const _config = deepClone(defaultConfig), _options = computed(() => {
8337
8877
  const cfg = unref(props.options);
8338
8878
  return merge(_config, cfg);
8339
- })), options = unref(_options);
8879
+ }), options = unref(_options);
8340
8880
  provide("ns", ns);
8341
- const {t: t} = useLocale(), activateNodeIndex = ref(0), classes = ref(props.classes), labelImages = ref(deepClone(props.data));
8342
- watch((() => props.data), (data => {
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 => {
8343
8889
  labelImages.value = deepClone(data);
8344
- }), {
8890
+ }, {
8345
8891
  deep: !0
8346
- }), watch((() => props.data.length), (() => {
8892
+ }), watch(() => props.data.length, () => {
8347
8893
  activateNodeIndex.value = 0;
8348
- })), watch((() => props.classes), (val => {
8349
- classes.value = val;
8350
- }), {
8351
- deep: !0
8352
8894
  });
8353
- const currentNode = computed((() => {
8895
+ const currentNode = computed(() => {
8354
8896
  if (!labelImages.value) return {};
8355
8897
  const node = labelImages.value[activateNodeIndex.value] || {};
8356
8898
  return deepClone(node);
8357
- })), loading = ref(!1), mainContentHeight = ref(options.minContentHeight), canvasContextRef = ref(), layoutLabelRef = ref(), headerRef = ref(), mainRef = ref(), footerRef = ref(), updateMainContentHeight = () => {
8358
- nextTick((() => {
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(() => {
8359
8909
  const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
8360
8910
  mainContentHeight.value = contentHeight;
8361
- }));
8911
+ });
8362
8912
  };
8363
- onMounted((() => {
8364
- document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (() => {
8913
+ onMounted(() => {
8914
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, () => {
8365
8915
  updateMainContentHeight();
8366
- })), window.addEventListener("resize", updateMainContentHeight);
8367
- })), onUnmounted((() => {
8916
+ }), window.addEventListener("resize", updateMainContentHeight);
8917
+ }), onUnmounted(() => {
8368
8918
  document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
8369
- }));
8919
+ });
8370
8920
  const onKeydownPrevNext = () => {}, onPaginationPrev = () => {
8371
8921
  const imageLength = labelImages.value.length;
8372
8922
  let i = activateNodeIndex.value - 1;
@@ -8381,20 +8931,20 @@ var Element = defineComponent({
8381
8931
  const node = currentNode.value;
8382
8932
  return emit("save", {
8383
8933
  node: node
8384
- }, (imageItem => {
8934
+ }, imageItem => {
8385
8935
  labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
8386
8936
  loading.value = !1;
8387
- }), (() => {
8937
+ }, () => {
8388
8938
  loading.value = !1;
8389
- })), !0;
8939
+ }), !0;
8390
8940
  }, isFullscreen = ref(!1), onSwitchFillscreen = val => {
8391
- isFullscreen.value = val, updateMainContentHeight(), nextTick((() => {
8941
+ isFullscreen.value = val, updateMainContentHeight(), nextTick(() => {
8392
8942
  canvasContextRef.value.rerenderImage();
8393
- }));
8943
+ });
8394
8944
  }, onChangePolygon = node => {
8395
8945
  currentNode.value.labels = node, emit("change-polygon", node);
8396
- }, onEditPlygon = node => {
8397
- currentNode.value.labels = node, emit("edit-polygon", node);
8946
+ }, onEditPolygon = node => {
8947
+ emit("edit-polygon", node);
8398
8948
  }, onToolHeaderSave = () => {
8399
8949
  onChangeActivateNode(activateNodeIndex.value) || ElMessage({
8400
8950
  type: "info",
@@ -8438,17 +8988,22 @@ var Element = defineComponent({
8438
8988
  }, null) ]), createVNode("div", {
8439
8989
  ref: mainRef,
8440
8990
  class: [ ns.b("main") ]
8441
- }, [ createVNode("div", {
8991
+ }, [ createVNode(LeftTools, null, null), createVNode("div", {
8442
8992
  class: [ ns.be("main", "content") ],
8443
8993
  style: {
8444
8994
  height: mainContentHeight.value + "px"
8445
8995
  }
8446
8996
  }, [ createVNode(CanvasContext, {
8447
8997
  ref: canvasContextRef,
8448
- rowInfo: currentNode.value,
8449
- onEditPolygon: onEditPlygon,
8450
- onChangePolygon: onChangePolygon
8451
- }, null) ]) ]), createVNode("footer", {
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", {
8452
9007
  ref: footerRef,
8453
9008
  class: [ ns.b("footer") ]
8454
9009
  }, [ createVNode("div", {
@@ -8464,7 +9019,7 @@ var Element = defineComponent({
8464
9019
  }, [ createVNode(ElScrollbar, null, {
8465
9020
  default: () => [ createVNode("ul", {
8466
9021
  class: [ ns.bem("footer", "center", "list") ]
8467
- }, [ labelImages.value.map(((item, index) => createVNode("li", {
9022
+ }, [ labelImages.value.map((item, index) => createVNode("li", {
8468
9023
  key: index,
8469
9024
  onClick: () => onChangeActivateNode(index),
8470
9025
  class: {
@@ -8477,7 +9032,7 @@ var Element = defineComponent({
8477
9032
  "max-scale": 2,
8478
9033
  "min-scale": .2,
8479
9034
  fit: "cover"
8480
- }, null) ]))) ]) ]
9035
+ }, null) ])) ]) ]
8481
9036
  }) ]), createVNode("div", {
8482
9037
  class: [ ns.be("footer", "right") ]
8483
9038
  }, [ createVNode(ElIcon, {
@@ -8526,7 +9081,7 @@ const zoomDialog = app => {
8526
9081
  var value;
8527
9082
  zoomDomBindData[1] = zoomDomBindData[1] ? zoomDomBindData[1] : ".el-dialog__body",
8528
9083
  zoomDomBindData[2] = void 0 !== zoomDomBindData[2] && zoomDomBindData[2], zoomDomBindData[3] = void 0 === zoomDomBindData[3] || zoomDomBindData[3],
8529
- nextTick((() => {
9084
+ nextTick(() => {
8530
9085
  const zoomDom = document.querySelector(zoomDomBindData[1]), zoomDomBox = document.querySelector(zoomDomBindData[0]), zoomHandleEl = document.createElement("div");
8531
9086
  zoomHandleEl.className = "dialog-zoom", zoomHandleEl.onmouseenter = () => {
8532
9087
  zoomHandleEl.onmousedown = e => {
@@ -8547,23 +9102,23 @@ const zoomDialog = app => {
8547
9102
  };
8548
9103
  };
8549
9104
  }, zoomDomBox.appendChild(zoomHandleEl);
8550
- }));
9105
+ });
8551
9106
  }
8552
9107
  });
8553
- }, configProviderContextKey = Symbol("configProviderContextKey"), version = "0.5.10", install = function(app, options) {
8554
- if (Object.keys(components).forEach((key => {
9108
+ }, configProviderContextKey = Symbol("configProviderContextKey"), version = "0.6.0", install = function(app, options) {
9109
+ if (Object.keys(components).forEach(key => {
8555
9110
  const component = components[key];
8556
9111
  app.component(component.name, component);
8557
- })), (app => {
9112
+ }), (app => {
8558
9113
  zoomDialog(app);
8559
9114
  })(app), options) {
8560
9115
  const inSetup = !!getCurrentInstance();
8561
- (app?.provide ?? (inSetup ? provide : void 0))(configProviderContextKey, computed((() => options)));
9116
+ (app?.provide ?? (inSetup ? provide : void 0))(configProviderContextKey, computed(() => options));
8562
9117
  }
8563
9118
  };
8564
9119
 
8565
9120
  var index = {
8566
- version: "0.5.10",
9121
+ version: "0.6.0",
8567
9122
  install: install
8568
9123
  };
8569
9124