next-element-vue 0.2.6 → 0.2.8

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,12 +2,12 @@
2
2
  /**
3
3
  * 作  者:huangteng
4
4
  * 邮  箱:htengweb@163.com
5
- * 当前版本:0.2.6 v
6
- * 发布日期:2024-06-06
5
+ * 当前版本:0.2.8 v
6
+ * 发布日期:2024-06-12
7
7
  * 地  址:https://www.npmjs.com/package/next-element-vue
8
8
  */
9
9
 
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 } from "vue";
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
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 } from "element-plus";
13
13
 
@@ -887,6 +887,9 @@ var merge = createAssigner((function(object, source, srcIndex) {
887
887
  tabsRight: "关闭右侧",
888
888
  tabsAll: "关闭全部",
889
889
  systemSetting: "系统配置"
890
+ },
891
+ labelimg: {
892
+ saveTxt: "保存中..."
890
893
  }
891
894
  }
892
895
  }, enLocale = {
@@ -956,6 +959,9 @@ var merge = createAssigner((function(object, source, srcIndex) {
956
959
  tabsRight: "close right",
957
960
  tabsAll: "close all",
958
961
  systemSetting: "system setting"
962
+ },
963
+ labelimg: {
964
+ saveTxt: "saving..."
959
965
  }
960
966
  }
961
967
  }, zhtwLocale = {
@@ -1025,6 +1031,9 @@ var merge = createAssigner((function(object, source, srcIndex) {
1025
1031
  tabsRight: "關閉右側",
1026
1032
  tabsAll: "關閉全部",
1027
1033
  systemSetting: "系統配置"
1034
+ },
1035
+ labelimg: {
1036
+ saveTxt: "保存中..."
1028
1037
  }
1029
1038
  }
1030
1039
  };
@@ -1235,7 +1244,7 @@ var defaultConfig$3 = {
1235
1244
  }
1236
1245
  };
1237
1246
 
1238
- const ns$i = useNamespace("text-ellipsis");
1247
+ const ns$j = useNamespace("text-ellipsis");
1239
1248
 
1240
1249
  const NextTextEllipsis = withInstall(defineComponent({
1241
1250
  name: "NextTextEllipsis",
@@ -1282,7 +1291,7 @@ const NextTextEllipsis = withInstall(defineComponent({
1282
1291
  }
1283
1292
  };
1284
1293
  return () => createVNode(Fragment, null, [ createVNode("div", {
1285
- class: [ ns$i.b(), props.class ],
1294
+ class: [ ns$j.b(), props.class ],
1286
1295
  style: setWidth.value,
1287
1296
  onMouseenter: onMouseenter
1288
1297
  }, [ isTip.value ? createVNode(ElTooltip, {
@@ -1292,11 +1301,11 @@ const NextTextEllipsis = withInstall(defineComponent({
1292
1301
  disabled: props.disabled
1293
1302
  }, {
1294
1303
  default: () => [ createVNode("span", {
1295
- class: ns$i.e("text"),
1304
+ class: ns$j.e("text"),
1296
1305
  ref: ellipsisRef
1297
1306
  }, [ slots.default ? slots.default() : props.content ]) ]
1298
1307
  }) : createVNode("span", {
1299
- class: ns$i.e("text"),
1308
+ class: ns$j.e("text"),
1300
1309
  ref: ellipsisRef
1301
1310
  }, [ slots.default ? slots.default() : props.content ]) ]) ]);
1302
1311
  }
@@ -1333,7 +1342,31 @@ var LogoView = defineComponent({
1333
1342
 
1334
1343
  var arrow_down_default = export_helper_default(arrow_down_vue_vue_type_script_lang_default, [ [ "render", function(_ctx, _cache, $props, $setup, $data, $options) {
1335
1344
  return openBlock(), createElementBlock("svg", _hoisted_16, _hoisted_36);
1336
- } ], [ "__file", "arrow-down.vue" ] ]), arrow_up_vue_vue_type_script_lang_default = {
1345
+ } ], [ "__file", "arrow-down.vue" ] ]), arrow_left_vue_vue_type_script_lang_default = {
1346
+ name: "ArrowLeft"
1347
+ }, _hoisted_18 = {
1348
+ xmlns: "http://www.w3.org/2000/svg",
1349
+ viewBox: "0 0 1024 1024"
1350
+ }, _hoisted_38 = [ createElementVNode("path", {
1351
+ fill: "currentColor",
1352
+ d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
1353
+ }, null, -1) ];
1354
+
1355
+ var arrow_left_default = export_helper_default(arrow_left_vue_vue_type_script_lang_default, [ [ "render", function(_ctx, _cache, $props, $setup, $data, $options) {
1356
+ return openBlock(), createElementBlock("svg", _hoisted_18, _hoisted_38);
1357
+ } ], [ "__file", "arrow-left.vue" ] ]), arrow_right_vue_vue_type_script_lang_default = {
1358
+ name: "ArrowRight"
1359
+ }, _hoisted_110 = {
1360
+ xmlns: "http://www.w3.org/2000/svg",
1361
+ viewBox: "0 0 1024 1024"
1362
+ }, _hoisted_310 = [ createElementVNode("path", {
1363
+ fill: "currentColor",
1364
+ d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
1365
+ }, null, -1) ];
1366
+
1367
+ var arrow_right_default = export_helper_default(arrow_right_vue_vue_type_script_lang_default, [ [ "render", function(_ctx, _cache, $props, $setup, $data, $options) {
1368
+ return openBlock(), createElementBlock("svg", _hoisted_110, _hoisted_310);
1369
+ } ], [ "__file", "arrow-right.vue" ] ]), arrow_up_vue_vue_type_script_lang_default = {
1337
1370
  name: "ArrowUp"
1338
1371
  }, _hoisted_112 = {
1339
1372
  xmlns: "http://www.w3.org/2000/svg",
@@ -2644,7 +2677,7 @@ const NextMenuItem = defineComponent({
2644
2677
  }, null) ]
2645
2678
  }))) ]) ]);
2646
2679
  }
2647
- }), ns$h = useNamespace("menu");
2680
+ }), ns$i = useNamespace("menu");
2648
2681
 
2649
2682
  const NextMenu = withInstall(defineComponent({
2650
2683
  name: "NextMenu",
@@ -2672,13 +2705,13 @@ const NextMenu = withInstall(defineComponent({
2672
2705
  }
2673
2706
  },
2674
2707
  setup(props) {
2675
- provide("ns", ns$h);
2708
+ provide("ns", ns$i);
2676
2709
  const router = getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, activePath = ref(currentPath);
2677
2710
  watch((() => router.currentRoute?.value), (to => {
2678
2711
  activePath.value = to.fullPath;
2679
2712
  }));
2680
2713
  return () => createVNode(Fragment, null, [ createVNode(ElMenu, {
2681
- class: [ ns$h.b(), props.className ],
2714
+ class: [ ns$i.b(), props.className ],
2682
2715
  style: props.style,
2683
2716
  defaultActive: activePath.value,
2684
2717
  router: props.router,
@@ -2686,7 +2719,7 @@ const NextMenu = withInstall(defineComponent({
2686
2719
  ellipsis: !0
2687
2720
  }, {
2688
2721
  default: () => [ createVNode(Fragment, null, [ props.menuTree.map((item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : createVNode(ElSubMenu, {
2689
- "popper-class": ns$h.b("popper"),
2722
+ "popper-class": ns$i.b("popper"),
2690
2723
  index: item.path || item.id,
2691
2724
  teleported: !0
2692
2725
  }, {
@@ -2697,7 +2730,7 @@ const NextMenu = withInstall(defineComponent({
2697
2730
  menuData: item.children
2698
2731
  }, null)
2699
2732
  }) : valueExist(item.meta?.isHide, !1) ? null : createVNode(ElMenuItem, {
2700
- "popper-class": ns$h.b("popper"),
2733
+ "popper-class": ns$i.b("popper"),
2701
2734
  index: item.path
2702
2735
  }, {
2703
2736
  default: () => [ createVNode(MenuItemTitle, {
@@ -2725,20 +2758,20 @@ var Sidebar$2 = defineComponent({
2725
2758
  }
2726
2759
  });
2727
2760
 
2728
- const ns$g = useNamespace("layout-defaults");
2761
+ const ns$h = useNamespace("layout-defaults");
2729
2762
 
2730
2763
  var defaults = defineComponent({
2731
2764
  props: {},
2732
- setup: () => (provide("ns", ns$g), {}),
2765
+ setup: () => (provide("ns", ns$h), {}),
2733
2766
  render() {
2734
2767
  const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {});
2735
2768
  slots.menu;
2736
2769
  const isTabs = ref(!!slots.tabs);
2737
2770
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), createVNode(ElContainer, {
2738
- class: ns$g.b()
2771
+ class: ns$h.b()
2739
2772
  }, {
2740
2773
  default: () => [ createVNode(Sidebar$2, null, null), createVNode("div", {
2741
- class: [ ns$g.b("content") ]
2774
+ class: [ ns$h.b("content") ]
2742
2775
  }, [ createVNode(Header$3, null, null), _config.showTabs ? slots.tabs ? slots.tabs?.() : createVNode(NextTabs, {
2743
2776
  tabs: _config.tabs,
2744
2777
  activeTab: _config.activeTab,
@@ -2746,7 +2779,7 @@ var defaults = defineComponent({
2746
2779
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2747
2780
  onClose: (...arg) => _emit("tabsClose", ...arg)
2748
2781
  }, null) : null, createVNode("main", {
2749
- class: [ ns$g.bf("main"), ns$g.is("layout-tabs", isTabs.value) ]
2782
+ class: [ ns$h.bf("main"), ns$h.is("layout-tabs", isTabs.value) ]
2750
2783
  }, [ slots.default?.() ]) ]) ]
2751
2784
  });
2752
2785
  }
@@ -2779,11 +2812,11 @@ var Header$2 = defineComponent({
2779
2812
  }
2780
2813
  });
2781
2814
 
2782
- const ns$f = useNamespace("layout-transverse");
2815
+ const ns$g = useNamespace("layout-transverse");
2783
2816
 
2784
2817
  var transverse = defineComponent({
2785
2818
  props: {},
2786
- setup: () => (provide("ns", ns$f), {}),
2819
+ setup: () => (provide("ns", ns$g), {}),
2787
2820
  render() {
2788
2821
  const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {}), __slots_header = {};
2789
2822
  slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
@@ -2800,7 +2833,7 @@ var transverse = defineComponent({
2800
2833
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2801
2834
  onClose: (...arg) => _emit("tabsClose", ...arg)
2802
2835
  }, null) : null, createVNode("main", {
2803
- class: [ ns$f.b("main"), ns$f.is("layout-tabs", isTabs.value) ]
2836
+ class: [ ns$g.b("main"), ns$g.is("layout-tabs", isTabs.value) ]
2804
2837
  }, [ slots.default?.() ]) ]);
2805
2838
  var s;
2806
2839
  }
@@ -2842,11 +2875,11 @@ var Header$1 = defineComponent({
2842
2875
  }
2843
2876
  });
2844
2877
 
2845
- const ns$e = useNamespace("layout-columns");
2878
+ const ns$f = useNamespace("layout-columns");
2846
2879
 
2847
2880
  var columns = defineComponent({
2848
2881
  props: {},
2849
- setup: () => (provide("ns", ns$e), {}),
2882
+ setup: () => (provide("ns", ns$f), {}),
2850
2883
  render() {
2851
2884
  const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {}), __slots_header = {};
2852
2885
  slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
@@ -2854,11 +2887,11 @@ var columns = defineComponent({
2854
2887
  slots[slots_config_headerToolsSuffix] && (__slots_header[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2855
2888
  const isTabs = ref(!!slots.tabs);
2856
2889
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), createVNode(ElContainer, {
2857
- class: ns$e.b()
2890
+ class: ns$f.b()
2858
2891
  }, {
2859
2892
  default: () => {
2860
2893
  return [ createVNode(Sidebar$1, null, null), createVNode("div", {
2861
- class: [ ns$e.b("content") ]
2894
+ class: [ ns$f.b("content") ]
2862
2895
  }, [ createVNode(Header$1, null, (s = __slots_header, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? __slots_header : {
2863
2896
  default: () => [ __slots_header ]
2864
2897
  })), _config.showTabs ? slots.tabs ? slots.tabs?.() : createVNode(NextTabs, {
@@ -2868,7 +2901,7 @@ var columns = defineComponent({
2868
2901
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2869
2902
  onClose: (...arg) => _emit("tabsClose", ...arg)
2870
2903
  }, null) : null, createVNode("main", {
2871
- class: [ ns$e.bf("main"), ns$e.is("layout-tabs", isTabs.value) ]
2904
+ class: [ ns$f.bf("main"), ns$f.is("layout-tabs", isTabs.value) ]
2872
2905
  }, [ slots.default?.() ]) ]) ];
2873
2906
  var s;
2874
2907
  }
@@ -2914,21 +2947,21 @@ var Header = defineComponent({
2914
2947
  }
2915
2948
  });
2916
2949
 
2917
- const ns$d = useNamespace("layout-classic");
2950
+ const ns$e = useNamespace("layout-classic");
2918
2951
 
2919
2952
  var classic = defineComponent({
2920
2953
  props: {},
2921
- setup: () => (provide("ns", ns$d), {
2922
- ns: ns$d
2954
+ setup: () => (provide("ns", ns$e), {
2955
+ ns: ns$e
2923
2956
  }),
2924
2957
  render() {
2925
2958
  const slots = this.$slots, _config = inject("options", {}), _emit = inject("__emit__", {});
2926
2959
  slots.menu;
2927
2960
  const isTabs = ref(!!slots.tabs);
2928
2961
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), createVNode(Fragment, null, [ createVNode(Header, null, null), createVNode("div", {
2929
- class: [ ns$d.b("content"), ns$d.is("layout-tabs", isTabs.value) ]
2962
+ class: [ ns$e.b("content"), ns$e.is("layout-tabs", isTabs.value) ]
2930
2963
  }, [ createVNode(Sidebar, null, null), createVNode("div", {
2931
- class: ns$d.b("container")
2964
+ class: ns$e.b("container")
2932
2965
  }, [ _config.showTabs ? slots.tabs ? slots.tabs?.() : createVNode(NextTabs, {
2933
2966
  tabs: _config.tabs,
2934
2967
  activeTab: _config.activeTab,
@@ -2936,12 +2969,12 @@ var classic = defineComponent({
2936
2969
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2937
2970
  onClose: (...arg) => _emit("tabsClose", ...arg)
2938
2971
  }, null) : null, createVNode("main", {
2939
- class: [ ns$d.b("main") ]
2972
+ class: [ ns$e.b("main") ]
2940
2973
  }, [ slots.default?.() ]) ]) ]) ]);
2941
2974
  }
2942
2975
  });
2943
2976
 
2944
- const ns$c = useNamespace("layout"), layouts = {
2977
+ const ns$d = useNamespace("layout"), layouts = {
2945
2978
  defaults: markRaw(defaults),
2946
2979
  transverse: markRaw(transverse),
2947
2980
  columns: markRaw(columns),
@@ -2969,7 +3002,7 @@ const NextLayout = withInstall(defineComponent({
2969
3002
  emits: [ "changeLanguage", "changeUserDropdown", "changeOptions", "tabsChange", "tabsSelect", "tabsClose" ],
2970
3003
  setup(props, {slots: slots, emit: emit}) {
2971
3004
  const _config = ref(mergeWith(defaultConfig$3, props.options, customizerCoverArray));
2972
- provide("options", _config.value), provide("__ns__", ns$c), provide("__emit__", emit),
3005
+ provide("options", _config.value), provide("__ns__", ns$d), provide("__emit__", emit),
2973
3006
  provide("__slots__", slots);
2974
3007
  const updateOptions = cfg => {
2975
3008
  _config.value = mergeWith(_config.value, cfg, customizerCoverArray), updateThemeColorCssVar(_config.value?.setting),
@@ -2993,15 +3026,15 @@ const NextLayout = withInstall(defineComponent({
2993
3026
  const _activeSlots = {};
2994
3027
  for (const key in slots) Object.prototype.hasOwnProperty.call(slots, key) && (_activeSlots[key] = () => slots[key]?.());
2995
3028
  return createVNode("div", {
2996
- class: [ ns$c.b(), props.className ],
3029
+ class: [ ns$d.b(), props.className ],
2997
3030
  style: props.style
2998
3031
  }, [ h(activeLayout.value, {}, {
2999
3032
  ..._activeSlots
3000
3033
  }) ]);
3001
3034
  }
3002
- })), ns$b = useNamespace("tabs");
3035
+ })), ns$c = useNamespace("tabs");
3003
3036
 
3004
- var Element$7 = defineComponent({
3037
+ var Element$8 = defineComponent({
3005
3038
  name: "NextTabs",
3006
3039
  props: {
3007
3040
  activeTab: {
@@ -3070,12 +3103,12 @@ var Element$7 = defineComponent({
3070
3103
  tabsView.value.push(activeRoute)), emit("change", activeIndex.value, tabsView.value, "add");
3071
3104
  }));
3072
3105
  const renderContent = () => createVNode("nav", {
3073
- class: ns$b.b()
3106
+ class: ns$c.b()
3074
3107
  }, [ createVNode(ElScrollbar, null, {
3075
3108
  default: () => [ createVNode("ul", {
3076
- class: ns$b.b("list")
3109
+ class: ns$c.b("list")
3077
3110
  }, [ tabsView.value.map(((tab, index) => tab ? createVNode("li", {
3078
- class: [ "tab-item", ns$b.is("active", activeIndex.value === index) ],
3111
+ class: [ "tab-item", ns$c.is("active", activeIndex.value === index) ],
3079
3112
  onClick: event => onClickTabItem(event, tab, index)
3080
3113
  }, [ createVNode("i", {
3081
3114
  class: [ "tab-icon", tab.meta?.icon ]
@@ -3106,11 +3139,11 @@ var Element$7 = defineComponent({
3106
3139
  onCommand: onChange
3107
3140
  }, {
3108
3141
  default: () => createVNode("span", {
3109
- class: ns$b.b("tab-more")
3142
+ class: ns$c.b("tab-more")
3110
3143
  }, [ createVNode("i", {
3111
- class: [ ns$b.be("tab-more", "box"), ns$b.be("tab-more", "top") ]
3144
+ class: [ ns$c.be("tab-more", "box"), ns$c.be("tab-more", "top") ]
3112
3145
  }, null), createVNode("i", {
3113
- class: [ ns$b.be("tab-more", "box"), ns$b.be("tab-more", "bottom") ]
3146
+ class: [ ns$c.be("tab-more", "box"), ns$c.be("tab-more", "bottom") ]
3114
3147
  }, null) ]),
3115
3148
  dropdown: () => createVNode(ElDropdownMenu, null, {
3116
3149
  default: () => [ createVNode(ElDropdownItem, {
@@ -3144,7 +3177,7 @@ var Element$7 = defineComponent({
3144
3177
  }
3145
3178
  });
3146
3179
 
3147
- const NextTabs = withInstall(Element$7), ns$a = useNamespace("container");
3180
+ const NextTabs = withInstall(Element$8), ns$b = useNamespace("container");
3148
3181
 
3149
3182
  const NextContainer = withInstall(defineComponent({
3150
3183
  name: "NextContainer",
@@ -3183,22 +3216,26 @@ const NextContainer = withInstall(defineComponent({
3183
3216
  }), style;
3184
3217
  }));
3185
3218
  return () => props.scrollbar ? createVNode(ElScrollbar, {
3186
- class: [ ns$a.b(), props.className ],
3219
+ class: [ ns$b.b(), props.className ],
3187
3220
  style: props.style
3188
3221
  }, {
3189
3222
  default: () => [ slots.default?.() ]
3190
3223
  }) : createVNode("div", {
3191
- class: [ ns$a.b(), props.className ],
3224
+ class: [ ns$b.b(), props.className ],
3192
3225
  style: {
3193
3226
  ...styles.value,
3194
3227
  ...props.style
3195
3228
  }
3196
3229
  }, [ props.card ? createVNode("div", {
3197
- class: ns$a.b("card")
3230
+ class: ns$b.b("card")
3198
3231
  }, [ slots.default?.() ]) : slots.default?.() ]);
3199
3232
  }
3200
3233
  }));
3201
3234
 
3235
+ function isEqual(value, other) {
3236
+ return baseIsEqual(value, other);
3237
+ }
3238
+
3202
3239
  var defaultPropsConfig = {
3203
3240
  className: {
3204
3241
  type: String,
@@ -3315,9 +3352,9 @@ var defaultConfig$2 = {
3315
3352
  formColumnMinWidth: 350
3316
3353
  };
3317
3354
 
3318
- const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$9 = useNamespace("spin-loading");
3355
+ const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$a = useNamespace("spin-loading");
3319
3356
 
3320
- var SpinLoading = defineComponent({
3357
+ var NextSpinLoading$1 = defineComponent({
3321
3358
  name: "NextSpinLoading",
3322
3359
  props: {
3323
3360
  className: {
@@ -3346,23 +3383,23 @@ var SpinLoading = defineComponent({
3346
3383
  render() {
3347
3384
  const _t = this.t, slots = this.$slots, props = this.$props, loadingText = props.tip || _t("next.loading");
3348
3385
  return createVNode("div", {
3349
- class: [ ns$9.b(), props.className ],
3386
+ class: [ ns$a.b(), props.className ],
3350
3387
  style: props.style
3351
- }, [ props.loading ? createVNode("div", {
3352
- class: ns$9.b("mask")
3388
+ }, [ slots.default?.(), props.loading ? createVNode("div", {
3389
+ class: ns$a.b("mask")
3353
3390
  }, [ createVNode("span", {
3354
- class: ns$9.b("mask-dot")
3391
+ class: ns$a.b("mask-dot")
3355
3392
  }, [ createVNode("i", {
3356
- class: ns$9.be("mask", "dot-item")
3393
+ class: ns$a.be("mask", "dot-item")
3357
3394
  }, null), createVNode("i", {
3358
- class: ns$9.be("mask", "dot-item")
3395
+ class: ns$a.be("mask", "dot-item")
3359
3396
  }, null), createVNode("i", {
3360
- class: ns$9.be("mask", "dot-item")
3397
+ class: ns$a.be("mask", "dot-item")
3361
3398
  }, null), createVNode("i", {
3362
- class: ns$9.be("mask", "dot-item")
3399
+ class: ns$a.be("mask", "dot-item")
3363
3400
  }, null) ]), createVNode("span", {
3364
- class: ns$9.be("mask", "text")
3365
- }, [ loadingText ]) ]) : null, slots.default?.() ]);
3401
+ class: ns$a.be("mask", "text")
3402
+ }, [ loadingText ]) ]) : null ]);
3366
3403
  }
3367
3404
  }), SearchColumn = defineComponent({
3368
3405
  name: "SearchColumn",
@@ -4039,7 +4076,7 @@ var TableColumnOperations = defineComponent({
4039
4076
  }
4040
4077
  });
4041
4078
 
4042
- const ns$8 = useNamespace("dialog");
4079
+ const ns$9 = useNamespace("dialog");
4043
4080
 
4044
4081
  var NextDialog$1 = defineComponent({
4045
4082
  name: "NextDialog",
@@ -4105,7 +4142,7 @@ var NextDialog$1 = defineComponent({
4105
4142
  return () => createVNode(Fragment, null, [ createVNode(ElDialog, {
4106
4143
  modelValue: visible.value,
4107
4144
  "onUpdate:modelValue": $event => visible.value = $event,
4108
- class: ns$8.b(),
4145
+ class: ns$9.b(),
4109
4146
  title: props.title,
4110
4147
  appendToBody: props.appendToBody,
4111
4148
  "destroy-on-close": !0,
@@ -4122,12 +4159,12 @@ var NextDialog$1 = defineComponent({
4122
4159
  }, {
4123
4160
  default: () => [ slots.default?.() ],
4124
4161
  header: ({close: close, titleId: titleId, titleClass: titleClass}) => createVNode("div", {
4125
- class: ns$8.b("header")
4162
+ class: ns$9.b("header")
4126
4163
  }, [ createVNode("h4", {
4127
4164
  id: titleId,
4128
4165
  class: titleClass
4129
4166
  }, [ props.title ]), createVNode("div", {
4130
- class: ns$8.e("header-right")
4167
+ class: ns$9.e("header-right")
4131
4168
  }, [ props.fullscreenBtn && createVNode("span", {
4132
4169
  class: "icon-fullscreen",
4133
4170
  onClick: () => isFullscreen.value = !isFullscreen.value
@@ -4176,7 +4213,7 @@ var defaultConfig$1 = {
4176
4213
  resetText: null
4177
4214
  };
4178
4215
 
4179
- const ns$7 = useNamespace("form");
4216
+ const ns$8 = useNamespace("form");
4180
4217
 
4181
4218
  var NumberRangePicker = defineComponent({
4182
4219
  name: "NumberRangePicker",
@@ -4216,7 +4253,7 @@ var NumberRangePicker = defineComponent({
4216
4253
  }));
4217
4254
  return () => createVNode(Fragment, null, [ createVNode("div", {
4218
4255
  ref: numberRangeRef,
4219
- class: ns$7.e("number-range")
4256
+ class: ns$8.e("number-range")
4220
4257
  }, [ createVNode(ElInputNumber, {
4221
4258
  modelValue: startNumber.value,
4222
4259
  "onUpdate:modelValue": $event => startNumber.value = $event,
@@ -4226,7 +4263,7 @@ var NumberRangePicker = defineComponent({
4226
4263
  disabled: disabled,
4227
4264
  onChange: onChangeStart
4228
4265
  }, null), createVNode("span", {
4229
- class: ns$7.em("number-range", "division")
4266
+ class: ns$8.em("number-range", "division")
4230
4267
  }, [ t("next.date.rangeSeparator") ]), createVNode(ElInputNumber, {
4231
4268
  modelValue: endNumber.value,
4232
4269
  "onUpdate:modelValue": $event => endNumber.value = $event,
@@ -4245,7 +4282,7 @@ function _isSlot$3(s) {
4245
4282
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
4246
4283
  }
4247
4284
 
4248
- const ns$6 = useNamespace("form"), InputTableSelect = defineComponent({
4285
+ const ns$7 = useNamespace("form"), InputTableSelect = defineComponent({
4249
4286
  name: "InputTableSelect",
4250
4287
  props: {
4251
4288
  modelValue: {
@@ -4344,18 +4381,18 @@ const ns$6 = useNamespace("form"), InputTableSelect = defineComponent({
4344
4381
  }, renderContent = () => {
4345
4382
  let _slot, _slot2;
4346
4383
  return createVNode(Fragment, null, [ createVNode("div", {
4347
- class: [ "el-input", ns$6.e("input-table"), ns$6.is("disabled", _disabled) ]
4384
+ class: [ "el-input", ns$7.e("input-table"), ns$7.is("disabled", _disabled) ]
4348
4385
  }, [ createVNode("div", {
4349
4386
  class: "el-input__wrapper"
4350
4387
  }, [ tags?.value.length ? createVNode("span", {
4351
- class: ns$6.em("input-table", "value")
4388
+ class: ns$7.em("input-table", "value")
4352
4389
  }, [ tags.value.map(((tag, index) => createVNode(ElTag, {
4353
4390
  closable: !_disabled,
4354
4391
  onClose: () => _onCloseTag(0, index)
4355
4392
  }, {
4356
4393
  default: () => [ tag.label ]
4357
4394
  }))), tagsMore?.value?.length ? createVNode(ElTooltip, {
4358
- "popper-class": ns$6.e("tooltip-tags"),
4395
+ "popper-class": ns$7.e("tooltip-tags"),
4359
4396
  placement: "bottom",
4360
4397
  effect: "light"
4361
4398
  }, {
@@ -4369,10 +4406,10 @@ const ns$6 = useNamespace("form"), InputTableSelect = defineComponent({
4369
4406
  default: () => [ tag.label ]
4370
4407
  })))
4371
4408
  }) : null ]) : createVNode("span", {
4372
- class: ns$6.em("input-table", "placeholder")
4409
+ class: ns$7.em("input-table", "placeholder")
4373
4410
  }, [ _placeholder ]) ]), createVNode(ElButton, {
4374
4411
  type: "primary",
4375
- class: ns$6.em("input-table", "append"),
4412
+ class: ns$7.em("input-table", "append"),
4376
4413
  disabled: _disabled,
4377
4414
  icon: search_default,
4378
4415
  onClick: onClickTableDialog
@@ -4386,7 +4423,7 @@ const ns$6 = useNamespace("form"), InputTableSelect = defineComponent({
4386
4423
  onClose: onCloseTableDialog
4387
4424
  }, {
4388
4425
  default: () => [ createVNode("div", {
4389
- class: ns$6.em("input-table", "content")
4426
+ class: ns$7.em("input-table", "content")
4390
4427
  }, [ createVNode(ElRadioGroup, {
4391
4428
  modelValue: sinleSelection.value
4392
4429
  }, {
@@ -4409,7 +4446,7 @@ const ns$6 = useNamespace("form"), InputTableSelect = defineComponent({
4409
4446
  }) ]
4410
4447
  }) ]
4411
4448
  }) ]), createVNode("div", {
4412
- class: ns$6.em("input-table", "footer")
4449
+ class: ns$7.em("input-table", "footer")
4413
4450
  }, [ createVNode(ElButton, {
4414
4451
  onClick: onResetTableSelect
4415
4452
  }, _isSlot$3(_slot = t("next.form.reset")) ? _slot : {
@@ -4425,7 +4462,7 @@ const ns$6 = useNamespace("form"), InputTableSelect = defineComponent({
4425
4462
  };
4426
4463
  return () => createVNode(Fragment, null, [ renderContent() ]);
4427
4464
  }
4428
- }), ns$5 = useNamespace("form");
4465
+ }), ns$6 = useNamespace("form");
4429
4466
 
4430
4467
  var UploadImage = defineComponent({
4431
4468
  name: "UploadImage",
@@ -4474,7 +4511,7 @@ var UploadImage = defineComponent({
4474
4511
  let urls = [];
4475
4512
  return "string" == typeof value ? urls = [ value ] : "[object Array]" === Object.prototype.toString.call(value) && (urls = value),
4476
4513
  urls = urls.filter((url => !!url)), urls.length ? createVNode(ElImage, {
4477
- class: ns$5.e("preview-image"),
4514
+ class: ns$6.e("preview-image"),
4478
4515
  src: urls[0],
4479
4516
  previewSrcList: urls,
4480
4517
  "preview-teleported": !0,
@@ -4489,7 +4526,7 @@ var UploadImage = defineComponent({
4489
4526
  })
4490
4527
  }) : null;
4491
4528
  })(), _disabled ? null : createVNode(ElUpload, {
4492
- class: [ ns$5.b("upload-image"), props.className ],
4529
+ class: [ ns$6.b("upload-image"), props.className ],
4493
4530
  style: props.style,
4494
4531
  "list-type": props.listType,
4495
4532
  "auto-upload": !1,
@@ -4615,9 +4652,9 @@ var UploadImage = defineComponent({
4615
4652
  }
4616
4653
  });
4617
4654
 
4618
- const ns$4 = useNamespace("form");
4655
+ const ns$5 = useNamespace("form");
4619
4656
 
4620
- var Element$5 = defineComponent({
4657
+ var Element$6 = defineComponent({
4621
4658
  name: "NextForm",
4622
4659
  props: {
4623
4660
  options: {
@@ -4979,7 +5016,7 @@ var Element$5 = defineComponent({
4979
5016
  let _slot;
4980
5017
  return createVNode(ElForm, {
4981
5018
  ref: ruleFormRef,
4982
- class: ns$4.b(),
5019
+ class: ns$5.b(),
4983
5020
  inline: !1,
4984
5021
  model: formParams,
4985
5022
  size: options.size
@@ -5000,7 +5037,7 @@ var Element$5 = defineComponent({
5000
5037
  }, {
5001
5038
  label: () => column.label ? createVNode(Fragment, null, [ createVNode(NextTextEllipsis, {
5002
5039
  content: t(column.label),
5003
- class: ns$4.e("item-label")
5040
+ class: ns$5.e("item-label")
5004
5041
  }, null), column.tip ? createVNode(ElTooltip, {
5005
5042
  effect: "dark",
5006
5043
  content: column.tip,
@@ -5020,7 +5057,7 @@ var Element$5 = defineComponent({
5020
5057
  }))), "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s) ? _slot : {
5021
5058
  default: () => [ _slot ]
5022
5059
  })), _isEditing.value && options.showFooter ? createVNode("div", {
5023
- class: ns$4.e("footer")
5060
+ class: ns$5.e("footer")
5024
5061
  }, [ createVNode(ElButton, {
5025
5062
  type: "primary",
5026
5063
  loading: submitLoading.value,
@@ -5040,7 +5077,7 @@ var Element$5 = defineComponent({
5040
5077
  }
5041
5078
  });
5042
5079
 
5043
- const NextTreeSelect = withInstall(treeSelect), NextForm = withInstall(Element$5);
5080
+ const NextTreeSelect = withInstall(treeSelect), NextForm = withInstall(Element$6);
5044
5081
 
5045
5082
  var AddEditForm = defineComponent({
5046
5083
  name: "AddEditForm",
@@ -5097,9 +5134,9 @@ function _isSlot(s) {
5097
5134
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !isVNode(s);
5098
5135
  }
5099
5136
 
5100
- const ns$3 = useNamespace("crud-table");
5137
+ const ns$4 = useNamespace("crud-table");
5101
5138
 
5102
- var Element$4 = defineComponent({
5139
+ var Element$5 = defineComponent({
5103
5140
  name: "NextCrudTable",
5104
5141
  props: defaultPropsConfig,
5105
5142
  emits: [ "confirm-search", "clear-search", "change-pagination", "selection-change", "row-click", "row-contextmenu", "row-dblclick", "cell-click", "cell-dblclick", "cell-contextmenu", "cell-mouse-enter", "cell-mouse-leave", "expand-change", "click-add-edit", "close-add-edit", "view-add-edit", "delete-rows", "delete-row", "submit-form" ],
@@ -5108,7 +5145,7 @@ var Element$4 = defineComponent({
5108
5145
  const cfg = unref(props.options);
5109
5146
  return merge$1(_config, cfg);
5110
5147
  })), options = unref(_options);
5111
- provide("options", computed((() => _options.value))), provide("ns", ns$3);
5148
+ provide("options", computed((() => _options.value))), provide("ns", ns$4);
5112
5149
  const {t: t} = useLocale(), _columns = ref(options.columns), _searchColumns = ref([]), _formColumns = ref([]), _updateColumnsAll = ops => {
5113
5150
  ((options, cb) => {
5114
5151
  const _columns = reactive(options.columns), _loadDicData = col => {
@@ -5230,7 +5267,7 @@ var Element$4 = defineComponent({
5230
5267
  return params;
5231
5268
  })()), onConfirmSearch = searchParams => {
5232
5269
  const params = deepClone(toRaw(searchParams));
5233
- baseIsEqual(_searchFormParams.value, params) || (props.page.pageIndex = 1, _searchFormParams.value = params),
5270
+ isEqual(_searchFormParams.value, params) || (props.page.pageIndex = 1, _searchFormParams.value = params),
5234
5271
  emit("confirm-search", params);
5235
5272
  }, onClearSearch = () => {
5236
5273
  emit("clear-search");
@@ -5349,11 +5386,11 @@ var Element$4 = defineComponent({
5349
5386
  });
5350
5387
  return () => createVNode(Fragment, null, [ createVNode(Fragment, null, [ createVNode("div", {
5351
5388
  ref: crudTableRef,
5352
- class: [ ns$3.b(), props.className ],
5389
+ class: [ ns$4.b(), props.className ],
5353
5390
  style: props.style
5354
5391
  }, [ options.showSearchForm || options.showHeaderMenu ? createVNode("header", {
5355
5392
  ref: headerRef,
5356
- class: ns$3.b("header")
5393
+ class: ns$4.b("header")
5357
5394
  }, [ options.showSearchForm && createVNode(HeaderSearch, {
5358
5395
  columns: _searchColumns.value,
5359
5396
  onZoomResize: updateTableContentHeight,
@@ -5367,12 +5404,12 @@ var Element$4 = defineComponent({
5367
5404
  onClickRefresh: onClickRefresh
5368
5405
  }, _isSlot(headerMenu_solts) ? headerMenu_solts : {
5369
5406
  default: () => [ headerMenu_solts ]
5370
- }), slots["table-head-tip"]?.() ]) : null, createVNode(SpinLoading, {
5407
+ }), slots["table-head-tip"]?.() ]) : null, createVNode(NextSpinLoading$1, {
5371
5408
  loading: props.loading
5372
5409
  }, {
5373
5410
  default: () => [ createVNode("div", {
5374
5411
  ref: tableRef,
5375
- class: ns$3.b("content")
5412
+ class: ns$4.b("content")
5376
5413
  }, [ createVNode(ElTable, {
5377
5414
  data: tableData.value,
5378
5415
  height: tableContentHeight.value,
@@ -5435,7 +5472,7 @@ var Element$4 = defineComponent({
5435
5472
  }) ]) ]
5436
5473
  }), options.isPagination ? createVNode("div", {
5437
5474
  ref: footerRef,
5438
- class: ns$3.b("footer")
5475
+ class: ns$4.b("footer")
5439
5476
  }, [ createVNode(FooterPagination, {
5440
5477
  page: props.page,
5441
5478
  onChange: onChangePagination
@@ -5462,7 +5499,7 @@ var Element$4 = defineComponent({
5462
5499
  }
5463
5500
  });
5464
5501
 
5465
- const NextCrudTable = withInstall(Element$4);
5502
+ const NextCrudTable = withInstall(Element$5);
5466
5503
 
5467
5504
  var propsConfig = {
5468
5505
  className: {
@@ -5495,7 +5532,7 @@ var propsConfig = {
5495
5532
  }
5496
5533
  }, defaultConfig = {};
5497
5534
 
5498
- const ns$2 = useNamespace("crud-table-virtualized");
5535
+ const ns$3 = useNamespace("crud-table-virtualized");
5499
5536
 
5500
5537
  const NextCrudTableVirtualized = withInstall(defineComponent({
5501
5538
  name: "NextCrudTableVirtualized",
@@ -5516,7 +5553,7 @@ const NextCrudTableVirtualized = withInstall(defineComponent({
5516
5553
  emit("close-add-edit");
5517
5554
  };
5518
5555
  return () => createVNode(Fragment, null, [ createVNode("div", {
5519
- class: [ ns$2.b(), props.className ]
5556
+ class: [ ns$3.b(), props.className ]
5520
5557
  }, [ createVNode(NextSpinLoading, null, null), createVNode(NextDialog, {
5521
5558
  modelValue: addEditDialog.visible,
5522
5559
  "onUpdate:modelValue": $event => addEditDialog.visible = $event,
@@ -5527,7 +5564,7 @@ const NextCrudTableVirtualized = withInstall(defineComponent({
5527
5564
  onClose: onCloseAddEditDialog
5528
5565
  }, null) ]) ]);
5529
5566
  }
5530
- })), NextSpinLoading = withInstall(SpinLoading), ns$1 = useNamespace("upload");
5567
+ })), NextSpinLoading = withInstall(NextSpinLoading$1), ns$2 = useNamespace("upload");
5531
5568
 
5532
5569
  const NextUpload = withInstall(defineComponent({
5533
5570
  name: "NextUpload",
@@ -5562,7 +5599,7 @@ const NextUpload = withInstall(defineComponent({
5562
5599
  const slots = this.$slots, props = this.$props, emit = this.$emit, _t = this.t, uploadfilesPreview = ref([]), body = document.getElementsByTagName("body")[0];
5563
5600
  let previewImagesContainer = null;
5564
5601
  return createVNode(ElUpload, {
5565
- class: [ ns$1.b(), props.className ],
5602
+ class: [ ns$2.b(), props.className ],
5566
5603
  style: props.style,
5567
5604
  "list-type": props.listType,
5568
5605
  "auto-upload": !1,
@@ -5600,9 +5637,9 @@ const NextUpload = withInstall(defineComponent({
5600
5637
  })
5601
5638
  });
5602
5639
  }
5603
- })), ns = useNamespace("video-player");
5640
+ })), ns$1 = useNamespace("video-player");
5604
5641
 
5605
- var Element$1 = defineComponent({
5642
+ var Element$2 = defineComponent({
5606
5643
  name: "NextVideoPlayer",
5607
5644
  props: {
5608
5645
  className: {
@@ -5675,7 +5712,7 @@ var Element$1 = defineComponent({
5675
5712
  if (!classNames || !classNames.length) throw new Error("模型类别不能未空!");
5676
5713
  container.innerHTML = "", tf.loadGraphModel(modelUrl).then((model => {
5677
5714
  const canvas = document.createElement("canvas");
5678
- canvas.className = ns.b("recongition"), container.appendChild(canvas);
5715
+ canvas.className = ns$1.b("recongition"), container.appendChild(canvas);
5679
5716
  const ctx = canvas.getContext("2d"), detect_ctx = document.createElement("canvas").getContext("2d");
5680
5717
  video.ontimeupdate = () => {
5681
5718
  const {videoWidth: videoWidth, videoHeight: videoHeight, offsetTop: offsetTop, offsetLeft: offsetLeft} = video;
@@ -5846,19 +5883,668 @@ var Element$1 = defineComponent({
5846
5883
  });
5847
5884
  return () => createVNode(Fragment, null, [ createVNode("div", {
5848
5885
  ref: videoBoxRef,
5849
- class: [ ns.b(), props.className ],
5886
+ class: [ ns$1.b(), props.className ],
5850
5887
  style: props.style
5851
5888
  }, null) ]);
5852
5889
  }
5853
5890
  });
5854
5891
 
5855
- const NextVideoPlayer = withInstall(Element$1);
5892
+ const NextVideoPlayer = withInstall(Element$2);
5856
5893
 
5857
5894
  const NextDragResize = withInstall(defineComponent({
5858
5895
  name: "NextDragResize",
5859
5896
  props: {},
5860
5897
  setup: () => () => createVNode(Fragment, null, [ createVNode(Fragment, null, null) ])
5861
- }));
5898
+ })), colors = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
5899
+ const label_type = rect.type, x_center = rect.startX + rect.rectWidth / 2, y_center = rect.startY + rect.rectHeight / 2;
5900
+ 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)) ];
5901
+ }, canvertToCanvas = (labelData, canvasWidth, canvasHeight) => {
5902
+ const [label_type, x_center, y_center, width, height] = labelData, rectWidth = width * canvasWidth, rectHeight = height * canvasHeight, startX = x_center * canvasWidth - rectWidth / 2, startY = y_center * canvasHeight - rectHeight / 2;
5903
+ return {
5904
+ type: label_type,
5905
+ startX: Math.ceil(startX),
5906
+ startY: Math.ceil(startY),
5907
+ rectWidth: Math.ceil(rectWidth),
5908
+ rectHeight: Math.ceil(rectHeight),
5909
+ canvasWidth: canvasWidth,
5910
+ canvasHeight: canvasHeight
5911
+ };
5912
+ };
5913
+
5914
+ var ContextMenuLabel = defineComponent({
5915
+ props: {
5916
+ labelRect: {
5917
+ type: Object,
5918
+ default: () => ({})
5919
+ },
5920
+ classes: {
5921
+ type: Array,
5922
+ default: () => []
5923
+ },
5924
+ activateRect: {
5925
+ type: Object,
5926
+ default: null
5927
+ }
5928
+ },
5929
+ emits: [ "close", "select", "delete" ],
5930
+ setup(props, {emit: emit}) {
5931
+ const ns = inject("ns", {}), onClose = () => {
5932
+ emit("close");
5933
+ }, onDelete = () => {
5934
+ emit("delete", props.activateRect);
5935
+ }, activateIndex = ref();
5936
+ watch((() => props.activateRect), (() => {
5937
+ const {type: type} = props.activateRect;
5938
+ activateIndex.value = isValueExist(type) ? type : null;
5939
+ }), {
5940
+ deep: !0,
5941
+ immediate: !0
5942
+ });
5943
+ const labelRectWidthHeight = ref({
5944
+ width: 0,
5945
+ height: 0
5946
+ });
5947
+ onMounted((() => {
5948
+ const {clientWidth: clientWidth, clientHeight: clientHeight} = labelMenuRef.value;
5949
+ labelRectWidthHeight.value.width = clientWidth, labelRectWidthHeight.value.height = clientHeight;
5950
+ }));
5951
+ const labelMenuRef = ref(), labelStyleFixed = computed((() => {
5952
+ const {left: left, top: top, canvasHeight: canvasHeight} = props.labelRect, height_diff = top + labelRectWidthHeight.value.height - canvasHeight;
5953
+ let y = top;
5954
+ return height_diff > 0 && (y -= height_diff), {
5955
+ top: y + "px",
5956
+ left: left + "px"
5957
+ };
5958
+ })), renderContent = () => createVNode("div", {
5959
+ ref: labelMenuRef,
5960
+ class: [ ns.b("contextmenu-label") ],
5961
+ style: labelStyleFixed.value
5962
+ }, [ createVNode("div", {
5963
+ class: "label-head"
5964
+ }, [ createVNode("span", {
5965
+ style: "padding-right: 30px"
5966
+ }, [ createTextVNode("标签选择") ]), createVNode(ElIcon, {
5967
+ size: 16,
5968
+ onClick: onClose
5969
+ }, {
5970
+ default: () => [ createVNode(close_default, null, null) ]
5971
+ }) ]), createVNode("ul", {
5972
+ class: "label-main"
5973
+ }, [ props.classes.map(((name, index) => createVNode("li", {
5974
+ key: index,
5975
+ onClick: () => (index => {
5976
+ activateIndex.value = index, emit("select", index);
5977
+ })(index),
5978
+ class: {
5979
+ "activate-label": activateIndex.value === index
5980
+ }
5981
+ }, [ createVNode("span", {
5982
+ style: {
5983
+ "background-color": colors[index]
5984
+ },
5985
+ class: "label-line"
5986
+ }, null), createVNode("span", null, [ name ]) ]))) ]), isValueExist(activateIndex.value) ? createVNode("div", {
5987
+ style: "margin: 10px auto 0"
5988
+ }, [ createVNode(ElButton, {
5989
+ icon: delete_default,
5990
+ plain: !0,
5991
+ size: "small",
5992
+ type: "danger",
5993
+ onClick: onDelete
5994
+ }, {
5995
+ default: () => [ createTextVNode("删除标注框") ]
5996
+ }) ]) : null ]);
5997
+ return () => createVNode(Fragment, null, [ renderContent() ]);
5998
+ }
5999
+ }), DraggableRect = defineComponent({
6000
+ props: {
6001
+ parentEl: {
6002
+ type: Object,
6003
+ default: null
6004
+ },
6005
+ rect: {
6006
+ type: Object,
6007
+ default: () => ({})
6008
+ }
6009
+ },
6010
+ emits: [ "draggle-resize", "contextmenu" ],
6011
+ setup(props, {emit: emit}) {
6012
+ const isDraggle = ref(!1), isResizeCorner = ref({
6013
+ topLeft: !1,
6014
+ topCenter: !1,
6015
+ topRight: !1,
6016
+ leftCenter: !1,
6017
+ rightCenter: !1,
6018
+ bottomLeft: !1,
6019
+ bottomCenter: !1,
6020
+ bottomRight: !1
6021
+ }), draggleOffset = ref({
6022
+ diff_x: null,
6023
+ diff_y: null
6024
+ });
6025
+ let parentRect = {};
6026
+ const rect = toRef(props.rect), onMouseup = e => {
6027
+ e.preventDefault(), e.stopPropagation(), isDraggle.value = !1, isResizeCorner.value.topLeft = !1,
6028
+ isResizeCorner.value.topCenter = !1, isResizeCorner.value.topRight = !1, isResizeCorner.value.leftCenter = !1,
6029
+ isResizeCorner.value.rightCenter = !1, isResizeCorner.value.bottomLeft = !1, isResizeCorner.value.bottomCenter = !1,
6030
+ isResizeCorner.value.bottomRight = !1, emit("draggle-resize", rect.value);
6031
+ }, onMousemove = e => {
6032
+ if (isDraggle.value) {
6033
+ const newLeft = e.clientX - parentRect.left - draggleOffset.value.diff_x, newTop = e.clientY - parentRect.top - draggleOffset.value.diff_y;
6034
+ rect.value.startX = Math.max(0, Math.min(newLeft, parentRect.width - rect.value.rectWidth)),
6035
+ rect.value.startY = Math.max(0, Math.min(newTop, parentRect.height - rect.value.rectHeight));
6036
+ }
6037
+ if (isResizeCorner.value.bottomCenter) {
6038
+ let newHeight = e.clientY - parentRect.top - rect.value.startY;
6039
+ newHeight < 30 && (newHeight = 30), newHeight + rect.value.startY > parentRect.height && (newHeight = parentRect.height - rect.value.startY),
6040
+ rect.value.rectHeight = newHeight;
6041
+ }
6042
+ if (isResizeCorner.value.topCenter) {
6043
+ let newTop = e.clientY - parentRect.top, newHeight = rect.value.startY - newTop + rect.value.rectHeight;
6044
+ if (newTop < 0) return;
6045
+ if (newHeight < 30) return;
6046
+ rect.value.rectHeight = newHeight, rect.value.startY = Math.max(0, Math.min(newTop, parentRect.height - rect.value.rectHeight));
6047
+ }
6048
+ if (isResizeCorner.value.leftCenter) {
6049
+ let newLeft = e.clientX - parentRect.left, newWidth = rect.value.startX - newLeft + rect.value.rectWidth;
6050
+ if (newLeft < 0) return;
6051
+ if (newWidth < 30) return;
6052
+ rect.value.startX = Math.max(0, Math.min(newLeft, parentRect.width - rect.value.rectWidth)),
6053
+ rect.value.rectWidth = newWidth;
6054
+ }
6055
+ if (isResizeCorner.value.rightCenter) {
6056
+ let newWidth = e.clientX - parentRect.left - rect.value.startX;
6057
+ newWidth < 30 && (newWidth = 30), newWidth + rect.value.startX > parentRect.width && (newWidth = parentRect.width - rect.value.startX),
6058
+ rect.value.rectWidth = newWidth;
6059
+ }
6060
+ if (isResizeCorner.value.bottomRight) {
6061
+ let newWidth = e.clientX - parentRect.left - rect.value.startX, newHeight = e.clientY - parentRect.top - rect.value.startY;
6062
+ newWidth < 30 && (newWidth = 30), newHeight < 30 && (newHeight = 30), newWidth + rect.value.startX > parentRect.width && (newWidth = parentRect.width - rect.value.startX),
6063
+ newHeight + rect.value.startY > parentRect.height && (newHeight = parentRect.height - rect.value.startY),
6064
+ rect.value.rectWidth = newWidth, rect.value.rectHeight = newHeight;
6065
+ }
6066
+ if (isResizeCorner.value.bottomLeft) {
6067
+ let newLeft = e.clientX - parentRect.left, newWidth = rect.value.startX - newLeft + rect.value.rectWidth, newHeight = e.clientY - parentRect.top - rect.value.startY;
6068
+ if (newLeft < 0) return;
6069
+ if (newWidth < 30) return;
6070
+ newHeight < 30 && (newHeight = 30), newHeight + rect.value.startY > parentRect.height && (newHeight = parentRect.height - rect.value.startY),
6071
+ rect.value.startX = Math.max(0, Math.min(newLeft, parentRect.width - rect.value.rectWidth)),
6072
+ rect.value.rectWidth = newWidth, rect.value.rectHeight = newHeight;
6073
+ }
6074
+ if (isResizeCorner.value.topLeft) {
6075
+ let newTop = e.clientY - parentRect.top, newHeight = rect.value.startY - newTop + rect.value.rectHeight;
6076
+ if (newTop < 0) return;
6077
+ if (newHeight < 30) return;
6078
+ rect.value.rectHeight = newHeight, rect.value.startY = Math.max(0, Math.min(newTop, parentRect.height - rect.value.rectHeight));
6079
+ let newLeft = e.clientX - parentRect.left, newWidth = rect.value.startX - newLeft + rect.value.rectWidth;
6080
+ if (newLeft < 0) return;
6081
+ if (newWidth < 30) return;
6082
+ rect.value.startX = Math.max(0, Math.min(newLeft, parentRect.width - rect.value.rectWidth)),
6083
+ rect.value.rectWidth = newWidth;
6084
+ }
6085
+ if (isResizeCorner.value.topRight) {
6086
+ let newTop = e.clientY - parentRect.top, newHeight = rect.value.startY - newTop + rect.value.rectHeight;
6087
+ if (newTop < 0) return;
6088
+ if (newHeight < 30) return;
6089
+ rect.value.rectHeight = newHeight, rect.value.startY = Math.max(0, Math.min(newTop, parentRect.height - rect.value.rectHeight));
6090
+ let newWidth = e.clientX - parentRect.left - rect.value.startX;
6091
+ newWidth < 30 && (newWidth = 30), newWidth + rect.value.startX > parentRect.width && (newWidth = parentRect.width - rect.value.startX),
6092
+ rect.value.rectWidth = newWidth;
6093
+ }
6094
+ };
6095
+ return onMounted((() => {
6096
+ parentRect = props.parentEl.getBoundingClientRect(), document.addEventListener("mousemove", onMousemove),
6097
+ document.addEventListener("mouseup", onMouseup);
6098
+ })), onUnmounted((() => {
6099
+ document.removeEventListener("mousemove", onMousemove, !1), document.removeEventListener("mouseup", onMouseup, !1);
6100
+ })), {
6101
+ onMousedown: e => {
6102
+ e.preventDefault(), isDraggle.value = !0, draggleOffset.value.diff_x = e.offsetX,
6103
+ draggleOffset.value.diff_y = e.offsetY;
6104
+ },
6105
+ onMouseup: onMouseup,
6106
+ onContextmenu: e => {
6107
+ e.preventDefault(), emit("contextmenu", e, rect.value);
6108
+ },
6109
+ rect: rect,
6110
+ onMousedownDot: (e, corner) => {
6111
+ e.preventDefault(), e.stopPropagation(), isResizeCorner.value[corner] = !0;
6112
+ }
6113
+ };
6114
+ },
6115
+ render() {
6116
+ const _ns = inject("ns", {});
6117
+ return createVNode("div", {
6118
+ class: [ _ns.b("draggable-rect") ],
6119
+ style: (() => {
6120
+ const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = this.rect;
6121
+ return {
6122
+ top: startY + "px",
6123
+ left: startX + "px",
6124
+ width: rectWidth + "px",
6125
+ height: rectHeight + "px"
6126
+ };
6127
+ })(),
6128
+ onMousedown: this.onMousedown,
6129
+ onMouseup: this.onMouseup,
6130
+ onContextmenu: this.onContextmenu
6131
+ }, [ createVNode("ul", {
6132
+ class: [ _ns.be("draggable-rect", "resize") ]
6133
+ }, [ createVNode("li", {
6134
+ class: "top-left",
6135
+ onMousedown: event => this.onMousedownDot(event, "topLeft")
6136
+ }, null), createVNode("li", {
6137
+ class: "top-center",
6138
+ onMousedown: event => this.onMousedownDot(event, "topCenter")
6139
+ }, null), createVNode("li", {
6140
+ class: "top-right",
6141
+ onMousedown: event => this.onMousedownDot(event, "topRight")
6142
+ }, null), createVNode("li", {
6143
+ class: "left-center",
6144
+ onMousedown: event => this.onMousedownDot(event, "leftCenter")
6145
+ }, null), createVNode("li", {
6146
+ class: "right-center",
6147
+ onMousedown: event => this.onMousedownDot(event, "rightCenter")
6148
+ }, null), createVNode("li", {
6149
+ class: "bottom-left",
6150
+ onMousedown: event => this.onMousedownDot(event, "bottomLeft")
6151
+ }, null), createVNode("li", {
6152
+ class: "bottom-center",
6153
+ onMousedown: event => this.onMousedownDot(event, "bottomCenter")
6154
+ }, null), createVNode("li", {
6155
+ class: "bottom-right",
6156
+ onMousedown: event => this.onMousedownDot(event, "bottomRight")
6157
+ }, null) ]) ]);
6158
+ }
6159
+ }), CanvasContext = defineComponent({
6160
+ name: "NextCanvasContext",
6161
+ props: {
6162
+ classes: {
6163
+ type: Array,
6164
+ default: () => []
6165
+ },
6166
+ rowInfo: {
6167
+ type: Object,
6168
+ default: () => ({})
6169
+ }
6170
+ },
6171
+ setup(props) {
6172
+ const ns = inject("ns", {}), _emit = inject("_emit", null), canvasMainRef = ref(), canvasBaseRef = ref(), canvasRectRef = ref(), formatLabelsType = () => {
6173
+ const _labels = deepClone(labels.value);
6174
+ let yolo_label = [];
6175
+ return {
6176
+ rects: _labels.map((rect => {
6177
+ delete rect.typeName;
6178
+ const label_rect = convertToLabel(rect);
6179
+ return yolo_label.push(label_rect.join(" ")), toRaw(rect);
6180
+ })),
6181
+ label_txt: yolo_label.join("\n")
6182
+ };
6183
+ }, labels = ref([]), drawBaseCanvas = ref({}), renderImageLabel = rowInfo => {
6184
+ labels.value = (rowInfo => rowInfo.labels ? rowInfo.labels.map((rect => {
6185
+ const typeName = props.classes[rect.type];
6186
+ return typeName && (rect.typeName = typeName), rect;
6187
+ })) : [])(rowInfo);
6188
+ const clientHeight = canvasMainRef.value?.clientHeight, ctx = canvasBaseRef.value?.getContext("2d");
6189
+ if (rowInfo?.imageSrc) {
6190
+ const image = new Image;
6191
+ image.src = rowInfo.imageSrc, image.onload = () => {
6192
+ const {width: width, height: height} = image, canvasHeight = clientHeight, scaleFactor = canvasHeight / height, canvasWidth = Math.ceil(width * scaleFactor);
6193
+ ((canvasWidth, canvasHeight) => {
6194
+ canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
6195
+ canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
6196
+ canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px",
6197
+ canvasRectRef.value.width = canvasWidth, canvasRectRef.value.height = canvasHeight,
6198
+ canvasRectRef.value.style.width = canvasWidth + "px", canvasRectRef.value.style.height = canvasHeight + "px";
6199
+ })(canvasWidth, canvasHeight);
6200
+ const {updateLabels: updateLabels, addDrawRect: addDrawRect, hitCanvasLabel: hitCanvasLabel} = (options => {
6201
+ const {ctx: ctx, labels: labels, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = options, updateLabels = () => {
6202
+ ctx.clearRect(0, 0, canvasWidth, canvasHeight), ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
6203
+ for (let i = 0; i < labels.length; i++) {
6204
+ const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors[type % colors.length];
6205
+ if (ctx.font = "bold 14px serif", ctx.textBaseline = "top", ctx.save(), ctx.strokeStyle = color,
6206
+ ctx.strokeRect(startX, startY, rectWidth, rectHeight), isValueExist(rect.typeName) || isValueExist(rect.type)) {
6207
+ const text = rect.typeName || rect.type;
6208
+ ctx.fillStyle = color, ctx.fillText(text, startX + 6, startY + 6);
6209
+ }
6210
+ ctx.restore();
6211
+ }
6212
+ };
6213
+ return updateLabels(), {
6214
+ updateLabels: updateLabels,
6215
+ addDrawRect: (rect, color = "#f30635") => {
6216
+ const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
6217
+ ctx.strokeStyle = color, ctx.strokeRect(startX, startY, rectWidth, rectHeight);
6218
+ },
6219
+ hitCanvasLabel: (x, y) => {
6220
+ let hit_rect = null, hit_index = null;
6221
+ for (let i = 0; i < labels.length; i++) {
6222
+ const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
6223
+ x >= startX && x <= startX + rectWidth && y >= startY && y <= startY + rectHeight && (hit_rect = rect,
6224
+ hit_index = i);
6225
+ }
6226
+ return {
6227
+ hit_rect: hit_rect,
6228
+ hit_index: hit_index
6229
+ };
6230
+ }
6231
+ };
6232
+ })({
6233
+ canvas: canvasBaseRef.value,
6234
+ ctx: ctx,
6235
+ image: image,
6236
+ canvasWidth: canvasWidth,
6237
+ canvasHeight: canvasHeight,
6238
+ labels: labels.value
6239
+ });
6240
+ drawBaseCanvas.value.updateLabels = updateLabels, drawBaseCanvas.value.addDrawRect = addDrawRect,
6241
+ drawBaseCanvas.value.hitCanvasLabel = hitCanvasLabel;
6242
+ const {clearCanvas: clearCanvas} = ((canvas, callback) => {
6243
+ const canvasWidth = canvas.width, canvasHeight = canvas.height, ctx = canvas?.getContext("2d"), clearCanvas = () => {
6244
+ ctx.clearRect(0, 0, canvasWidth, canvasHeight);
6245
+ };
6246
+ clearCanvas();
6247
+ let startX, startY, endX, endY, isDrawing = !1, isRectDraw = !1, isWKeyPressed = !1;
6248
+ document.addEventListener("keydown", (event => {
6249
+ "w" === event.key && (isWKeyPressed = !0, canvas.style.cursor = "crosshair", canvas.style.zIndex = "11");
6250
+ })), document.addEventListener("keyup", (event => {
6251
+ "w" === event.key && (isWKeyPressed = !1, canvas.style.cursor = "unset", canvas.style.zIndex = "0");
6252
+ })), canvas.addEventListener("mousedown", (e => {
6253
+ isWKeyPressed && (isDrawing = !0, startX = e.offsetX, startY = e.offsetY);
6254
+ })), canvas.addEventListener("mousemove", (e => {
6255
+ isDrawing && isWKeyPressed && (isRectDraw = !0, endX = e.offsetX, endY = e.offsetY,
6256
+ drawRect());
6257
+ })), canvas.addEventListener("mouseup", (() => {
6258
+ if (!isRectDraw) return;
6259
+ isDrawing = !1, isWKeyPressed = !1;
6260
+ const rectWidth = Math.abs(endX - startX), rectHeight = Math.abs(endY - startY);
6261
+ startX > endX && (startX = endX), startY > endY && (startY = endY), callback && callback({
6262
+ startX: startX,
6263
+ startY: startY,
6264
+ rectWidth: rectWidth,
6265
+ rectHeight: rectHeight,
6266
+ canvasWidth: canvasWidth,
6267
+ canvasHeight: canvasHeight
6268
+ }, {
6269
+ endX: endX,
6270
+ endY: endY
6271
+ }), isRectDraw = !1;
6272
+ }));
6273
+ const drawRect = (color = "#f30635") => {
6274
+ clearCanvas(), ctx.strokeStyle = color, ctx.strokeRect(startX, startY, endX - startX, endY - startY);
6275
+ };
6276
+ return {
6277
+ canvas: canvas,
6278
+ ctx: ctx,
6279
+ clearCanvas: clearCanvas,
6280
+ drawRect: drawRect
6281
+ };
6282
+ })(canvasRectRef.value, ((rect, {endX: endX, endY: endY}) => {
6283
+ activate_add_label.value = rect, drawBaseCanvas.value.addDrawRect(rect), updateContextmenuLabelFixed(endX, endY, rect);
6284
+ }));
6285
+ drawBaseCanvas.value.clearCanvasRect = clearCanvas;
6286
+ };
6287
+ }
6288
+ canvasBaseRef.value.addEventListener("contextmenu", (e => {
6289
+ e.preventDefault();
6290
+ const x = e.offsetX, y = e.offsetY, {hit_rect: hit_rect} = drawBaseCanvas.value.hitCanvasLabel(x, y);
6291
+ onCloseContentmenuLabel(), onCloseDraggableRectFixed(), hit_rect && nextTick((() => {
6292
+ updateContextmenuLabelFixed(x, y, hit_rect);
6293
+ }));
6294
+ })), canvasBaseRef.value.addEventListener("click", (e => {
6295
+ const x = e.offsetX, y = e.offsetY, {hit_rect: hit_rect, hit_index: hit_index} = drawBaseCanvas.value.hitCanvasLabel(x, y);
6296
+ onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && nextTick((() => {
6297
+ updateDraggableRectFixed(x, y, hit_rect, hit_index);
6298
+ }));
6299
+ }));
6300
+ };
6301
+ onMounted((() => {
6302
+ watch((() => props.rowInfo), (info => {
6303
+ const rowInfo = toRaw(info);
6304
+ renderImageLabel(rowInfo);
6305
+ }), {
6306
+ deep: !0,
6307
+ immediate: !0
6308
+ });
6309
+ }));
6310
+ const contextmenuLabelFixed = ref({
6311
+ show: !1,
6312
+ top: 0,
6313
+ left: 0,
6314
+ activateRect: null
6315
+ }), updateContextmenuLabelFixed = (x, y, rect) => {
6316
+ contextmenuLabelFixed.value.show = !0, contextmenuLabelFixed.value.left = x, contextmenuLabelFixed.value.top = y,
6317
+ contextmenuLabelFixed.value.canvasWidth = canvasBaseRef.value.width, contextmenuLabelFixed.value.canvasHeight = canvasBaseRef.value.height,
6318
+ contextmenuLabelFixed.value.activateRect = rect, activate_add_label.value = rect;
6319
+ }, onCloseContentmenuLabel = () => {
6320
+ contextmenuLabelFixed.value.show = !1, contextmenuLabelFixed.value.top = 0, contextmenuLabelFixed.value.left = 0,
6321
+ contextmenuLabelFixed.value.activateRect = null, activate_add_label.value = null,
6322
+ drawBaseCanvas.value.updateLabels(), drawBaseCanvas.value.clearCanvasRect();
6323
+ }, contextmenuLabelRect = computed((() => {
6324
+ const {top: top, left: left, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = contextmenuLabelFixed.value;
6325
+ return {
6326
+ top: top,
6327
+ left: left,
6328
+ canvasWidth: canvasWidth,
6329
+ canvasHeight: canvasHeight
6330
+ };
6331
+ })), draggableRectFixed = ref({
6332
+ show: !1,
6333
+ top: 0,
6334
+ left: 0,
6335
+ width: 0,
6336
+ height: 0,
6337
+ activateRect: null,
6338
+ activateIndex: null
6339
+ }), updateDraggableRectFixed = (x, y, rect, index) => {
6340
+ draggableRectFixed.value.show = !0, draggableRectFixed.value.top = y, draggableRectFixed.value.left = x,
6341
+ draggableRectFixed.value.width = rect.rectWidth, draggableRectFixed.value.height = rect.rectHeight,
6342
+ draggableRectFixed.value.activateRect = rect, draggableRectFixed.value.activateIndex = index;
6343
+ }, onCloseDraggableRectFixed = () => {
6344
+ draggableRectFixed.value.show = !1, draggableRectFixed.value.top = 0, draggableRectFixed.value.left = 0,
6345
+ draggableRectFixed.value.width = 0, draggableRectFixed.value.height = 0, draggableRectFixed.value.activateRect = null,
6346
+ draggableRectFixed.value.activateIndex = null;
6347
+ }, onDraggleRectResize = rect => {
6348
+ draggableRectFixed.value.activateRect = rect, drawBaseCanvas.value.updateLabels();
6349
+ const i = labels.value.findIndex((o => isEqual(o, rect)));
6350
+ i > -1 && labels.value.splice(i, 1, rect);
6351
+ const {rects: rects, label_txt: label_txt} = formatLabelsType();
6352
+ _emit("change", rects, label_txt);
6353
+ }, onContextmenuDraggable = (e, rect) => {
6354
+ e.preventDefault();
6355
+ const rect_x = e.offsetX, rect_y = e.offsetY, x = rect_x + rect.startX, y = rect_y + rect.startY;
6356
+ onCloseContentmenuLabel(), nextTick((() => {
6357
+ updateContextmenuLabelFixed(x, y, rect);
6358
+ }));
6359
+ }, activate_add_label = ref(), onSelectLabel = type => {
6360
+ activate_add_label.value.type = type;
6361
+ const typeName = props.classes[type];
6362
+ typeName && (activate_add_label.value.typeName = typeName);
6363
+ const i = labels.value.findIndex((o => isEqual(o, activate_add_label.value)));
6364
+ i > -1 ? labels.value.splice(i, 1, activate_add_label.value) : labels.value.push(activate_add_label.value),
6365
+ onCloseContentmenuLabel();
6366
+ const {rects: rects, label_txt: label_txt} = formatLabelsType();
6367
+ _emit("change", rects, label_txt);
6368
+ }, onDeleteLabel = rect => {
6369
+ const i = labels.value.findIndex((o => isEqual(o, rect)));
6370
+ labels.value.splice(i, 1), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
6371
+ drawBaseCanvas.value.updateLabels();
6372
+ const {rects: rects, label_txt: label_txt} = formatLabelsType();
6373
+ _emit("change", rects, label_txt);
6374
+ };
6375
+ return () => createVNode(Fragment, null, [ createVNode("div", {
6376
+ ref: canvasMainRef,
6377
+ class: [ ns.b("canvas") ]
6378
+ }, [ createVNode("canvas", {
6379
+ ref: canvasBaseRef,
6380
+ class: [ ns.be("canvas", "context") ]
6381
+ }, null), createVNode("canvas", {
6382
+ ref: canvasRectRef,
6383
+ class: [ ns.be("canvas", "rect") ]
6384
+ }, null), contextmenuLabelFixed.value.show ? createVNode(ContextMenuLabel, {
6385
+ labelRect: contextmenuLabelRect.value,
6386
+ classes: props.classes,
6387
+ activateRect: contextmenuLabelFixed.value.activateRect,
6388
+ onClose: onCloseContentmenuLabel,
6389
+ onSelect: onSelectLabel,
6390
+ onDelete: onDeleteLabel
6391
+ }, null) : null, draggableRectFixed.value.show ? createVNode(DraggableRect, {
6392
+ parentEl: canvasMainRef.value,
6393
+ rect: draggableRectFixed.value.activateRect,
6394
+ onDraggleResize: onDraggleRectResize,
6395
+ onContextmenu: onContextmenuDraggable
6396
+ }, null) : null ]) ]);
6397
+ }
6398
+ });
6399
+
6400
+ const ns = useNamespace("labelimg");
6401
+
6402
+ var Element = defineComponent({
6403
+ name: "NextLabelimg",
6404
+ props: {
6405
+ className: {
6406
+ type: String,
6407
+ default: ""
6408
+ },
6409
+ style: {
6410
+ type: Object,
6411
+ default: () => ({})
6412
+ },
6413
+ options: {
6414
+ type: Object,
6415
+ default: () => ({
6416
+ classes: [],
6417
+ list: []
6418
+ })
6419
+ }
6420
+ },
6421
+ emits: [ "change", "save", "prev-click", "next-click" ],
6422
+ setup(props, {emit: emit, slots: slots, expose: expose}) {
6423
+ const {t: t} = useLocale();
6424
+ provide("ns", ns), provide("_emit", emit);
6425
+ const {classes: classes, list: list} = props.options, activateNodeIndex = ref(0), currentNode = computed((() => {
6426
+ if (!list) return {};
6427
+ return list[activateNodeIndex.value] || {};
6428
+ })), imageLength = list.length, loading = ref(!1), formatNodeLabels = () => {
6429
+ const node = deepClone(currentNode.value);
6430
+ let yolo_label = [];
6431
+ return node.labels.forEach((rect => {
6432
+ delete rect.typeName;
6433
+ const label_rect = convertToLabel(rect);
6434
+ yolo_label.push(label_rect.join(" "));
6435
+ })), {
6436
+ node: node,
6437
+ label_txt: yolo_label.join("\n")
6438
+ };
6439
+ }, onKeydownPrevNext = e => {
6440
+ if (loading.value) return;
6441
+ if (![ "KeyA", "KeyD" ].includes(e.code)) return;
6442
+ loading.value = !0;
6443
+ const {node: node, label_txt: label_txt} = formatNodeLabels();
6444
+ emit("save", {
6445
+ node: node,
6446
+ label_txt: label_txt
6447
+ }, (() => {
6448
+ "KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
6449
+ activateNodeIndex.value < 0 && (activateNodeIndex.value = imageLength - 1)), loading.value = !1;
6450
+ }), (() => {
6451
+ loading.value = !1;
6452
+ }));
6453
+ }, onPaginationPrev = () => {
6454
+ emit("prev-click");
6455
+ }, onPaginationNext = () => {
6456
+ emit("next-click");
6457
+ }, layoutRef = ref(), headerRef = ref(), mainRef = ref(), footerRef = ref(), mainContentHeight = ref(500);
6458
+ onMounted((() => {
6459
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutRef.value, (() => {
6460
+ nextTick((() => {
6461
+ const contentHeight = (layoutRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
6462
+ mainContentHeight.value = contentHeight;
6463
+ }));
6464
+ }));
6465
+ })), onUnmounted((() => {
6466
+ document.removeEventListener("keydown", onKeydownPrevNext);
6467
+ })), expose({
6468
+ convertToLabel: convertToLabel,
6469
+ canvertToCanvas: canvertToCanvas
6470
+ });
6471
+ const renderContent = () => createVNode("div", {
6472
+ ref: layoutRef,
6473
+ class: [ ns.b(), props.className ],
6474
+ style: {
6475
+ ...props.style
6476
+ }
6477
+ }, [ createVNode(NextSpinLoading$1, {
6478
+ loading: loading.value,
6479
+ tip: t("next.labelimg.saveTxt"),
6480
+ class: [ ns.b("loading") ]
6481
+ }, {
6482
+ default: () => [ createVNode(ElScrollbar, null, {
6483
+ default: () => [ createVNode("header", {
6484
+ ref: headerRef,
6485
+ class: [ ns.b("header") ]
6486
+ }, [ slots.header ? slots.header() : createVNode(Fragment, null, [ createVNode("ul", null, null), createVNode("ul", null, null) ]) ]), createVNode("div", {
6487
+ ref: mainRef,
6488
+ class: [ ns.b("main") ]
6489
+ }, [ createVNode(CanvasContext, {
6490
+ classes: classes,
6491
+ rowInfo: currentNode.value
6492
+ }, null) ]), createVNode("footer", {
6493
+ ref: footerRef,
6494
+ class: [ ns.b("footer") ]
6495
+ }, [ createVNode("div", {
6496
+ class: [ ns.be("footer", "left") ]
6497
+ }, [ createVNode(ElIcon, {
6498
+ size: 24,
6499
+ onClick: onPaginationPrev
6500
+ }, {
6501
+ default: () => [ createVNode(arrow_left_default, null, null) ]
6502
+ }) ]), createVNode("div", {
6503
+ class: [ ns.be("footer", "center") ]
6504
+ }, [ createVNode(ElScrollbar, null, {
6505
+ default: () => [ createVNode("ul", {
6506
+ class: [ ns.bem("footer", "center", "list") ]
6507
+ }, [ list.map(((item, index) => createVNode("li", {
6508
+ key: index,
6509
+ onClick: () => (index => {
6510
+ if (loading.value) return;
6511
+ loading.value = !0;
6512
+ const {node: node, label_txt: label_txt} = formatNodeLabels();
6513
+ emit("save", {
6514
+ node: node,
6515
+ label_txt: label_txt
6516
+ }, (() => {
6517
+ activateNodeIndex.value = index, loading.value = !1;
6518
+ }), (() => {
6519
+ loading.value = !1;
6520
+ }));
6521
+ })(index),
6522
+ class: {
6523
+ "is-activate": activateNodeIndex.value === index
6524
+ }
6525
+ }, [ createVNode(ElImage, {
6526
+ style: "height: 100%",
6527
+ src: item.imageSrc,
6528
+ "zoom-rate": 1.2,
6529
+ "max-scale": 2,
6530
+ "min-scale": .2,
6531
+ fit: "cover"
6532
+ }, null) ]))) ]) ]
6533
+ }) ]), createVNode("div", {
6534
+ class: [ ns.be("footer", "right") ]
6535
+ }, [ createVNode(ElIcon, {
6536
+ size: 24,
6537
+ onClick: onPaginationNext
6538
+ }, {
6539
+ default: () => [ createVNode(arrow_right_default, null, null) ]
6540
+ }) ]) ]) ]
6541
+ }) ]
6542
+ }) ]);
6543
+ return () => createVNode(Fragment, null, [ renderContent() ]);
6544
+ }
6545
+ });
6546
+
6547
+ const NextLabelimg = withInstall(Element);
5862
6548
 
5863
6549
  var components = Object.freeze({
5864
6550
  __proto__: null,
@@ -5868,6 +6554,7 @@ var components = Object.freeze({
5868
6554
  NextDialog: NextDialog,
5869
6555
  NextDragResize: NextDragResize,
5870
6556
  NextForm: NextForm,
6557
+ NextLabelimg: NextLabelimg,
5871
6558
  NextLayout: NextLayout,
5872
6559
  NextMenu: NextMenu,
5873
6560
  NextSpinLoading: NextSpinLoading,
@@ -5910,7 +6597,7 @@ const zoomDialog = app => {
5910
6597
  }));
5911
6598
  }
5912
6599
  });
5913
- }, version = "0.2.6", install = function(app) {
6600
+ }, version = "0.2.8", install = function(app) {
5914
6601
  Object.keys(components).forEach((key => {
5915
6602
  const component = components[key];
5916
6603
  app.component(component.name, component);
@@ -5920,8 +6607,8 @@ const zoomDialog = app => {
5920
6607
  };
5921
6608
 
5922
6609
  var index = {
5923
- version: "0.2.6",
6610
+ version: "0.2.8",
5924
6611
  install: install
5925
6612
  };
5926
6613
 
5927
- export { NextContainer, NextCrudTable, NextCrudTableVirtualized, NextDialog, NextDragResize, NextForm, NextLayout, NextMenu, NextSpinLoading, NextTabs, NextTextEllipsis, NextTreeSelect, NextUpload, NextVideoPlayer, buildLocaleContext, buildTranslator, index as default, defaultNamespace, install, localeContextKey, localeLang, namespaceContextKey, nextUseCssTheme, nextUseCssVar, translate, updateThemeColor, updateThemeColorCssVar, useDetectVideo, useGetDerivedNamespace, useLanguage, useLocale, useNamespace, version };
6614
+ export { NextContainer, NextCrudTable, NextCrudTableVirtualized, NextDialog, NextDragResize, NextForm, NextLabelimg, NextLayout, NextMenu, NextSpinLoading, NextTabs, NextTextEllipsis, NextTreeSelect, NextUpload, NextVideoPlayer, buildLocaleContext, buildTranslator, index as default, defaultNamespace, install, localeContextKey, localeLang, namespaceContextKey, nextUseCssTheme, nextUseCssVar, translate, updateThemeColor, updateThemeColorCssVar, useDetectVideo, useGetDerivedNamespace, useLanguage, useLocale, useNamespace, version };