x-next 1.3.1 → 1.5.0

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.
Files changed (182) hide show
  1. package/AI_USAGE.md +2 -2
  2. package/CHANGELOG.md +71 -0
  3. package/dist/_utils/constant.d.ts +1 -1
  4. package/dist/_utils/palette.d.ts +6 -14
  5. package/dist/components/alert/Alert.vue.d.ts +9 -9
  6. package/dist/components/alert/index.d.ts +6 -6
  7. package/dist/components/button/ButtonGroup.vue.d.ts +22 -18
  8. package/dist/components/date-picker/DatePanel.vue.d.ts +342 -1
  9. package/dist/components/date-picker/DatePicker.vue.d.ts +343 -2
  10. package/dist/components/date-picker/index.d.ts +1765 -1083
  11. package/dist/components/dropdown/DropdownButton.vue.d.ts +2 -1
  12. package/dist/components/dropdown/index.d.ts +3 -0
  13. package/dist/components/form-input-tag/index.d.ts +26 -25
  14. package/dist/components/form-input-tag/interface.d.ts +8 -0
  15. package/dist/components/link/Link.vue.d.ts +4 -4
  16. package/dist/components/link/index.d.ts +6 -6
  17. package/dist/components/message/index.d.ts +3 -3
  18. package/dist/components/message/message.vue.d.ts +1 -1
  19. package/dist/components/notification/Notification.d.ts +1 -1
  20. package/dist/components/notification/index.d.ts +3 -3
  21. package/dist/components/popconfirm/src/types.d.ts +1 -1
  22. package/dist/components/progress/Progress.vue.d.ts +3 -3
  23. package/dist/components/progress/index.d.ts +3 -3
  24. package/dist/components/steps/context.d.ts +9 -0
  25. package/dist/components/tabs/TabPane.vue.d.ts +2 -0
  26. package/dist/components/tabs/index.d.ts +6 -0
  27. package/dist/components/tabs/interface.d.ts +4 -0
  28. package/dist/components/tag/Tag.vue.d.ts +14 -0
  29. package/dist/components/tag/index.d.ts +9 -0
  30. package/dist/components/tag/interface.d.ts +5 -0
  31. package/dist/components/trend-chart/components/TrendChart.d.ts +127 -17
  32. package/dist/components/trend-chart/components/trend-chart-curve.d.ts +27 -7
  33. package/dist/components/trend-chart/components/trend-chart-labels.d.ts +4 -0
  34. package/dist/components/trend-chart/helpers/getPadding.d.ts +3 -2
  35. package/dist/components/trend-chart/index.d.ts +223 -28
  36. package/dist/components/trend-chart/props.d.ts +63 -5
  37. package/dist/es/_styles/palette-aliases.js +182 -127
  38. package/dist/es/_utils/palette.js +49 -43
  39. package/dist/es/components/_components/picker/input-range.vue2.js +10 -10
  40. package/dist/es/components/_components/picker/input.vue2.js +20 -20
  41. package/dist/es/components/_components/select-view/select-view.js +2 -2
  42. package/dist/es/components/alert/Alert.vue.js +2 -2
  43. package/dist/es/components/alert/Alert.vue2.js +21 -20
  44. package/dist/es/components/button/Button.js +17 -17
  45. package/dist/es/components/button/ButtonGroup.vue2.js +11 -9
  46. package/dist/es/components/date-picker/DatePanel.vue.js +71 -62
  47. package/dist/es/components/date-picker/DatePanel.vue2.js +50 -40
  48. package/dist/es/components/date-picker/DatePicker.vue2.js +1 -1
  49. package/dist/es/components/dropdown/Dropdown.vue2.js +11 -4
  50. package/dist/es/components/dropdown/DropdownButton.vue.js +8 -7
  51. package/dist/es/components/dropdown/DropdownButton.vue2.js +19 -17
  52. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +18 -17
  53. package/dist/es/components/form/form-item-label.vue.js +25 -22
  54. package/dist/es/components/form/form-item-label.vue2.js +1 -1
  55. package/dist/es/components/form-checkbox/icon-check.js +12 -43
  56. package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
  57. package/dist/es/components/form-input/InputSearch.js +1 -1
  58. package/dist/es/components/form-input-number/InputNumber.js +4 -4
  59. package/dist/es/components/form-input-tag/InputTag.js +168 -147
  60. package/dist/es/components/form-input-tag/utils.js +21 -19
  61. package/dist/es/components/form-textarea/Textarea.vue2.js +1 -1
  62. package/dist/es/components/link/Link.vue2.js +1 -1
  63. package/dist/es/components/menu/MenuSubMenu.js +50 -36
  64. package/dist/es/components/menu/sub-menu-pop.vue2.js +30 -30
  65. package/dist/es/components/pagination/Pagination.js +73 -70
  66. package/dist/es/components/popconfirm/src/popup.vue.js +1 -1
  67. package/dist/es/components/progress/Progress.vue2.js +1 -1
  68. package/dist/es/components/steps/Step.vue2.js +51 -47
  69. package/dist/es/components/steps/Steps.vue2.js +22 -19
  70. package/dist/es/components/table/Table.js +1 -1
  71. package/dist/es/components/table/table-th.js +2 -2
  72. package/dist/es/components/tabs/TabPane.vue.js +11 -9
  73. package/dist/es/components/tabs/TabPane.vue2.js +28 -24
  74. package/dist/es/components/tabs/tabs-button.js +2 -2
  75. package/dist/es/components/tabs/tabs-nav.js +21 -19
  76. package/dist/es/components/tabs/tabs-tab.vue.js +10 -8
  77. package/dist/es/components/tag/Tag.vue.js +20 -20
  78. package/dist/es/components/tag/Tag.vue2.js +35 -28
  79. package/dist/es/components/time-picker/TimePanel.vue.js +30 -29
  80. package/dist/es/components/time-picker/TimePicker.vue2.js +1 -1
  81. package/dist/es/components/time-picker/TimeRangePanel.js +26 -23
  82. package/dist/es/components/trend-chart/components/TrendChart.js +208 -142
  83. package/dist/es/components/trend-chart/components/trend-chart-curve.js +124 -59
  84. package/dist/es/components/trend-chart/components/trend-chart-labels.js +43 -41
  85. package/dist/es/components/trend-chart/helpers/getPadding.js +3 -3
  86. package/dist/es/components/trend-chart/props.js +101 -33
  87. package/dist/es/components/trend-chart/themes.js +15 -15
  88. package/dist/es/components/watermark/controller.js +40 -40
  89. package/dist/es/icons/default/calendar.js +15 -0
  90. package/dist/es/icons/default/clock-circle.js +15 -0
  91. package/dist/es/icons/default/double-left.js +15 -0
  92. package/dist/es/icons/default/double-right.js +15 -0
  93. package/dist/es/icons/default/down.js +16 -0
  94. package/dist/es/icons/default/eye-invisible.js +20 -0
  95. package/dist/es/icons/default/eye.js +18 -0
  96. package/dist/es/icons/default/left.js +15 -0
  97. package/dist/es/icons/default/minus.js +16 -0
  98. package/dist/es/icons/default/plus.js +16 -0
  99. package/dist/es/icons/default/question-circle.js +18 -0
  100. package/dist/es/icons/default/right.js +15 -0
  101. package/dist/es/icons/default/search.js +16 -0
  102. package/dist/es/icons/default/up.js +16 -0
  103. package/dist/es/icons/icon.js +26 -25
  104. package/dist/es/icons/public/boxicons/basic.js +1893 -0
  105. package/dist/es/icons/public/boxicons/brands.js +304 -0
  106. package/dist/es/icons/public/boxicons/filled.js +1893 -0
  107. package/dist/es/icons/public/boxicons/index.js +24 -0
  108. package/dist/es/icons/public/boxicons/names.js +4082 -0
  109. package/dist/es/icons/registry.js +15 -15
  110. package/dist/es/locale/en-US.js +2 -1
  111. package/dist/es/locale/zh-CN.js +2 -1
  112. package/dist/es/style.css +1 -1
  113. package/dist/icons/default/calendar.d.ts +93 -0
  114. package/dist/icons/default/clock-circle.d.ts +93 -0
  115. package/dist/icons/{_self/down.d.ts → default/double-left.d.ts} +6 -0
  116. package/dist/icons/{_self/eye-invisible.d.ts → default/double-right.d.ts} +6 -0
  117. package/dist/icons/default/down.d.ts +93 -0
  118. package/dist/icons/default/eye-invisible.d.ts +93 -0
  119. package/dist/icons/default/eye.d.ts +93 -0
  120. package/dist/icons/{_self/eye.d.ts → default/left.d.ts} +7 -0
  121. package/dist/icons/default/minus.d.ts +93 -0
  122. package/dist/icons/{_self → default}/plus.d.ts +7 -0
  123. package/dist/icons/default/question-circle.d.ts +93 -0
  124. package/dist/icons/{_self/minus.d.ts → default/right.d.ts} +7 -0
  125. package/dist/icons/{_self → default}/search.d.ts +7 -0
  126. package/dist/icons/{_self → default}/up.d.ts +7 -0
  127. package/dist/icons/public/boxicons/basic.cjs +1 -0
  128. package/dist/icons/public/boxicons/basic.d.ts +2 -0
  129. package/dist/icons/public/boxicons/brands.cjs +1 -0
  130. package/dist/icons/public/boxicons/brands.d.ts +2 -0
  131. package/dist/icons/public/boxicons/filled.cjs +1 -0
  132. package/dist/icons/public/boxicons/filled.d.ts +2 -0
  133. package/dist/icons/public/boxicons/index.cjs +1 -0
  134. package/dist/icons/public/boxicons/index.d.ts +10 -0
  135. package/dist/icons/public/boxicons/names.d.ts +10 -0
  136. package/dist/icons/registry.d.ts +5 -0
  137. package/dist/index.cjs +4 -4
  138. package/dist/index.umd.js +4 -4
  139. package/dist/locale/interface.d.ts +2 -0
  140. package/dist/style/alert.css +1 -1
  141. package/dist/style/base.css +1 -1
  142. package/dist/style/button.css +1 -1
  143. package/dist/style/date-picker.css +1 -1
  144. package/dist/style/dialog.css +1 -1
  145. package/dist/style/drawer.css +1 -1
  146. package/dist/style/dropdown.css +1 -1
  147. package/dist/style/form-input-number.css +1 -1
  148. package/dist/style/form-input-tag.css +1 -1
  149. package/dist/style/form-input.css +1 -1
  150. package/dist/style/form-radio.css +1 -1
  151. package/dist/style/form-select.css +1 -1
  152. package/dist/style/form-textarea.css +1 -1
  153. package/dist/style/form.css +1 -1
  154. package/dist/style/link.css +1 -1
  155. package/dist/style/menu.css +1 -1
  156. package/dist/style/message-box.css +1 -1
  157. package/dist/style/network.css +1 -1
  158. package/dist/style/pagination.css +1 -1
  159. package/dist/style/popconfirm.css +1 -1
  160. package/dist/style/popover.css +1 -1
  161. package/dist/style/popup.css +1 -1
  162. package/dist/style/progress.css +1 -1
  163. package/dist/style/rate.css +1 -1
  164. package/dist/style/spin.css +1 -1
  165. package/dist/style/steps.css +1 -1
  166. package/dist/style/table.css +1 -1
  167. package/dist/style/tabs.css +1 -1
  168. package/dist/style/tag.css +1 -1
  169. package/dist/style/time-picker.css +1 -1
  170. package/dist/style/time-range-selector.css +1 -1
  171. package/dist/style.css +1 -1
  172. package/package.json +31 -4
  173. package/dist/es/icons/_self/down.js +0 -16
  174. package/dist/es/icons/_self/eye-invisible.js +0 -13
  175. package/dist/es/icons/_self/eye.js +0 -13
  176. package/dist/es/icons/_self/minus.js +0 -13
  177. package/dist/es/icons/_self/plus.js +0 -12
  178. package/dist/es/icons/_self/question-message.js +0 -12
  179. package/dist/es/icons/_self/search.js +0 -13
  180. package/dist/es/icons/_self/up.js +0 -16
  181. package/dist/es/icons/_ui/calendar.js +0 -13
  182. package/dist/es/icons/_ui/time.js +0 -12
@@ -1,29 +1,30 @@
1
- import { defineComponent as G, reactive as I, computed as u, ref as A, onMounted as F, onUnmounted as W, watch as P, nextTick as x, createVNode as s, mergeProps as R, h as U, Fragment as _ } from "vue";
2
- import $ from "../helpers/getPadding.js";
3
- import { useLocale as q } from "../../../locale/index.js";
4
- import T from "./trend-chart-grid.js";
5
- import V from "./trend-chart-labels.js";
6
- import Y from "./trend-chart-curve.js";
7
- import { getComponentPrefix as H } from "../../../_utils/config.js";
8
- import { trendChartProps as J } from "../props.js";
9
- import { TrendChartTheme as h } from "../themes.js";
10
- const ie = /* @__PURE__ */ G({
11
- name: H("TrendChart"),
1
+ import { defineComponent as Z, useId as p, reactive as ee, computed as u, ref as j, onMounted as te, nextTick as f, onUnmounted as le, watch as N, createVNode as m, mergeProps as S, h as ae, Fragment as ne } from "vue";
2
+ import ie from "../helpers/getPadding.js";
3
+ import ue from "../helpers/genPoints.js";
4
+ import { useLocale as oe } from "../../../locale/index.js";
5
+ import F from "./trend-chart-grid.js";
6
+ import E from "./trend-chart-labels.js";
7
+ import $ from "./trend-chart-curve.js";
8
+ import { getComponentPrefix as re } from "../../../_utils/config.js";
9
+ import { trendChartProps as me } from "../props.js";
10
+ import { TrendChartTheme as x } from "../themes.js";
11
+ const we = /* @__PURE__ */ Z({
12
+ name: re("TrendChart"),
12
13
  components: {
13
- TrendChartGrid: T,
14
- TrendChartLabels: V,
15
- TrendChartCurve: Y
14
+ TrendChartGrid: F,
15
+ TrendChartLabels: E,
16
+ TrendChartCurve: $
16
17
  },
17
- props: J,
18
+ props: me,
18
19
  emits: {
19
- "mouse-move": (a) => !0
20
+ "mouse-move": (t) => !0
20
21
  },
21
- setup(a, {
22
- emit: f
22
+ setup(t, {
23
+ emit: w
23
24
  }) {
24
25
  const {
25
- t: j
26
- } = q(), n = I({
26
+ t: B
27
+ } = oe(), A = `x-trend-chart-clip-${p()}`, a = ee({
27
28
  width: null,
28
29
  height: null,
29
30
  labelsOverflowObject: {
@@ -32,155 +33,218 @@ const ie = /* @__PURE__ */ G({
32
33
  bottom: 0,
33
34
  left: 0
34
35
  },
35
- activeLine: null,
36
- activeLineParams: null
37
- }), z = (e, t) => ({
36
+ activeIndex: null
37
+ }), D = (e, l = {}) => ({
38
38
  ...e,
39
- ...t,
39
+ ...l,
40
40
  stroke: {
41
41
  ...e.stroke,
42
- ...t == null ? void 0 : t.stroke
42
+ ...l.color ? {
43
+ color: l.color
44
+ } : {},
45
+ ...l.stroke
43
46
  },
44
47
  fill: {
45
48
  ...e.fill,
46
- ...t == null ? void 0 : t.fill
49
+ ...l.color ? {
50
+ color: l.color
51
+ } : {},
52
+ ...l.fill
47
53
  },
48
54
  point: {
49
55
  ...e.point,
50
- ...t == null ? void 0 : t.point
56
+ ...l.color ? {
57
+ color: l.color
58
+ } : {},
59
+ ...l.point
51
60
  },
52
61
  axisLine: {
53
62
  ...e.axisLine,
54
- ...t == null ? void 0 : t.axisLine
63
+ ...l.color ? {
64
+ color: l.color
65
+ } : {},
66
+ ...l.axisLine
55
67
  }
56
- }), c = u(() => {
57
- let e = h.INFO;
58
- return a.status === "primary" ? e = h.PRIMARY : a.status === "success" ? e = h.SUCCESS : a.status === "danger" ? e = h.DANGER : a.status === "warning" ? e = h.WARNING : a.status === "strong" && (e = h.STRONG), z(e, a.theme);
59
- }), m = u(() => a.dataset.filter((e) => Number.isFinite(e))), k = u(() => m.value.length > 0), o = u(() => $(a.padding || "0")), l = u(() => ({
60
- minX: Number(o.value.left) + Number(n.labelsOverflowObject.left),
61
- minY: Number(o.value.top) + Number(n.labelsOverflowObject.top),
62
- maxX: (n.width ?? 0) - Number(o.value.right) - Number(n.labelsOverflowObject.right),
63
- maxY: (n.height ?? 0) - Number(o.value.bottom) - Number(n.labelsOverflowObject.bottom)
64
- })), i = u(() => {
65
- let e = m.value.length ? Math.max(...m.value) : 0, t = m.value.length ? Math.min(...m.value) : 0;
66
- const r = m.value.length;
67
- return a.max !== void 0 && (e = Math.max(e, a.max)), a.min !== void 0 && (t = Math.min(t, a.min)), {
68
- maxValue: e,
69
- minValue: t,
70
- maxAmount: r
68
+ }), g = u(() => {
69
+ let e = x.PRIMARY;
70
+ return t.status === "success" ? e = x.SUCCESS : t.status === "danger" ? e = x.DANGER : t.status === "warning" ? e = x.WARNING : t.status === "strong" ? e = x.STRONG : t.status === "info" && (e = x.INFO), D(e, t.theme);
71
+ }), h = u(() => t.dataset.filter((e) => Number.isFinite(e))), G = u(() => h.value.length > 0), c = u(() => ie(t.padding)), n = u(() => {
72
+ const e = Number(c.value.left) + Number(a.labelsOverflowObject.left), l = Number(c.value.top) + Number(a.labelsOverflowObject.top), i = Math.max(e, (a.width ?? 0) - Number(c.value.right) - Number(a.labelsOverflowObject.right)), o = Math.max(l, (a.height ?? 0) - Number(c.value.bottom) - Number(a.labelsOverflowObject.bottom));
73
+ return {
74
+ minX: e,
75
+ minY: l,
76
+ maxX: i,
77
+ maxY: o
71
78
  };
72
- }), S = u(() => ({
73
- x: l.value.minX,
74
- y: l.value.minY,
75
- width: Math.max(0, l.value.maxX - l.value.minX),
76
- height: Math.max(0, l.value.maxY - l.value.minY),
79
+ }), r = u(() => {
80
+ const e = h.value, l = e.length ? Math.max(...e) : 0, i = e.length ? Math.min(...e) : 0;
81
+ let o = Number.isFinite(t.max) ? t.max : l, s = Number.isFinite(t.min) ? t.min : i;
82
+ return s > o && ([s, o] = [o, s]), {
83
+ maxValue: o,
84
+ minValue: s,
85
+ maxAmount: e.length
86
+ };
87
+ }), W = u(() => ({
88
+ width: typeof t.width == "number" ? `${t.width}px` : t.width,
89
+ height: typeof t.height == "number" ? `${t.height}px` : t.height
90
+ })), b = u(() => n.value.maxX - n.value.minX), L = u(() => n.value.maxY - n.value.minY), U = u(() => ({
91
+ x: n.value.minX,
92
+ y: n.value.minY,
93
+ width: b.value,
94
+ height: L.value,
77
95
  opacity: 0
78
- })), g = u(() => ({
79
- x: l.value.minX + Math.max(0, l.value.maxX - l.value.minX) / 2,
80
- y: l.value.minY + Math.max(0, l.value.maxY - l.value.minY) / 2
81
- })), d = u(() => {
82
- if (i.value.maxAmount <= 0)
96
+ })), R = u(() => ({
97
+ x: n.value.minX + b.value / 2,
98
+ y: n.value.minY + L.value / 2
99
+ })), X = u(() => {
100
+ if (r.value.maxAmount <= 0)
83
101
  return [];
84
- if (i.value.maxAmount === 1)
85
- return [Math.round(l.value.minX + (l.value.maxX - l.value.minX) / 2)];
86
- const e = (l.value.maxX - l.value.minX) / (i.value.maxAmount - 1);
102
+ if (r.value.maxAmount === 1)
103
+ return [Math.round(n.value.minX + b.value / 2)];
104
+ const e = b.value / (r.value.maxAmount - 1);
87
105
  return Array.from({
88
- length: i.value.maxAmount
89
- }, (t, r) => Math.round(l.value.minX + e * r));
90
- }), v = A(null), b = A(null), L = () => {
106
+ length: r.value.maxAmount
107
+ }, (l, i) => Math.round(n.value.minX + e * i));
108
+ }), y = u(() => a.activeIndex === null ? null : X.value[a.activeIndex] ?? null), _ = u(() => ue(h.value, n.value, r.value.maxValue, r.value.minValue, r.value.maxAmount)), H = u(() => {
109
+ const e = a.activeIndex === null ? null : _.value[a.activeIndex];
110
+ return e ? Math.min(Math.max(e.y, n.value.minY), n.value.maxY) : n.value.minY;
111
+ }), v = j(null), M = j(null), O = () => {
91
112
  if (v.value) {
92
113
  const e = v.value.getBoundingClientRect();
93
- n.width = e.width, n.height = e.height;
114
+ a.width = e.width, a.height = e.height;
94
115
  }
95
- }, N = () => {
96
- if (v.value && b.value) {
97
- const e = v.value.getBoundingClientRect(), t = b.value.$el.getBoundingClientRect();
98
- n.labelsOverflowObject = {
99
- top: Math.max(0, Number(e.top) - Number(t.top) + Number(o.value.top)),
100
- right: Math.max(0, Number(t.right) - Number(e.right) + Number(o.value.right)),
101
- bottom: Math.max(0, Number(t.bottom) - Number(e.bottom) + Number(o.value.bottom)),
102
- left: Math.max(0, Number(o.value.left) - Number(t.left) + Number(e.left))
116
+ }, C = () => {
117
+ a.labelsOverflowObject = {
118
+ top: 0,
119
+ right: 0,
120
+ bottom: 0,
121
+ left: 0
122
+ };
123
+ }, I = () => {
124
+ if (v.value && M.value) {
125
+ const e = v.value.getBoundingClientRect(), l = M.value.$el.getBoundingClientRect();
126
+ a.labelsOverflowObject = {
127
+ top: Math.max(0, Number(e.top) - Number(l.top) + Number(c.value.top)),
128
+ right: Math.max(0, Number(l.right) - Number(e.right) + Number(c.value.right)),
129
+ bottom: Math.max(0, Number(l.bottom) - Number(e.bottom) + Number(c.value.bottom)),
130
+ left: Math.max(0, Number(c.value.left) - Number(l.left) + Number(e.left))
103
131
  };
104
132
  } else
105
- n.labelsOverflowObject = {
106
- top: 0,
107
- right: 0,
108
- bottom: 0,
109
- left: 0
110
- };
111
- }, w = () => {
112
- L(), x(N);
113
- }, E = (e) => d.value.length ? d.value.reduce((t, r) => Math.abs(t - e) > Math.abs(r - e) ? r : t, 1 / 0) : null, B = (e) => {
133
+ C();
134
+ }, P = () => {
135
+ O(), f(() => {
136
+ C(), f(I);
137
+ });
138
+ }, q = (e) => {
139
+ const l = X.value;
140
+ if (!l.length)
141
+ return null;
142
+ let i = 0;
143
+ return l.forEach((o, s) => {
144
+ Math.abs(o - e) < Math.abs(l[i] - e) && (i = s);
145
+ }), i;
146
+ }, J = (e) => {
114
147
  if (v.value) {
115
- const t = v.value.getBoundingClientRect();
116
- n.activeLine = E(e.clientX - t.left);
148
+ const l = v.value.getBoundingClientRect();
149
+ a.activeIndex = q(e.clientX - l.left);
117
150
  }
118
- }, D = () => {
119
- n.activeLine = null, n.activeLineParams = null;
120
- }, y = () => {
121
- L(), x(N);
151
+ }, K = () => {
152
+ a.activeIndex = null;
153
+ };
154
+ let d = null;
155
+ const Q = () => {
156
+ typeof ResizeObserver > "u" || !v.value || (d = new ResizeObserver(() => {
157
+ P();
158
+ }), d.observe(v.value));
159
+ }, V = () => {
160
+ P();
122
161
  };
123
- return F(() => {
124
- w(), window.addEventListener("resize", y);
125
- }), W(() => {
126
- window.removeEventListener("resize", y);
127
- }), P(() => n.activeLine, (e) => {
162
+ return te(() => {
163
+ O(), f(I), Q(), window.addEventListener("resize", V);
164
+ }), le(() => {
165
+ d == null || d.disconnect(), d = null, window.removeEventListener("resize", V);
166
+ }), N(() => a.activeIndex, (e) => {
128
167
  if (e !== null) {
129
- const t = d.value.indexOf(e);
130
- if (t < 0)
168
+ const l = h.value[e];
169
+ if (l === void 0) {
170
+ w("mouse-move", null);
131
171
  return;
132
- n.activeLineParams = {
133
- index: t
134
- }, f("mouse-move", {
135
- ...n.activeLineParams,
136
- data: m.value[t]
172
+ }
173
+ w("mouse-move", {
174
+ index: e,
175
+ data: l
137
176
  });
138
177
  } else
139
- f("mouse-move", null);
140
- }), P(() => [a.labels, a.dataset, a.min, a.max, a.padding], () => {
141
- n.labelsOverflowObject = {
142
- top: 0,
143
- right: 0,
144
- bottom: 0,
145
- left: 0
146
- }, x(w);
178
+ w("mouse-move", null);
179
+ }), N(h, (e) => {
180
+ a.activeIndex !== null && a.activeIndex >= e.length && (a.activeIndex = null);
181
+ }), N(() => [t.labels, t.dataset, t.min, t.max, t.padding], () => {
182
+ C(), f(() => {
183
+ O(), f(I);
184
+ });
185
+ }, {
186
+ deep: !0
187
+ }), N(() => {
188
+ var e, l, i, o;
189
+ return [(e = t.grid) == null ? void 0 : e.verticalLines, (l = t.grid) == null ? void 0 : l.verticalLinesNumber, (o = (i = t.labels) == null ? void 0 : i.xLabels) == null ? void 0 : o.length, h.value.length];
190
+ }, () => {
147
191
  }, {
192
+ immediate: !0,
148
193
  deep: !0
149
194
  }), () => {
150
- var e, t, r, O, M, C, X;
151
- return s("svg", {
195
+ var e, l, i, o, s, Y, T, z, k;
196
+ return m("svg", {
152
197
  class: "x-trend-chart",
153
198
  ref: v,
154
199
  xmlns: "http://www.w3.org/2000/svg",
155
200
  width: "100%",
156
- height: "100%"
157
- }, [a.grid && s(T, {
201
+ height: "100%",
202
+ style: W.value,
203
+ role: t.ariaLabel ? "img" : void 0,
204
+ "aria-label": t.ariaLabel
205
+ }, [m("defs", null, [m("clipPath", {
206
+ id: A
207
+ }, [m("rect", {
208
+ x: n.value.minX,
209
+ y: n.value.minY,
210
+ width: Math.max(0, b.value),
211
+ height: Math.max(0, L.value)
212
+ }, null)])]), t.grid && m(F, {
158
213
  class: "grid",
159
- verticalLines: a.grid.verticalLines,
160
- verticalLinesNumber: a.grid.verticalLinesNumber || i.value.maxAmount,
161
- horizontalLines: a.grid.horizontalLines,
162
- horizontalLinesNumber: a.grid.horizontalLinesNumber || (((e = a.labels) == null ? void 0 : e.yLabels) ?? 0),
163
- boundary: l.value
164
- }, null), a.labels && s(V, R({
165
- ref: b,
214
+ verticalLines: t.grid.verticalLines,
215
+ verticalLinesNumber: t.grid.verticalLinesNumber || ((l = (e = t.labels) == null ? void 0 : e.xLabels) == null ? void 0 : l.length) || r.value.maxAmount,
216
+ horizontalLines: t.grid.horizontalLines,
217
+ horizontalLinesNumber: t.grid.horizontalLinesNumber || ((i = t.labels) == null ? void 0 : i.yLabels) || 4,
218
+ boundary: n.value
219
+ }, null), t.labels && m(E, S({
220
+ ref: M,
166
221
  class: "labels"
167
- }, a.labels, {
168
- boundary: l.value,
169
- minValue: i.value.minValue,
170
- maxValue: i.value.maxValue
171
- }), null), s(Y, {
222
+ }, t.labels, {
223
+ boundary: n.value,
224
+ minValue: r.value.minValue,
225
+ maxValue: r.value.maxValue
226
+ }), null), m($, {
172
227
  class: "curve",
173
- data: m.value,
174
- boundary: l.value,
175
- minValue: i.value.minValue,
176
- maxValue: i.value.maxValue,
177
- maxAmount: i.value.maxAmount,
178
- activeLineParams: n.activeLineParams,
179
- theme: c.value
180
- }, null), !k.value && U("text", {
228
+ data: h.value,
229
+ boundary: n.value,
230
+ minValue: r.value.minValue,
231
+ maxValue: r.value.maxValue,
232
+ maxAmount: r.value.maxAmount,
233
+ activeLineParams: a.activeIndex === null ? null : {
234
+ index: a.activeIndex
235
+ },
236
+ clipPath: `url(#${A})`,
237
+ smooth: t.smooth,
238
+ stroke: t.stroke,
239
+ fill: t.fill,
240
+ showPoints: t.showPoints,
241
+ tooltip: t.tooltip,
242
+ tooltipFormatter: t.tooltipFormatter,
243
+ theme: g.value
244
+ }, null), !G.value && ae("text", {
181
245
  class: "x-trend-chart-empty",
182
- x: g.value.x,
183
- y: g.value.y,
246
+ x: R.value.x,
247
+ y: R.value.y,
184
248
  "text-anchor": "middle",
185
249
  "dominant-baseline": "middle",
186
250
  style: {
@@ -188,25 +252,27 @@ const ie = /* @__PURE__ */ G({
188
252
  fontSize: "12px",
189
253
  pointerEvents: "none"
190
254
  }
191
- }, j("common.noData")), a.interactive && s(_, null, [s("line", {
255
+ }, B("common.noData")), t.interactive && m(ne, null, [m("line", {
192
256
  class: "x-trend-chart-active-line",
193
- x1: n.activeLine ?? l.value.minX,
194
- x2: n.activeLine ?? l.value.minX,
195
- y1: l.value.minY,
196
- y2: l.value.maxY,
197
- visibility: n.activeLine !== null ? "visible" : "hidden",
257
+ x1: y.value ?? n.value.minX,
258
+ x2: y.value ?? n.value.minX,
259
+ y1: H.value,
260
+ y2: n.value.maxY,
261
+ visibility: y.value !== null ? "visible" : "hidden",
198
262
  style: {
199
- stroke: (r = (t = c.value) == null ? void 0 : t.axisLine) == null ? void 0 : r.color,
200
- strokeWidth: (M = (O = c.value) == null ? void 0 : O.axisLine) == null ? void 0 : M.width,
201
- strokeOpacity: (X = (C = c.value) == null ? void 0 : C.axisLine) == null ? void 0 : X.opacity
263
+ stroke: (s = (o = g.value) == null ? void 0 : o.axisLine) == null ? void 0 : s.color,
264
+ strokeWidth: (T = (Y = g.value) == null ? void 0 : Y.axisLine) == null ? void 0 : T.width,
265
+ strokeOpacity: (k = (z = g.value) == null ? void 0 : z.axisLine) == null ? void 0 : k.opacity
202
266
  }
203
- }, null), s("rect", R(S.value, {
204
- onMousemove: B,
205
- onMouseout: D
267
+ }, null), m("rect", S({
268
+ class: "x-trend-chart-overlay"
269
+ }, U.value, {
270
+ onMousemove: J,
271
+ onMouseout: K
206
272
  }), null)])]);
207
273
  };
208
274
  }
209
275
  });
210
276
  export {
211
- ie as default
277
+ we as default
212
278
  };
@@ -1,79 +1,144 @@
1
- import { defineComponent as T, computed as s, createVNode as c } from "vue";
2
- import W from "../helpers/genPoints.js";
3
- import E from "../helpers/genPath.js";
4
- import { getComponentPrefix as F } from "../../../_utils/config.js";
1
+ import { defineComponent as T, useId as W, computed as i, createVNode as o } from "vue";
2
+ import G from "../helpers/genPoints.js";
3
+ import H from "../helpers/genPath.js";
4
+ import { getComponentPrefix as O } from "../../../_utils/config.js";
5
5
  import { trendChartCurveProps as S } from "../props.js";
6
- const G = /* @__PURE__ */ T({
7
- name: F("TrendChartCurve"),
6
+ const _ = /* @__PURE__ */ T({
7
+ name: O("TrendChartCurve"),
8
8
  props: S,
9
9
  setup(e) {
10
- const u = s(() => W(e.data, e.boundary, e.maxValue, e.minValue, e.maxAmount)), m = s(() => E([...u.value], e.smooth, e.boundary)), b = s(() => {
11
- var a;
12
- return e.fill && ((a = m.value) == null ? void 0 : a.fillPath) && u.value.length > 1 && e.maxValue !== e.minValue;
13
- }), A = s(() => {
14
- var h, d, f, v, x, y, P, k, C, g, V;
15
- const a = [];
16
- b.value && a.push(c("path", {
10
+ const x = `x-trend-chart-fill-${W()}`, h = i(() => G(e.data, e.boundary, e.maxValue, e.minValue, e.maxAmount)), v = i(() => H([...h.value], e.smooth, e.boundary)), k = i(() => {
11
+ var t;
12
+ return e.fill && ((t = v.value) == null ? void 0 : t.fillPath) && h.value.length > 1 && e.maxValue !== e.minValue;
13
+ }), y = i(() => {
14
+ var t, l;
15
+ return ((l = (t = e.theme) == null ? void 0 : t.fill) == null ? void 0 : l.color) || "var(--x-color-text-secondary)";
16
+ }), b = i(() => {
17
+ var t, l;
18
+ return ((l = (t = e.theme) == null ? void 0 : t.fill) == null ? void 0 : l.opacity) ?? 0.1;
19
+ }), g = i(() => {
20
+ var t, l;
21
+ return (((l = (t = e.theme) == null ? void 0 : t.fill) == null ? void 0 : l.type) ?? "gradient") === "gradient";
22
+ }), u = i(() => {
23
+ var t;
24
+ return ((t = e.activeLineParams) == null ? void 0 : t.index) ?? -1;
25
+ }), C = 18, w = i(() => {
26
+ if (e.showPoints === !1) return !1;
27
+ if (e.showPoints === !0) return !0;
28
+ const t = h.value.length;
29
+ return t <= 2 ? !0 : (e.boundary.maxX - e.boundary.minX) / (t - 1) >= C;
30
+ }), V = (t) => {
31
+ var a, n;
32
+ const l = ((n = (a = e.theme) == null ? void 0 : a.point) == null ? void 0 : n.width) ?? 3;
33
+ return t ? l + 1 : l;
34
+ }, I = (t) => {
35
+ var a, n, c, r, m, f;
36
+ const l = ((n = (a = e.theme) == null ? void 0 : a.point) == null ? void 0 : n.color) ?? ((r = (c = e.theme) == null ? void 0 : c.stroke) == null ? void 0 : r.color);
37
+ return t ? {
38
+ fill: l,
39
+ stroke: l,
40
+ strokeWidth: 1
41
+ } : {
42
+ fill: l,
43
+ opacity: (f = (m = e.theme) == null ? void 0 : m.point) == null ? void 0 : f.opacity
44
+ };
45
+ }, N = i(() => {
46
+ var a, n, c, r, m, f, P;
47
+ const t = [];
48
+ k.value && t.push(o("path", {
17
49
  class: "x-trend-chart-fill",
18
- d: m.value.fillPath,
50
+ d: v.value.fillPath,
19
51
  fill: "none",
20
52
  style: {
21
- fill: ((d = (h = e.theme) == null ? void 0 : h.fill) == null ? void 0 : d.color) || "var(--x-color-text-secondary)",
22
- opacity: ((v = (f = e.theme) == null ? void 0 : f.fill) == null ? void 0 : v.opacity) ?? 0.1
53
+ fill: g.value ? `url(#${x})` : y.value,
54
+ opacity: g.value ? 1 : b.value
23
55
  }
24
- }, null)), e.stroke && ((x = m.value) != null && x.linePath) && a.push(c("path", {
56
+ }, null)), e.stroke && ((a = v.value) != null && a.linePath) && t.push(o("path", {
25
57
  class: "x-trend-chart-stroke",
26
- d: m.value.linePath,
58
+ d: v.value.linePath,
27
59
  fill: "none",
28
60
  stroke: "none",
61
+ "stroke-linecap": "round",
62
+ "stroke-linejoin": "round",
29
63
  style: {
30
- stroke: (P = (y = e.theme) == null ? void 0 : y.stroke) == null ? void 0 : P.color,
31
- strokeWidth: (C = (k = e.theme) == null ? void 0 : k.stroke) == null ? void 0 : C.width,
32
- opacity: (V = (g = e.theme) == null ? void 0 : g.stroke) == null ? void 0 : V.opacity
64
+ stroke: (c = (n = e.theme) == null ? void 0 : n.stroke) == null ? void 0 : c.color,
65
+ strokeWidth: (m = (r = e.theme) == null ? void 0 : r.stroke) == null ? void 0 : m.width,
66
+ opacity: (P = (f = e.theme) == null ? void 0 : f.stroke) == null ? void 0 : P.opacity
33
67
  }
34
68
  }, null));
35
- const N = (i) => {
36
- var t, l;
37
- const n = ((l = (t = e.theme) == null ? void 0 : t.point) == null ? void 0 : l.width) ?? 3;
38
- return i ? n + 1 : n;
39
- }, R = (i) => {
40
- var t, l, o, r, w, L;
41
- const n = ((l = (t = e.theme) == null ? void 0 : t.point) == null ? void 0 : l.color) ?? ((r = (o = e.theme) == null ? void 0 : o.stroke) == null ? void 0 : r.color);
42
- return i ? {
43
- fill: n,
44
- stroke: n,
69
+ const l = h.value.map((s, d) => ({
70
+ point: s,
71
+ index: d
72
+ })).filter(({
73
+ index: s
74
+ }) => w.value || s === u.value);
75
+ return l.length && t.push(o("g", {
76
+ class: "x-trend-chart-points"
77
+ }, [l.map(({
78
+ point: s,
79
+ index: d
80
+ }) => o("circle", {
81
+ key: d,
82
+ class: {
83
+ point: !0,
84
+ "x-trend-chart-point-active": u.value === d
85
+ },
86
+ cx: s.x,
87
+ cy: s.y,
88
+ r: V(u.value === d),
89
+ style: I(u.value === d)
90
+ }, null))])), t;
91
+ }), R = i(() => {
92
+ const t = h.value[u.value];
93
+ if (!e.tooltip || u.value < 0 || !t)
94
+ return null;
95
+ const l = e.tooltipFormatter(e.data[u.value]), a = Math.max(24, l.length * 7 + 12), n = 18, r = t.y - n - 6 >= e.boundary.minY ? t.y - n - 6 : t.y + 6;
96
+ return o("g", {
97
+ class: "x-trend-chart-tooltip",
98
+ "pointer-events": "none"
99
+ }, [o("rect", {
100
+ x: t.x - a / 2,
101
+ y: r,
102
+ width: a,
103
+ height: n,
104
+ rx: 4,
105
+ style: {
106
+ fill: "var(--x-color-bg-popup)",
107
+ stroke: "var(--x-color-border-subtle)",
45
108
  strokeWidth: 1
46
- } : {
47
- fill: n,
48
- opacity: (L = (w = e.theme) == null ? void 0 : w.point) == null ? void 0 : L.opacity
49
- };
50
- };
51
- if (e.showPoints && u.value) {
52
- const i = u.value.map((n, t) => {
53
- var l, o, r;
54
- return c("circle", {
55
- key: t,
56
- class: {
57
- point: !0,
58
- "x-trend-chart-point-active": ((l = e.activeLineParams) == null ? void 0 : l.index) === t
59
- },
60
- cx: n.x,
61
- cy: n.y,
62
- r: N(((o = e.activeLineParams) == null ? void 0 : o.index) === t),
63
- style: R(((r = e.activeLineParams) == null ? void 0 : r.index) === t)
64
- }, null);
65
- });
66
- a.push(c("g", {
67
- class: "x-trend-chart-points"
68
- }, [i]));
69
- }
70
- return a;
109
+ }
110
+ }, null), o("text", {
111
+ x: t.x,
112
+ y: r + n / 2,
113
+ "text-anchor": "middle",
114
+ "dominant-baseline": "middle",
115
+ style: {
116
+ fill: "var(--x-color-text-primary)",
117
+ fontSize: "12px"
118
+ }
119
+ }, [l])]);
71
120
  });
72
- return () => c("g", {
121
+ return () => o("g", {
73
122
  class: e.className
74
- }, [A.value]);
123
+ }, [o("defs", null, [o("linearGradient", {
124
+ id: x,
125
+ x1: "0",
126
+ y1: "0",
127
+ x2: "0",
128
+ y2: "1"
129
+ }, [o("stop", {
130
+ offset: "0%",
131
+ "stop-color": y.value,
132
+ "stop-opacity": b.value
133
+ }, null), o("stop", {
134
+ offset: "100%",
135
+ "stop-color": y.value,
136
+ "stop-opacity": "0"
137
+ }, null)])]), o("g", {
138
+ "clip-path": e.clipPath
139
+ }, [N.value]), R.value]);
75
140
  }
76
141
  });
77
142
  export {
78
- G as default
143
+ _ as default
79
144
  };