next-element-vue 0.3.3 → 0.3.4

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.4 v
6
+ * 发布日期:2024-08-10
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,
@@ -6853,13 +6868,14 @@
6853
6868
  this.canvas.style.cursor = "crosshair");
6854
6869
  }
6855
6870
  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),
6871
+ e.stopPropagation(), this.isDrawing && (this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
6872
+ this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes)),
6858
6873
  this.notifyDestryedListerers(), this.destroyed();
6859
6874
  }
6860
6875
  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);
6876
+ this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.destroyedObservers = () => {
6877
+ this.canvas.removeEventListener("click", this.canvasMouseClick);
6878
+ }, this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
6863
6879
  }
6864
6880
  }
6865
6881
  class EditPolygonPath {
@@ -6958,14 +6974,11 @@
6958
6974
  }
6959
6975
  canvasMousedown(e) {
6960
6976
  e.stopPropagation(), e.preventDefault(), this.canClickEvent = !0;
6961
- 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
- }
6977
+ const {offsetX: x, offsetY: y} = e, vertex_i = this.pointInVertexes(x, y);
6978
+ isValueExist(vertex_i) && (this.isMoveEditing = !0, this.pointVertexIndex = vertex_i,
6979
+ this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
6980
+ const i = this.pointInEdgeCentre(x, y);
6981
+ isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ])),
6969
6982
  setTimeout((() => {
6970
6983
  this.canClickEvent = !1;
6971
6984
  }), 200);
@@ -6981,8 +6994,7 @@
6981
6994
  canvasMouseClick(e) {
6982
6995
  e.stopPropagation();
6983
6996
  const {offsetX: x, offsetY: y} = e;
6984
- if (this.isEditing && this.canClickEvent) {
6985
- e.stopImmediatePropagation();
6997
+ if (this.canClickEvent) {
6986
6998
  const i = this.pointInVertexes(x, y);
6987
6999
  if (isValueExist(i)) {
6988
7000
  if (this.vertexes.length <= 3) return;
@@ -7018,8 +7030,8 @@
7018
7030
  const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, paths: paths} = options;
7019
7031
  this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
7020
7032
  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) => {
7033
+ this.render(), this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx),
7034
+ this.editDrawPolygon = new EditPolygonPath(canvas, ctx), this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
7023
7035
  this.render(), this.editDrawPolygon.drawPolygon(vertexes, mouseOffset), this.editVertexes = vertexes,
7024
7036
  this.notifyObservers();
7025
7037
  })), this.createPolygonVertexes.onDestroyed((vertexes => {
@@ -7079,8 +7091,12 @@
7079
7091
  }
7080
7092
  },
7081
7093
  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 => {
7094
+ setup(props, {emit: emit, expose: expose}) {
7095
+ const ns = vue.inject("ns", {}), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), setContainerWidthHeight = (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
+ }, loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
7084
7100
  const clientHeight = canvasMainRef.value?.clientHeight, ctx = canvasBaseRef.value?.getContext("2d");
7085
7101
  if (rowInfo?.imageSrc) {
7086
7102
  const image = new Image;
@@ -7092,11 +7108,7 @@
7092
7108
  height = clientHeight, image.style.height = height + "px", width /= scale;
7093
7109
  }
7094
7110
  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({
7111
+ setContainerWidthHeight(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
7100
7112
  canvas: canvasBaseRef.value,
7101
7113
  ctx: ctx,
7102
7114
  image: image,
@@ -7131,9 +7143,19 @@
7131
7143
  }
7132
7144
  }));
7133
7145
  }));
7134
- return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
7146
+ return expose({
7147
+ rerenderImage: () => {
7148
+ setContainerWidthHeight(0, 0), vue.nextTick((() => {
7149
+ const rowInfo = vue.toRaw(props.rowInfo);
7150
+ renderImageLabel(rowInfo);
7151
+ }));
7152
+ }
7153
+ }), () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
7135
7154
  loading: loadingImage.value,
7136
- class: [ ns.b("loading") ]
7155
+ class: [ ns.b("loading") ],
7156
+ style: {
7157
+ height: "100%"
7158
+ }
7137
7159
  }, {
7138
7160
  default: () => [ vue.createVNode("div", {
7139
7161
  ref: canvasMainRef,
@@ -7144,11 +7166,173 @@
7144
7166
  }, null) ]) ]
7145
7167
  }) ]);
7146
7168
  }
7169
+ }), HeaderTool = vue.defineComponent({
7170
+ props: {
7171
+ isFullscreen: {
7172
+ type: Boolean,
7173
+ default: !1
7174
+ },
7175
+ imageIndex: {
7176
+ type: Number,
7177
+ default: 0
7178
+ },
7179
+ imageLength: {
7180
+ type: Number,
7181
+ default: 0
7182
+ }
7183
+ },
7184
+ emits: [ "fullscreen", "save" ],
7185
+ setup(props, {emit: emit}) {
7186
+ const _ns = vue.inject("ns", {}), {t: t} = useLocale(), switchFillscreen = val => {
7187
+ emit("fullscreen", val);
7188
+ };
7189
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", {
7190
+ class: [ _ns.be("header", "tool") ]
7191
+ }, [ vue.createVNode("li", {
7192
+ class: "tool-item",
7193
+ onClick: () => emit("save")
7194
+ }, [ vue.createVNode("svg", {
7195
+ t: "1719034799379",
7196
+ class: "icon",
7197
+ viewBox: "0 0 1024 1024",
7198
+ version: "1.1",
7199
+ xmlns: "http://www.w3.org/2000/svg",
7200
+ "p-id": "4272",
7201
+ width: "18",
7202
+ height: "18"
7203
+ }, [ vue.createVNode("path", {
7204
+ 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",
7205
+ "p-id": "4273"
7206
+ }, null), vue.createVNode("path", {
7207
+ d: "M536 196.3h42.7v87.2H536zM368.7 641.2h220.7v42.7H368.7zM368.7 744h170.9v42.7H368.7z",
7208
+ "p-id": "4274"
7209
+ }, null) ]), vue.createVNode("p", {
7210
+ class: "label-text"
7211
+ }, [ t("next.labelme.saveLabel") ]) ]), vue.createVNode("li", {
7212
+ class: "tool-item"
7213
+ }, [ vue.createVNode("svg", {
7214
+ t: "1721826305513",
7215
+ class: "icon",
7216
+ viewBox: "0 0 1025 1024",
7217
+ version: "1.1",
7218
+ xmlns: "http://www.w3.org/2000/svg",
7219
+ "p-id": "6215",
7220
+ width: "18",
7221
+ height: "18"
7222
+ }, [ vue.createVNode("path", {
7223
+ 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",
7224
+ "p-id": "6216"
7225
+ }, null), vue.createVNode("path", {
7226
+ 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",
7227
+ "p-id": "6217"
7228
+ }, null) ]), vue.createVNode("p", {
7229
+ class: "label-text"
7230
+ }, [ t("next.labelme.createPolygon") ]) ]), vue.createVNode("li", {
7231
+ class: "tool-item"
7232
+ }, [ vue.createVNode("svg", {
7233
+ t: "1721826424613",
7234
+ class: "icon",
7235
+ viewBox: "0 0 1024 1024",
7236
+ version: "1.1",
7237
+ xmlns: "http://www.w3.org/2000/svg",
7238
+ "p-id": "7356",
7239
+ width: "18",
7240
+ height: "18"
7241
+ }, [ vue.createVNode("path", {
7242
+ 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",
7243
+ "p-id": "7357"
7244
+ }, null) ]), vue.createVNode("p", {
7245
+ class: "label-text"
7246
+ }, [ t("next.labelme.editPolygon") ]) ]), vue.createVNode("li", {
7247
+ class: "tool-item"
7248
+ }, [ vue.createVNode("svg", {
7249
+ t: "1721826579655",
7250
+ class: "icon",
7251
+ viewBox: "0 0 1024 1024",
7252
+ version: "1.1",
7253
+ xmlns: "http://www.w3.org/2000/svg",
7254
+ "p-id": "10996",
7255
+ width: "18",
7256
+ height: "18"
7257
+ }, [ vue.createVNode("path", {
7258
+ 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",
7259
+ "p-id": "10997"
7260
+ }, null), vue.createVNode("path", {
7261
+ 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",
7262
+ "p-id": "10998"
7263
+ }, null) ]), vue.createVNode("p", {
7264
+ class: "label-text"
7265
+ }, [ t("next.labelme.deletePolyton") ]) ]) ]), vue.createVNode("ul", {
7266
+ class: [ _ns.be("header", "tool") ]
7267
+ }, [ props.imageLength ? vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("第 "), props.imageIndex + 1, vue.createTextVNode(" 张") ]), vue.createVNode("em", {
7268
+ style: "padding: 0 5px;"
7269
+ }, [ vue.createTextVNode("/") ]), vue.createVNode("span", null, [ vue.createTextVNode("共 "), props.imageLength, vue.createTextVNode(" 张") ]) ]) : null, vue.createVNode("li", {
7270
+ style: "margin-right: 30px;",
7271
+ class: "tool-item"
7272
+ }, [ vue.createVNode(elementPlus.ElPopover, {
7273
+ trigger: "hover",
7274
+ placement: "bottom",
7275
+ width: "none"
7276
+ }, {
7277
+ reference: () => vue.createVNode("div", {
7278
+ class: "flex-center"
7279
+ }, [ vue.createVNode("span", {
7280
+ style: "padding-right: 3px"
7281
+ }, [ t("next.labelimg.instructions") ]), vue.createVNode(elementPlus.ElIcon, {
7282
+ size: 14
7283
+ }, {
7284
+ default: () => [ vue.createVNode(warning_default, null, null) ]
7285
+ }) ]),
7286
+ default: () => vue.createVNode("ul", {
7287
+ style: "font-size: 12px;white-space: nowrap;"
7288
+ }, [ 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键进入下一张图片进行标注") ]) ]) ])
7289
+ }) ]), props.isFullscreen ? vue.createVNode("li", {
7290
+ class: "tool-item",
7291
+ onClick: () => switchFillscreen(!1)
7292
+ }, [ vue.createVNode(elementPlus.ElTooltip, {
7293
+ placement: "top",
7294
+ content: "取消全屏"
7295
+ }, {
7296
+ default: () => [ vue.createVNode("svg", {
7297
+ t: "1719035442027",
7298
+ class: "icon",
7299
+ viewBox: "0 0 1024 1024",
7300
+ version: "1.1",
7301
+ xmlns: "http://www.w3.org/2000/svg",
7302
+ "p-id": "5388",
7303
+ width: "18",
7304
+ height: "18"
7305
+ }, [ vue.createVNode("path", {
7306
+ 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",
7307
+ "p-id": "5389"
7308
+ }, null) ]) ]
7309
+ }) ]) : vue.createVNode("li", {
7310
+ class: "tool-item",
7311
+ onClick: () => switchFillscreen(!0)
7312
+ }, [ vue.createVNode(elementPlus.ElTooltip, {
7313
+ placement: "top",
7314
+ content: "全屏"
7315
+ }, {
7316
+ default: () => [ vue.createVNode("svg", {
7317
+ t: "1719035375323",
7318
+ class: "icon",
7319
+ viewBox: "0 0 1024 1024",
7320
+ version: "1.1",
7321
+ xmlns: "http://www.w3.org/2000/svg",
7322
+ "p-id": "5241",
7323
+ width: "18",
7324
+ height: "18"
7325
+ }, [ vue.createVNode("path", {
7326
+ 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",
7327
+ "p-id": "5242"
7328
+ }, null) ]) ]
7329
+ }) ]) ]) ]) ]);
7330
+ }
7147
7331
  }), defaultConfig = {
7148
7332
  minContentHeight: 500
7149
7333
  };
7150
7334
  const ns = useNamespace("labelme");
7151
- const NextLabelme = withInstall(vue.defineComponent({
7335
+ var Element = vue.defineComponent({
7152
7336
  name: "NextLabelme",
7153
7337
  props: {
7154
7338
  className: {
@@ -7172,14 +7356,14 @@
7172
7356
  default: () => []
7173
7357
  }
7174
7358
  },
7175
- emits: [ "change", "edit-polygon" ],
7176
- setup(props, {emit: emit}) {
7359
+ emits: [ "change", "save", "edit-polygon", "prev-click", "next-click" ],
7360
+ setup(props, {emit: emit, slots: slots}) {
7177
7361
  const _config = deepClone(defaultConfig), _options = vue.computed((() => {
7178
7362
  const cfg = vue.unref(props.options);
7179
7363
  return merge$1(_config, cfg);
7180
7364
  })), 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));
7365
+ vue.provide("ns", ns);
7366
+ const {t: t} = useLocale(), activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes), labelImages = vue.ref(deepClone(props.data));
7183
7367
  vue.watch((() => props.data), (data => {
7184
7368
  labelImages.value = deepClone(data);
7185
7369
  }), {
@@ -7195,28 +7379,122 @@
7195
7379
  if (!labelImages.value) return {};
7196
7380
  const node = labelImages.value[activateNodeIndex.value] || {};
7197
7381
  return deepClone(node);
7198
- })), mainContentHeight = vue.ref(options.minContentHeight), mainRef = vue.ref(), isFullscreen = vue.ref(!1), onEditPlygonChange = plygon => {
7382
+ })), 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 = () => {
7383
+ vue.nextTick((() => {
7384
+ const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
7385
+ mainContentHeight.value = contentHeight;
7386
+ }));
7387
+ };
7388
+ vue.onMounted((() => {
7389
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (() => {
7390
+ updateMainContentHeight();
7391
+ })), window.addEventListener("resize", updateMainContentHeight);
7392
+ })), vue.onUnmounted((() => {
7393
+ document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
7394
+ }));
7395
+ const onKeydownPrevNext = () => {}, onPaginationPrev = () => {
7396
+ const imageLength = labelImages.value.length;
7397
+ let i = activateNodeIndex.value - 1;
7398
+ i < 0 && (i = imageLength - 1), onChangeActivateNode(i), emit("prev-click");
7399
+ }, onPaginationNext = () => {
7400
+ const imageLength = labelImages.value.length;
7401
+ let i = activateNodeIndex.value + 1;
7402
+ i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
7403
+ }, onChangeActivateNode = index => {
7404
+ if (loading.value) return;
7405
+ loading.value = !0;
7406
+ const node = currentNode.value;
7407
+ emit("save", {
7408
+ node: node
7409
+ }, (imageItem => {
7410
+ labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
7411
+ loading.value = !1;
7412
+ }), (() => {
7413
+ loading.value = !1;
7414
+ }));
7415
+ }, isFullscreen = vue.ref(!1), onSwitchFillscreen = val => {
7416
+ isFullscreen.value = val, updateMainContentHeight(), vue.nextTick((() => {
7417
+ canvasContextRef.value.rerenderImage();
7418
+ }));
7419
+ }, onEditPlygonChange = plygon => {
7199
7420
  emit("edit-polygon", plygon);
7200
7421
  };
7201
7422
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
7423
+ ref: layoutLabelRef,
7202
7424
  class: [ ns.b(), props.className, isFullscreen.value ? ns.b("fullscreen") : "" ],
7203
7425
  style: {
7204
7426
  ...props.style
7205
7427
  }
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) ]) ]) ]) ]);
7428
+ }, [ vue.createVNode(NextSpinLoading, {
7429
+ loading: loading.value,
7430
+ tip: t("next.labelimg.saveTxt"),
7431
+ class: [ ns.b("loading") ]
7432
+ }, {
7433
+ default: () => [ vue.createVNode(elementPlus.ElScrollbar, null, {
7434
+ default: () => [ vue.createVNode("header", {
7435
+ ref: headerRef,
7436
+ class: [ ns.b("header") ]
7437
+ }, [ slots.header ? slots.header() : vue.createVNode(HeaderTool, {
7438
+ isFullscreen: isFullscreen.value,
7439
+ imageIndex: activateNodeIndex.value,
7440
+ imageLength: labelImages.value.length,
7441
+ onFullscreen: onSwitchFillscreen
7442
+ }, null) ]), vue.createVNode("div", {
7443
+ ref: mainRef,
7444
+ class: [ ns.b("main") ]
7445
+ }, [ vue.createVNode("div", {
7446
+ class: [ ns.be("main", "content") ],
7447
+ style: {
7448
+ height: mainContentHeight.value + "px"
7449
+ }
7450
+ }, [ vue.createVNode(CanvasContext, {
7451
+ ref: canvasContextRef,
7452
+ rowInfo: currentNode.value,
7453
+ onEditPolygon: onEditPlygonChange
7454
+ }, null) ]) ]), vue.createVNode("footer", {
7455
+ ref: footerRef,
7456
+ class: [ ns.b("footer") ]
7457
+ }, [ vue.createVNode("div", {
7458
+ class: [ ns.be("footer", "left") ]
7459
+ }, [ vue.createVNode(elementPlus.ElIcon, {
7460
+ size: 24,
7461
+ color: "#797979",
7462
+ onClick: onPaginationPrev
7463
+ }, {
7464
+ default: () => [ vue.createVNode(arrow_left_default, null, null) ]
7465
+ }) ]), vue.createVNode("div", {
7466
+ class: [ ns.be("footer", "center") ]
7467
+ }, [ vue.createVNode(elementPlus.ElScrollbar, null, {
7468
+ default: () => [ vue.createVNode("ul", {
7469
+ class: [ ns.bem("footer", "center", "list") ]
7470
+ }, [ labelImages.value.map(((item, index) => vue.createVNode("li", {
7471
+ key: index,
7472
+ onClick: () => onChangeActivateNode(index),
7473
+ class: {
7474
+ "is-activate": activateNodeIndex.value === index
7475
+ }
7476
+ }, [ vue.createVNode(elementPlus.ElImage, {
7477
+ style: "height: 100%",
7478
+ src: item.imageSrc,
7479
+ "zoom-rate": 1.2,
7480
+ "max-scale": 2,
7481
+ "min-scale": .2,
7482
+ fit: "cover"
7483
+ }, null) ]))) ]) ]
7484
+ }) ]), vue.createVNode("div", {
7485
+ class: [ ns.be("footer", "right") ]
7486
+ }, [ vue.createVNode(elementPlus.ElIcon, {
7487
+ size: 24,
7488
+ color: "#797979",
7489
+ onClick: onPaginationNext
7490
+ }, {
7491
+ default: () => [ vue.createVNode(arrow_right_default, null, null) ]
7492
+ }) ]) ]) ]
7493
+ }) ]
7494
+ }) ]) ]);
7218
7495
  }
7219
- }));
7496
+ });
7497
+ const NextLabelme = withInstall(Element);
7220
7498
  var components = Object.freeze({
7221
7499
  __proto__: null,
7222
7500
  NextContainer: NextContainer,
@@ -7278,7 +7556,7 @@
7278
7556
  })(app);
7279
7557
  };
7280
7558
  var index = {
7281
- version: "0.3.3",
7559
+ version: "0.3.4",
7282
7560
  install: install
7283
7561
  };
7284
7562
  exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
@@ -7325,7 +7603,7 @@
7325
7603
  }), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
7326
7604
  const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
7327
7605
  localeRef.value.name = lang, localeRef.value.next = nextLang.next;
7328
- }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.3",
7606
+ }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.4",
7329
7607
  Object.defineProperty(exports, "__esModule", {
7330
7608
  value: !0
7331
7609
  });