@pisell/materials 1.0.1034 → 1.0.1035

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 (254) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +17 -17
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +18 -23
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +27 -32
  11. package/es/components/Pagination/index.js +1 -1
  12. package/es/components/PisellCards/index.d.ts +6 -6
  13. package/es/components/calendar/index.d.ts +2 -2
  14. package/es/components/checkbox/index.d.ts +2 -2
  15. package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
  16. package/es/components/dataSourceComponents/fields/Input.Email/index.d.ts +2 -2
  17. package/es/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
  18. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +3 -3
  19. package/es/components/dataSourceComponents/fields/Input.TextArea/index.d.ts +2 -2
  20. package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
  21. package/es/components/date-picker/index.d.ts +2 -2
  22. package/es/components/filter/components/Dropdown/index.js +6 -2
  23. package/es/components/filter/components/FilterButton/index.js +3 -2
  24. package/es/components/filter/components/FilterButton/types.d.ts +5 -2
  25. package/es/components/filter/components/FilterItem/AsyncOptionsSelectWrapper.js +67 -0
  26. package/es/components/filter/components/FilterItem/index.js +105 -6
  27. package/es/components/filter/components/FilterItem/index.less +90 -0
  28. package/es/components/filter/types.d.ts +4 -2
  29. package/es/components/input/index.d.ts +2 -2
  30. package/es/components/pisell-config-provider/context.d.ts +2 -2
  31. package/es/components/pisellCurrency/PisellCurrency.less +163 -25
  32. package/es/components/pisellDatePicker/index.d.ts +2 -2
  33. package/es/components/pisellDateTimeDisplay/PisellDateTimeDisplay.js +11 -10
  34. package/es/components/pisellDateTimeDisplay/types.d.ts +5 -0
  35. package/es/components/pisellEmail/PisellEmail.d.ts +2 -33
  36. package/es/components/pisellEmail/PisellEmail.js +1 -1
  37. package/es/components/pisellEmail/PisellEmail.less +119 -10
  38. package/es/components/pisellEmail/index.d.ts +1 -1
  39. package/es/components/pisellFilter/docs/PisellFilter.md +289 -232
  40. package/es/components/pisellFilter/index.js +66 -11
  41. package/es/components/pisellLongText/PisellLongText.less +72 -4
  42. package/es/components/pisellLookup/PisellLookup.js +3 -3
  43. package/es/components/pisellLookup/PisellLookup.less +14 -9
  44. package/es/components/pisellLookup/components/LookupTrigger.js +6 -2
  45. package/es/components/pisellMetricCard/PisellMetricCard.d.ts +38 -0
  46. package/es/components/pisellMetricCard/PisellMetricCard.js +136 -0
  47. package/es/components/pisellMetricCard/components/MetricComparison.js +54 -0
  48. package/es/components/pisellMetricCard/components/MetricTitle.js +41 -0
  49. package/es/components/pisellMetricCard/components/MetricValue.js +26 -0
  50. package/es/components/pisellMetricCard/components/TrendIcon.js +26 -0
  51. package/es/components/pisellMetricCard/docs/pisellMetricCard.$tab-design.md +2 -6
  52. package/es/components/pisellMetricCard/index.d.ts +2 -0
  53. package/es/components/pisellMetricCard/types.d.ts +143 -0
  54. package/es/components/pisellMetricCard/utils/calculateTrend.js +22 -0
  55. package/es/components/pisellMetricCard/utils/formatMetricValue.js +52 -0
  56. package/es/components/pisellMultipleSelect/PisellMultipleSelect.less +151 -124
  57. package/es/components/pisellMultipleSelect/components/EditView.js +8 -1
  58. package/es/components/pisellMultipleSelect/components/ReadOnlyView.js +18 -6
  59. package/es/components/pisellNumber/PisellNumber.less +135 -17
  60. package/es/components/pisellPercent/PisellPercent.less +142 -24
  61. package/es/components/pisellPhone/PisellPhone.less +122 -27
  62. package/es/components/pisellPhone/components/EditView.js +1 -1
  63. package/es/components/pisellPhone/components/ReadOnlyView.js +15 -5
  64. package/es/components/pisellPhone/utils/countryCodeHelper.js +1 -10
  65. package/es/components/pisellRating/PisellRating.less +20 -12
  66. package/es/components/pisellRecordBoard/PisellRecordBoard.js +148 -0
  67. package/es/components/pisellRecordBoard/README.md +183 -0
  68. package/es/components/pisellRecordBoard/context/RecordBoardContext.js +7 -0
  69. package/es/components/pisellRecordBoard/context/RecordBoardProvider.js +14 -0
  70. package/es/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-design.md +128 -0
  71. package/es/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-dev.md +82 -0
  72. package/es/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-test.md +70 -0
  73. package/es/components/pisellRecordBoard/docs/PisellRecordBoard.md +552 -0
  74. package/es/components/pisellRecordBoard/hooks/useRecordBoardContext.d.ts +20 -0
  75. package/es/components/pisellRecordBoard/hooks/useRecordBoardContext.js +16 -0
  76. package/es/components/pisellRecordBoard/index.d.ts +40 -0
  77. package/es/components/pisellRecordBoard/index.js +28 -0
  78. package/es/components/pisellRecordBoard/layouts/CardLayout/CardList.d.ts +15 -0
  79. package/es/components/pisellRecordBoard/layouts/CardLayout/CardList.js +24 -0
  80. package/es/components/pisellRecordBoard/layouts/CardLayout/index.d.ts +15 -0
  81. package/es/components/pisellRecordBoard/layouts/CardLayout/index.js +21 -0
  82. package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.d.ts +17 -0
  83. package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.js +105 -0
  84. package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.less +13 -0
  85. package/es/components/pisellRecordBoard/layouts/GridLayout/index.d.ts +15 -0
  86. package/es/components/pisellRecordBoard/layouts/GridLayout/index.js +21 -0
  87. package/es/components/pisellRecordBoard/shellFrame/BatchActionBar/index.d.ts +12 -0
  88. package/es/components/pisellRecordBoard/shellFrame/BatchActionBar/index.js +69 -0
  89. package/es/components/pisellRecordBoard/shellFrame/ColumnSetting/ColumnSettingPopover.js +40 -0
  90. package/es/components/pisellRecordBoard/shellFrame/ColumnSetting/index.js +60 -0
  91. package/es/components/pisellRecordBoard/shellFrame/ColumnSetting/index.less +2 -0
  92. package/es/components/pisellRecordBoard/shellFrame/Pagination/index.d.ts +17 -0
  93. package/es/components/pisellRecordBoard/shellFrame/Pagination/index.js +52 -0
  94. package/es/components/pisellRecordBoard/shellFrame/Pagination/index.less +61 -0
  95. package/es/components/pisellRecordBoard/shellFrame/Search/index.d.ts +13 -0
  96. package/es/components/pisellRecordBoard/shellFrame/Search/index.js +34 -0
  97. package/es/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +77 -0
  98. package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +14 -0
  99. package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +136 -0
  100. package/es/components/pisellRecordBoard/shellFrame/ToolBarQuickFilter/index.d.ts +2 -0
  101. package/es/components/pisellRecordBoard/shellFrame/ToolBarQuickFilter/index.js +62 -0
  102. package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.d.ts +2 -0
  103. package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +45 -0
  104. package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.less +41 -0
  105. package/es/components/pisellRecordBoard/shellFrame/index.d.ts +27 -0
  106. package/es/components/pisellRecordBoard/shellFrame/index.js +38 -0
  107. package/es/components/pisellRecordBoard/types.d.ts +259 -0
  108. package/es/components/pisellRecordBoard/utils/recordBoardColumns.js +287 -0
  109. package/es/components/pisellShellFrame/PisellShellFrame.d.ts +16 -0
  110. package/es/components/pisellShellFrame/PisellShellFrame.js +60 -0
  111. package/es/components/pisellShellFrame/PisellShellFrame.less +73 -0
  112. package/es/components/pisellShellFrame/README.md +58 -0
  113. package/es/components/pisellShellFrame/index.d.ts +2 -0
  114. package/es/components/pisellShellFrame/types.d.ts +60 -0
  115. package/es/components/pisellSingleSelect/PisellSingleSelect.less +88 -46
  116. package/es/components/pisellSingleSelect/components/EditView.js +8 -1
  117. package/es/components/pisellSingleSelect/components/ReadOnlyView.js +8 -2
  118. package/es/components/pisellUrl/PisellUrl.d.ts +2 -33
  119. package/es/components/pisellUrl/PisellUrl.js +1 -1
  120. package/es/components/pisellUrl/PisellUrl.less +120 -11
  121. package/es/components/pisellUrl/index.d.ts +1 -1
  122. package/es/components/radio/index.d.ts +2 -2
  123. package/es/components/section-footers/index.d.ts +2 -2
  124. package/es/components/skeleton/index.d.ts +2 -2
  125. package/es/components/sort/index.js +12 -1
  126. package/es/components/sort/types.d.ts +8 -2
  127. package/es/components/time-picker/index.d.ts +2 -2
  128. package/es/index.d.ts +19 -11
  129. package/es/index.js +19 -15
  130. package/es/locales/en-US.js +16 -2
  131. package/es/locales/zh-CN.js +18 -4
  132. package/es/locales/zh-TW.js +18 -4
  133. package/es/utils/tagColor.js +31 -0
  134. package/lib/components/Pagination/index.js +1 -1
  135. package/lib/components/checkbox/index.d.ts +2 -2
  136. package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
  137. package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +2 -2
  138. package/lib/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
  139. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  140. package/lib/components/dataSourceComponents/fields/Input.TextArea/index.d.ts +2 -2
  141. package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
  142. package/lib/components/filter/components/Dropdown/index.js +6 -2
  143. package/lib/components/filter/components/FilterButton/index.js +3 -2
  144. package/lib/components/filter/components/FilterButton/types.d.ts +5 -2
  145. package/lib/components/filter/components/FilterItem/AsyncOptionsSelectWrapper.js +69 -0
  146. package/lib/components/filter/components/FilterItem/index.js +106 -6
  147. package/lib/components/filter/components/FilterItem/index.less +90 -0
  148. package/lib/components/filter/types.d.ts +4 -2
  149. package/lib/components/input/index.d.ts +2 -2
  150. package/lib/components/pisell-config-provider/context.d.ts +2 -2
  151. package/lib/components/pisellCurrency/PisellCurrency.less +163 -25
  152. package/lib/components/pisellDatePicker/index.d.ts +2 -2
  153. package/lib/components/pisellDateTimeDisplay/PisellDateTimeDisplay.js +11 -10
  154. package/lib/components/pisellDateTimeDisplay/types.d.ts +5 -0
  155. package/lib/components/pisellEmail/PisellEmail.d.ts +2 -33
  156. package/lib/components/pisellEmail/PisellEmail.js +1 -1
  157. package/lib/components/pisellEmail/PisellEmail.less +119 -10
  158. package/lib/components/pisellEmail/index.d.ts +1 -1
  159. package/lib/components/pisellFilter/docs/PisellFilter.md +289 -232
  160. package/lib/components/pisellFilter/index.js +65 -10
  161. package/lib/components/pisellLongText/PisellLongText.less +72 -4
  162. package/lib/components/pisellLookup/PisellLookup.js +3 -3
  163. package/lib/components/pisellLookup/PisellLookup.less +14 -9
  164. package/lib/components/pisellLookup/components/LookupTrigger.js +6 -2
  165. package/lib/components/pisellMetricCard/PisellMetricCard.d.ts +38 -0
  166. package/lib/components/pisellMetricCard/PisellMetricCard.js +138 -0
  167. package/lib/components/pisellMetricCard/components/MetricComparison.js +56 -0
  168. package/lib/components/pisellMetricCard/components/MetricTitle.js +43 -0
  169. package/lib/components/pisellMetricCard/components/MetricValue.js +28 -0
  170. package/lib/components/pisellMetricCard/components/TrendIcon.js +28 -0
  171. package/lib/components/pisellMetricCard/docs/pisellMetricCard.$tab-design.md +2 -6
  172. package/lib/components/pisellMetricCard/index.d.ts +2 -0
  173. package/lib/components/pisellMetricCard/types.d.ts +143 -0
  174. package/lib/components/pisellMetricCard/utils/calculateTrend.js +23 -0
  175. package/lib/components/pisellMetricCard/utils/formatMetricValue.js +53 -0
  176. package/lib/components/pisellMultipleSelect/PisellMultipleSelect.less +151 -124
  177. package/lib/components/pisellMultipleSelect/components/EditView.js +7 -0
  178. package/lib/components/pisellMultipleSelect/components/ReadOnlyView.js +17 -5
  179. package/lib/components/pisellNumber/PisellNumber.less +135 -17
  180. package/lib/components/pisellPercent/PisellPercent.less +142 -24
  181. package/lib/components/pisellPhone/PisellPhone.less +122 -27
  182. package/lib/components/pisellPhone/components/EditView.js +1 -1
  183. package/lib/components/pisellPhone/components/ReadOnlyView.js +15 -5
  184. package/lib/components/pisellPhone/utils/countryCodeHelper.js +0 -10
  185. package/lib/components/pisellRating/PisellRating.less +20 -12
  186. package/lib/components/pisellRecordBoard/PisellRecordBoard.js +150 -0
  187. package/lib/components/pisellRecordBoard/README.md +183 -0
  188. package/lib/components/pisellRecordBoard/context/RecordBoardContext.js +8 -0
  189. package/lib/components/pisellRecordBoard/context/RecordBoardProvider.js +16 -0
  190. package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-design.md +128 -0
  191. package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-dev.md +82 -0
  192. package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-test.md +70 -0
  193. package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.md +552 -0
  194. package/lib/components/pisellRecordBoard/hooks/useRecordBoardContext.d.ts +20 -0
  195. package/lib/components/pisellRecordBoard/hooks/useRecordBoardContext.js +17 -0
  196. package/lib/components/pisellRecordBoard/index.d.ts +40 -0
  197. package/lib/components/pisellRecordBoard/index.js +28 -0
  198. package/lib/components/pisellRecordBoard/layouts/CardLayout/CardList.d.ts +15 -0
  199. package/lib/components/pisellRecordBoard/layouts/CardLayout/CardList.js +26 -0
  200. package/lib/components/pisellRecordBoard/layouts/CardLayout/index.d.ts +15 -0
  201. package/lib/components/pisellRecordBoard/layouts/CardLayout/index.js +23 -0
  202. package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.d.ts +17 -0
  203. package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.js +107 -0
  204. package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.less +13 -0
  205. package/lib/components/pisellRecordBoard/layouts/GridLayout/index.d.ts +15 -0
  206. package/lib/components/pisellRecordBoard/layouts/GridLayout/index.js +23 -0
  207. package/lib/components/pisellRecordBoard/shellFrame/BatchActionBar/index.d.ts +12 -0
  208. package/lib/components/pisellRecordBoard/shellFrame/BatchActionBar/index.js +71 -0
  209. package/lib/components/pisellRecordBoard/shellFrame/ColumnSetting/ColumnSettingPopover.js +43 -0
  210. package/lib/components/pisellRecordBoard/shellFrame/ColumnSetting/index.js +62 -0
  211. package/lib/components/pisellRecordBoard/shellFrame/ColumnSetting/index.less +2 -0
  212. package/lib/components/pisellRecordBoard/shellFrame/Pagination/index.d.ts +17 -0
  213. package/lib/components/pisellRecordBoard/shellFrame/Pagination/index.js +54 -0
  214. package/lib/components/pisellRecordBoard/shellFrame/Pagination/index.less +61 -0
  215. package/lib/components/pisellRecordBoard/shellFrame/Search/index.d.ts +13 -0
  216. package/lib/components/pisellRecordBoard/shellFrame/Search/index.js +36 -0
  217. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +77 -0
  218. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +14 -0
  219. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +139 -0
  220. package/lib/components/pisellRecordBoard/shellFrame/ToolBarQuickFilter/index.js +64 -0
  221. package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.d.ts +2 -0
  222. package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +47 -0
  223. package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.less +41 -0
  224. package/lib/components/pisellRecordBoard/shellFrame/index.d.ts +26 -0
  225. package/lib/components/pisellRecordBoard/shellFrame/index.js +40 -0
  226. package/lib/components/pisellRecordBoard/types.d.ts +259 -0
  227. package/lib/components/pisellRecordBoard/utils/recordBoardColumns.js +292 -0
  228. package/lib/components/pisellShellFrame/PisellShellFrame.d.ts +16 -0
  229. package/lib/components/pisellShellFrame/PisellShellFrame.js +62 -0
  230. package/lib/components/pisellShellFrame/PisellShellFrame.less +73 -0
  231. package/lib/components/pisellShellFrame/README.md +58 -0
  232. package/lib/components/pisellShellFrame/index.d.ts +2 -0
  233. package/lib/components/pisellShellFrame/types.d.ts +60 -0
  234. package/lib/components/pisellSingleSelect/PisellSingleSelect.less +88 -46
  235. package/lib/components/pisellSingleSelect/components/EditView.js +7 -0
  236. package/lib/components/pisellSingleSelect/components/ReadOnlyView.js +8 -2
  237. package/lib/components/pisellUrl/PisellUrl.d.ts +2 -33
  238. package/lib/components/pisellUrl/PisellUrl.js +1 -1
  239. package/lib/components/pisellUrl/PisellUrl.less +120 -11
  240. package/lib/components/pisellUrl/index.d.ts +1 -1
  241. package/lib/components/radio/index.d.ts +2 -2
  242. package/lib/components/section-footers/index.d.ts +2 -2
  243. package/lib/components/skeleton/index.d.ts +2 -2
  244. package/lib/components/sort/index.js +12 -1
  245. package/lib/components/sort/types.d.ts +8 -2
  246. package/lib/components/time-picker/index.d.ts +2 -2
  247. package/lib/components/upload/index.d.ts +2 -2
  248. package/lib/index.d.ts +19 -11
  249. package/lib/index.js +33 -25
  250. package/lib/locales/en-US.js +16 -2
  251. package/lib/locales/zh-CN.js +18 -4
  252. package/lib/locales/zh-TW.js +18 -4
  253. package/lib/utils/tagColor.js +32 -0
  254. package/package.json +3 -3
@@ -2,7 +2,7 @@ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.108.0/hel
2
2
  import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectWithoutProperties.js";
3
3
  import FilterButton_default from "../filter/components/FilterButton/index.js";
4
4
  import { Form } from "antd";
5
- import React, { useEffect, useMemo, useState } from "react";
5
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
 
7
7
  //#region src/components/pisellFilter/index.tsx
8
8
  const _excluded = [
@@ -11,26 +11,77 @@ const _excluded = [
11
11
  "formFiltersPrefix",
12
12
  "hiddenQuickFilter",
13
13
  "hiddenOtherFilter",
14
- "hasForm"
14
+ "hasForm",
15
+ "onChange"
15
16
  ];
16
17
  const PisellFilter = (props) => {
17
- const { value: originalValue, quickFilterMaxLength, formFiltersPrefix, hiddenQuickFilter = true, hiddenOtherFilter = false, hasForm = true } = props, otherProps = _objectWithoutProperties(props, _excluded);
18
- const [value, setValue] = useState({});
18
+ const { value: originalValue, quickFilterMaxLength, formFiltersPrefix, hiddenQuickFilter = true, hiddenOtherFilter = false, hasForm = true, onChange } = props, otherProps = _objectWithoutProperties(props, _excluded);
19
+ const [form] = Form.useForm();
20
+ const [value, setValue] = useState(() => ({
21
+ quickFilter: (originalValue === null || originalValue === void 0 ? void 0 : originalValue.quickFilter) || [],
22
+ otherFilter: (originalValue === null || originalValue === void 0 ? void 0 : originalValue.otherFilter) || [],
23
+ values: (originalValue === null || originalValue === void 0 ? void 0 : originalValue.values) || {}
24
+ }));
25
+ const isInternalChange = useRef(false);
19
26
  useEffect(() => {
20
- setValue({
21
- quickFilter: (originalValue === null || originalValue === void 0 ? void 0 : originalValue.quickFilter) || [],
22
- otherFilter: (originalValue === null || originalValue === void 0 ? void 0 : originalValue.otherFilter) || []
27
+ setValue((prev) => {
28
+ var _originalValue$quickF, _originalValue$otherF, _ref, _originalValue$values;
29
+ return {
30
+ quickFilter: (_originalValue$quickF = originalValue === null || originalValue === void 0 ? void 0 : originalValue.quickFilter) !== null && _originalValue$quickF !== void 0 ? _originalValue$quickF : prev.quickFilter,
31
+ otherFilter: (_originalValue$otherF = originalValue === null || originalValue === void 0 ? void 0 : originalValue.otherFilter) !== null && _originalValue$otherF !== void 0 ? _originalValue$otherF : prev.otherFilter,
32
+ values: (_ref = (_originalValue$values = originalValue === null || originalValue === void 0 ? void 0 : originalValue.values) !== null && _originalValue$values !== void 0 ? _originalValue$values : prev.values) !== null && _ref !== void 0 ? _ref : {}
33
+ };
23
34
  });
24
- }, [originalValue]);
35
+ }, [
36
+ originalValue === null || originalValue === void 0 ? void 0 : originalValue.quickFilter,
37
+ originalValue === null || originalValue === void 0 ? void 0 : originalValue.otherFilter,
38
+ originalValue === null || originalValue === void 0 ? void 0 : originalValue.values
39
+ ]);
40
+ useEffect(() => {
41
+ if (!hasForm || !(originalValue === null || originalValue === void 0 ? void 0 : originalValue.values) || typeof originalValue.values !== "object") return;
42
+ if (isInternalChange.current) {
43
+ isInternalChange.current = false;
44
+ return;
45
+ }
46
+ form.setFieldsValue(originalValue.values);
47
+ }, [
48
+ hasForm,
49
+ form,
50
+ originalValue === null || originalValue === void 0 ? void 0 : originalValue.values
51
+ ]);
52
+ const handleChange = useCallback((newVal) => {
53
+ setValue((prev) => {
54
+ var _newVal$values;
55
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, prev), newVal), {}, { values: (_newVal$values = newVal.values) !== null && _newVal$values !== void 0 ? _newVal$values : prev.values });
56
+ });
57
+ onChange === null || onChange === void 0 || onChange(newVal);
58
+ }, [onChange]);
59
+ const handleFormValuesChange = useCallback((_, allValues) => {
60
+ if (typeof allValues !== "object" || allValues === null) return;
61
+ isInternalChange.current = true;
62
+ const mergedValues = _objectSpread2(_objectSpread2({}, value.values), allValues);
63
+ const next = {
64
+ quickFilter: value.quickFilter,
65
+ otherFilter: value.otherFilter,
66
+ values: mergedValues
67
+ };
68
+ setValue(next);
69
+ onChange === null || onChange === void 0 || onChange(next);
70
+ }, [
71
+ value.quickFilter,
72
+ value.otherFilter,
73
+ value.values,
74
+ onChange
75
+ ]);
25
76
  const content = useMemo(() => {
26
77
  return /* @__PURE__ */ React.createElement(FilterButton_default, _objectSpread2(_objectSpread2({}, otherProps), {}, {
78
+ onChange: handleChange,
27
79
  value: {
28
80
  quickFilter: value.quickFilter,
29
81
  otherFilter: value.otherFilter
30
82
  },
31
83
  hiddenQuickFilter,
32
84
  hiddenOtherFilter,
33
- onChange: setValue,
34
85
  quickFilterMaxLength: quickFilterMaxLength || 100,
35
86
  formFiltersPrefix: formFiltersPrefix || ""
36
87
  }));
@@ -39,11 +90,15 @@ const PisellFilter = (props) => {
39
90
  hiddenQuickFilter,
40
91
  hiddenOtherFilter,
41
92
  quickFilterMaxLength,
42
- formFiltersPrefix
93
+ formFiltersPrefix,
94
+ handleChange
43
95
  ]);
44
96
  if (hasForm) return /* @__PURE__ */ React.createElement(Form, _objectSpread2({
97
+ form,
45
98
  size: "large",
46
- layout: "vertical"
99
+ layout: "vertical",
100
+ initialValues: value.values,
101
+ onValuesChange: handleFormValuesChange
47
102
  }, otherProps), content);
48
103
  return content;
49
104
  };
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * PisellLongText 组件样式
3
+ * 基于 Figma 设计规范,与 SingleLineText 设计体系一致
3
4
  */
4
5
 
5
6
  .pisell-long-text {
@@ -7,16 +8,78 @@
7
8
  position: relative;
8
9
  width: 100%;
9
10
 
10
- // 基于 Figma 设计规范的 TextArea 样式
11
+ // TextArea 样式(Figma 设计规范,覆盖时使用 pisell-lowcode-xxx)
11
12
  .pisell-lowcode-input {
12
- padding: 12px 14px; // Figma: 垂直12px,水平14px(比 Input 小2px)
13
+ // 基础样式
14
+ font-size: 16px !important;
15
+ line-height: 24px !important;
16
+
17
+ // 边框和圆角
18
+ border-radius: 8px !important;
19
+ border: 1px solid #d0d5dd !important; // Gray/300
20
+
21
+ // 内边距(Figma: 垂直 12px,水平 14px)
22
+ padding: 12px 14px !important;
23
+ min-height: 80px !important; // 多行最小高度,由 rows 进一步控制
24
+
25
+ // 颜色
26
+ color: #101828 !important; // Gray/900
27
+ background-color: #ffffff !important;
28
+
29
+ &::placeholder {
30
+ color: #667085 !important; // Gray/500
31
+ }
32
+
33
+ // 聚焦态
34
+ &:focus,
35
+ &:focus-within {
36
+ border-color: #d6bbfb !important; // Primary/300
37
+ box-shadow: 0 0 0 4px #f4ebff !important; // Primary/100
38
+ outline: none !important;
39
+ }
40
+
41
+ // Hover 态
42
+ &:hover:not(:focus):not(:focus-within):not([disabled]) {
43
+ border-color: #b692f6 !important; // Primary/400
44
+ }
45
+
46
+ // 禁用态
47
+ &[disabled],
48
+ &.pisell-lowcode-input-disabled {
49
+ background-color: #f9fafb !important; // Gray/50
50
+ color: #98a2b3 !important; // Gray/400
51
+ border-color: #d0d5dd !important;
52
+ cursor: not-allowed !important;
53
+ }
54
+ }
55
+
56
+ // 字数统计样式(TextArea showCount)
57
+ .pisell-lowcode-input-data-count,
58
+ .pisell-lowcode-input-show-count-suffix {
59
+ color: #667085 !important; // Gray/500
60
+ font-size: 14px !important;
61
+ }
62
+
63
+ // 错误状态
64
+ .pisell-lowcode-input-status-error {
65
+ border-color: #fda29b !important; // Error/300
66
+
67
+ &:focus,
68
+ &:focus-within {
69
+ border-color: #f97066 !important; // Error/400
70
+ box-shadow: 0 0 0 4px #fee4e2 !important; // Error/100
71
+ }
72
+
73
+ &:hover:not(:focus):not(:focus-within) {
74
+ border-color: #f97066 !important; // Error/400
75
+ }
13
76
  }
14
77
  }
15
78
 
16
79
  &-error {
17
80
  margin-top: 4px;
18
81
  font-size: 12px;
19
- color: #ff4d4f;
82
+ color: #d92d20; // Error/600
20
83
  line-height: 1.5;
21
84
  animation: fadeIn 0.3s ease-in-out;
22
85
  }
@@ -32,12 +95,17 @@
32
95
  height: auto;
33
96
  font-size: 14px;
34
97
  margin-top: 8px;
98
+ color: #6d48c4;
99
+
100
+ &:hover {
101
+ color: #6d48c4 !important;
102
+ }
35
103
  }
36
104
 
37
105
  &-word-count {
38
106
  margin-top: 8px;
39
107
  font-size: 12px;
40
- color: #667085;
108
+ color: #667085; // Gray/500
41
109
  text-align: right;
42
110
  }
43
111
 
@@ -241,10 +241,10 @@ const PisellLookupComponent = forwardRef((props, ref) => {
241
241
  }, 200);
242
242
  }, [displayType, close]);
243
243
  /**
244
- * 处理确认触发(点击 Lookup 按钮或按 Enter 键)
244
+ * 处理确认触发(点击 Lookup 按钮或按 Enter 键)。支持传入当前输入值,回车时由 Trigger 传入以避免受控下 keyword 未更新导致历史未保存。
245
245
  */
246
- const handleConfirm = useCallback(() => {
247
- handleConfirmSearch(keyword);
246
+ const handleConfirm = useCallback((valueFromTrigger) => {
247
+ handleConfirmSearch(valueFromTrigger !== null && valueFromTrigger !== void 0 ? valueFromTrigger : keyword);
248
248
  }, [keyword, handleConfirmSearch]);
249
249
  /**
250
250
  * 处理清除
@@ -132,8 +132,9 @@
132
132
 
133
133
  // ============ Input 样式覆盖 ============
134
134
 
135
- // 覆盖 Ant Design Input 默认样式(适用于所有尺寸)
135
+ // 覆盖 Ant Design Input 默认样式(适用于所有尺寸);默认高度 50px
136
136
  &-trigger-input.pisell-lowcode-input-affix-wrapper {
137
+ min-height: 50px;
137
138
  border: 1px solid #d0d5dd;
138
139
  border-radius: 8px;
139
140
  box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
@@ -192,8 +193,9 @@
192
193
  }
193
194
  }
194
195
 
195
- // 大号输入框
196
+ // 大号输入框,高度 58px
196
197
  &-trigger-input.pisell-lowcode-input-affix-wrapper-lg {
198
+ min-height: 58px;
197
199
  padding: 6px 6px 6px 16px;
198
200
 
199
201
  .pisell-lookup-input-clear {
@@ -210,6 +212,11 @@
210
212
 
211
213
  .pisell-lookup-input-confirm {
212
214
  padding: 10px;
215
+ line-height: 24px;
216
+
217
+ span {
218
+ line-height: 24px;
219
+ }
213
220
  }
214
221
  }
215
222
 
@@ -270,8 +277,8 @@
270
277
  }
271
278
 
272
279
  &-confirm {
280
+ border: none;
273
281
  background-color: #7f56d9;
274
- border-color: #7f56d9;
275
282
  border-radius: 8px;
276
283
  box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
277
284
  padding: 10px;
@@ -279,39 +286,37 @@
279
286
  min-width: auto;
280
287
  font-size: 16px;
281
288
  font-weight: 600;
282
- line-height: 22px;
289
+ line-height: 20px;
283
290
  color: #ffffff;
284
291
 
285
292
  &:hover {
286
293
  background-color: #6941c6 !important;
287
- border-color: #6941c6 !important;
288
294
  color: #ffffff !important;
289
295
  }
290
296
 
291
297
  &:active {
292
298
  background-color: #53389e !important;
293
- border-color: #53389e !important;
294
299
  color: #ffffff !important;
295
300
  }
296
301
 
297
302
  span {
298
303
  font-size: 16px;
299
304
  font-weight: 600;
300
- line-height: 22px;
305
+ line-height: 20px;
301
306
  }
302
307
 
303
308
  &.pisell-lowcode-btn-sm {
304
309
  padding: 10px;
305
310
  height: auto;
306
311
  font-size: 16px;
307
- line-height: 22px;
312
+ line-height: 20px;
308
313
  }
309
314
 
310
315
  &.pisell-lowcode-btn-middle {
311
316
  padding: 10px;
312
317
  height: auto;
313
318
  font-size: 16px;
314
- line-height: 22px;
319
+ line-height: 20px;
315
320
  }
316
321
  }
317
322
  }
@@ -119,10 +119,14 @@ const LookupTriggerComponent = forwardRef((props, ref) => {
119
119
  onConfirm === null || onConfirm === void 0 || onConfirm();
120
120
  };
121
121
  /**
122
- * 处理按 Enter
122
+ * 处理按 Enter 键:传入当前输入值,避免受控模式下 state 未更新导致历史未保存
123
123
  */
124
124
  const handleKeyPress = (e) => {
125
- if (e.key === "Enter") onConfirm === null || onConfirm === void 0 || onConfirm();
125
+ if (e.key === "Enter") {
126
+ var _ref, _e$currentTarget$valu, _e$currentTarget;
127
+ const currentValue = (_ref = (_e$currentTarget$valu = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.value) !== null && _e$currentTarget$valu !== void 0 ? _e$currentTarget$valu : value) !== null && _ref !== void 0 ? _ref : "";
128
+ onConfirm === null || onConfirm === void 0 || onConfirm(currentValue);
129
+ }
126
130
  };
127
131
  /**
128
132
  * 渲染输入框触发器
@@ -0,0 +1,38 @@
1
+ import { PisellMetricCardProps } from "./types.js";
2
+ import React from "react";
3
+ import "./PisellMetricCard.less";
4
+
5
+ //#region src/components/pisellMetricCard/PisellMetricCard.d.ts
6
+ /**
7
+ * PisellMetricCard 指标卡片组件
8
+ *
9
+ * 用于展示单一核心指标的专业卡片组件
10
+ * 支持标题、数值、环比、趋势箭头、标签等信息展示
11
+ *
12
+ * @example 基础用法
13
+ * ```tsx
14
+ * <PisellMetricCard
15
+ * title="Total Sales"
16
+ * value={1580}
17
+ * />
18
+ * ```
19
+ *
20
+ * @example 使用对象配置
21
+ * ```tsx
22
+ * <PisellMetricCard
23
+ * title="Revenue"
24
+ * value={1580}
25
+ * format={{
26
+ * showCurrencySymbol: true,
27
+ * currencySymbol: '$',
28
+ * useGrouping: true
29
+ * }}
30
+ * comparison={{
31
+ * value: 120
32
+ * }}
33
+ * />
34
+ * ```
35
+ */
36
+ declare const PisellMetricCard: React.FC<PisellMetricCardProps>;
37
+ //#endregion
38
+ export { PisellMetricCard };
@@ -0,0 +1,136 @@
1
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
2
+ import pisellCard_default from "../pisellCard/index.js";
3
+ import MetricValue_default from "./components/MetricValue.js";
4
+ import MetricTitle_default from "./components/MetricTitle.js";
5
+ import { formatMetricValue } from "./utils/formatMetricValue.js";
6
+ import MetricComparison_default from "./components/MetricComparison.js";
7
+ import React, { useMemo } from "react";
8
+ import "./PisellMetricCard.less";
9
+
10
+ //#region src/components/pisellMetricCard/PisellMetricCard.tsx
11
+ /**
12
+ * PisellMetricCard 指标卡片组件
13
+ *
14
+ * 用于展示单一核心指标的专业卡片组件
15
+ * 支持标题、数值、环比、趋势箭头、标签等信息展示
16
+ *
17
+ * @example 基础用法
18
+ * ```tsx
19
+ * <PisellMetricCard
20
+ * title="Total Sales"
21
+ * value={1580}
22
+ * />
23
+ * ```
24
+ *
25
+ * @example 使用对象配置
26
+ * ```tsx
27
+ * <PisellMetricCard
28
+ * title="Revenue"
29
+ * value={1580}
30
+ * format={{
31
+ * showCurrencySymbol: true,
32
+ * currencySymbol: '$',
33
+ * useGrouping: true
34
+ * }}
35
+ * comparison={{
36
+ * value: 120
37
+ * }}
38
+ * />
39
+ * ```
40
+ */
41
+ const PisellMetricCard = (props) => {
42
+ const { title, subtitle, value, tag, tooltip, format, comparison, styleConfig, showSubtitle = false, showTag = false, showTooltip = false, loading = false, hoverable = true, className, style, onClick } = props;
43
+ const formatConfig = useMemo(() => {
44
+ var _format$precision, _format$useGrouping, _format$showCurrencyS, _format$currencySymbo, _format$hideDecimalFo;
45
+ return {
46
+ precision: (_format$precision = format === null || format === void 0 ? void 0 : format.precision) !== null && _format$precision !== void 0 ? _format$precision : 0,
47
+ useGrouping: (_format$useGrouping = format === null || format === void 0 ? void 0 : format.useGrouping) !== null && _format$useGrouping !== void 0 ? _format$useGrouping : false,
48
+ showCurrencySymbol: (_format$showCurrencyS = format === null || format === void 0 ? void 0 : format.showCurrencySymbol) !== null && _format$showCurrencyS !== void 0 ? _format$showCurrencyS : false,
49
+ currencySymbol: (_format$currencySymbo = format === null || format === void 0 ? void 0 : format.currencySymbol) !== null && _format$currencySymbo !== void 0 ? _format$currencySymbo : "",
50
+ formatter: format === null || format === void 0 ? void 0 : format.formatter,
51
+ hideDecimalForWholeNumbers: (_format$hideDecimalFo = format === null || format === void 0 ? void 0 : format.hideDecimalForWholeNumbers) !== null && _format$hideDecimalFo !== void 0 ? _format$hideDecimalFo : true
52
+ };
53
+ }, [format]);
54
+ const cardStyle = useMemo(() => {
55
+ var _styleConfig$card$bor, _styleConfig$card, _styleConfig$card$bor2, _styleConfig$card2, _styleConfig$card$pad, _styleConfig$card3, _styleConfig$card$sha, _styleConfig$card4, _styleConfig$card$bac, _styleConfig$card5, _styleConfig$card$wid, _styleConfig$card6;
56
+ return {
57
+ bordered: (_styleConfig$card$bor = styleConfig === null || styleConfig === void 0 || (_styleConfig$card = styleConfig.card) === null || _styleConfig$card === void 0 ? void 0 : _styleConfig$card.bordered) !== null && _styleConfig$card$bor !== void 0 ? _styleConfig$card$bor : true,
58
+ borderRadius: (_styleConfig$card$bor2 = styleConfig === null || styleConfig === void 0 || (_styleConfig$card2 = styleConfig.card) === null || _styleConfig$card2 === void 0 ? void 0 : _styleConfig$card2.borderRadius) !== null && _styleConfig$card$bor2 !== void 0 ? _styleConfig$card$bor2 : 12,
59
+ padding: (_styleConfig$card$pad = styleConfig === null || styleConfig === void 0 || (_styleConfig$card3 = styleConfig.card) === null || _styleConfig$card3 === void 0 ? void 0 : _styleConfig$card3.padding) !== null && _styleConfig$card$pad !== void 0 ? _styleConfig$card$pad : 16,
60
+ shadow: (_styleConfig$card$sha = styleConfig === null || styleConfig === void 0 || (_styleConfig$card4 = styleConfig.card) === null || _styleConfig$card4 === void 0 ? void 0 : _styleConfig$card4.shadow) !== null && _styleConfig$card$sha !== void 0 ? _styleConfig$card$sha : true,
61
+ background: (_styleConfig$card$bac = styleConfig === null || styleConfig === void 0 || (_styleConfig$card5 = styleConfig.card) === null || _styleConfig$card5 === void 0 ? void 0 : _styleConfig$card5.background) !== null && _styleConfig$card$bac !== void 0 ? _styleConfig$card$bac : "#ffffff",
62
+ width: (_styleConfig$card$wid = styleConfig === null || styleConfig === void 0 || (_styleConfig$card6 = styleConfig.card) === null || _styleConfig$card6 === void 0 ? void 0 : _styleConfig$card6.width) !== null && _styleConfig$card$wid !== void 0 ? _styleConfig$card$wid : "auto"
63
+ };
64
+ }, [styleConfig]);
65
+ const titleStyle = useMemo(() => {
66
+ var _styleConfig$title$si, _styleConfig$title, _styleConfig$title$we, _styleConfig$title2, _styleConfig$title$co, _styleConfig$title3;
67
+ return {
68
+ size: (_styleConfig$title$si = styleConfig === null || styleConfig === void 0 || (_styleConfig$title = styleConfig.title) === null || _styleConfig$title === void 0 ? void 0 : _styleConfig$title.size) !== null && _styleConfig$title$si !== void 0 ? _styleConfig$title$si : 14,
69
+ weight: (_styleConfig$title$we = styleConfig === null || styleConfig === void 0 || (_styleConfig$title2 = styleConfig.title) === null || _styleConfig$title2 === void 0 ? void 0 : _styleConfig$title2.weight) !== null && _styleConfig$title$we !== void 0 ? _styleConfig$title$we : 400,
70
+ color: (_styleConfig$title$co = styleConfig === null || styleConfig === void 0 || (_styleConfig$title3 = styleConfig.title) === null || _styleConfig$title3 === void 0 ? void 0 : _styleConfig$title3.color) !== null && _styleConfig$title$co !== void 0 ? _styleConfig$title$co : "rgba(0, 0, 0, 0.45)"
71
+ };
72
+ }, [styleConfig]);
73
+ const valueStyle = useMemo(() => {
74
+ var _styleConfig$value$si, _styleConfig$value, _styleConfig$value$we, _styleConfig$value2, _styleConfig$value$co, _styleConfig$value3;
75
+ return {
76
+ size: (_styleConfig$value$si = styleConfig === null || styleConfig === void 0 || (_styleConfig$value = styleConfig.value) === null || _styleConfig$value === void 0 ? void 0 : _styleConfig$value.size) !== null && _styleConfig$value$si !== void 0 ? _styleConfig$value$si : 30,
77
+ weight: (_styleConfig$value$we = styleConfig === null || styleConfig === void 0 || (_styleConfig$value2 = styleConfig.value) === null || _styleConfig$value2 === void 0 ? void 0 : _styleConfig$value2.weight) !== null && _styleConfig$value$we !== void 0 ? _styleConfig$value$we : 600,
78
+ color: (_styleConfig$value$co = styleConfig === null || styleConfig === void 0 || (_styleConfig$value3 = styleConfig.value) === null || _styleConfig$value3 === void 0 ? void 0 : _styleConfig$value3.color) !== null && _styleConfig$value$co !== void 0 ? _styleConfig$value$co : "rgba(0, 0, 0, 0.85)"
79
+ };
80
+ }, [styleConfig]);
81
+ const formattedValue = useMemo(() => {
82
+ return formatMetricValue(value, formatConfig);
83
+ }, [value, formatConfig]);
84
+ const comparisonConfig = useMemo(() => {
85
+ var _comparison$text, _comparison$showTrend, _comparison$positiveC, _comparison$negativeC, _comparison$size;
86
+ if (!(comparison === null || comparison === void 0 ? void 0 : comparison.value)) return null;
87
+ return {
88
+ value: comparison.value,
89
+ text: (_comparison$text = comparison.text) !== null && _comparison$text !== void 0 ? _comparison$text : "v.s. pre",
90
+ showTrendIcon: (_comparison$showTrend = comparison.showTrendIcon) !== null && _comparison$showTrend !== void 0 ? _comparison$showTrend : true,
91
+ positiveColor: (_comparison$positiveC = comparison.positiveColor) !== null && _comparison$positiveC !== void 0 ? _comparison$positiveC : "#52c41a",
92
+ negativeColor: (_comparison$negativeC = comparison.negativeColor) !== null && _comparison$negativeC !== void 0 ? _comparison$negativeC : "#ff4d4f",
93
+ size: (_comparison$size = comparison.size) !== null && _comparison$size !== void 0 ? _comparison$size : 14
94
+ };
95
+ }, [comparison]);
96
+ return /* @__PURE__ */ React.createElement(pisellCard_default, {
97
+ bordered: cardStyle.bordered,
98
+ borderRadius: cardStyle.borderRadius,
99
+ padding: cardStyle.padding,
100
+ loading,
101
+ isClickable: !!onClick,
102
+ onClick,
103
+ style: _objectSpread2({
104
+ width: typeof cardStyle.width === "number" ? `${cardStyle.width}px` : cardStyle.width,
105
+ background: cardStyle.background,
106
+ boxShadow: typeof cardStyle.shadow === "string" ? cardStyle.shadow : cardStyle.shadow ? "0px 1px 2px 0px rgba(16, 24, 40, 0.05)" : "none"
107
+ }, style),
108
+ className: `pisell-metric-card ${className || ""}`
109
+ }, /* @__PURE__ */ React.createElement(MetricTitle_default, {
110
+ title,
111
+ subtitle: showSubtitle ? subtitle : void 0,
112
+ tooltip: showTooltip ? tooltip : void 0,
113
+ titleSize: titleStyle.size,
114
+ titleWeight: titleStyle.weight,
115
+ titleColor: titleStyle.color
116
+ }), /* @__PURE__ */ React.createElement(MetricValue_default, {
117
+ value: formattedValue,
118
+ valueSize: valueStyle.size,
119
+ valueWeight: valueStyle.weight,
120
+ valueColor: valueStyle.color
121
+ }), comparisonConfig && /* @__PURE__ */ React.createElement(MetricComparison_default, {
122
+ comparison: comparisonConfig.value,
123
+ comparisonText: comparisonConfig.text,
124
+ showTrendIcon: comparisonConfig.showTrendIcon,
125
+ positiveColor: comparisonConfig.positiveColor,
126
+ negativeColor: comparisonConfig.negativeColor,
127
+ comparisonSize: comparisonConfig.size,
128
+ precision: formatConfig.precision,
129
+ showCurrencySymbol: formatConfig.showCurrencySymbol,
130
+ currencySymbol: formatConfig.currencySymbol
131
+ }), showTag && tag && /* @__PURE__ */ React.createElement("div", { className: "pisell-metric-card-tag" }, tag));
132
+ };
133
+ var PisellMetricCard_default = PisellMetricCard;
134
+
135
+ //#endregion
136
+ export { PisellMetricCard_default as default };
@@ -0,0 +1,54 @@
1
+ import TrendIcon_default from "./TrendIcon.js";
2
+ import { formatMetricValue } from "../utils/formatMetricValue.js";
3
+ import { calculateTrend } from "../utils/calculateTrend.js";
4
+ import React, { useMemo } from "react";
5
+
6
+ //#region src/components/pisellMetricCard/components/MetricComparison.tsx
7
+ /**
8
+ * MetricComparison 环比信息组件
9
+ *
10
+ * 负责渲染环比数值和趋势箭头
11
+ * - 自动根据正负值显示不同颜色
12
+ * - 支持格式化环比数值
13
+ * - 集成趋势箭头组件
14
+ *
15
+ * @param props 组件属性
16
+ */
17
+ const MetricComparison = ({ comparison, comparisonText = "v.s. pre", showTrendIcon = true, positiveColor = "#52c41a", negativeColor = "#ff4d4f", comparisonSize = 14, precision, showCurrencySymbol, currencySymbol }) => {
18
+ const trend = useMemo(() => {
19
+ return calculateTrend(comparison);
20
+ }, [comparison]);
21
+ const formattedComparison = useMemo(() => {
22
+ if (comparison === null || comparison === void 0) return null;
23
+ const numComparison = typeof comparison === "string" ? parseFloat(comparison) : comparison;
24
+ if (isNaN(numComparison)) return null;
25
+ return formatMetricValue(Math.abs(numComparison), {
26
+ precision,
27
+ showCurrencySymbol,
28
+ currencySymbol,
29
+ useGrouping: false
30
+ });
31
+ }, [
32
+ comparison,
33
+ precision,
34
+ showCurrencySymbol,
35
+ currencySymbol
36
+ ]);
37
+ if (formattedComparison === null || trend === "neutral") return null;
38
+ const color = trend === "up" ? positiveColor : negativeColor;
39
+ const sign = trend === "up" ? "+" : "-";
40
+ return /* @__PURE__ */ React.createElement("div", {
41
+ className: "pisell-metric-card-comparison",
42
+ style: {
43
+ fontSize: typeof comparisonSize === "number" ? `${comparisonSize}px` : comparisonSize,
44
+ color
45
+ }
46
+ }, /* @__PURE__ */ React.createElement("span", null, comparisonText), /* @__PURE__ */ React.createElement("span", null, sign, formattedComparison), showTrendIcon && /* @__PURE__ */ React.createElement(TrendIcon_default, {
47
+ trend,
48
+ color
49
+ }));
50
+ };
51
+ var MetricComparison_default = MetricComparison;
52
+
53
+ //#endregion
54
+ export { MetricComparison_default as default };
@@ -0,0 +1,41 @@
1
+ import { Tooltip } from "antd";
2
+ import React from "react";
3
+ import { QuestionCircleOutlined } from "@ant-design/icons";
4
+
5
+ //#region src/components/pisellMetricCard/components/MetricTitle.tsx
6
+ /**
7
+ * MetricTitle 标题组件
8
+ *
9
+ * 负责渲染标题、副标题和提示信息
10
+ * 支持自定义字号、字重、颜色等样式
11
+ *
12
+ * @param props 组件属性
13
+ */
14
+ const MetricTitle = ({ title, subtitle, tooltip, titleSize = 14, titleWeight = 400, titleColor = "rgba(0, 0, 0, 0.45)" }) => {
15
+ return /* @__PURE__ */ React.createElement("div", { className: "pisell-metric-card-title-wrapper" }, /* @__PURE__ */ React.createElement("div", {
16
+ className: "pisell-metric-card-title",
17
+ style: {
18
+ fontSize: typeof titleSize === "number" ? `${titleSize}px` : titleSize,
19
+ fontWeight: titleWeight,
20
+ color: titleColor,
21
+ display: "flex",
22
+ alignItems: "center",
23
+ gap: "4px"
24
+ }
25
+ }, title, tooltip && /* @__PURE__ */ React.createElement(Tooltip, { title: tooltip }, /* @__PURE__ */ React.createElement(QuestionCircleOutlined, { style: {
26
+ fontSize: 12,
27
+ color: titleColor,
28
+ cursor: "help"
29
+ } }))), subtitle && /* @__PURE__ */ React.createElement("div", {
30
+ className: "pisell-metric-card-subtitle",
31
+ style: {
32
+ fontSize: 12,
33
+ fontWeight: 400,
34
+ color: titleColor
35
+ }
36
+ }, subtitle));
37
+ };
38
+ var MetricTitle_default = MetricTitle;
39
+
40
+ //#endregion
41
+ export { MetricTitle_default as default };
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+
3
+ //#region src/components/pisellMetricCard/components/MetricValue.tsx
4
+ /**
5
+ * MetricValue 数值展示组件
6
+ *
7
+ * 负责渲染格式化后的主数值
8
+ * 支持自定义字号、字重、颜色等样式
9
+ *
10
+ * @param props 组件属性
11
+ */
12
+ const MetricValue = ({ value, valueSize = 30, valueWeight = 600, valueColor = "rgba(0, 0, 0, 0.85)" }) => {
13
+ const displayValue = value !== null && value !== void 0 ? value : "-";
14
+ return /* @__PURE__ */ React.createElement("div", {
15
+ className: "pisell-metric-card-value",
16
+ style: {
17
+ fontSize: typeof valueSize === "number" ? `${valueSize}px` : valueSize,
18
+ fontWeight: valueWeight,
19
+ color: valueColor
20
+ }
21
+ }, displayValue);
22
+ };
23
+ var MetricValue_default = MetricValue;
24
+
25
+ //#endregion
26
+ export { MetricValue_default as default };
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { ArrowDownOutlined, ArrowUpOutlined } from "@ant-design/icons";
3
+
4
+ //#region src/components/pisellMetricCard/components/TrendIcon.tsx
5
+ /**
6
+ * TrendIcon 趋势箭头组件
7
+ *
8
+ * 根据趋势类型显示上升或下降箭头
9
+ * - up: 显示上升箭头 ↑
10
+ * - down: 显示下降箭头 ↓
11
+ * - neutral: 不显示箭头
12
+ *
13
+ * @param props 组件属性
14
+ */
15
+ const TrendIcon = ({ trend, color }) => {
16
+ if (trend === "neutral") return null;
17
+ const Icon = trend === "up" ? ArrowUpOutlined : ArrowDownOutlined;
18
+ return /* @__PURE__ */ React.createElement(Icon, {
19
+ className: "pisell-metric-card-trend-icon",
20
+ style: { color }
21
+ });
22
+ };
23
+ var TrendIcon_default = TrendIcon;
24
+
25
+ //#endregion
26
+ export { TrendIcon_default as default };