@platox/pivot-table 0.0.34 → 0.0.36
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/es/dashboard-workbench/components/add-module-btn/index.js +14 -5
- package/es/dashboard-workbench/components/add-module-btn/index.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/custome-data.d.ts +3 -3
- package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/custome-data.js +73 -82
- package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/custome-data.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/index.d.ts +1 -5
- package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/index.js +13 -22
- package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/index.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/CombinationChartOptionPicker.d.ts +18 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/CombinationChartOptionPicker.js +103 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/CombinationChartOptionPicker.js.map +1 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/GroupFieldConfigPicker.d.ts +14 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/GroupFieldConfigPicker.js +79 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/GroupFieldConfigPicker.js.map +1 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/index.module.less.js +11 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/components/index.module.less.js.map +1 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/config.d.ts +14 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/config.js +153 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/config.js.map +1 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-data.d.ts +1 -19
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-data.js +132 -101
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-data.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-styles.d.ts +0 -6
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-styles.js +2 -4
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-styles.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.d.ts +1 -8
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.js +13 -22
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.module.less.js +7 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.module.less.js.map +1 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/interface.d.ts +62 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/interface.js +31 -0
- package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/interface.js.map +1 -0
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-data.d.ts +3 -3
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-data.js +2 -2
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-data.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-styles.js +16 -11
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-styles.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/index.d.ts +1 -7
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/index.js +13 -22
- package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/index.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/config.d.ts +30 -0
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/config.js +132 -0
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/config.js.map +1 -0
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/debounce-select.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/index.d.ts +4 -12
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/index.js +6 -200
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/index.js.map +1 -1
- package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/interface.d.ts +14 -0
- package/es/dashboard-workbench/components/global-filter-condition/ConditionRowItem.d.ts +9 -0
- package/es/dashboard-workbench/components/global-filter-condition/ConditionRowItem.js +90 -0
- package/es/dashboard-workbench/components/global-filter-condition/ConditionRowItem.js.map +1 -0
- package/es/dashboard-workbench/components/global-filter-condition/ConditionSymbolAndValuePicker.d.ts +15 -0
- package/es/dashboard-workbench/components/global-filter-condition/ConditionSymbolAndValuePicker.js +218 -0
- package/es/dashboard-workbench/components/global-filter-condition/ConditionSymbolAndValuePicker.js.map +1 -0
- package/es/dashboard-workbench/components/global-filter-condition/FieldPicker.d.ts +13 -0
- package/es/dashboard-workbench/components/global-filter-condition/FieldPicker.js +56 -0
- package/es/dashboard-workbench/components/global-filter-condition/FieldPicker.js.map +1 -0
- package/es/dashboard-workbench/components/global-filter-condition/index.d.ts +13 -0
- package/es/dashboard-workbench/components/global-filter-condition/index.js +311 -0
- package/es/dashboard-workbench/components/global-filter-condition/index.js.map +1 -0
- package/es/dashboard-workbench/components/global-filter-condition/index.module.less.js +8 -0
- package/es/dashboard-workbench/components/global-filter-condition/index.module.less.js.map +1 -0
- package/es/dashboard-workbench/components/global-filter-condition/interface.d.ts +9 -0
- package/es/dashboard-workbench/components/global-filter-condition/useContext.d.ts +13 -0
- package/es/dashboard-workbench/components/global-filter-condition/useContext.js +10 -0
- package/es/dashboard-workbench/components/global-filter-condition/useContext.js.map +1 -0
- package/es/dashboard-workbench/components/global-filter-condition/util.d.ts +1 -0
- package/es/dashboard-workbench/components/global-filter-condition/util.js +7 -0
- package/es/dashboard-workbench/components/global-filter-condition/util.js.map +1 -0
- package/es/dashboard-workbench/components/modal-editor-header/index.d.ts +12 -0
- package/es/dashboard-workbench/components/modal-editor-header/index.js +59 -0
- package/es/dashboard-workbench/components/modal-editor-header/index.js.map +1 -0
- package/es/dashboard-workbench/components/modal-editor-header/index.module.less.js +9 -0
- package/es/dashboard-workbench/components/modal-editor-header/index.module.less.js.map +1 -0
- package/es/dashboard-workbench/components/module-content/calendar-module/index.js +38 -26
- package/es/dashboard-workbench/components/module-content/calendar-module/index.js.map +1 -1
- package/es/dashboard-workbench/components/module-content/calendar-module/locales/en.d.ts +7 -0
- package/es/dashboard-workbench/components/module-content/calendar-module/locales/en.js +10 -0
- package/es/dashboard-workbench/components/module-content/calendar-module/locales/en.js.map +1 -0
- package/es/dashboard-workbench/components/module-content/calendar-module/locales/zh.d.ts +22 -0
- package/es/dashboard-workbench/components/module-content/calendar-module/locales/zh.js +29 -0
- package/es/dashboard-workbench/components/module-content/calendar-module/locales/zh.js.map +1 -0
- package/es/dashboard-workbench/components/module-content/chart-module/Empty.d.ts +5 -0
- package/es/dashboard-workbench/components/module-content/chart-module/Empty.js +30 -0
- package/es/dashboard-workbench/components/module-content/chart-module/Empty.js.map +1 -0
- package/es/dashboard-workbench/components/module-content/chart-module/base-chart/index.js +1 -1
- package/es/dashboard-workbench/components/module-content/chart-module/base-chart/index.js.map +1 -1
- package/es/dashboard-workbench/components/module-content/chart-module/index.d.ts +3 -4
- package/es/dashboard-workbench/components/module-content/chart-module/index.js +263 -160
- package/es/dashboard-workbench/components/module-content/chart-module/index.js.map +1 -1
- package/es/dashboard-workbench/components/module-content/chart-module/utils.d.ts +100 -2
- package/es/dashboard-workbench/components/module-content/chart-module/utils.js +66 -13
- package/es/dashboard-workbench/components/module-content/chart-module/utils.js.map +1 -1
- package/es/dashboard-workbench/components/module-content/index.js +3 -3
- package/es/dashboard-workbench/components/module-content/index.js.map +1 -1
- package/es/dashboard-workbench/components/module-content/statistics-module/index.d.ts +1 -1
- package/es/dashboard-workbench/components/module-content/statistics-module/index.js +17 -7
- package/es/dashboard-workbench/components/module-content/statistics-module/index.js.map +1 -1
- package/es/dashboard-workbench/components/module-content/text-module/editor/index.js +5 -5
- package/es/dashboard-workbench/components/module-content/text-module/editor/index.js.map +1 -1
- package/es/dashboard-workbench/components/module-content/utils.d.ts +2 -15
- package/es/dashboard-workbench/components/module-content/utils.js.map +1 -1
- package/es/dashboard-workbench/components/module-header/index.d.ts +1 -1
- package/es/dashboard-workbench/components/module-header/index.js +3 -3
- package/es/dashboard-workbench/components/module-header/index.js.map +1 -1
- package/es/dashboard-workbench/context.d.ts +21 -9
- package/es/dashboard-workbench/context.js +2 -9
- package/es/dashboard-workbench/context.js.map +1 -1
- package/es/dashboard-workbench/icon/icon-chart-combination.d.ts +3 -0
- package/es/dashboard-workbench/icon/icon-chart-combination.js +36 -0
- package/es/dashboard-workbench/icon/icon-chart-combination.js.map +1 -0
- package/es/dashboard-workbench/icon/icon-empty.d.ts +2 -0
- package/es/dashboard-workbench/icon/icon-empty.js +139 -0
- package/es/dashboard-workbench/icon/icon-empty.js.map +1 -0
- package/es/dashboard-workbench/index.d.ts +2 -2
- package/es/dashboard-workbench/index.js +92 -83
- package/es/dashboard-workbench/index.js.map +1 -1
- package/es/dashboard-workbench/lang/en-US.d.ts +38 -0
- package/es/dashboard-workbench/lang/en-US.js +32 -4
- package/es/dashboard-workbench/lang/en-US.js.map +1 -1
- package/es/dashboard-workbench/lang/index.js +2 -2
- package/es/dashboard-workbench/lang/index.js.map +1 -1
- package/es/dashboard-workbench/lang/zh-CN.d.ts +38 -0
- package/es/dashboard-workbench/lang/zh-CN.js +31 -3
- package/es/dashboard-workbench/lang/zh-CN.js.map +1 -1
- package/es/dashboard-workbench/types.d.ts +18 -5
- package/es/dashboard-workbench/utils/index.d.ts +6 -4
- package/es/dashboard-workbench/utils/index.js +24 -3
- package/es/dashboard-workbench/utils/index.js.map +1 -1
- package/es/style.css +1 -1
- package/package.json +28 -20
- package/umd/pivot-table.umd.cjs +74 -74
- package/umd/style.css +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { Tooltip, Input } from "antd";
|
|
5
|
+
import { useControllableValue, useMemoizedFn } from "ahooks";
|
|
6
|
+
import { ChartType } from "../interface.js";
|
|
7
|
+
import { CombinationChartOptionPicker } from "./CombinationChartOptionPicker.js";
|
|
8
|
+
import styles from "./index.module.less.js";
|
|
9
|
+
const componentName = "group-field-config-picker";
|
|
10
|
+
const empty = [];
|
|
11
|
+
const GroupFieldConfigPicker = (props) => {
|
|
12
|
+
const { style, className, options = empty } = props;
|
|
13
|
+
const [value = empty, setValue] = useControllableValue(props);
|
|
14
|
+
const getFieldValue = useMemoizedFn((key) => {
|
|
15
|
+
let match = (value ?? []).find((v) => v.value === key);
|
|
16
|
+
return match ? match.config : void 0;
|
|
17
|
+
});
|
|
18
|
+
const handleFieldChange = useMemoizedFn((key, config) => {
|
|
19
|
+
let newData = [...value ?? []];
|
|
20
|
+
let match = newData.find((v) => v.value === key);
|
|
21
|
+
if (match) {
|
|
22
|
+
match.config = config;
|
|
23
|
+
} else {
|
|
24
|
+
newData.push({ value: key, config });
|
|
25
|
+
}
|
|
26
|
+
setValue(newData);
|
|
27
|
+
return;
|
|
28
|
+
});
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if ((options == null ? void 0 : options.length) > 0) {
|
|
31
|
+
let newData = options.map((v) => {
|
|
32
|
+
return {
|
|
33
|
+
value: v,
|
|
34
|
+
config: {
|
|
35
|
+
chartType: ChartType["ChartBar"],
|
|
36
|
+
yAxisPos: "left",
|
|
37
|
+
...getFieldValue(v) ?? {}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
setValue(newData);
|
|
42
|
+
}
|
|
43
|
+
}, [options]);
|
|
44
|
+
return useMemo(
|
|
45
|
+
() => /* @__PURE__ */ jsx("div", { className: clsx(className, styles[`${componentName}`]), style, children: /* @__PURE__ */ jsx("div", { children: ((props == null ? void 0 : props.options) ?? []).map((fieldName) => {
|
|
46
|
+
let str = `${fieldName}`;
|
|
47
|
+
const value2 = getFieldValue(fieldName);
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx(styles[`${componentName}__item`]), children: [
|
|
49
|
+
/* @__PURE__ */ jsx(Tooltip, { title: str, children: /* @__PURE__ */ jsx("div", { className: clsx(styles[`${componentName}__input`]), children: /* @__PURE__ */ jsx(
|
|
50
|
+
Input,
|
|
51
|
+
{
|
|
52
|
+
value: str,
|
|
53
|
+
disabled: true,
|
|
54
|
+
style: {
|
|
55
|
+
width: 200,
|
|
56
|
+
pointerEvents: "none"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
) }) }),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
CombinationChartOptionPicker,
|
|
62
|
+
{
|
|
63
|
+
value: value2,
|
|
64
|
+
onChange: (v) => {
|
|
65
|
+
handleFieldChange(fieldName, v);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] }, str);
|
|
70
|
+
}) }) }),
|
|
71
|
+
[value, options]
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
GroupFieldConfigPicker.displayName = "GroupFieldConfigPicker";
|
|
75
|
+
export {
|
|
76
|
+
GroupFieldConfigPicker,
|
|
77
|
+
GroupFieldConfigPicker as default
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=GroupFieldConfigPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupFieldConfigPicker.js","sources":["../../../../../../packages/dashboard-workbench/components/add-module-modal/add-chart-modal/components/GroupFieldConfigPicker.tsx"],"sourcesContent":["import { useEffect, useMemo, type CSSProperties } from 'react'\nimport clsx from 'clsx'\nimport { Input, Tooltip } from 'antd'\nimport { useControllableValue, useMemoizedFn } from 'ahooks'\nimport { ChartCustomDataType, ChartType, CombinationChartConfig } from '../interface'\nimport { CombinationChartOptionPicker } from './CombinationChartOptionPicker'\nimport styles from './index.module.less'\n\nconst componentName = 'group-field-config-picker'\n\nconst empty: unknown[] = []\n\nexport type GroupFieldConfigPickerProps<T> = {\n style?: CSSProperties\n className?: string\n\n options?: T[]\n\n value?: ChartCustomDataType['groupFieldConfig']\n onChange?: (v: ChartCustomDataType['groupFieldConfig']) => void\n}\n\nexport const GroupFieldConfigPicker = <T,>(props: GroupFieldConfigPickerProps<T>) => {\n const { style, className, options = empty as T[] } = props\n\n const [value = empty as ChartCustomDataType['groupFieldConfig'], setValue] =\n useControllableValue<ChartCustomDataType['groupFieldConfig']>(props)\n\n const getFieldValue = useMemoizedFn((key: T) => {\n let match = (value ?? []).find(v => v.value === key)\n return match ? match.config : undefined\n })\n\n const handleFieldChange = useMemoizedFn((key: T, config: CombinationChartConfig) => {\n let newData = [...(value ?? [])]\n let match = newData.find(v => v.value === key)\n if (match) {\n match.config = config\n } else {\n newData.push({ value: key, config })\n }\n setValue(newData)\n return\n })\n\n /* ============================== 默认值 =============================== */\n useEffect(() => {\n if (options?.length > 0) {\n let newData: ChartCustomDataType['groupFieldConfig'] = options.map(v => {\n return {\n value: v,\n config: {\n chartType: ChartType['ChartBar'],\n yAxisPos: 'left',\n ...(getFieldValue(v) ?? {}),\n },\n }\n })\n setValue(newData)\n }\n }, [options])\n\n return useMemo(\n () => (\n <div className={clsx(className, styles[`${componentName}`])} style={style}>\n <div>\n {(props?.options ?? []).map(fieldName => {\n let str = `${fieldName}`\n const value = getFieldValue(fieldName)\n return (\n <div className={clsx(styles[`${componentName}__item`])} key={str}>\n <Tooltip title={str}>\n <div className={clsx(styles[`${componentName}__input`])}>\n <Input\n value={str}\n disabled={true}\n style={{\n width: 200,\n pointerEvents: 'none',\n }}\n ></Input>\n </div>\n </Tooltip>\n\n <CombinationChartOptionPicker\n value={value}\n onChange={v => {\n handleFieldChange(fieldName, v)\n }}\n />\n </div>\n )\n })}\n </div>\n </div>\n ),\n [value, options]\n )\n}\n\nGroupFieldConfigPicker.displayName = 'GroupFieldConfigPicker'\n\nexport default GroupFieldConfigPicker\n"],"names":["value"],"mappings":";;;;;;;;AAQA,MAAM,gBAAgB;AAEtB,MAAM,QAAmB,CAAC;AAYb,MAAA,yBAAyB,CAAK,UAA0C;AACnF,QAAM,EAAE,OAAO,WAAW,UAAU,MAAiB,IAAA;AAErD,QAAM,CAAC,QAAQ,OAAkD,QAAQ,IACvE,qBAA8D,KAAK;AAE/D,QAAA,gBAAgB,cAAc,CAAC,QAAW;AAC1C,QAAA,SAAS,SAAS,IAAI,KAAK,CAAK,MAAA,EAAE,UAAU,GAAG;AAC5C,WAAA,QAAQ,MAAM,SAAS;AAAA,EAAA,CAC/B;AAED,QAAM,oBAAoB,cAAc,CAAC,KAAQ,WAAmC;AAClF,QAAI,UAAU,CAAC,GAAI,SAAS,EAAG;AAC/B,QAAI,QAAQ,QAAQ,KAAK,CAAK,MAAA,EAAE,UAAU,GAAG;AAC7C,QAAI,OAAO;AACT,YAAM,SAAS;AAAA,IAAA,OACV;AACL,cAAQ,KAAK,EAAE,OAAO,KAAK,QAAQ;AAAA,IAAA;AAErC,aAAS,OAAO;AAChB;AAAA,EAAA,CACD;AAGD,YAAU,MAAM;AACV,SAAA,mCAAS,UAAS,GAAG;AACnB,UAAA,UAAmD,QAAQ,IAAI,CAAK,MAAA;AAC/D,eAAA;AAAA,UACL,OAAO;AAAA,UACP,QAAQ;AAAA,YACN,WAAW,UAAU,UAAU;AAAA,YAC/B,UAAU;AAAA,YACV,GAAI,cAAc,CAAC,KAAK,CAAA;AAAA,UAAC;AAAA,QAE7B;AAAA,MAAA,CACD;AACD,eAAS,OAAO;AAAA,IAAA;AAAA,EAClB,GACC,CAAC,OAAO,CAAC;AAEL,SAAA;AAAA,IACL,0BACG,OAAI,EAAA,WAAW,KAAK,WAAW,OAAO,GAAG,aAAa,EAAE,CAAC,GAAG,OAC3D,8BAAC,OACG,EAAA,YAAA,+BAAO,YAAW,CAAC,GAAG,IAAI,CAAa,cAAA;AACnC,UAAA,MAAM,GAAG,SAAS;AAChBA,YAAAA,SAAQ,cAAc,SAAS;AAEnC,aAAA,qBAAC,SAAI,WAAW,KAAK,OAAO,GAAG,aAAa,QAAQ,CAAC,GACnD,UAAA;AAAA,QAAA,oBAAC,SAAQ,EAAA,OAAO,KACd,UAAA,oBAAC,OAAI,EAAA,WAAW,KAAK,OAAO,GAAG,aAAa,SAAS,CAAC,GACpD,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,YACP,UAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO;AAAA,cACP,eAAe;AAAA,YAAA;AAAA,UACjB;AAAA,WAEJ,EACF,CAAA;AAAA,QAEA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAOA;AAAAA,YACP,UAAU,CAAK,MAAA;AACb,gCAAkB,WAAW,CAAC;AAAA,YAAA;AAAA,UAChC;AAAA,QAAA;AAAA,MACF,EAAA,GAnB2D,GAoB7D;AAAA,IAAA,CAEH,GACH,EACF,CAAA;AAAA,IAEF,CAAC,OAAO,OAAO;AAAA,EACjB;AACF;AAEA,uBAAuB,cAAc;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const styles = {
|
|
2
|
+
"combination-chart-option": "_combination-chart-option_1cwba_1",
|
|
3
|
+
"group-field-config-picker": "_group-field-config-picker_1cwba_11",
|
|
4
|
+
"group-field-config-picker__title": "_group-field-config-picker__title_1cwba_14",
|
|
5
|
+
"group-field-config-picker__item": "_group-field-config-picker__item_1cwba_18",
|
|
6
|
+
"group-field-config-picker__input": "_group-field-config-picker__input_1cwba_23"
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
styles as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.module.less.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.less.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DisplayRange } from './interface';
|
|
2
|
+
export declare const useChartTypeOption: () => {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}[];
|
|
7
|
+
export declare const useTimeGroupIntervalOption: () => {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}[];
|
|
11
|
+
export declare const useDisplayRangeOption: () => {
|
|
12
|
+
label: string;
|
|
13
|
+
value: DisplayRange;
|
|
14
|
+
}[];
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import SvgComponent from "../../../icon/icon-chart-combination.js";
|
|
5
|
+
import IconBar from "../../../icon/icon-bar.js";
|
|
6
|
+
import IconBarPercentage from "../../../icon/icon-bar-percentage.js";
|
|
7
|
+
import IconBarPile from "../../../icon/icon-bar-pile.js";
|
|
8
|
+
import IconLine from "../../../icon/icon-line.js";
|
|
9
|
+
import IconLineSmooth from "../../../icon/icon-line-smooth.js";
|
|
10
|
+
import IconPie from "../../../icon/icon-pie.js";
|
|
11
|
+
import IconPieCircular from "../../../icon/icon-pie-circular.js";
|
|
12
|
+
import IconStripBar from "../../../icon/icon-strip-bar.js";
|
|
13
|
+
import IconStripBarPercentage from "../../../icon/icon-strip-bar-percentage.js";
|
|
14
|
+
import IconStripBarPile from "../../../icon/icon-strip-bar-pile.js";
|
|
15
|
+
import { ChartType, DisplayRange } from "./interface.js";
|
|
16
|
+
const useChartTypeOption = () => {
|
|
17
|
+
const { t, i18n } = useTranslation();
|
|
18
|
+
const ret = useMemo(() => {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
label: t("chart.t2"),
|
|
22
|
+
value: "chart-bar",
|
|
23
|
+
icon: /* @__PURE__ */ jsx(IconBar, {})
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: t("chart.t3"),
|
|
27
|
+
value: "chart-bar-pile",
|
|
28
|
+
icon: /* @__PURE__ */ jsx(IconBarPile, {})
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: t("chart.t4"),
|
|
32
|
+
value: "chart-bar-percentage",
|
|
33
|
+
icon: /* @__PURE__ */ jsx(IconBarPercentage, {})
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: t("chart.t5"),
|
|
37
|
+
value: "chart-strip-bar",
|
|
38
|
+
icon: /* @__PURE__ */ jsx(IconStripBar, {})
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: t("chart.t6"),
|
|
42
|
+
value: "chart-strip-bar-pile",
|
|
43
|
+
icon: /* @__PURE__ */ jsx(IconStripBarPile, {})
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: t("chart.t7"),
|
|
47
|
+
value: "chart-strip-bar-percentage",
|
|
48
|
+
icon: /* @__PURE__ */ jsx(IconStripBarPercentage, {})
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: t("chart.t8"),
|
|
52
|
+
value: "chart-line",
|
|
53
|
+
icon: /* @__PURE__ */ jsx(IconLine, {})
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: t("chart.t9"),
|
|
57
|
+
value: "chart-line-smooth",
|
|
58
|
+
icon: /* @__PURE__ */ jsx(IconLineSmooth, {})
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: t("chart.t10"),
|
|
62
|
+
value: "chart-pie",
|
|
63
|
+
icon: /* @__PURE__ */ jsx(IconPie, {})
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: t("chart.t11"),
|
|
67
|
+
value: "chart-pie-circular",
|
|
68
|
+
icon: /* @__PURE__ */ jsx(IconPieCircular, {})
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: t("chart._t12"),
|
|
72
|
+
value: ChartType["chartCombination"],
|
|
73
|
+
// icon: <IconPieCircular />,
|
|
74
|
+
icon: /* @__PURE__ */ jsx(SvgComponent, {})
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
}, [i18n.language]);
|
|
78
|
+
return ret;
|
|
79
|
+
};
|
|
80
|
+
const useTimeGroupIntervalOption = () => {
|
|
81
|
+
const { t, i18n } = useTranslation();
|
|
82
|
+
const ret = useMemo(() => {
|
|
83
|
+
return [
|
|
84
|
+
{
|
|
85
|
+
label: t("chart.t40"),
|
|
86
|
+
value: "day"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: t("chart.t41"),
|
|
90
|
+
value: "week"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: t("chart.t42"),
|
|
94
|
+
value: "month"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: t("chart.t43"),
|
|
98
|
+
value: "year"
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
}, [i18n.language]);
|
|
102
|
+
return ret;
|
|
103
|
+
};
|
|
104
|
+
const useDisplayRangeOption = () => {
|
|
105
|
+
const { t, i18n } = useTranslation();
|
|
106
|
+
const ret = useMemo(() => {
|
|
107
|
+
return [
|
|
108
|
+
{
|
|
109
|
+
label: t("displayRange.all", "ALL"),
|
|
110
|
+
value: DisplayRange["ALL"]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: t("displayRange.top5", "TOP5"),
|
|
114
|
+
value: DisplayRange["TOP5"]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: t("displayRange.top10", "TOP10"),
|
|
118
|
+
value: DisplayRange["TOP10"]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: t("displayRange.top20", "TOP20"),
|
|
122
|
+
value: DisplayRange["TOP20"]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: t("displayRange.top30", "TOP30"),
|
|
126
|
+
value: DisplayRange["TOP30"]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: t("displayRange.bottom5", "BOTTOM5"),
|
|
130
|
+
value: DisplayRange["BOTTOM5"]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
label: t("displayRange.bottom10", "BOTTOM10"),
|
|
134
|
+
value: DisplayRange["BOTTOM10"]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: t("displayRange.bottom20", "BOTTOM20"),
|
|
138
|
+
value: DisplayRange["BOTTOM20"]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: t("displayRange.bottom30", "BOTTOM30"),
|
|
142
|
+
value: DisplayRange["BOTTOM30"]
|
|
143
|
+
}
|
|
144
|
+
];
|
|
145
|
+
}, [i18n.language]);
|
|
146
|
+
return ret;
|
|
147
|
+
};
|
|
148
|
+
export {
|
|
149
|
+
useChartTypeOption,
|
|
150
|
+
useDisplayRangeOption,
|
|
151
|
+
useTimeGroupIntervalOption
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../../../packages/dashboard-workbench/components/add-module-modal/add-chart-modal/config.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport IconChartCombination from '@platox/pivot-table/icon/icon-chart-combination'\nimport IconBar from '../../../icon/icon-bar'\nimport IconBarPercentage from '../../../icon/icon-bar-percentage'\nimport IconBarPile from '../../../icon/icon-bar-pile'\nimport IconLine from '../../../icon/icon-line'\nimport IconLineSmooth from '../../../icon/icon-line-smooth'\nimport IconPie from '../../../icon/icon-pie'\nimport IconPieCircular from '../../../icon/icon-pie-circular'\nimport IconStripBar from '../../../icon/icon-strip-bar'\nimport IconStripBarPercentage from '../../../icon/icon-strip-bar-percentage'\nimport IconStripBarPile from '../../../icon/icon-strip-bar-pile'\nimport { ChartType, DisplayRange } from './interface'\n\nexport const useChartTypeOption = () => {\n const { t, i18n } = useTranslation()\n\n const ret = useMemo(() => {\n return [\n {\n label: t('chart.t2'),\n value: 'chart-bar',\n icon: <IconBar />,\n },\n {\n label: t('chart.t3'),\n value: 'chart-bar-pile',\n icon: <IconBarPile />,\n },\n {\n label: t('chart.t4'),\n value: 'chart-bar-percentage',\n icon: <IconBarPercentage />,\n },\n {\n label: t('chart.t5'),\n value: 'chart-strip-bar',\n icon: <IconStripBar />,\n },\n {\n label: t('chart.t6'),\n value: 'chart-strip-bar-pile',\n icon: <IconStripBarPile />,\n },\n {\n label: t('chart.t7'),\n value: 'chart-strip-bar-percentage',\n icon: <IconStripBarPercentage />,\n },\n {\n label: t('chart.t8'),\n value: 'chart-line',\n icon: <IconLine />,\n },\n {\n label: t('chart.t9'),\n value: 'chart-line-smooth',\n icon: <IconLineSmooth />,\n },\n {\n label: t('chart.t10'),\n value: 'chart-pie',\n icon: <IconPie />,\n },\n {\n label: t('chart.t11'),\n value: 'chart-pie-circular',\n icon: <IconPieCircular />,\n },\n {\n label: t('chart._t12'),\n value: ChartType['chartCombination'],\n // icon: <IconPieCircular />,\n icon: <IconChartCombination />,\n },\n ]\n }, [i18n.language])\n\n return ret\n}\n\nexport const useTimeGroupIntervalOption = () => {\n const { t, i18n } = useTranslation()\n\n const ret = useMemo(() => {\n return [\n {\n label: t('chart.t40'),\n value: 'day',\n },\n {\n label: t('chart.t41'),\n value: 'week',\n },\n {\n label: t('chart.t42'),\n value: 'month',\n },\n {\n label: t('chart.t43'),\n value: 'year',\n },\n ]\n }, [i18n.language])\n\n return ret\n}\n\nexport const useDisplayRangeOption = () => {\n const { t, i18n } = useTranslation()\n\n const ret = useMemo(() => {\n return [\n {\n label: t('displayRange.all', 'ALL'),\n value: DisplayRange['ALL'],\n },\n {\n label: t('displayRange.top5', 'TOP5'),\n value: DisplayRange['TOP5'],\n },\n {\n label: t('displayRange.top10', 'TOP10'),\n value: DisplayRange['TOP10'],\n },\n {\n label: t('displayRange.top20', 'TOP20'),\n value: DisplayRange['TOP20'],\n },\n {\n label: t('displayRange.top30', 'TOP30'),\n value: DisplayRange['TOP30'],\n },\n {\n label: t('displayRange.bottom5', 'BOTTOM5'),\n value: DisplayRange['BOTTOM5'],\n },\n {\n label: t('displayRange.bottom10', 'BOTTOM10'),\n value: DisplayRange['BOTTOM10'],\n },\n {\n label: t('displayRange.bottom20', 'BOTTOM20'),\n value: DisplayRange['BOTTOM20'],\n },\n {\n label: t('displayRange.bottom30', 'BOTTOM30'),\n value: DisplayRange['BOTTOM30'],\n },\n ]\n }, [i18n.language])\n\n return ret\n}\n"],"names":["IconChartCombination"],"mappings":"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"}
|
package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-data.d.ts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
import { ModuleData } from '../../module-content';
|
|
2
1
|
import { EnumDataApi } from '../../../types';
|
|
3
|
-
import {
|
|
4
|
-
export type ChartCustomeDataTypes = {
|
|
5
|
-
conditionData?: {
|
|
6
|
-
conditionList: ConditionListItemTypes[];
|
|
7
|
-
conditionType: 'all' | 'any';
|
|
8
|
-
};
|
|
9
|
-
dataSourceId?: string;
|
|
10
|
-
type: 'chart-bar' | 'chart-bar-pile' | 'chart-bar-percentage' | 'chart-line' | 'chart-line-smooth' | 'chart-strip-bar' | 'chart-strip-bar-pile' | 'chart-strip-bar-percentage' | 'chart-pie' | 'chart-pie-circular';
|
|
11
|
-
xAxis: string;
|
|
12
|
-
yAxis: string;
|
|
13
|
-
yAxisField: string;
|
|
14
|
-
yAxisFieldType: 'sum' | 'max' | 'min' | 'avg';
|
|
15
|
-
groupField: string;
|
|
16
|
-
isGroup: boolean;
|
|
17
|
-
chartOptions: any;
|
|
18
|
-
sortField: 'xAxis' | 'yAxisField' | 'recordValue';
|
|
19
|
-
sortOrder: 'asc' | 'desc';
|
|
20
|
-
};
|
|
2
|
+
import { ModuleData } from '../../module-content';
|
|
21
3
|
interface CustomDataProps {
|
|
22
4
|
selectModuleData?: ModuleData;
|
|
23
5
|
onAllValuesChange?: ((values: any) => void) | undefined;
|
|
@@ -1,91 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Form, Select, Button, Flex, Checkbox, Divider, Radio, Space } from "antd";
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
2
|
import { useMemo, useState, useRef, useEffect } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { Form, Select, Button, Flex, Checkbox, Divider, Radio, Space, Spin } from "antd";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { useMemoizedFn, useRequest, useDebounceFn } from "ahooks";
|
|
7
|
+
import { getTransformValue } from "../../../utils/index.js";
|
|
4
8
|
import { useAppContext } from "../../../context.js";
|
|
5
|
-
import
|
|
6
|
-
import IconBarPile from "../../../icon/icon-bar-pile.js";
|
|
7
|
-
import IconStripBar from "../../../icon/icon-strip-bar.js";
|
|
8
|
-
import IconStripBarPercentage from "../../../icon/icon-strip-bar-percentage.js";
|
|
9
|
-
import IconStripBarPile from "../../../icon/icon-strip-bar-pile.js";
|
|
10
|
-
import IconBar from "../../../icon/icon-bar.js";
|
|
11
|
-
import IconLineSmooth from "../../../icon/icon-line-smooth.js";
|
|
12
|
-
import IconLine from "../../../icon/icon-line.js";
|
|
13
|
-
import IconPie from "../../../icon/icon-pie.js";
|
|
14
|
-
import IconPieCircular from "../../../icon/icon-pie-circular.js";
|
|
9
|
+
import { mapConditionsToPostgrest } from "../../module-content/utils.js";
|
|
15
10
|
import ConditionModal from "../components/condition-modal/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
11
|
+
import { CombinationChartOptionPicker } from "./components/CombinationChartOptionPicker.js";
|
|
12
|
+
import { GroupFieldConfigPicker } from "./components/GroupFieldConfigPicker.js";
|
|
13
|
+
import { useChartTypeOption, useTimeGroupIntervalOption, useDisplayRangeOption } from "./config.js";
|
|
14
|
+
import styles from "./index.module.less.js";
|
|
15
|
+
import { ChartType } from "./interface.js";
|
|
16
|
+
const componentName = "chart-modal";
|
|
18
17
|
const CustomData = ({
|
|
19
18
|
selectModuleData,
|
|
20
19
|
onAllValuesChange,
|
|
21
20
|
enumDataApi
|
|
22
21
|
}) => {
|
|
23
22
|
const { globalData } = useAppContext();
|
|
24
|
-
const { t
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
label: t("chart.t2"),
|
|
29
|
-
value: "chart-bar",
|
|
30
|
-
icon: /* @__PURE__ */ jsx(IconBar, {})
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
label: t("chart.t3"),
|
|
34
|
-
value: "chart-bar-pile",
|
|
35
|
-
icon: /* @__PURE__ */ jsx(IconBarPile, {})
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: t("chart.t4"),
|
|
39
|
-
value: "chart-bar-percentage",
|
|
40
|
-
icon: /* @__PURE__ */ jsx(IconBarPercentage, {})
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: t("chart.t5"),
|
|
44
|
-
value: "chart-strip-bar",
|
|
45
|
-
icon: /* @__PURE__ */ jsx(IconStripBar, {})
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: t("chart.t6"),
|
|
49
|
-
value: "chart-strip-bar-pile",
|
|
50
|
-
icon: /* @__PURE__ */ jsx(IconStripBarPile, {})
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: t("chart.t7"),
|
|
54
|
-
value: "chart-strip-bar-percentage",
|
|
55
|
-
icon: /* @__PURE__ */ jsx(IconStripBarPercentage, {})
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: t("chart.t8"),
|
|
59
|
-
value: "chart-line",
|
|
60
|
-
icon: /* @__PURE__ */ jsx(IconLine, {})
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
label: t("chart.t9"),
|
|
64
|
-
value: "chart-line-smooth",
|
|
65
|
-
icon: /* @__PURE__ */ jsx(IconLineSmooth, {})
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
label: t("chart.t10"),
|
|
69
|
-
value: "chart-pie",
|
|
70
|
-
icon: /* @__PURE__ */ jsx(IconPie, {})
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
label: t("chart.t11"),
|
|
74
|
-
value: "chart-pie-circular",
|
|
75
|
-
icon: /* @__PURE__ */ jsx(IconPieCircular, {})
|
|
76
|
-
}
|
|
77
|
-
];
|
|
78
|
-
}, [i18n.language]);
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const ChartTypeOption = useChartTypeOption();
|
|
25
|
+
const TimeGroupIntervalOption = useTimeGroupIntervalOption();
|
|
26
|
+
const DisplayRangeOption = useDisplayRangeOption();
|
|
79
27
|
const initialValues = {
|
|
80
28
|
dataSourceId: "",
|
|
81
29
|
yAxis: "recordTotal",
|
|
82
30
|
chartOptions: ["legend", "label", "axis", "splitLine"],
|
|
83
31
|
sortField: "xAxis",
|
|
84
|
-
sortOrder: "asc"
|
|
32
|
+
sortOrder: "asc",
|
|
33
|
+
timeGroupInterval: "day",
|
|
34
|
+
displayRange: "ALL",
|
|
35
|
+
yAxisFieldConfig: {
|
|
36
|
+
chartType: ChartType.ChartBar,
|
|
37
|
+
yAxisPos: "left"
|
|
38
|
+
}
|
|
85
39
|
};
|
|
86
40
|
const [form] = Form.useForm();
|
|
87
41
|
const type = Form.useWatch("type", form);
|
|
88
42
|
const dataSourceId = Form.useWatch("dataSourceId", form);
|
|
43
|
+
const isGroup = Form.useWatch("isGroup", form);
|
|
89
44
|
const xAxis = Form.useWatch("xAxis", form);
|
|
90
45
|
const yAxisField = Form.useWatch("yAxisField", form);
|
|
91
46
|
const groupField = Form.useWatch("groupField", form);
|
|
@@ -116,6 +71,10 @@ const CustomData = ({
|
|
|
116
71
|
groupFieldOption: groupFieldOption2
|
|
117
72
|
};
|
|
118
73
|
}, [dataSourceId, xAxis, yAxisField, groupField]);
|
|
74
|
+
const isTimeField = useMemoizedFn((fieldName) => {
|
|
75
|
+
var _a;
|
|
76
|
+
return ((_a = fieldOptions.find((item) => item.value === fieldName)) == null ? void 0 : _a.type) === "timestamp";
|
|
77
|
+
});
|
|
119
78
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
120
79
|
const conditionDataRef = useRef();
|
|
121
80
|
const [conditionData, setConditionData] = useState({
|
|
@@ -129,9 +88,41 @@ const CustomData = ({
|
|
|
129
88
|
conditionDataRef.current = val;
|
|
130
89
|
setConditionDataNum(((_a = val == null ? void 0 : val.conditionList) == null ? void 0 : _a.length) || 0);
|
|
131
90
|
};
|
|
91
|
+
const { service } = useAppContext();
|
|
92
|
+
const { data: CombinationGroupOptions, loading: isGetCombinationGroupOptionsLoading } = useRequest(
|
|
93
|
+
async () => {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
if (isGroup && type === ChartType["chartCombination"] && !!groupField) {
|
|
96
|
+
const newGroupField = groupField === "tags" ? "tag" : groupField;
|
|
97
|
+
let queryString = `select=${newGroupField}`;
|
|
98
|
+
if (((_a = conditionData == null ? void 0 : conditionData.conditionList) == null ? void 0 : _a.length) > 0) {
|
|
99
|
+
queryString += `&${mapConditionsToPostgrest(conditionData)}`;
|
|
100
|
+
}
|
|
101
|
+
let res = await ((_b = service == null ? void 0 : service.moduleDataApi) == null ? void 0 : _b.call(service, {
|
|
102
|
+
id: dataSourceId,
|
|
103
|
+
query: queryString
|
|
104
|
+
}));
|
|
105
|
+
let options = (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.map((item) => {
|
|
106
|
+
return getTransformValue({
|
|
107
|
+
fieldOptions,
|
|
108
|
+
val: item[newGroupField],
|
|
109
|
+
field: newGroupField,
|
|
110
|
+
fieldMap: globalData == null ? void 0 : globalData.fieldMap
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
return [...new Set(options)];
|
|
114
|
+
} else {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
refreshDeps: [type, isGroup, groupField, conditionData, dataSourceId]
|
|
120
|
+
}
|
|
121
|
+
);
|
|
132
122
|
const { run: debounceSubmit } = useDebounceFn(
|
|
133
123
|
useMemoizedFn(() => {
|
|
134
124
|
onAllValuesChange == null ? void 0 : onAllValuesChange({
|
|
125
|
+
...initialValues,
|
|
135
126
|
...form.getFieldsValue(),
|
|
136
127
|
conditionData: conditionDataRef.current
|
|
137
128
|
});
|
|
@@ -150,6 +141,15 @@ const CustomData = ({
|
|
|
150
141
|
isGroup: false
|
|
151
142
|
});
|
|
152
143
|
}
|
|
144
|
+
if (changedValues.xAxis) {
|
|
145
|
+
form.setFieldsValue(
|
|
146
|
+
isTimeField(changedValues.xAxis) ? {
|
|
147
|
+
timeGroupInterval: initialValues == null ? void 0 : initialValues.timeGroupInterval
|
|
148
|
+
} : {
|
|
149
|
+
displayRange: initialValues == null ? void 0 : initialValues.displayRange
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
153
|
if (changedValues.yAxis) {
|
|
154
154
|
let value = changedValues.yAxis;
|
|
155
155
|
form.setFieldsValue({
|
|
@@ -182,7 +182,7 @@ const CustomData = ({
|
|
|
182
182
|
setCondition((_c = selectModuleData == null ? void 0 : selectModuleData.customData) == null ? void 0 : _c.conditionData);
|
|
183
183
|
debounceSubmit();
|
|
184
184
|
}, [selectModuleData, globalData]);
|
|
185
|
-
return /* @__PURE__ */ jsxs("div", { style: { height: "50vh", overflowX: "auto" }, children: [
|
|
185
|
+
return /* @__PURE__ */ jsxs("div", { style: { height: "50vh", overflowX: "auto" }, className: clsx(styles[`${componentName}`]), children: [
|
|
186
186
|
/* @__PURE__ */ jsxs(
|
|
187
187
|
Form,
|
|
188
188
|
{
|
|
@@ -210,7 +210,7 @@ const CustomData = ({
|
|
|
210
210
|
/* @__PURE__ */ jsx(Form.Item, { label: t("chart.t1"), name: "type", children: /* @__PURE__ */ jsx(
|
|
211
211
|
Select,
|
|
212
212
|
{
|
|
213
|
-
options:
|
|
213
|
+
options: ChartTypeOption,
|
|
214
214
|
optionRender: (option) => /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
215
215
|
/* @__PURE__ */ jsx("span", { role: "img", style: { marginTop: "5px" }, "aria-label": option.data.label, children: option.data.icon }),
|
|
216
216
|
option.data.label
|
|
@@ -234,7 +234,8 @@ const CustomData = ({
|
|
|
234
234
|
children: /* @__PURE__ */ jsx(Select, { options: xAxisFieldOption })
|
|
235
235
|
}
|
|
236
236
|
),
|
|
237
|
-
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["type"], children: ({ getFieldValue }) => {
|
|
237
|
+
/* @__PURE__ */ jsx(Form.Item, { noStyle: true, dependencies: ["type", "xAxis"], children: ({ getFieldValue }) => isTimeField(getFieldValue("xAxis")) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Form.Item, { name: "timeGroupInterval", label: t("chart.t39"), children: /* @__PURE__ */ jsx(Select, { options: TimeGroupIntervalOption }) }) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Form.Item, { name: "displayRange", label: t("displayRange.title"), children: /* @__PURE__ */ jsx(Select, { options: DisplayRangeOption }) }) }) }),
|
|
238
|
+
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["type"], noStyle: true, children: ({ getFieldValue }) => {
|
|
238
239
|
var _a;
|
|
239
240
|
return !((_a = getFieldValue("type")) == null ? void 0 : _a.includes("pie")) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
240
241
|
/* @__PURE__ */ jsx(Form.Item, { name: "sortField", label: t("chart.t31"), children: /* @__PURE__ */ jsxs(Radio.Group, { children: [
|
|
@@ -267,38 +268,68 @@ const CustomData = ({
|
|
|
267
268
|
)
|
|
268
269
|
}
|
|
269
270
|
),
|
|
270
|
-
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["yAxis"], noStyle: true, children: ({ getFieldValue }) => getFieldValue("yAxis") === "fieldValue" ? /* @__PURE__ */ jsx(Form.Item, { label: t("selectField"), children: /* @__PURE__ */ jsxs(
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
271
|
+
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["yAxis"], noStyle: true, children: ({ getFieldValue }) => getFieldValue("yAxis") === "fieldValue" ? /* @__PURE__ */ jsx(Form.Item, { label: t("selectField"), children: /* @__PURE__ */ jsxs(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
style: {
|
|
275
|
+
display: "flex",
|
|
276
|
+
justifyContent: "space-between"
|
|
277
|
+
},
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsxs(Space.Compact, { children: [
|
|
280
|
+
/* @__PURE__ */ jsx(Form.Item, { noStyle: true, name: "yAxisField", children: /* @__PURE__ */ jsx(Select, { style: { width: "100px" }, options: yAxisFieldOption }) }),
|
|
281
|
+
/* @__PURE__ */ jsx(Form.Item, { name: "yAxisFieldType", noStyle: true, children: /* @__PURE__ */ jsx(
|
|
282
|
+
Select,
|
|
283
|
+
{
|
|
284
|
+
style: { width: "100px" },
|
|
285
|
+
options: [
|
|
286
|
+
{
|
|
287
|
+
value: "sum",
|
|
288
|
+
label: t("sumVal")
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
value: "max",
|
|
292
|
+
label: t("maxVal")
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
value: "min",
|
|
296
|
+
label: t("minVal")
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
value: "avg",
|
|
300
|
+
label: t("averageVal")
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
) })
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ jsx(
|
|
307
|
+
Form.Item,
|
|
289
308
|
{
|
|
290
|
-
|
|
291
|
-
|
|
309
|
+
noStyle: true,
|
|
310
|
+
name: "yAxisFieldConfig",
|
|
311
|
+
dependencies: ["type", "isGroup"],
|
|
312
|
+
hidden: getFieldValue("type") !== ChartType["chartCombination"] && getFieldValue("isGroup"),
|
|
313
|
+
children: /* @__PURE__ */ jsx(CombinationChartOptionPicker, {})
|
|
292
314
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["type"], children: ({ getFieldValue }) => {
|
|
315
|
+
)
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
) }) : null }),
|
|
319
|
+
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["type"], noStyle: true, children: ({ getFieldValue }) => {
|
|
298
320
|
var _a;
|
|
299
|
-
return !((_a = getFieldValue("type")) == null ? void 0 : _a.includes("pie")) ? /* @__PURE__ */ jsxs(
|
|
321
|
+
return !((_a = getFieldValue("type")) == null ? void 0 : _a.includes("pie")) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
300
322
|
/* @__PURE__ */ jsx(Form.Item, { name: "isGroup", valuePropName: "checked", noStyle: true, children: /* @__PURE__ */ jsx(Checkbox, { style: { marginBottom: "5px" }, children: t("chart.t38") }) }),
|
|
301
|
-
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["isGroup"], children: ({ getFieldValue: getFieldValue2 }) => getFieldValue2("isGroup") ? /* @__PURE__ */ jsx(Form.Item, { name: "groupField", children: /* @__PURE__ */ jsx(Select, { options: groupFieldOption }) }) : null })
|
|
323
|
+
/* @__PURE__ */ jsx(Form.Item, { dependencies: ["isGroup"], noStyle: true, children: ({ getFieldValue: getFieldValue2 }) => getFieldValue2("isGroup") ? /* @__PURE__ */ jsx(Form.Item, { name: "groupField", children: /* @__PURE__ */ jsx(Select, { options: groupFieldOption }) }) : null }),
|
|
324
|
+
/* @__PURE__ */ jsx(Spin, { spinning: isGetCombinationGroupOptionsLoading, children: /* @__PURE__ */ jsx(
|
|
325
|
+
Form.Item,
|
|
326
|
+
{
|
|
327
|
+
name: "groupFieldConfig",
|
|
328
|
+
label: t("chart.groupFieldConfig"),
|
|
329
|
+
hidden: !(getFieldValue("type") === ChartType["chartCombination"] && getFieldValue("isGroup")),
|
|
330
|
+
children: /* @__PURE__ */ jsx(GroupFieldConfigPicker, { options: CombinationGroupOptions })
|
|
331
|
+
}
|
|
332
|
+
) })
|
|
302
333
|
] }) : null;
|
|
303
334
|
} })
|
|
304
335
|
]
|