next-element-vue 0.3.7 → 0.3.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.3.7 v
6
- * 发布日期:2024-09-21
5
+ * 当前版本:0.3.9 v
6
+ * 发布日期:2024-11-12
7
7
  * 地  址:https://www.npmjs.com/package/next-element-vue
8
8
  */
9
9
 
@@ -1813,15 +1813,18 @@
1813
1813
  return isHeaderBarColorGradual ? {
1814
1814
  background: `linear-gradient(to bottom , ${color}, ${getLightColor$3(color, .5)})`
1815
1815
  } : "";
1816
- }));
1817
- return vue.createVNode("header", {
1816
+ })), __slots_header_tools = {};
1817
+ return slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
1818
+ slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]()),
1819
+ vue.createVNode("header", {
1818
1820
  class: _ns.b("header"),
1819
1821
  style: headerStyle.value
1820
1822
  }, [ vue.createVNode(LogoView, null, null), vue.createVNode("div", {
1821
1823
  class: _ns.bf("header", "right")
1822
- }, [ vue.createVNode(HeaderTools, null, {
1823
- default: () => [ slots[slots_config_headerToolsPrefix]?.(), slots[slots_config_headerToolsSuffix]?.() ]
1824
- }) ]) ]);
1824
+ }, [ vue.createVNode(HeaderTools, null, (s = __slots_header_tools, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header_tools : {
1825
+ default: () => [ __slots_header_tools ]
1826
+ })) ]) ]);
1827
+ var s;
1825
1828
  }
1826
1829
  });
1827
1830
  function getDefaultExportFromCjs(x) {
@@ -2635,21 +2638,29 @@
2635
2638
  render() {
2636
2639
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {});
2637
2640
  slots.menu;
2641
+ const __slots_header_tools = {};
2642
+ slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
2643
+ slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2638
2644
  const isTabs = vue.ref(!!slots.tabs);
2639
2645
  return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(elementPlus.ElContainer, {
2640
2646
  class: ns$j.b()
2641
2647
  }, {
2642
- default: () => [ vue.createVNode(Sidebar$2, null, null), vue.createVNode("div", {
2643
- class: [ ns$j.b("content") ]
2644
- }, [ vue.createVNode(Header$3, null, null), _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
2645
- tabs: _config.tabs,
2646
- activeTab: _config.activeTab,
2647
- onChange: (...arg) => _emit("tabsChange", ...arg),
2648
- onSelect: (...arg) => _emit("tabsSelect", ...arg),
2649
- onClose: (...arg) => _emit("tabsClose", ...arg)
2650
- }, null) : null, vue.createVNode("main", {
2651
- class: [ ns$j.bf("main"), ns$j.is("layout-tabs", isTabs.value) ]
2652
- }, [ slots.default?.() ]) ]) ]
2648
+ default: () => {
2649
+ return [ vue.createVNode(Sidebar$2, null, null), vue.createVNode("div", {
2650
+ class: [ ns$j.b("content") ]
2651
+ }, [ vue.createVNode(Header$3, null, (s = __slots_header_tools, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header_tools : {
2652
+ default: () => [ __slots_header_tools ]
2653
+ })), _config.showTabs ? slots.tabs ? slots.tabs?.() : vue.createVNode(NextTabs, {
2654
+ tabs: _config.tabs,
2655
+ activeTab: _config.activeTab,
2656
+ onChange: (...arg) => _emit("tabsChange", ...arg),
2657
+ onSelect: (...arg) => _emit("tabsSelect", ...arg),
2658
+ onClose: (...arg) => _emit("tabsClose", ...arg)
2659
+ }, null) : null, vue.createVNode("main", {
2660
+ class: [ ns$j.bf("main"), ns$j.is("layout-tabs", isTabs.value) ]
2661
+ }, [ slots.default?.() ]) ]) ];
2662
+ var s;
2663
+ }
2653
2664
  });
2654
2665
  }
2655
2666
  });
@@ -2661,21 +2672,26 @@
2661
2672
  return isHeaderBarColorGradual ? {
2662
2673
  background: `linear-gradient(to bottom , ${color}, ${getLightColor$2(color, .5)})`
2663
2674
  } : "";
2664
- }));
2665
- return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("header", {
2666
- class: _ns.b("header"),
2667
- style: headerStyle.value
2668
- }, [ vue.createVNode(LogoView, null, null), vue.createVNode("div", {
2669
- class: _ns.bf("header", "menu")
2670
- }, [ slots[slots_config_headerMenu] ? slots[slots_config_headerMenu]() : vue.createVNode(NextMenu, {
2671
- menuTree: _config.menuTree,
2672
- router: _config.menuRouter,
2673
- mode: _config.menuMode
2674
- }, null) ]), vue.createVNode("div", {
2675
- class: _ns.bf("header", "right")
2676
- }, [ vue.createVNode(HeaderTools, null, {
2677
- default: () => [ slots[slots_config_headerToolsPrefix]?.(), slots[slots_config_headerToolsSuffix]?.() ]
2678
- }) ]) ]) ]);
2675
+ })), __slots_header_tools = {};
2676
+ slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
2677
+ slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2678
+ return () => {
2679
+ return vue.createVNode(vue.Fragment, null, [ vue.createVNode("header", {
2680
+ class: _ns.b("header"),
2681
+ style: headerStyle.value
2682
+ }, [ vue.createVNode(LogoView, null, null), vue.createVNode("div", {
2683
+ class: _ns.bf("header", "menu")
2684
+ }, [ slots[slots_config_headerMenu] ? slots[slots_config_headerMenu]() : vue.createVNode(NextMenu, {
2685
+ menuTree: _config.menuTree,
2686
+ router: _config.menuRouter,
2687
+ mode: _config.menuMode
2688
+ }, null) ]), vue.createVNode("div", {
2689
+ class: _ns.bf("header", "right")
2690
+ }, [ vue.createVNode(HeaderTools, null, (s = __slots_header_tools, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header_tools : {
2691
+ default: () => [ __slots_header_tools ]
2692
+ })) ]) ]) ]);
2693
+ var s;
2694
+ };
2679
2695
  }
2680
2696
  });
2681
2697
  const ns$i = useNamespace("layout-transverse");
@@ -2711,17 +2727,22 @@
2711
2727
  return isHeaderBarColorGradual ? {
2712
2728
  background: `linear-gradient(to bottom , ${color}, ${getLightColor$1(color, .5)})`
2713
2729
  } : "";
2714
- }));
2715
- return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("header", {
2716
- class: _ns.b("header"),
2717
- style: headerStyle.value
2718
- }, [ vue.createVNode(LogoView, null, null), vue.createVNode("div", {
2719
- class: _ns.bf("header", "menu")
2720
- }, null), vue.createVNode("div", {
2721
- class: _ns.bf("header", "right")
2722
- }, [ vue.createVNode(HeaderTools, null, {
2723
- default: () => [ slots[slots_config_headerToolsPrefix]?.(), slots[slots_config_headerToolsSuffix]?.() ]
2724
- }) ]) ]) ]);
2730
+ })), __slots_header_tools = {};
2731
+ slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
2732
+ slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2733
+ return () => {
2734
+ return vue.createVNode(vue.Fragment, null, [ vue.createVNode("header", {
2735
+ class: _ns.b("header"),
2736
+ style: headerStyle.value
2737
+ }, [ vue.createVNode(LogoView, null, null), vue.createVNode("div", {
2738
+ class: _ns.bf("header", "menu")
2739
+ }, null), vue.createVNode("div", {
2740
+ class: _ns.bf("header", "right")
2741
+ }, [ vue.createVNode(HeaderTools, null, (s = __slots_header_tools, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header_tools : {
2742
+ default: () => [ __slots_header_tools ]
2743
+ })) ]) ]) ]);
2744
+ var s;
2745
+ };
2725
2746
  }
2726
2747
  }), Sidebar$1 = vue.defineComponent({
2727
2748
  setup: () => ({
@@ -2777,17 +2798,22 @@
2777
2798
  return isHeaderBarColorGradual ? {
2778
2799
  background: `linear-gradient(to bottom , ${color}, ${getLightColor(color, .5)})`
2779
2800
  } : "";
2780
- }));
2781
- return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("header", {
2782
- class: _ns.b("header"),
2783
- style: headerStyle.value
2784
- }, [ vue.createVNode(LogoView, null, null), vue.createVNode("div", {
2785
- class: _ns.bf("header", "menu")
2786
- }, [ slots[slots_config_headerMenu]?.() ]), vue.createVNode("div", {
2787
- class: _ns.bf("header", "right")
2788
- }, [ vue.createVNode(HeaderTools, null, {
2789
- default: () => [ slots[slots_config_headerToolsPrefix]?.(), slots[slots_config_headerToolsSuffix]?.() ]
2790
- }) ]) ]) ]);
2801
+ })), __slots_header_tools = {};
2802
+ slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
2803
+ slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2804
+ return () => {
2805
+ return vue.createVNode(vue.Fragment, null, [ vue.createVNode("header", {
2806
+ class: _ns.b("header"),
2807
+ style: headerStyle.value
2808
+ }, [ vue.createVNode(LogoView, null, null), vue.createVNode("div", {
2809
+ class: _ns.bf("header", "menu")
2810
+ }, [ slots[slots_config_headerMenu]?.() ]), vue.createVNode("div", {
2811
+ class: _ns.bf("header", "right")
2812
+ }, [ vue.createVNode(HeaderTools, null, (s = __slots_header_tools, "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header_tools : {
2813
+ default: () => [ __slots_header_tools ]
2814
+ })) ]) ]) ]);
2815
+ var s;
2816
+ };
2791
2817
  }
2792
2818
  }), Sidebar = vue.defineComponent({
2793
2819
  setup: () => ({
@@ -2814,8 +2840,14 @@
2814
2840
  render() {
2815
2841
  const slots = this.$slots, _config = vue.inject("options", {}), _emit = vue.inject("__emit__", {});
2816
2842
  slots.menu;
2843
+ const __slots_header_tools = {};
2844
+ slots[slots_config_headerToolsPrefix] && (__slots_header_tools[slots_config_headerToolsPrefix] = () => slots[slots_config_headerToolsPrefix]()),
2845
+ slots[slots_config_headerToolsSuffix] && (__slots_header_tools[slots_config_headerToolsSuffix] = () => slots[slots_config_headerToolsSuffix]());
2817
2846
  const isTabs = vue.ref(!!slots.tabs);
2818
- return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(vue.Fragment, null, [ vue.createVNode(Header, null, null), vue.createVNode("div", {
2847
+ return void 0 === slots.tabs && _config.showTabs && (isTabs.value = !0), vue.createVNode(vue.Fragment, null, [ vue.createVNode(Header, null, (s = __slots_header_tools,
2848
+ "function" == typeof s || "[object Object]" === Object.prototype.toString.call(s) && !vue.isVNode(s) ? __slots_header_tools : {
2849
+ default: () => [ __slots_header_tools ]
2850
+ })), vue.createVNode("div", {
2819
2851
  class: [ ns$g.b("content"), ns$g.is("layout-tabs", isTabs.value) ]
2820
2852
  }, [ vue.createVNode(Sidebar, null, null), vue.createVNode("div", {
2821
2853
  class: ns$g.b("container")
@@ -2828,6 +2860,7 @@
2828
2860
  }, null) : null, vue.createVNode("main", {
2829
2861
  class: [ ns$g.b("main") ]
2830
2862
  }, [ slots.default?.() ]) ]) ]) ]);
2863
+ var s;
2831
2864
  }
2832
2865
  });
2833
2866
  const ns$f = useNamespace("layout"), layouts = {
@@ -3808,7 +3841,11 @@
3808
3841
  const {operationsBtnPlain: operationsBtnPlain, operationsBtnText: operationsBtnText} = options;
3809
3842
  return operationsBtnText || operationsBtnPlain;
3810
3843
  })), renderContent = () => {
3811
- const btnText = options.operationsBtnText, btnPlain = options.operationsBtnPlain, btnSize = options.operationsBtnSize;
3844
+ const btnText = options.operationsBtnText, btnPlain = options.operationsBtnPlain, btnSize = options.operationsBtnSize, btnCfg = {
3845
+ text: btnText,
3846
+ plain: btnPlain,
3847
+ size: btnSize
3848
+ };
3812
3849
  return vue.createVNode(elementPlus.ElTableColumn, {
3813
3850
  fixed: "right",
3814
3851
  label: t("next.table.operation"),
@@ -3816,10 +3853,9 @@
3816
3853
  headerAlign: valueExist(options.operationsHeaderAlign, options.headerAlign),
3817
3854
  align: valueExist(options.operationsColumnAlign, options.cellAlign)
3818
3855
  }, {
3819
- default: scoped => vue.createVNode(vue.Fragment, null, [ slots["operation-column-prefix"]?.(scoped, {
3820
- text: btnText,
3821
- plain: btnPlain,
3822
- size: btnSize
3856
+ default: scoped => vue.createVNode(vue.Fragment, null, [ slots["operation-column-prefix"]?.({
3857
+ scoped: scoped,
3858
+ btn: btnCfg
3823
3859
  }), options.editBtn ? vue.createVNode(elementPlus.ElTooltip, {
3824
3860
  enterable: !1,
3825
3861
  effect: "dark",
@@ -3899,10 +3935,9 @@
3899
3935
  }),
3900
3936
  default: () => t("next.table.delete")
3901
3937
  }) ]
3902
- }) : null, slots["operation-column-suffix"]?.(scoped, {
3903
- text: btnText,
3904
- plain: btnPlain,
3905
- size: btnSize
3938
+ }) : null, slots["operation-column-suffix"]?.({
3939
+ scoped: scoped,
3940
+ btn: btnCfg
3906
3941
  }) ])
3907
3942
  });
3908
3943
  };
@@ -4637,9 +4672,9 @@
4637
4672
  return vue.createVNode(elementPlus.ElInput, {
4638
4673
  modelValue: formParams[col.prop],
4639
4674
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4640
- clearable: !0,
4675
+ clearable: valueExist(col.clearable, !0),
4641
4676
  readonly: valueExist(col.readonly, !1),
4642
- disabled: col.disabled,
4677
+ disabled: valueExist(col.disabled, !1),
4643
4678
  placeholder: placeholder,
4644
4679
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
4645
4680
  }, {
@@ -4655,7 +4690,7 @@
4655
4690
  modelValue: formParams[col.prop],
4656
4691
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4657
4692
  type: "password",
4658
- clearable: !0,
4693
+ clearable: valueExist(col.clearable, !0),
4659
4694
  "show-password": !0,
4660
4695
  readonly: valueExist(col.readonly, !1),
4661
4696
  disabled: col.disabled,
@@ -4673,7 +4708,7 @@
4673
4708
  return vue.createVNode(elementPlus.ElInput, {
4674
4709
  modelValue: formParams[col.prop],
4675
4710
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4676
- clearable: !0,
4711
+ clearable: valueExist(col.clearable, !0),
4677
4712
  readonly: valueExist(col.readonly, !1),
4678
4713
  disabled: col.disabled,
4679
4714
  placeholder: placeholder,
@@ -4694,7 +4729,7 @@
4694
4729
  return vue.createVNode(elementPlus.ElInput, {
4695
4730
  modelValue: formParams[col.prop],
4696
4731
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4697
- clearable: !0,
4732
+ clearable: valueExist(col.clearable, !0),
4698
4733
  readonly: valueExist(col.readonly, !1),
4699
4734
  disabled: col.disabled,
4700
4735
  placeholder: placeholder,
@@ -4718,7 +4753,7 @@
4718
4753
  modelValue: formParams[col.prop],
4719
4754
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4720
4755
  type: "textarea",
4721
- clearable: !0,
4756
+ clearable: valueExist(col.clearable, !0),
4722
4757
  readonly: valueExist(col.readonly, !1),
4723
4758
  disabled: col.disabled,
4724
4759
  placeholder: placeholder,
@@ -4736,8 +4771,9 @@
4736
4771
  modelValue: formParams[col.prop],
4737
4772
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4738
4773
  placeholder: placeholder,
4739
- clearable: !0,
4740
- disabled: col.disabled,
4774
+ clearable: valueExist(col.clearable, !0),
4775
+ disabled: valueExist(col.disabled, !1),
4776
+ readonly: valueExist(col.readonly, !1),
4741
4777
  multiple: valueExist(col.multiple, !1),
4742
4778
  "collapse-tags-tooltip": !0,
4743
4779
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
@@ -4758,8 +4794,10 @@
4758
4794
  start: "00:00",
4759
4795
  step: "00:30",
4760
4796
  end: "23:59",
4761
- editable: !1,
4762
- disabled: col.disabled,
4797
+ clearable: valueExist(col.clearable, !0),
4798
+ editable: valueExist(col.editable, !1),
4799
+ disabled: valueExist(col.disabled, !1),
4800
+ readonly: valueExist(col.readonly, !1),
4763
4801
  placeholder: placeholder,
4764
4802
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
4765
4803
  }, {
@@ -4770,7 +4808,8 @@
4770
4808
  if ("radio" === col.type) return vue.createVNode(elementPlus.ElRadioGroup, {
4771
4809
  modelValue: formParams[col.prop],
4772
4810
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4773
- disabled: col.disabled,
4811
+ disabled: valueExist(col.disabled, !1),
4812
+ readonly: valueExist(col.readonly, !1),
4774
4813
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
4775
4814
  }, {
4776
4815
  default: () => [ col.dicData && col.dicData.map((item => vue.createVNode(elementPlus.ElRadio, {
@@ -4785,7 +4824,8 @@
4785
4824
  vue.createVNode(elementPlus.ElCheckboxGroup, {
4786
4825
  modelValue: formParams[col.prop],
4787
4826
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4788
- disabled: col.disabled,
4827
+ disabled: valueExist(col.disabled, !1),
4828
+ readonly: valueExist(col.readonly, !1),
4789
4829
  onChange: event => col.onChange?.(event, col, formParams, formColumns)
4790
4830
  }, {
4791
4831
  default: () => [ col.dicData && col.dicData.map((item => vue.createVNode(elementPlus.ElCheckbox, {
@@ -4805,10 +4845,11 @@
4805
4845
  type: "date",
4806
4846
  valueFormat: col.format || "YYYY-MM-DD",
4807
4847
  format: col.format || "YYYY-MM-DD",
4808
- clearable: !0,
4848
+ clearable: valueExist(col.clearable, !0),
4809
4849
  disabledDate: col.disabledDate || _defaultDisabledDate,
4810
- disabled: col.disabled,
4811
- editable: col.editable
4850
+ editable: valueExist(col.editable, !1),
4851
+ disabled: valueExist(col.disabled, !1),
4852
+ readonly: valueExist(col.readonly, !1)
4812
4853
  }, null);
4813
4854
  }
4814
4855
  if ("datetime" === col.type) {
@@ -4820,10 +4861,11 @@
4820
4861
  type: "datetime",
4821
4862
  valueFormat: col.format || "YYYY-MM-DD HH:mm:ss",
4822
4863
  format: col.format || "YYYY-MM-DD HH:mm:ss",
4823
- clearable: !0,
4864
+ clearable: valueExist(col.clearable, !0),
4824
4865
  disabledDate: col.disabledDate || _defaultDisabledDate,
4825
- disabled: col.disabled,
4826
- editable: col.editable
4866
+ editable: valueExist(col.editable, !1),
4867
+ disabled: valueExist(col.disabled, !1),
4868
+ readonly: valueExist(col.readonly, !1)
4827
4869
  }, null);
4828
4870
  }
4829
4871
  if ("datetimerange" === col.type) {
@@ -4835,13 +4877,14 @@
4835
4877
  type: "datetimerange",
4836
4878
  valueFormat: col.format || "YYYY-MM-DD HH:mm:ss",
4837
4879
  format: col.format || "YYYY-MM-DD HH:mm:ss",
4838
- clearable: !0,
4839
4880
  "range-separator": t("next.date.rangeSeparator"),
4840
4881
  "start-placeholder": t("next.date.startPlaceholder"),
4841
4882
  "end-placeholder": t("next.date.endPlaceholder"),
4842
4883
  disabledDate: col.disabledDate || _defaultDisabledDate,
4843
- disabled: col.disabled,
4844
- editable: col.editable,
4884
+ clearable: valueExist(col.clearable, !0),
4885
+ editable: valueExist(col.editable, !1),
4886
+ disabled: valueExist(col.disabled, !1),
4887
+ readonly: valueExist(col.readonly, !1),
4845
4888
  shortcuts: col.shortcuts || _defaultShortcuts
4846
4889
  }, null);
4847
4890
  }
@@ -4859,7 +4902,7 @@
4859
4902
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4860
4903
  formParams: formParams,
4861
4904
  column: col,
4862
- disabled: col.disabled,
4905
+ disabled: valueExist(col.disabled, !1),
4863
4906
  onSelect: rows => ((rows, col) => {
4864
4907
  rows && (col.tableSelectRows = rows);
4865
4908
  const {value: value} = col.tableSelectProps || {};
@@ -4868,15 +4911,15 @@
4868
4911
  }, null) : "uploadImage" === col.type ? vue.createVNode(UploadImage, {
4869
4912
  modelValue: formParams[col.prop],
4870
4913
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4871
- disabled: col.disabled,
4872
- multiple: col.multiple,
4914
+ disabled: valueExist(col.disabled, !1),
4915
+ multiple: valueExist(col.multiple, !1),
4873
4916
  limit: col.limit,
4874
4917
  onChange: (...arg) => col.onChange?.(...arg, col, formParams, formColumns),
4875
4918
  onExceed: (...arg) => col.onExceed?.(...arg, col, formParams, formColumns)
4876
4919
  }, null) : "treeSelect" === col.type ? vue.createVNode(treeSelect, {
4877
4920
  modelValue: formParams[col.prop],
4878
4921
  "onUpdate:modelValue": $event => formParams[col.prop] = $event,
4879
- disabled: col.disabled,
4922
+ disabled: valueExist(col.disabled, !1),
4880
4923
  column: col,
4881
4924
  formParams: formParams
4882
4925
  }, null) : void 0;
@@ -5048,7 +5091,7 @@
5048
5091
  append: valueExist(col.formAppend, col.append, null),
5049
5092
  hide: valueExist(col.formHide, col.hide, !1),
5050
5093
  disabled: valueExist(col.formDisabled, col.disabled, !1),
5051
- clearable: valueExist(col.formClearable, col.clearable, !1),
5094
+ clearable: valueExist(col.formClearable, col.clearable, !0),
5052
5095
  readonly: valueExist(col.formReadonly, col.readonly, !1),
5053
5096
  tip: valueExist(col.formTip, col.tip, null),
5054
5097
  rules: valueExist(col.formRules, col.rules, null),
@@ -6356,12 +6399,14 @@
6356
6399
  canvas.width = canvasWidth, scaleOffset.value && (ctx.save(), ctx.translate(scaleOffset.value.x, scaleOffset.value.y),
6357
6400
  ctx.scale(scaleOffset.value.scale, scaleOffset.value.scale)), ctx.clearRect(0, 0, canvasWidth, canvasHeight),
6358
6401
  ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
6402
+ const scale = scaleOffset.value?.scale || 1, fontSize = 14 / scale, fontPadding = 6 / scale, lineWidth = 2 / scale;
6359
6403
  for (let i = 0; i < labels.length; i++) {
6360
6404
  const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors$1[type % colors$1.length];
6361
- if (ctx.font = "bold 14px serif", ctx.textBaseline = "top", ctx.save(), ctx.strokeStyle = color,
6362
- ctx.strokeRect(startX, startY, rectWidth, rectHeight), isValueExist(rect.typeName) || isValueExist(rect.type)) {
6405
+ if (ctx.font = `bold ${fontSize}px serif`, ctx.textBaseline = "top", ctx.save(),
6406
+ ctx.strokeStyle = color, ctx.lineWidth = lineWidth, ctx.strokeRect(startX, startY, rectWidth, rectHeight),
6407
+ isValueExist(rect.typeName) || isValueExist(rect.type)) {
6363
6408
  const text = rect.typeName || rect.type;
6364
- ctx.fillStyle = color, ctx.fillText(text, startX + 6, startY + 6);
6409
+ ctx.fillStyle = color, ctx.fillText(text, startX + fontPadding, startY + fontPadding);
6365
6410
  }
6366
6411
  ctx.restore();
6367
6412
  }
@@ -6369,8 +6414,10 @@
6369
6414
  return updateLabels(), {
6370
6415
  updateLabels: updateLabels,
6371
6416
  addDrawRect: (rect, color = "#f30635") => {
6372
- const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
6373
- ctx.save(), ctx.strokeStyle = color, ctx.strokeRect(startX, startY, rectWidth, rectHeight),
6417
+ const scale = scaleOffset.value?.scale || 1, {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
6418
+ ctx.save();
6419
+ const lineWidth = 2 / scale;
6420
+ ctx.lineWidth = lineWidth, ctx.strokeStyle = color, ctx.strokeRect(startX, startY, rectWidth, rectHeight),
6374
6421
  ctx.restore();
6375
6422
  },
6376
6423
  hitCanvasLabel: (x, y) => {
@@ -7025,7 +7072,10 @@
7025
7072
  }, null) ]) ]);
7026
7073
  }
7027
7074
  });
7028
- 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" ];
7075
+ 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))), vertexesToScale = (vertexes, scaleX, scaleY, isMultiply = !0) => vertexes?.length ? vertexes.map((item => ((vertex, scaleX, scaleY, isMultiply = !0) => {
7076
+ const [x, y] = vertex;
7077
+ return isMultiply ? [ x * scaleX, y * scaleY ] : [ x / scaleX, y / scaleY ];
7078
+ })(item, scaleX, scaleY, isMultiply))) : [], {hexToRgba: hexToRgba} = useChangeColor(), colors = [ "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ];
7029
7079
  class CreatePolygonVertexes {
7030
7080
  canvas;
7031
7081
  ctx;
@@ -7081,9 +7131,9 @@
7081
7131
  canvasMouseDblclick(e) {
7082
7132
  e.stopPropagation(), this.isDrawing && (this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
7083
7133
  this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes)),
7084
- this.notifyDestryedListerers(), this.destroyed();
7134
+ this.notifyDestryedListerers(), this.destroy();
7085
7135
  }
7086
- destroyed() {
7136
+ destroy() {
7087
7137
  this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.destroyedObservers = () => {
7088
7138
  this.canvas.removeEventListener("click", this.canvasMouseClick);
7089
7139
  }, this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
@@ -7102,11 +7152,22 @@
7102
7152
  edgeCentreRadius;
7103
7153
  pointRecover;
7104
7154
  observers=[];
7155
+ editPolygonObserver;
7105
7156
  constructor(canvas, ctx) {
7106
7157
  this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
7107
7158
  this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
7108
7159
  this.vertexRadius = 8, this.edgeCentreRadius = 5, this.pointRecover = [];
7109
7160
  }
7161
+ notifyEditPolygonObserver() {
7162
+ this.editPolygonObserver?.(this.vertexes);
7163
+ }
7164
+ onEditPolygon(callback) {
7165
+ this.editPolygonObserver = callback;
7166
+ }
7167
+ getTransformPoint(x, y) {
7168
+ const transformMatrix = this.ctx.getTransform(), scaleX = parseFloat(transformMatrix.a.toFixed(1)), scaleY = parseFloat(transformMatrix.d.toFixed(1)), translateX = Math.ceil(transformMatrix.e), translateY = Math.ceil(transformMatrix.f);
7169
+ return [ Math.floor((x - translateX) / scaleX), Math.floor((y - translateY) / scaleY) ];
7170
+ }
7110
7171
  drawPolygonPath(vertexes, mouseX, mouseY) {
7111
7172
  const ctx = this.ctx;
7112
7173
  if (!vertexes.length) return;
@@ -7138,11 +7199,11 @@
7138
7199
  this.drawPolygonEdgeCentre(vertexes));
7139
7200
  }
7140
7201
  pointInVertexes(x, y) {
7141
- const vertexes = this.vertexes;
7202
+ const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
7142
7203
  let aimIndex = null;
7143
7204
  for (let i = 0; i < vertexes.length; i++) {
7144
7205
  const [vertex_x, vertex_y] = vertexes[i];
7145
- if (isPointInCircle(x, y, vertex_x, vertex_y, this.vertexRadius)) {
7206
+ if (isPointInCircle(_x, _y, vertex_x, vertex_y, this.vertexRadius)) {
7146
7207
  this.canvas.style.cursor = "pointer", aimIndex = i;
7147
7208
  break;
7148
7209
  }
@@ -7151,11 +7212,11 @@
7151
7212
  return aimIndex;
7152
7213
  }
7153
7214
  pointInEdgeCentre(x, y) {
7154
- const vertexes = this.vertexes;
7215
+ const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
7155
7216
  let aimIndex = null;
7156
7217
  for (let i = 0; i < vertexes.length; i++) {
7157
7218
  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;
7158
- if (isPointInCircle(x, y, vertex_x, vertex_y, this.edgeCentreRadius)) {
7219
+ if (isPointInCircle(_x, _y, vertex_x, vertex_y, this.edgeCentreRadius)) {
7159
7220
  this.canvas.style.cursor = "pointer", aimIndex = i;
7160
7221
  break;
7161
7222
  }
@@ -7164,9 +7225,9 @@
7164
7225
  return aimIndex;
7165
7226
  }
7166
7227
  pointInVertexesOrEdgeCentre(x, y) {
7167
- const vertexes = this.vertexes;
7228
+ const [_x, _y] = this.getTransformPoint(x, y), vertexes = this.vertexes;
7168
7229
  for (let i = 0; i < vertexes.length; i++) {
7169
- 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);
7230
+ 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);
7170
7231
  if (isInVertex || isInEdgeCenter) {
7171
7232
  this.canvas.style.cursor = "pointer";
7172
7233
  break;
@@ -7211,7 +7272,7 @@
7211
7272
  this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
7212
7273
  this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
7213
7274
  this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
7214
- this.drawPolygon(this.vertexes), this.notifyObservers();
7275
+ this.drawPolygon(this.vertexes), this.notifyObservers(), this.notifyEditPolygonObserver();
7215
7276
  }
7216
7277
  canvasMouseClick(e) {
7217
7278
  e.stopPropagation();
@@ -7220,7 +7281,8 @@
7220
7281
  const i = this.pointInVertexes(x, y);
7221
7282
  if (isValueExist(i)) {
7222
7283
  if (this.vertexes.length <= 3) return;
7223
- this.vertexes.splice(i, 1), this.drawPolygon(this.vertexes), this.notifyObservers();
7284
+ this.vertexes.splice(i, 1), this.drawPolygon(this.vertexes), this.notifyObservers(),
7285
+ this.notifyEditPolygonObserver();
7224
7286
  }
7225
7287
  }
7226
7288
  }
@@ -7231,7 +7293,7 @@
7231
7293
  this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
7232
7294
  this.notifyObservers());
7233
7295
  }
7234
- destroyed() {
7296
+ destroy() {
7235
7297
  this.vertexes = [], this.observers = [], this.isEditing = !1, this.canvas.removeEventListener("mousedown", this.canvasMousedown),
7236
7298
  this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("click", this.canvasMouseClick),
7237
7299
  this.canvas.removeEventListener("mousemove", this.canvasMousemove);
@@ -7243,26 +7305,32 @@
7243
7305
  image;
7244
7306
  canvasWidth;
7245
7307
  canvasHeight;
7246
- paths;
7308
+ scaleOffset;
7309
+ labels;
7247
7310
  scaleX;
7248
7311
  scaleY;
7249
7312
  editDrawPolygon;
7250
7313
  createPolygonVertexes;
7251
7314
  editVertexes;
7252
7315
  editPolygonObservers=[];
7316
+ drawnPolygonObserver;
7253
7317
  constructor(options) {
7254
- const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, paths: paths, scaleX: scaleX, scaleY: scaleY} = options;
7318
+ const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, labels: labels, scaleX: scaleX, scaleY: scaleY, scaleOffset: scaleOffset} = options;
7255
7319
  this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
7256
- this.canvasHeight = canvasHeight, this.paths = paths || [], this.scaleX = scaleX || 1,
7257
- this.scaleY = scaleY || 1, this.editVertexes = [], this.render(), this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx),
7258
- this.editDrawPolygon = new EditPolygonPath(canvas, ctx), this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
7320
+ this.canvasHeight = canvasHeight, this.scaleOffset = scaleOffset, this.labels = labels || {},
7321
+ this.scaleX = scaleX || 1, this.scaleY = scaleY || 1, this.editVertexes = [], this.render(),
7322
+ this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx), this.editDrawPolygon = new EditPolygonPath(canvas, ctx),
7323
+ this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
7259
7324
  this.render(), this.editDrawPolygon.drawPolygon(vertexes, mouseOffset), this.editVertexes = vertexes,
7260
7325
  this.notifyObservers();
7261
7326
  })), this.createPolygonVertexes.onDestroyed((vertexes => {
7262
- this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editDrawPolygon.updatePolygon((vertexes => {
7327
+ this.editVertexes = vertexes, this.render(), this.editDrawPolygon.drawPolygon(vertexes),
7328
+ this.editDrawPolygon.updatePolygon((vertexes => {
7263
7329
  this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editVertexes = vertexes,
7264
7330
  this.notifyObservers();
7265
- }));
7331
+ })), this.editDrawPolygon.onEditPolygon((vertexes => {
7332
+ this.editVertexes = vertexes, this.notifyDrawnPolygonObservers();
7333
+ })), this.notifyDrawnPolygonObservers();
7266
7334
  }));
7267
7335
  }
7268
7336
  notifyObservers() {
@@ -7270,17 +7338,22 @@
7270
7338
  listener(this.editVertexes);
7271
7339
  }));
7272
7340
  }
7341
+ notifyDrawnPolygonObservers() {
7342
+ this.drawnPolygonObserver?.(this.editVertexes);
7343
+ }
7273
7344
  updatePolygon(callback) {
7274
7345
  this.editPolygonObservers.push(callback);
7275
7346
  }
7276
- drawPolygons(paths) {
7277
- const ctx = this.ctx;
7278
- ctx.scale(this.scaleX, this.scaleY);
7279
- for (let i = 0; i < paths.length; i++) {
7280
- const path = paths[i].path;
7347
+ onDrawnPolygon(callback) {
7348
+ this.drawnPolygonObserver = callback;
7349
+ }
7350
+ drawPolygons(shapes) {
7351
+ const ctx = this.ctx, {scale: scale} = this.scaleOffset.value, scaleX = this.scaleX, scaleY = this.scaleY;
7352
+ for (let i = 0; i < shapes.length; i++) {
7353
+ const item = shapes[i], path = vertexesToScale(item.points, scaleX, scaleY);
7281
7354
  if (!path.length) return;
7282
7355
  const color = colors[i % colors.length];
7283
- ctx.beginPath(), ctx.lineWidth = 2, ctx.strokeStyle = color, ctx.fillStyle = hexToRgba(color, .2);
7356
+ ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.strokeStyle = color, ctx.fillStyle = hexToRgba(color, .2);
7284
7357
  const startX = path[0][0], startY = path[0][1];
7285
7358
  ctx.moveTo(startX, startY);
7286
7359
  for (let i = 1; i < path.length; i++) {
@@ -7290,15 +7363,18 @@
7290
7363
  ctx.closePath(), ctx.stroke(), ctx.fill();
7291
7364
  }
7292
7365
  }
7293
- initCanvas=() => {
7366
+ drawCanvas=() => {
7294
7367
  this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.ctx.drawImage(this.image, 0, 0, this.canvasWidth, this.canvasHeight),
7295
- this.ctx.save(), this.drawPolygons(this.paths), this.ctx.restore();
7368
+ this.ctx.save();
7369
+ const shapes = this.labels.shapes;
7370
+ shapes?.length && this.drawPolygons(shapes), this.ctx.restore();
7296
7371
  };
7297
7372
  render=() => {
7298
- this.initCanvas();
7373
+ this.canvas.width = this.canvasWidth, this.scaleOffset.value && (this.ctx.translate(this.scaleOffset.value.x, this.scaleOffset.value.y),
7374
+ this.ctx.scale(this.scaleOffset.value.scale, this.scaleOffset.value.scale)), this.drawCanvas();
7299
7375
  };
7300
- destroyed() {
7301
- this.paths = [], this.editDrawPolygon.destroyed(), this.createPolygonVertexes.destroyed();
7376
+ destroy() {
7377
+ this.labels = {}, this.editDrawPolygon.destroy(), this.createPolygonVertexes.destroy();
7302
7378
  }
7303
7379
  }
7304
7380
  var CanvasContext = vue.defineComponent({
@@ -7316,9 +7392,9 @@
7316
7392
  default: () => ({})
7317
7393
  }
7318
7394
  },
7319
- emits: [ "editPolygon" ],
7395
+ emits: [ "editPolygon", "changePolygon" ],
7320
7396
  setup(props, {emit: emit, expose: expose}) {
7321
- const ns = vue.inject("ns", {}), mainBasaeRef = vue.ref(), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), setContainerWidthHeight = (canvasWidth, canvasHeight) => {
7397
+ const ns = vue.inject("ns", {}), scaleTranslateManager = vue.inject("scaleTranslateManager", {}), mainBasaeRef = vue.ref(), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), canvasDragZoom = vue.ref(), setContainerWidthHeight = (canvasWidth, canvasHeight) => {
7322
7398
  canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
7323
7399
  canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
7324
7400
  canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
@@ -7328,7 +7404,7 @@
7328
7404
  const image = new Image;
7329
7405
  image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
7330
7406
  loadingImage.value = !1;
7331
- const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleFactor: scaleFactor, scaleX: scaleX, scaleY: scaleY} = (image => {
7407
+ const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleFactor: scaleFactor, scaleX: scaleX, scaleY: scaleY, originWidth: originWidth, originHeight: originHeight} = (image => {
7332
7408
  const clientWidth = mainBasaeRef.value?.elementInstance.clientWidth, clientHeight = mainBasaeRef.value?.elementInstance.clientHeight;
7333
7409
  let {width: width, height: height} = image, scaleFactor = 1;
7334
7410
  const aspect_ratio = width / height;
@@ -7348,7 +7424,9 @@
7348
7424
  canvasHeight: canvasHeight,
7349
7425
  scaleFactor: scaleFactor,
7350
7426
  scaleX: Number(scaleX),
7351
- scaleY: Number(scaleY)
7427
+ scaleY: Number(scaleY),
7428
+ originWidth: image.width,
7429
+ originHeight: image.height
7352
7430
  };
7353
7431
  })(image);
7354
7432
  image.style.width = canvasWidth + "px", image.style.height = canvasHeight + "px",
@@ -7359,15 +7437,25 @@
7359
7437
  canvasWidth: canvasWidth,
7360
7438
  canvasHeight: canvasHeight,
7361
7439
  scaleFactor: scaleFactor,
7362
- paths: rowInfo.labels,
7440
+ labels: rowInfo.labels,
7363
7441
  scaleX: scaleX,
7364
- scaleY: scaleY
7442
+ scaleY: scaleY,
7443
+ scaleOffset: scaleTranslateManager.scaleTranslate
7365
7444
  }), drawCanvas.value.updatePolygon((vertexes => {
7366
- emit("editPolygon", {
7445
+ emit("changePolygon", {
7367
7446
  vertexes: vertexes,
7368
7447
  canvasWidth: canvasWidth,
7369
7448
  canvasHeight: canvasHeight
7370
7449
  });
7450
+ })), drawCanvas.value.onDrawnPolygon((vertexes => {
7451
+ const new_vertexes = vertexesToScale(vertexes, scaleX, scaleY, !1);
7452
+ emit("editPolygon", {
7453
+ vertexes: new_vertexes,
7454
+ originWidth: originWidth,
7455
+ originHeight: originHeight
7456
+ });
7457
+ })), canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom((scaleOffset => {
7458
+ scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawCanvas.value.render();
7371
7459
  }));
7372
7460
  }, image.onerror = () => {
7373
7461
  loadingImage.value = !1;
@@ -7388,6 +7476,8 @@
7388
7476
  renderImageLabel(rowInfo);
7389
7477
  }
7390
7478
  }));
7479
+ })), vue.onUnmounted((() => {
7480
+ drawCanvas.value.destroy(), canvasDragZoom.value.destroy();
7391
7481
  }));
7392
7482
  return expose({
7393
7483
  rerenderImage: () => {
@@ -7395,6 +7485,9 @@
7395
7485
  const rowInfo = vue.toRaw(props.rowInfo);
7396
7486
  renderImageLabel(rowInfo);
7397
7487
  }));
7488
+ },
7489
+ resetScaleOffset: () => {
7490
+ canvasDragZoom.value.reset();
7398
7491
  }
7399
7492
  }), () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
7400
7493
  ref: mainBasaeRef,
@@ -7430,7 +7523,7 @@
7430
7523
  },
7431
7524
  emits: [ "fullscreen", "save" ],
7432
7525
  setup(props, {emit: emit}) {
7433
- const _ns = vue.inject("ns", {}), {t: t} = useLocale(), switchFillscreen = val => {
7526
+ const _ns = vue.inject("ns", {}), scaleTranslateManager = vue.inject("scaleTranslateManager", {}), scaleTranslate = scaleTranslateManager.scaleTranslate, {t: t} = useLocale(), switchFillscreen = val => {
7434
7527
  emit("fullscreen", val), document.body.style.overflow = val ? "hidden" : "auto";
7435
7528
  };
7436
7529
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", {
@@ -7511,7 +7604,28 @@
7511
7604
  class: "label-text"
7512
7605
  }, [ t("next.labelme.deletePolyton") ]) ]) ]), vue.createVNode("ul", {
7513
7606
  class: [ _ns.be("header", "tool") ]
7514
- }, [ props.imageLength ? vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("第 "), props.imageIndex + 1, vue.createTextVNode(" 张") ]), vue.createVNode("em", {
7607
+ }, [ vue.createVNode("li", {
7608
+ class: "hover",
7609
+ onClick: () => scaleTranslateManager.onResetScaleTranslate()
7610
+ }, [ vue.createVNode("svg", {
7611
+ t: "1725840994827",
7612
+ class: "icon",
7613
+ viewBox: "0 0 1024 1024",
7614
+ version: "1.1",
7615
+ xmlns: "http://www.w3.org/2000/svg",
7616
+ "p-id": "6051",
7617
+ width: "18",
7618
+ height: "18"
7619
+ }, [ vue.createVNode("path", {
7620
+ d: "M322.794667 445.205333a34.133333 34.133333 0 0 1 2.218666 45.824l-2.218666 2.432a34.133333 34.133333 0 0 1-45.824 2.218667l-2.432-2.218667-149.333334-149.333333a34.133333 34.133333 0 0 1-2.218666-45.824l2.218666-2.432 149.333334-149.333333a34.133333 34.133333 0 0 1 50.474666 45.824l-2.218666 2.432-91.050667 91.050666L640 285.866667c160.234667 0 290.133333 129.898667 290.133333 290.133333 0 158.016-126.314667 286.506667-283.477333 290.048L640 866.133333H234.666667a34.133333 34.133333 0 0 1-3.114667-68.117333L234.666667 797.866667h405.333333c122.538667 0 221.866667-99.328 221.866667-221.866667 0-120.533333-96.106667-218.602667-215.850667-221.781333L640 354.133333l-408.256-0.021333 91.050667 91.093333z",
7621
+ "p-id": "6052"
7622
+ }, null) ]), vue.createVNode("span", {
7623
+ style: "padding-left: 3px"
7624
+ }, [ t("next.labelimg.zoomRestore") ]) ]), vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("缩放比例") ]), vue.createVNode("span", null, [ parseInt((100 * scaleTranslate.value.scale).toString()), vue.createTextVNode("%") ]), vue.createVNode("span", {
7625
+ style: "padding: 0 10px;"
7626
+ }, [ vue.createTextVNode("偏移量") ]), vue.createVNode("span", {
7627
+ style: "min-width: 120px; text-align: left;"
7628
+ }, [ vue.createTextVNode("X: "), scaleTranslate.value.x, vue.createTextVNode(", Y: "), scaleTranslate.value.y ]) ]), props.imageLength ? vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("第 "), props.imageIndex + 1, vue.createTextVNode(" 张") ]), vue.createVNode("em", {
7515
7629
  style: "padding: 0 5px;"
7516
7630
  }, [ vue.createTextVNode("/") ]), vue.createVNode("span", null, [ vue.createTextVNode("共 "), props.imageLength, vue.createTextVNode(" 张") ]) ]) : null, vue.createVNode("li", {
7517
7631
  style: "margin-right: 30px;",
@@ -7603,7 +7717,7 @@
7603
7717
  default: () => []
7604
7718
  }
7605
7719
  },
7606
- emits: [ "change", "save", "edit-polygon", "prev-click", "next-click" ],
7720
+ emits: [ "change", "save", "edit-polygon", "change-polygon", "prev-click", "next-click" ],
7607
7721
  setup(props, {emit: emit, slots: slots}) {
7608
7722
  const _config = deepClone(defaultConfig), _options = vue.computed((() => {
7609
7723
  const cfg = vue.unref(props.options);
@@ -7663,14 +7777,29 @@
7663
7777
  isFullscreen.value = val, updateMainContentHeight(), vue.nextTick((() => {
7664
7778
  canvasContextRef.value.rerenderImage();
7665
7779
  }));
7666
- }, onEditPlygonChange = plygon => {
7667
- currentNode.value.labels = plygon, emit("edit-polygon", plygon);
7780
+ }, onChangePolygon = node => {
7781
+ currentNode.value.labels = node, emit("change-polygon", node);
7782
+ }, onEditPlygon = node => {
7783
+ currentNode.value.labels = node, emit("edit-polygon", node);
7668
7784
  }, onToolHeaderSave = () => {
7669
7785
  onChangeActivateNode(activateNodeIndex.value) || elementPlus.ElMessage({
7670
7786
  type: "info",
7671
7787
  message: t("next.labelimg.labelNoUpdate")
7672
7788
  });
7673
- };
7789
+ }, scaleTranslate = vue.ref({
7790
+ scale: 1,
7791
+ x: 0,
7792
+ y: 0
7793
+ });
7794
+ vue.provide("scaleTranslateManager", {
7795
+ scaleTranslate: scaleTranslate,
7796
+ onChangeScaleTranslate: val => {
7797
+ scaleTranslate.value = val;
7798
+ },
7799
+ onResetScaleTranslate: () => {
7800
+ canvasContextRef.value.resetScaleOffset();
7801
+ }
7802
+ });
7674
7803
  return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
7675
7804
  ref: layoutLabelRef,
7676
7805
  class: [ ns.b(), props.className, isFullscreen.value ? ns.b("fullscreen") : "" ],
@@ -7703,7 +7832,8 @@
7703
7832
  }, [ vue.createVNode(CanvasContext, {
7704
7833
  ref: canvasContextRef,
7705
7834
  rowInfo: currentNode.value,
7706
- onEditPolygon: onEditPlygonChange
7835
+ onEditPolygon: onEditPlygon,
7836
+ onChangePolygon: onChangePolygon
7707
7837
  }, null) ]) ]), vue.createVNode("footer", {
7708
7838
  ref: footerRef,
7709
7839
  class: [ ns.b("footer") ]
@@ -7809,7 +7939,7 @@
7809
7939
  })(app);
7810
7940
  };
7811
7941
  var index = {
7812
- version: "0.3.7",
7942
+ version: "0.3.9",
7813
7943
  install: install
7814
7944
  };
7815
7945
  exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
@@ -7856,7 +7986,7 @@
7856
7986
  }), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
7857
7987
  const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
7858
7988
  localeRef.value.name = lang, localeRef.value.next = nextLang.next;
7859
- }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.7",
7989
+ }, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.9",
7860
7990
  Object.defineProperty(exports, "__esModule", {
7861
7991
  value: !0
7862
7992
  });