@platox/pivot-table 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,93 +1,98 @@
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 = ({
51
- id,
52
- query,
53
- }: {
54
- id?: string;
55
- query?: string;
56
- }) => Promise<unknown>;
57
-
58
- export interface DashboardWorkbenchProps {
59
- sourceData?: SourceDataTypes[];
60
- moduleConfigData?: ModuleConfigDataTypes;
61
- fieldMap?: Record<string, string>;
62
- lang?: "zh_CN" | "en_US";
63
- moduleDataApi?: ModuleDataApi;
64
- onCreateModule?: (val: ModuleData) => Promise<ModuleData>;
65
- onUpdateModule?: (val: ModuleData) => Promise<ModuleData>;
66
- onDeleteModule?: (val: string) => Promise<void>;
67
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
- onLayoutChange?: (layout: any) => void;
69
- className?: string;
70
- cols?: { lg: number; md: number; sm: number; xs: number; xxs: number };
71
- rowHeight?: number;
72
- }
73
-
74
-
75
- declare module "pivot-table" {
76
-
77
- interface PivotTableProps {
78
- sourceData?: SourceDataTypes[];
79
- moduleConfigData?: ModuleConfigDataTypes;
80
- fieldMap?: Record<string, string>;
81
- lang?: "zh_CN" | "en_US";
82
- moduleDataApi?: ModuleDataApi;
83
- onCreateModule?: (val: ModuleData) => Promise<ModuleData>;
84
- onUpdateModule?: (val: ModuleData) => Promise<ModuleData>;
85
- onDeleteModule?: (val: string) => Promise<void>;
86
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
- onLayoutChange?: (layout: any) => void;
88
- className?: string;
89
- cols?: { lg: number; md: number; sm: number; xs: number; xxs: number };
90
- rowHeight?: number;
91
- }
92
- export const PivotTable: React.FC<PivotTableProps>;
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 = ({
51
+ id,
52
+ query,
53
+ }: {
54
+ id?: string;
55
+ query?: string;
56
+ }) => Promise<unknown>;
57
+
58
+ export type EnumDataApi = (url?: string) => Promise<unknown> | undefined;
59
+
60
+
61
+ export interface DashboardWorkbenchProps {
62
+ sourceData?: SourceDataTypes[];
63
+ moduleConfigData?: ModuleConfigDataTypes;
64
+ fieldMap?: Record<string, string>;
65
+ lang?: "zh_CN" | "en_US";
66
+ moduleDataApi?: ModuleDataApi;
67
+ enumDataApi?: EnumDataApi;
68
+ onCreateModule?: (val: ModuleData) => Promise<ModuleData>;
69
+ onUpdateModule?: (val: ModuleData) => Promise<ModuleData>;
70
+ onDeleteModule?: (val: string) => Promise<void>;
71
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
+ onLayoutChange?: (layout: any) => void;
73
+ className?: string;
74
+ cols?: { lg: number; md: number; sm: number; xs: number; xxs: number };
75
+ rowHeight?: number;
76
+ }
77
+
78
+
79
+ declare module "pivot-table" {
80
+
81
+ interface PivotTableProps {
82
+ sourceData?: SourceDataTypes[];
83
+ moduleConfigData?: ModuleConfigDataTypes;
84
+ fieldMap?: Record<string, string>;
85
+ lang?: "zh_CN" | "en_US";
86
+ moduleDataApi?: ModuleDataApi;
87
+ enumDataApi?: EnumDataApi;
88
+ onCreateModule?: (val: ModuleData) => Promise<ModuleData>;
89
+ onUpdateModule?: (val: ModuleData) => Promise<ModuleData>;
90
+ onDeleteModule?: (val: string) => Promise<void>;
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ onLayoutChange?: (layout: any) => void;
93
+ className?: string;
94
+ cols?: { lg: number; md: number; sm: number; xs: number; xxs: number };
95
+ rowHeight?: number;
96
+ }
97
+ export const PivotTable: React.FC<PivotTableProps>;
93
98
  }
package/lib/index.js CHANGED
@@ -40241,13 +40241,13 @@ const MP = ({
40241
40241
  onOk: r,
40242
40242
  fieldOptions: n,
40243
40243
  value: i,
40244
- getEnumDataApi: a
40244
+ enumDataApi: a
40245
40245
  }) => {
40246
40246
  const [o] = ye.useForm(), s = mt(), { t: u } = an(), l = Ze(() => {
40247
40247
  if (i != null && i.conditionList) {
40248
40248
  const g = JSON.parse(JSON.stringify(i == null ? void 0 : i.conditionList));
40249
40249
  o.setFieldsValue({
40250
- conditionList: g.map((v) => (v.type === "timestamp" && (v.val && (v.val = ai(v.val)), v.val2 && (v.val2 = ai(v.val2))), v)),
40250
+ conditionList: g.map((v) => (v.type === "timestamp" && (v.val && (v.val = ai(v.val)), v.val2 && (v.val2 = ai(v.val2))), (v.val === void 0 || v.val === "") && (v.val = ""), (v.val2 === void 0 || v.val2 === "") && (v.val2 = ""), v)),
40251
40251
  conditionType: i.conditionType
40252
40252
  });
40253
40253
  } else
@@ -40257,14 +40257,11 @@ const MP = ({
40257
40257
  });
40258
40258
  }, [i]), [f, c] = Pe([]), h = ({
40259
40259
  url: g,
40260
- value: v,
40261
- callback: m
40260
+ callback: v
40262
40261
  }) => {
40263
- const y = JSON.stringify({
40264
- q: v
40265
- });
40266
- a(g, y).then((b) => {
40267
- m(b.data);
40262
+ var m;
40263
+ (m = a == null ? void 0 : a(g)) == null || m.then((y) => {
40264
+ v(y.data);
40268
40265
  });
40269
40266
  }, d = (g) => {
40270
40267
  kf && (clearTimeout(kf), kf = null), kf = setTimeout(() => {
@@ -40577,7 +40574,7 @@ const MP = ({
40577
40574
  }, $Y = ({
40578
40575
  selectModuleData: t,
40579
40576
  onAllValuesChange: e,
40580
- getEnumDataApi: r
40577
+ enumDataApi: r
40581
40578
  }) => {
40582
40579
  const { globalData: n } = Bs(), [i] = ye.useForm(), [a, o] = Pe(), [s, u] = Pe(!1), l = mt(), [f, c] = Pe(), [h, d] = Pe(0), { t: p } = an(), g = {
40583
40580
  dataSourceId: "",
@@ -40731,7 +40728,7 @@ const MP = ({
40731
40728
  open: s,
40732
40729
  value: f,
40733
40730
  fieldOptions: a,
40734
- getEnumDataApi: r,
40731
+ enumDataApi: r,
40735
40732
  onClose: () => {
40736
40733
  u(!1);
40737
40734
  },
@@ -40858,7 +40855,7 @@ const MP = ({
40858
40855
  onOk: r,
40859
40856
  moduleDataApi: n,
40860
40857
  selectModuleData: i,
40861
- getEnumDataApi: a
40858
+ enumDataApi: a
40862
40859
  }) => {
40863
40860
  const { t: o } = an(), [s, u] = Pe(), [l, f] = Pe(), c = () => {
40864
40861
  e == null || e();
@@ -40915,7 +40912,7 @@ const MP = ({
40915
40912
  $Y,
40916
40913
  {
40917
40914
  selectModuleData: i,
40918
- getEnumDataApi: a,
40915
+ enumDataApi: a,
40919
40916
  onAllValuesChange: (h) => {
40920
40917
  u(h);
40921
40918
  }
@@ -41117,18 +41114,19 @@ const MP = ({
41117
41114
  }
41118
41115
  },
41119
41116
  children: /* @__PURE__ */ A.jsxs("div", { className: "config-widget-dialog-container", children: [
41120
- /* @__PURE__ */ A.jsx("div", { className: "config-widget-dialog-content", children: /* @__PURE__ */ A.jsx("div", { className: "config-widget-dialog-preview", style: { height: "50vh" }, children: /* @__PURE__ */ A.jsx(
41117
+ /* @__PURE__ */ A.jsx("div", { className: "config-widget-dialog-content", children: /* @__PURE__ */ A.jsx("div", { className: "config-widget-dialog-preview", style: { borderRight: "1px solid #e0e0e0" }, children: /* @__PURE__ */ A.jsx(
41121
41118
  o2,
41122
41119
  {
41123
41120
  customData: o,
41124
41121
  moduleDataApi: n
41125
41122
  }
41126
41123
  ) }) }),
41127
- /* @__PURE__ */ A.jsxs("div", { className: "config-widget-dialog-panel", children: [
41124
+ /* @__PURE__ */ A.jsxs("div", { className: "config-widget-dialog-panel", style: { borderLeft: "none" }, children: [
41128
41125
  /* @__PURE__ */ A.jsx(
41129
41126
  "div",
41130
41127
  {
41131
41128
  className: "bitable-dashboard edit-panel-container",
41129
+ style: { paddingTop: "20px" },
41132
41130
  children: /* @__PURE__ */ A.jsx(
41133
41131
  GY,
41134
41132
  {
@@ -41485,7 +41483,7 @@ const MP = ({
41485
41483
  selectModuleData: t,
41486
41484
  onAllValuesChange: e,
41487
41485
  onValuesChange: r,
41488
- getEnumDataApi: n
41486
+ enumDataApi: n
41489
41487
  }) => {
41490
41488
  const { globalData: i } = Bs(), [a] = ye.useForm(), [o, s] = Pe(), [u, l] = Pe(!1), f = mt(), [c, h] = Pe(), [d, p] = Pe(0), { t: g } = an(), v = ye.useWatch("type", a), m = {
41491
41489
  dataSourceId: "",
@@ -41744,7 +41742,7 @@ const MP = ({
41744
41742
  open: u,
41745
41743
  value: c,
41746
41744
  fieldOptions: o,
41747
- getEnumDataApi: n,
41745
+ enumDataApi: n,
41748
41746
  onClose: () => {
41749
41747
  l(!1);
41750
41748
  },
@@ -43725,7 +43723,7 @@ const zX = () => /* @__PURE__ */ A.jsx(
43725
43723
  moduleConfigData: e,
43726
43724
  fieldMap: r,
43727
43725
  moduleDataApi: n,
43728
- getEnumDataApi: i,
43726
+ enumDataApi: i,
43729
43727
  onCreateModule: a,
43730
43728
  onUpdateModule: o,
43731
43729
  onDeleteModule: s,
@@ -44009,7 +44007,7 @@ const zX = () => /* @__PURE__ */ A.jsx(
44009
44007
  }), P(!1);
44010
44008
  },
44011
44009
  moduleDataApi: n,
44012
- getEnumDataApi: i
44010
+ enumDataApi: i
44013
44011
  }
44014
44012
  ),
44015
44013
  /* @__PURE__ */ A.jsx(
@@ -44030,7 +44028,7 @@ const zX = () => /* @__PURE__ */ A.jsx(
44030
44028
  }), B(!1);
44031
44029
  },
44032
44030
  moduleDataApi: n,
44033
- getEnumDataApi: i
44031
+ enumDataApi: i
44034
44032
  }
44035
44033
  ),
44036
44034
  /* @__PURE__ */ A.jsx(
@@ -44053,7 +44051,7 @@ const zX = () => /* @__PURE__ */ A.jsx(
44053
44051
  }), I(!1);
44054
44052
  },
44055
44053
  moduleDataApi: n,
44056
- getEnumDataApi: i
44054
+ enumDataApi: i
44057
44055
  }
44058
44056
  )
44059
44057
  ] });