next-element-vue 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -2,8 +2,8 @@
2
2
  /**
3
3
  * 作  者:huangteng
4
4
  * 邮  箱:htengweb@163.com
5
- * 当前版本:0.2.8 v
6
- * 发布日期:2024-06-12
5
+ * 当前版本:0.2.9 v
6
+ * 发布日期:2024-06-14
7
7
  * 地  址:https://www.npmjs.com/package/next-element-vue
8
8
  */
9
9
 
@@ -791,7 +791,9 @@
791
791
  systemSetting: "系统配置"
792
792
  },
793
793
  labelimg: {
794
- saveTxt: "保存中..."
794
+ saveTxt: "保存中...",
795
+ emptyLabelText: "暂无标签数据",
796
+ confirmDeleteLabel: "确定要删除该标注吗?"
795
797
  }
796
798
  }
797
799
  }, enLocale = {
@@ -863,7 +865,9 @@
863
865
  systemSetting: "system setting"
864
866
  },
865
867
  labelimg: {
866
- saveTxt: "saving..."
868
+ saveTxt: "saving...",
869
+ emptyLabelText: "No label data",
870
+ confirmDeleteLabel: "Are you sure you want to delete this annotation?"
867
871
  }
868
872
  }
869
873
  }, zhtwLocale = {
@@ -935,7 +939,9 @@
935
939
  systemSetting: "系統配置"
936
940
  },
937
941
  labelimg: {
938
- saveTxt: "保存中..."
942
+ saveTxt: "保存中...",
943
+ emptyLabelText: "暂无标签数据",
944
+ confirmDeleteLabel: "确定要删除该标注吗?"
939
945
  }
940
946
  }
941
947
  };
@@ -1064,7 +1070,7 @@
1064
1070
  }, extra) for (const [key, comp] of Object.entries(extra)) main[key] = comp;
1065
1071
  return main;
1066
1072
  }, slots_config_headerMenu = "header-menu", slots_config_headerToolsPrefix = "header-tools-prefix", slots_config_headerToolsSuffix = "header-tools-suffix";
1067
- var defaultConfig$3 = {
1073
+ var defaultConfig$4 = {
1068
1074
  logo: "",
1069
1075
  title: "Next Element Vue",
1070
1076
  userName: "Admin",
@@ -1108,7 +1114,7 @@
1108
1114
  isDark: !1
1109
1115
  }
1110
1116
  };
1111
- const ns$j = useNamespace("text-ellipsis");
1117
+ const ns$k = useNamespace("text-ellipsis");
1112
1118
  const NextTextEllipsis = withInstall(vue.defineComponent({
1113
1119
  name: "NextTextEllipsis",
1114
1120
  props: {
@@ -1154,7 +1160,7 @@
1154
1160
  }
1155
1161
  };
1156
1162
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
1157
- class: [ ns$j.b(), props.class ],
1163
+ class: [ ns$k.b(), props.class ],
1158
1164
  style: setWidth.value,
1159
1165
  onMouseenter: onMouseenter
1160
1166
  }, [ isTip.value ? vue.createVNode(elementPlus.ElTooltip, {
@@ -1164,11 +1170,11 @@
1164
1170
  disabled: props.disabled
1165
1171
  }, {
1166
1172
  default: () => [ vue.createVNode("span", {
1167
- class: ns$j.e("text"),
1173
+ class: ns$k.e("text"),
1168
1174
  ref: ellipsisRef
1169
1175
  }, [ slots.default ? slots.default() : props.content ]) ]
1170
1176
  }) : vue.createVNode("span", {
1171
- class: ns$j.e("text"),
1177
+ class: ns$k.e("text"),
1172
1178
  ref: ellipsisRef
1173
1179
  }, [ slots.default ? slots.default() : props.content ]) ]) ]);
1174
1180
  }
@@ -2491,7 +2497,7 @@
2491
2497
  }, null) ]
2492
2498
  }))) ]) ]);
2493
2499
  }
2494
- }), ns$i = useNamespace("menu");
2500
+ }), ns$j = useNamespace("menu");
2495
2501
  const NextMenu = withInstall(vue.defineComponent({
2496
2502
  name: "NextMenu",
2497
2503
  props: {
@@ -2518,13 +2524,13 @@
2518
2524
  }
2519
2525
  },
2520
2526
  setup(props) {
2521
- vue.provide("ns", ns$i);
2527
+ vue.provide("ns", ns$j);
2522
2528
  const router = vue.getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, activePath = vue.ref(currentPath);
2523
2529
  vue.watch((() => router.currentRoute?.value), (to => {
2524
2530
  activePath.value = to.fullPath;
2525
2531
  }));
2526
2532
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(elementPlus.ElMenu, {
2527
- class: [ ns$i.b(), props.className ],
2533
+ class: [ ns$j.b(), props.className ],
2528
2534
  style: props.style,
2529
2535
  defaultActive: activePath.value,
2530
2536
  router: props.router,
@@ -2532,7 +2538,7 @@
2532
2538
  ellipsis: !0
2533
2539
  }, {
2534
2540
  default: () => [ vue.createVNode(vue.Fragment, null, [ props.menuTree.map((item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : vue.createVNode(elementPlus.ElSubMenu, {
2535
- "popper-class": ns$i.b("popper"),
2541
+ "popper-class": ns$j.b("popper"),
2536
2542
  index: item.path || item.id,
2537
2543
  teleported: !0
2538
2544
  }, {
@@ -2543,7 +2549,7 @@
2543
2549
  menuData: item.children
2544
2550
  }, null)
2545
2551
  }) : valueExist(item.meta?.isHide, !1) ? null : vue.createVNode(elementPlus.ElMenuItem, {
2546
- "popper-class": ns$i.b("popper"),
2552
+ "popper-class": ns$j.b("popper"),
2547
2553
  index: item.path
2548
2554
  }, {
2549
2555
  default: () => [ vue.createVNode(MenuItemTitle, {
@@ -2569,19 +2575,19 @@
2569
2575
  }) ]);
2570
2576
  }
2571
2577
  });
2572
- const ns$h = useNamespace("layout-defaults");
2578
+ const ns$i = useNamespace("layout-defaults");
2573
2579
  var defaults = vue.defineComponent({
2574
2580
  props: {},
2575
- setup: () => (vue.provide("ns", ns$h), {}),
2581
+ setup: () => (vue.provide("ns", ns$i), {}),
2576
2582
  render() {
2577
2583
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {});
2578
2584
  slots.menu;
2579
2585
  const isTabs = vue.ref(!!slots.tabs);
2580
2586
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(elementPlus.ElContainer, {
2581
- class: ns$h.b()
2587
+ class: ns$i.b()
2582
2588
  }, {
2583
2589
  default: () => [ vue.createVNode(Sidebar$2, null, null), vue.createVNode("div", {
2584
- class: [ ns$h.b("content") ]
2590
+ class: [ ns$i.b("content") ]
2585
2591
  }, [ vue.createVNode(Header$3, null, null), _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
2586
2592
  tabs: _config.tabs,
2587
2593
  activeTab: _config.activeTab,
@@ -2589,7 +2595,7 @@
2589
2595
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2590
2596
  onClose: (...arg) => _emit("tabsClose", ...arg)
2591
2597
  }, null) : null, vue.createVNode("main", {
2592
- class: [ ns$h.bf("main"), ns$h.is("layout-tabs", isTabs.value) ]
2598
+ class: [ ns$i.bf("main"), ns$i.is("layout-tabs", isTabs.value) ]
2593
2599
  }, [ slots.default?.() ]) ]) ]
2594
2600
  });
2595
2601
  }
@@ -2619,10 +2625,10 @@
2619
2625
  }) ]) ]) ]);
2620
2626
  }
2621
2627
  });
2622
- const ns$g = useNamespace("layout-transverse");
2628
+ const ns$h = useNamespace("layout-transverse");
2623
2629
  var transverse = vue.defineComponent({
2624
2630
  props: {},
2625
- setup: () => (vue.provide("ns", ns$g), {}),
2631
+ setup: () => (vue.provide("ns", ns$h), {}),
2626
2632
  render() {
2627
2633
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {}), __slots_header = {};
2628
2634
  slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
@@ -2639,7 +2645,7 @@
2639
2645
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2640
2646
  onClose: (...arg) => _emit("tabsClose", ...arg)
2641
2647
  }, null) : null, vue.createVNode("main", {
2642
- class: [ ns$g.b("main"), ns$g.is("layout-tabs", isTabs.value) ]
2648
+ class: [ ns$h.b("main"), ns$h.is("layout-tabs", isTabs.value) ]
2643
2649
  }, [ slots.default?.() ]) ]);
2644
2650
  var s;
2645
2651
  }
@@ -2678,10 +2684,10 @@
2678
2684
  }, null) ]);
2679
2685
  }
2680
2686
  });
2681
- const ns$f = useNamespace("layout-columns");
2687
+ const ns$g = useNamespace("layout-columns");
2682
2688
  var columns = vue.defineComponent({
2683
2689
  props: {},
2684
- setup: () => (vue.provide("ns", ns$f), {}),
2690
+ setup: () => (vue.provide("ns", ns$g), {}),
2685
2691
  render() {
2686
2692
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {}), __slots_header = {};
2687
2693
  slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
@@ -2689,11 +2695,11 @@
2689
2695
  slots[slots_config_headerToolsSuffix] && (__slots_header[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2690
2696
  const isTabs = vue.ref(!!slots.tabs);
2691
2697
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(elementPlus.ElContainer, {
2692
- class: ns$f.b()
2698
+ class: ns$g.b()
2693
2699
  }, {
2694
2700
  default: () => {
2695
2701
  return [ vue.createVNode(Sidebar$1, null, null), vue.createVNode("div", {
2696
- class: [ ns$f.b("content") ]
2702
+ class: [ ns$g.b("content") ]
2697
2703
  }, [ vue.createVNode(Header$1, null, (s = __slots_header, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header : {
2698
2704
  default: () => [ __slots_header ]
2699
2705
  })), _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
@@ -2703,7 +2709,7 @@
2703
2709
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2704
2710
  onClose: (...arg) => _emit("tabsClose", ...arg)
2705
2711
  }, null) : null, vue.createVNode("main", {
2706
- class: [ ns$f.bf("main"), ns$f.is("layout-tabs", isTabs.value) ]
2712
+ class: [ ns$g.bf("main"), ns$g.is("layout-tabs", isTabs.value) ]
2707
2713
  }, [ slots.default?.() ]) ]) ];
2708
2714
  var s;
2709
2715
  }
@@ -2746,20 +2752,20 @@
2746
2752
  }) ]);
2747
2753
  }
2748
2754
  });
2749
- const ns$e = useNamespace("layout-classic");
2755
+ const ns$f = useNamespace("layout-classic");
2750
2756
  var classic = vue.defineComponent({
2751
2757
  props: {},
2752
- setup: () => (vue.provide("ns", ns$e), {
2753
- ns: ns$e
2758
+ setup: () => (vue.provide("ns", ns$f), {
2759
+ ns: ns$f
2754
2760
  }),
2755
2761
  render() {
2756
2762
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {});
2757
2763
  slots.menu;
2758
2764
  const isTabs = vue.ref(!!slots.tabs);
2759
2765
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(vue.Fragment, null, [ vue.createVNode(Header, null, null), vue.createVNode("div", {
2760
- class: [ ns$e.b("content"), ns$e.is("layout-tabs", isTabs.value) ]
2766
+ class: [ ns$f.b("content"), ns$f.is("layout-tabs", isTabs.value) ]
2761
2767
  }, [ vue.createVNode(Sidebar, null, null), vue.createVNode("div", {
2762
- class: ns$e.b("container")
2768
+ class: ns$f.b("container")
2763
2769
  }, [ _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
2764
2770
  tabs: _config.tabs,
2765
2771
  activeTab: _config.activeTab,
@@ -2767,11 +2773,11 @@
2767
2773
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2768
2774
  onClose: (...arg) => _emit("tabsClose", ...arg)
2769
2775
  }, null) : null, vue.createVNode("main", {
2770
- class: [ ns$e.b("main") ]
2776
+ class: [ ns$f.b("main") ]
2771
2777
  }, [ slots.default?.() ]) ]) ]) ]);
2772
2778
  }
2773
2779
  });
2774
- const ns$d = useNamespace("layout"), layouts = {
2780
+ const ns$e = useNamespace("layout"), layouts = {
2775
2781
  defaults: vue.markRaw(defaults),
2776
2782
  transverse: vue.markRaw(transverse),
2777
2783
  columns: vue.markRaw(columns),
@@ -2797,8 +2803,8 @@
2797
2803
  },
2798
2804
  emits: [ "changeLanguage", "changeUserDropdown", "changeOptions", "tabsChange", "tabsSelect", "tabsClose" ],
2799
2805
  setup(props, {slots: slots, emit: emit}) {
2800
- const _config = vue.ref(mergeWith(defaultConfig$3, props.options, customizerCoverArray));
2801
- vue.provide("options", _config.value), vue.provide("__ns__", ns$d), vue.provide("__emit__", emit),
2806
+ const _config = vue.ref(mergeWith(defaultConfig$4, props.options, customizerCoverArray));
2807
+ vue.provide("options", _config.value), vue.provide("__ns__", ns$e), vue.provide("__emit__", emit),
2802
2808
  vue.provide("__slots__", slots);
2803
2809
  const updateOptions = cfg => {
2804
2810
  _config.value = mergeWith(_config.value, cfg, customizerCoverArray), updateThemeColorCssVar(_config.value?.setting),
@@ -2822,13 +2828,13 @@
2822
2828
  const _activeSlots = {};
2823
2829
  for (const key in slots) Object.prototype.hasOwnProperty.call(slots, key) && (_activeSlots[key] = () => slots[key]?.());
2824
2830
  return vue.createVNode("div", {
2825
- class: [ ns$d.b(), props.className ],
2831
+ class: [ ns$e.b(), props.className ],
2826
2832
  style: props.style
2827
2833
  }, [ vue.h(activeLayout.value, {}, {
2828
2834
  ..._activeSlots
2829
2835
  }) ]);
2830
2836
  }
2831
- })), ns$c = useNamespace("tabs");
2837
+ })), ns$d = useNamespace("tabs");
2832
2838
  var Element$8 = vue.defineComponent({
2833
2839
  name: "NextTabs",
2834
2840
  props: {
@@ -2898,12 +2904,12 @@
2898
2904
  tabsView.value.push(activeRoute)), emit("change", activeIndex.value, tabsView.value, "add");
2899
2905
  }));
2900
2906
  const renderContent = () => vue.createVNode("nav", {
2901
- class: ns$c.b()
2907
+ class: ns$d.b()
2902
2908
  }, [ vue.createVNode(elementPlus.ElScrollbar, null, {
2903
2909
  default: () => [ vue.createVNode("ul", {
2904
- class: ns$c.b("list")
2910
+ class: ns$d.b("list")
2905
2911
  }, [ tabsView.value.map(((tab, index) => tab ? vue.createVNode("li", {
2906
- class: [ "tab-item", ns$c.is("active", activeIndex.value === index) ],
2912
+ class: [ "tab-item", ns$d.is("active", activeIndex.value === index) ],
2907
2913
  onClick: event => onClickTabItem(event, tab, index)
2908
2914
  }, [ vue.createVNode("i", {
2909
2915
  class: [ "tab-icon", tab.meta?.icon ]
@@ -2934,11 +2940,11 @@
2934
2940
  onCommand: onChange
2935
2941
  }, {
2936
2942
  default: () => vue.createVNode("span", {
2937
- class: ns$c.b("tab-more")
2943
+ class: ns$d.b("tab-more")
2938
2944
  }, [ vue.createVNode("i", {
2939
- class: [ ns$c.be("tab-more", "box"), ns$c.be("tab-more", "top") ]
2945
+ class: [ ns$d.be("tab-more", "box"), ns$d.be("tab-more", "top") ]
2940
2946
  }, null), vue.createVNode("i", {
2941
- class: [ ns$c.be("tab-more", "box"), ns$c.be("tab-more", "bottom") ]
2947
+ class: [ ns$d.be("tab-more", "box"), ns$d.be("tab-more", "bottom") ]
2942
2948
  }, null) ]),
2943
2949
  dropdown: () => vue.createVNode(elementPlus.ElDropdownMenu, null, {
2944
2950
  default: () => [ vue.createVNode(elementPlus.ElDropdownItem, {
@@ -2971,7 +2977,7 @@
2971
2977
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
2972
2978
  }
2973
2979
  });
2974
- const NextTabs = withInstall(Element$8), ns$b = useNamespace("container");
2980
+ const NextTabs = withInstall(Element$8), ns$c = useNamespace("container");
2975
2981
  const NextContainer = withInstall(vue.defineComponent({
2976
2982
  name: "NextContainer",
2977
2983
  props: {
@@ -3009,18 +3015,18 @@
3009
3015
  }), style;
3010
3016
  }));
3011
3017
  return () => props.scrollbar ? vue.createVNode(elementPlus.ElScrollbar, {
3012
- class: [ ns$b.b(), props.className ],
3018
+ class: [ ns$c.b(), props.className ],
3013
3019
  style: props.style
3014
3020
  }, {
3015
3021
  default: () => [ slots.default?.() ]
3016
3022
  }) : vue.createVNode("div", {
3017
- class: [ ns$b.b(), props.className ],
3023
+ class: [ ns$c.b(), props.className ],
3018
3024
  style: {
3019
3025
  ...styles.value,
3020
3026
  ...props.style
3021
3027
  }
3022
3028
  }, [ props.card ? vue.createVNode("div", {
3023
- class: ns$b.b("card")
3029
+ class: ns$c.b("card")
3024
3030
  }, [ slots.default?.() ]) : slots.default?.() ]);
3025
3031
  }
3026
3032
  }));
@@ -3094,7 +3100,7 @@
3094
3100
  }
3095
3101
  };
3096
3102
  const header_menu_slots_key = [ "menu-left-prefix", "menu-left-suffix", "menu-right-prefix", "menu-right-suffix" ], operation_column_slots_key = [ "operation-column-prefix", "operation-column-suffix" ];
3097
- var defaultConfig$2 = {
3103
+ var defaultConfig$3 = {
3098
3104
  initLoadData: !0,
3099
3105
  defaultContentHeight: 300,
3100
3106
  fullscreenchangeContentHeight: !1,
@@ -3140,7 +3146,7 @@
3140
3146
  formSpan: 12,
3141
3147
  formColumnMinWidth: 350
3142
3148
  };
3143
- const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$a = useNamespace("spin-loading");
3149
+ const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$b = useNamespace("spin-loading");
3144
3150
  var NextSpinLoading$1 = vue.defineComponent({
3145
3151
  name: "NextSpinLoading",
3146
3152
  props: {
@@ -3161,31 +3167,35 @@
3161
3167
  default: ""
3162
3168
  }
3163
3169
  },
3164
- setup() {
3165
- const {t: t} = useLocale();
3166
- return {
3167
- t: t
3170
+ setup(props, {expose: expose}) {
3171
+ const {t: t} = useLocale(), elementInstance = vue.ref();
3172
+ return expose({
3173
+ elementInstance: elementInstance
3174
+ }), {
3175
+ t: t,
3176
+ elementInstance: elementInstance
3168
3177
  };
3169
3178
  },
3170
3179
  render() {
3171
3180
  const _t = this.t, slots = this.$slots, props = this.$props, loadingText = props.tip || _t("next.loading");
3172
3181
  return vue.createVNode("div", {
3173
- class: [ ns$a.b(), props.className ],
3182
+ ref: "elementInstance",
3183
+ class: [ ns$b.b(), props.className ],
3174
3184
  style: props.style
3175
3185
  }, [ slots.default?.(), props.loading ? vue.createVNode("div", {
3176
- class: ns$a.b("mask")
3186
+ class: ns$b.b("mask")
3177
3187
  }, [ vue.createVNode("span", {
3178
- class: ns$a.b("mask-dot")
3188
+ class: ns$b.b("mask-dot")
3179
3189
  }, [ vue.createVNode("i", {
3180
- class: ns$a.be("mask", "dot-item")
3190
+ class: ns$b.be("mask", "dot-item")
3181
3191
  }, null), vue.createVNode("i", {
3182
- class: ns$a.be("mask", "dot-item")
3192
+ class: ns$b.be("mask", "dot-item")
3183
3193
  }, null), vue.createVNode("i", {
3184
- class: ns$a.be("mask", "dot-item")
3194
+ class: ns$b.be("mask", "dot-item")
3185
3195
  }, null), vue.createVNode("i", {
3186
- class: ns$a.be("mask", "dot-item")
3196
+ class: ns$b.be("mask", "dot-item")
3187
3197
  }, null) ]), vue.createVNode("span", {
3188
- class: ns$a.be("mask", "text")
3198
+ class: ns$b.be("mask", "text")
3189
3199
  }, [ loadingText ]) ]) : null ]);
3190
3200
  }
3191
3201
  }), SearchColumn = vue.defineComponent({
@@ -3858,7 +3868,7 @@
3858
3868
  }, null) ]);
3859
3869
  }
3860
3870
  });
3861
- const ns$9 = useNamespace("dialog");
3871
+ const ns$a = useNamespace("dialog");
3862
3872
  var NextDialog$1 = vue.defineComponent({
3863
3873
  name: "NextDialog",
3864
3874
  props: {
@@ -3923,7 +3933,7 @@
3923
3933
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(elementPlus.ElDialog, {
3924
3934
  modelValue: visible.value,
3925
3935
  "onUpdate:modelValue": $event => visible.value = $event,
3926
- class: ns$9.b(),
3936
+ class: ns$a.b(),
3927
3937
  title: props.title,
3928
3938
  appendToBody: props.appendToBody,
3929
3939
  "destroy-on-close": !0,
@@ -3940,12 +3950,12 @@
3940
3950
  }, {
3941
3951
  default: () => [ slots.default?.() ],
3942
3952
  header: ({close: close, titleId: titleId, titleClass: titleClass}) => vue.createVNode("div", {
3943
- class: ns$9.b("header")
3953
+ class: ns$a.b("header")
3944
3954
  }, [ vue.createVNode("h4", {
3945
3955
  id: titleId,
3946
3956
  class: titleClass
3947
3957
  }, [ props.title ]), vue.createVNode("div", {
3948
- class: ns$9.e("header-right")
3958
+ class: ns$a.e("header-right")
3949
3959
  }, [ props.fullscreenBtn && vue.createVNode("span", {
3950
3960
  class: "icon-fullscreen",
3951
3961
  onClick: () => isFullscreen.value = !isFullscreen.value
@@ -3977,7 +3987,7 @@
3977
3987
  settingBtn: !0,
3978
3988
  operations: !1
3979
3989
  };
3980
- var defaultConfig$1 = {
3990
+ var defaultConfig$2 = {
3981
3991
  size: "default",
3982
3992
  colSpan: 8,
3983
3993
  labelWidth: "6em",
@@ -3991,7 +4001,7 @@
3991
4001
  submitText: null,
3992
4002
  resetText: null
3993
4003
  };
3994
- const ns$8 = useNamespace("form");
4004
+ const ns$9 = useNamespace("form");
3995
4005
  var NumberRangePicker = vue.defineComponent({
3996
4006
  name: "NumberRangePicker",
3997
4007
  props: {
@@ -4030,7 +4040,7 @@
4030
4040
  }));
4031
4041
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
4032
4042
  ref: numberRangeRef,
4033
- class: ns$8.e("number-range")
4043
+ class: ns$9.e("number-range")
4034
4044
  }, [ vue.createVNode(elementPlus.ElInputNumber, {
4035
4045
  modelValue: startNumber.value,
4036
4046
  "onUpdate:modelValue": $event => startNumber.value = $event,
@@ -4040,7 +4050,7 @@
4040
4050
  disabled: disabled,
4041
4051
  onChange: onChangeStart
4042
4052
  }, null), vue.createVNode("span", {
4043
- class: ns$8.em("number-range", "division")
4053
+ class: ns$9.em("number-range", "division")
4044
4054
  }, [ t("next.date.rangeSeparator") ]), vue.createVNode(elementPlus.ElInputNumber, {
4045
4055
  modelValue: endNumber.value,
4046
4056
  "onUpdate:modelValue": $event => endNumber.value = $event,
@@ -4056,7 +4066,7 @@
4056
4066
  function _isSlot$3(s) {
4057
4067
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
4058
4068
  }
4059
- const ns$7 = useNamespace("form"), InputTableSelect = vue.defineComponent({
4069
+ const ns$8 = useNamespace("form"), InputTableSelect = vue.defineComponent({
4060
4070
  name: "InputTableSelect",
4061
4071
  props: {
4062
4072
  modelValue: {
@@ -4084,7 +4094,7 @@
4084
4094
  },
4085
4095
  emits: [ "select" ],
4086
4096
  setup(props, {emit: emit}) {
4087
- const {t: t} = useLocale(), _disabled = props.disabled, _column = props.column, _placeholder = _column.placeholder || t("next.form.select") + _column.label, _tableDefaultConfig = deepClone(defaultConfig$2), _tableSelectConfig = deepClone(tableSelectConfig), _options = merge$1(_tableDefaultConfig, _tableSelectConfig, _column.tableSelect), tableSelectDialog = vue.reactive({
4097
+ const {t: t} = useLocale(), _disabled = props.disabled, _column = props.column, _placeholder = _column.placeholder || t("next.form.select") + _column.label, _tableDefaultConfig = deepClone(defaultConfig$3), _tableSelectConfig = deepClone(tableSelectConfig), _options = merge$1(_tableDefaultConfig, _tableSelectConfig, _column.tableSelect), tableSelectDialog = vue.reactive({
4088
4098
  visible: !1,
4089
4099
  title: _column.label + t("next.form.tableSelect"),
4090
4100
  dialogWidth: _options.dialogWidth
@@ -4155,18 +4165,18 @@
4155
4165
  }, renderContent = () => {
4156
4166
  let _slot, _slot2;
4157
4167
  return vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
4158
- class: [ "el-input", ns$7.e("input-table"), ns$7.is("disabled", _disabled) ]
4168
+ class: [ "el-input", ns$8.e("input-table"), ns$8.is("disabled", _disabled) ]
4159
4169
  }, [ vue.createVNode("div", {
4160
4170
  class: "el-input__wrapper"
4161
4171
  }, [ tags?.value.length ? vue.createVNode("span", {
4162
- class: ns$7.em("input-table", "value")
4172
+ class: ns$8.em("input-table", "value")
4163
4173
  }, [ tags.value.map(((tag, index) => vue.createVNode(elementPlus.ElTag, {
4164
4174
  closable: !_disabled,
4165
4175
  onClose: () => _onCloseTag(0, index)
4166
4176
  }, {
4167
4177
  default: () => [ tag.label ]
4168
4178
  }))), tagsMore?.value?.length ? vue.createVNode(elementPlus.ElTooltip, {
4169
- "popper-class": ns$7.e("tooltip-tags"),
4179
+ "popper-class": ns$8.e("tooltip-tags"),
4170
4180
  placement: "bottom",
4171
4181
  effect: "light"
4172
4182
  }, {
@@ -4180,10 +4190,10 @@
4180
4190
  default: () => [ tag.label ]
4181
4191
  })))
4182
4192
  }) : null ]) : vue.createVNode("span", {
4183
- class: ns$7.em("input-table", "placeholder")
4193
+ class: ns$8.em("input-table", "placeholder")
4184
4194
  }, [ _placeholder ]) ]), vue.createVNode(elementPlus.ElButton, {
4185
4195
  type: "primary",
4186
- class: ns$7.em("input-table", "append"),
4196
+ class: ns$8.em("input-table", "append"),
4187
4197
  disabled: _disabled,
4188
4198
  icon: search_default,
4189
4199
  onClick: onClickTableDialog
@@ -4197,7 +4207,7 @@
4197
4207
  onClose: onCloseTableDialog
4198
4208
  }, {
4199
4209
  default: () => [ vue.createVNode("div", {
4200
- class: ns$7.em("input-table", "content")
4210
+ class: ns$8.em("input-table", "content")
4201
4211
  }, [ vue.createVNode(elementPlus.ElRadioGroup, {
4202
4212
  modelValue: sinleSelection.value
4203
4213
  }, {
@@ -4220,7 +4230,7 @@
4220
4230
  }) ]
4221
4231
  }) ]
4222
4232
  }) ]), vue.createVNode("div", {
4223
- class: ns$7.em("input-table", "footer")
4233
+ class: ns$8.em("input-table", "footer")
4224
4234
  }, [ vue.createVNode(elementPlus.ElButton, {
4225
4235
  onClick: onResetTableSelect
4226
4236
  }, _isSlot$3(_slot = t("next.form.reset")) ? _slot : {
@@ -4236,7 +4246,7 @@
4236
4246
  };
4237
4247
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
4238
4248
  }
4239
- }), ns$6 = useNamespace("form");
4249
+ }), ns$7 = useNamespace("form");
4240
4250
  var UploadImage = vue.defineComponent({
4241
4251
  name: "UploadImage",
4242
4252
  props: {
@@ -4284,7 +4294,7 @@
4284
4294
  let urls = [];
4285
4295
  return "string" == typeof value ? urls = [ value ] : "[object Array]" === Object.prototype.toString.call(value) && (urls = value),
4286
4296
  urls = urls.filter((url => !!url)), urls.length ? vue.createVNode(elementPlus.ElImage, {
4287
- class: ns$6.e("preview-image"),
4297
+ class: ns$7.e("preview-image"),
4288
4298
  src: urls[0],
4289
4299
  previewSrcList: urls,
4290
4300
  "preview-teleported": !0,
@@ -4299,7 +4309,7 @@
4299
4309
  })
4300
4310
  }) : null;
4301
4311
  })(), _disabled ? null : vue.createVNode(elementPlus.ElUpload, {
4302
- class: [ ns$6.b("upload-image"), props.className ],
4312
+ class: [ ns$7.b("upload-image"), props.className ],
4303
4313
  style: props.style,
4304
4314
  "list-type": props.listType,
4305
4315
  "auto-upload": !1,
@@ -4424,7 +4434,7 @@
4424
4434
  }, null) ]);
4425
4435
  }
4426
4436
  });
4427
- const ns$5 = useNamespace("form");
4437
+ const ns$6 = useNamespace("form");
4428
4438
  var Element$6 = vue.defineComponent({
4429
4439
  name: "NextForm",
4430
4440
  props: {
@@ -4443,7 +4453,7 @@
4443
4453
  },
4444
4454
  emits: [ "submit", "close", "reset" ],
4445
4455
  setup(props, {slots: slots, emit: emit, expose: expose}) {
4446
- const _config = deepClone(defaultConfig$1), options = vue.reactive(merge$1(_config, props.options)), _isEditing = vue.computed((() => "boolean" != typeof options.isEditing || options.isEditing)), {t: t} = useLocale(), colSpan = vue.ref(options.colSpan), formDatum = vue.reactive(props.formDatum) || {}, formParams = vue.reactive(merge$1({}, formDatum)), _formColumns = vue.ref([]), formRules = vue.reactive({});
4456
+ const _config = deepClone(defaultConfig$2), options = vue.reactive(merge$1(_config, props.options)), _isEditing = vue.computed((() => "boolean" != typeof options.isEditing || options.isEditing)), {t: t} = useLocale(), colSpan = vue.ref(options.colSpan), formDatum = vue.reactive(props.formDatum) || {}, formParams = vue.reactive(merge$1({}, formDatum)), _formColumns = vue.ref([]), formRules = vue.reactive({});
4447
4457
  vue.watch((() => [ props.columns, props.formDatum ]), (() => {
4448
4458
  (() => {
4449
4459
  const columns = props.columns;
@@ -4787,7 +4797,7 @@
4787
4797
  let _slot;
4788
4798
  return vue.createVNode(elementPlus.ElForm, {
4789
4799
  ref: ruleFormRef,
4790
- class: ns$5.b(),
4800
+ class: ns$6.b(),
4791
4801
  inline: !1,
4792
4802
  model: formParams,
4793
4803
  size: options.size
@@ -4808,7 +4818,7 @@
4808
4818
  }, {
4809
4819
  label: () => column.label ? vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextTextEllipsis, {
4810
4820
  content: t(column.label),
4811
- class: ns$5.e("item-label")
4821
+ class: ns$6.e("item-label")
4812
4822
  }, null), column.tip ? vue.createVNode(elementPlus.ElTooltip, {
4813
4823
  effect: "dark",
4814
4824
  content: column.tip,
@@ -4828,7 +4838,7 @@
4828
4838
  }))), "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? _slot : {
4829
4839
  default: () => [ _slot ]
4830
4840
  })), _isEditing.value && options.showFooter ? vue.createVNode("div", {
4831
- class: ns$5.e("footer")
4841
+ class: ns$6.e("footer")
4832
4842
  }, [ vue.createVNode(elementPlus.ElButton, {
4833
4843
  type: "primary",
4834
4844
  loading: submitLoading.value,
@@ -4901,17 +4911,17 @@
4901
4911
  function _isSlot(s) {
4902
4912
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
4903
4913
  }
4904
- const ns$4 = useNamespace("crud-table");
4914
+ const ns$5 = useNamespace("crud-table");
4905
4915
  var Element$5 = vue.defineComponent({
4906
4916
  name: "NextCrudTable",
4907
4917
  props: defaultPropsConfig,
4908
4918
  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" ],
4909
4919
  setup(props, {emit: emit, slots: slots, expose: expose}) {
4910
- const _config = deepClone(defaultConfig$2), _options = vue.computed((() => {
4920
+ const _config = deepClone(defaultConfig$3), _options = vue.computed((() => {
4911
4921
  const cfg = vue.unref(props.options);
4912
4922
  return merge$1(_config, cfg);
4913
4923
  })), options = vue.unref(_options);
4914
- vue.provide("options", vue.computed((() => _options.value))), vue.provide("ns", ns$4);
4924
+ vue.provide("options", vue.computed((() => _options.value))), vue.provide("ns", ns$5);
4915
4925
  const {t: t} = useLocale(), _columns = vue.ref(options.columns), _searchColumns = vue.ref([]), _formColumns = vue.ref([]), _updateColumnsAll = ops => {
4916
4926
  ((options, cb) => {
4917
4927
  const _columns = vue.reactive(options.columns), _loadDicData = col => {
@@ -5152,11 +5162,11 @@
5152
5162
  });
5153
5163
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
5154
5164
  ref: crudTableRef,
5155
- class: [ ns$4.b(), props.className ],
5165
+ class: [ ns$5.b(), props.className ],
5156
5166
  style: props.style
5157
5167
  }, [ options.showSearchForm || options.showHeaderMenu ? vue.createVNode("header", {
5158
5168
  ref: headerRef,
5159
- class: ns$4.b("header")
5169
+ class: ns$5.b("header")
5160
5170
  }, [ options.showSearchForm && vue.createVNode(HeaderSearch, {
5161
5171
  columns: _searchColumns.value,
5162
5172
  onZoomResize: updateTableContentHeight,
@@ -5175,7 +5185,7 @@
5175
5185
  }, {
5176
5186
  default: () => [ vue.createVNode("div", {
5177
5187
  ref: tableRef,
5178
- class: ns$4.b("content")
5188
+ class: ns$5.b("content")
5179
5189
  }, [ vue.createVNode(elementPlus.ElTable, {
5180
5190
  data: tableData.value,
5181
5191
  height: tableContentHeight.value,
@@ -5238,7 +5248,7 @@
5238
5248
  }) ]) ]
5239
5249
  }), options.isPagination ? vue.createVNode("div", {
5240
5250
  ref: footerRef,
5241
- class: ns$4.b("footer")
5251
+ class: ns$5.b("footer")
5242
5252
  }, [ vue.createVNode(FooterPagination, {
5243
5253
  page: props.page,
5244
5254
  onChange: onChangePagination
@@ -5294,13 +5304,13 @@
5294
5304
  total: 0
5295
5305
  })
5296
5306
  }
5297
- }, defaultConfig = {};
5298
- const ns$3 = useNamespace("crud-table-virtualized");
5307
+ }, defaultConfig$1 = {};
5308
+ const ns$4 = useNamespace("crud-table-virtualized");
5299
5309
  const NextCrudTableVirtualized = withInstall(vue.defineComponent({
5300
5310
  name: "NextCrudTableVirtualized",
5301
5311
  props: propsConfig,
5302
5312
  setup(props, {emit: emit}) {
5303
- const _config = deepClone(defaultConfig), _options = vue.computed((() => {
5313
+ const _config = deepClone(defaultConfig$1), _options = vue.computed((() => {
5304
5314
  const cfg = vue.unref(props.options);
5305
5315
  return merge$1(_config, cfg);
5306
5316
  })), options = vue.unref(_options);
@@ -5315,7 +5325,7 @@
5315
5325
  emit("close-add-edit");
5316
5326
  };
5317
5327
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
5318
- class: [ ns$3.b(), props.className ]
5328
+ class: [ ns$4.b(), props.className ]
5319
5329
  }, [ vue.createVNode(NextSpinLoading, null, null), vue.createVNode(NextDialog, {
5320
5330
  modelValue: addEditDialog.visible,
5321
5331
  "onUpdate:modelValue": $event => addEditDialog.visible = $event,
@@ -5326,7 +5336,7 @@
5326
5336
  onClose: onCloseAddEditDialog
5327
5337
  }, null) ]) ]);
5328
5338
  }
5329
- })), NextSpinLoading = withInstall(NextSpinLoading$1), ns$2 = useNamespace("upload");
5339
+ })), NextSpinLoading = withInstall(NextSpinLoading$1), ns$3 = useNamespace("upload");
5330
5340
  const NextUpload = withInstall(vue.defineComponent({
5331
5341
  name: "NextUpload",
5332
5342
  props: {
@@ -5360,7 +5370,7 @@
5360
5370
  const slots = this.$slots, props = this.$props, emit = this.$emit, _t = this.t, uploadfilesPreview = vue.ref([]), body = document.getElementsByTagName("body")[0];
5361
5371
  let previewImagesContainer = null;
5362
5372
  return vue.createVNode(elementPlus.ElUpload, {
5363
- class: [ ns$2.b(), props.className ],
5373
+ class: [ ns$3.b(), props.className ],
5364
5374
  style: props.style,
5365
5375
  "list-type": props.listType,
5366
5376
  "auto-upload": !1,
@@ -5398,7 +5408,7 @@
5398
5408
  })
5399
5409
  });
5400
5410
  }
5401
- })), ns$1 = useNamespace("video-player");
5411
+ })), ns$2 = useNamespace("video-player");
5402
5412
  var Element$2 = vue.defineComponent({
5403
5413
  name: "NextVideoPlayer",
5404
5414
  props: {
@@ -5472,7 +5482,7 @@
5472
5482
  if (!classNames || !classNames.length) throw new Error("模型类别不能未空!");
5473
5483
  container.innerHTML = "", tf__namespace.loadGraphModel(modelUrl).then((model => {
5474
5484
  const canvas = document.createElement("canvas");
5475
- canvas.className = ns$1.b("recongition"), container.appendChild(canvas);
5485
+ canvas.className = ns$2.b("recongition"), container.appendChild(canvas);
5476
5486
  const ctx = canvas.getContext("2d"), detect_ctx = document.createElement("canvas").getContext("2d");
5477
5487
  video.ontimeupdate = () => {
5478
5488
  const {videoWidth: videoWidth, videoHeight: videoHeight, offsetTop: offsetTop, offsetLeft: offsetLeft} = video;
@@ -5643,7 +5653,7 @@
5643
5653
  });
5644
5654
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
5645
5655
  ref: videoBoxRef,
5646
- class: [ ns$1.b(), props.className ],
5656
+ class: [ ns$2.b(), props.className ],
5647
5657
  style: props.style
5648
5658
  }, null) ]);
5649
5659
  }
@@ -5737,7 +5747,7 @@
5737
5747
  }
5738
5748
  }, [ vue.createVNode("span", {
5739
5749
  style: {
5740
- "background-color": colors[index]
5750
+ "background-color": colors[index % colors.length]
5741
5751
  },
5742
5752
  class: "label-line"
5743
5753
  }, null), vue.createVNode("span", null, [ name ]) ]))) ]), isValueExist(activateIndex.value) ? vue.createVNode("div", {
@@ -5753,7 +5763,9 @@
5753
5763
  }) ]) : null ]);
5754
5764
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
5755
5765
  }
5756
- }), DraggableRect = vue.defineComponent({
5766
+ });
5767
+ const {hexToRgb: hexToRgb} = useChangeColor();
5768
+ var DraggableRect = vue.defineComponent({
5757
5769
  props: {
5758
5770
  parentEl: {
5759
5771
  type: Object,
@@ -5762,6 +5774,10 @@
5762
5774
  rect: {
5763
5775
  type: Object,
5764
5776
  default: () => ({})
5777
+ },
5778
+ color: {
5779
+ type: String,
5780
+ default: null
5765
5781
  }
5766
5782
  },
5767
5783
  emits: [ "draggle-resize", "contextmenu" ],
@@ -5870,17 +5886,21 @@
5870
5886
  };
5871
5887
  },
5872
5888
  render() {
5873
- const _ns = vue.inject("ns", {});
5889
+ const _ns = vue.inject("ns", {}), props = this.$props;
5874
5890
  return vue.createVNode("div", {
5875
5891
  class: [ _ns.b("draggable-rect") ],
5876
5892
  style: (() => {
5877
- const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = this.rect;
5878
- return {
5893
+ const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = this.rect, style = {
5879
5894
  top: startY + "px",
5880
5895
  left: startX + "px",
5881
5896
  width: rectWidth + "px",
5882
5897
  height: rectHeight + "px"
5883
- };
5898
+ }, color = props.color;
5899
+ if (color) {
5900
+ const rgb_color = hexToRgb(color);
5901
+ rgb_color && (style.backgroundColor = `rgba(${rgb_color[0]},${rgb_color[1]},${rgb_color[2]}, 0.5)`);
5902
+ }
5903
+ return style;
5884
5904
  })(),
5885
5905
  onMousedown: this.onMousedown,
5886
5906
  onMouseup: this.onMouseup,
@@ -5920,13 +5940,18 @@
5920
5940
  type: Array,
5921
5941
  default: () => []
5922
5942
  },
5943
+ contextClientHeight: {
5944
+ type: Number,
5945
+ default: null
5946
+ },
5923
5947
  rowInfo: {
5924
5948
  type: Object,
5925
5949
  default: () => ({})
5926
5950
  }
5927
5951
  },
5928
- setup(props) {
5929
- const ns = vue.inject("ns", {}), _emit = vue.inject("_emit", null), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), canvasRectRef = vue.ref(), formatLabelsType = () => {
5952
+ emits: [ "change" ],
5953
+ setup(props, {emit: emit, expose: expose}) {
5954
+ const ns = vue.inject("ns", {}), _emit = vue.inject("_emit", null), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), canvasRectRef = vue.ref(), labels = vue.ref([]), drawBaseCanvas = vue.ref({}), formatLabelsType = () => {
5930
5955
  const _labels = deepClone(labels.value);
5931
5956
  let yolo_label = [];
5932
5957
  return {
@@ -5937,7 +5962,7 @@
5937
5962
  })),
5938
5963
  label_txt: yolo_label.join("\n")
5939
5964
  };
5940
- }, labels = vue.ref([]), drawBaseCanvas = vue.ref({}), renderImageLabel = rowInfo => {
5965
+ }, loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
5941
5966
  labels.value = (rowInfo => rowInfo.labels ? rowInfo.labels.map((rect => {
5942
5967
  const typeName = props.classes[rect.type];
5943
5968
  return typeName && (rect.typeName = typeName), rect;
@@ -5945,15 +5970,26 @@
5945
5970
  const clientHeight = canvasMainRef.value?.clientHeight, ctx = canvasBaseRef.value?.getContext("2d");
5946
5971
  if (rowInfo?.imageSrc) {
5947
5972
  const image = new Image;
5948
- image.src = rowInfo.imageSrc, image.onload = () => {
5949
- const {width: width, height: height} = image, canvasHeight = clientHeight, scaleFactor = canvasHeight / height, canvasWidth = Math.ceil(width * scaleFactor);
5973
+ image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
5974
+ loadingImage.value = !1;
5975
+ const {width: width, height: height} = image, canvasHeight = clientHeight, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
5950
5976
  ((canvasWidth, canvasHeight) => {
5951
5977
  canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
5952
5978
  canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
5953
5979
  canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px",
5954
5980
  canvasRectRef.value.width = canvasWidth, canvasRectRef.value.height = canvasHeight,
5955
5981
  canvasRectRef.value.style.width = canvasWidth + "px", canvasRectRef.value.style.height = canvasHeight + "px";
5956
- })(canvasWidth, canvasHeight);
5982
+ })(canvasWidth, canvasHeight), labels.value = ((labels, canvasHeight) => {
5983
+ let scale_rects = [];
5984
+ for (let i = 0; i < labels.length; i++) {
5985
+ const rect = labels[i], scale = parseFloat((canvasHeight / rect.canvasHeight).toFixed(3));
5986
+ scale && (rect.startX = Math.ceil(rect.startX * scale), rect.startY = Math.ceil(rect.startY * scale),
5987
+ rect.rectWidth = Math.ceil(rect.rectWidth * scale), rect.rectHeight = Math.ceil(rect.rectHeight * scale),
5988
+ rect.canvasWidth = Math.ceil(rect.canvasWidth * scale), rect.canvasHeight = canvasHeight),
5989
+ scale_rects.push(rect);
5990
+ }
5991
+ return scale_rects;
5992
+ })(labels.value, canvasHeight);
5957
5993
  const {updateLabels: updateLabels, addDrawRect: addDrawRect, hitCanvasLabel: hitCanvasLabel} = (options => {
5958
5994
  const {ctx: ctx, labels: labels, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = options, updateLabels = () => {
5959
5995
  ctx.clearRect(0, 0, canvasWidth, canvasHeight), ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
@@ -5974,15 +6010,16 @@
5974
6010
  ctx.strokeStyle = color, ctx.strokeRect(startX, startY, rectWidth, rectHeight);
5975
6011
  },
5976
6012
  hitCanvasLabel: (x, y) => {
5977
- let hit_rect = null, hit_index = null;
6013
+ let hit_rect = null, hit_index = null, color = null;
5978
6014
  for (let i = 0; i < labels.length; i++) {
5979
- const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
6015
+ const rect = labels[i], {type: type, startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
5980
6016
  x >= startX && x <= startX + rectWidth && y >= startY && y <= startY + rectHeight && (hit_rect = rect,
5981
- hit_index = i);
6017
+ hit_index = i, color = colors[type]);
5982
6018
  }
5983
6019
  return {
5984
6020
  hit_rect: hit_rect,
5985
- hit_index: hit_index
6021
+ hit_index: hit_index,
6022
+ color: color
5986
6023
  };
5987
6024
  }
5988
6025
  };
@@ -5992,20 +6029,23 @@
5992
6029
  image: image,
5993
6030
  canvasWidth: canvasWidth,
5994
6031
  canvasHeight: canvasHeight,
5995
- labels: labels.value
6032
+ labels: labels.value,
6033
+ scaleFactor: scaleFactor
5996
6034
  });
5997
6035
  drawBaseCanvas.value.updateLabels = updateLabels, drawBaseCanvas.value.addDrawRect = addDrawRect,
5998
6036
  drawBaseCanvas.value.hitCanvasLabel = hitCanvasLabel;
5999
- const {clearCanvas: clearCanvas} = ((canvas, callback) => {
6037
+ const {clearCanvas: clearCanvas} = ((canvas, callback, keyW) => {
6000
6038
  const canvasWidth = canvas.width, canvasHeight = canvas.height, ctx = canvas?.getContext("2d"), clearCanvas = () => {
6001
6039
  ctx.clearRect(0, 0, canvasWidth, canvasHeight);
6002
6040
  };
6003
6041
  clearCanvas();
6004
6042
  let startX, startY, endX, endY, isDrawing = !1, isRectDraw = !1, isWKeyPressed = !1;
6005
6043
  document.addEventListener("keydown", (event => {
6006
- "w" === event.key && (isWKeyPressed = !0, canvas.style.cursor = "crosshair", canvas.style.zIndex = "11");
6044
+ "KeyW" === event.code && (isWKeyPressed = !0, canvas.style.cursor = "crosshair",
6045
+ canvas.style.zIndex = "11", keyW && keyW());
6007
6046
  })), document.addEventListener("keyup", (event => {
6008
- "w" === event.key && (isWKeyPressed = !1, canvas.style.cursor = "unset", canvas.style.zIndex = "0");
6047
+ isDrawing || "KeyW" === event.code && (isWKeyPressed = !1, canvas.style.cursor = "unset",
6048
+ canvas.style.zIndex = "0");
6009
6049
  })), canvas.addEventListener("mousedown", (e => {
6010
6050
  isWKeyPressed && (isDrawing = !0, startX = e.offsetX, startY = e.offsetY);
6011
6051
  })), canvas.addEventListener("mousemove", (e => {
@@ -6013,7 +6053,7 @@
6013
6053
  drawRect());
6014
6054
  })), canvas.addEventListener("mouseup", (() => {
6015
6055
  if (!isRectDraw) return;
6016
- isDrawing = !1, isWKeyPressed = !1;
6056
+ isDrawing = !1, isWKeyPressed = !1, canvas.style.cursor = "unset", canvas.style.zIndex = "0";
6017
6057
  const rectWidth = Math.abs(endX - startX), rectHeight = Math.abs(endY - startY);
6018
6058
  startX > endX && (startX = endX), startY > endY && (startY = endY), callback && callback({
6019
6059
  startX: startX,
@@ -6038,8 +6078,12 @@
6038
6078
  };
6039
6079
  })(canvasRectRef.value, ((rect, {endX: endX, endY: endY}) => {
6040
6080
  activate_add_label.value = rect, drawBaseCanvas.value.addDrawRect(rect), updateContextmenuLabelFixed(endX, endY, rect);
6081
+ }), (() => {
6082
+ onCloseDraggableRectFixed();
6041
6083
  }));
6042
6084
  drawBaseCanvas.value.clearCanvasRect = clearCanvas;
6085
+ }, image.onerror = () => {
6086
+ loadingImage.value = !1;
6043
6087
  };
6044
6088
  }
6045
6089
  canvasBaseRef.value.addEventListener("contextmenu", (e => {
@@ -6049,9 +6093,9 @@
6049
6093
  updateContextmenuLabelFixed(x, y, hit_rect);
6050
6094
  }));
6051
6095
  })), canvasBaseRef.value.addEventListener("click", (e => {
6052
- const x = e.offsetX, y = e.offsetY, {hit_rect: hit_rect, hit_index: hit_index} = drawBaseCanvas.value.hitCanvasLabel(x, y);
6096
+ const x = e.offsetX, y = e.offsetY, {hit_rect: hit_rect, hit_index: hit_index, color: color} = drawBaseCanvas.value.hitCanvasLabel(x, y);
6053
6097
  onCloseDraggableRectFixed(), onCloseContentmenuLabel(), hit_rect && vue.nextTick((() => {
6054
- updateDraggableRectFixed(x, y, hit_rect, hit_index);
6098
+ updateDraggableRectFixed(x, y, hit_rect, hit_index, color);
6055
6099
  }));
6056
6100
  }));
6057
6101
  };
@@ -6062,7 +6106,13 @@
6062
6106
  }), {
6063
6107
  deep: !0,
6064
6108
  immediate: !0
6065
- });
6109
+ }), vue.watch((() => props.contextClientHeight), (height => {
6110
+ if (valueExist(height)) {
6111
+ canvasMainRef.value.style.height = height + "px";
6112
+ const rowInfo = vue.toRaw(props.rowInfo);
6113
+ renderImageLabel(rowInfo);
6114
+ }
6115
+ }));
6066
6116
  }));
6067
6117
  const contextmenuLabelFixed = vue.ref({
6068
6118
  show: !1,
@@ -6092,21 +6142,23 @@
6092
6142
  width: 0,
6093
6143
  height: 0,
6094
6144
  activateRect: null,
6095
- activateIndex: null
6096
- }), updateDraggableRectFixed = (x, y, rect, index) => {
6145
+ activateIndex: null,
6146
+ color: null
6147
+ }), updateDraggableRectFixed = (x, y, rect, index, color) => {
6097
6148
  draggableRectFixed.value.show = !0, draggableRectFixed.value.top = y, draggableRectFixed.value.left = x,
6098
6149
  draggableRectFixed.value.width = rect.rectWidth, draggableRectFixed.value.height = rect.rectHeight,
6099
- draggableRectFixed.value.activateRect = rect, draggableRectFixed.value.activateIndex = index;
6150
+ draggableRectFixed.value.activateRect = rect, draggableRectFixed.value.activateIndex = index,
6151
+ draggableRectFixed.value.color = color;
6100
6152
  }, onCloseDraggableRectFixed = () => {
6101
6153
  draggableRectFixed.value.show = !1, draggableRectFixed.value.top = 0, draggableRectFixed.value.left = 0,
6102
6154
  draggableRectFixed.value.width = 0, draggableRectFixed.value.height = 0, draggableRectFixed.value.activateRect = null,
6103
- draggableRectFixed.value.activateIndex = null;
6155
+ draggableRectFixed.value.activateIndex = null, draggableRectFixed.value.color = null;
6104
6156
  }, onDraggleRectResize = rect => {
6105
6157
  draggableRectFixed.value.activateRect = rect, drawBaseCanvas.value.updateLabels();
6106
6158
  const i = labels.value.findIndex((o => isEqual(o, rect)));
6107
6159
  i > -1 && labels.value.splice(i, 1, rect);
6108
6160
  const {rects: rects, label_txt: label_txt} = formatLabelsType();
6109
- _emit("change", rects, label_txt);
6161
+ _emit("change", rects, label_txt), emit("change", rects, label_txt);
6110
6162
  }, onContextmenuDraggable = (e, rect) => {
6111
6163
  e.preventDefault();
6112
6164
  const rect_x = e.offsetX, rect_y = e.offsetY, x = rect_x + rect.startX, y = rect_y + rect.startY;
@@ -6121,39 +6173,116 @@
6121
6173
  i > -1 ? labels.value.splice(i, 1, activate_add_label.value) : labels.value.push(activate_add_label.value),
6122
6174
  onCloseContentmenuLabel();
6123
6175
  const {rects: rects, label_txt: label_txt} = formatLabelsType();
6124
- _emit("change", rects, label_txt);
6176
+ _emit("change", rects, label_txt), emit("change", rects, label_txt);
6125
6177
  }, onDeleteLabel = rect => {
6126
6178
  const i = labels.value.findIndex((o => isEqual(o, rect)));
6127
6179
  labels.value.splice(i, 1), onCloseContentmenuLabel(), onCloseDraggableRectFixed(),
6128
6180
  drawBaseCanvas.value.updateLabels();
6129
6181
  const {rects: rects, label_txt: label_txt} = formatLabelsType();
6130
- _emit("change", rects, label_txt);
6182
+ _emit("change", rects, label_txt), emit("change", rects, label_txt);
6131
6183
  };
6132
- return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
6133
- ref: canvasMainRef,
6134
- class: [ ns.b("canvas") ]
6135
- }, [ vue.createVNode("canvas", {
6136
- ref: canvasBaseRef,
6137
- class: [ ns.be("canvas", "context") ]
6138
- }, null), vue.createVNode("canvas", {
6139
- ref: canvasRectRef,
6140
- class: [ ns.be("canvas", "rect") ]
6141
- }, null), contextmenuLabelFixed.value.show ? vue.createVNode(ContextMenuLabel, {
6142
- labelRect: contextmenuLabelRect.value,
6143
- classes: props.classes,
6144
- activateRect: contextmenuLabelFixed.value.activateRect,
6145
- onClose: onCloseContentmenuLabel,
6146
- onSelect: onSelectLabel,
6147
- onDelete: onDeleteLabel
6148
- }, null) : null, draggableRectFixed.value.show ? vue.createVNode(DraggableRect, {
6149
- parentEl: canvasMainRef.value,
6150
- rect: draggableRectFixed.value.activateRect,
6151
- onDraggleResize: onDraggleRectResize,
6152
- onContextmenu: onContextmenuDraggable
6153
- }, null) : null ]) ]);
6184
+ expose({
6185
+ onCloseDraggableRectFixed: onCloseDraggableRectFixed,
6186
+ onCloseContentmenuLabel: onCloseContentmenuLabel,
6187
+ onSelectedLabel: (rect, index) => {
6188
+ onCloseDraggableRectFixed(), vue.nextTick((() => {
6189
+ const {startX: x, startY: y, type: type} = rect;
6190
+ updateDraggableRectFixed(x, y, rect, index, colors[type]);
6191
+ }));
6192
+ },
6193
+ onDeleteLabel: onDeleteLabel
6194
+ });
6195
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
6196
+ loading: loadingImage.value,
6197
+ class: [ ns.b("loading") ]
6198
+ }, {
6199
+ default: () => [ vue.createVNode("div", {
6200
+ ref: canvasMainRef,
6201
+ class: [ ns.b("canvas") ]
6202
+ }, [ vue.createVNode("canvas", {
6203
+ ref: canvasBaseRef,
6204
+ class: [ ns.be("canvas", "context") ]
6205
+ }, null), vue.createVNode("canvas", {
6206
+ ref: canvasRectRef,
6207
+ class: [ ns.be("canvas", "rect") ]
6208
+ }, null), contextmenuLabelFixed.value.show ? vue.createVNode(ContextMenuLabel, {
6209
+ labelRect: contextmenuLabelRect.value,
6210
+ classes: props.classes,
6211
+ activateRect: contextmenuLabelFixed.value.activateRect,
6212
+ onClose: onCloseContentmenuLabel,
6213
+ onSelect: onSelectLabel,
6214
+ onDelete: onDeleteLabel
6215
+ }, null) : null, draggableRectFixed.value.show ? vue.createVNode(DraggableRect, {
6216
+ parentEl: canvasMainRef.value,
6217
+ rect: draggableRectFixed.value.activateRect,
6218
+ color: draggableRectFixed.value.color,
6219
+ onDraggleResize: onDraggleRectResize,
6220
+ onContextmenu: onContextmenuDraggable
6221
+ }, null) : null ]) ]
6222
+ }) ]);
6154
6223
  }
6155
- });
6156
- const ns = useNamespace("labelimg");
6224
+ }), RightLabel = vue.defineComponent({
6225
+ props: {
6226
+ classes: {
6227
+ type: Array,
6228
+ default: () => []
6229
+ },
6230
+ labels: {
6231
+ type: Array,
6232
+ default: () => []
6233
+ }
6234
+ },
6235
+ emits: [ "delete", "select" ],
6236
+ setup(props, {emit: emit}) {
6237
+ const {t: t} = useLocale(), ns = vue.inject("ns", {}), labels = vue.ref([]);
6238
+ vue.watch((() => props.labels), (rects => {
6239
+ const _rects = vue.toRaw(rects);
6240
+ labels.value = (labels => labels.length ? labels.map((rect => {
6241
+ const typeName = props.classes[rect.type];
6242
+ return typeName && (rect.typeName = typeName), rect;
6243
+ })) : [])(_rects);
6244
+ }), {
6245
+ deep: !0,
6246
+ immediate: !0
6247
+ });
6248
+ const renderContent = () => vue.createVNode("div", {
6249
+ class: [ ns.b("right") ]
6250
+ }, [ labels.value.length ? vue.createVNode("ul", null, [ labels.value.map(((rect, index) => vue.createVNode("li", {
6251
+ key: index,
6252
+ onClick: () => ((rect, index) => {
6253
+ emit("select", rect, index);
6254
+ })(rect, index)
6255
+ }, [ vue.createVNode("div", null, [ vue.createVNode("span", {
6256
+ style: {
6257
+ "background-color": colors[rect.type]
6258
+ },
6259
+ class: "label-line"
6260
+ }, null), vue.createVNode("span", null, [ rect.typeName ]) ]), vue.createVNode(elementPlus.ElPopconfirm, {
6261
+ title: t("next.labelimg.confirmDeleteLabel"),
6262
+ width: 180,
6263
+ onConfirm: () => (rect => {
6264
+ emit("delete", rect);
6265
+ })(rect)
6266
+ }, {
6267
+ reference: () => vue.createVNode(elementPlus.ElIcon, {
6268
+ size: 16,
6269
+ color: "#ff0000",
6270
+ onClick: event => {
6271
+ event.preventDefault(), event.stopPropagation();
6272
+ }
6273
+ }, {
6274
+ default: () => [ vue.createVNode(delete_default, null, null) ]
6275
+ })
6276
+ }) ]))) ]) : vue.createVNode(elementPlus.ElEmpty, {
6277
+ "image-size": 120,
6278
+ description: t("next.labelimg.emptyLabelText")
6279
+ }, null) ]);
6280
+ return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
6281
+ }
6282
+ }), defaultConfig = {
6283
+ mainContentHeight: 600
6284
+ };
6285
+ const ns$1 = useNamespace("labelimg");
6157
6286
  var Element = vue.defineComponent({
6158
6287
  name: "NextLabelimg",
6159
6288
  props: {
@@ -6163,25 +6292,58 @@
6163
6292
  },
6164
6293
  style: {
6165
6294
  type: Object,
6166
- default: () => ({})
6295
+ default: () => ({
6296
+ position: "unset"
6297
+ })
6298
+ },
6299
+ rowKey: {
6300
+ type: String,
6301
+ default: "id"
6167
6302
  },
6168
6303
  options: {
6169
6304
  type: Object,
6170
- default: () => ({
6171
- classes: [],
6172
- list: []
6173
- })
6305
+ default: () => ({})
6306
+ },
6307
+ classes: {
6308
+ type: Array,
6309
+ default: () => []
6310
+ },
6311
+ data: {
6312
+ type: Array,
6313
+ default: () => []
6174
6314
  }
6175
6315
  },
6176
6316
  emits: [ "change", "save", "prev-click", "next-click" ],
6177
6317
  setup(props, {emit: emit, slots: slots, expose: expose}) {
6178
- const {t: t} = useLocale();
6179
- vue.provide("ns", ns), vue.provide("_emit", emit);
6180
- const {classes: classes, list: list} = props.options, activateNodeIndex = vue.ref(0), currentNode = vue.computed((() => {
6181
- if (!list) return {};
6182
- return list[activateNodeIndex.value] || {};
6183
- })), imageLength = list.length, loading = vue.ref(!1), formatNodeLabels = () => {
6184
- const node = deepClone(currentNode.value);
6318
+ const {t: t} = useLocale(), _config = deepClone(defaultConfig), _options = vue.computed((() => {
6319
+ const cfg = vue.unref(props.options);
6320
+ return merge$1(_config, cfg);
6321
+ })), options = vue.unref(_options);
6322
+ vue.provide("ns", ns$1), vue.provide("_emit", emit);
6323
+ const activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes), labelImages = vue.ref(deepClone(props.data));
6324
+ vue.watch((() => props.data), (data => {
6325
+ labelImages.value = deepClone(data);
6326
+ }), {
6327
+ deep: !0
6328
+ }), vue.watch((() => props.data.length), (() => {
6329
+ activateNodeIndex.value = 0;
6330
+ })), vue.watch((() => props.classes), (val => {
6331
+ classes.value = val;
6332
+ }), {
6333
+ deep: !0
6334
+ });
6335
+ const currentNode = vue.computed((() => {
6336
+ if (!labelImages.value) return {};
6337
+ const node = labelImages.value[activateNodeIndex.value] || {};
6338
+ return deepClone(node);
6339
+ })), activateNodeLabels = vue.ref(currentNode.value.labels || []);
6340
+ vue.watch((() => currentNode.value), (() => {
6341
+ activateNodeLabels.value = currentNode.value.labels || [];
6342
+ }));
6343
+ const onChangeNodeRect = rects => {
6344
+ currentNode.value.labels = rects, activateNodeLabels.value = rects;
6345
+ }, loading = vue.ref(!1), formatNodeLabels = () => {
6346
+ const node = currentNode.value;
6185
6347
  let yolo_label = [];
6186
6348
  return node.labels.forEach((rect => {
6187
6349
  delete rect.typeName;
@@ -6191,89 +6353,123 @@
6191
6353
  node: node,
6192
6354
  label_txt: yolo_label.join("\n")
6193
6355
  };
6356
+ }, isChangeNodeLabels = () => isEqual(labelImages.value[activateNodeIndex.value].labels, currentNode.value.labels), switchKeydownAD = e => {
6357
+ const imageLength = labelImages.value.length;
6358
+ "KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
6359
+ activateNodeIndex.value < 0 && (activateNodeIndex.value = imageLength - 1));
6194
6360
  }, onKeydownPrevNext = e => {
6195
6361
  if (loading.value) return;
6196
6362
  if (![ "KeyA", "KeyD" ].includes(e.code)) return;
6197
6363
  loading.value = !0;
6198
6364
  const {node: node, label_txt: label_txt} = formatNodeLabels();
6365
+ if (canvasContextRef.value.onCloseDraggableRectFixed(), isChangeNodeLabels()) return switchKeydownAD(e),
6366
+ void (loading.value = !1);
6199
6367
  emit("save", {
6200
6368
  node: node,
6201
6369
  label_txt: label_txt
6202
- }, (() => {
6203
- "KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
6204
- activateNodeIndex.value < 0 && (activateNodeIndex.value = imageLength - 1)), loading.value = !1;
6370
+ }, (imageItem => {
6371
+ labelImages.value[activateNodeIndex.value] = imageItem || node, switchKeydownAD(e),
6372
+ loading.value = !1;
6373
+ }), (() => {
6374
+ loading.value = !1;
6375
+ }));
6376
+ }, onChangeActivateNode = index => {
6377
+ if (loading.value) return;
6378
+ loading.value = !0;
6379
+ const {node: node, label_txt: label_txt} = formatNodeLabels();
6380
+ if (canvasContextRef.value.onCloseDraggableRectFixed(), isChangeNodeLabels()) return activateNodeIndex.value = index,
6381
+ void (loading.value = !1);
6382
+ emit("save", {
6383
+ node: node,
6384
+ label_txt: label_txt
6385
+ }, (imageItem => {
6386
+ labelImages.value[activateNodeIndex.value] = imageItem || node, activateNodeIndex.value = index,
6387
+ loading.value = !1;
6205
6388
  }), (() => {
6206
6389
  loading.value = !1;
6207
6390
  }));
6208
6391
  }, onPaginationPrev = () => {
6209
- emit("prev-click");
6392
+ const imageLength = labelImages.value.length;
6393
+ let i = activateNodeIndex.value - 1;
6394
+ i < 0 && (i = imageLength - 1), onChangeActivateNode(i), emit("prev-click");
6210
6395
  }, onPaginationNext = () => {
6211
- emit("next-click");
6212
- }, layoutRef = vue.ref(), headerRef = vue.ref(), mainRef = vue.ref(), footerRef = vue.ref(), mainContentHeight = vue.ref(500);
6396
+ const imageLength = labelImages.value.length;
6397
+ let i = activateNodeIndex.value + 1;
6398
+ i >= imageLength && (i = 0), onChangeActivateNode(i), emit("next-click");
6399
+ }, canvasContextRef = vue.ref(), layoutLabelRef = vue.ref(), headerRef = vue.ref(), mainRef = vue.ref(), footerRef = vue.ref(), mainContentHeight = vue.ref(options.mainContentHeight);
6213
6400
  vue.onMounted((() => {
6214
- document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutRef.value, (() => {
6401
+ document.addEventListener("keydown", onKeydownPrevNext), elementResize(layoutLabelRef.value, (() => {
6215
6402
  vue.nextTick((() => {
6216
- const contentHeight = (layoutRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
6403
+ layoutLabelRef.value.style.position = "unset";
6404
+ const contentHeight = (layoutLabelRef.value?.clientHeight || 0) - ((headerRef.value?.clientHeight || 0) + (footerRef.value?.clientHeight || 0));
6217
6405
  mainContentHeight.value = contentHeight;
6218
6406
  }));
6219
6407
  }));
6220
6408
  })), vue.onUnmounted((() => {
6221
6409
  document.removeEventListener("keydown", onKeydownPrevNext);
6222
- })), expose({
6410
+ }));
6411
+ const onSelectLabelNode = (rect, index) => {
6412
+ canvasContextRef.value.onSelectedLabel(rect, index);
6413
+ }, onDeleteLabelNode = rect => {
6414
+ canvasContextRef.value.onDeleteLabel(rect);
6415
+ };
6416
+ expose({
6223
6417
  convertToLabel: convertToLabel,
6224
6418
  canvertToCanvas: canvertToCanvas
6225
6419
  });
6226
- const renderContent = () => vue.createVNode("div", {
6227
- ref: layoutRef,
6228
- class: [ ns.b(), props.className ],
6420
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
6421
+ ref: layoutLabelRef,
6422
+ class: [ ns$1.b(), props.className ],
6229
6423
  style: {
6230
6424
  ...props.style
6231
6425
  }
6232
6426
  }, [ vue.createVNode(NextSpinLoading$1, {
6233
6427
  loading: loading.value,
6234
6428
  tip: t("next.labelimg.saveTxt"),
6235
- class: [ ns.b("loading") ]
6429
+ class: [ ns$1.b("loading") ]
6236
6430
  }, {
6237
6431
  default: () => [ vue.createVNode(elementPlus.ElScrollbar, null, {
6238
6432
  default: () => [ vue.createVNode("header", {
6239
6433
  ref: headerRef,
6240
- class: [ ns.b("header") ]
6434
+ class: [ ns$1.b("header") ]
6241
6435
  }, [ slots.header ? slots.header() : vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", null, null), vue.createVNode("ul", null, null) ]) ]), vue.createVNode("div", {
6242
6436
  ref: mainRef,
6243
- class: [ ns.b("main") ]
6437
+ class: [ ns$1.b("main") ],
6438
+ style: {
6439
+ height: mainContentHeight.value + "px"
6440
+ }
6441
+ }, [ vue.createVNode("div", {
6442
+ class: [ ns$1.be("main", "content") ]
6244
6443
  }, [ vue.createVNode(CanvasContext, {
6245
- classes: classes,
6246
- rowInfo: currentNode.value
6444
+ ref: canvasContextRef,
6445
+ contextClientHeight: mainContentHeight.value,
6446
+ classes: classes.value,
6447
+ rowInfo: currentNode.value,
6448
+ onChange: onChangeNodeRect
6449
+ }, null) ]), vue.createVNode(RightLabel, {
6450
+ classes: classes.value,
6451
+ labels: activateNodeLabels.value,
6452
+ onDelete: onDeleteLabelNode,
6453
+ onSelect: onSelectLabelNode
6247
6454
  }, null) ]), vue.createVNode("footer", {
6248
6455
  ref: footerRef,
6249
- class: [ ns.b("footer") ]
6456
+ class: [ ns$1.b("footer") ]
6250
6457
  }, [ vue.createVNode("div", {
6251
- class: [ ns.be("footer", "left") ]
6458
+ class: [ ns$1.be("footer", "left") ]
6252
6459
  }, [ vue.createVNode(elementPlus.ElIcon, {
6253
6460
  size: 24,
6461
+ color: "#797979",
6254
6462
  onClick: onPaginationPrev
6255
6463
  }, {
6256
6464
  default: () => [ vue.createVNode(arrow_left_default, null, null) ]
6257
6465
  }) ]), vue.createVNode("div", {
6258
- class: [ ns.be("footer", "center") ]
6466
+ class: [ ns$1.be("footer", "center") ]
6259
6467
  }, [ vue.createVNode(elementPlus.ElScrollbar, null, {
6260
6468
  default: () => [ vue.createVNode("ul", {
6261
- class: [ ns.bem("footer", "center", "list") ]
6262
- }, [ list.map(((item, index) => vue.createVNode("li", {
6469
+ class: [ ns$1.bem("footer", "center", "list") ]
6470
+ }, [ labelImages.value.map(((item, index) => vue.createVNode("li", {
6263
6471
  key: index,
6264
- onClick: () => (index => {
6265
- if (loading.value) return;
6266
- loading.value = !0;
6267
- const {node: node, label_txt: label_txt} = formatNodeLabels();
6268
- emit("save", {
6269
- node: node,
6270
- label_txt: label_txt
6271
- }, (() => {
6272
- activateNodeIndex.value = index, loading.value = !1;
6273
- }), (() => {
6274
- loading.value = !1;
6275
- }));
6276
- })(index),
6472
+ onClick: () => onChangeActivateNode(index),
6277
6473
  class: {
6278
6474
  "is-activate": activateNodeIndex.value === index
6279
6475
  }
@@ -6286,19 +6482,87 @@
6286
6482
  fit: "cover"
6287
6483
  }, null) ]))) ]) ]
6288
6484
  }) ]), vue.createVNode("div", {
6289
- class: [ ns.be("footer", "right") ]
6485
+ class: [ ns$1.be("footer", "right") ]
6290
6486
  }, [ vue.createVNode(elementPlus.ElIcon, {
6291
6487
  size: 24,
6488
+ color: "#797979",
6292
6489
  onClick: onPaginationNext
6293
6490
  }, {
6294
6491
  default: () => [ vue.createVNode(arrow_right_default, null, null) ]
6295
6492
  }) ]) ]) ]
6296
6493
  }) ]
6297
- }) ]);
6298
- return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
6494
+ }) ]) ]);
6495
+ }
6496
+ });
6497
+ const ns = useNamespace("labelimg-preview");
6498
+ var preview = vue.defineComponent({
6499
+ name: "NextLabelimgPreview",
6500
+ props: {
6501
+ className: {
6502
+ type: String,
6503
+ default: ""
6504
+ },
6505
+ style: {
6506
+ type: Object,
6507
+ default: () => ({})
6508
+ },
6509
+ src: {
6510
+ type: String,
6511
+ default: ""
6512
+ },
6513
+ classes: {
6514
+ type: Array,
6515
+ default: () => []
6516
+ },
6517
+ labels: {
6518
+ type: Array,
6519
+ default: () => []
6520
+ }
6521
+ },
6522
+ setup(props) {
6523
+ const canvasBaseRef = vue.ref(), classes = vue.ref(deepClone(props.classes)), labels = vue.ref(deepClone(props.labels)), renderImageAndLabel = () => {
6524
+ if (props.src) {
6525
+ const ctx = canvasBaseRef.value?.getContext("2d"), image = new Image;
6526
+ image.src = props.src, image.onload = () => {
6527
+ const {width: width, height: height} = image, canvasHeight = height, scaleFactor = canvasHeight / height, canvasWidth = Math.ceil(width * scaleFactor);
6528
+ ((canvasWidth, canvasHeight) => {
6529
+ canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
6530
+ canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
6531
+ })(canvasWidth, canvasHeight), ctx.clearRect(0, 0, canvasWidth, canvasHeight), ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
6532
+ for (let i = 0; i < labels.value.length; i++) {
6533
+ const rect = labels.value[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors[type % colors.length];
6534
+ if (ctx.font = "bold 14px serif", ctx.textBaseline = "top", ctx.save(), ctx.strokeStyle = color,
6535
+ ctx.strokeRect(startX, startY, rectWidth, rectHeight), !isValueExist(rect.typeName)) {
6536
+ const typeName = classes.value[rect.type];
6537
+ typeName && (rect.typeName = typeName);
6538
+ }
6539
+ if (isValueExist(rect.typeName) || isValueExist(rect.type)) {
6540
+ const text = rect.typeName || rect.type;
6541
+ ctx.fillStyle = color, ctx.fillText(text, startX + 6, startY + 6);
6542
+ }
6543
+ ctx.restore();
6544
+ }
6545
+ };
6546
+ }
6547
+ };
6548
+ vue.onMounted((() => {
6549
+ vue.watch((() => props.src), (() => {
6550
+ renderImageAndLabel();
6551
+ }), {
6552
+ immediate: !0
6553
+ });
6554
+ }));
6555
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
6556
+ class: [ ns.b(), props.className ],
6557
+ style: {
6558
+ ...props.style
6559
+ }
6560
+ }, [ vue.createVNode("canvas", {
6561
+ ref: canvasBaseRef
6562
+ }, null) ]) ]);
6299
6563
  }
6300
6564
  });
6301
- const NextLabelimg = withInstall(Element);
6565
+ const NextLabelimg = withInstall(Element), NextLabelimgPreview = withInstall(preview);
6302
6566
  var components = Object.freeze({
6303
6567
  __proto__: null,
6304
6568
  NextContainer: NextContainer,
@@ -6308,6 +6572,7 @@
6308
6572
  NextDragResize: NextDragResize,
6309
6573
  NextForm: NextForm,
6310
6574
  NextLabelimg: NextLabelimg,
6575
+ NextLabelimgPreview: NextLabelimgPreview,
6311
6576
  NextLayout: NextLayout,
6312
6577
  NextMenu: NextMenu,
6313
6578
  NextSpinLoading: NextSpinLoading,
@@ -6358,19 +6623,19 @@
6358
6623
  })(app);
6359
6624
  };
6360
6625
  var index = {
6361
- version: "0.2.8",
6626
+ version: "0.2.9",
6362
6627
  install: install
6363
6628
  };
6364
6629
  exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
6365
6630
  exports.NextDialog = NextDialog, exports.NextDragResize = NextDragResize, exports.NextForm = NextForm,
6366
- exports.NextLabelimg = NextLabelimg, exports.NextLayout = NextLayout, exports.NextMenu = NextMenu,
6367
- exports.NextSpinLoading = NextSpinLoading, exports.NextTabs = NextTabs, exports.NextTextEllipsis = NextTextEllipsis,
6368
- exports.NextTreeSelect = NextTreeSelect, exports.NextUpload = NextUpload, exports.NextVideoPlayer = NextVideoPlayer,
6369
- exports.buildLocaleContext = buildLocaleContext, exports.buildTranslator = buildTranslator,
6370
- exports.default = index, exports.defaultNamespace = "next", exports.install = install,
6371
- exports.localeContextKey = localeContextKey, exports.localeLang = localeLang, exports.namespaceContextKey = namespaceContextKey,
6372
- exports.nextUseCssTheme = nextUseCssTheme, exports.nextUseCssVar = nextUseCssVar,
6373
- exports.translate = translate, exports.updateThemeColor = color => {
6631
+ exports.NextLabelimg = NextLabelimg, exports.NextLabelimgPreview = NextLabelimgPreview,
6632
+ exports.NextLayout = NextLayout, exports.NextMenu = NextMenu, exports.NextSpinLoading = NextSpinLoading,
6633
+ exports.NextTabs = NextTabs, exports.NextTextEllipsis = NextTextEllipsis, exports.NextTreeSelect = NextTreeSelect,
6634
+ exports.NextUpload = NextUpload, exports.NextVideoPlayer = NextVideoPlayer, exports.buildLocaleContext = buildLocaleContext,
6635
+ exports.buildTranslator = buildTranslator, exports.default = index, exports.defaultNamespace = "next",
6636
+ exports.install = install, exports.localeContextKey = localeContextKey, exports.localeLang = localeLang,
6637
+ exports.namespaceContextKey = namespaceContextKey, exports.nextUseCssTheme = nextUseCssTheme,
6638
+ exports.nextUseCssVar = nextUseCssVar, exports.translate = translate, exports.updateThemeColor = color => {
6374
6639
  color && nextUseCssTheme("--el-color-primary", color);
6375
6640
  }, exports.updateThemeColorCssVar = updateThemeColorCssVar, exports.useDetectVideo = () => ({
6376
6641
  detectVideoFrameImage: ({container: container, video: video, modelUrl: modelUrl, classNames: classNames, classInput: classInput = []}, success, error) => modelUrl ? classNames ? void tf__namespace.loadGraphModel(modelUrl).then((model => {
@@ -6404,7 +6669,7 @@
6404
6669
  }), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
6405
6670
  const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
6406
6671
  localeRef.value.name = lang, localeRef.value.next = nextLang.next;
6407
- }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.2.8",
6672
+ }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.2.9",
6408
6673
  Object.defineProperty(exports, "__esModule", {
6409
6674
  value: !0
6410
6675
  });