next-element-vue 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -2,8 +2,8 @@
2
2
  /**
3
3
  * 作  者:huangteng
4
4
  * 邮  箱:htengweb@163.com
5
- * 当前版本:0.3.2 v
6
- * 发布日期:2024-06-27
5
+ * 当前版本:0.3.3 v
6
+ * 发布日期:2024-07-23
7
7
  * 地  址:https://www.npmjs.com/package/next-element-vue
8
8
  */
9
9
 
@@ -491,8 +491,8 @@
491
491
  }(result, symbolsFunc(object));
492
492
  }(object, keys, getSymbols$1);
493
493
  }
494
- var DataView = getNative(root, "DataView"), Promise$1 = getNative(root, "Promise"), Set = getNative(root, "Set"), dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap), getTag = baseGetTag;
495
- (DataView && "[object DataView]" != getTag(new DataView(new ArrayBuffer(1))) || Map$1 && "[object Map]" != getTag(new Map$1) || Promise$1 && "[object Promise]" != getTag(Promise$1.resolve()) || Set && "[object Set]" != getTag(new Set) || WeakMap && "[object WeakMap]" != getTag(new WeakMap)) && (getTag = function(value) {
494
+ var DataView = getNative(root, "DataView"), Promise$1 = getNative(root, "Promise"), Set$1 = getNative(root, "Set"), dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap), getTag = baseGetTag;
495
+ (DataView && "[object DataView]" != getTag(new DataView(new ArrayBuffer(1))) || Map$1 && "[object Map]" != getTag(new Map$1) || Promise$1 && "[object Promise]" != getTag(Promise$1.resolve()) || Set$1 && "[object Set]" != getTag(new Set$1) || WeakMap && "[object WeakMap]" != getTag(new WeakMap)) && (getTag = function(value) {
496
496
  var result = baseGetTag(value), Ctor = "[object Object]" == result ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
497
497
  if (ctorString) switch (ctorString) {
498
498
  case dataViewCtorString:
@@ -988,6 +988,14 @@
988
988
  for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
989
989
  return hexs;
990
990
  },
991
+ hexToRgba: (str, alpha = 1) => {
992
+ let hexs = "";
993
+ if (!/^\#?[0-9A-Fa-f]{6}$/.test(str)) return elementPlus.ElMessage.warning("输入错误的hex"),
994
+ "";
995
+ hexs = (str = str.replace("#", "")).match(/../g);
996
+ for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
997
+ return `rgba(${hexs.join(",")},${alpha})`;
998
+ },
991
999
  rgbToHex: (r, g, b) => {
992
1000
  let reg = /^\d{1,3}$/;
993
1001
  if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return elementPlus.ElMessage.warning("输入错误的rgb颜色值"),
@@ -1082,7 +1090,7 @@
1082
1090
  }, extra) for (const [key, comp] of Object.entries(extra)) main[key] = comp;
1083
1091
  return main;
1084
1092
  }, slots_config_headerMenu = "header-menu", slots_config_headerToolsPrefix = "header-tools-prefix", slots_config_headerToolsSuffix = "header-tools-suffix";
1085
- var defaultConfig$4 = {
1093
+ var defaultConfig$5 = {
1086
1094
  logo: "",
1087
1095
  title: "Next Element Vue",
1088
1096
  userName: "Admin",
@@ -1129,7 +1137,7 @@
1129
1137
  isDark: !1
1130
1138
  }
1131
1139
  };
1132
- const ns$k = useNamespace("text-ellipsis");
1140
+ const ns$l = useNamespace("text-ellipsis");
1133
1141
  const NextTextEllipsis = withInstall(vue.defineComponent({
1134
1142
  name: "NextTextEllipsis",
1135
1143
  props: {
@@ -1175,7 +1183,7 @@
1175
1183
  }
1176
1184
  };
1177
1185
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
1178
- class: [ ns$k.b(), props.class ],
1186
+ class: [ ns$l.b(), props.class ],
1179
1187
  style: setWidth.value,
1180
1188
  onMouseenter: onMouseenter
1181
1189
  }, [ isTip.value ? vue.createVNode(elementPlus.ElTooltip, {
@@ -1185,11 +1193,11 @@
1185
1193
  disabled: props.disabled
1186
1194
  }, {
1187
1195
  default: () => [ vue.createVNode("span", {
1188
- class: ns$k.e("text"),
1196
+ class: ns$l.e("text"),
1189
1197
  ref: ellipsisRef
1190
1198
  }, [ slots.default ? slots.default() : props.content ]) ]
1191
1199
  }) : vue.createVNode("span", {
1192
- class: ns$k.e("text"),
1200
+ class: ns$l.e("text"),
1193
1201
  ref: ellipsisRef
1194
1202
  }, [ slots.default ? slots.default() : props.content ]) ]) ]);
1195
1203
  }
@@ -2524,7 +2532,7 @@
2524
2532
  }, null) ]
2525
2533
  }))) ]) ]);
2526
2534
  }
2527
- }), ns$j = useNamespace("menu");
2535
+ }), ns$k = useNamespace("menu");
2528
2536
  const NextMenu = withInstall(vue.defineComponent({
2529
2537
  name: "NextMenu",
2530
2538
  props: {
@@ -2551,13 +2559,13 @@
2551
2559
  }
2552
2560
  },
2553
2561
  setup(props) {
2554
- vue.provide("ns", ns$j);
2562
+ vue.provide("ns", ns$k);
2555
2563
  const router = vue.getCurrentInstance().appContext.config.globalProperties.$router, currentPath = router.currentRoute?.value.fullPath, activePath = vue.ref(currentPath);
2556
2564
  vue.watch((() => router.currentRoute?.value), (to => {
2557
2565
  activePath.value = to.fullPath;
2558
2566
  }));
2559
2567
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(elementPlus.ElMenu, {
2560
- class: [ ns$j.b(), props.className ],
2568
+ class: [ ns$k.b(), props.className ],
2561
2569
  style: props.style,
2562
2570
  defaultActive: activePath.value,
2563
2571
  router: props.router,
@@ -2565,7 +2573,7 @@
2565
2573
  ellipsis: !0
2566
2574
  }, {
2567
2575
  default: () => [ vue.createVNode(vue.Fragment, null, [ props.menuTree.map((item => item.children?.length ? valueExist(item.meta?.isHide, !1) ? null : vue.createVNode(elementPlus.ElSubMenu, {
2568
- "popper-class": ns$j.b("popper"),
2576
+ "popper-class": ns$k.b("popper"),
2569
2577
  index: item.path || item.id,
2570
2578
  teleported: !0
2571
2579
  }, {
@@ -2576,7 +2584,7 @@
2576
2584
  menuData: item.children
2577
2585
  }, null)
2578
2586
  }) : valueExist(item.meta?.isHide, !1) ? null : vue.createVNode(elementPlus.ElMenuItem, {
2579
- "popper-class": ns$j.b("popper"),
2587
+ "popper-class": ns$k.b("popper"),
2580
2588
  index: item.path
2581
2589
  }, {
2582
2590
  default: () => [ vue.createVNode(MenuItemTitle, {
@@ -2602,19 +2610,19 @@
2602
2610
  }) ]);
2603
2611
  }
2604
2612
  });
2605
- const ns$i = useNamespace("layout-defaults");
2613
+ const ns$j = useNamespace("layout-defaults");
2606
2614
  var defaults = vue.defineComponent({
2607
2615
  props: {},
2608
- setup: () => (vue.provide("ns", ns$i), {}),
2616
+ setup: () => (vue.provide("ns", ns$j), {}),
2609
2617
  render() {
2610
2618
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {});
2611
2619
  slots.menu;
2612
2620
  const isTabs = vue.ref(!!slots.tabs);
2613
2621
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(elementPlus.ElContainer, {
2614
- class: ns$i.b()
2622
+ class: ns$j.b()
2615
2623
  }, {
2616
2624
  default: () => [ vue.createVNode(Sidebar$2, null, null), vue.createVNode("div", {
2617
- class: [ ns$i.b("content") ]
2625
+ class: [ ns$j.b("content") ]
2618
2626
  }, [ vue.createVNode(Header$3, null, null), _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
2619
2627
  tabs: _config.tabs,
2620
2628
  activeTab: _config.activeTab,
@@ -2622,7 +2630,7 @@
2622
2630
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2623
2631
  onClose: (...arg) => _emit("tabsClose", ...arg)
2624
2632
  }, null) : null, vue.createVNode("main", {
2625
- class: [ ns$i.bf("main"), ns$i.is("layout-tabs", isTabs.value) ]
2633
+ class: [ ns$j.bf("main"), ns$j.is("layout-tabs", isTabs.value) ]
2626
2634
  }, [ slots.default?.() ]) ]) ]
2627
2635
  });
2628
2636
  }
@@ -2652,10 +2660,10 @@
2652
2660
  }) ]) ]) ]);
2653
2661
  }
2654
2662
  });
2655
- const ns$h = useNamespace("layout-transverse");
2663
+ const ns$i = useNamespace("layout-transverse");
2656
2664
  var transverse = vue.defineComponent({
2657
2665
  props: {},
2658
- setup: () => (vue.provide("ns", ns$h), {}),
2666
+ setup: () => (vue.provide("ns", ns$i), {}),
2659
2667
  render() {
2660
2668
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {}), __slots_header = {};
2661
2669
  slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
@@ -2672,7 +2680,7 @@
2672
2680
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2673
2681
  onClose: (...arg) => _emit("tabsClose", ...arg)
2674
2682
  }, null) : null, vue.createVNode("main", {
2675
- class: [ ns$h.b("main"), ns$h.is("layout-tabs", isTabs.value) ]
2683
+ class: [ ns$i.b("main"), ns$i.is("layout-tabs", isTabs.value) ]
2676
2684
  }, [ slots.default?.() ]) ]);
2677
2685
  var s;
2678
2686
  }
@@ -2711,10 +2719,10 @@
2711
2719
  }, null) ]);
2712
2720
  }
2713
2721
  });
2714
- const ns$g = useNamespace("layout-columns");
2722
+ const ns$h = useNamespace("layout-columns");
2715
2723
  var columns = vue.defineComponent({
2716
2724
  props: {},
2717
- setup: () => (vue.provide("ns", ns$g), {}),
2725
+ setup: () => (vue.provide("ns", ns$h), {}),
2718
2726
  render() {
2719
2727
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {}), __slots_header = {};
2720
2728
  slots[slots_config_headerMenu] && (__slots_header[slots_config_headerMenu] = () => slots[slots_config_headerMenu]()),
@@ -2722,11 +2730,11 @@
2722
2730
  slots[slots_config_headerToolsSuffix] && (__slots_header[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2723
2731
  const isTabs = vue.ref(!!slots.tabs);
2724
2732
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(elementPlus.ElContainer, {
2725
- class: ns$g.b()
2733
+ class: ns$h.b()
2726
2734
  }, {
2727
2735
  default: () => {
2728
2736
  return [ vue.createVNode(Sidebar$1, null, null), vue.createVNode("div", {
2729
- class: [ ns$g.b("content") ]
2737
+ class: [ ns$h.b("content") ]
2730
2738
  }, [ vue.createVNode(Header$1, null, (s = __slots_header, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header : {
2731
2739
  default: () => [ __slots_header ]
2732
2740
  })), _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
@@ -2736,7 +2744,7 @@
2736
2744
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2737
2745
  onClose: (...arg) => _emit("tabsClose", ...arg)
2738
2746
  }, null) : null, vue.createVNode("main", {
2739
- class: [ ns$g.bf("main"), ns$g.is("layout-tabs", isTabs.value) ]
2747
+ class: [ ns$h.bf("main"), ns$h.is("layout-tabs", isTabs.value) ]
2740
2748
  }, [ slots.default?.() ]) ]) ];
2741
2749
  var s;
2742
2750
  }
@@ -2779,20 +2787,20 @@
2779
2787
  }) ]);
2780
2788
  }
2781
2789
  });
2782
- const ns$f = useNamespace("layout-classic");
2790
+ const ns$g = useNamespace("layout-classic");
2783
2791
  var classic = vue.defineComponent({
2784
2792
  props: {},
2785
- setup: () => (vue.provide("ns", ns$f), {
2786
- ns: ns$f
2793
+ setup: () => (vue.provide("ns", ns$g), {
2794
+ ns: ns$g
2787
2795
  }),
2788
2796
  render() {
2789
2797
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {});
2790
2798
  slots.menu;
2791
2799
  const isTabs = vue.ref(!!slots.tabs);
2792
2800
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(vue.Fragment, null, [ vue.createVNode(Header, null, null), vue.createVNode("div", {
2793
- class: [ ns$f.b("content"), ns$f.is("layout-tabs", isTabs.value) ]
2801
+ class: [ ns$g.b("content"), ns$g.is("layout-tabs", isTabs.value) ]
2794
2802
  }, [ vue.createVNode(Sidebar, null, null), vue.createVNode("div", {
2795
- class: ns$f.b("container")
2803
+ class: ns$g.b("container")
2796
2804
  }, [ _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
2797
2805
  tabs: _config.tabs,
2798
2806
  activeTab: _config.activeTab,
@@ -2800,11 +2808,11 @@
2800
2808
  onSelect: (...arg) => _emit("tabsSelect", ...arg),
2801
2809
  onClose: (...arg) => _emit("tabsClose", ...arg)
2802
2810
  }, null) : null, vue.createVNode("main", {
2803
- class: [ ns$f.b("main") ]
2811
+ class: [ ns$g.b("main") ]
2804
2812
  }, [ slots.default?.() ]) ]) ]) ]);
2805
2813
  }
2806
2814
  });
2807
- const ns$e = useNamespace("layout"), layouts = {
2815
+ const ns$f = useNamespace("layout"), layouts = {
2808
2816
  defaults: vue.markRaw(defaults),
2809
2817
  transverse: vue.markRaw(transverse),
2810
2818
  columns: vue.markRaw(columns),
@@ -2830,8 +2838,8 @@
2830
2838
  },
2831
2839
  emits: [ "changeLanguage", "changeUserDropdown", "changeOptions", "tabsChange", "tabsSelect", "tabsClose" ],
2832
2840
  setup(props, {slots: slots, emit: emit}) {
2833
- const _config = vue.ref(mergeWith(defaultConfig$4, props.options, customizerCoverArray));
2834
- vue.provide("options", _config.value), vue.provide("__ns__", ns$e), vue.provide("__emit__", emit),
2841
+ const _config = vue.ref(mergeWith(defaultConfig$5, props.options, customizerCoverArray));
2842
+ vue.provide("options", _config.value), vue.provide("__ns__", ns$f), vue.provide("__emit__", emit),
2835
2843
  vue.provide("__slots__", slots);
2836
2844
  const updateOptions = cfg => {
2837
2845
  _config.value = mergeWith(_config.value, cfg, customizerCoverArray), updateThemeColorCssVar(_config.value?.setting),
@@ -2855,14 +2863,14 @@
2855
2863
  const _activeSlots = {};
2856
2864
  for (const key in slots) Object.prototype.hasOwnProperty.call(slots, key) && (_activeSlots[key] = () => slots[key]?.());
2857
2865
  return vue.createVNode("div", {
2858
- class: [ ns$e.b(), props.className ],
2866
+ class: [ ns$f.b(), props.className ],
2859
2867
  style: props.style
2860
2868
  }, [ vue.h(activeLayout.value, {}, {
2861
2869
  ..._activeSlots
2862
2870
  }) ]);
2863
2871
  }
2864
- })), ns$d = useNamespace("tabs");
2865
- var Element$8 = vue.defineComponent({
2872
+ })), ns$e = useNamespace("tabs");
2873
+ var Element$9 = vue.defineComponent({
2866
2874
  name: "NextTabs",
2867
2875
  props: {
2868
2876
  activeTab: {
@@ -2931,12 +2939,12 @@
2931
2939
  tabsView.value.push(activeRoute)), emit("change", activeIndex.value, tabsView.value, "add");
2932
2940
  }));
2933
2941
  const renderContent = () => vue.createVNode("nav", {
2934
- class: ns$d.b()
2942
+ class: ns$e.b()
2935
2943
  }, [ vue.createVNode(elementPlus.ElScrollbar, null, {
2936
2944
  default: () => [ vue.createVNode("ul", {
2937
- class: ns$d.b("list")
2945
+ class: ns$e.b("list")
2938
2946
  }, [ tabsView.value.map(((tab, index) => tab ? vue.createVNode("li", {
2939
- class: [ "tab-item", ns$d.is("active", activeIndex.value === index) ],
2947
+ class: [ "tab-item", ns$e.is("active", activeIndex.value === index) ],
2940
2948
  onClick: event => onClickTabItem(event, tab, index)
2941
2949
  }, [ vue.createVNode("i", {
2942
2950
  class: [ "tab-icon", tab.meta?.icon ]
@@ -2967,11 +2975,11 @@
2967
2975
  onCommand: onChange
2968
2976
  }, {
2969
2977
  default: () => vue.createVNode("span", {
2970
- class: ns$d.b("tab-more")
2978
+ class: ns$e.b("tab-more")
2971
2979
  }, [ vue.createVNode("i", {
2972
- class: [ ns$d.be("tab-more", "box"), ns$d.be("tab-more", "top") ]
2980
+ class: [ ns$e.be("tab-more", "box"), ns$e.be("tab-more", "top") ]
2973
2981
  }, null), vue.createVNode("i", {
2974
- class: [ ns$d.be("tab-more", "box"), ns$d.be("tab-more", "bottom") ]
2982
+ class: [ ns$e.be("tab-more", "box"), ns$e.be("tab-more", "bottom") ]
2975
2983
  }, null) ]),
2976
2984
  dropdown: () => vue.createVNode(elementPlus.ElDropdownMenu, null, {
2977
2985
  default: () => [ vue.createVNode(elementPlus.ElDropdownItem, {
@@ -3004,7 +3012,7 @@
3004
3012
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
3005
3013
  }
3006
3014
  });
3007
- const NextTabs = withInstall(Element$8), ns$c = useNamespace("container");
3015
+ const NextTabs = withInstall(Element$9), ns$d = useNamespace("container");
3008
3016
  const NextContainer = withInstall(vue.defineComponent({
3009
3017
  name: "NextContainer",
3010
3018
  props: {
@@ -3042,18 +3050,18 @@
3042
3050
  }), style;
3043
3051
  }));
3044
3052
  return () => props.scrollbar ? vue.createVNode(elementPlus.ElScrollbar, {
3045
- class: [ ns$c.b(), props.className ],
3053
+ class: [ ns$d.b(), props.className ],
3046
3054
  style: props.style
3047
3055
  }, {
3048
3056
  default: () => [ slots.default?.() ]
3049
3057
  }) : vue.createVNode("div", {
3050
- class: [ ns$c.b(), props.className ],
3058
+ class: [ ns$d.b(), props.className ],
3051
3059
  style: {
3052
3060
  ...styles.value,
3053
3061
  ...props.style
3054
3062
  }
3055
3063
  }, [ props.card ? vue.createVNode("div", {
3056
- class: ns$c.b("card")
3064
+ class: ns$d.b("card")
3057
3065
  }, [ slots.default?.() ]) : slots.default?.() ]);
3058
3066
  }
3059
3067
  }));
@@ -3127,7 +3135,7 @@
3127
3135
  }
3128
3136
  };
3129
3137
  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" ];
3130
- var defaultConfig$3 = {
3138
+ var defaultConfig$4 = {
3131
3139
  initLoadData: !0,
3132
3140
  defaultContentHeight: 300,
3133
3141
  fullscreenchangeContentHeight: !1,
@@ -3175,7 +3183,7 @@
3175
3183
  formSpan: 12,
3176
3184
  formColumnMinWidth: 350
3177
3185
  };
3178
- const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$b = useNamespace("spin-loading");
3186
+ const columnSlotName = prop => "column-" + prop, searchFormSlotName = prop => "search-" + prop, formSlotName = prop => "form-" + prop, ns$c = useNamespace("spin-loading");
3179
3187
  var NextSpinLoading$1 = vue.defineComponent({
3180
3188
  name: "NextSpinLoading",
3181
3189
  props: {
@@ -3209,22 +3217,22 @@
3209
3217
  const _t = this.t, slots = this.$slots, props = this.$props, loadingText = props.tip || _t("next.loading");
3210
3218
  return vue.createVNode("div", {
3211
3219
  ref: "elementInstance",
3212
- class: [ ns$b.b(), props.className ],
3220
+ class: [ ns$c.b(), props.className ],
3213
3221
  style: props.style
3214
3222
  }, [ slots.default?.(), props.loading ? vue.createVNode("div", {
3215
- class: ns$b.b("mask")
3223
+ class: ns$c.b("mask")
3216
3224
  }, [ vue.createVNode("span", {
3217
- class: ns$b.b("mask-dot")
3225
+ class: ns$c.b("mask-dot")
3218
3226
  }, [ vue.createVNode("i", {
3219
- class: ns$b.be("mask", "dot-item")
3227
+ class: ns$c.be("mask", "dot-item")
3220
3228
  }, null), vue.createVNode("i", {
3221
- class: ns$b.be("mask", "dot-item")
3229
+ class: ns$c.be("mask", "dot-item")
3222
3230
  }, null), vue.createVNode("i", {
3223
- class: ns$b.be("mask", "dot-item")
3231
+ class: ns$c.be("mask", "dot-item")
3224
3232
  }, null), vue.createVNode("i", {
3225
- class: ns$b.be("mask", "dot-item")
3233
+ class: ns$c.be("mask", "dot-item")
3226
3234
  }, null) ]), vue.createVNode("span", {
3227
- class: ns$b.be("mask", "text")
3235
+ class: ns$c.be("mask", "text")
3228
3236
  }, [ loadingText ]) ]) : null ]);
3229
3237
  }
3230
3238
  }), SearchColumn = vue.defineComponent({
@@ -3911,7 +3919,7 @@
3911
3919
  }, null) ]);
3912
3920
  }
3913
3921
  });
3914
- const ns$a = useNamespace("dialog");
3922
+ const ns$b = useNamespace("dialog");
3915
3923
  var NextDialog$1 = vue.defineComponent({
3916
3924
  name: "NextDialog",
3917
3925
  props: {
@@ -3939,6 +3947,10 @@
3939
3947
  type: Boolean,
3940
3948
  default: !0
3941
3949
  },
3950
+ showClose: {
3951
+ type: Boolean,
3952
+ default: !0
3953
+ },
3942
3954
  appendToBody: {
3943
3955
  type: Boolean,
3944
3956
  default: !1
@@ -3976,7 +3988,7 @@
3976
3988
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(elementPlus.ElDialog, {
3977
3989
  modelValue: visible.value,
3978
3990
  "onUpdate:modelValue": $event => visible.value = $event,
3979
- class: ns$a.b(),
3991
+ class: ns$b.b(),
3980
3992
  title: props.title,
3981
3993
  appendToBody: props.appendToBody,
3982
3994
  "destroy-on-close": !0,
@@ -3993,18 +4005,18 @@
3993
4005
  }, {
3994
4006
  default: () => [ slots.default?.() ],
3995
4007
  header: ({close: close, titleId: titleId, titleClass: titleClass}) => vue.createVNode("div", {
3996
- class: ns$a.b("header")
4008
+ class: ns$b.b("header")
3997
4009
  }, [ vue.createVNode("h4", {
3998
4010
  id: titleId,
3999
4011
  class: titleClass
4000
4012
  }, [ props.title ]), vue.createVNode("div", {
4001
- class: ns$a.e("header-right")
4013
+ class: ns$b.e("header-right")
4002
4014
  }, [ props.fullscreenBtn && vue.createVNode("span", {
4003
4015
  class: "icon-fullscreen",
4004
4016
  onClick: () => isFullscreen.value = !isFullscreen.value
4005
4017
  }, [ vue.createVNode(elementPlus.ElIcon, null, {
4006
4018
  default: () => [ vue.createVNode(full_screen_default, null, null) ]
4007
- }) ]), vue.createVNode("span", {
4019
+ }) ]), props.showClose && vue.createVNode("span", {
4008
4020
  class: "icon-close",
4009
4021
  onClick: close
4010
4022
  }, [ vue.createVNode(elementPlus.ElIcon, {
@@ -4030,7 +4042,7 @@
4030
4042
  settingBtn: !0,
4031
4043
  operations: !1
4032
4044
  };
4033
- var defaultConfig$2 = {
4045
+ var defaultConfig$3 = {
4034
4046
  size: "default",
4035
4047
  colSpan: 8,
4036
4048
  labelWidth: "6em",
@@ -4044,7 +4056,7 @@
4044
4056
  submitText: null,
4045
4057
  resetText: null
4046
4058
  };
4047
- const ns$9 = useNamespace("form");
4059
+ const ns$a = useNamespace("form");
4048
4060
  var NumberRangePicker = vue.defineComponent({
4049
4061
  name: "NumberRangePicker",
4050
4062
  props: {
@@ -4083,7 +4095,7 @@
4083
4095
  }));
4084
4096
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
4085
4097
  ref: numberRangeRef,
4086
- class: ns$9.e("number-range")
4098
+ class: ns$a.e("number-range")
4087
4099
  }, [ vue.createVNode(elementPlus.ElInputNumber, {
4088
4100
  modelValue: startNumber.value,
4089
4101
  "onUpdate:modelValue": $event => startNumber.value = $event,
@@ -4093,7 +4105,7 @@
4093
4105
  disabled: disabled,
4094
4106
  onChange: onChangeStart
4095
4107
  }, null), vue.createVNode("span", {
4096
- class: ns$9.em("number-range", "division")
4108
+ class: ns$a.em("number-range", "division")
4097
4109
  }, [ t("next.date.rangeSeparator") ]), vue.createVNode(elementPlus.ElInputNumber, {
4098
4110
  modelValue: endNumber.value,
4099
4111
  "onUpdate:modelValue": $event => endNumber.value = $event,
@@ -4109,7 +4121,7 @@
4109
4121
  function _isSlot$3(s) {
4110
4122
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
4111
4123
  }
4112
- const ns$8 = useNamespace("form"), InputTableSelect = vue.defineComponent({
4124
+ const ns$9 = useNamespace("form"), InputTableSelect = vue.defineComponent({
4113
4125
  name: "InputTableSelect",
4114
4126
  props: {
4115
4127
  modelValue: {
@@ -4137,7 +4149,7 @@
4137
4149
  },
4138
4150
  emits: [ "select" ],
4139
4151
  setup(props, {emit: emit}) {
4140
- 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({
4152
+ const {t: t} = useLocale(), _disabled = props.disabled, _column = props.column, _placeholder = _column.placeholder || t("next.form.select") + _column.label, _tableDefaultConfig = deepClone(defaultConfig$4), _tableSelectConfig = deepClone(tableSelectConfig), _options = merge$1(_tableDefaultConfig, _tableSelectConfig, _column.tableSelect), tableSelectDialog = vue.reactive({
4141
4153
  visible: !1,
4142
4154
  title: _column.label + t("next.form.tableSelect"),
4143
4155
  dialogWidth: _options.dialogWidth
@@ -4208,18 +4220,18 @@
4208
4220
  }, renderContent = () => {
4209
4221
  let _slot, _slot2;
4210
4222
  return vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
4211
- class: [ "el-input", ns$8.e("input-table"), ns$8.is("disabled", _disabled) ]
4223
+ class: [ "el-input", ns$9.e("input-table"), ns$9.is("disabled", _disabled) ]
4212
4224
  }, [ vue.createVNode("div", {
4213
4225
  class: "el-input__wrapper"
4214
4226
  }, [ tags?.value.length ? vue.createVNode("span", {
4215
- class: ns$8.em("input-table", "value")
4227
+ class: ns$9.em("input-table", "value")
4216
4228
  }, [ tags.value.map(((tag, index) => vue.createVNode(elementPlus.ElTag, {
4217
4229
  closable: !_disabled,
4218
4230
  onClose: () => _onCloseTag(0, index)
4219
4231
  }, {
4220
4232
  default: () => [ tag.label ]
4221
4233
  }))), tagsMore?.value?.length ? vue.createVNode(elementPlus.ElTooltip, {
4222
- "popper-class": ns$8.e("tooltip-tags"),
4234
+ "popper-class": ns$9.e("tooltip-tags"),
4223
4235
  placement: "bottom",
4224
4236
  effect: "light"
4225
4237
  }, {
@@ -4233,10 +4245,10 @@
4233
4245
  default: () => [ tag.label ]
4234
4246
  })))
4235
4247
  }) : null ]) : vue.createVNode("span", {
4236
- class: ns$8.em("input-table", "placeholder")
4248
+ class: ns$9.em("input-table", "placeholder")
4237
4249
  }, [ _placeholder ]) ]), vue.createVNode(elementPlus.ElButton, {
4238
4250
  type: "primary",
4239
- class: ns$8.em("input-table", "append"),
4251
+ class: ns$9.em("input-table", "append"),
4240
4252
  disabled: _disabled,
4241
4253
  icon: search_default,
4242
4254
  onClick: onClickTableDialog
@@ -4250,7 +4262,7 @@
4250
4262
  onClose: onCloseTableDialog
4251
4263
  }, {
4252
4264
  default: () => [ vue.createVNode("div", {
4253
- class: ns$8.em("input-table", "content")
4265
+ class: ns$9.em("input-table", "content")
4254
4266
  }, [ vue.createVNode(elementPlus.ElRadioGroup, {
4255
4267
  modelValue: sinleSelection.value
4256
4268
  }, {
@@ -4273,7 +4285,7 @@
4273
4285
  }) ]
4274
4286
  }) ]
4275
4287
  }) ]), vue.createVNode("div", {
4276
- class: ns$8.em("input-table", "footer")
4288
+ class: ns$9.em("input-table", "footer")
4277
4289
  }, [ vue.createVNode(elementPlus.ElButton, {
4278
4290
  onClick: onResetTableSelect
4279
4291
  }, _isSlot$3(_slot = t("next.form.reset")) ? _slot : {
@@ -4289,7 +4301,7 @@
4289
4301
  };
4290
4302
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
4291
4303
  }
4292
- }), ns$7 = useNamespace("form");
4304
+ }), ns$8 = useNamespace("form");
4293
4305
  var UploadImage = vue.defineComponent({
4294
4306
  name: "UploadImage",
4295
4307
  props: {
@@ -4345,7 +4357,7 @@
4345
4357
  let urls = [];
4346
4358
  return "string" == typeof value ? urls = [ value ] : "[object Array]" === Object.prototype.toString.call(value) && (urls = value),
4347
4359
  urls = urls.filter((url => !!url)), urls.length ? vue.createVNode(elementPlus.ElImage, {
4348
- class: ns$7.e("preview-image"),
4360
+ class: ns$8.e("preview-image"),
4349
4361
  src: urls[0],
4350
4362
  previewSrcList: urls,
4351
4363
  "preview-teleported": !0,
@@ -4360,7 +4372,7 @@
4360
4372
  })
4361
4373
  }) : null;
4362
4374
  })(), _disabled ? null : vue.createVNode(elementPlus.ElUpload, {
4363
- class: [ ns$7.b("upload-image"), props.className ],
4375
+ class: [ ns$8.b("upload-image"), props.className ],
4364
4376
  style: props.style,
4365
4377
  "list-type": props.listType,
4366
4378
  multiple: props.multiple,
@@ -4496,8 +4508,8 @@
4496
4508
  function _isSlot$2(s) {
4497
4509
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
4498
4510
  }
4499
- const ns$6 = useNamespace("form");
4500
- var Element$6 = vue.defineComponent({
4511
+ const ns$7 = useNamespace("form");
4512
+ var Element$7 = vue.defineComponent({
4501
4513
  name: "NextForm",
4502
4514
  props: {
4503
4515
  options: {
@@ -4515,7 +4527,7 @@
4515
4527
  },
4516
4528
  emits: [ "submit", "close", "reset" ],
4517
4529
  setup(props, {slots: slots, emit: emit, expose: expose}) {
4518
- 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({});
4530
+ const _config = deepClone(defaultConfig$3), 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({});
4519
4531
  vue.watch((() => [ props.columns, props.formDatum ]), (() => {
4520
4532
  (() => {
4521
4533
  const columns = props.columns;
@@ -4866,7 +4878,7 @@
4866
4878
  let _slot;
4867
4879
  return vue.createVNode(elementPlus.ElForm, {
4868
4880
  ref: ruleFormRef,
4869
- class: ns$6.b(),
4881
+ class: ns$7.b(),
4870
4882
  inline: !1,
4871
4883
  model: formParams,
4872
4884
  size: options.size
@@ -4886,7 +4898,7 @@
4886
4898
  }, {
4887
4899
  label: () => column.label ? vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextTextEllipsis, {
4888
4900
  content: t(column.label),
4889
- class: ns$6.e("item-label")
4901
+ class: ns$7.e("item-label")
4890
4902
  }, null), column.tip ? vue.createVNode(elementPlus.ElTooltip, {
4891
4903
  effect: "dark",
4892
4904
  content: column.tip,
@@ -4906,7 +4918,7 @@
4906
4918
  })))) ? _slot : {
4907
4919
  default: () => [ _slot ]
4908
4920
  }), _isEditing.value && options.showFooter ? vue.createVNode("div", {
4909
- class: ns$6.e("footer")
4921
+ class: ns$7.e("footer")
4910
4922
  }, [ vue.createVNode(elementPlus.ElButton, {
4911
4923
  type: "primary",
4912
4924
  loading: submitLoading.value,
@@ -4925,7 +4937,7 @@
4925
4937
  };
4926
4938
  }
4927
4939
  });
4928
- const NextTreeSelect = withInstall(treeSelect), NextForm = withInstall(Element$6);
4940
+ const NextTreeSelect = withInstall(treeSelect), NextForm = withInstall(Element$7);
4929
4941
  var AddEditForm = vue.defineComponent({
4930
4942
  name: "AddEditForm",
4931
4943
  props: {
@@ -4979,17 +4991,17 @@
4979
4991
  function _isSlot(s) {
4980
4992
  return "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s);
4981
4993
  }
4982
- const ns$5 = useNamespace("crud-table");
4983
- var Element$5 = vue.defineComponent({
4994
+ const ns$6 = useNamespace("crud-table");
4995
+ var Element$6 = vue.defineComponent({
4984
4996
  name: "NextCrudTable",
4985
4997
  props: defaultPropsConfig,
4986
4998
  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" ],
4987
4999
  setup(props, {emit: emit, slots: slots, expose: expose}) {
4988
- const _config = deepClone(defaultConfig$3), _options = vue.computed((() => {
5000
+ const _config = deepClone(defaultConfig$4), _options = vue.computed((() => {
4989
5001
  const cfg = vue.unref(props.options);
4990
5002
  return merge$1(_config, cfg);
4991
5003
  })), options = vue.unref(_options);
4992
- vue.provide("options", vue.computed((() => _options.value))), vue.provide("ns", ns$5);
5004
+ vue.provide("options", vue.computed((() => _options.value))), vue.provide("ns", ns$6);
4993
5005
  const {t: t} = useLocale(), _columns = vue.ref(options.columns), _searchColumns = vue.ref([]), _formColumns = vue.ref([]), _updateColumnsAll = ops => {
4994
5006
  ((options, cb) => {
4995
5007
  const _columns = vue.reactive(options.columns), _loadDicData = col => {
@@ -5232,11 +5244,11 @@
5232
5244
  });
5233
5245
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
5234
5246
  ref: crudTableRef,
5235
- class: [ ns$5.b(), props.className ],
5247
+ class: [ ns$6.b(), props.className ],
5236
5248
  style: props.style
5237
5249
  }, [ options.showSearchForm || options.showHeaderMenu ? vue.createVNode("header", {
5238
5250
  ref: headerRef,
5239
- class: ns$5.b("header")
5251
+ class: ns$6.b("header")
5240
5252
  }, [ options.showSearchForm && vue.createVNode(HeaderSearch, {
5241
5253
  columns: _searchColumns.value,
5242
5254
  onZoomResize: updateTableContentHeight,
@@ -5255,7 +5267,7 @@
5255
5267
  }, {
5256
5268
  default: () => [ vue.createVNode("div", {
5257
5269
  ref: tableRef,
5258
- class: ns$5.b("content")
5270
+ class: ns$6.b("content")
5259
5271
  }, [ vue.createVNode(elementPlus.ElTable, {
5260
5272
  data: tableData.value,
5261
5273
  height: tableContentHeight.value,
@@ -5318,7 +5330,7 @@
5318
5330
  }) ]) ]
5319
5331
  }), options.isPagination ? vue.createVNode("div", {
5320
5332
  ref: footerRef,
5321
- class: ns$5.b("footer")
5333
+ class: ns$6.b("footer")
5322
5334
  }, [ vue.createVNode(FooterPagination, {
5323
5335
  page: props.page,
5324
5336
  onChange: onChangePagination
@@ -5344,7 +5356,7 @@
5344
5356
  }) ]) ]) ]);
5345
5357
  }
5346
5358
  });
5347
- const NextCrudTable = withInstall(Element$5);
5359
+ const NextCrudTable = withInstall(Element$6);
5348
5360
  var propsConfig = {
5349
5361
  className: {
5350
5362
  type: String,
@@ -5374,13 +5386,13 @@
5374
5386
  total: 0
5375
5387
  })
5376
5388
  }
5377
- }, defaultConfig$1 = {};
5378
- const ns$4 = useNamespace("crud-table-virtualized");
5389
+ }, defaultConfig$2 = {};
5390
+ const ns$5 = useNamespace("crud-table-virtualized");
5379
5391
  const NextCrudTableVirtualized = withInstall(vue.defineComponent({
5380
5392
  name: "NextCrudTableVirtualized",
5381
5393
  props: propsConfig,
5382
5394
  setup(props, {emit: emit}) {
5383
- const _config = deepClone(defaultConfig$1), _options = vue.computed((() => {
5395
+ const _config = deepClone(defaultConfig$2), _options = vue.computed((() => {
5384
5396
  const cfg = vue.unref(props.options);
5385
5397
  return merge$1(_config, cfg);
5386
5398
  })), options = vue.unref(_options);
@@ -5395,7 +5407,7 @@
5395
5407
  emit("close-add-edit");
5396
5408
  };
5397
5409
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
5398
- class: [ ns$4.b(), props.className ]
5410
+ class: [ ns$5.b(), props.className ]
5399
5411
  }, [ vue.createVNode(NextSpinLoading, null, null), vue.createVNode(NextDialog, {
5400
5412
  modelValue: addEditDialog.visible,
5401
5413
  "onUpdate:modelValue": $event => addEditDialog.visible = $event,
@@ -5406,7 +5418,7 @@
5406
5418
  onClose: onCloseAddEditDialog
5407
5419
  }, null) ]) ]);
5408
5420
  }
5409
- })), NextSpinLoading = withInstall(NextSpinLoading$1), ns$3 = useNamespace("upload");
5421
+ })), NextSpinLoading = withInstall(NextSpinLoading$1), ns$4 = useNamespace("upload");
5410
5422
  const NextUpload = withInstall(vue.defineComponent({
5411
5423
  name: "NextUpload",
5412
5424
  props: {
@@ -5440,7 +5452,7 @@
5440
5452
  const slots = this.$slots, props = this.$props, emit = this.$emit, _t = this.t, uploadfilesPreview = vue.ref([]), body = document.getElementsByTagName("body")[0];
5441
5453
  let previewImagesContainer = null;
5442
5454
  return vue.createVNode(elementPlus.ElUpload, {
5443
- class: [ ns$3.b(), props.className ],
5455
+ class: [ ns$4.b(), props.className ],
5444
5456
  style: props.style,
5445
5457
  "list-type": props.listType,
5446
5458
  "auto-upload": !1,
@@ -5478,8 +5490,8 @@
5478
5490
  })
5479
5491
  });
5480
5492
  }
5481
- })), ns$2 = useNamespace("video-player");
5482
- var Element$2 = vue.defineComponent({
5493
+ })), ns$3 = useNamespace("video-player");
5494
+ var Element$3 = vue.defineComponent({
5483
5495
  name: "NextVideoPlayer",
5484
5496
  props: {
5485
5497
  className: {
@@ -5552,7 +5564,7 @@
5552
5564
  if (!classNames || !classNames.length) throw new Error("模型类别不能未空!");
5553
5565
  container.innerHTML = "", tf__namespace.loadGraphModel(modelUrl).then((model => {
5554
5566
  const canvas = document.createElement("canvas");
5555
- canvas.className = ns$2.b("recongition"), container.appendChild(canvas);
5567
+ canvas.className = ns$3.b("recongition"), container.appendChild(canvas);
5556
5568
  const ctx = canvas.getContext("2d"), detect_ctx = document.createElement("canvas").getContext("2d");
5557
5569
  video.ontimeupdate = () => {
5558
5570
  const {videoWidth: videoWidth, videoHeight: videoHeight, offsetTop: offsetTop, offsetLeft: offsetLeft} = video;
@@ -5723,12 +5735,12 @@
5723
5735
  });
5724
5736
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
5725
5737
  ref: videoBoxRef,
5726
- class: [ ns$2.b(), props.className ],
5738
+ class: [ ns$3.b(), props.className ],
5727
5739
  style: props.style
5728
5740
  }, null) ]);
5729
5741
  }
5730
5742
  });
5731
- const NextVideoPlayer = withInstall(Element$2);
5743
+ const NextVideoPlayer = withInstall(Element$3);
5732
5744
  const NextDragResize = withInstall(vue.defineComponent({
5733
5745
  name: "NextDragResize",
5734
5746
  props: {},
@@ -5843,7 +5855,7 @@
5843
5855
  }) ]) ]) ]) ]);
5844
5856
  }
5845
5857
  });
5846
- const colors = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
5858
+ const colors$1 = [ "#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ], convertToLabel = rect => {
5847
5859
  const label_type = rect.type, x_center = rect.startX + rect.rectWidth / 2, y_center = rect.startY + rect.rectHeight / 2;
5848
5860
  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)) ];
5849
5861
  }, canvertToCanvas = (labelData, canvasWidth, canvasHeight) => {
@@ -5927,7 +5939,7 @@
5927
5939
  }
5928
5940
  }, [ vue.createVNode("span", {
5929
5941
  style: {
5930
- "background-color": colors[index % colors.length]
5942
+ "background-color": colors$1[index % colors$1.length]
5931
5943
  },
5932
5944
  class: "label-line"
5933
5945
  }, null), vue.createVNode("span", null, [ name ]) ]))) ]), isValueExist(activateIndex.value) ? vue.createVNode("div", {
@@ -6113,7 +6125,7 @@
6113
6125
  onMousedown: event => this.onMousedownDot(event, "bottomRight")
6114
6126
  }, null) ]) ]);
6115
6127
  }
6116
- }), CanvasContext = vue.defineComponent({
6128
+ }), CanvasContext$1 = vue.defineComponent({
6117
6129
  name: "NextCanvasContext",
6118
6130
  props: {
6119
6131
  classes: {
@@ -6179,7 +6191,7 @@
6179
6191
  const {ctx: ctx, labels: labels, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight} = options, updateLabels = () => {
6180
6192
  ctx.clearRect(0, 0, canvasWidth, canvasHeight), ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
6181
6193
  for (let i = 0; i < labels.length; i++) {
6182
- const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors[type % colors.length];
6194
+ const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors$1[type % colors$1.length];
6183
6195
  if (ctx.font = "bold 14px serif", ctx.textBaseline = "top", ctx.save(), ctx.strokeStyle = color,
6184
6196
  ctx.strokeRect(startX, startY, rectWidth, rectHeight), isValueExist(rect.typeName) || isValueExist(rect.type)) {
6185
6197
  const text = rect.typeName || rect.type;
@@ -6199,7 +6211,7 @@
6199
6211
  for (let i = 0; i < labels.length; i++) {
6200
6212
  const rect = labels[i], {type: type, startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
6201
6213
  x >= startX && x <= startX + rectWidth && y >= startY && y <= startY + rectHeight && (hit_rect = rect,
6202
- hit_index = i, color = colors[type]);
6214
+ hit_index = i, color = colors$1[type]);
6203
6215
  }
6204
6216
  return {
6205
6217
  hit_rect: hit_rect,
@@ -6389,7 +6401,7 @@
6389
6401
  onCloseContentmenuLabel: onCloseContentmenuLabel,
6390
6402
  onSelectedLabel: (rect, index) => {
6391
6403
  onCloseDraggableRectFixed(), vue.nextTick((() => {
6392
- const {startX: x, startY: y, type: type} = rect, color = colors[type];
6404
+ const {startX: x, startY: y, type: type} = rect, color = colors$1[type];
6393
6405
  updateDraggableRectFixed(x, y, labels.value[index], index, color);
6394
6406
  }));
6395
6407
  },
@@ -6470,7 +6482,7 @@
6470
6482
  })(rect, index)
6471
6483
  }, [ vue.createVNode("div", null, [ vue.createVNode("span", {
6472
6484
  style: {
6473
- "background-color": colors[rect.type]
6485
+ "background-color": colors$1[rect.type]
6474
6486
  },
6475
6487
  class: "label-line"
6476
6488
  }, null), vue.createVNode("span", null, [ rect.typeName ]) ]), vue.createVNode(elementPlus.ElPopconfirm, {
@@ -6495,11 +6507,11 @@
6495
6507
  }, null) ]);
6496
6508
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
6497
6509
  }
6498
- }), defaultConfig = {
6510
+ }), defaultConfig$1 = {
6499
6511
  minContentHeight: 500
6500
6512
  };
6501
- const ns$1 = useNamespace("labelimg");
6502
- var Element = vue.defineComponent({
6513
+ const ns$2 = useNamespace("labelimg");
6514
+ var Element$1 = vue.defineComponent({
6503
6515
  name: "NextLabelimg",
6504
6516
  props: {
6505
6517
  className: {
@@ -6510,10 +6522,6 @@
6510
6522
  type: Object,
6511
6523
  default: () => ({})
6512
6524
  },
6513
- rowKey: {
6514
- type: String,
6515
- default: "id"
6516
- },
6517
6525
  options: {
6518
6526
  type: Object,
6519
6527
  default: () => ({})
@@ -6529,11 +6537,11 @@
6529
6537
  },
6530
6538
  emits: [ "change", "save", "prev-click", "next-click" ],
6531
6539
  setup(props, {emit: emit, slots: slots, expose: expose}) {
6532
- const {t: t} = useLocale(), _config = deepClone(defaultConfig), _options = vue.computed((() => {
6540
+ const {t: t} = useLocale(), _config = deepClone(defaultConfig$1), _options = vue.computed((() => {
6533
6541
  const cfg = vue.unref(props.options);
6534
6542
  return merge$1(_config, cfg);
6535
6543
  })), options = vue.unref(_options);
6536
- vue.provide("ns", ns$1), vue.provide("_emit", emit);
6544
+ vue.provide("ns", ns$2), vue.provide("_emit", emit);
6537
6545
  const activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes), labelImages = vue.ref(deepClone(props.data));
6538
6546
  vue.watch((() => props.data), (data => {
6539
6547
  labelImages.value = deepClone(data);
@@ -6567,7 +6575,10 @@
6567
6575
  node: node,
6568
6576
  label_txt: yolo_label.join("\n")
6569
6577
  };
6570
- }, isChangeNodeLabels = () => isEqual(labelImages.value[activateNodeIndex.value].labels, currentNode.value.labels), switchKeydownAD = e => {
6578
+ }, isChangeNodeLabels = () => {
6579
+ const node = labelImages.value[activateNodeIndex.value];
6580
+ return isEqual(vue.toRaw(node.labels).map((rect => convertToLabel(rect))), currentNode.value.labels.map((rect => convertToLabel(rect))));
6581
+ }, switchKeydownAD = e => {
6571
6582
  const imageLength = labelImages.value.length;
6572
6583
  "KeyD" === e.code ? (activateNodeIndex.value++, activateNodeIndex.value >= imageLength && (activateNodeIndex.value = 0)) : "KeyA" === e.code && (activateNodeIndex.value--,
6573
6584
  activateNodeIndex.value < 0 && (activateNodeIndex.value = imageLength - 1));
@@ -6637,19 +6648,19 @@
6637
6648
  });
6638
6649
  const renderContent = () => vue.createVNode("div", {
6639
6650
  ref: layoutLabelRef,
6640
- class: [ ns$1.b(), props.className, isFullscreen.value ? ns$1.b("fullscreen") : "" ],
6651
+ class: [ ns$2.b(), props.className, isFullscreen.value ? ns$2.b("fullscreen") : "" ],
6641
6652
  style: {
6642
6653
  ...props.style
6643
6654
  }
6644
6655
  }, [ vue.createVNode(NextSpinLoading$1, {
6645
6656
  loading: loading.value,
6646
6657
  tip: t("next.labelimg.saveTxt"),
6647
- class: [ ns$1.b("loading") ]
6658
+ class: [ ns$2.b("loading") ]
6648
6659
  }, {
6649
6660
  default: () => [ vue.createVNode(elementPlus.ElScrollbar, null, {
6650
6661
  default: () => [ vue.createVNode("header", {
6651
6662
  ref: headerRef,
6652
- class: [ ns$1.b("header") ]
6663
+ class: [ ns$2.b("header") ]
6653
6664
  }, [ slots.header ? slots.header() : vue.createVNode(ToolHeader, {
6654
6665
  isFullscreen: isFullscreen.value,
6655
6666
  imageIndex: activateNodeIndex.value,
@@ -6663,16 +6674,16 @@
6663
6674
  }
6664
6675
  }, null) ]), vue.createVNode("div", {
6665
6676
  ref: mainRef,
6666
- class: [ ns$1.b("main") ]
6677
+ class: [ ns$2.b("main") ]
6667
6678
  }, [ vue.createVNode(elementPlus.ElScrollbar, {
6668
- class: [ ns$1.be("main", "content") ]
6679
+ class: [ ns$2.be("main", "content") ]
6669
6680
  }, {
6670
6681
  default: () => [ vue.createVNode("div", {
6671
- class: [ ns$1.be("main", "content") ],
6682
+ class: [ ns$2.be("main", "content") ],
6672
6683
  style: {
6673
6684
  height: mainContentHeight.value + "px"
6674
6685
  }
6675
- }, [ vue.createVNode(CanvasContext, {
6686
+ }, [ vue.createVNode(CanvasContext$1, {
6676
6687
  ref: canvasContextRef,
6677
6688
  contextClientHeight: mainContentHeight.value,
6678
6689
  classes: classes.value,
@@ -6687,9 +6698,9 @@
6687
6698
  onSelect: onSelectLabelNode
6688
6699
  }, null) ]), vue.createVNode("footer", {
6689
6700
  ref: footerRef,
6690
- class: [ ns$1.b("footer") ]
6701
+ class: [ ns$2.b("footer") ]
6691
6702
  }, [ vue.createVNode("div", {
6692
- class: [ ns$1.be("footer", "left") ]
6703
+ class: [ ns$2.be("footer", "left") ]
6693
6704
  }, [ vue.createVNode(elementPlus.ElIcon, {
6694
6705
  size: 24,
6695
6706
  color: "#797979",
@@ -6697,10 +6708,10 @@
6697
6708
  }, {
6698
6709
  default: () => [ vue.createVNode(arrow_left_default, null, null) ]
6699
6710
  }) ]), vue.createVNode("div", {
6700
- class: [ ns$1.be("footer", "center") ]
6711
+ class: [ ns$2.be("footer", "center") ]
6701
6712
  }, [ vue.createVNode(elementPlus.ElScrollbar, null, {
6702
6713
  default: () => [ vue.createVNode("ul", {
6703
- class: [ ns$1.bem("footer", "center", "list") ]
6714
+ class: [ ns$2.bem("footer", "center", "list") ]
6704
6715
  }, [ labelImages.value.map(((item, index) => vue.createVNode("li", {
6705
6716
  key: index,
6706
6717
  onClick: () => onChangeActivateNode(index),
@@ -6716,7 +6727,7 @@
6716
6727
  fit: "cover"
6717
6728
  }, null) ]))) ]) ]
6718
6729
  }) ]), vue.createVNode("div", {
6719
- class: [ ns$1.be("footer", "right") ]
6730
+ class: [ ns$2.be("footer", "right") ]
6720
6731
  }, [ vue.createVNode(elementPlus.ElIcon, {
6721
6732
  size: 24,
6722
6733
  color: "#797979",
@@ -6729,7 +6740,7 @@
6729
6740
  return () => vue.createVNode(vue.Fragment, null, [ renderContent() ]);
6730
6741
  }
6731
6742
  });
6732
- const ns = useNamespace("labelimg-preview");
6743
+ const ns$1 = useNamespace("labelimg-preview");
6733
6744
  var preview = vue.defineComponent({
6734
6745
  name: "NextLabelimgPreview",
6735
6746
  props: {
@@ -6765,7 +6776,7 @@
6765
6776
  canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
6766
6777
  })(canvasWidth, canvasHeight), ctx.clearRect(0, 0, canvasWidth, canvasHeight), ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
6767
6778
  for (let i = 0; i < labels.value.length; i++) {
6768
- const rect = labels.value[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors[type % colors.length];
6779
+ const rect = labels.value[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors$1[type % colors$1.length];
6769
6780
  if (ctx.font = "bold 14px serif", ctx.textBaseline = "top", ctx.save(), ctx.strokeStyle = color,
6770
6781
  ctx.strokeRect(startX, startY, rectWidth, rectHeight), !isValueExist(rect.typeName)) {
6771
6782
  const typeName = classes.value[rect.type];
@@ -6788,7 +6799,7 @@
6788
6799
  });
6789
6800
  }));
6790
6801
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
6791
- class: [ ns.b(), props.className ],
6802
+ class: [ ns$1.b(), props.className ],
6792
6803
  style: {
6793
6804
  ...props.style
6794
6805
  }
@@ -6797,7 +6808,415 @@
6797
6808
  }, null) ]) ]);
6798
6809
  }
6799
6810
  });
6800
- const NextLabelimg = withInstall(Element), NextLabelimgPreview = withInstall(preview);
6811
+ const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview), isPointInCircle = (mouseX, mouseY, circleX, circleY, radius) => Math.sqrt(Math.pow(mouseX - circleX, 2) + Math.pow(mouseY - circleY, 2)) < radius, vertexesUnique = vertexes => Array.from(new Set(vertexes.map((item => JSON.stringify(item))))).map((item => JSON.parse(item))), {hexToRgba: hexToRgba} = useChangeColor(), colors = [ "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ];
6812
+ class CreatePolygonVertexes {
6813
+ canvas;
6814
+ ctx;
6815
+ vertexes;
6816
+ isDrawing;
6817
+ mouseOffset;
6818
+ vertexesObservers=[];
6819
+ destroyedObservers;
6820
+ constructor(canvas, ctx) {
6821
+ this.canvas = canvas, this.ctx = ctx, this.isDrawing = !1, this.vertexes = [], this.mouseOffset = {
6822
+ x: 0,
6823
+ y: 0
6824
+ }, canvas.addEventListener("click", this.canvasMouseClick.bind(this)), canvas.addEventListener("mousemove", this.canvasMousemove.bind(this)),
6825
+ canvas.addEventListener("dblclick", this.canvasMouseDblclick.bind(this)), this.vertexes = new Proxy(this.vertexes, {
6826
+ set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
6827
+ !0)
6828
+ }), this.mouseOffset = new Proxy(this.mouseOffset, {
6829
+ set: (target, property, value) => (target[property] = value, this.notifyVertexChangeListeners(),
6830
+ !0)
6831
+ });
6832
+ }
6833
+ notifyVertexChangeListeners() {
6834
+ this.vertexesObservers.forEach((listener => {
6835
+ listener(this.vertexes, this.mouseOffset);
6836
+ }));
6837
+ }
6838
+ vertexesChangeEventListener(listener) {
6839
+ this.vertexesObservers.push(listener);
6840
+ }
6841
+ notifyDestryedListerers() {
6842
+ this.destroyedObservers(this.vertexes);
6843
+ }
6844
+ onDestroyed(callback) {
6845
+ this.destroyedObservers = callback;
6846
+ }
6847
+ canvasMouseClick(e) {
6848
+ e.stopPropagation(), this.isDrawing = !0, this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
6849
+ this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes);
6850
+ }
6851
+ canvasMousemove(e) {
6852
+ e.stopPropagation(), this.isDrawing && (this.mouseOffset.x = e.offsetX, this.mouseOffset.y = e.offsetY,
6853
+ this.canvas.style.cursor = "crosshair");
6854
+ }
6855
+ canvasMouseDblclick(e) {
6856
+ e.stopPropagation(), this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
6857
+ this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes),
6858
+ this.notifyDestryedListerers(), this.destroyed();
6859
+ }
6860
+ destroyed() {
6861
+ this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.canvas.removeEventListener("click", this.canvasMouseClick),
6862
+ this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
6863
+ }
6864
+ }
6865
+ class EditPolygonPath {
6866
+ canvas;
6867
+ ctx;
6868
+ vertexes;
6869
+ isEditing;
6870
+ isMoveEditing;
6871
+ canClickEvent;
6872
+ pointVertexIndex;
6873
+ pointCentreIndex;
6874
+ vertexRadius;
6875
+ edgeCentreRadius;
6876
+ observers=[];
6877
+ constructor(canvas, ctx) {
6878
+ this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
6879
+ this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
6880
+ this.vertexRadius = 8, this.edgeCentreRadius = 5;
6881
+ }
6882
+ drawPolygonPath(vertexes, mouseX, mouseY) {
6883
+ const ctx = this.ctx;
6884
+ if (!vertexes.length) return;
6885
+ ctx.beginPath(), ctx.lineWidth = 3, ctx.strokeStyle = "#5470c6", ctx.fillStyle = hexToRgba("#5470c6", .2),
6886
+ ctx.moveTo(vertexes[0][0], vertexes[0][1]);
6887
+ for (let i = 1; i < vertexes.length; i++) {
6888
+ const [x, y] = vertexes[i];
6889
+ ctx.lineTo(x, y);
6890
+ }
6891
+ isNaN(mouseX) || isNaN(mouseY) || ctx.lineTo(mouseX, mouseY), ctx.closePath(), ctx.stroke(),
6892
+ ctx.fill();
6893
+ }
6894
+ drawPolygonEdgeCentre(vertexes) {
6895
+ const ctx = this.ctx;
6896
+ for (let i = 0; i < vertexes.length; i++) {
6897
+ const [x, y] = vertexes[i];
6898
+ ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, this.vertexRadius, 0, 2 * Math.PI),
6899
+ ctx.closePath(), ctx.fill(), ctx.beginPath(), ctx.fillStyle = "#FFFFFF", ctx.arc(x, y, this.vertexRadius - 3, 0, 2 * Math.PI),
6900
+ ctx.closePath(), ctx.fill();
6901
+ }
6902
+ for (let i = 0; i < vertexes.length; i++) {
6903
+ const start = vertexes[i % vertexes.length], end = vertexes[(i + 1) % vertexes.length], x = start[0] + (end[0] - start[0]) / 2, y = start[1] + (end[1] - start[1]) / 2;
6904
+ ctx.beginPath(), ctx.fillStyle = "#5470c6", ctx.arc(x, y, this.edgeCentreRadius, 0, 2 * Math.PI),
6905
+ ctx.closePath(), ctx.fill();
6906
+ }
6907
+ }
6908
+ drawPolygon(vertexes, mouseOffset) {
6909
+ this.vertexes = vertexes, mouseOffset ? this.drawPolygonPath(vertexes, mouseOffset.x, mouseOffset.y) : (this.drawPolygonPath(vertexes),
6910
+ this.drawPolygonEdgeCentre(vertexes));
6911
+ }
6912
+ pointInVertexes(x, y) {
6913
+ const vertexes = this.vertexes;
6914
+ let aimIndex = null;
6915
+ for (let i = 0; i < vertexes.length; i++) {
6916
+ const [vertex_x, vertex_y] = vertexes[i];
6917
+ if (isPointInCircle(x, y, vertex_x, vertex_y, this.vertexRadius)) {
6918
+ this.canvas.style.cursor = "pointer", aimIndex = i;
6919
+ break;
6920
+ }
6921
+ this.canvas.style.cursor = "unset";
6922
+ }
6923
+ return aimIndex;
6924
+ }
6925
+ pointInEdgeCentre(x, y) {
6926
+ const vertexes = this.vertexes;
6927
+ let aimIndex = null;
6928
+ for (let i = 0; i < vertexes.length; i++) {
6929
+ const start = vertexes[i % vertexes.length], end = vertexes[(i + 1) % vertexes.length], vertex_x = start[0] + (end[0] - start[0]) / 2, vertex_y = start[1] + (end[1] - start[1]) / 2;
6930
+ if (isPointInCircle(x, y, vertex_x, vertex_y, this.edgeCentreRadius)) {
6931
+ this.canvas.style.cursor = "pointer", aimIndex = i;
6932
+ break;
6933
+ }
6934
+ this.canvas.style.cursor = "unset";
6935
+ }
6936
+ return aimIndex;
6937
+ }
6938
+ pointInVertexesOrEdgeCentre(x, y) {
6939
+ const vertexes = this.vertexes;
6940
+ for (let i = 0; i < vertexes.length; i++) {
6941
+ const [vertex_x, vertex_y] = vertexes[i], isInVertex = isPointInCircle(x, y, vertex_x, vertex_y, this.vertexRadius), start = vertexes[i % vertexes.length], end = vertexes[(i + 1) % vertexes.length], edge_center_x = start[0] + (end[0] - start[0]) / 2, edge_center_y = start[1] + (end[1] - start[1]) / 2, isInEdgeCenter = isPointInCircle(x, y, edge_center_x, edge_center_y, this.edgeCentreRadius);
6942
+ if (isInVertex || isInEdgeCenter) {
6943
+ this.canvas.style.cursor = "pointer";
6944
+ break;
6945
+ }
6946
+ this.canvas.style.cursor = "unset";
6947
+ }
6948
+ }
6949
+ notifyObservers() {
6950
+ this.observers.forEach((listener => {
6951
+ listener(this.vertexes);
6952
+ }));
6953
+ }
6954
+ updatePolygon(callback) {
6955
+ this.isEditing = !0, this.canvas.addEventListener("mousedown", this.canvasMousedown.bind(this)),
6956
+ this.canvas.addEventListener("mouseup", this.canvasMouseup.bind(this)), this.canvas.addEventListener("click", this.canvasMouseClick.bind(this)),
6957
+ this.canvas.addEventListener("mousemove", this.canvasMousemove.bind(this)), this.observers.push(callback);
6958
+ }
6959
+ canvasMousedown(e) {
6960
+ e.stopPropagation(), e.preventDefault(), this.canClickEvent = !0;
6961
+ const {offsetX: x, offsetY: y} = e;
6962
+ if (this.isEditing) {
6963
+ const vertex_i = this.pointInVertexes(x, y);
6964
+ isValueExist(vertex_i) && (this.isMoveEditing = !0, this.pointVertexIndex = vertex_i,
6965
+ this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]));
6966
+ const i = this.pointInEdgeCentre(x, y);
6967
+ isValueExist(i) && (this.isMoveEditing = !0, this.pointCentreIndex = i + 1, this.vertexes.splice(this.pointCentreIndex, 0, [ x, y ]));
6968
+ }
6969
+ setTimeout((() => {
6970
+ this.canClickEvent = !1;
6971
+ }), 200);
6972
+ }
6973
+ canvasMouseup(e) {
6974
+ e.stopPropagation(), e.preventDefault();
6975
+ const {offsetX: x, offsetY: y} = e;
6976
+ this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
6977
+ this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
6978
+ this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
6979
+ this.notifyObservers();
6980
+ }
6981
+ canvasMouseClick(e) {
6982
+ e.stopPropagation();
6983
+ const {offsetX: x, offsetY: y} = e;
6984
+ if (this.isEditing && this.canClickEvent) {
6985
+ e.stopImmediatePropagation();
6986
+ const i = this.pointInVertexes(x, y);
6987
+ if (isValueExist(i)) {
6988
+ if (this.vertexes.length <= 3) return;
6989
+ this.vertexes.splice(i, 1), this.drawPolygon(this.vertexes), this.notifyObservers();
6990
+ }
6991
+ }
6992
+ }
6993
+ canvasMousemove(e) {
6994
+ e.stopPropagation();
6995
+ const {offsetX: x, offsetY: y} = e;
6996
+ this.pointInVertexesOrEdgeCentre(x, y), this.isMoveEditing && (this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
6997
+ this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
6998
+ this.notifyObservers());
6999
+ }
7000
+ destroyed() {
7001
+ this.vertexes = [], this.observers = [], this.isEditing = !1, this.canvas.removeEventListener("mousedown", this.canvasMousedown),
7002
+ this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("click", this.canvasMouseClick),
7003
+ this.canvas.removeEventListener("mousemove", this.canvasMousemove);
7004
+ }
7005
+ }
7006
+ class CreateDrawCanvas {
7007
+ canvas;
7008
+ ctx;
7009
+ image;
7010
+ canvasWidth;
7011
+ canvasHeight;
7012
+ paths;
7013
+ editDrawPolygon;
7014
+ createPolygonVertexes;
7015
+ editVertexes;
7016
+ editPolygonObservers=[];
7017
+ constructor(options) {
7018
+ const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, paths: paths} = options;
7019
+ this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
7020
+ this.canvasHeight = canvasHeight, this.paths = paths || [], this.editVertexes = [],
7021
+ this.render(), this.editDrawPolygon = new EditPolygonPath(canvas, ctx), this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx),
7022
+ this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
7023
+ this.render(), this.editDrawPolygon.drawPolygon(vertexes, mouseOffset), this.editVertexes = vertexes,
7024
+ this.notifyObservers();
7025
+ })), this.createPolygonVertexes.onDestroyed((vertexes => {
7026
+ this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editDrawPolygon.updatePolygon((vertexes => {
7027
+ this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editVertexes = vertexes,
7028
+ this.notifyObservers();
7029
+ }));
7030
+ }));
7031
+ }
7032
+ notifyObservers() {
7033
+ this.editPolygonObservers.forEach((listener => {
7034
+ listener(this.editVertexes);
7035
+ }));
7036
+ }
7037
+ updatePolygon(callback) {
7038
+ this.editPolygonObservers.push(callback);
7039
+ }
7040
+ drawPolygons(paths) {
7041
+ const ctx = this.ctx;
7042
+ for (let i = 0; i < paths.length; i++) {
7043
+ const path = paths[i].path;
7044
+ if (!path.length) return;
7045
+ const color = colors[i % colors.length];
7046
+ ctx.beginPath(), ctx.lineWidth = 2, ctx.strokeStyle = color, ctx.fillStyle = hexToRgba(color, .2),
7047
+ ctx.moveTo(path[0][0], path[0][1]);
7048
+ for (let i = 1; i < path.length; i++) {
7049
+ const [x, y] = path[i];
7050
+ ctx.lineTo(x, y);
7051
+ }
7052
+ ctx.closePath(), ctx.stroke(), ctx.fill();
7053
+ }
7054
+ }
7055
+ initCanvas=() => {
7056
+ this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.ctx.drawImage(this.image, 0, 0, this.canvasWidth, this.canvasHeight),
7057
+ this.drawPolygons(this.paths);
7058
+ };
7059
+ render=() => {
7060
+ this.initCanvas();
7061
+ };
7062
+ destroyed() {
7063
+ this.paths = [], this.editDrawPolygon.destroyed(), this.createPolygonVertexes.destroyed();
7064
+ }
7065
+ }
7066
+ var CanvasContext = vue.defineComponent({
7067
+ props: {
7068
+ classes: {
7069
+ type: Array,
7070
+ default: () => []
7071
+ },
7072
+ contextClientHeight: {
7073
+ type: Number,
7074
+ default: null
7075
+ },
7076
+ rowInfo: {
7077
+ type: Object,
7078
+ default: () => ({})
7079
+ }
7080
+ },
7081
+ emits: [ "editPolygon" ],
7082
+ setup(props, {emit: emit}) {
7083
+ const ns = vue.inject("ns", {}), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), loadingImage = vue.ref(!1), renderImageLabel = rowInfo => {
7084
+ const clientHeight = canvasMainRef.value?.clientHeight, ctx = canvasBaseRef.value?.getContext("2d");
7085
+ if (rowInfo?.imageSrc) {
7086
+ const image = new Image;
7087
+ image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
7088
+ loadingImage.value = !1;
7089
+ let {width: width, height: height} = image;
7090
+ if (height > clientHeight) {
7091
+ const scale = height / clientHeight;
7092
+ height = clientHeight, image.style.height = height + "px", width /= scale;
7093
+ }
7094
+ const canvasHeight = height, scaleFactor = parseFloat((canvasHeight / height).toFixed(3)), canvasWidth = Math.ceil(width * scaleFactor);
7095
+ ((canvasWidth, canvasHeight) => {
7096
+ canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
7097
+ canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
7098
+ canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
7099
+ })(canvasWidth, canvasHeight), drawCanvas.value = new CreateDrawCanvas({
7100
+ canvas: canvasBaseRef.value,
7101
+ ctx: ctx,
7102
+ image: image,
7103
+ canvasWidth: canvasWidth,
7104
+ canvasHeight: canvasHeight,
7105
+ scaleFactor: scaleFactor,
7106
+ paths: rowInfo.labels
7107
+ }), drawCanvas.value.updatePolygon((vertexes => {
7108
+ emit("editPolygon", {
7109
+ vertexes: vertexes,
7110
+ canvasWidth: canvasWidth,
7111
+ canvasHeight: canvasHeight
7112
+ });
7113
+ }));
7114
+ }, image.onerror = () => {
7115
+ loadingImage.value = !1;
7116
+ };
7117
+ }
7118
+ };
7119
+ vue.onMounted((() => {
7120
+ vue.watch((() => props.rowInfo), (info => {
7121
+ const rowInfo = vue.toRaw(info);
7122
+ renderImageLabel(rowInfo);
7123
+ }), {
7124
+ deep: !0,
7125
+ immediate: !0
7126
+ }), vue.watch((() => props.contextClientHeight), (height => {
7127
+ if (valueExist(height)) {
7128
+ canvasMainRef.value.style.height = height + "px";
7129
+ const rowInfo = vue.toRaw(props.rowInfo);
7130
+ renderImageLabel(rowInfo);
7131
+ }
7132
+ }));
7133
+ }));
7134
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
7135
+ loading: loadingImage.value,
7136
+ class: [ ns.b("loading") ]
7137
+ }, {
7138
+ default: () => [ vue.createVNode("div", {
7139
+ ref: canvasMainRef,
7140
+ class: [ ns.b("canvas") ]
7141
+ }, [ vue.createVNode("canvas", {
7142
+ ref: canvasBaseRef,
7143
+ class: [ ns.be("canvas", "context") ]
7144
+ }, null) ]) ]
7145
+ }) ]);
7146
+ }
7147
+ }), defaultConfig = {
7148
+ minContentHeight: 500
7149
+ };
7150
+ const ns = useNamespace("labelme");
7151
+ const NextLabelme = withInstall(vue.defineComponent({
7152
+ name: "NextLabelme",
7153
+ props: {
7154
+ className: {
7155
+ type: String,
7156
+ default: ""
7157
+ },
7158
+ style: {
7159
+ type: Object,
7160
+ default: () => ({})
7161
+ },
7162
+ options: {
7163
+ type: Object,
7164
+ default: () => ({})
7165
+ },
7166
+ classes: {
7167
+ type: Array,
7168
+ default: () => []
7169
+ },
7170
+ data: {
7171
+ type: Array,
7172
+ default: () => []
7173
+ }
7174
+ },
7175
+ emits: [ "change", "edit-polygon" ],
7176
+ setup(props, {emit: emit}) {
7177
+ const _config = deepClone(defaultConfig), _options = vue.computed((() => {
7178
+ const cfg = vue.unref(props.options);
7179
+ return merge$1(_config, cfg);
7180
+ })), options = vue.unref(_options);
7181
+ vue.provide("ns", ns), useLocale();
7182
+ const activateNodeIndex = vue.ref(0), classes = vue.ref(props.classes), labelImages = vue.ref(deepClone(props.data));
7183
+ vue.watch((() => props.data), (data => {
7184
+ labelImages.value = deepClone(data);
7185
+ }), {
7186
+ deep: !0
7187
+ }), vue.watch((() => props.data.length), (() => {
7188
+ activateNodeIndex.value = 0;
7189
+ })), vue.watch((() => props.classes), (val => {
7190
+ classes.value = val;
7191
+ }), {
7192
+ deep: !0
7193
+ });
7194
+ const currentNode = vue.computed((() => {
7195
+ if (!labelImages.value) return {};
7196
+ const node = labelImages.value[activateNodeIndex.value] || {};
7197
+ return deepClone(node);
7198
+ })), mainContentHeight = vue.ref(options.minContentHeight), mainRef = vue.ref(), isFullscreen = vue.ref(!1), onEditPlygonChange = plygon => {
7199
+ emit("edit-polygon", plygon);
7200
+ };
7201
+ return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
7202
+ class: [ ns.b(), props.className, isFullscreen.value ? ns.b("fullscreen") : "" ],
7203
+ style: {
7204
+ ...props.style
7205
+ }
7206
+ }, [ vue.createVNode("div", {
7207
+ ref: mainRef,
7208
+ class: [ ns.b("main") ]
7209
+ }, [ vue.createVNode("div", {
7210
+ class: [ ns.be("main", "content") ],
7211
+ style: {
7212
+ height: mainContentHeight.value + "px"
7213
+ }
7214
+ }, [ vue.createVNode(CanvasContext, {
7215
+ rowInfo: currentNode.value,
7216
+ onEditPolygon: onEditPlygonChange
7217
+ }, null) ]) ]) ]) ]);
7218
+ }
7219
+ }));
6801
7220
  var components = Object.freeze({
6802
7221
  __proto__: null,
6803
7222
  NextContainer: NextContainer,
@@ -6808,6 +7227,7 @@
6808
7227
  NextForm: NextForm,
6809
7228
  NextLabelimg: NextLabelimg,
6810
7229
  NextLabelimgPreview: NextLabelimgPreview,
7230
+ NextLabelme: NextLabelme,
6811
7231
  NextLayout: NextLayout,
6812
7232
  NextMenu: NextMenu,
6813
7233
  NextSpinLoading: NextSpinLoading,
@@ -6858,19 +7278,20 @@
6858
7278
  })(app);
6859
7279
  };
6860
7280
  var index = {
6861
- version: "0.3.2",
7281
+ version: "0.3.3",
6862
7282
  install: install
6863
7283
  };
6864
7284
  exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
6865
7285
  exports.NextDialog = NextDialog, exports.NextDragResize = NextDragResize, exports.NextForm = NextForm,
6866
7286
  exports.NextLabelimg = NextLabelimg, exports.NextLabelimgPreview = NextLabelimgPreview,
6867
- exports.NextLayout = NextLayout, exports.NextMenu = NextMenu, exports.NextSpinLoading = NextSpinLoading,
6868
- exports.NextTabs = NextTabs, exports.NextTextEllipsis = NextTextEllipsis, exports.NextTreeSelect = NextTreeSelect,
6869
- exports.NextUpload = NextUpload, exports.NextVideoPlayer = NextVideoPlayer, exports.buildLocaleContext = buildLocaleContext,
6870
- exports.buildTranslator = buildTranslator, exports.default = index, exports.defaultNamespace = "next",
6871
- exports.install = install, exports.localeContextKey = localeContextKey, exports.localeLang = localeLang,
6872
- exports.namespaceContextKey = namespaceContextKey, exports.nextUseCssTheme = nextUseCssTheme,
6873
- exports.nextUseCssVar = nextUseCssVar, exports.translate = translate, exports.updateThemeColor = color => {
7287
+ exports.NextLabelme = NextLabelme, exports.NextLayout = NextLayout, exports.NextMenu = NextMenu,
7288
+ exports.NextSpinLoading = NextSpinLoading, exports.NextTabs = NextTabs, exports.NextTextEllipsis = NextTextEllipsis,
7289
+ exports.NextTreeSelect = NextTreeSelect, exports.NextUpload = NextUpload, exports.NextVideoPlayer = NextVideoPlayer,
7290
+ exports.buildLocaleContext = buildLocaleContext, exports.buildTranslator = buildTranslator,
7291
+ exports.default = index, exports.defaultNamespace = "next", exports.install = install,
7292
+ exports.localeContextKey = localeContextKey, exports.localeLang = localeLang, exports.namespaceContextKey = namespaceContextKey,
7293
+ exports.nextUseCssTheme = nextUseCssTheme, exports.nextUseCssVar = nextUseCssVar,
7294
+ exports.translate = translate, exports.updateThemeColor = color => {
6874
7295
  color && nextUseCssTheme("--el-color-primary", color);
6875
7296
  }, exports.updateThemeColorCssVar = updateThemeColorCssVar, exports.useDetectVideo = () => ({
6876
7297
  detectVideoFrameImage: ({container: container, video: video, modelUrl: modelUrl, classNames: classNames, classInput: classInput = []}, success, error) => modelUrl ? classNames ? void tf__namespace.loadGraphModel(modelUrl).then((model => {
@@ -6904,7 +7325,7 @@
6904
7325
  }), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
6905
7326
  const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
6906
7327
  localeRef.value.name = lang, localeRef.value.next = nextLang.next;
6907
- }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.2",
7328
+ }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.3",
6908
7329
  Object.defineProperty(exports, "__esModule", {
6909
7330
  value: !0
6910
7331
  });