@platox/pivot-table 0.0.33 → 0.0.35

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 (165) hide show
  1. package/es/dashboard-workbench/components/add-module-btn/index.d.ts +11 -0
  2. package/es/dashboard-workbench/components/add-module-btn/index.js +97 -0
  3. package/es/dashboard-workbench/components/add-module-btn/index.js.map +1 -0
  4. package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/custome-data.d.ts +20 -0
  5. package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/custome-data.js +169 -0
  6. package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/custome-data.js.map +1 -0
  7. package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/index.d.ts +13 -0
  8. package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/index.js +82 -0
  9. package/es/dashboard-workbench/components/add-module-modal/add-calendar-modal/index.js.map +1 -0
  10. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-data.d.ts +29 -0
  11. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-data.js +328 -0
  12. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-data.js.map +1 -0
  13. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-styles.d.ts +15 -0
  14. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-styles.js +58 -0
  15. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/custome-styles.js.map +1 -0
  16. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.d.ts +13 -0
  17. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.js +114 -0
  18. package/es/dashboard-workbench/components/add-module-modal/add-chart-modal/index.js.map +1 -0
  19. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-data.d.ts +20 -0
  20. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-data.js +180 -0
  21. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-data.js.map +1 -0
  22. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-styles.d.ts +13 -0
  23. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-styles.js +119 -0
  24. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/custome-styles.js.map +1 -0
  25. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/index.d.ts +13 -0
  26. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/index.js +111 -0
  27. package/es/dashboard-workbench/components/add-module-modal/add-statistics-modal/index.js.map +1 -0
  28. package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/debounce-select.d.ts +12 -0
  29. package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/debounce-select.js +44 -0
  30. package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/debounce-select.js.map +1 -0
  31. package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/index.d.ts +21 -0
  32. package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/index.js +510 -0
  33. package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/index.js.map +1 -0
  34. package/es/dashboard-workbench/components/add-module-modal/components/condition-modal/utils.d.ts +25 -0
  35. package/es/dashboard-workbench/components/add-module-modal/components/select-color/index.d.ts +12 -0
  36. package/es/dashboard-workbench/components/add-module-modal/components/select-color/index.js +45 -0
  37. package/es/dashboard-workbench/components/add-module-modal/components/select-color/index.js.map +1 -0
  38. package/es/dashboard-workbench/components/module-content/calendar-module/index.d.ts +14 -0
  39. package/es/dashboard-workbench/components/module-content/calendar-module/index.js +229 -0
  40. package/es/dashboard-workbench/components/module-content/calendar-module/index.js.map +1 -0
  41. package/es/dashboard-workbench/components/module-content/calendar-module/locales/en.d.ts +7 -0
  42. package/es/dashboard-workbench/components/module-content/calendar-module/locales/en.js +10 -0
  43. package/es/dashboard-workbench/components/module-content/calendar-module/locales/en.js.map +1 -0
  44. package/es/dashboard-workbench/components/module-content/calendar-module/locales/zh.d.ts +22 -0
  45. package/es/dashboard-workbench/components/module-content/calendar-module/locales/zh.js +29 -0
  46. package/es/dashboard-workbench/components/module-content/calendar-module/locales/zh.js.map +1 -0
  47. package/es/dashboard-workbench/components/module-content/chart-module/Empty.d.ts +5 -0
  48. package/es/dashboard-workbench/components/module-content/chart-module/Empty.js +30 -0
  49. package/es/dashboard-workbench/components/module-content/chart-module/Empty.js.map +1 -0
  50. package/es/dashboard-workbench/components/module-content/chart-module/base-chart/index.d.ts +8 -0
  51. package/es/dashboard-workbench/components/module-content/chart-module/base-chart/index.js +62 -0
  52. package/es/dashboard-workbench/components/module-content/chart-module/base-chart/index.js.map +1 -0
  53. package/es/dashboard-workbench/components/module-content/chart-module/index.d.ts +14 -0
  54. package/es/dashboard-workbench/components/module-content/chart-module/index.js +406 -0
  55. package/es/dashboard-workbench/components/module-content/chart-module/index.js.map +1 -0
  56. package/es/dashboard-workbench/components/module-content/chart-module/utils.d.ts +9 -0
  57. package/es/dashboard-workbench/components/module-content/chart-module/utils.js +200 -0
  58. package/es/dashboard-workbench/components/module-content/chart-module/utils.js.map +1 -0
  59. package/es/dashboard-workbench/components/module-content/index.d.ts +31 -0
  60. package/es/dashboard-workbench/components/module-content/index.js +81 -0
  61. package/es/dashboard-workbench/components/module-content/index.js.map +1 -0
  62. package/es/dashboard-workbench/components/module-content/statistics-module/index.d.ts +15 -0
  63. package/es/dashboard-workbench/components/module-content/statistics-module/index.js +305 -0
  64. package/es/dashboard-workbench/components/module-content/statistics-module/index.js.map +1 -0
  65. package/es/dashboard-workbench/components/module-content/statistics-module/utils.d.ts +4 -0
  66. package/es/dashboard-workbench/components/module-content/statistics-module/utils.js +41 -0
  67. package/es/dashboard-workbench/components/module-content/statistics-module/utils.js.map +1 -0
  68. package/es/dashboard-workbench/components/module-content/text-module/editor/index.d.ts +7 -0
  69. package/es/dashboard-workbench/components/module-content/text-module/editor/index.js +224 -0
  70. package/es/dashboard-workbench/components/module-content/text-module/editor/index.js.map +1 -0
  71. package/es/dashboard-workbench/components/module-content/text-module/editor/useDebounce.d.ts +2 -0
  72. package/es/dashboard-workbench/components/module-content/text-module/editor/useDebounce.js +24 -0
  73. package/es/dashboard-workbench/components/module-content/text-module/editor/useDebounce.js.map +1 -0
  74. package/es/dashboard-workbench/components/module-content/text-module/index.d.ts +7 -0
  75. package/es/dashboard-workbench/components/module-content/text-module/index.js +11 -0
  76. package/es/dashboard-workbench/components/module-content/text-module/index.js.map +1 -0
  77. package/es/dashboard-workbench/components/module-content/utils.d.ts +15 -0
  78. package/es/dashboard-workbench/components/module-content/utils.js +113 -0
  79. package/es/dashboard-workbench/components/module-content/utils.js.map +1 -0
  80. package/es/dashboard-workbench/components/module-header/index.d.ts +12 -0
  81. package/es/dashboard-workbench/components/module-header/index.js +115 -0
  82. package/es/dashboard-workbench/components/module-header/index.js.map +1 -0
  83. package/es/dashboard-workbench/components/ui/modal/editor-header.d.ts +12 -0
  84. package/es/dashboard-workbench/components/ui/modal/editor-header.js +59 -0
  85. package/es/dashboard-workbench/components/ui/modal/editor-header.js.map +1 -0
  86. package/es/dashboard-workbench/components/ui/modal/index.module.less.js +9 -0
  87. package/es/dashboard-workbench/components/ui/modal/index.module.less.js.map +1 -0
  88. package/es/dashboard-workbench/context.d.ts +16 -0
  89. package/es/dashboard-workbench/context.js +21 -0
  90. package/es/dashboard-workbench/context.js.map +1 -0
  91. package/es/dashboard-workbench/icon/icon-bar-percentage.d.ts +2 -0
  92. package/es/dashboard-workbench/icon/icon-bar-percentage.js +17 -0
  93. package/es/dashboard-workbench/icon/icon-bar-percentage.js.map +1 -0
  94. package/es/dashboard-workbench/icon/icon-bar-pile.d.ts +2 -0
  95. package/es/dashboard-workbench/icon/icon-bar-pile.js +17 -0
  96. package/es/dashboard-workbench/icon/icon-bar-pile.js.map +1 -0
  97. package/es/dashboard-workbench/icon/icon-bar.d.ts +2 -0
  98. package/es/dashboard-workbench/icon/icon-bar.js +13 -0
  99. package/es/dashboard-workbench/icon/icon-bar.js.map +1 -0
  100. package/es/dashboard-workbench/icon/icon-calendar.d.ts +2 -0
  101. package/es/dashboard-workbench/icon/icon-calendar.js +40 -0
  102. package/es/dashboard-workbench/icon/icon-calendar.js.map +1 -0
  103. package/es/dashboard-workbench/icon/icon-drag.d.ts +2 -0
  104. package/es/dashboard-workbench/icon/icon-drag.js +25 -0
  105. package/es/dashboard-workbench/icon/icon-drag.js.map +1 -0
  106. package/es/dashboard-workbench/icon/icon-editor.d.ts +2 -0
  107. package/es/dashboard-workbench/icon/icon-editor.js +40 -0
  108. package/es/dashboard-workbench/icon/icon-editor.js.map +1 -0
  109. package/es/dashboard-workbench/icon/icon-empty.d.ts +2 -0
  110. package/es/dashboard-workbench/icon/icon-empty.js +139 -0
  111. package/es/dashboard-workbench/icon/icon-empty.js.map +1 -0
  112. package/es/dashboard-workbench/icon/icon-line-smooth.d.ts +2 -0
  113. package/es/dashboard-workbench/icon/icon-line-smooth.js +28 -0
  114. package/es/dashboard-workbench/icon/icon-line-smooth.js.map +1 -0
  115. package/es/dashboard-workbench/icon/icon-line.d.ts +2 -0
  116. package/es/dashboard-workbench/icon/icon-line.js +28 -0
  117. package/es/dashboard-workbench/icon/icon-line.js.map +1 -0
  118. package/es/dashboard-workbench/icon/icon-move.d.ts +2 -0
  119. package/es/dashboard-workbench/icon/icon-move.js +25 -0
  120. package/es/dashboard-workbench/icon/icon-move.js.map +1 -0
  121. package/es/dashboard-workbench/icon/icon-pie-circular.d.ts +2 -0
  122. package/es/dashboard-workbench/icon/icon-pie-circular.js +30 -0
  123. package/es/dashboard-workbench/icon/icon-pie-circular.js.map +1 -0
  124. package/es/dashboard-workbench/icon/icon-pie.d.ts +2 -0
  125. package/es/dashboard-workbench/icon/icon-pie.js +24 -0
  126. package/es/dashboard-workbench/icon/icon-pie.js.map +1 -0
  127. package/es/dashboard-workbench/icon/icon-statistics.d.ts +2 -0
  128. package/es/dashboard-workbench/icon/icon-statistics.js +37 -0
  129. package/es/dashboard-workbench/icon/icon-statistics.js.map +1 -0
  130. package/es/dashboard-workbench/icon/icon-strip-bar-percentage.d.ts +2 -0
  131. package/es/dashboard-workbench/icon/icon-strip-bar-percentage.js +105 -0
  132. package/es/dashboard-workbench/icon/icon-strip-bar-percentage.js.map +1 -0
  133. package/es/dashboard-workbench/icon/icon-strip-bar-pile.d.ts +2 -0
  134. package/es/dashboard-workbench/icon/icon-strip-bar-pile.js +105 -0
  135. package/es/dashboard-workbench/icon/icon-strip-bar-pile.js.map +1 -0
  136. package/es/dashboard-workbench/icon/icon-strip-bar.d.ts +2 -0
  137. package/es/dashboard-workbench/icon/icon-strip-bar.js +57 -0
  138. package/es/dashboard-workbench/icon/icon-strip-bar.js.map +1 -0
  139. package/es/dashboard-workbench/index.d.ts +33 -0
  140. package/es/dashboard-workbench/index.js +414 -0
  141. package/es/dashboard-workbench/index.js.map +1 -0
  142. package/es/dashboard-workbench/lang/en-US.d.ts +147 -0
  143. package/es/dashboard-workbench/lang/en-US.js +158 -0
  144. package/es/dashboard-workbench/lang/en-US.js.map +1 -0
  145. package/es/dashboard-workbench/lang/index.d.ts +2 -0
  146. package/es/dashboard-workbench/lang/index.js +25 -0
  147. package/es/dashboard-workbench/lang/index.js.map +1 -0
  148. package/es/dashboard-workbench/lang/zh-CN.d.ts +147 -0
  149. package/es/dashboard-workbench/lang/zh-CN.js +158 -0
  150. package/es/dashboard-workbench/lang/zh-CN.js.map +1 -0
  151. package/es/dashboard-workbench/types.d.ts +22 -0
  152. package/es/dashboard-workbench/utils/index.d.ts +9 -0
  153. package/es/dashboard-workbench/utils/index.js +30 -0
  154. package/es/dashboard-workbench/utils/index.js.map +1 -0
  155. package/es/index.d.ts +1 -0
  156. package/es/index.js +5 -0
  157. package/es/index.js.map +1 -0
  158. package/es/style.css +1 -0
  159. package/package.json +25 -24
  160. package/umd/pivot-table.umd.cjs +178 -0
  161. package/umd/style.css +1 -0
  162. package/index.d.ts +0 -98
  163. package/lib/index.js +0 -52222
  164. package/lib/index.umd.cjs +0 -178
  165. package/lib/style.css +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../packages/dashboard-workbench/components/add-module-modal/components/select-color/index.tsx"],"sourcesContent":["import { CheckOutlined } from '@ant-design/icons'\nimport './index.less'\nimport { useEffect, useState } from 'react'\n\nexport type StatisticsCustomeStylesTypes = {\n color?: string\n unit?: string\n precision?: number\n desc: string\n}\n\ninterface CustomeStylesProps {\n value?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange?: ((values: any) => void) | undefined\n}\nconst CustomeStyles: React.FC<CustomeStylesProps> = ({ value, onChange }) => {\n const [color, setColor] = useState<string | undefined>()\n const colors = [\n '#373c43',\n '#3370ff',\n '#4954e6',\n '#34c724',\n '#14c0ff',\n '#ffc60a',\n '#f80',\n '#f76964',\n ]\n\n useEffect(() => {\n setColor(value)\n }, [value])\n\n return (\n <div className=\"pane-item-body item-body-column\">\n <div className=\"panel-single-color-selector\">\n {colors.map((item, idx) => (\n <div\n key={idx}\n className=\"panel-single-color-selector-color-item\"\n onClick={() => {\n setColor(item)\n onChange?.(item)\n }}\n >\n <div\n className=\"panel-single-color-selector-color-item-background\"\n style={{ background: item }}\n ></div>\n {color === item ? (\n <span className=\"panel-icon\">\n <CheckOutlined />\n </span>\n ) : null}\n </div>\n ))}\n </div>\n </div>\n )\n}\nexport default CustomeStyles\n"],"names":[],"mappings":";;;;AAgBA,MAAM,gBAA8C,CAAC,EAAE,OAAO,eAAe;AAC3E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA6B;AACvD,QAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,YAAU,MAAM;AACd,aAAS,KAAK;AAAA,EAAA,GACb,CAAC,KAAK,CAAC;AAEV,SACG,oBAAA,OAAA,EAAI,WAAU,mCACb,UAAC,oBAAA,OAAA,EAAI,WAAU,+BACZ,UAAO,OAAA,IAAI,CAAC,MAAM,QACjB;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,WAAU;AAAA,MACV,SAAS,MAAM;AACb,iBAAS,IAAI;AACb,6CAAW;AAAA,MACb;AAAA,MAEA,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,EAAE,YAAY,KAAK;AAAA,UAAA;AAAA,QAC3B;AAAA,QACA,UAAU,OACR,oBAAA,QAAA,EAAK,WAAU,cACd,UAAA,oBAAC,eAAc,CAAA,CAAA,EACjB,CAAA,IACE;AAAA,MAAA;AAAA,IAAA;AAAA,IAfC;AAAA,EAAA,CAiBR,GACH,EACF,CAAA;AAEJ;"}
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { ModuleDataApi } from '../../../types';
3
+ import { CalendarCustomeDataTypes } from '../../add-module-modal/add-calendar-modal/custome-data';
4
+ interface CalendarModuleProps {
5
+ customData?: CalendarCustomeDataTypes;
6
+ onChange?: (val: unknown) => void;
7
+ moduleDataApi?: ModuleDataApi;
8
+ width?: number;
9
+ height?: number;
10
+ rowWidth?: number;
11
+ rowHeight?: number;
12
+ }
13
+ declare const _default: React.NamedExoticComponent<CalendarModuleProps>;
14
+ export default _default;
@@ -0,0 +1,229 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useMemo, useRef } from "react";
3
+ import FullCalendar from "@fullcalendar/react";
4
+ import dayGridPlugin from "@fullcalendar/daygrid";
5
+ import dayjs from "dayjs";
6
+ import isBetween from "dayjs/plugin/isBetween";
7
+ import { useAppContext } from "../../../context.js";
8
+ import { useTranslation } from "react-i18next";
9
+ import { mapConditionsToPostgrest } from "../utils.js";
10
+ import { message, Spin, Modal, Descriptions } from "antd";
11
+ import { getTransformValue } from "../../../utils/index.js";
12
+ import { useMemoizedFn, useSize } from "ahooks";
13
+ import MINIMAL_RAW_EN_LOCALE from "./locales/en.js";
14
+ import l77 from "./locales/zh.js";
15
+ dayjs.extend(isBetween);
16
+ const CalendarModule = ({ moduleDataApi, customData }) => {
17
+ const { t, i18n } = useTranslation();
18
+ const { globalData } = useAppContext();
19
+ const [startMonthIntervals, setStartMonthIntervals] = useState(["", ""]);
20
+ const handleDatesSet = (dateInfo) => {
21
+ const currentDate = dayjs(dateInfo.view.currentStart);
22
+ const firstDay = currentDate.startOf("month").format("YYYY-MM-DD");
23
+ const lastDay = currentDate.endOf("month").format("YYYY-MM-DD");
24
+ setStartMonthIntervals([firstDay, lastDay]);
25
+ };
26
+ const [isloading, setIsloading] = useState(false);
27
+ const [chartData, setChartData] = useState();
28
+ const fetchChartData = useMemoizedFn(async () => {
29
+ var _a, _b;
30
+ setChartData([]);
31
+ if (customData) {
32
+ setIsloading(true);
33
+ let queryString = "";
34
+ const firstDayOfMonth = dayjs().startOf("month").format("YYYY-MM-DD");
35
+ const lastDayOfMonth = dayjs().endOf("month").format("YYYY-MM-DD");
36
+ const conditionData = customData.conditionData;
37
+ const FMDay = startMonthIntervals.length > 0 ? startMonthIntervals[0] : firstDayOfMonth;
38
+ const LMDay = startMonthIntervals.length > 0 ? startMonthIntervals[1] : lastDayOfMonth;
39
+ if (conditionData) {
40
+ if ((_b = (_a = conditionData == null ? void 0 : conditionData.conditionList) == null ? void 0 : _a.map((item) => item.type)) == null ? void 0 : _b.includes("timestamp")) {
41
+ queryString += `${mapConditionsToPostgrest(conditionData)}`;
42
+ } else {
43
+ queryString += `added_on=gt.${FMDay}&added_on=lt.${LMDay}&${mapConditionsToPostgrest(
44
+ conditionData
45
+ )}`;
46
+ }
47
+ } else {
48
+ queryString = `added_on=gt.${FMDay}&added_on=lt.${LMDay}`;
49
+ }
50
+ if (customData == null ? void 0 : customData.dataSourceId) {
51
+ moduleDataApi == null ? void 0 : moduleDataApi({
52
+ id: customData == null ? void 0 : customData.dataSourceId,
53
+ query: queryString
54
+ }).then((res) => {
55
+ if (!res.success) {
56
+ message.error(res.message);
57
+ return;
58
+ }
59
+ setChartData(res.data);
60
+ }).finally(() => {
61
+ setIsloading(false);
62
+ });
63
+ }
64
+ }
65
+ });
66
+ useEffect(() => {
67
+ if (customData) {
68
+ fetchChartData();
69
+ }
70
+ }, [customData == null ? void 0 : customData.dataSourceId, customData == null ? void 0 : customData.conditionData, startMonthIntervals]);
71
+ const fieldOptions = useMemo(() => {
72
+ var _a, _b;
73
+ return (_b = (_a = globalData == null ? void 0 : globalData.sourceData) == null ? void 0 : _a.find((item) => item.value === (customData == null ? void 0 : customData.dataSourceId))) == null ? void 0 : _b.fields;
74
+ }, [globalData, customData]);
75
+ const events = useMemo(() => {
76
+ const calendarEvents = chartData == null ? void 0 : chartData.map((item) => {
77
+ var _a, _b;
78
+ const title = getTransformValue({
79
+ fieldOptions,
80
+ val: (customData == null ? void 0 : customData.titleField) ? item == null ? void 0 : item[customData.titleField] : "",
81
+ field: customData == null ? void 0 : customData.titleField,
82
+ fieldMap: globalData == null ? void 0 : globalData.fieldMap
83
+ });
84
+ return {
85
+ title: title ?? t("unnamedRecord"),
86
+ start: (customData == null ? void 0 : customData.startDateField) && item[customData == null ? void 0 : customData.startDateField] ? (_a = dayjs(item[customData == null ? void 0 : customData.startDateField])) == null ? void 0 : _a.toISOString() : "",
87
+ end: (customData == null ? void 0 : customData.endDateField) && item[customData == null ? void 0 : customData.endDateField] ? (_b = dayjs(item[customData == null ? void 0 : customData.endDateField])) == null ? void 0 : _b.toISOString() : void 0,
88
+ allDay: true,
89
+ ...item,
90
+ originalData: item
91
+ };
92
+ });
93
+ return calendarEvents;
94
+ }, [chartData, customData, fieldOptions]);
95
+ const [isModalOpen, setIsModalOpen] = useState(false);
96
+ const [currData, setCurrData] = useState();
97
+ const currTitle = getTransformValue({
98
+ fieldOptions,
99
+ val: (customData == null ? void 0 : customData.titleField) ? currData == null ? void 0 : currData[customData.titleField] : "",
100
+ field: customData == null ? void 0 : customData.titleField,
101
+ fieldMap: globalData == null ? void 0 : globalData.fieldMap
102
+ });
103
+ const handleEventClick = useMemoizedFn((info) => {
104
+ var _a;
105
+ const event = info.event;
106
+ setIsModalOpen(true);
107
+ setCurrData((_a = event.extendedProps) == null ? void 0 : _a.originalData);
108
+ });
109
+ const boxRef = useRef();
110
+ const calendarRef = useRef(null);
111
+ const size = useSize(boxRef);
112
+ useEffect(() => {
113
+ setTimeout(() => {
114
+ var _a, _b;
115
+ (_b = (_a = calendarRef.current) == null ? void 0 : _a.getApi()) == null ? void 0 : _b.updateSize();
116
+ }, 16);
117
+ }, [size]);
118
+ return /* @__PURE__ */ jsx(
119
+ "div",
120
+ {
121
+ ref: boxRef,
122
+ style: {
123
+ height: "100%",
124
+ width: "100%",
125
+ boxSizing: "border-box",
126
+ padding: "12px"
127
+ },
128
+ children: /* @__PURE__ */ jsxs(
129
+ "div",
130
+ {
131
+ className: "full-calendar-app",
132
+ style: {
133
+ height: "100%",
134
+ width: "100%",
135
+ overflowY: "auto",
136
+ position: "relative"
137
+ },
138
+ children: [
139
+ isloading ? /* @__PURE__ */ jsx(
140
+ Spin,
141
+ {
142
+ style: {
143
+ width: "100%",
144
+ height: "100%",
145
+ display: "flex",
146
+ justifyContent: "center",
147
+ alignItems: "center",
148
+ position: "absolute",
149
+ background: "rgba(255,255,255,0.6)",
150
+ top: 0,
151
+ left: 0,
152
+ right: 0,
153
+ bottom: 0,
154
+ zIndex: 1e3
155
+ },
156
+ spinning: isloading
157
+ }
158
+ ) : null,
159
+ /* @__PURE__ */ jsx(
160
+ FullCalendar,
161
+ {
162
+ locale: i18n.language === "zh-CN" ? l77 : MINIMAL_RAW_EN_LOCALE,
163
+ ref: calendarRef,
164
+ plugins: [dayGridPlugin],
165
+ headerToolbar: {
166
+ left: "title,today,prev,next",
167
+ center: "",
168
+ right: ""
169
+ },
170
+ initialView: "dayGridMonth",
171
+ height: "auto",
172
+ contentHeight: "auto",
173
+ editable: true,
174
+ selectable: true,
175
+ selectMirror: true,
176
+ fixedWeekCount: false,
177
+ datesSet: handleDatesSet,
178
+ timeZone: "UTC",
179
+ events,
180
+ eventContent: (eventInfo) => {
181
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("i", { children: eventInfo.event.title }) });
182
+ },
183
+ eventClick: handleEventClick
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsx(
187
+ Modal,
188
+ {
189
+ title: currTitle ?? t("unnamedRecord"),
190
+ open: isModalOpen,
191
+ onOk: () => {
192
+ setIsModalOpen(false);
193
+ },
194
+ onCancel: () => {
195
+ setIsModalOpen(false);
196
+ },
197
+ destroyOnClose: true,
198
+ footer: (_, { OkBtn }) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(OkBtn, {}) }),
199
+ children: ((fieldOptions == null ? void 0 : fieldOptions.length) ?? 0) > 0 ? /* @__PURE__ */ jsx(
200
+ Descriptions,
201
+ {
202
+ className: "reset-descriptions",
203
+ layout: "vertical",
204
+ column: 2,
205
+ items: fieldOptions == null ? void 0 : fieldOptions.map((field, fieldKey) => ({
206
+ key: fieldKey,
207
+ label: field.label,
208
+ children: getTransformValue({
209
+ fieldOptions,
210
+ val: currData == null ? void 0 : currData[field.value],
211
+ field: field.value,
212
+ fieldMap: globalData == null ? void 0 : globalData.fieldMap
213
+ })
214
+ }))
215
+ }
216
+ ) : null
217
+ }
218
+ )
219
+ ]
220
+ }
221
+ )
222
+ }
223
+ );
224
+ };
225
+ const CalendarModule$1 = React.memo(CalendarModule);
226
+ export {
227
+ CalendarModule$1 as default
228
+ };
229
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../packages/dashboard-workbench/components/module-content/calendar-module/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport FullCalendar from '@fullcalendar/react'\nimport dayGridPlugin from '@fullcalendar/daygrid'\nimport dayjs from 'dayjs'\nimport isBetween from 'dayjs/plugin/isBetween'\nimport { EventContentArg, EventSourceInput } from '@fullcalendar/core'\nimport { ModuleDataApi, SourceDataFieldsTypes } from '../../../types'\nimport { CalendarCustomeDataTypes } from '../../add-module-modal/add-calendar-modal/custome-data'\nimport { useAppContext } from '../../../context'\nimport { useTranslation } from 'react-i18next'\nimport { mapConditionsToPostgrest } from '../utils'\nimport { Descriptions, message, Modal, Spin } from 'antd'\nimport { getTransformValue } from '../../../utils'\nimport { useMemoizedFn, useSize } from 'ahooks'\nimport en from './locales/en'\nimport zh from './locales/zh'\n// import zh from\n\ndayjs.extend(isBetween)\n\ninterface CalendarModuleProps {\n customData?: CalendarCustomeDataTypes\n onChange?: (val: unknown) => void\n moduleDataApi?: ModuleDataApi\n width?: number\n height?: number\n rowWidth?: number\n rowHeight?: number\n}\n\nconst CalendarModule: React.FC<CalendarModuleProps> = ({ moduleDataApi, customData }) => {\n const { t, i18n } = useTranslation()\n const { globalData } = useAppContext()\n\n /* ============================== split =============================== */\n const [startMonthIntervals, setStartMonthIntervals] = useState<[string, string]>(['', ''])\n const handleDatesSet = (dateInfo: any) => {\n const currentDate = dayjs(dateInfo.view.currentStart)\n const firstDay = currentDate.startOf('month').format('YYYY-MM-DD')\n const lastDay = currentDate.endOf('month').format('YYYY-MM-DD')\n setStartMonthIntervals([firstDay, lastDay])\n }\n /* ============================== split =============================== */\n const [isloading, setIsloading] = useState(false)\n const [chartData, setChartData] = useState<any>()\n const fetchChartData = useMemoizedFn(async () => {\n setChartData([])\n if (customData) {\n setIsloading(true)\n let queryString = ''\n const firstDayOfMonth = dayjs().startOf('month').format('YYYY-MM-DD')\n const lastDayOfMonth = dayjs().endOf('month').format('YYYY-MM-DD')\n const conditionData = customData.conditionData\n const FMDay = startMonthIntervals.length > 0 ? startMonthIntervals[0] : firstDayOfMonth\n const LMDay = startMonthIntervals.length > 0 ? startMonthIntervals[1] : lastDayOfMonth\n\n if (conditionData) {\n if (conditionData?.conditionList?.map(item => item.type)?.includes('timestamp')) {\n queryString += `${mapConditionsToPostgrest(conditionData)}`\n } else {\n queryString += `added_on=gt.${FMDay}&added_on=lt.${LMDay}&${mapConditionsToPostgrest(\n conditionData\n )}`\n }\n } else {\n queryString = `added_on=gt.${FMDay}&added_on=lt.${LMDay}`\n }\n\n if (customData?.dataSourceId) {\n moduleDataApi?.({\n id: customData?.dataSourceId,\n query: queryString,\n })\n .then((res: any) => {\n if (!res.success) {\n message.error(res.message)\n return\n }\n setChartData(res.data)\n })\n .finally(() => {\n setIsloading(false)\n })\n }\n }\n })\n useEffect(() => {\n if (customData) {\n fetchChartData()\n }\n }, [customData?.dataSourceId, customData?.conditionData, startMonthIntervals])\n\n /* ============================== split =============================== */\n const fieldOptions = useMemo(() => {\n return globalData?.sourceData?.find(item => item.value === customData?.dataSourceId)?.fields\n }, [globalData, customData])\n\n const events = useMemo(() => {\n const calendarEvents = chartData?.map((item: any) => {\n const title = getTransformValue({\n fieldOptions,\n val: customData?.titleField ? item?.[customData.titleField] : '',\n field: customData?.titleField,\n fieldMap: globalData?.fieldMap,\n })\n return {\n title: title ?? t('unnamedRecord'),\n start:\n customData?.startDateField && item[customData?.startDateField]\n ? dayjs(item[customData?.startDateField])?.toISOString()\n : '',\n end:\n customData?.endDateField && item[customData?.endDateField]\n ? dayjs(item[customData?.endDateField])?.toISOString()\n : undefined,\n allDay: true,\n ...item,\n originalData: item,\n }\n })\n return calendarEvents\n }, [chartData, customData, fieldOptions])\n\n /* ============================== split =============================== */\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [currData, setCurrData] = useState()\n const currTitle = getTransformValue({\n fieldOptions,\n val: customData?.titleField ? currData?.[customData.titleField] : '',\n field: customData?.titleField,\n fieldMap: globalData?.fieldMap,\n })\n\n const handleEventClick = useMemoizedFn((info: any) => {\n const event = info.event\n setIsModalOpen(true)\n\n setCurrData(event.extendedProps?.originalData)\n })\n\n /* ============================== split =============================== */\n const boxRef = useRef<any>()\n const calendarRef = useRef<any>(null)\n const size = useSize(boxRef)\n useEffect(() => {\n setTimeout(() => {\n calendarRef.current?.getApi()?.updateSize()\n }, 16) //不是一个div 会有延迟\n }, [size])\n\n /* ============================== split =============================== */\n\n return (\n <div\n ref={boxRef}\n style={{\n height: '100%',\n width: '100%',\n boxSizing: 'border-box',\n padding: '12px',\n }}\n >\n <div\n className=\"full-calendar-app\"\n style={{\n height: '100%',\n width: '100%',\n overflowY: 'auto',\n position: 'relative',\n }}\n >\n {isloading ? (\n <Spin\n style={{\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n position: 'absolute',\n background: 'rgba(255,255,255,0.6)',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 1000,\n }}\n spinning={isloading}\n />\n ) : null}\n\n <FullCalendar\n locale={i18n.language === 'zh-CN' ? zh : en}\n // locale =\n ref={calendarRef} // 设置 FullCalendar 引用\n plugins={[dayGridPlugin]}\n headerToolbar={{\n left: 'title,today,prev,next',\n center: '',\n right: '',\n }}\n initialView=\"dayGridMonth\"\n height=\"auto\" // 自适应高度\n contentHeight=\"auto\" // 自动调整内容高度\n // dayMaxEvents={4} // 如果一天的事件太多则显示更多按钮\n editable={true}\n selectable={true}\n selectMirror={true}\n fixedWeekCount={false}\n datesSet={handleDatesSet}\n timeZone=\"UTC\"\n events={events} // 将筛选后的事件传递给 FullCalendar\n eventContent={(eventInfo: EventContentArg) => {\n return (\n <>\n <i>{eventInfo.event.title}</i>\n </>\n )\n }} // 自定义事件内容渲染\n eventClick={handleEventClick} // 事件点击时调用\n ></FullCalendar>\n <Modal\n title={currTitle ?? t('unnamedRecord')}\n open={isModalOpen}\n onOk={() => {\n setIsModalOpen(false)\n }}\n onCancel={() => {\n setIsModalOpen(false)\n }}\n destroyOnClose\n footer={(_, { OkBtn }) => (\n <>\n <OkBtn />\n </>\n )}\n >\n {(fieldOptions?.length ?? 0) > 0 ? (\n <Descriptions\n className=\"reset-descriptions\"\n layout=\"vertical\"\n column={2}\n items={fieldOptions?.map((field: any, fieldKey) => ({\n key: fieldKey,\n label: field.label,\n children: getTransformValue({\n fieldOptions,\n val: currData?.[field.value],\n field: field.value,\n fieldMap: globalData?.fieldMap,\n }),\n }))}\n />\n ) : null}\n </Modal>\n </div>\n </div>\n )\n}\n\nexport default React.memo(CalendarModule)\n"],"names":["zh","en"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAM,OAAO,SAAS;AAYtB,MAAM,iBAAgD,CAAC,EAAE,eAAe,iBAAiB;AACvF,QAAM,EAAE,GAAG,KAAK,IAAI,eAAe;AAC7B,QAAA,EAAE,WAAW,IAAI,cAAc;AAG/B,QAAA,CAAC,qBAAqB,sBAAsB,IAAI,SAA2B,CAAC,IAAI,EAAE,CAAC;AACnF,QAAA,iBAAiB,CAAC,aAAkB;AACxC,UAAM,cAAc,MAAM,SAAS,KAAK,YAAY;AACpD,UAAM,WAAW,YAAY,QAAQ,OAAO,EAAE,OAAO,YAAY;AACjE,UAAM,UAAU,YAAY,MAAM,OAAO,EAAE,OAAO,YAAY;AACvC,2BAAA,CAAC,UAAU,OAAO,CAAC;AAAA,EAC5C;AAEA,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAc;AAC1C,QAAA,iBAAiB,cAAc,YAAY;;AAC/C,iBAAa,CAAA,CAAE;AACf,QAAI,YAAY;AACd,mBAAa,IAAI;AACjB,UAAI,cAAc;AAClB,YAAM,kBAAkB,QAAQ,QAAQ,OAAO,EAAE,OAAO,YAAY;AACpE,YAAM,iBAAiB,QAAQ,MAAM,OAAO,EAAE,OAAO,YAAY;AACjE,YAAM,gBAAgB,WAAW;AACjC,YAAM,QAAQ,oBAAoB,SAAS,IAAI,oBAAoB,CAAC,IAAI;AACxE,YAAM,QAAQ,oBAAoB,SAAS,IAAI,oBAAoB,CAAC,IAAI;AAExE,UAAI,eAAe;AACb,aAAA,0DAAe,kBAAf,mBAA8B,IAAI,CAAA,SAAQ,KAAK,UAA/C,mBAAsD,S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AAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,QAAO;AAAA,oBACP,QAAQ;AAAA,oBACR,OAAO,6CAAc,IAAI,CAAC,OAAY,cAAc;AAAA,sBAClD,KAAK;AAAA,sBACL,OAAO,MAAM;AAAA,sBACb,UAAU,kBAAkB;AAAA,wBAC1B;AAAA,wBACA,KAAK,qCAAW,MAAM;AAAA,wBACtB,OAAO,MAAM;AAAA,wBACb,UAAU,yCAAY;AAAA,sBACvB,CAAA;AAAA,oBAAA;AAAA,kBACD;AAAA,gBAAA,IAEF;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;AAEA,MAAA,mBAAe,MAAM,KAAK,cAAc;"}
@@ -0,0 +1,7 @@
1
+ declare const MINIMAL_RAW_EN_LOCALE: {
2
+ code: string;
3
+ buttonText: {
4
+ today: string;
5
+ };
6
+ };
7
+ export default MINIMAL_RAW_EN_LOCALE;
@@ -0,0 +1,10 @@
1
+ const MINIMAL_RAW_EN_LOCALE = {
2
+ code: "en",
3
+ buttonText: {
4
+ today: "Today"
5
+ }
6
+ };
7
+ export {
8
+ MINIMAL_RAW_EN_LOCALE as default
9
+ };
10
+ //# sourceMappingURL=en.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.js","sources":["../../../../../../packages/dashboard-workbench/components/module-content/calendar-module/locales/en.ts"],"sourcesContent":["const MINIMAL_RAW_EN_LOCALE = {\n code: 'en',\n buttonText: {\n today: 'Today',\n },\n}\nexport default MINIMAL_RAW_EN_LOCALE\n"],"names":[],"mappings":"AAAA,MAAM,wBAAwB;AAAA,EAC5B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,OAAO;AAAA,EAAA;AAEX;"}
@@ -0,0 +1,22 @@
1
+ declare var l77: {
2
+ code: string;
3
+ week: {
4
+ dow: number;
5
+ doy: number;
6
+ };
7
+ buttonText: {
8
+ prev: string;
9
+ next: string;
10
+ today: string;
11
+ year: string;
12
+ month: string;
13
+ week: string;
14
+ day: string;
15
+ list: string;
16
+ };
17
+ weekText: string;
18
+ allDayText: string;
19
+ moreLinkText(n: string): string;
20
+ noEventsText: string;
21
+ };
22
+ export { l77 as default };
@@ -0,0 +1,29 @@
1
+ var l77 = {
2
+ code: "zh-cn",
3
+ week: {
4
+ // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
5
+ dow: 1,
6
+ doy: 4
7
+ // The week that contains Jan 4th is the first week of the year.
8
+ },
9
+ buttonText: {
10
+ prev: "上月",
11
+ next: "下月",
12
+ today: "今天",
13
+ year: "年",
14
+ month: "月",
15
+ week: "周",
16
+ day: "日",
17
+ list: "日程"
18
+ },
19
+ weekText: "周",
20
+ allDayText: "全天",
21
+ moreLinkText(n) {
22
+ return "另外 " + n + " 个";
23
+ },
24
+ noEventsText: "没有事件显示"
25
+ };
26
+ export {
27
+ l77 as default
28
+ };
29
+ //# sourceMappingURL=zh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zh.js","sources":["../../../../../../packages/dashboard-workbench/components/module-content/calendar-module/locales/zh.ts"],"sourcesContent":["var l77 = {\n code: 'zh-cn',\n week: {\n // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效\n dow: 1,\n doy: 4, // The week that contains Jan 4th is the first week of the year.\n },\n buttonText: {\n prev: '上月',\n next: '下月',\n today: '今天',\n year: '年',\n month: '月',\n week: '周',\n day: '日',\n list: '日程',\n },\n weekText: '周',\n allDayText: '全天',\n moreLinkText(n: string) {\n return '另外 ' + n + ' 个'\n },\n noEventsText: '没有事件显示',\n}\n\nexport { l77 as default }\n"],"names":[],"mappings":"AAAA,IAAI,MAAM;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA;AAAA,IAEJ,KAAK;AAAA,IACL,KAAK;AAAA;AAAA,EACP;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,aAAa,GAAW;AACtB,WAAO,QAAQ,IAAI;AAAA,EACrB;AAAA,EACA,cAAc;AAChB;"}
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export interface EmptyProps {
3
+ }
4
+ export declare const Empty: React.FC<EmptyProps>;
5
+ export default Empty;
@@ -0,0 +1,30 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import IconEmpty from "../../../icon/icon-empty.js";
3
+ import { useTranslation } from "react-i18next";
4
+ const Empty = (props) => {
5
+ const { t } = useTranslation();
6
+ return /* @__PURE__ */ jsxs(
7
+ "div",
8
+ {
9
+ style: {
10
+ color: "#A1A1AA",
11
+ width: "100%",
12
+ height: "100%",
13
+ display: "flex",
14
+ flexDirection: "column",
15
+ alignItems: "center",
16
+ justifyContent: "center"
17
+ },
18
+ children: [
19
+ /* @__PURE__ */ jsx(IconEmpty, {}),
20
+ /* @__PURE__ */ jsx("span", { children: t("empty") })
21
+ ]
22
+ }
23
+ );
24
+ };
25
+ Empty.displayName = "Empty";
26
+ export {
27
+ Empty,
28
+ Empty as default
29
+ };
30
+ //# sourceMappingURL=Empty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Empty.js","sources":["../../../../../packages/dashboard-workbench/components/module-content/chart-module/Empty.tsx"],"sourcesContent":["import React, { useMemo } from 'react'\nimport styles from './index.scss'\nimport IconEmpty from '@platox/pivot-table/dashboard-workbench/icon/icon-empty'\nimport { useTranslation } from 'react-i18next'\n\nconst componentName = 'Empty'\n\nexport interface EmptyProps {}\nexport const Empty: React.FC<EmptyProps> = props => {\n const { t } = useTranslation()\n return (\n <div\n style={{\n color: '#A1A1AA',\n width: '100%',\n height: '100%',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <IconEmpty />\n <span>{t('empty')}</span>\n </div>\n )\n}\n\nEmpty.displayName = 'Empty'\n\nexport default Empty\n"],"names":[],"mappings":";;;AAQO,MAAM,QAA8B,CAAS,UAAA;AAC5C,QAAA,EAAE,EAAE,IAAI,eAAe;AAE3B,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,OAAO;AAAA,QACP,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,gBAAgB;AAAA,MAClB;AAAA,MAEA,UAAA;AAAA,QAAA,oBAAC,WAAU,EAAA;AAAA,QACV,oBAAA,QAAA,EAAM,UAAE,EAAA,OAAO,EAAE,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpB;AAEJ;AAEA,MAAM,cAAc;"}
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { EChartsOption } from 'echarts';
3
+ interface ChartProps {
4
+ options?: EChartsOption;
5
+ echartRef?: any;
6
+ }
7
+ declare const Chart: React.FC<ChartProps>;
8
+ export default Chart;
@@ -0,0 +1,62 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React, { useRef, useEffect, useImperativeHandle } from "react";
3
+ import * as echarts from "echarts/core";
4
+ import { BarChart, LineChart, PieChart } from "echarts/charts";
5
+ import { GraphicComponent, LegendComponent, TitleComponent, TooltipComponent, GridComponent, DatasetComponent, TransformComponent } from "echarts/components";
6
+ import { LabelLayout, UniversalTransition } from "echarts/features";
7
+ import { CanvasRenderer } from "echarts/renderers";
8
+ echarts.use([
9
+ GraphicComponent,
10
+ LegendComponent,
11
+ TitleComponent,
12
+ TooltipComponent,
13
+ GridComponent,
14
+ DatasetComponent,
15
+ TransformComponent,
16
+ BarChart,
17
+ LineChart,
18
+ PieChart,
19
+ LabelLayout,
20
+ UniversalTransition,
21
+ CanvasRenderer
22
+ ]);
23
+ const Chart = React.memo(({ options, echartRef }) => {
24
+ const chartRef = useRef(null);
25
+ const chartInstanceRef = useRef(null);
26
+ useEffect(() => {
27
+ if (chartRef.current) {
28
+ chartInstanceRef.current = echarts.init(chartRef.current);
29
+ window.__chartInstanceRef = chartInstanceRef;
30
+ }
31
+ return () => {
32
+ if (chartInstanceRef.current) {
33
+ chartInstanceRef.current.dispose();
34
+ }
35
+ };
36
+ }, []);
37
+ useEffect(() => {
38
+ if (chartInstanceRef.current) {
39
+ chartInstanceRef.current.clear();
40
+ if (options && Object.keys(options).length > 0) {
41
+ chartInstanceRef.current.setOption({ ...options });
42
+ }
43
+ }
44
+ }, [options]);
45
+ useImperativeHandle(echartRef, () => ({
46
+ resize: () => {
47
+ if (chartInstanceRef.current) {
48
+ chartInstanceRef.current.resize();
49
+ }
50
+ },
51
+ getWidth: () => {
52
+ if (chartInstanceRef.current) {
53
+ chartInstanceRef.current.getWidth();
54
+ }
55
+ }
56
+ }));
57
+ return /* @__PURE__ */ jsx("div", { ref: chartRef, style: { width: "100%", height: "100%" } });
58
+ });
59
+ export {
60
+ Chart as default
61
+ };
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../packages/dashboard-workbench/components/module-content/chart-module/base-chart/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useImperativeHandle, useRef } from 'react'\nimport * as echarts from 'echarts/core'\nimport { BarChart, LineChart, PieChart } from 'echarts/charts'\nimport {\n GraphicComponent,\n TitleComponent,\n TooltipComponent,\n GridComponent,\n DatasetComponent,\n TransformComponent,\n LegendComponent,\n} from 'echarts/components'\n\nimport { LabelLayout, UniversalTransition } from 'echarts/features'\nimport { CanvasRenderer } from 'echarts/renderers'\nimport { EChartsOption } from 'echarts'\n\necharts.use([\n GraphicComponent,\n LegendComponent,\n TitleComponent,\n TooltipComponent,\n GridComponent,\n DatasetComponent,\n TransformComponent,\n BarChart,\n LineChart,\n PieChart,\n LabelLayout,\n UniversalTransition,\n CanvasRenderer,\n])\n\ninterface ChartProps {\n options?: EChartsOption\n echartRef?: any\n}\n\nconst Chart: React.FC<ChartProps> = React.memo(({ options, echartRef }) => {\n const chartRef = useRef<HTMLDivElement>(null)\n const chartInstanceRef = useRef<echarts.ECharts | null>(null)\n\n useEffect(() => {\n if (chartRef.current) {\n chartInstanceRef.current = echarts.init(chartRef.current)\n //@ts-ignore\n window.__chartInstanceRef = chartInstanceRef\n // chartInstanceRef.current = echarts.init(chartRef.current, 'light223')\n }\n return () => {\n if (chartInstanceRef.current) {\n chartInstanceRef.current.dispose()\n }\n }\n }, [])\n\n useEffect(() => {\n if (chartInstanceRef.current) {\n chartInstanceRef.current.clear()\n if (options && Object.keys(options).length > 0) {\n chartInstanceRef.current.setOption({ ...options })\n }\n }\n }, [options])\n\n useImperativeHandle(echartRef, () => ({\n resize: () => {\n if (chartInstanceRef.current) {\n chartInstanceRef.current.resize()\n }\n },\n getWidth: () => {\n if (chartInstanceRef.current) {\n chartInstanceRef.current.getWidth()\n }\n },\n }))\n\n return <div ref={chartRef} style={{ width: '100%', height: '100%' }} />\n})\n\nexport default Chart\n"],"names":[],"mappings":";;;;;;;AAkBA,QAAQ,IAAI;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOD,MAAM,QAA8B,MAAM,KAAK,CAAC,EAAE,SAAS,gBAAgB;AACnE,QAAA,WAAW,OAAuB,IAAI;AACtC,QAAA,mBAAmB,OAA+B,IAAI;AAE5D,YAAU,MAAM;AACd,QAAI,SAAS,SAAS;AACpB,uBAAiB,UAAU,QAAQ,KAAK,SAAS,OAAO;AAExD,aAAO,qBAAqB;AAAA,IAAA;AAG9B,WAAO,MAAM;AACX,UAAI,iBAAiB,SAAS;AAC5B,yBAAiB,QAAQ,QAAQ;AAAA,MAAA;AAAA,IAErC;AAAA,EACF,GAAG,EAAE;AAEL,YAAU,MAAM;AACd,QAAI,iBAAiB,SAAS;AAC5B,uBAAiB,QAAQ,MAAM;AAC/B,UAAI,WAAW,OAAO,KAAK,OAAO,EAAE,SAAS,GAAG;AAC9C,yBAAiB,QAAQ,UAAU,EAAE,GAAG,SAAS;AAAA,MAAA;AAAA,IACnD;AAAA,EACF,GACC,CAAC,OAAO,CAAC;AAEZ,sBAAoB,WAAW,OAAO;AAAA,IACpC,QAAQ,MAAM;AACZ,UAAI,iBAAiB,SAAS;AAC5B,yBAAiB,QAAQ,OAAO;AAAA,MAAA;AAAA,IAEpC;AAAA,IACA,UAAU,MAAM;AACd,UAAI,iBAAiB,SAAS;AAC5B,yBAAiB,QAAQ,SAAS;AAAA,MAAA;AAAA,IACpC;AAAA,EACF,EACA;AAEK,SAAA,oBAAC,OAAI,EAAA,KAAK,UAAU,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAU,EAAA,CAAA;AACvE,CAAC;"}
@@ -0,0 +1,14 @@
1
+ import { ModuleDataApi } from '../../../types';
2
+ import { ChartCustomeDataTypes } from '../../add-module-modal/add-chart-modal/custome-data';
3
+ import { ChartCustomeStylesTypes } from '../../add-module-modal/add-chart-modal/custome-styles';
4
+ import { default as React } from 'react';
5
+ interface ChartModuleProps {
6
+ customData?: ChartCustomeDataTypes;
7
+ customeStyle?: ChartCustomeStylesTypes;
8
+ onChange?: (val: unknown) => void;
9
+ moduleDataApi?: ModuleDataApi;
10
+ width?: number;
11
+ height?: number;
12
+ }
13
+ declare const _default: React.NamedExoticComponent<ChartModuleProps>;
14
+ export default _default;