next-element-vue 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -2,8 +2,8 @@
2
2
  /**
3
3
  * 作  者:huangteng
4
4
  * 邮  箱:htengweb@163.com
5
- * 当前版本:0.3.3 v
6
- * 发布日期:2024-07-23
5
+ * 当前版本:0.3.5 v
6
+ * 发布日期:2024-09-03
7
7
  * 地  址:https://www.npmjs.com/package/next-element-vue
8
8
  */
9
9
 
@@ -798,6 +798,12 @@
798
798
  saveLabel: "保存当前标注",
799
799
  instructions: "使用说明",
800
800
  labelNoUpdate: "暂无标签数据更新"
801
+ },
802
+ labelme: {
803
+ saveLabel: "保存",
804
+ createPolygon: "创建多边形",
805
+ editPolygon: "编辑多边形",
806
+ deletePolyton: "删除多边形"
801
807
  }
802
808
  }
803
809
  }, enLocale = {
@@ -876,6 +882,12 @@
876
882
  saveLabel: "save label",
877
883
  instructions: "instructions",
878
884
  labelNoUpdate: "No label data update"
885
+ },
886
+ labelme: {
887
+ saveLabel: "saving...",
888
+ createPolygon: "create polygon",
889
+ editPolygon: "edit polygon",
890
+ deletePolyton: "delete polygon"
879
891
  }
880
892
  }
881
893
  }, zhtwLocale = {
@@ -954,6 +966,9 @@
954
966
  saveLabel: "保存当前标注",
955
967
  instructions: "使用说明",
956
968
  labelNoUpdate: "暂无标签数据更新"
969
+ },
970
+ labelme: {
971
+ saveLabel: "保存"
957
972
  }
958
973
  }
959
974
  };
@@ -3289,7 +3304,7 @@
3289
3304
  return start.setTime(start.getTime() - 94608e6), [ start, end ];
3290
3305
  }
3291
3306
  } ], _onChangeNumberRange = (value, key) => {
3292
- formParams.value[key] = value;
3307
+ formParams[key] = value;
3293
3308
  }, renderColItemContent = col => {
3294
3309
  const _disabled = valueExist(col.searchDisabled, col.disabled, !1);
3295
3310
  if (slots[searchFormSlotName(col.prop)]) return slots[searchFormSlotName(col.prop)]({
@@ -3320,7 +3335,7 @@
3320
3335
  placeholder: placeholder,
3321
3336
  onInput: e => ((val, key) => {
3322
3337
  const value = val.replace(/\D/g, "");
3323
- formParams.value[key] = value;
3338
+ formParams[key] = value;
3324
3339
  })(e, col.prop)
3325
3340
  }, {
3326
3341
  prefix: col.prefix ? () => col.prefix(formParams, col) : null,
@@ -3341,7 +3356,7 @@
3341
3356
  let value = val;
3342
3357
  value = value.replace(/[^0-9\.]/g, ""), value = value.replace(/^\./, "0."), value = value.replace(/\.{2,}/g, "."),
3343
3358
  value = value.replace(".", "DUMMY"), value = value.replace(/\./g, ""), value = value.replace("DUMMY", "."),
3344
- formParams.value[key] = value;
3359
+ formParams[key] = value;
3345
3360
  })(e, col.prop)
3346
3361
  }, {
3347
3362
  prefix: col.prefix ? () => col.prefix(formParams, col) : null,
@@ -3352,7 +3367,7 @@
3352
3367
  }
3353
3368
  if ("select" === col.type) {
3354
3369
  const placeholder = t("next.form.select") + (col.searchPlaceholder || col.searchLabel || col.label);
3355
- return vue.createVNode(elementPlus.ElSelect, {
3370
+ return !formParams[col.prop] && col.multiple && (formParams[col.prop] = []), vue.createVNode(elementPlus.ElSelect, {
3356
3371
  modelValue: formParams[col.prop],
3357
3372
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
3358
3373
  clearable: !0,
@@ -6845,21 +6860,31 @@
6845
6860
  this.destroyedObservers = callback;
6846
6861
  }
6847
6862
  canvasMouseClick(e) {
6848
- e.stopPropagation(), this.isDrawing = !0, this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
6849
- this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes);
6863
+ e.stopPropagation(), this.isDrawing = !0, this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY;
6864
+ const [x, y] = [ e.offsetX, e.offsetY ];
6865
+ let is_add = !0;
6866
+ for (let i = 0; i < this.vertexes.length; i++) {
6867
+ const p = this.vertexes[i];
6868
+ if (Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2) < 8) {
6869
+ is_add = !1;
6870
+ break;
6871
+ }
6872
+ }
6873
+ is_add && this.vertexes.push([ x, y ]), this.vertexes = vertexesUnique(this.vertexes);
6850
6874
  }
6851
6875
  canvasMousemove(e) {
6852
6876
  e.stopPropagation(), this.isDrawing && (this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
6853
6877
  this.canvas.style.cursor = "crosshair");
6854
6878
  }
6855
6879
  canvasMouseDblclick(e) {
6856
- e.stopPropagation(), this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
6857
- this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes),
6880
+ e.stopPropagation(), this.isDrawing && (this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
6881
+ this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes)),
6858
6882
  this.notifyDestryedListerers(), this.destroyed();
6859
6883
  }
6860
6884
  destroyed() {
6861
- this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.canvas.removeEventListener("click", this.canvasMouseClick),
6862
- this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
6885
+ this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.destroyedObservers = () => {
6886
+ this.canvas.removeEventListener("click", this.canvasMouseClick);
6887
+ }, this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
6863
6888
  }
6864
6889
  }
6865
6890
  class EditPolygonPath {
@@ -6873,11 +6898,12 @@
6873
6898
  pointCentreIndex;
6874
6899
  vertexRadius;
6875
6900
  edgeCentreRadius;
6901
+ pointRecover;
6876
6902
  observers=[];
6877
6903
  constructor(canvas, ctx) {
6878
6904
  this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
6879
6905
  this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
6880
- this.vertexRadius = 8, this.edgeCentreRadius = 5;
6906
+ this.vertexRadius = 8, this.edgeCentreRadius = 5, this.pointRecover = [];
6881
6907
  }
6882
6908
  drawPolygonPath(vertexes, mouseX, mouseY) {
6883
6909
  const ctx = this.ctx;
@@ -6959,30 +6985,36 @@
6959
6985
  canvasMousedown(e) {
6960
6986
  e.stopPropagation(), e.preventDefault(), this.canClickEvent = !0;
6961
6987
  const {offsetX: x, offsetY: y} = e;
6962
- if (this.isEditing) {
6963
- const vertex_i = this.pointInVertexes(x, y);
6964
- isValueExist(vertex_i) && (this.isMoveEditing = !0, this.pointVertexIndex = vertex_i,
6965
- this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
6966
- const i = this.pointInEdgeCentre(x, y);
6967
- isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ]));
6968
- }
6988
+ this.pointRecover = [ x, y ];
6989
+ const vertex_i = this.pointInVertexes(x, y);
6990
+ isValueExist(vertex_i) && (this.isMoveEditing = !0, this.pointVertexIndex = vertex_i,
6991
+ this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
6992
+ const i = this.pointInEdgeCentre(x, y);
6993
+ isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ])),
6969
6994
  setTimeout((() => {
6970
6995
  this.canClickEvent = !1;
6971
6996
  }), 200);
6972
6997
  }
6973
6998
  canvasMouseup(e) {
6974
6999
  e.stopPropagation(), e.preventDefault();
6975
- const {offsetX: x, offsetY: y} = e;
7000
+ let {offsetX: x, offsetY: y} = e;
7001
+ this.vertexes = vertexesUnique(this.vertexes);
7002
+ for (let i = 0; i < this.vertexes.length; i++) {
7003
+ const p = this.vertexes[i], radius = Math.sqrt((x - p[0]) ** 2 + (y - p[1]) ** 2);
7004
+ if (radius < 8 && radius > 0 && this.pointRecover.length) {
7005
+ x = this.pointRecover[0], y = this.pointRecover[1], this.pointRecover = [];
7006
+ break;
7007
+ }
7008
+ }
6976
7009
  this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
6977
7010
  this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
6978
7011
  this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
6979
- this.notifyObservers();
7012
+ this.drawPolygon(this.vertexes), this.notifyObservers();
6980
7013
  }
6981
7014
  canvasMouseClick(e) {
6982
7015
  e.stopPropagation();
6983
7016
  const {offsetX: x, offsetY: y} = e;
6984
- if (this.isEditing && this.canClickEvent) {
6985
- e.stopImmediatePropagation();
7017
+ if (this.canClickEvent) {
6986
7018
  const i = this.pointInVertexes(x, y);
6987
7019
  if (isValueExist(i)) {
6988
7020
  if (this.vertexes.length <= 3) return;
@@ -7018,8 +7050,8 @@
7018
7050
  const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, paths: paths} = options;
7019
7051
  this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
7020
7052
  this.canvasHeight = canvasHeight, this.paths = paths || [], this.editVertexes = [],
7021
- this.render(), this.editDrawPolygon = new EditPolygonPath(canvas, ctx), this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx),
7022
- this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
7053
+ this.render(), this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx),
7054
+ this.editDrawPolygon = new EditPolygonPath(canvas, ctx), this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
7023
7055
  this.render(), this.editDrawPolygon.drawPolygon(vertexes, mouseOffset), this.editVertexes = vertexes,
7024
7056
  this.notifyObservers();
7025
7057
  })), this.createPolygonVertexes.onDestroyed((vertexes => {
@@ -7079,8 +7111,12 @@
7079
7111
  }
7080
7112
  },
7081
7113
  emits: [ "editPolygon" ],
7082
- setup(props, {emit: emit}) {
7083
- const ns = vue.inject("ns", {}), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
7114
+ setup(props, {emit: emit, expose: expose}) {
7115
+ const ns = vue.inject("ns", {}), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), setContainerWidthHeight = (canvasWidth, canvasHeight) => {
7116
+ canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
7117
+ canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
7118
+ canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
7119
+ }, loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
7084
7120
  const clientHeight = canvasMainRef.value?.clientHeight, ctx = canvasBaseRef.value?.getContext("2d");
7085
7121
  if (rowInfo?.imageSrc) {
7086
7122
  const image = new Image;
@@ -7092,11 +7128,7 @@
7092
7128
  height = clientHeight, image.style.height = height + "px", width /= scale;
7093
7129
  }
7094
7130
  const canvasHeight = height, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
7095
- ((canvasWidth, canvasHeight) => {
7096
- canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
7097
- canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
7098
- canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
7099
- })(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
7131
+ setContainerWidthHeight(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
7100
7132
  canvas: canvasBaseRef.value,
7101
7133
  ctx: ctx,
7102
7134
  image: image,
@@ -7131,9 +7163,19 @@
7131
7163
  }
7132
7164
  }));
7133
7165
  }));
7134
- return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
7166
+ return expose({
7167
+ rerenderImage: () => {
7168
+ setContainerWidthHeight(0, 0), vue.nextTick((() => {
7169
+ const rowInfo = vue.toRaw(props.rowInfo);
7170
+ renderImageLabel(rowInfo);
7171
+ }));
7172
+ }
7173
+ }), () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
7135
7174
  loading: loadingImage.value,
7136
- class: [ ns.b("loading") ]
7175
+ class: [ ns.b("loading") ],
7176
+ style: {
7177
+ height: "100%"
7178
+ }
7137
7179
  }, {
7138
7180
  default: () => [ vue.createVNode("div", {
7139
7181
  ref: canvasMainRef,
@@ -7144,11 +7186,173 @@
7144
7186
  }, null) ]) ]
7145
7187
  }) ]);
7146
7188
  }
7189
+ }), HeaderTool = vue.defineComponent({
7190
+ props: {
7191
+ isFullscreen: {
7192
+ type: Boolean,
7193
+ default: !1
7194
+ },
7195
+ imageIndex: {
7196
+ type: Number,
7197
+ default: 0
7198
+ },
7199
+ imageLength: {
7200
+ type: Number,
7201
+ default: 0
7202
+ }
7203
+ },
7204
+ emits: [ "fullscreen", "save" ],
7205
+ setup(props, {emit: emit}) {
7206
+ const _ns = vue.inject("ns", {}), {t: t} = useLocale(), switchFillscreen = val => {
7207
+ emit("fullscreen", val);
7208
+ };
7209
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", {
7210
+ class: [ _ns.be("header", "tool") ]
7211
+ }, [ vue.createVNode("li", {
7212
+ class: "tool-item",
7213
+ onClick: () => emit("save")
7214
+ }, [ vue.createVNode("svg", {
7215
+ t: "1719034799379",
7216
+ class: "icon",
7217
+ viewBox: "0 0 1024 1024",
7218
+ version: "1.1",
7219
+ xmlns: "http://www.w3.org/2000/svg",
7220
+ "p-id": "4272",
7221
+ width: "18",
7222
+ height: "18"
7223
+ }, [ vue.createVNode("path", {
7224
+ d: "M831.4 252.2L711.5 132.4c-10.3-10.3-24.2-16.1-38.8-16.1h-450c-23.3 0-42.2 18.9-42.2 42.2v709.4c0 23.3 18.9 42.2 42.2 42.2h582.6c23.3 0 42.2-18.9 42.2-42.2V291c-0.1-14.5-5.8-28.5-16.1-38.8zM619.6 159v159.8c0 4-3.3 7.3-7.3 7.3H387.2c-4 0-7.3-3.3-7.3-7.3V159h239.7z m67.7 708.4H340.8v-292c0-3.9 3.2-7.1 7.1-7.1h332.4c3.9 0 7.1 3.2 7.1 7.1v292z m117.4 0H730v-292c0-27.5-22.3-49.8-49.8-49.8H347.8c-27.5 0-49.8 22.3-49.8 49.8v292h-74.7V159.1h113.9v159.8c0 27.6 22.4 50.1 50.1 50.1h225.1c27.6 0 50.1-22.4 50.1-50.1V159h10.4c3.2 0 6.3 1.3 8.6 3.6l119.9 119.9c2.3 2.3 3.6 5.3 3.6 8.6l-0.3 576.3z",
7225
+ "p-id": "4273"
7226
+ }, null), vue.createVNode("path", {
7227
+ d: "M536 196.3h42.7v87.2H536zM368.7 641.2h220.7v42.7H368.7zM368.7 744h170.9v42.7H368.7z",
7228
+ "p-id": "4274"
7229
+ }, null) ]), vue.createVNode("p", {
7230
+ class: "label-text"
7231
+ }, [ t("next.labelme.saveLabel") ]) ]), vue.createVNode("li", {
7232
+ class: "tool-item"
7233
+ }, [ vue.createVNode("svg", {
7234
+ t: "1721826305513",
7235
+ class: "icon",
7236
+ viewBox: "0 0 1025 1024",
7237
+ version: "1.1",
7238
+ xmlns: "http://www.w3.org/2000/svg",
7239
+ "p-id": "6215",
7240
+ width: "18",
7241
+ height: "18"
7242
+ }, [ vue.createVNode("path", {
7243
+ 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",
7244
+ "p-id": "6216"
7245
+ }, null), vue.createVNode("path", {
7246
+ 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",
7247
+ "p-id": "6217"
7248
+ }, null) ]), vue.createVNode("p", {
7249
+ class: "label-text"
7250
+ }, [ t("next.labelme.createPolygon") ]) ]), vue.createVNode("li", {
7251
+ class: "tool-item"
7252
+ }, [ vue.createVNode("svg", {
7253
+ t: "1721826424613",
7254
+ class: "icon",
7255
+ viewBox: "0 0 1024 1024",
7256
+ version: "1.1",
7257
+ xmlns: "http://www.w3.org/2000/svg",
7258
+ "p-id": "7356",
7259
+ width: "18",
7260
+ height: "18"
7261
+ }, [ vue.createVNode("path", {
7262
+ 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",
7263
+ "p-id": "7357"
7264
+ }, null) ]), vue.createVNode("p", {
7265
+ class: "label-text"
7266
+ }, [ t("next.labelme.editPolygon") ]) ]), vue.createVNode("li", {
7267
+ class: "tool-item"
7268
+ }, [ vue.createVNode("svg", {
7269
+ t: "1721826579655",
7270
+ class: "icon",
7271
+ viewBox: "0 0 1024 1024",
7272
+ version: "1.1",
7273
+ xmlns: "http://www.w3.org/2000/svg",
7274
+ "p-id": "10996",
7275
+ width: "18",
7276
+ height: "18"
7277
+ }, [ vue.createVNode("path", {
7278
+ 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",
7279
+ "p-id": "10997"
7280
+ }, null), vue.createVNode("path", {
7281
+ 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",
7282
+ "p-id": "10998"
7283
+ }, null) ]), vue.createVNode("p", {
7284
+ class: "label-text"
7285
+ }, [ t("next.labelme.deletePolyton") ]) ]) ]), vue.createVNode("ul", {
7286
+ class: [ _ns.be("header", "tool") ]
7287
+ }, [ props.imageLength ? vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("第 "), props.imageIndex + 1, vue.createTextVNode(" 张") ]), vue.createVNode("em", {
7288
+ style: "padding: 0 5px;"
7289
+ }, [ vue.createTextVNode("/") ]), vue.createVNode("span", null, [ vue.createTextVNode("共 "), props.imageLength, vue.createTextVNode(" 张") ]) ]) : null, vue.createVNode("li", {
7290
+ style: "margin-right: 30px;",
7291
+ class: "tool-item"
7292
+ }, [ vue.createVNode(elementPlus.ElPopover, {
7293
+ trigger: "hover",
7294
+ placement: "bottom",
7295
+ width: "none"
7296
+ }, {
7297
+ reference: () => vue.createVNode("div", {
7298
+ class: "flex-center"
7299
+ }, [ vue.createVNode("span", {
7300
+ style: "padding-right: 3px"
7301
+ }, [ t("next.labelimg.instructions") ]), vue.createVNode(elementPlus.ElIcon, {
7302
+ size: 14
7303
+ }, {
7304
+ default: () => [ vue.createVNode(warning_default, null, null) ]
7305
+ }) ]),
7306
+ default: () => vue.createVNode("ul", {
7307
+ style: "font-size: 12px;white-space: nowrap;"
7308
+ }, [ vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("A:") ]), vue.createVNode("span", null, [ vue.createTextVNode("A键进入上一张图片进行标注") ]) ]), vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("D:") ]), vue.createVNode("span", null, [ vue.createTextVNode("D键进入下一张图片进行标注") ]) ]) ])
7309
+ }) ]), props.isFullscreen ? vue.createVNode("li", {
7310
+ class: "tool-item",
7311
+ onClick: () => switchFillscreen(!1)
7312
+ }, [ vue.createVNode(elementPlus.ElTooltip, {
7313
+ placement: "top",
7314
+ content: "取消全屏"
7315
+ }, {
7316
+ default: () => [ vue.createVNode("svg", {
7317
+ t: "1719035442027",
7318
+ class: "icon",
7319
+ viewBox: "0 0 1024 1024",
7320
+ version: "1.1",
7321
+ xmlns: "http://www.w3.org/2000/svg",
7322
+ "p-id": "5388",
7323
+ width: "18",
7324
+ height: "18"
7325
+ }, [ vue.createVNode("path", {
7326
+ d: "M354.133333 682.666667H256v-42.666667h170.666667v170.666667H384v-98.133334L243.2 853.333333l-29.866667-29.866666L354.133333 682.666667z m358.4 0l140.8 140.8-29.866666 29.866666-140.8-140.8V810.666667h-42.666667v-170.666667h170.666667v42.666667h-98.133334zM354.133333 384L213.333333 243.2l29.866667-29.866667L384 354.133333V256h42.666667v170.666667H256V384h98.133333z m358.4 0H810.666667v42.666667h-170.666667V256h42.666667v98.133333L823.466667 213.333333l29.866666 29.866667L712.533333 384z",
7327
+ "p-id": "5389"
7328
+ }, null) ]) ]
7329
+ }) ]) : vue.createVNode("li", {
7330
+ class: "tool-item",
7331
+ onClick: () => switchFillscreen(!0)
7332
+ }, [ vue.createVNode(elementPlus.ElTooltip, {
7333
+ placement: "top",
7334
+ content: "全屏"
7335
+ }, {
7336
+ default: () => [ vue.createVNode("svg", {
7337
+ t: "1719035375323",
7338
+ class: "icon",
7339
+ viewBox: "0 0 1024 1024",
7340
+ version: "1.1",
7341
+ xmlns: "http://www.w3.org/2000/svg",
7342
+ "p-id": "5241",
7343
+ width: "18",
7344
+ height: "18"
7345
+ }, [ vue.createVNode("path", {
7346
+ d: "M285.866667 810.666667H384v42.666666H213.333333v-170.666666h42.666667v98.133333l128-128 29.866667 29.866667-128 128z m494.933333 0l-128-128 29.866667-29.866667 128 128V682.666667h42.666666v170.666666h-170.666666v-42.666666h98.133333zM285.866667 256l128 128-29.866667 29.866667-128-128V384H213.333333V213.333333h170.666667v42.666667H285.866667z m494.933333 0H682.666667V213.333333h170.666666v170.666667h-42.666666V285.866667l-128 128-29.866667-29.866667 128-128z",
7347
+ "p-id": "5242"
7348
+ }, null) ]) ]
7349
+ }) ]) ]) ]) ]);
7350
+ }
7147
7351
  }), defaultConfig = {
7148
7352
  minContentHeight: 500
7149
7353
  };
7150
7354
  const ns = useNamespace("labelme");
7151
- const NextLabelme = withInstall(vue.defineComponent({
7355
+ var Element = vue.defineComponent({
7152
7356
  name: "NextLabelme",
7153
7357
  props: {
7154
7358
  className: {
@@ -7172,14 +7376,14 @@
7172
7376
  default: () => []
7173
7377
  }
7174
7378
  },
7175
- emits: [ "change", "edit-polygon" ],
7176
- setup(props, {emit: emit}) {
7379
+ emits: [ "change", "save", "edit-polygon", "prev-click", "next-click" ],
7380
+ setup(props, {emit: emit, slots: slots}) {
7177
7381
  const _config = deepClone(defaultConfig), _options = vue.computed((() => {
7178
7382
  const cfg = vue.unref(props.options);
7179
7383
  return merge$1(_config, cfg);
7180
7384
  })), options = vue.unref(_options);
7181
- vue.provide("ns", ns), useLocale();
7182
- const activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes), labelImages = vue.ref(deepClone(props.data));
7385
+ vue.provide("ns", ns);
7386
+ const {t: t} = useLocale(), activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes), labelImages = vue.ref(deepClone(props.data));
7183
7387
  vue.watch((() => props.data), (data => {
7184
7388
  labelImages.value = deepClone(data);
7185
7389
  }), {
@@ -7195,28 +7399,122 @@
7195
7399
  if (!labelImages.value) return {};
7196
7400
  const node = labelImages.value[activateNodeIndex.value] || {};
7197
7401
  return deepClone(node);
7198
- })), mainContentHeight = vue.ref(options.minContentHeight), mainRef = vue.ref(), isFullscreen = vue.ref(!1), onEditPlygonChange = plygon => {
7402
+ })), loading = vue.ref(!1), mainContentHeight = vue.ref(options.minContentHeight), canvasContextRef = vue.ref(), layoutLabelRef = vue.ref(), headerRef = vue.ref(), mainRef = vue.ref(), footerRef = vue.ref(), updateMainContentHeight = () => {
7403
+ vue.nextTick((() => {
7404
+ const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
7405
+ mainContentHeight.value = contentHeight;
7406
+ }));
7407
+ };
7408
+ vue.onMounted((() => {
7409
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (() => {
7410
+ updateMainContentHeight();
7411
+ })), window.addEventListener("resize", updateMainContentHeight);
7412
+ })), vue.onUnmounted((() => {
7413
+ document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
7414
+ }));
7415
+ const onKeydownPrevNext = () => {}, onPaginationPrev = () => {
7416
+ const imageLength = labelImages.value.length;
7417
+ let i = activateNodeIndex.value - 1;
7418
+ i < 0 && (i = imageLength - 1), onChangeActivateNode(i), emit("prev-click");
7419
+ }, onPaginationNext = () => {
7420
+ const imageLength = labelImages.value.length;
7421
+ let i = activateNodeIndex.value + 1;
7422
+ i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
7423
+ }, onChangeActivateNode = index => {
7424
+ if (loading.value) return;
7425
+ loading.value = !0;
7426
+ const node = currentNode.value;
7427
+ emit("save", {
7428
+ node: node
7429
+ }, (imageItem => {
7430
+ labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
7431
+ loading.value = !1;
7432
+ }), (() => {
7433
+ loading.value = !1;
7434
+ }));
7435
+ }, isFullscreen = vue.ref(!1), onSwitchFillscreen = val => {
7436
+ isFullscreen.value = val, updateMainContentHeight(), vue.nextTick((() => {
7437
+ canvasContextRef.value.rerenderImage();
7438
+ }));
7439
+ }, onEditPlygonChange = plygon => {
7199
7440
  emit("edit-polygon", plygon);
7200
7441
  };
7201
7442
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
7443
+ ref: layoutLabelRef,
7202
7444
  class: [ ns.b(), props.className, isFullscreen.value ? ns.b("fullscreen") : "" ],
7203
7445
  style: {
7204
7446
  ...props.style
7205
7447
  }
7206
- }, [ vue.createVNode("div", {
7207
- ref: mainRef,
7208
- class: [ ns.b("main") ]
7209
- }, [ vue.createVNode("div", {
7210
- class: [ ns.be("main", "content") ],
7211
- style: {
7212
- height: mainContentHeight.value + "px"
7213
- }
7214
- }, [ vue.createVNode(CanvasContext, {
7215
- rowInfo: currentNode.value,
7216
- onEditPolygon: onEditPlygonChange
7217
- }, null) ]) ]) ]) ]);
7448
+ }, [ vue.createVNode(NextSpinLoading, {
7449
+ loading: loading.value,
7450
+ tip: t("next.labelimg.saveTxt"),
7451
+ class: [ ns.b("loading") ]
7452
+ }, {
7453
+ default: () => [ vue.createVNode(elementPlus.ElScrollbar, null, {
7454
+ default: () => [ vue.createVNode("header", {
7455
+ ref: headerRef,
7456
+ class: [ ns.b("header") ]
7457
+ }, [ slots.header ? slots.header() : vue.createVNode(HeaderTool, {
7458
+ isFullscreen: isFullscreen.value,
7459
+ imageIndex: activateNodeIndex.value,
7460
+ imageLength: labelImages.value.length,
7461
+ onFullscreen: onSwitchFillscreen
7462
+ }, null) ]), vue.createVNode("div", {
7463
+ ref: mainRef,
7464
+ class: [ ns.b("main") ]
7465
+ }, [ vue.createVNode("div", {
7466
+ class: [ ns.be("main", "content") ],
7467
+ style: {
7468
+ height: mainContentHeight.value + "px"
7469
+ }
7470
+ }, [ vue.createVNode(CanvasContext, {
7471
+ ref: canvasContextRef,
7472
+ rowInfo: currentNode.value,
7473
+ onEditPolygon: onEditPlygonChange
7474
+ }, null) ]) ]), vue.createVNode("footer", {
7475
+ ref: footerRef,
7476
+ class: [ ns.b("footer") ]
7477
+ }, [ vue.createVNode("div", {
7478
+ class: [ ns.be("footer", "left") ]
7479
+ }, [ vue.createVNode(elementPlus.ElIcon, {
7480
+ size: 24,
7481
+ color: "#797979",
7482
+ onClick: onPaginationPrev
7483
+ }, {
7484
+ default: () => [ vue.createVNode(arrow_left_default, null, null) ]
7485
+ }) ]), vue.createVNode("div", {
7486
+ class: [ ns.be("footer", "center") ]
7487
+ }, [ vue.createVNode(elementPlus.ElScrollbar, null, {
7488
+ default: () => [ vue.createVNode("ul", {
7489
+ class: [ ns.bem("footer", "center", "list") ]
7490
+ }, [ labelImages.value.map(((item, index) => vue.createVNode("li", {
7491
+ key: index,
7492
+ onClick: () => onChangeActivateNode(index),
7493
+ class: {
7494
+ "is-activate": activateNodeIndex.value === index
7495
+ }
7496
+ }, [ vue.createVNode(elementPlus.ElImage, {
7497
+ style: "height: 100%",
7498
+ src: item.imageSrc,
7499
+ "zoom-rate": 1.2,
7500
+ "max-scale": 2,
7501
+ "min-scale": .2,
7502
+ fit: "cover"
7503
+ }, null) ]))) ]) ]
7504
+ }) ]), vue.createVNode("div", {
7505
+ class: [ ns.be("footer", "right") ]
7506
+ }, [ vue.createVNode(elementPlus.ElIcon, {
7507
+ size: 24,
7508
+ color: "#797979",
7509
+ onClick: onPaginationNext
7510
+ }, {
7511
+ default: () => [ vue.createVNode(arrow_right_default, null, null) ]
7512
+ }) ]) ]) ]
7513
+ }) ]
7514
+ }) ]) ]);
7218
7515
  }
7219
- }));
7516
+ });
7517
+ const NextLabelme = withInstall(Element);
7220
7518
  var components = Object.freeze({
7221
7519
  __proto__: null,
7222
7520
  NextContainer: NextContainer,
@@ -7278,7 +7576,7 @@
7278
7576
  })(app);
7279
7577
  };
7280
7578
  var index = {
7281
- version: "0.3.3",
7579
+ version: "0.3.5",
7282
7580
  install: install
7283
7581
  };
7284
7582
  exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
@@ -7325,7 +7623,7 @@
7325
7623
  }), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
7326
7624
  const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
7327
7625
  localeRef.value.name = lang, localeRef.value.next = nextLang.next;
7328
- }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.3",
7626
+ }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.5",
7329
7627
  Object.defineProperty(exports, "__esModule", {
7330
7628
  value: !0
7331
7629
  });