next-element-vue 0.3.0 → 0.3.1

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.0 v
6
- * 发布日期:2024-06-16
5
+ * 当前版本:0.3.1 v
6
+ * 发布日期:2024-06-22
7
7
  * 地  址:https://www.npmjs.com/package/next-element-vue
8
8
  */
9
9
 
@@ -794,7 +794,10 @@
794
794
  labelimg: {
795
795
  saveTxt: "保存中...",
796
796
  emptyLabelText: "暂无标签数据",
797
- confirmDeleteLabel: "确定要删除该标注吗?"
797
+ confirmDeleteLabel: "确定要删除该标注吗?",
798
+ saveLabel: "保存当前标注",
799
+ instructions: "使用说明",
800
+ labelNoUpdate: "暂无标签数据更新"
798
801
  }
799
802
  }
800
803
  }, enLocale = {
@@ -869,7 +872,10 @@
869
872
  labelimg: {
870
873
  saveTxt: "saving...",
871
874
  emptyLabelText: "No label data",
872
- confirmDeleteLabel: "Are you sure you want to delete this annotation?"
875
+ confirmDeleteLabel: "Are you sure you want to delete this annotation?",
876
+ saveLabel: "save label",
877
+ instructions: "instructions",
878
+ labelNoUpdate: "No label data update"
873
879
  }
874
880
  }
875
881
  }, zhtwLocale = {
@@ -944,7 +950,10 @@
944
950
  labelimg: {
945
951
  saveTxt: "保存中...",
946
952
  emptyLabelText: "暂无标签数据",
947
- confirmDeleteLabel: "确定要删除该标注吗?"
953
+ confirmDeleteLabel: "确定要删除该标注吗?",
954
+ saveLabel: "保存当前标注",
955
+ instructions: "使用说明",
956
+ labelNoUpdate: "暂无标签数据更新"
948
957
  }
949
958
  }
950
959
  };
@@ -1090,13 +1099,16 @@
1090
1099
  } ],
1091
1100
  userDropdown: [ {
1092
1101
  value: "/",
1093
- label: "next.layout.home"
1102
+ label: "next.layout.home",
1103
+ svg: '<svg t="1718695810903" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11410" width="16" height="16"><path d="M988.672 502.272l-476.16-476.16-476.16 476.16c-8.704 8.704-8.704 22.528 0 31.232l1.536 1.536c8.704 8.704 22.528 8.704 31.232 0l443.392-443.392 443.392 443.392c8.704 8.704 22.528 8.704 31.232 0l1.536-1.536c8.704-8.704 8.704-22.528 0-31.232z" fill="" p-id="11411"></path><path d="M860.16 534.016c-12.288 0-22.016 9.728-22.016 22.016v333.312c0 54.272-27.648 64-47.104 64h-152.064v-227.84c0-25.088 0-59.392-44.544-59.392H418.816c-44.032 0-44.032 33.28-44.032 59.392v227.84h-153.6c-44.032 0-45.056-64-45.056-64v-333.312c0.512-12.288-8.704-22.528-20.992-23.04-12.288-0.512-22.528 8.704-23.04 20.992v368.64c0 65.536 70.144 75.264 70.144 75.264h217.088v-287.232h176.64v287.232H824.32c39.424 0 57.856-44.032 57.856-75.264v-366.592c0-12.288-9.728-22.016-22.016-22.016z" fill="" p-id="11412"></path></svg>'
1094
1104
  }, {
1095
1105
  value: "/personal",
1096
- label: "next.layout.personal"
1106
+ label: "next.layout.personal",
1107
+ svg: '<svg t="1718695007028" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2161" width="16" height="16"><path d="M512 87.04c-136.704 0-247.808 111.104-247.808 247.808 0 98.816 58.368 184.32 142.336 223.744-155.136 45.568-268.8 188.928-268.8 358.912 0 10.752 8.704 19.456 19.456 19.456 10.752 0 19.456-8.704 19.456-19.456 0-184.832 150.528-335.36 335.36-335.36 136.704 0 247.808-111.104 247.808-247.808S648.704 87.04 512 87.04z m0 456.192c-115.2 0-208.384-93.696-208.384-208.384 0-115.2 93.696-208.384 208.384-208.384 115.2 0 208.384 93.696 208.384 208.384 0 114.688-93.184 208.384-208.384 208.384z m226.816 76.8c-8.704-6.656-20.992-5.12-27.648 3.584-6.656 8.704-5.12 20.992 3.584 27.648 83.968 64 132.096 161.28 132.096 266.752 0 10.752 8.704 19.456 19.456 19.456 10.752 0 19.456-8.704 19.456-19.456 0.512-118.272-53.248-226.816-146.944-297.984z" fill="" p-id="2162"></path></svg>'
1097
1108
  }, {
1098
1109
  value: "logOut",
1099
1110
  label: "next.layout.logOut",
1111
+ svg: '<svg t="1718695049981" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2313" width="16" height="16"><path d="M896 928H384a32 32 0 0 1-32-32v-128a32 32 0 0 1 64 0v96h448v-704h-448V256a32 32 0 1 1-64 0V128a32 32 0 0 1 32-32h512a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32z" fill="" p-id="2314"></path><path d="M608 544H192a32 32 0 0 1 0-64h416a32 32 0 0 1 0 64z" fill="" p-id="2315"></path><path d="M256 672a30.08 30.08 0 0 1-22.4-9.6l-128-128a30.72 30.72 0 0 1 0-44.8l128-128a31.36 31.36 0 1 1 44.8 44.8L173.44 512l104.96 105.6a30.72 30.72 0 0 1 0 44.8 30.08 30.08 0 0 1-22.4 9.6z" fill="" p-id="2316"></path></svg>',
1100
1112
  divided: !0
1101
1113
  } ],
1102
1114
  showTabs: !0,
@@ -1463,7 +1475,18 @@
1463
1475
  }, null, -1) ];
1464
1476
  var view_default = export_helper_default(view_vue_vue_type_script_lang_default, [ [ "render", function(_ctx, _cache, $props, $setup, $data, $options) {
1465
1477
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1283, _hoisted_3282);
1466
- } ], [ "__file", "view.vue" ] ]), LayoutSetting = vue.defineComponent({
1478
+ } ], [ "__file", "view.vue" ] ]), warning_vue_vue_type_script_lang_default = {
1479
+ name: "Warning"
1480
+ }, _hoisted_1288 = {
1481
+ xmlns: "http://www.w3.org/2000/svg",
1482
+ viewBox: "0 0 1024 1024"
1483
+ }, _hoisted_3287 = [ vue.createElementVNode("path", {
1484
+ fill: "currentColor",
1485
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768zm48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0zm-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
1486
+ }, null, -1) ];
1487
+ var warning_default = export_helper_default(warning_vue_vue_type_script_lang_default, [ [ "render", function(_ctx, _cache, $props, $setup, $data, $options) {
1488
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1288, _hoisted_3287);
1489
+ } ], [ "__file", "warning.vue" ] ]), LayoutSetting = vue.defineComponent({
1467
1490
  setup() {},
1468
1491
  render() {
1469
1492
  const _slots = vue.inject("__slots__", {}), _ns = vue.inject("__ns__", {}), _config = vue.inject("options", {}), _updateOptions = vue.inject("updateOptions", null), settingConfig = vue.reactive({
@@ -1592,16 +1615,13 @@
1592
1615
  class: _ns.be("config-bar-item", "label")
1593
1616
  }, [ vue.createTextVNode("是否显示标签栏") ]), vue.createVNode("div", {
1594
1617
  class: _ns.be("config-bar-item", "value")
1595
- }, [ vue.createVNode(vue.resolveComponent("el-switch"), {
1618
+ }, [ vue.createVNode(elementPlus.ElSwitch, {
1596
1619
  modelValue: _config.showTabs,
1597
1620
  "onUpdate:modelValue": $event => _config.showTabs = $event
1598
1621
  }, null) ]) ]), _slots.setting?.() ]
1599
1622
  });
1600
1623
  }
1601
1624
  });
1602
- function _isSlot$8(s) {
1603
- return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
1604
- }
1605
1625
  var HeaderTools = vue.defineComponent({
1606
1626
  setup() {
1607
1627
  const locale = vue.inject(localeContextKey, vue.ref()), config = vue.inject("options", {}), {t: t} = useLocale(), {toggle: toggle, isFullscreen: isFullscreen} = core.useFullscreen(), language = vue.ref(vue.computed((() => config.language)).value), settingDrawer = vue.ref(!1);
@@ -1653,14 +1673,15 @@
1653
1673
  }) ]),
1654
1674
  dropdown: () => {
1655
1675
  let _slot;
1656
- return vue.createVNode(elementPlus.ElDropdownMenu, null, _isSlot$8(_slot = _languageDropdown.map((item => vue.createVNode(elementPlus.ElDropdownItem, {
1676
+ return vue.createVNode(elementPlus.ElDropdownMenu, null, "function" == typeof (s = _slot = _languageDropdown.map((item => vue.createVNode(elementPlus.ElDropdownItem, {
1657
1677
  command: item.value,
1658
1678
  disabled: this.language === item.value
1659
1679
  }, {
1660
1680
  default: () => [ item.label ]
1661
- })))) ? _slot : {
1681
+ })))) || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? _slot : {
1662
1682
  default: () => [ _slot ]
1663
1683
  });
1684
+ var s;
1664
1685
  }
1665
1686
  }) ]), vue.createVNode("li", null, [ vue.createVNode("span", {
1666
1687
  style: {
@@ -1697,6 +1718,7 @@
1697
1718
  }) ]) ]), slots[slots_config_headerToolsSuffix]?.(), vue.createVNode("li", null, [ vue.createVNode(elementPlus.ElDropdown, {
1698
1719
  "show-timeout": 70,
1699
1720
  "hide-timeout": 80,
1721
+ "popper-class": _ns.be("header-tools", "userDropdown"),
1700
1722
  onCommand: command => {
1701
1723
  _emit("changeUserDropdown", command), _config.onChangeUserDropdown && _config.onChangeUserDropdown(command);
1702
1724
  }
@@ -1712,15 +1734,17 @@
1712
1734
  default: () => [ vue.createVNode(arrow_down_default, null, null) ]
1713
1735
  }) ]),
1714
1736
  dropdown: () => vue.createVNode(elementPlus.ElDropdownMenu, null, {
1715
- default: () => [ _userDropdown?.map((item => {
1716
- let _slot2;
1717
- return vue.createVNode(elementPlus.ElDropdownItem, {
1718
- command: item.value,
1719
- divided: !!item.divided
1720
- }, _isSlot$8(_slot2 = _t(item.label)) ? _slot2 : {
1721
- default: () => [ _slot2 ]
1722
- });
1723
- })) ]
1737
+ default: () => [ _userDropdown?.map((item => vue.createVNode(elementPlus.ElDropdownItem, {
1738
+ command: item.value,
1739
+ divided: !!item.divided
1740
+ }, {
1741
+ default: () => [ item.svg ? vue.createVNode("span", {
1742
+ innerHTML: item.svg,
1743
+ class: "item-svg"
1744
+ }, null) : null, item.iconfont ? vue.createVNode("i", {
1745
+ class: item.iconfont
1746
+ }, null) : null, _t(item.label) ]
1747
+ }))) ]
1724
1748
  })
1725
1749
  }) ]), vue.createVNode("li", null, [ vue.createVNode("span", {
1726
1750
  style: {
@@ -4155,7 +4179,7 @@
4155
4179
  }
4156
4180
  })(event, vue.toRaw(row))
4157
4181
  }, null) : vue.createVNode(elementPlus.ElRadio, {
4158
- label: value,
4182
+ value: value,
4159
4183
  onChange: () => {
4160
4184
  sinleSelection.value = value, multipleSelection.value = [ row ];
4161
4185
  }
@@ -4717,7 +4741,7 @@
4717
4741
  }, {
4718
4742
  default: () => [ col.dicData && col.dicData.map((item => vue.createVNode(elementPlus.ElRadio, {
4719
4743
  key: item.value,
4720
- label: item.value,
4744
+ value: item.value,
4721
4745
  disabled: valueExist(item.disabled, !1)
4722
4746
  }, {
4723
4747
  default: () => [ item.label ]
@@ -5704,7 +5728,103 @@
5704
5728
  name: "NextDragResize",
5705
5729
  props: {},
5706
5730
  setup: () => () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, null) ])
5707
- })), colors = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
5731
+ }));
5732
+ var ToolHeader = vue.defineComponent({
5733
+ props: {
5734
+ isFullscreen: {
5735
+ type: Boolean,
5736
+ default: !1
5737
+ }
5738
+ },
5739
+ emits: [ "fullscreen", "save" ],
5740
+ setup(props, {emit: emit}) {
5741
+ const _ns = vue.inject("ns", {}), {t: t} = useLocale(), switchFillscreen = val => {
5742
+ emit("fullscreen", val);
5743
+ };
5744
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", {
5745
+ class: [ _ns.be("header", "tool") ]
5746
+ }, [ vue.createVNode("li", {
5747
+ onClick: () => emit("save")
5748
+ }, [ vue.createVNode("svg", {
5749
+ t: "1719034799379",
5750
+ class: "icon",
5751
+ viewBox: "0 0 1024 1024",
5752
+ version: "1.1",
5753
+ xmlns: "http://www.w3.org/2000/svg",
5754
+ "p-id": "4272",
5755
+ width: "18",
5756
+ height: "18"
5757
+ }, [ vue.createVNode("path", {
5758
+ 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",
5759
+ "p-id": "4273"
5760
+ }, null), vue.createVNode("path", {
5761
+ d: "M536 196.3h42.7v87.2H536zM368.7 641.2h220.7v42.7H368.7zM368.7 744h170.9v42.7H368.7z",
5762
+ "p-id": "4274"
5763
+ }, null) ]), vue.createVNode("span", {
5764
+ style: "padding-left: 3px"
5765
+ }, [ t("next.labelimg.saveLabel") ]) ]) ]), vue.createVNode("ul", {
5766
+ class: [ _ns.be("header", "tool") ]
5767
+ }, [ vue.createVNode("li", {
5768
+ style: "margin-right: 30px;"
5769
+ }, [ vue.createVNode(elementPlus.ElPopover, {
5770
+ trigger: "hover",
5771
+ placement: "bottom",
5772
+ width: "none"
5773
+ }, {
5774
+ reference: () => vue.createVNode("div", {
5775
+ class: "flex-center"
5776
+ }, [ vue.createVNode("span", {
5777
+ style: "padding-right: 3px"
5778
+ }, [ t("next.labelimg.instructions") ]), vue.createVNode(elementPlus.ElIcon, {
5779
+ size: 14
5780
+ }, {
5781
+ default: () => [ vue.createVNode(warning_default, null, null) ]
5782
+ }) ]),
5783
+ default: () => vue.createVNode("ul", {
5784
+ style: "font-size: 12px;white-space: nowrap;"
5785
+ }, [ vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("W:") ]), vue.createVNode("span", null, [ vue.createTextVNode("鼠标移入图片中,长按W键,鼠标按下左键,移动鼠标开始绘制,鼠标抬起结束绘制") ]) ]), 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键进入下一张图片进行标注") ]) ]) ])
5786
+ }) ]), props.isFullscreen ? vue.createVNode("li", {
5787
+ onClick: () => switchFillscreen(!1)
5788
+ }, [ vue.createVNode(elementPlus.ElTooltip, {
5789
+ placement: "top",
5790
+ content: "取消全屏"
5791
+ }, {
5792
+ default: () => [ vue.createVNode("svg", {
5793
+ t: "1719035442027",
5794
+ class: "icon",
5795
+ viewBox: "0 0 1024 1024",
5796
+ version: "1.1",
5797
+ xmlns: "http://www.w3.org/2000/svg",
5798
+ "p-id": "5388",
5799
+ width: "18",
5800
+ height: "18"
5801
+ }, [ vue.createVNode("path", {
5802
+ 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",
5803
+ "p-id": "5389"
5804
+ }, null) ]) ]
5805
+ }) ]) : vue.createVNode("li", {
5806
+ onClick: () => switchFillscreen(!0)
5807
+ }, [ vue.createVNode(elementPlus.ElTooltip, {
5808
+ placement: "top",
5809
+ content: "全屏"
5810
+ }, {
5811
+ default: () => [ vue.createVNode("svg", {
5812
+ t: "1719035375323",
5813
+ class: "icon",
5814
+ viewBox: "0 0 1024 1024",
5815
+ version: "1.1",
5816
+ xmlns: "http://www.w3.org/2000/svg",
5817
+ "p-id": "5241",
5818
+ width: "18",
5819
+ height: "18"
5820
+ }, [ vue.createVNode("path", {
5821
+ 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",
5822
+ "p-id": "5242"
5823
+ }, null) ]) ]
5824
+ }) ]) ]) ]) ]);
5825
+ }
5826
+ });
5827
+ const colors = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
5708
5828
  const label_type = rect.type, x_center = rect.startX + rect.rectWidth / 2, y_center = rect.startY + rect.rectHeight / 2;
5709
5829
  return [ label_type, parseFloat((x_center / rect.canvasWidth).toFixed(6)), parseFloat((y_center / rect.canvasHeight).toFixed(6)), parseFloat((rect.rectWidth / rect.canvasWidth).toFixed(6)), parseFloat((rect.rectHeight / rect.canvasHeight).toFixed(6)) ];
5710
5830
  }, canvertToCanvas = (labelData, canvasWidth, canvasHeight) => {
@@ -5757,7 +5877,7 @@
5757
5877
  labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
5758
5878
  }));
5759
5879
  const labelMenuRef = vue.ref(), labelStyleFixed = vue.computed((() => {
5760
- const {left: left, top: top, canvasHeight: canvasHeight} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - canvasHeight;
5880
+ const {left: left, top: top} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - window.innerHeight;
5761
5881
  let y = top;
5762
5882
  return height_diff > 0 && (y -= height_diff), {
5763
5883
  top: y + "px",
@@ -6003,6 +6123,12 @@
6003
6123
  })),
6004
6124
  label_txt: yolo_label.join("\n")
6005
6125
  };
6126
+ }, setContainerWidthHeight = (canvasWidth, canvasHeight) => {
6127
+ canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
6128
+ canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
6129
+ canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px",
6130
+ canvasRectRef.value.width = canvasWidth, canvasRectRef.value.height = canvasHeight,
6131
+ canvasRectRef.value.style.width = canvasWidth + "px", canvasRectRef.value.style.height = canvasHeight + "px";
6006
6132
  }, loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
6007
6133
  labels.value = (rowInfo => rowInfo.labels ? rowInfo.labels.map((rect => {
6008
6134
  const typeName = props.classes[rect.type];
@@ -6013,14 +6139,13 @@
6013
6139
  const image = new Image;
6014
6140
  image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
6015
6141
  loadingImage.value = !1;
6016
- const {width: width, height: height} = image, canvasHeight = clientHeight, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
6017
- ((canvasWidth, canvasHeight) => {
6018
- canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
6019
- canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
6020
- canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px",
6021
- canvasRectRef.value.width = canvasWidth, canvasRectRef.value.height = canvasHeight,
6022
- canvasRectRef.value.style.width = canvasWidth + "px", canvasRectRef.value.style.height = canvasHeight + "px";
6023
- })(canvasWidth, canvasHeight), labels.value = ((labels, canvasHeight) => {
6142
+ let {width: width, height: height} = image;
6143
+ if (height > clientHeight) {
6144
+ const scale = height / clientHeight;
6145
+ height = clientHeight, image.style.height = height + "px", width /= scale;
6146
+ }
6147
+ const canvasHeight = height, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
6148
+ setContainerWidthHeight(canvasWidth, canvasHeight), labels.value = ((labels, canvasHeight) => {
6024
6149
  let scale_rects = [];
6025
6150
  for (let i = 0; i < labels.length; i++) {
6026
6151
  const rect = labels[i], scale = parseFloat((canvasHeight / rect.canvasHeight).toFixed(3));
@@ -6161,9 +6286,11 @@
6161
6286
  left: 0,
6162
6287
  activateRect: null
6163
6288
  }), updateContextmenuLabelFixed = (x, y, rect) => {
6164
- contextmenuLabelFixed.value.show = !0, contextmenuLabelFixed.value.left = x, contextmenuLabelFixed.value.top = y,
6165
- contextmenuLabelFixed.value.canvasWidth = canvasBaseRef.value.width, contextmenuLabelFixed.value.canvasHeight = canvasBaseRef.value.height,
6166
- contextmenuLabelFixed.value.activateRect = rect, activate_add_label.value = rect;
6289
+ const contextRect = canvasBaseRef.value.getBoundingClientRect();
6290
+ contextmenuLabelFixed.value.show = !0, contextmenuLabelFixed.value.left = x + contextRect.x,
6291
+ contextmenuLabelFixed.value.top = y + contextRect.y, contextmenuLabelFixed.value.canvasWidth = canvasBaseRef.value.width,
6292
+ contextmenuLabelFixed.value.canvasHeight = canvasBaseRef.value.height, contextmenuLabelFixed.value.activateRect = rect,
6293
+ activate_add_label.value = rect;
6167
6294
  }, onCloseContentmenuLabel = () => {
6168
6295
  contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
6169
6296
  contextmenuLabelFixed.value.activateRect = null, activate_add_label.value = null,
@@ -6231,7 +6358,14 @@
6231
6358
  updateDraggableRectFixed(x, y, rect, index, colors[type]);
6232
6359
  }));
6233
6360
  },
6234
- onDeleteLabel: onDeleteLabel
6361
+ onDeleteLabel: onDeleteLabel,
6362
+ rerenderImage: () => {
6363
+ setContainerWidthHeight(0, 0), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
6364
+ vue.nextTick((() => {
6365
+ const rowInfo = vue.toRaw(props.rowInfo);
6366
+ renderImageLabel(rowInfo);
6367
+ }));
6368
+ }
6235
6369
  });
6236
6370
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
6237
6371
  loading: loadingImage.value,
@@ -6264,6 +6398,9 @@
6264
6398
  }
6265
6399
  }), RightLabel = vue.defineComponent({
6266
6400
  props: {
6401
+ contentHeight: {
6402
+ type: Number
6403
+ },
6267
6404
  classes: {
6268
6405
  type: Array,
6269
6406
  default: () => []
@@ -6287,7 +6424,10 @@
6287
6424
  immediate: !0
6288
6425
  });
6289
6426
  const renderContent = () => vue.createVNode("div", {
6290
- class: [ ns.b("right") ]
6427
+ class: [ ns.b("right") ],
6428
+ style: {
6429
+ height: props.contentHeight + "px"
6430
+ }
6291
6431
  }, [ labels.value.length ? vue.createVNode("ul", null, [ labels.value.map(((rect, index) => vue.createVNode("li", {
6292
6432
  key: index,
6293
6433
  onClick: () => ((rect, index) => {
@@ -6321,7 +6461,7 @@
6321
6461
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
6322
6462
  }
6323
6463
  }), defaultConfig = {
6324
- mainContentHeight: 600
6464
+ minContentHeight: 500
6325
6465
  };
6326
6466
  const ns$1 = useNamespace("labelimg");
6327
6467
  var Element = vue.defineComponent({
@@ -6333,9 +6473,7 @@
6333
6473
  },
6334
6474
  style: {
6335
6475
  type: Object,
6336
- default: () => ({
6337
- position: "unset"
6338
- })
6476
+ default: () => ({})
6339
6477
  },
6340
6478
  rowKey: {
6341
6479
  type: String,
@@ -6418,9 +6556,8 @@
6418
6556
  if (loading.value) return;
6419
6557
  loading.value = !0;
6420
6558
  const {node: node, label_txt: label_txt} = formatNodeLabels();
6421
- if (canvasContextRef.value.onCloseDraggableRectFixed(), isChangeNodeLabels()) return activateNodeIndex.value = index,
6422
- void (loading.value = !1);
6423
- emit("save", {
6559
+ return canvasContextRef.value.onCloseDraggableRectFixed(), isChangeNodeLabels() ? (activateNodeIndex.value = index,
6560
+ loading.value = !1, !1) : (emit("save", {
6424
6561
  node: node,
6425
6562
  label_txt: label_txt
6426
6563
  }, (imageItem => {
@@ -6428,7 +6565,7 @@
6428
6565
  loading.value = !1;
6429
6566
  }), (() => {
6430
6567
  loading.value = !1;
6431
- }));
6568
+ })), !0);
6432
6569
  }, onPaginationPrev = () => {
6433
6570
  const imageLength = labelImages.value.length;
6434
6571
  let i = activateNodeIndex.value - 1;
@@ -6437,30 +6574,35 @@
6437
6574
  const imageLength = labelImages.value.length;
6438
6575
  let i = activateNodeIndex.value + 1;
6439
6576
  i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
6440
- }, canvasContextRef = vue.ref(), layoutLabelRef = vue.ref(), headerRef = vue.ref(), mainRef = vue.ref(), footerRef = vue.ref(), mainContentHeight = vue.ref(options.mainContentHeight);
6441
- vue.onMounted((() => {
6442
- document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value, (() => {
6443
- vue.nextTick((() => {
6444
- layoutLabelRef.value.style.position = "unset";
6445
- const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
6446
- mainContentHeight.value = contentHeight;
6447
- }));
6577
+ }, canvasContextRef = vue.ref(), layoutLabelRef = vue.ref(), headerRef = vue.ref(), mainRef = vue.ref(), footerRef = vue.ref(), mainContentHeight = vue.ref(options.minContentHeight), updateMainContentHeight = () => {
6578
+ vue.nextTick((() => {
6579
+ const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
6580
+ mainContentHeight.value = contentHeight;
6448
6581
  }));
6582
+ };
6583
+ vue.onMounted((() => {
6584
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (() => {
6585
+ updateMainContentHeight();
6586
+ })), window.addEventListener("resize", updateMainContentHeight);
6449
6587
  })), vue.onUnmounted((() => {
6450
- document.removeEventListener("keydown", onKeydownPrevNext);
6588
+ document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
6451
6589
  }));
6452
6590
  const onSelectLabelNode = (rect, index) => {
6453
6591
  canvasContextRef.value.onSelectedLabel(rect, index);
6454
6592
  }, onDeleteLabelNode = rect => {
6455
6593
  canvasContextRef.value.onDeleteLabel(rect);
6594
+ }, isFullscreen = vue.ref(!1), onSwitchFillscreen = val => {
6595
+ isFullscreen.value = val, updateMainContentHeight(), vue.nextTick((() => {
6596
+ canvasContextRef.value.rerenderImage();
6597
+ }));
6456
6598
  };
6457
6599
  expose({
6458
6600
  convertToLabel: convertToLabel,
6459
6601
  canvertToCanvas: canvertToCanvas
6460
6602
  });
6461
- return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
6603
+ const renderContent = () => vue.createVNode("div", {
6462
6604
  ref: layoutLabelRef,
6463
- class: [ ns$1.b(), props.className ],
6605
+ class: [ ns$1.b(), props.className, isFullscreen.value ? ns$1.b("fullscreen") : "" ],
6464
6606
  style: {
6465
6607
  ...props.style
6466
6608
  }
@@ -6473,21 +6615,35 @@
6473
6615
  default: () => [ vue.createVNode("header", {
6474
6616
  ref: headerRef,
6475
6617
  class: [ ns$1.b("header") ]
6476
- }, [ slots.header ? slots.header() : vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", null, null), vue.createVNode("ul", null, null) ]) ]), vue.createVNode("div", {
6477
- ref: mainRef,
6478
- class: [ ns$1.b("main") ],
6479
- style: {
6480
- height: mainContentHeight.value + "px"
6618
+ }, [ slots.header ? slots.header() : vue.createVNode(ToolHeader, {
6619
+ isFullscreen: isFullscreen.value,
6620
+ onFullscreen: onSwitchFillscreen,
6621
+ onSave: () => {
6622
+ onChangeActivateNode(activateNodeIndex.value) || elementPlus.ElMessage({
6623
+ type: "info",
6624
+ message: t("next.labelimg.labelNoUpdate")
6625
+ });
6481
6626
  }
6482
- }, [ vue.createVNode("div", {
6627
+ }, null) ]), vue.createVNode("div", {
6628
+ ref: mainRef,
6629
+ class: [ ns$1.b("main") ]
6630
+ }, [ vue.createVNode(elementPlus.ElScrollbar, {
6483
6631
  class: [ ns$1.be("main", "content") ]
6484
- }, [ vue.createVNode(CanvasContext, {
6485
- ref: canvasContextRef,
6486
- contextClientHeight: mainContentHeight.value,
6487
- classes: classes.value,
6488
- rowInfo: currentNode.value,
6489
- onChange: onChangeNodeRect
6490
- }, null) ]), vue.createVNode(RightLabel, {
6632
+ }, {
6633
+ default: () => [ vue.createVNode("div", {
6634
+ class: [ ns$1.be("main", "content") ],
6635
+ style: {
6636
+ height: mainContentHeight.value + "px"
6637
+ }
6638
+ }, [ vue.createVNode(CanvasContext, {
6639
+ ref: canvasContextRef,
6640
+ contextClientHeight: mainContentHeight.value,
6641
+ classes: classes.value,
6642
+ rowInfo: currentNode.value,
6643
+ onChange: onChangeNodeRect
6644
+ }, null) ]) ]
6645
+ }), vue.createVNode(RightLabel, {
6646
+ contentHeight: mainContentHeight.value,
6491
6647
  classes: classes.value,
6492
6648
  labels: activateNodeLabels.value,
6493
6649
  onDelete: onDeleteLabelNode,
@@ -6532,7 +6688,8 @@
6532
6688
  default: () => [ vue.createVNode(arrow_right_default, null, null) ]
6533
6689
  }) ]) ]) ]
6534
6690
  }) ]
6535
- }) ]) ]);
6691
+ }) ]);
6692
+ return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
6536
6693
  }
6537
6694
  });
6538
6695
  const ns = useNamespace("labelimg-preview");
@@ -6664,7 +6821,7 @@
6664
6821
  })(app);
6665
6822
  };
6666
6823
  var index = {
6667
- version: "0.3.0",
6824
+ version: "0.3.1",
6668
6825
  install: install
6669
6826
  };
6670
6827
  exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
@@ -6710,7 +6867,7 @@
6710
6867
  }), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
6711
6868
  const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
6712
6869
  localeRef.value.name = lang, localeRef.value.next = nextLang.next;
6713
- }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.0",
6870
+ }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.1",
6714
6871
  Object.defineProperty(exports, "__esModule", {
6715
6872
  value: !0
6716
6873
  });