@fe-free/core 6.0.21 → 6.0.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 6.0.22
4
+
5
+ ### Patch Changes
6
+
7
+ - types
8
+ - @fe-free/icons@6.0.22
9
+ - @fe-free/tool@6.0.22
10
+
3
11
  ## 6.0.21
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "6.0.21",
3
+ "version": "6.0.22",
4
4
  "description": "React 业务核心组件库:CRUD、ProForm 扩展、布局、路由、树、上传等(Antd + ProComponents)",
5
5
  "license": "ISC",
6
6
  "author": "",
7
7
  "main": "./src/index.ts",
8
+ "types": "./src/index.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./src/index.ts",
12
+ "import": "./src/index.ts",
13
+ "require": "./src/index.ts"
14
+ }
15
+ },
8
16
  "publishConfig": {
9
17
  "access": "public",
10
18
  "registry": "https://registry.npmjs.org/"
@@ -43,8 +51,8 @@
43
51
  "i18next-icu": "^2.4.1",
44
52
  "react": "^19.2.0",
45
53
  "react-i18next": "^16.4.0",
46
- "@fe-free/icons": "6.0.21",
47
- "@fe-free/tool": "6.0.21"
54
+ "@fe-free/tool": "6.0.22",
55
+ "@fe-free/icons": "6.0.22"
48
56
  },
49
57
  "scripts": {
50
58
  "i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
@@ -11,9 +11,9 @@ interface ProFormListModalHelperProps<T> {
11
11
  onChange?: (value: T[]) => void;
12
12
  children: (props: { value?: T[]; item: T; index: number }) => React.ReactNode;
13
13
  readOnly?: boolean;
14
- detailForm: JSX.Element;
14
+ detailForm: React.ReactElement;
15
15
  // 如果 addForm 存在,则使用 addForm 作为添加按钮
16
- addForm?: JSX.Element;
16
+ addForm?: React.ReactElement;
17
17
  // 禁用添加的提交按钮
18
18
  disabledSubmitter?: boolean;
19
19
  // 禁用添加
@@ -23,15 +23,15 @@ interface ProFormListModalHelperProps<T> {
23
23
  // 禁用删除
24
24
  disabledDelete?: boolean;
25
25
  // 触发添加
26
- addTrigger?: JSX.Element;
26
+ addTrigger?: React.ReactElement;
27
27
  editForm?: any;
28
28
  }
29
29
 
30
30
  function Edit<T>(props: {
31
- children: JSX.Element;
31
+ children: React.ReactElement;
32
32
  values?: T;
33
33
  onChange: (values: T) => void;
34
- detailForm: JSX.Element;
34
+ detailForm: React.ReactElement;
35
35
  editForm?: any;
36
36
  disabledSubmitter?: boolean;
37
37
  }) {
@@ -81,7 +81,7 @@ function ProFormListModalHelper<T = any>(props: ProFormListModalHelperProps<T>)
81
81
  })}
82
82
  </div>
83
83
  {!props.readOnly && (
84
- <div className="absolute right-1 top-1 hidden items-center bg-white group-hover:flex">
84
+ <div className="absolute top-1 right-1 hidden items-center bg-white group-hover:flex">
85
85
  {!props.disabledEdit && (
86
86
  <Edit<T>
87
87
  values={item}
@@ -25,9 +25,6 @@ interface LineChartConfig {
25
25
  title: string;
26
26
  }
27
27
 
28
- // @ts-ignore
29
- interface ChartConfig extends ChartConfigBase, ChartConfigLine {}
30
-
31
28
  // 错误处理组件
32
29
  function ChartError(props: { children?: React.ReactNode }) {
33
30
  const { children } = props;
@@ -38,15 +35,15 @@ function ChartError(props: { children?: React.ReactNode }) {
38
35
  );
39
36
  }
40
37
 
41
- class ErrorBoundary extends React.Component {
38
+ class ErrorBoundary extends React.Component<{ children?: React.ReactNode }, { hasError: boolean }> {
42
39
  state = { hasError: false };
43
40
 
44
- static getDerivedStateFromError(error) {
41
+ static getDerivedStateFromError(error: unknown) {
45
42
  console.error('ErrorBoundary:', error);
46
43
  return { hasError: true };
47
44
  }
48
45
 
49
- componentDidCatch(error, info) {
46
+ componentDidCatch(error: unknown, info: React.ErrorInfo) {
50
47
  console.error('Error caught:', error, info);
51
48
  }
52
49
 
@@ -70,7 +67,7 @@ function ChartContainer(props: { title: string; children: React.ReactNode }) {
70
67
  }
71
68
 
72
69
  // 饼图组件
73
- function PieChart(props: { data: ChartData; chart: ChartConfig }) {
70
+ function PieChart(props: { data: ChartData; chart: ChartConfigBase }) {
74
71
  const { data, chart } = props;
75
72
  const { columns, rows } = data;
76
73
  const { angle_field, color_field } = chart;
@@ -186,7 +183,7 @@ function LineChart(props: { data: ChartData; chart: LineChartConfig }) {
186
183
  }
187
184
 
188
185
  // 柱状图组件
189
- function BarChart(props: { data: ChartData; chart: ChartConfig }) {
186
+ function BarChart(props: { data: ChartData; chart: ChartConfigBase }) {
190
187
  const { data, chart } = props;
191
188
  const { columns, rows } = data;
192
189
  const { x_field, y_field } = chart;
@@ -217,7 +214,7 @@ function BarChart(props: { data: ChartData; chart: ChartConfig }) {
217
214
  return <Column {...config} />;
218
215
  }
219
216
 
220
- function ScatterChart(props: { data: ChartData; chart: ChartConfig }) {
217
+ function ScatterChart(props: { data: ChartData; chart: ChartConfigBase }) {
221
218
  const { data, chart } = props;
222
219
  const { columns, rows } = data;
223
220
  const { x_field, y_field } = chart;
@@ -86,15 +86,15 @@ function ChartError(props: { children?: React.ReactNode }) {
86
86
  );
87
87
  }
88
88
 
89
- class ErrorBoundary extends React.Component {
89
+ class ErrorBoundary extends React.Component<{ children?: React.ReactNode }, { hasError: boolean }> {
90
90
  state = { hasError: false };
91
91
 
92
- static getDerivedStateFromError(error) {
92
+ static getDerivedStateFromError(error: unknown) {
93
93
  console.error('ErrorBoundary:', error);
94
94
  return { hasError: true };
95
95
  }
96
96
 
97
- componentDidCatch(error, info) {
97
+ componentDidCatch(error: unknown, info: React.ErrorInfo) {
98
98
  console.error('Error caught:', error, info);
99
99
  }
100
100
 
@@ -1,6 +1,8 @@
1
1
  import { InputNumber, Slider } from 'antd';
2
2
  import classNames from 'classnames';
3
3
  import { useCallback, useMemo } from 'react';
4
+
5
+ // @ts-ignore
4
6
  import './style.scss';
5
7
 
6
8
  interface NumberSliderProps {
@@ -89,7 +91,7 @@ function PercentageSlider(props: PercentageSliderProps) {
89
91
  [max]: max,
90
92
  };
91
93
 
92
- [...sliderValue, max].forEach((v, i) => {
94
+ [...sliderValue, max].forEach((_, i) => {
93
95
  const m = value[i] / 2 + (sliderValue[i - 1] || min);
94
96
  result[m] = value[i];
95
97
  // result[v] = value[i];
@@ -0,0 +1,5 @@
1
+ declare module '*.svg?react' {
2
+ import type React from 'react';
3
+ const SVGComponent: React.FC<React.SVGProps<SVGSVGElement>>;
4
+ export default SVGComponent;
5
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true
5
+ },
6
+ "include": ["src/**/*"],
7
+ "exclude": ["src/**/*.stories.tsx"]
8
+ }