@platox/pivot-table 0.0.2
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/README.md +54 -0
- package/index.d.ts +87 -0
- package/lib/index.js +43181 -0
- package/lib/index.umd.cjs +178 -0
- package/lib/style.css +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
13
|
+
|
|
14
|
+
- Configure the top-level `parserOptions` property like this:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
export default tseslint.config({
|
|
18
|
+
languageOptions: {
|
|
19
|
+
// other options...
|
|
20
|
+
parserOptions: {
|
|
21
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
22
|
+
tsconfigRootDir: import.meta.dirname,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
|
29
|
+
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
|
30
|
+
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
// eslint.config.js
|
|
34
|
+
import react from 'eslint-plugin-react'
|
|
35
|
+
|
|
36
|
+
export default tseslint.config({
|
|
37
|
+
// Set the react version
|
|
38
|
+
settings: { react: { version: '18.3' } },
|
|
39
|
+
plugins: {
|
|
40
|
+
// Add the react plugin
|
|
41
|
+
react,
|
|
42
|
+
},
|
|
43
|
+
rules: {
|
|
44
|
+
// other rules...
|
|
45
|
+
// Enable its recommended rules
|
|
46
|
+
...react.configs.recommended.rules,
|
|
47
|
+
...react.configs['jsx-runtime'].rules,
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
修改上述代码
|
|
53
|
+
|
|
54
|
+
增加背景标尺布局块:将屏幕分成12个网格,网格与网格之间相隔10px,最边缘网格距离屏幕上下左右10px,屏幕大小变化时,网格的宽度根据屏幕重新计算,网格的高度暂时定50px,拖动时才显示网格
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export interface ModuleValueType {
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
|
+
id?: any;
|
|
4
|
+
type?:
|
|
5
|
+
| "text"
|
|
6
|
+
| "statistics"
|
|
7
|
+
| "chart-bar"
|
|
8
|
+
| "chart-bar-pile"
|
|
9
|
+
| "chart-bar-percentage"
|
|
10
|
+
| "chart-line"
|
|
11
|
+
| "chart-line-smooth"
|
|
12
|
+
| "chart-strip-bar"
|
|
13
|
+
| "chart-strip-bar-pile"
|
|
14
|
+
| "chart-strip-bar-percentage"
|
|
15
|
+
| "chart-pie"
|
|
16
|
+
| "chart-pie-circular"
|
|
17
|
+
| "calendar";
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
customData?: any;
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
customeStyle?: any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ModuleData {
|
|
25
|
+
id?: string;
|
|
26
|
+
i?: string;
|
|
27
|
+
w: number;
|
|
28
|
+
h: number;
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
type: ModuleValueType["type"];
|
|
32
|
+
customData?: ModuleValueType["customData"];
|
|
33
|
+
customeStyle?: ModuleValueType["customeStyle"];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface SourceDataFieldsTypes {
|
|
37
|
+
label: string;
|
|
38
|
+
enum: string | number[];
|
|
39
|
+
value: string;
|
|
40
|
+
type: "int" | "timestamp" | "string" | "bool";
|
|
41
|
+
}
|
|
42
|
+
export interface SourceDataTypes {
|
|
43
|
+
fields: SourceDataFieldsTypes[];
|
|
44
|
+
label: string;
|
|
45
|
+
value: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ModuleConfigDataTypes = ModuleData[];
|
|
49
|
+
|
|
50
|
+
export type ModuleDataApi = (id: unknown) => Promise<unknown>;
|
|
51
|
+
|
|
52
|
+
export interface DashboardWorkbenchProps {
|
|
53
|
+
sourceData?: SourceDataTypes[];
|
|
54
|
+
moduleConfigData?: ModuleConfigDataTypes;
|
|
55
|
+
fieldMap?: Record<string, string>;
|
|
56
|
+
lang?: "zh_CN" | "en_US";
|
|
57
|
+
moduleDataApi?: ModuleDataApi;
|
|
58
|
+
onCreateModule?: (val: ModuleData) => Promise<ModuleData>;
|
|
59
|
+
onUpdateModule?: (val: ModuleData) => Promise<ModuleData>;
|
|
60
|
+
onDeleteModule?: (val: string) => Promise<void>;
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
onLayoutChange?: (layout: any) => void;
|
|
63
|
+
className?: string;
|
|
64
|
+
cols?: { lg: number; md: number; sm: number; xs: number; xxs: number };
|
|
65
|
+
rowHeight?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
declare module "pivot-table" {
|
|
70
|
+
|
|
71
|
+
interface PivotTableProps {
|
|
72
|
+
sourceData?: SourceDataTypes[];
|
|
73
|
+
moduleConfigData?: ModuleConfigDataTypes;
|
|
74
|
+
fieldMap?: Record<string, string>;
|
|
75
|
+
lang?: "zh_CN" | "en_US";
|
|
76
|
+
moduleDataApi?: ModuleDataApi;
|
|
77
|
+
onCreateModule?: (val: ModuleData) => Promise<ModuleData>;
|
|
78
|
+
onUpdateModule?: (val: ModuleData) => Promise<ModuleData>;
|
|
79
|
+
onDeleteModule?: (val: string) => Promise<void>;
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
onLayoutChange?: (layout: any) => void;
|
|
82
|
+
className?: string;
|
|
83
|
+
cols?: { lg: number; md: number; sm: number; xs: number; xxs: number };
|
|
84
|
+
rowHeight?: number;
|
|
85
|
+
}
|
|
86
|
+
export const PivotTable: React.FC<PivotTableProps>;
|
|
87
|
+
}
|