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.js CHANGED
@@ -2,14 +2,14 @@
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
 
10
10
  import { getCurrentInstance, inject, ref, computed, unref, isRef, defineComponent, createVNode, Fragment, openBlock, createElementBlock, createElementVNode, reactive, createTextVNode, resolveComponent, Teleport, isVNode, onUnmounted, provide, watch, markRaw, watchEffect, h, onMounted, toRaw, render, nextTick, toRef } from "vue";
11
11
 
12
- import { localeContextKey as localeContextKey$1, ElMessage, ElTooltip, ElScrollbar, ElDivider, ElColorPicker, ElSwitch, ElDropdown, ElIcon, ElDropdownMenu, ElDropdownItem, ElDrawer, ElMenuItem, ElSubMenu, ElMenu, ElContainer, ElCol, ElFormItem, ElInput, ElSelect, ElOption, ElDatePicker, ElInputNumber, ElForm, ElRow, ElButton, ElTable, ElTableColumn, ElCheckbox, ElMessageBox, ElPagination, ElDialog, ElTag, ElRadioGroup, ElRadio, ElUpload, ElImageViewer, ElImage, ElTreeSelect, ElTimeSelect, ElCheckboxGroup, ElEmpty, ElPopconfirm } from "element-plus";
12
+ import { localeContextKey as localeContextKey$1, ElMessage, ElTooltip, ElScrollbar, ElDivider, ElColorPicker, ElSwitch, ElDropdown, ElIcon, ElDropdownMenu, ElDropdownItem, ElDrawer, ElMenuItem, ElSubMenu, ElMenu, ElContainer, ElCol, ElFormItem, ElInput, ElSelect, ElOption, ElDatePicker, ElInputNumber, ElForm, ElRow, ElButton, ElTable, ElTableColumn, ElCheckbox, ElMessageBox, ElPagination, ElDialog, ElTag, ElRadioGroup, ElRadio, ElUpload, ElImageViewer, ElImage, ElTreeSelect, ElTimeSelect, ElCheckboxGroup, ElEmpty, ElPopover, ElPopconfirm } from "element-plus";
13
13
 
14
14
  import { useDateFormat, useNow, useFullscreen } from "@vueuse/core";
15
15
 
@@ -892,7 +892,10 @@ var merge = createAssigner((function(object, source, srcIndex) {
892
892
  labelimg: {
893
893
  saveTxt: "保存中...",
894
894
  emptyLabelText: "暂无标签数据",
895
- confirmDeleteLabel: "确定要删除该标注吗?"
895
+ confirmDeleteLabel: "确定要删除该标注吗?",
896
+ saveLabel: "保存当前标注",
897
+ instructions: "使用说明",
898
+ labelNoUpdate: "暂无标签数据更新"
896
899
  }
897
900
  }
898
901
  }, enLocale = {
@@ -967,7 +970,10 @@ var merge = createAssigner((function(object, source, srcIndex) {
967
970
  labelimg: {
968
971
  saveTxt: "saving...",
969
972
  emptyLabelText: "No label data",
970
- confirmDeleteLabel: "Are you sure you want to delete this annotation?"
973
+ confirmDeleteLabel: "Are you sure you want to delete this annotation?",
974
+ saveLabel: "save label",
975
+ instructions: "instructions",
976
+ labelNoUpdate: "No label data update"
971
977
  }
972
978
  }
973
979
  }, zhtwLocale = {
@@ -1042,7 +1048,10 @@ var merge = createAssigner((function(object, source, srcIndex) {
1042
1048
  labelimg: {
1043
1049
  saveTxt: "保存中...",
1044
1050
  emptyLabelText: "暂无标签数据",
1045
- confirmDeleteLabel: "确定要删除该标注吗?"
1051
+ confirmDeleteLabel: "确定要删除该标注吗?",
1052
+ saveLabel: "保存当前标注",
1053
+ instructions: "使用说明",
1054
+ labelNoUpdate: "暂无标签数据更新"
1046
1055
  }
1047
1056
  }
1048
1057
  };
@@ -1225,13 +1234,16 @@ var defaultConfig$4 = {
1225
1234
  } ],
1226
1235
  userDropdown: [ {
1227
1236
  value: "/",
1228
- label: "next.layout.home"
1237
+ label: "next.layout.home",
1238
+ 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>'
1229
1239
  }, {
1230
1240
  value: "/personal",
1231
- label: "next.layout.personal"
1241
+ label: "next.layout.personal",
1242
+ 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>'
1232
1243
  }, {
1233
1244
  value: "logOut",
1234
1245
  label: "next.layout.logOut",
1246
+ 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>',
1235
1247
  divided: !0
1236
1248
  } ],
1237
1249
  showTabs: !0,
@@ -1624,7 +1636,19 @@ var tools_default = export_helper_default(tools_vue_vue_type_script_lang_default
1624
1636
 
1625
1637
  var view_default = export_helper_default(view_vue_vue_type_script_lang_default, [ [ "render", function(_ctx, _cache, $props, $setup, $data, $options) {
1626
1638
  return openBlock(), createElementBlock("svg", _hoisted_1283, _hoisted_3282);
1627
- } ], [ "__file", "view.vue" ] ]), LayoutSetting = defineComponent({
1639
+ } ], [ "__file", "view.vue" ] ]), warning_vue_vue_type_script_lang_default = {
1640
+ name: "Warning"
1641
+ }, _hoisted_1288 = {
1642
+ xmlns: "http://www.w3.org/2000/svg",
1643
+ viewBox: "0 0 1024 1024"
1644
+ }, _hoisted_3287 = [ createElementVNode("path", {
1645
+ fill: "currentColor",
1646
+ 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"
1647
+ }, null, -1) ];
1648
+
1649
+ var warning_default = export_helper_default(warning_vue_vue_type_script_lang_default, [ [ "render", function(_ctx, _cache, $props, $setup, $data, $options) {
1650
+ return openBlock(), createElementBlock("svg", _hoisted_1288, _hoisted_3287);
1651
+ } ], [ "__file", "warning.vue" ] ]), LayoutSetting = defineComponent({
1628
1652
  setup() {},
1629
1653
  render() {
1630
1654
  const _slots = inject("__slots__", {}), _ns = inject("__ns__", {}), _config = inject("options", {}), _updateOptions = inject("updateOptions", null), settingConfig = reactive({
@@ -1753,7 +1777,7 @@ var view_default = export_helper_default(view_vue_vue_type_script_lang_default,
1753
1777
  class: _ns.be("config-bar-item", "label")
1754
1778
  }, [ createTextVNode("是否显示标签栏") ]), createVNode("div", {
1755
1779
  class: _ns.be("config-bar-item", "value")
1756
- }, [ createVNode(resolveComponent("el-switch"), {
1780
+ }, [ createVNode(ElSwitch, {
1757
1781
  modelValue: _config.showTabs,
1758
1782
  "onUpdate:modelValue": $event => _config.showTabs = $event
1759
1783
  }, null) ]) ]), _slots.setting?.() ]
@@ -1761,10 +1785,6 @@ var view_default = export_helper_default(view_vue_vue_type_script_lang_default,
1761
1785
  }
1762
1786
  });
1763
1787
 
1764
- function _isSlot$8(s) {
1765
- return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
1766
- }
1767
-
1768
1788
  var HeaderTools = defineComponent({
1769
1789
  setup() {
1770
1790
  const locale = inject(localeContextKey, ref()), config = inject("options", {}), {t: t} = useLocale(), {toggle: toggle, isFullscreen: isFullscreen} = useFullscreen(), language = ref(computed((() => config.language)).value), settingDrawer = ref(!1);
@@ -1816,14 +1836,15 @@ var HeaderTools = defineComponent({
1816
1836
  }) ]),
1817
1837
  dropdown: () => {
1818
1838
  let _slot;
1819
- return createVNode(ElDropdownMenu, null, _isSlot$8(_slot = _languageDropdown.map((item => createVNode(ElDropdownItem, {
1839
+ return createVNode(ElDropdownMenu, null, "function" == typeof (s = _slot = _languageDropdown.map((item => createVNode(ElDropdownItem, {
1820
1840
  command: item.value,
1821
1841
  disabled: this.language === item.value
1822
1842
  }, {
1823
1843
  default: () => [ item.label ]
1824
- })))) ? _slot : {
1844
+ })))) || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? _slot : {
1825
1845
  default: () => [ _slot ]
1826
1846
  });
1847
+ var s;
1827
1848
  }
1828
1849
  }) ]), createVNode("li", null, [ createVNode("span", {
1829
1850
  style: {
@@ -1860,6 +1881,7 @@ var HeaderTools = defineComponent({
1860
1881
  }) ]) ]), slots[slots_config_headerToolsSuffix]?.(), createVNode("li", null, [ createVNode(ElDropdown, {
1861
1882
  "show-timeout": 70,
1862
1883
  "hide-timeout": 80,
1884
+ "popper-class": _ns.be("header-tools", "userDropdown"),
1863
1885
  onCommand: command => {
1864
1886
  _emit("changeUserDropdown", command), _config.onChangeUserDropdown && _config.onChangeUserDropdown(command);
1865
1887
  }
@@ -1875,15 +1897,17 @@ var HeaderTools = defineComponent({
1875
1897
  default: () => [ createVNode(arrow_down_default, null, null) ]
1876
1898
  }) ]),
1877
1899
  dropdown: () => createVNode(ElDropdownMenu, null, {
1878
- default: () => [ _userDropdown?.map((item => {
1879
- let _slot2;
1880
- return createVNode(ElDropdownItem, {
1881
- command: item.value,
1882
- divided: !!item.divided
1883
- }, _isSlot$8(_slot2 = _t(item.label)) ? _slot2 : {
1884
- default: () => [ _slot2 ]
1885
- });
1886
- })) ]
1900
+ default: () => [ _userDropdown?.map((item => createVNode(ElDropdownItem, {
1901
+ command: item.value,
1902
+ divided: !!item.divided
1903
+ }, {
1904
+ default: () => [ item.svg ? createVNode("span", {
1905
+ innerHTML: item.svg,
1906
+ class: "item-svg"
1907
+ }, null) : null, item.iconfont ? createVNode("i", {
1908
+ class: item.iconfont
1909
+ }, null) : null, _t(item.label) ]
1910
+ }))) ]
1887
1911
  })
1888
1912
  }) ]), createVNode("li", null, [ createVNode("span", {
1889
1913
  style: {
@@ -4381,7 +4405,7 @@ const ns$8 = useNamespace("form"), InputTableSelect = defineComponent({
4381
4405
  }
4382
4406
  })(event, toRaw(row))
4383
4407
  }, null) : createVNode(ElRadio, {
4384
- label: value,
4408
+ value: value,
4385
4409
  onChange: () => {
4386
4410
  sinleSelection.value = value, multipleSelection.value = [ row ];
4387
4411
  }
@@ -4947,7 +4971,7 @@ var Element$6 = defineComponent({
4947
4971
  }, {
4948
4972
  default: () => [ col.dicData && col.dicData.map((item => createVNode(ElRadio, {
4949
4973
  key: item.value,
4950
- label: item.value,
4974
+ value: item.value,
4951
4975
  disabled: valueExist(item.disabled, !1)
4952
4976
  }, {
4953
4977
  default: () => [ item.label ]
@@ -5947,7 +5971,105 @@ const NextDragResize = withInstall(defineComponent({
5947
5971
  name: "NextDragResize",
5948
5972
  props: {},
5949
5973
  setup: () => () => createVNode(Fragment, null, [ createVNode(Fragment, null, null) ])
5950
- })), colors = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
5974
+ }));
5975
+
5976
+ var ToolHeader = defineComponent({
5977
+ props: {
5978
+ isFullscreen: {
5979
+ type: Boolean,
5980
+ default: !1
5981
+ }
5982
+ },
5983
+ emits: [ "fullscreen", "save" ],
5984
+ setup(props, {emit: emit}) {
5985
+ const _ns = inject("ns", {}), {t: t} = useLocale(), switchFillscreen = val => {
5986
+ emit("fullscreen", val);
5987
+ };
5988
+ return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ createVNode("ul", {
5989
+ class: [ _ns.be("header", "tool") ]
5990
+ }, [ createVNode("li", {
5991
+ onClick: () => emit("save")
5992
+ }, [ createVNode("svg", {
5993
+ t: "1719034799379",
5994
+ class: "icon",
5995
+ viewBox: "0 0 1024 1024",
5996
+ version: "1.1",
5997
+ xmlns: "http://www.w3.org/2000/svg",
5998
+ "p-id": "4272",
5999
+ width: "18",
6000
+ height: "18"
6001
+ }, [ createVNode("path", {
6002
+ 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",
6003
+ "p-id": "4273"
6004
+ }, null), createVNode("path", {
6005
+ d: "M536 196.3h42.7v87.2H536zM368.7 641.2h220.7v42.7H368.7zM368.7 744h170.9v42.7H368.7z",
6006
+ "p-id": "4274"
6007
+ }, null) ]), createVNode("span", {
6008
+ style: "padding-left: 3px"
6009
+ }, [ t("next.labelimg.saveLabel") ]) ]) ]), createVNode("ul", {
6010
+ class: [ _ns.be("header", "tool") ]
6011
+ }, [ createVNode("li", {
6012
+ style: "margin-right: 30px;"
6013
+ }, [ createVNode(ElPopover, {
6014
+ trigger: "hover",
6015
+ placement: "bottom",
6016
+ width: "none"
6017
+ }, {
6018
+ reference: () => createVNode("div", {
6019
+ class: "flex-center"
6020
+ }, [ createVNode("span", {
6021
+ style: "padding-right: 3px"
6022
+ }, [ t("next.labelimg.instructions") ]), createVNode(ElIcon, {
6023
+ size: 14
6024
+ }, {
6025
+ default: () => [ createVNode(warning_default, null, null) ]
6026
+ }) ]),
6027
+ default: () => createVNode("ul", {
6028
+ style: "font-size: 12px;white-space: nowrap;"
6029
+ }, [ createVNode("li", null, [ createVNode("span", null, [ createTextVNode("W:") ]), createVNode("span", null, [ createTextVNode("鼠标移入图片中,长按W键,鼠标按下左键,移动鼠标开始绘制,鼠标抬起结束绘制") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("A:") ]), createVNode("span", null, [ createTextVNode("A键进入上一张图片进行标注") ]) ]), createVNode("li", null, [ createVNode("span", null, [ createTextVNode("D:") ]), createVNode("span", null, [ createTextVNode("D键进入下一张图片进行标注") ]) ]) ])
6030
+ }) ]), props.isFullscreen ? createVNode("li", {
6031
+ onClick: () => switchFillscreen(!1)
6032
+ }, [ createVNode(ElTooltip, {
6033
+ placement: "top",
6034
+ content: "取消全屏"
6035
+ }, {
6036
+ default: () => [ createVNode("svg", {
6037
+ t: "1719035442027",
6038
+ class: "icon",
6039
+ viewBox: "0 0 1024 1024",
6040
+ version: "1.1",
6041
+ xmlns: "http://www.w3.org/2000/svg",
6042
+ "p-id": "5388",
6043
+ width: "18",
6044
+ height: "18"
6045
+ }, [ createVNode("path", {
6046
+ 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",
6047
+ "p-id": "5389"
6048
+ }, null) ]) ]
6049
+ }) ]) : createVNode("li", {
6050
+ onClick: () => switchFillscreen(!0)
6051
+ }, [ createVNode(ElTooltip, {
6052
+ placement: "top",
6053
+ content: "全屏"
6054
+ }, {
6055
+ default: () => [ createVNode("svg", {
6056
+ t: "1719035375323",
6057
+ class: "icon",
6058
+ viewBox: "0 0 1024 1024",
6059
+ version: "1.1",
6060
+ xmlns: "http://www.w3.org/2000/svg",
6061
+ "p-id": "5241",
6062
+ width: "18",
6063
+ height: "18"
6064
+ }, [ createVNode("path", {
6065
+ 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",
6066
+ "p-id": "5242"
6067
+ }, null) ]) ]
6068
+ }) ]) ]) ]) ]);
6069
+ }
6070
+ });
6071
+
6072
+ const colors = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
5951
6073
  const label_type = rect.type, x_center = rect.startX + rect.rectWidth / 2, y_center = rect.startY + rect.rectHeight / 2;
5952
6074
  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)) ];
5953
6075
  }, canvertToCanvas = (labelData, canvasWidth, canvasHeight) => {
@@ -6001,7 +6123,7 @@ var ContextMenuLabel = defineComponent({
6001
6123
  labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
6002
6124
  }));
6003
6125
  const labelMenuRef = ref(), labelStyleFixed = computed((() => {
6004
- const {left: left, top: top, canvasHeight: canvasHeight} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - canvasHeight;
6126
+ const {left: left, top: top} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - window.innerHeight;
6005
6127
  let y = top;
6006
6128
  return height_diff > 0 && (y -= height_diff), {
6007
6129
  top: y + "px",
@@ -6249,6 +6371,12 @@ var DraggableRect = defineComponent({
6249
6371
  })),
6250
6372
  label_txt: yolo_label.join("\n")
6251
6373
  };
6374
+ }, setContainerWidthHeight = (canvasWidth, canvasHeight) => {
6375
+ canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
6376
+ canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
6377
+ canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px",
6378
+ canvasRectRef.value.width = canvasWidth, canvasRectRef.value.height = canvasHeight,
6379
+ canvasRectRef.value.style.width = canvasWidth + "px", canvasRectRef.value.style.height = canvasHeight + "px";
6252
6380
  }, loadingImage = ref(!1), renderImageLabel = rowInfo => {
6253
6381
  labels.value = (rowInfo => rowInfo.labels ? rowInfo.labels.map((rect => {
6254
6382
  const typeName = props.classes[rect.type];
@@ -6259,14 +6387,13 @@ var DraggableRect = defineComponent({
6259
6387
  const image = new Image;
6260
6388
  image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
6261
6389
  loadingImage.value = !1;
6262
- const {width: width, height: height} = image, canvasHeight = clientHeight, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
6263
- ((canvasWidth, canvasHeight) => {
6264
- canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
6265
- canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
6266
- canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px",
6267
- canvasRectRef.value.width = canvasWidth, canvasRectRef.value.height = canvasHeight,
6268
- canvasRectRef.value.style.width = canvasWidth + "px", canvasRectRef.value.style.height = canvasHeight + "px";
6269
- })(canvasWidth, canvasHeight), labels.value = ((labels, canvasHeight) => {
6390
+ let {width: width, height: height} = image;
6391
+ if (height > clientHeight) {
6392
+ const scale = height / clientHeight;
6393
+ height = clientHeight, image.style.height = height + "px", width /= scale;
6394
+ }
6395
+ const canvasHeight = height, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
6396
+ setContainerWidthHeight(canvasWidth, canvasHeight), labels.value = ((labels, canvasHeight) => {
6270
6397
  let scale_rects = [];
6271
6398
  for (let i = 0; i < labels.length; i++) {
6272
6399
  const rect = labels[i], scale = parseFloat((canvasHeight / rect.canvasHeight).toFixed(3));
@@ -6407,9 +6534,11 @@ var DraggableRect = defineComponent({
6407
6534
  left: 0,
6408
6535
  activateRect: null
6409
6536
  }), updateContextmenuLabelFixed = (x, y, rect) => {
6410
- contextmenuLabelFixed.value.show = !0, contextmenuLabelFixed.value.left = x, contextmenuLabelFixed.value.top = y,
6411
- contextmenuLabelFixed.value.canvasWidth = canvasBaseRef.value.width, contextmenuLabelFixed.value.canvasHeight = canvasBaseRef.value.height,
6412
- contextmenuLabelFixed.value.activateRect = rect, activate_add_label.value = rect;
6537
+ const contextRect = canvasBaseRef.value.getBoundingClientRect();
6538
+ contextmenuLabelFixed.value.show = !0, contextmenuLabelFixed.value.left = x + contextRect.x,
6539
+ contextmenuLabelFixed.value.top = y + contextRect.y, contextmenuLabelFixed.value.canvasWidth = canvasBaseRef.value.width,
6540
+ contextmenuLabelFixed.value.canvasHeight = canvasBaseRef.value.height, contextmenuLabelFixed.value.activateRect = rect,
6541
+ activate_add_label.value = rect;
6413
6542
  }, onCloseContentmenuLabel = () => {
6414
6543
  contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
6415
6544
  contextmenuLabelFixed.value.activateRect = null, activate_add_label.value = null,
@@ -6477,7 +6606,14 @@ var DraggableRect = defineComponent({
6477
6606
  updateDraggableRectFixed(x, y, rect, index, colors[type]);
6478
6607
  }));
6479
6608
  },
6480
- onDeleteLabel: onDeleteLabel
6609
+ onDeleteLabel: onDeleteLabel,
6610
+ rerenderImage: () => {
6611
+ setContainerWidthHeight(0, 0), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
6612
+ nextTick((() => {
6613
+ const rowInfo = toRaw(props.rowInfo);
6614
+ renderImageLabel(rowInfo);
6615
+ }));
6616
+ }
6481
6617
  });
6482
6618
  return () => createVNode(Fragment, null, [ createVNode(NextSpinLoading, {
6483
6619
  loading: loadingImage.value,
@@ -6510,6 +6646,9 @@ var DraggableRect = defineComponent({
6510
6646
  }
6511
6647
  }), RightLabel = defineComponent({
6512
6648
  props: {
6649
+ contentHeight: {
6650
+ type: Number
6651
+ },
6513
6652
  classes: {
6514
6653
  type: Array,
6515
6654
  default: () => []
@@ -6533,7 +6672,10 @@ var DraggableRect = defineComponent({
6533
6672
  immediate: !0
6534
6673
  });
6535
6674
  const renderContent = () => createVNode("div", {
6536
- class: [ ns.b("right") ]
6675
+ class: [ ns.b("right") ],
6676
+ style: {
6677
+ height: props.contentHeight + "px"
6678
+ }
6537
6679
  }, [ labels.value.length ? createVNode("ul", null, [ labels.value.map(((rect, index) => createVNode("li", {
6538
6680
  key: index,
6539
6681
  onClick: () => ((rect, index) => {
@@ -6567,7 +6709,7 @@ var DraggableRect = defineComponent({
6567
6709
  return () => createVNode(Fragment, null, [ renderContent() ]);
6568
6710
  }
6569
6711
  }), defaultConfig = {
6570
- mainContentHeight: 600
6712
+ minContentHeight: 500
6571
6713
  };
6572
6714
 
6573
6715
  const ns$1 = useNamespace("labelimg");
@@ -6581,9 +6723,7 @@ var Element = defineComponent({
6581
6723
  },
6582
6724
  style: {
6583
6725
  type: Object,
6584
- default: () => ({
6585
- position: "unset"
6586
- })
6726
+ default: () => ({})
6587
6727
  },
6588
6728
  rowKey: {
6589
6729
  type: String,
@@ -6666,9 +6806,8 @@ var Element = defineComponent({
6666
6806
  if (loading.value) return;
6667
6807
  loading.value = !0;
6668
6808
  const {node: node, label_txt: label_txt} = formatNodeLabels();
6669
- if (canvasContextRef.value.onCloseDraggableRectFixed(), isChangeNodeLabels()) return activateNodeIndex.value = index,
6670
- void (loading.value = !1);
6671
- emit("save", {
6809
+ return canvasContextRef.value.onCloseDraggableRectFixed(), isChangeNodeLabels() ? (activateNodeIndex.value = index,
6810
+ loading.value = !1, !1) : (emit("save", {
6672
6811
  node: node,
6673
6812
  label_txt: label_txt
6674
6813
  }, (imageItem => {
@@ -6676,7 +6815,7 @@ var Element = defineComponent({
6676
6815
  loading.value = !1;
6677
6816
  }), (() => {
6678
6817
  loading.value = !1;
6679
- }));
6818
+ })), !0);
6680
6819
  }, onPaginationPrev = () => {
6681
6820
  const imageLength = labelImages.value.length;
6682
6821
  let i = activateNodeIndex.value - 1;
@@ -6685,30 +6824,35 @@ var Element = defineComponent({
6685
6824
  const imageLength = labelImages.value.length;
6686
6825
  let i = activateNodeIndex.value + 1;
6687
6826
  i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
6688
- }, canvasContextRef = ref(), layoutLabelRef = ref(), headerRef = ref(), mainRef = ref(), footerRef = ref(), mainContentHeight = ref(options.mainContentHeight);
6689
- onMounted((() => {
6690
- document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value, (() => {
6691
- nextTick((() => {
6692
- layoutLabelRef.value.style.position = "unset";
6693
- const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
6694
- mainContentHeight.value = contentHeight;
6695
- }));
6827
+ }, canvasContextRef = ref(), layoutLabelRef = ref(), headerRef = ref(), mainRef = ref(), footerRef = ref(), mainContentHeight = ref(options.minContentHeight), updateMainContentHeight = () => {
6828
+ nextTick((() => {
6829
+ const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
6830
+ mainContentHeight.value = contentHeight;
6696
6831
  }));
6832
+ };
6833
+ onMounted((() => {
6834
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value.parentElement, (() => {
6835
+ updateMainContentHeight();
6836
+ })), window.addEventListener("resize", updateMainContentHeight);
6697
6837
  })), onUnmounted((() => {
6698
- document.removeEventListener("keydown", onKeydownPrevNext);
6838
+ document.removeEventListener("keydown", onKeydownPrevNext), window.removeEventListener("resize", updateMainContentHeight);
6699
6839
  }));
6700
6840
  const onSelectLabelNode = (rect, index) => {
6701
6841
  canvasContextRef.value.onSelectedLabel(rect, index);
6702
6842
  }, onDeleteLabelNode = rect => {
6703
6843
  canvasContextRef.value.onDeleteLabel(rect);
6844
+ }, isFullscreen = ref(!1), onSwitchFillscreen = val => {
6845
+ isFullscreen.value = val, updateMainContentHeight(), nextTick((() => {
6846
+ canvasContextRef.value.rerenderImage();
6847
+ }));
6704
6848
  };
6705
6849
  expose({
6706
6850
  convertToLabel: convertToLabel,
6707
6851
  canvertToCanvas: canvertToCanvas
6708
6852
  });
6709
- return () => createVNode(Fragment, null, [ createVNode("div", {
6853
+ const renderContent = () => createVNode("div", {
6710
6854
  ref: layoutLabelRef,
6711
- class: [ ns$1.b(), props.className ],
6855
+ class: [ ns$1.b(), props.className, isFullscreen.value ? ns$1.b("fullscreen") : "" ],
6712
6856
  style: {
6713
6857
  ...props.style
6714
6858
  }
@@ -6721,21 +6865,35 @@ var Element = defineComponent({
6721
6865
  default: () => [ createVNode("header", {
6722
6866
  ref: headerRef,
6723
6867
  class: [ ns$1.b("header") ]
6724
- }, [ slots.header ? slots.header() : createVNode(Fragment, null, [ createVNode("ul", null, null), createVNode("ul", null, null) ]) ]), createVNode("div", {
6725
- ref: mainRef,
6726
- class: [ ns$1.b("main") ],
6727
- style: {
6728
- height: mainContentHeight.value + "px"
6868
+ }, [ slots.header ? slots.header() : createVNode(ToolHeader, {
6869
+ isFullscreen: isFullscreen.value,
6870
+ onFullscreen: onSwitchFillscreen,
6871
+ onSave: () => {
6872
+ onChangeActivateNode(activateNodeIndex.value) || ElMessage({
6873
+ type: "info",
6874
+ message: t("next.labelimg.labelNoUpdate")
6875
+ });
6729
6876
  }
6730
- }, [ createVNode("div", {
6877
+ }, null) ]), createVNode("div", {
6878
+ ref: mainRef,
6879
+ class: [ ns$1.b("main") ]
6880
+ }, [ createVNode(ElScrollbar, {
6731
6881
  class: [ ns$1.be("main", "content") ]
6732
- }, [ createVNode(CanvasContext, {
6733
- ref: canvasContextRef,
6734
- contextClientHeight: mainContentHeight.value,
6735
- classes: classes.value,
6736
- rowInfo: currentNode.value,
6737
- onChange: onChangeNodeRect
6738
- }, null) ]), createVNode(RightLabel, {
6882
+ }, {
6883
+ default: () => [ createVNode("div", {
6884
+ class: [ ns$1.be("main", "content") ],
6885
+ style: {
6886
+ height: mainContentHeight.value + "px"
6887
+ }
6888
+ }, [ createVNode(CanvasContext, {
6889
+ ref: canvasContextRef,
6890
+ contextClientHeight: mainContentHeight.value,
6891
+ classes: classes.value,
6892
+ rowInfo: currentNode.value,
6893
+ onChange: onChangeNodeRect
6894
+ }, null) ]) ]
6895
+ }), createVNode(RightLabel, {
6896
+ contentHeight: mainContentHeight.value,
6739
6897
  classes: classes.value,
6740
6898
  labels: activateNodeLabels.value,
6741
6899
  onDelete: onDeleteLabelNode,
@@ -6780,7 +6938,8 @@ var Element = defineComponent({
6780
6938
  default: () => [ createVNode(arrow_right_default, null, null) ]
6781
6939
  }) ]) ]) ]
6782
6940
  }) ]
6783
- }) ]) ]);
6941
+ }) ]);
6942
+ return () => createVNode(Fragment, null, [ renderContent() ]);
6784
6943
  }
6785
6944
  });
6786
6945
 
@@ -6908,7 +7067,7 @@ const zoomDialog = app => {
6908
7067
  }));
6909
7068
  }
6910
7069
  });
6911
- }, version = "0.3.0", install = function(app) {
7070
+ }, version = "0.3.1", install = function(app) {
6912
7071
  Object.keys(components).forEach((key => {
6913
7072
  const component = components[key];
6914
7073
  app.component(component.name, component);
@@ -6918,7 +7077,7 @@ const zoomDialog = app => {
6918
7077
  };
6919
7078
 
6920
7079
  var index = {
6921
- version: "0.3.0",
7080
+ version: "0.3.1",
6922
7081
  install: install
6923
7082
  };
6924
7083