@platox/pivot-table 0.0.53 → 0.0.55

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.
@@ -9,3 +9,4 @@ interface AddModuleBtnProps {
9
9
  }
10
10
  declare const AddModuleBtn: React.FC<AddModuleBtnProps>;
11
11
  export default AddModuleBtn;
12
+ export declare const AddBtn: () => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
- import { Popover, Button } from "antd";
3
+ import { Popover } from "antd";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import SvgComponent from "../../icon/icon-chart-combination.js";
6
6
  import IconBar from "../../icon/icon-bar.js";
@@ -10,11 +10,9 @@ import IconLine from "../../icon/icon-line.js";
10
10
  import IconPie from "../../icon/icon-pie.js";
11
11
  import IconStatistics from "../../icon/icon-statistics.js";
12
12
  import IconStripBar from "../../icon/icon-strip-bar.js";
13
- import { useChartTypeOption } from "../add-module-modal/add-chart-modal/config.js";
14
13
  import { ChartType } from "../add-module-modal/add-chart-modal/interface.js";
15
14
  const AddModuleBtn = ({ onOk }) => {
16
15
  const { t } = useTranslation();
17
- useChartTypeOption();
18
16
  const navs = [
19
17
  {
20
18
  title: t("add.add1"),
@@ -96,11 +94,41 @@ const AddModuleBtn = ({ onOk }) => {
96
94
  )) })
97
95
  ] }, key)) }),
98
96
  trigger: "click",
99
- children: /* @__PURE__ */ jsx(Button, { children: t("add.add10") })
97
+ children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(AddBtn, {}) })
100
98
  }
101
99
  ) });
102
100
  };
101
+ const AddBtn = () => {
102
+ return /* @__PURE__ */ jsx(
103
+ "div",
104
+ {
105
+ style: {
106
+ width: "1.5rem",
107
+ height: "1.5rem",
108
+ backgroundColor: "var(--brand)",
109
+ display: "flex",
110
+ alignItems: "center",
111
+ justifyContent: "center",
112
+ borderRadius: "9999px",
113
+ cursor: "pointer"
114
+ },
115
+ children: /* @__PURE__ */ jsx(
116
+ "div",
117
+ {
118
+ style: {
119
+ fontSize: "1.25rem",
120
+ color: "black",
121
+ lineHeight: "1.25rem",
122
+ marginTop: "-2px"
123
+ },
124
+ children: "+"
125
+ }
126
+ )
127
+ }
128
+ );
129
+ };
103
130
  export {
131
+ AddBtn,
104
132
  AddModuleBtn as default
105
133
  };
106
134
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../packages/dashboard-workbench/components/add-module-btn/index.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { Button, Popover } from 'antd'\nimport { useTranslation } from 'react-i18next'\nimport IconChartCombination from '@platox/pivot-table/icon/icon-chart-combination'\nimport IconBar from '../../icon/icon-bar'\nimport IconCalendar from '../../icon/icon-calendar'\nimport IconEditor from '../../icon/icon-editor'\nimport IconLine from '../../icon/icon-line'\nimport IconPie from '../../icon/icon-pie'\nimport IconStatistics from '../../icon/icon-statistics'\nimport IconStripBar from '../../icon/icon-strip-bar'\nimport { useChartTypeOption } from '../add-module-modal/add-chart-modal/config'\nimport { ChartType } from '../add-module-modal/add-chart-modal/interface'\n\nexport interface ModuleValueType {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n id?: any\n type?:\n | 'text'\n | 'statistics'\n | 'chart-bar'\n | 'chart-bar-pile'\n | 'chart-bar-percentage'\n | 'chart-line'\n | 'chart-line-smooth'\n | 'chart-strip-bar'\n | 'chart-strip-bar-pile'\n | 'chart-strip-bar-percentage'\n | 'chart-pie'\n | 'chart-pie-circular'\n | 'calendar'\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customData?: any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customeStyle?: any\n}\n\ninterface AddModuleBtnProps {\n onOk?: (type: ModuleValueType['type']) => void\n}\n\nconst AddModuleBtn: React.FC<AddModuleBtnProps> = ({ onOk }) => {\n const { t } = useTranslation()\n\n const chartTypeOptions = useChartTypeOption()\n\n const navs = [\n {\n title: t('add.add1'),\n child: [\n {\n title: t('add.add2'),\n type: 'chart-bar',\n icon: <IconBar />,\n },\n {\n title: t('add.add3'),\n type: 'chart-line',\n icon: <IconLine />,\n },\n {\n title: t('add.add4'),\n type: 'chart-pie',\n icon: <IconPie />,\n },\n {\n title: t('add.add5'),\n type: 'chart-strip-bar',\n icon: <IconStripBar />,\n },\n {\n title: t('add._add5'),\n type: ChartType['chartCombination'],\n icon: <IconChartCombination />,\n },\n ],\n },\n {\n title: t('add.add6'),\n child: [\n {\n title: t('add.add7'),\n type: 'statistics',\n icon: <IconStatistics />,\n },\n {\n title: t('add.add8'),\n type: 'text',\n icon: <IconEditor />,\n },\n {\n title: t('add.add9'),\n type: 'calendar',\n icon: <IconCalendar />,\n },\n ],\n },\n ]\n\n const [open, setOpen] = useState(false)\n const onAdd = (value: ModuleValueType['type']) => {\n setOpen(false)\n onOk?.(value)\n }\n\n return (\n <>\n <Popover\n placement=\"bottomRight\"\n open={open}\n onOpenChange={setOpen}\n content={\n <div className=\"pivot-table-modal box-widget-popover-item-container\">\n {navs.map((item, key) => (\n <div key={key} className=\"box-widget-popover-item-group\">\n <p className=\"box-widget-popover-item-group-header\">{item.title}</p>\n <div className=\"box-widget-popover-item-group-content\">\n {item.child.map((child, childKey) => (\n <div\n key={childKey}\n onClick={() => {\n onAdd(child.type as ModuleValueType['type'])\n }}\n className=\"box-widget-popover-item\"\n >\n <div className=\"img\">{child.icon}</div>\n <div className=\"title\">{child.title}</div>\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n }\n trigger=\"click\"\n >\n <Button>{t('add.add10')}</Button>\n </Popover>\n </>\n )\n}\n\nexport default AddModuleBtn\n"],"names":["IconChartCombination"],"mappings":";;;;;;;;;;;;;;AAyCA,MAAM,eAA4C,CAAC,EAAE,WAAW;AACxD,QAAA,EAAE,EAAE,IAAI,eAAe;AAEJ,qBAAmB;AAE5C,QAAM,OAAO;AAAA,IACX;AAAA,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AAA,MACV;AAAA,MACA,cAAc;AAAA,MACd,SACE,oBAAC,OAAI,EAAA,WAAU,uDACZ,UAAA,KAAK,IAAI,CAAC,MAAM,QACd,qBAAA,OAAA,EAAc,WAAU,iCACvB,UAAA;AAAA,QAAA,oBAAC,KAAE,EAAA,WAAU,wCAAwC,UAAA,KAAK,OAAM;AAAA,QAChE,oBAAC,SAAI,WAAU,yCACZ,eAAK,MAAM,IAAI,CAAC,OAAO,aACtB;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,SAAS,MAAM;AACb,oBAAM,MAAM,IAA+B;AAAA,YAC7C;AAAA,YACA,WAAU;AAAA,YAEV,UAAA;AAAA,cAAA,oBAAC,OAAI,EAAA,WAAU,OAAO,UAAA,MAAM,MAAK;AAAA,cAChC,oBAAA,OAAA,EAAI,WAAU,SAAS,gBAAM,MAAM,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAP/B;AAAA,QAAA,CASR,EACH,CAAA;AAAA,MAAA,KAfQ,GAgBV,CACD,GACH;AAAA,MAEF,SAAQ;AAAA,MAER,UAAC,oBAAA,QAAA,EAAQ,UAAE,EAAA,WAAW,EAAE,CAAA;AAAA,IAAA;AAAA,EAAA,GAE5B;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../packages/dashboard-workbench/components/add-module-btn/index.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { Button, Popover } from 'antd'\nimport { useTranslation } from 'react-i18next'\nimport IconChartCombination from '@platox/pivot-table/icon/icon-chart-combination'\nimport IconBar from '../../icon/icon-bar'\nimport IconCalendar from '../../icon/icon-calendar'\nimport IconEditor from '../../icon/icon-editor'\nimport IconLine from '../../icon/icon-line'\nimport IconPie from '../../icon/icon-pie'\nimport IconStatistics from '../../icon/icon-statistics'\nimport IconStripBar from '../../icon/icon-strip-bar'\nimport { useChartTypeOption } from '../add-module-modal/add-chart-modal/config'\nimport { ChartType } from '../add-module-modal/add-chart-modal/interface'\n\nexport interface ModuleValueType {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n id?: any\n type?:\n | 'text'\n | 'statistics'\n | 'chart-bar'\n | 'chart-bar-pile'\n | 'chart-bar-percentage'\n | 'chart-line'\n | 'chart-line-smooth'\n | 'chart-strip-bar'\n | 'chart-strip-bar-pile'\n | 'chart-strip-bar-percentage'\n | 'chart-pie'\n | 'chart-pie-circular'\n | 'calendar'\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customData?: any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customeStyle?: any\n}\n\ninterface AddModuleBtnProps {\n onOk?: (type: ModuleValueType['type']) => void\n}\n\nconst AddModuleBtn: React.FC<AddModuleBtnProps> = ({ onOk }) => {\n const { t } = useTranslation()\n\n const navs = [\n {\n title: t('add.add1'),\n child: [\n {\n title: t('add.add2'),\n type: 'chart-bar',\n icon: <IconBar />,\n },\n {\n title: t('add.add3'),\n type: 'chart-line',\n icon: <IconLine />,\n },\n {\n title: t('add.add4'),\n type: 'chart-pie',\n icon: <IconPie />,\n },\n {\n title: t('add.add5'),\n type: 'chart-strip-bar',\n icon: <IconStripBar />,\n },\n {\n title: t('add._add5'),\n type: ChartType['chartCombination'],\n icon: <IconChartCombination />,\n },\n ],\n },\n {\n title: t('add.add6'),\n child: [\n {\n title: t('add.add7'),\n type: 'statistics',\n icon: <IconStatistics />,\n },\n {\n title: t('add.add8'),\n type: 'text',\n icon: <IconEditor />,\n },\n {\n title: t('add.add9'),\n type: 'calendar',\n icon: <IconCalendar />,\n },\n ],\n },\n ]\n\n const [open, setOpen] = useState(false)\n const onAdd = (value: ModuleValueType['type']) => {\n setOpen(false)\n onOk?.(value)\n }\n\n return (\n <>\n <Popover\n placement=\"bottomRight\"\n open={open}\n onOpenChange={setOpen}\n content={\n <div className=\"pivot-table-modal box-widget-popover-item-container\">\n {navs.map((item, key) => (\n <div key={key} className=\"box-widget-popover-item-group\">\n <p className=\"box-widget-popover-item-group-header\">{item.title}</p>\n <div className=\"box-widget-popover-item-group-content\">\n {item.child.map((child, childKey) => (\n <div\n key={childKey}\n onClick={() => {\n onAdd(child.type as ModuleValueType['type'])\n }}\n className=\"box-widget-popover-item\"\n >\n <div className=\"img\">{child.icon}</div>\n <div className=\"title\">{child.title}</div>\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n }\n trigger=\"click\"\n >\n <span>\n <AddBtn />\n </span>\n </Popover>\n </>\n )\n}\n\nexport default AddModuleBtn\n\n/* ============================== split =============================== */\n\nexport const AddBtn = () => {\n return (\n <div\n style={{\n width: '1.5rem',\n height: '1.5rem',\n backgroundColor: 'var(--brand)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '9999px',\n cursor: 'pointer',\n }}\n >\n <div\n style={{\n fontSize: '1.25rem',\n color: 'black',\n lineHeight: '1.25rem',\n marginTop: '-2px',\n }}\n >\n +\n </div>\n </div>\n )\n}\n"],"names":["IconChartCombination"],"mappings":";;;;;;;;;;;;;AAyCA,MAAM,eAA4C,CAAC,EAAE,WAAW;AACxD,QAAA,EAAE,EAAE,IAAI,eAAe;AAE7B,QAAM,OAAO;AAAA,IACX;AAAA,MACE,OAAO,EAAE,UAAU;AAAA,MACnB,OAAO;AAAA,QACL;AAAA,UACE,OAAO,EAAE,UAAU;AAAA,UACnB,MAAM;AAAA,UACN,0BAAO,SAAQ,CAAA,CAAA;AAAA,QACjB;AAAA,QACA;AAAA,UACE,OAAO,EAAE,UAAU;AAAA,UACnB,MAAM;AAAA,UACN,0BAAO,UAAS,CAAA,CAAA;AAAA,QAClB;AAAA,QACA;AAAA,UACE,OAAO,EAAE,UAAU;AAAA,UACnB,MAAM;AAAA,UACN,0BAAO,SAAQ,CAAA,CAAA;AAAA,QACjB;AAAA,QACA;AAAA,UACE,OAAO,EAAE,UAAU;AAAA,UACnB,MAAM;AAAA,UACN,0BAAO,cAAa,CAAA,CAAA;AAAA,QACtB;AAAA,QACA;AAAA,UACE,OAAO,EAAE,WAAW;AAAA,UACpB,MAAM,UAAU,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;AAAA,YAAA;AAAA,UAAA;AAAA,UAP/B;AAAA,QAAA,CASR,EACH,CAAA;AAAA,MAAA,KAfQ,GAgBV,CACD,GACH;AAAA,MAEF,SAAQ;AAAA,MAER,UAAC,oBAAA,QAAA,EACC,UAAC,oBAAA,QAAA,CAAA,CAAO,EACV,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAMO,MAAM,SAAS,MAAM;AAExB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,iBAAiB;AAAA,QACjB,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,cAAc;AAAA,QACd,QAAQ;AAAA,MACV;AAAA,MAEA,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAO;AAAA,YACL,UAAU;AAAA,YACV,OAAO;AAAA,YACP,YAAY;AAAA,YACZ,WAAW;AAAA,UACb;AAAA,UACD,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED;AAAA,EACF;AAEJ;"}
@@ -2,11 +2,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useMemo, useEffect } from "react";
3
3
  import clsx from "clsx";
4
4
  import { Popover, Button, Select } from "antd";
5
- import { FilterOutlined, PlusOutlined } from "@ant-design/icons";
5
+ import { PlusOutlined } from "@ant-design/icons";
6
6
  import { useTranslation } from "react-i18next";
7
7
  import { useMemoizedFn } from "ahooks";
8
8
  import { cloneDeep, isEqual } from "lodash-es";
9
9
  import { useAppContext } from "../../context.js";
10
+ import SvgComponent from "../../icon/icon-Filter.js";
10
11
  import { useConditionTypeOptions } from "../add-module-modal/components/condition-modal/config.js";
11
12
  import { ConditionRowItem } from "./ConditionRowItem.js";
12
13
  import styles from "./index.module.less.js";
@@ -74,11 +75,15 @@ const GlobalFilterCondition = (props) => {
74
75
  trigger: "click",
75
76
  open,
76
77
  onOpenChange: setOpen,
77
- children: /* @__PURE__ */ jsxs(Button, { children: [
78
- /* @__PURE__ */ jsx(FilterOutlined, {}),
79
- t("globalfilter"),
80
- ((globalFilterCondition == null ? void 0 : globalFilterCondition.length) ?? 0) > 0 ? `(${globalFilterCondition == null ? void 0 : globalFilterCondition.length})` : ""
81
- ] })
78
+ children: /* @__PURE__ */ jsx(
79
+ Button,
80
+ {
81
+ className: `!px-1 ${((globalFilterCondition == null ? void 0 : globalFilterCondition.length) ?? 0) > 0 ? "!bg-primary/10" : ""}`,
82
+ type: "text",
83
+ icon: /* @__PURE__ */ jsx(SvgComponent, {}),
84
+ children: t("globalfilter")
85
+ }
86
+ )
82
87
  }
83
88
  ) })
84
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../packages/dashboard-workbench/components/global-filter-condition/index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\nimport clsx from 'clsx'\nimport { Button, MenuProps, Popover, Select, Space } from 'antd'\nimport { FilterOutlined, PlusOutlined } from '@ant-design/icons'\nimport { useTranslation } from 'react-i18next'\nimport { useMemoizedFn } from 'ahooks'\nimport { cloneDeep, isEqual } from 'lodash-es'\nimport { useAppContext } from '@platox/pivot-table/context'\nimport { useConditionTypeOptions } from '../add-module-modal/components/condition-modal/config'\nimport ConditionRowItem from './ConditionRowItem'\nimport { FieldPickerDataSourceItem } from './FieldPicker'\nimport styles from './index.module.less'\nimport { ConditionBlockWrapper, ConditionListItemWrapper } from './interface'\nimport { Context, ContextProps, useContext } from './useContext'\nimport { getMergeId } from './util'\n\nconst componentName = 'global-filter-condition'\n\nconst Empty: unknown[] = []\n\n/* ============================== split =============================== */\n\nexport interface GlobalFilterConditionProps {\n className?: string\n style?: React.CSSProperties\n}\nexport const GlobalFilterCondition: React.FC<GlobalFilterConditionProps> = props => {\n const { className, style } = props\n\n const { t } = useTranslation()\n\n const { globalFilterCondition, setGlobalFilterCondition } = useAppContext()\n\n const [open, setOpen] = useState<boolean>(false)\n\n /* ============================== 整理数据 =============================== */\n const { globalData } = useAppContext()\n const { fieldPickerDataSource, flattenFieldMap } = useMemo(() => {\n let flattenFieldMap: ContextProps['flattenFieldMap'] = new Map()\n\n let fieldPickerDataSource = (globalData?.sourceData || []).map(item => {\n let children = (item?.fields || []).map(v => {\n let mergeId = getMergeId(item?.value, v?.value)\n\n // 记录mergeId对应的field和source\n flattenFieldMap.set(mergeId, {\n field: v,\n source: item,\n mergeId: mergeId,\n })\n\n return {\n key: mergeId,\n label: v?.label,\n }\n })\n\n return {\n key: item?.value,\n label: item?.label,\n children,\n popupClassName: styles['sub-popup'],\n }\n })\n\n return {\n fieldPickerDataSource: fieldPickerDataSource as unknown as FieldPickerDataSourceItem[],\n flattenFieldMap,\n }\n }, [globalData?.sourceData])\n\n return (\n <Context.Provider\n value={{\n fieldPickerDataSource: fieldPickerDataSource,\n flattenFieldMap: flattenFieldMap,\n }}\n >\n <div className={clsx(styles[`${componentName}`], className)} style={style}>\n <Popover\n content={\n <PopoverContent\n defaultValue={globalFilterCondition}\n onClose={(isOk, data) => {\n if (isOk) {\n setGlobalFilterCondition(data!)\n }\n setOpen(false)\n }}\n />\n }\n destroyTooltipOnHide\n placement=\"bottomRight\"\n trigger=\"click\"\n open={open}\n onOpenChange={setOpen}\n >\n <Button>\n <FilterOutlined />\n {t('globalfilter')}\n {(globalFilterCondition?.length ?? 0) > 0 ? `(${globalFilterCondition?.length})` : ''}\n </Button>\n </Popover>\n </div>\n </Context.Provider>\n )\n}\n\nGlobalFilterCondition.displayName = 'GlobalFilterCondition'\n\nexport default GlobalFilterCondition\n\n/* ============================== split =============================== */\n\nexport type PopoverContentProps = {\n defaultValue?: ConditionBlockWrapper[]\n onClose?: (isOk: boolean, data?: ConditionBlockWrapper[]) => void\n}\n\nexport const PopoverContent = (props: PopoverContentProps) => {\n const { defaultValue } = props\n\n const { t } = useTranslation()\n const fieldPickerDataSource = useContext().fieldPickerDataSource\n const conditionTypeOptions = useConditionTypeOptions()\n\n /* ============================== split =============================== */\n const [value = Empty as ConditionBlockWrapper[], setValue] = useState<ConditionBlockWrapper[]>([])\n\n useEffect(() => {\n if (defaultValue) {\n setValue(cloneDeep(defaultValue))\n }\n }, [defaultValue])\n\n /* ============================== 这是empty =============================== */\n const [emptyBlockList, setEmptyBlockList] = useState<ConditionListItemWrapper[]>([])\n\n const handleEmptyBlockListChange = (newItem: ConditionListItemWrapper) => {\n if (newItem?.field) {\n setValue(prev => {\n let ret = [...prev]\n let match = ret.find(item => item.dataSourceId === newItem.dataSourceId)\n if (match) {\n match.conditionList.push(newItem)\n return [...ret]\n } else {\n //  创建一个\n let newConditionBlockWrapper = {\n dataSourceId: newItem.dataSourceId,\n conditionType: 'all',\n conditionList: [newItem],\n } as ConditionBlockWrapper\n return [...ret, newConditionBlockWrapper]\n }\n })\n }\n }\n\n const handleAddEmptyBlock = () => {\n setEmptyBlockList([...emptyBlockList, {}])\n }\n\n /* ============================== split =============================== */\n const hasChange = useMemo(() => {\n return !isEqual(value, defaultValue)\n }, [value, defaultValue])\n\n const handleSubmit = useMemoizedFn(() => {\n props?.onClose?.(true, value)\n })\n\n return (\n <div className={clsx(styles[`${componentName}__popover`])}>\n <div\n style={{\n marginBottom: '10px',\n }}\n >\n {t('setFilterCondition')}\n </div>\n\n {value.map((item, index) => {\n let conditionList = item?.conditionList\n let dataSourceName = fieldPickerDataSource?.find(v => v.key === item?.dataSourceId)?.label\n\n return (\n <div className={clsx(styles[`${componentName}__block`])} key={item?.dataSourceId}>\n <div\n style={{\n marginBottom: '10px',\n display: 'flex',\n justifyContent: 'space-between',\n }}\n >\n <div>{dataSourceName}</div>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '5px',\n }}\n >\n {t('conformTo')}\n <Select\n style={{ width: '80px' }}\n options={conditionTypeOptions}\n value={item?.conditionType}\n onChange={v => {\n setValue(prev => {\n let ret = [...prev]\n ret[index].conditionType = v\n return ret\n })\n }}\n />\n {t('addCondition')}\n </div>\n </div>\n <div\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '10px',\n }}\n >\n {conditionList.map((v, conditionIndex) => {\n return (\n <ConditionRowItem\n key={conditionIndex}\n value={v}\n onChange={newValue => {\n setValue(prev => {\n let ret = [...prev]\n let prevItem = ret[index].conditionList[conditionIndex]\n if (prevItem?.dataSourceId !== newValue?.dataSourceId) {\n // 数据源变化了 删除原来的\n ret[index].conditionList.splice(conditionIndex, 1)\n if (ret[index].conditionList.length === 0) {\n ret.splice(index, 1)\n }\n // 添加到新的数据源添\n let newItem = newValue\n let match = ret.find(item => item.dataSourceId === newItem.dataSourceId)\n if (match) {\n match.conditionList.push(newItem)\n return [...ret]\n } else {\n let newConditionBlockWrapper = {\n dataSourceId: newItem.dataSourceId,\n conditionType: 'all',\n conditionList: [newItem],\n } as ConditionBlockWrapper\n return [...ret, newConditionBlockWrapper]\n }\n } else {\n ret[index].conditionList[conditionIndex] = {\n ...prevItem,\n ...newValue,\n }\n }\n\n return ret\n })\n }}\n onDelete={() => {\n setValue(prev => {\n let ret = [...prev]\n ret[index].conditionList.splice(conditionIndex, 1)\n\n if (ret[index].conditionList.length === 0) {\n ret.splice(index, 1)\n }\n return ret\n })\n }}\n />\n )\n })}\n </div>\n </div>\n )\n })}\n\n {emptyBlockList.map((item, index) => {\n return (\n <div className={clsx(styles[`${componentName}__block`])} key={index}>\n <ConditionRowItem\n value={item}\n onChange={newValue => {\n handleEmptyBlockListChange(newValue)\n }}\n onDelete={() => {\n setEmptyBlockList(prev => {\n let ret = [...prev]\n ret.splice(index, 1)\n return ret\n })\n }}\n />\n </div>\n )\n })}\n\n <Button\n type=\"dashed\"\n block\n style={{\n marginBottom: '10px',\n }}\n icon={<PlusOutlined />}\n onClick={() => {\n handleAddEmptyBlock()\n }}\n >\n {t('addCondition')}\n </Button>\n\n <div\n style={{\n display: 'flex',\n justifyContent: 'flex-end',\n }}\n >\n <Button\n type=\"primary\"\n disabled={!hasChange}\n onClick={() => {\n handleSubmit()\n }}\n >\n {t('confirm')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AA;AAAA,QACC,MAAK;AAAA,QACL,OAAK;AAAA,QACL,OAAO;AAAA,UACL,cAAc;AAAA,QAChB;AAAA,QACA,0BAAO,cAAa,EAAA;AAAA,QACpB,SAAS,MAAM;AACO,8BAAA;AAAA,QACtB;AAAA,QAEC,YAAE,cAAc;AAAA,MAAA;AAAA,IACnB;AAAA,IAEA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,SAAS;AAAA,UACT,gBAAgB;AAAA,QAClB;AAAA,QAEA,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,UAAU,CAAC;AAAA,YACX,SAAS,MAAM;AACA,2BAAA;AAAA,YACf;AAAA,YAEC,YAAE,SAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../packages/dashboard-workbench/components/global-filter-condition/index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\nimport clsx from 'clsx'\nimport { Button, Popover, Select } from 'antd'\nimport { PlusOutlined } from '@ant-design/icons'\nimport { useTranslation } from 'react-i18next'\nimport { useMemoizedFn } from 'ahooks'\nimport { cloneDeep, isEqual } from 'lodash-es'\nimport { useAppContext } from '@platox/pivot-table/context'\nimport IconFilter from '@platox/pivot-table/icon/icon-Filter'\nimport { useConditionTypeOptions } from '../add-module-modal/components/condition-modal/config'\nimport ConditionRowItem from './ConditionRowItem'\nimport { FieldPickerDataSourceItem } from './FieldPicker'\nimport styles from './index.module.less'\nimport { ConditionBlockWrapper, ConditionListItemWrapper } from './interface'\nimport { Context, ContextProps, useContext } from './useContext'\nimport { getMergeId } from './util'\n\nconst componentName = 'global-filter-condition'\n\nconst Empty: unknown[] = []\n\n/* ============================== split =============================== */\n\nexport interface GlobalFilterConditionProps {\n className?: string\n style?: React.CSSProperties\n}\nexport const GlobalFilterCondition: React.FC<GlobalFilterConditionProps> = props => {\n const { className, style } = props\n\n const { t } = useTranslation()\n\n const { globalFilterCondition, setGlobalFilterCondition } = useAppContext()\n\n const [open, setOpen] = useState<boolean>(false)\n\n /* ============================== 整理数据 =============================== */\n const { globalData } = useAppContext()\n const { fieldPickerDataSource, flattenFieldMap } = useMemo(() => {\n let flattenFieldMap: ContextProps['flattenFieldMap'] = new Map()\n\n let fieldPickerDataSource = (globalData?.sourceData || []).map(item => {\n let children = (item?.fields || []).map(v => {\n let mergeId = getMergeId(item?.value, v?.value)\n\n // 记录mergeId对应的field和source\n flattenFieldMap.set(mergeId, {\n field: v,\n source: item,\n mergeId: mergeId,\n })\n\n return {\n key: mergeId,\n label: v?.label,\n }\n })\n\n return {\n key: item?.value,\n label: item?.label,\n children,\n popupClassName: styles['sub-popup'],\n }\n })\n\n return {\n fieldPickerDataSource: fieldPickerDataSource as unknown as FieldPickerDataSourceItem[],\n flattenFieldMap,\n }\n }, [globalData?.sourceData])\n\n return (\n <Context.Provider\n value={{\n fieldPickerDataSource: fieldPickerDataSource,\n flattenFieldMap: flattenFieldMap,\n }}\n >\n <div className={clsx(styles[`${componentName}`], className)} style={style}>\n <Popover\n content={\n <PopoverContent\n defaultValue={globalFilterCondition}\n onClose={(isOk, data) => {\n if (isOk) {\n setGlobalFilterCondition(data!)\n }\n setOpen(false)\n }}\n />\n }\n destroyTooltipOnHide\n placement=\"bottomRight\"\n trigger=\"click\"\n open={open}\n onOpenChange={setOpen}\n >\n <Button\n className={`!px-1 ${(globalFilterCondition?.length ?? 0) > 0 ? '!bg-primary/10' : ''}`}\n type=\"text\"\n icon={<IconFilter />}\n >\n {t('globalfilter')}\n {/* {t('common.filter')} */}\n </Button>\n </Popover>\n </div>\n </Context.Provider>\n )\n}\n\nGlobalFilterCondition.displayName = 'GlobalFilterCondition'\n\nexport default GlobalFilterCondition\n\n/* ============================== split =============================== */\n\nexport type PopoverContentProps = {\n defaultValue?: ConditionBlockWrapper[]\n onClose?: (isOk: boolean, data?: ConditionBlockWrapper[]) => void\n}\n\nexport const PopoverContent = (props: PopoverContentProps) => {\n const { defaultValue } = props\n\n const { t } = useTranslation()\n const fieldPickerDataSource = useContext().fieldPickerDataSource\n const conditionTypeOptions = useConditionTypeOptions()\n\n /* ============================== split =============================== */\n const [value = Empty as ConditionBlockWrapper[], setValue] = useState<ConditionBlockWrapper[]>([])\n\n useEffect(() => {\n if (defaultValue) {\n setValue(cloneDeep(defaultValue))\n }\n }, [defaultValue])\n\n /* ============================== 这是empty =============================== */\n const [emptyBlockList, setEmptyBlockList] = useState<ConditionListItemWrapper[]>([])\n\n const handleEmptyBlockListChange = (newItem: ConditionListItemWrapper) => {\n if (newItem?.field) {\n setValue(prev => {\n let ret = [...prev]\n let match = ret.find(item => item.dataSourceId === newItem.dataSourceId)\n if (match) {\n match.conditionList.push(newItem)\n return [...ret]\n } else {\n //  创建一个\n let newConditionBlockWrapper = {\n dataSourceId: newItem.dataSourceId,\n conditionType: 'all',\n conditionList: [newItem],\n } as ConditionBlockWrapper\n return [...ret, newConditionBlockWrapper]\n }\n })\n }\n }\n\n const handleAddEmptyBlock = () => {\n setEmptyBlockList([...emptyBlockList, {}])\n }\n\n /* ============================== split =============================== */\n const hasChange = useMemo(() => {\n return !isEqual(value, defaultValue)\n }, [value, defaultValue])\n\n const handleSubmit = useMemoizedFn(() => {\n props?.onClose?.(true, value)\n })\n\n return (\n <div className={clsx(styles[`${componentName}__popover`])}>\n <div\n style={{\n marginBottom: '10px',\n }}\n >\n {t('setFilterCondition')}\n </div>\n\n {value.map((item, index) => {\n let conditionList = item?.conditionList\n let dataSourceName = fieldPickerDataSource?.find(v => v.key === item?.dataSourceId)?.label\n\n return (\n <div className={clsx(styles[`${componentName}__block`])} key={item?.dataSourceId}>\n <div\n style={{\n marginBottom: '10px',\n display: 'flex',\n justifyContent: 'space-between',\n }}\n >\n <div>{dataSourceName}</div>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '5px',\n }}\n >\n {t('conformTo')}\n <Select\n style={{ width: '80px' }}\n options={conditionTypeOptions}\n value={item?.conditionType}\n onChange={v => {\n setValue(prev => {\n let ret = [...prev]\n ret[index].conditionType = v\n return ret\n })\n }}\n />\n {t('addCondition')}\n </div>\n </div>\n <div\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '10px',\n }}\n >\n {conditionList.map((v, conditionIndex) => {\n return (\n <ConditionRowItem\n key={conditionIndex}\n value={v}\n onChange={newValue => {\n setValue(prev => {\n let ret = [...prev]\n let prevItem = ret[index].conditionList[conditionIndex]\n if (prevItem?.dataSourceId !== newValue?.dataSourceId) {\n // 数据源变化了 删除原来的\n ret[index].conditionList.splice(conditionIndex, 1)\n if (ret[index].conditionList.length === 0) {\n ret.splice(index, 1)\n }\n // 添加到新的数据源添\n let newItem = newValue\n let match = ret.find(item => item.dataSourceId === newItem.dataSourceId)\n if (match) {\n match.conditionList.push(newItem)\n return [...ret]\n } else {\n let newConditionBlockWrapper = {\n dataSourceId: newItem.dataSourceId,\n conditionType: 'all',\n conditionList: [newItem],\n } as ConditionBlockWrapper\n return [...ret, newConditionBlockWrapper]\n }\n } else {\n ret[index].conditionList[conditionIndex] = {\n ...prevItem,\n ...newValue,\n }\n }\n\n return ret\n })\n }}\n onDelete={() => {\n setValue(prev => {\n let ret = [...prev]\n ret[index].conditionList.splice(conditionIndex, 1)\n\n if (ret[index].conditionList.length === 0) {\n ret.splice(index, 1)\n }\n return ret\n })\n }}\n />\n )\n })}\n </div>\n </div>\n )\n })}\n\n {emptyBlockList.map((item, index) => {\n return (\n <div className={clsx(styles[`${componentName}__block`])} key={index}>\n <ConditionRowItem\n value={item}\n onChange={newValue => {\n handleEmptyBlockListChange(newValue)\n }}\n onDelete={() => {\n setEmptyBlockList(prev => {\n let ret = [...prev]\n ret.splice(index, 1)\n return ret\n })\n }}\n />\n </div>\n )\n })}\n\n <Button\n type=\"dashed\"\n block\n style={{\n marginBottom: '10px',\n }}\n icon={<PlusOutlined />}\n onClick={() => {\n handleAddEmptyBlock()\n }}\n >\n {t('addCondition')}\n </Button>\n\n <div\n style={{\n display: 'flex',\n justifyContent: 'flex-end',\n }}\n >\n <Button\n type=\"primary\"\n disabled={!hasChange}\n onClick={() => {\n handleSubmit()\n }}\n >\n {t('confirm')}\n </Button>\n </div>\n </div>\n )\n}\n"],"names":["flattenFieldMap","fieldPickerDataSource","IconFilter","item"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,gBAAgB;AAEtB,MAAM,QAAmB,CAAC;AAQnB,MAAM,wBAA8D,CAAS,UAAA;AAC5E,QAAA,EAAE,WAAW,MAAA,IAAU;AAEvB,QAAA,EAAE,EAAE,IAAI,eAAe;AAE7B,QAAM,EAAE,uBAAuB,yBAAyB,IAAI,cAAc;AAE1E,QAAM,CAAC,MAAM,OAAO,IAAI,SAAkB,KAAK;AAGzC,QAAA,EAAE,WAAW,IAAI,cAAc;AACrC,QAAM,EAAE,uBAAuB,gBAAgB,IAAI,QAAQ,MAAM;AAC3DA,QAAAA,uCAAuD,IAAI;AAE/D,QAAIC,2BAAyB,yCAAY,eAAc,CAAA,GAAI,IAAI,CAAQ,SAAA;AACrE,UAAI,aAAY,6BAAM,WAAU,CAAA,GAAI,IAAI,CAAK,MAAA;AAC3C,YAAI,UAAU,WAAW,6BAAM,OAAO,uBAAG,KAAK;AAG9CD,yBAAgB,IAAI,SAAS;AAAA,UAC3B,OAAO;AAAA,UACP,QAAQ;AAAA,UACR;AAAA,QAAA,CACD;AAEM,eAAA;AAAA,UACL,KAAK;AAAA,UACL,OAAO,uBAAG;AAAA,QACZ;AAAA,MAAA,CACD;AAEM,aAAA;AAAA,QACL,KAAK,6BAAM;AAAA,QACX,OAAO,6BAAM;AAAA,QACb;AAAA,QACA,gBAAgB,OAAO,WAAW;AAAA,MACpC;AAAA,IAAA,CACD;AAEM,WAAA;AAAA,MACL,uBAAuBC;AAAAA,MACvB,iBAAAD;AAAAA,IACF;AAAA,EAAA,GACC,CAAC,yCAAY,UAAU,CAAC;AAGzB,SAAA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,kBAAA,MAAM,CAAC,GAAG,IAAI;AACd,kBAAA,OAAO,OAAO,CAAC;AACZ,qBAAA;AAAA,YAAA,CACR;AAAA,UAAA;AAAA,QACH;AAAA,WAZ0D,KAc9D;AAAA,IAAA,CAEH;AAAA,IAED;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAK;AAAA,QACL,OAAO;AAAA,UACL,cAAc;AAAA,QAChB;AAAA,QACA,0BAAO,cAAa,EAAA;AAAA,QACpB,SAAS,MAAM;AACO,8BAAA;AAAA,QACtB;AAAA,QAEC,YAAE,cAAc;AAAA,MAAA;AAAA,IACnB;AAAA,IAEA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,SAAS;AAAA,UACT,gBAAgB;AAAA,QAClB;AAAA,QAEA,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,UAAU,CAAC;AAAA,YACX,SAAS,MAAM;AACA,2BAAA;AAAA,YACf;AAAA,YAEC,YAAE,SAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+ declare const SvgComponent: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default SvgComponent;
@@ -0,0 +1,17 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const SvgComponent = (props) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "currentColor", ...props, children: [
3
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#a)", children: /* @__PURE__ */ jsx(
4
+ "path",
5
+ {
6
+ fill: "#000",
7
+ fillRule: "evenodd",
8
+ d: "M3 2.666a.167.167 0 0 0-.166.167v1.634c0 .057.03.11.077.14l3.05 1.94c.336.215.54.586.54.985v4.634a.5.5 0 1 1-1 0V7.532c0-.057-.03-.11-.078-.14L2.374 5.45a1.167 1.167 0 0 1-.54-.984V2.833c0-.645.522-1.167 1.167-1.167h10c.644 0 1.166.522 1.166 1.167v1.634c0 .399-.204.77-.54.984l-3.05 1.94a.167.167 0 0 0-.076.141v6.3a.5.5 0 0 1-1 0v-6.3c0-.399.203-.77.54-.984l3.05-1.94a.167.167 0 0 0 .076-.141V2.833a.167.167 0 0 0-.166-.167H3Z",
9
+ clipRule: "evenodd"
10
+ }
11
+ ) }),
12
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h16v16H0z" }) }) })
13
+ ] });
14
+ export {
15
+ SvgComponent as default
16
+ };
17
+ //# sourceMappingURL=icon-Filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-Filter.js","sources":["../../../packages/dashboard-workbench/icon/icon-Filter.tsx"],"sourcesContent":["import * as React from 'react'\nimport { SVGProps } from 'react'\n\nconst SvgComponent = (props: SVGProps<SVGSVGElement>) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" fill=\"currentColor\" {...props}>\n <g clipPath=\"url(#a)\">\n <path\n fill=\"#000\"\n fillRule=\"evenodd\"\n d=\"M3 2.666a.167.167 0 0 0-.166.167v1.634c0 .057.03.11.077.14l3.05 1.94c.336.215.54.586.54.985v4.634a.5.5 0 1 1-1 0V7.532c0-.057-.03-.11-.078-.14L2.374 5.45a1.167 1.167 0 0 1-.54-.984V2.833c0-.645.522-1.167 1.167-1.167h10c.644 0 1.166.522 1.166 1.167v1.634c0 .399-.204.77-.54.984l-3.05 1.94a.167.167 0 0 0-.076.141v6.3a.5.5 0 0 1-1 0v-6.3c0-.399.203-.77.54-.984l3.05-1.94a.167.167 0 0 0 .076-.141V2.833a.167.167 0 0 0-.166-.167H3Z\"\n clipRule=\"evenodd\"\n />\n </g>\n <defs>\n <clipPath id=\"a\">\n <path fill=\"#fff\" d=\"M0 0h16v16H0z\" />\n </clipPath>\n </defs>\n </svg>\n)\nexport default SvgComponent\n"],"names":[],"mappings":";AAGA,MAAM,eAAe,CAAC,UACpB,qBAAC,SAAI,OAAM,8BAA6B,OAAM,OAAM,QAAO,OAAM,MAAK,gBAAgB,GAAG,OACvF,UAAA;AAAA,EAAC,oBAAA,KAAA,EAAE,UAAS,WACV,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,UAAS;AAAA,MACT,GAAE;AAAA,MACF,UAAS;AAAA,IAAA;AAAA,EAAA,GAEb;AAAA,EACC,oBAAA,QAAA,EACC,UAAC,oBAAA,YAAA,EAAS,IAAG,KACX,UAAC,oBAAA,QAAA,EAAK,MAAK,QAAO,GAAE,gBAAA,CAAgB,GACtC,EACF,CAAA;AAAA,EACF,CAAA;"}
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import React, { useEffect, useState } from "react";
2
+ import React, { useEffect, useState, useRef } from "react";
3
3
  import { Modal, message } from "antd";
4
4
  import { ExclamationCircleOutlined } from "@ant-design/icons";
5
5
  import { WidthProvider, Responsive } from "react-grid-layout";
6
6
  import { useTranslation } from "react-i18next";
7
- import { useControllableValue } from "ahooks";
7
+ import { useControllableValue, useScroll } from "ahooks";
8
8
  import { pick, omit } from "lodash-es";
9
9
  import AddModuleBtn from "./components/add-module-btn/index.js";
10
10
  import AddStatisticsModal$1 from "./components/add-module-modal/add-calendar-modal/index.js";
@@ -18,6 +18,7 @@ import { findChangedItems } from "./utils/index.js";
18
18
  import "./lang/index.js";
19
19
  /* empty css */
20
20
  /* empty css */
21
+ import clsx from "clsx";
21
22
  const ResponsiveReactGridLayout = WidthProvider(Responsive);
22
23
  const DashboardWorkbench = ({
23
24
  moduleConfigData,
@@ -190,134 +191,108 @@ const DashboardWorkbench = ({
190
191
  calendar: t("calendarText"),
191
192
  statistics: t("chartText")
192
193
  };
193
- return /* @__PURE__ */ jsxs("div", { className: "pivot-table", children: [
194
- /* @__PURE__ */ jsxs("div", { className: "bitable-block-dashboard", children: [
195
- /* @__PURE__ */ jsx("div", { className: "bitable-block-dashboard-toolbar bitable-toolbar", children: /* @__PURE__ */ jsxs("div", { className: "bitable-block-dashboard-toolbar--left", children: [
196
- /* @__PURE__ */ jsx(
197
- AddModuleBtn,
198
- {
199
- onOk: (val) => {
200
- handleOpenCreateModal(val);
201
- }
202
- }
194
+ const ref = useRef(null);
195
+ const scroll = useScroll(ref);
196
+ const isShadowShow = ((scroll == null ? void 0 : scroll.top) ?? 0) > 50;
197
+ return /* @__PURE__ */ jsxs("div", { className: "pivot-table", ref, children: [
198
+ /* @__PURE__ */ jsx(
199
+ "div",
200
+ {
201
+ className: clsx(
202
+ "bitable-block-dashboard-toolbar bitable-toolbar",
203
+ isShadowShow && "bitable-toolbar--shadow"
204
+ // isShadowShow &&
203
205
  ),
204
- /* @__PURE__ */ jsx(
205
- GlobalFilterCondition,
206
- {
207
- style: {
208
- marginLeft: 10
206
+ children: /* @__PURE__ */ jsxs("div", { className: "bitable-block-dashboard-toolbar--left", children: [
207
+ /* @__PURE__ */ jsx(
208
+ AddModuleBtn,
209
+ {
210
+ onOk: (val) => {
211
+ handleOpenCreateModal(val);
212
+ }
209
213
  }
210
- }
211
- )
212
- ] }) }),
213
- /* @__PURE__ */ jsx("div", { className: "bitable-block-dashboard__mount", children: /* @__PURE__ */ jsx("div", { className: "dashboard-container", children: /* @__PURE__ */ jsx(
214
- "div",
215
- {
216
- className: `dashboard-content-container ${isDragOrResize ? "isDragOrResize" : ""} ${isDragOrResizeEnd ? "isDragOrResizeEnd" : ""}`,
217
- children: /* @__PURE__ */ jsx(
218
- ResponsiveReactGridLayout,
214
+ ),
215
+ /* @__PURE__ */ jsx(
216
+ "div",
219
217
  {
220
- onBreakpointChange,
221
- className,
222
- compactType: "vertical",
223
- preventCollision: false,
224
- cols,
225
- margin: margins,
226
- rowHeight,
227
- measureBeforeMount: false,
228
- draggableHandle: ".isCanDrag",
229
- onWidthChange: (containerWidth, _margin, cols2) => {
230
- setRowWidth(containerWidth / cols2 - 1);
231
- },
232
- onDragStart: () => {
233
- onDragStartOrEnd("start");
234
- },
235
- onDragStop: (newLayout) => {
236
- onDragStartOrEnd("end", newLayout);
237
- },
238
- onResizeStart: () => {
239
- onDragStartOrEnd("start");
240
- },
241
- onResizeStop: (newLayout) => {
242
- onDragStartOrEnd("end", newLayout);
243
- },
244
218
  style: {
245
- backgroundSize: `${rowWidth}px ${rowHeight + margins[0]}px`,
246
- backgroundPosition: `${margins[0]}px ${margins[0]}px`,
247
- minHeight: "100vh"
248
- },
249
- children: modules == null ? void 0 : modules.map((module) => /* @__PURE__ */ jsxs(
250
- "div",
251
- {
252
- className: `box-dashboard ${activeId === module.id ? "active" : ""}`,
253
- onClick: () => {
254
- setActiveId(module.id);
255
- },
256
- "data-grid": {
257
- i: module.id,
258
- x: module.x || 0,
259
- y: module.y || 0,
260
- // puts it at the bottom
261
- w: module.w || 2,
262
- h: module.h || 2,
263
- minW: 2,
264
- minH: 2
265
- },
266
- children: [
267
- /* @__PURE__ */ jsx(
268
- ModuleHeader,
269
- {
270
- module,
271
- defaultValue: module.title,
272
- onChange: (val) => updateModule(module.id, {
273
- title: val
274
- }),
275
- onDropdownItem: (key) => {
276
- var _a;
277
- if (key === "edit") {
278
- setActiveId(module.id);
279
- setSelectModuleData(module);
280
- if (module.type === "statistics") {
281
- setIsShowAddStatisticsModal(true);
282
- }
283
- if ((_a = module.type) == null ? void 0 : _a.includes("chart")) {
284
- setIsShowAddChartModal(true);
285
- }
286
- if (module.type === "calendar") {
287
- setIsShowAddCalendarModal(true);
288
- }
289
- } else if (key === "delete") {
290
- Modal.confirm({
291
- title: t("promptTitle"),
292
- icon: /* @__PURE__ */ jsx(ExclamationCircleOutlined, {}),
293
- content: t("promptContentDeleteComponents"),
294
- onOk() {
295
- deleteModule(module.id);
296
- }
297
- });
298
- } else if (key === "copy") {
299
- const data = JSON.parse(JSON.stringify(module));
300
- delete data.id;
301
- delete data.i;
302
- addModule(data);
303
- }
304
- }
305
- }
306
- ),
307
- /* @__PURE__ */ jsx(
308
- ModuleContent,
309
- {
310
- module,
311
- onUpdate: updateModule,
312
- moduleDataApi,
313
- activeId,
314
- onClick: () => {
315
- setActiveId(module.id);
316
- },
317
- rowWidth,
318
- rowHeight,
319
- onEdit: () => {
320
- var _a;
219
+ width: "1px",
220
+ height: "1rem",
221
+ backgroundColor: "rgba(217, 217, 217, 1)",
222
+ marginLeft: "12px",
223
+ marginRight: "4px"
224
+ }
225
+ }
226
+ ),
227
+ /* @__PURE__ */ jsx(GlobalFilterCondition, {})
228
+ ] })
229
+ }
230
+ ),
231
+ /* @__PURE__ */ jsx("div", { className: "bitable-block-dashboard__mount", children: /* @__PURE__ */ jsx("div", { className: "dashboard-container", children: /* @__PURE__ */ jsx(
232
+ "div",
233
+ {
234
+ className: `dashboard-content-container ${isDragOrResize ? "isDragOrResize" : ""} ${isDragOrResizeEnd ? "isDragOrResizeEnd" : ""}`,
235
+ children: /* @__PURE__ */ jsx(
236
+ ResponsiveReactGridLayout,
237
+ {
238
+ onBreakpointChange,
239
+ className,
240
+ compactType: "vertical",
241
+ preventCollision: false,
242
+ cols,
243
+ margin: margins,
244
+ rowHeight,
245
+ measureBeforeMount: false,
246
+ draggableHandle: ".isCanDrag",
247
+ onWidthChange: (containerWidth, _margin, cols2) => {
248
+ setRowWidth(containerWidth / cols2 - 1);
249
+ },
250
+ onDragStart: () => {
251
+ onDragStartOrEnd("start");
252
+ },
253
+ onDragStop: (newLayout) => {
254
+ onDragStartOrEnd("end", newLayout);
255
+ },
256
+ onResizeStart: () => {
257
+ onDragStartOrEnd("start");
258
+ },
259
+ onResizeStop: (newLayout) => {
260
+ onDragStartOrEnd("end", newLayout);
261
+ },
262
+ style: {
263
+ backgroundSize: `${rowWidth}px ${rowHeight + margins[0]}px`,
264
+ backgroundPosition: `${margins[0]}px ${margins[0]}px`,
265
+ minHeight: "100vh"
266
+ },
267
+ children: modules == null ? void 0 : modules.map((module) => /* @__PURE__ */ jsxs(
268
+ "div",
269
+ {
270
+ className: `box-dashboard ${activeId === module.id ? "active" : ""}`,
271
+ onClick: () => {
272
+ setActiveId(module.id);
273
+ },
274
+ "data-grid": {
275
+ i: module.id,
276
+ x: module.x || 0,
277
+ y: module.y || 0,
278
+ // puts it at the bottom
279
+ w: module.w || 2,
280
+ h: module.h || 2,
281
+ minW: 2,
282
+ minH: 2
283
+ },
284
+ children: [
285
+ /* @__PURE__ */ jsx(
286
+ ModuleHeader,
287
+ {
288
+ module,
289
+ defaultValue: module.title,
290
+ onChange: (val) => updateModule(module.id, {
291
+ title: val
292
+ }),
293
+ onDropdownItem: (key) => {
294
+ var _a;
295
+ if (key === "edit") {
321
296
  setActiveId(module.id);
322
297
  setSelectModuleData(module);
323
298
  if (module.type === "statistics") {
@@ -329,33 +304,75 @@ const DashboardWorkbench = ({
329
304
  if (module.type === "calendar") {
330
305
  setIsShowAddCalendarModal(true);
331
306
  }
332
- },
333
- onDelete: () => {
334
- deleteModule(module.id);
335
- },
336
- onCopy: () => {
307
+ } else if (key === "delete") {
308
+ Modal.confirm({
309
+ title: t("promptTitle"),
310
+ icon: /* @__PURE__ */ jsx(ExclamationCircleOutlined, {}),
311
+ content: t("promptContentDeleteComponents"),
312
+ onOk() {
313
+ deleteModule(module.id);
314
+ }
315
+ });
316
+ } else if (key === "copy") {
337
317
  const data = JSON.parse(JSON.stringify(module));
338
318
  delete data.id;
339
319
  delete data.i;
340
320
  addModule(data);
341
- },
342
- onStartDragOrResize: () => {
343
- setIsDragOrResize(true);
344
- },
345
- onStopDragOrResize: () => {
346
- setIsDragOrResize(false);
347
321
  }
348
322
  }
349
- )
350
- ]
351
- },
352
- module.id
353
- ))
354
- }
355
- )
356
- }
357
- ) }) })
358
- ] }),
323
+ }
324
+ ),
325
+ /* @__PURE__ */ jsx(
326
+ ModuleContent,
327
+ {
328
+ module,
329
+ onUpdate: updateModule,
330
+ moduleDataApi,
331
+ activeId,
332
+ onClick: () => {
333
+ setActiveId(module.id);
334
+ },
335
+ rowWidth,
336
+ rowHeight,
337
+ onEdit: () => {
338
+ var _a;
339
+ setActiveId(module.id);
340
+ setSelectModuleData(module);
341
+ if (module.type === "statistics") {
342
+ setIsShowAddStatisticsModal(true);
343
+ }
344
+ if ((_a = module.type) == null ? void 0 : _a.includes("chart")) {
345
+ setIsShowAddChartModal(true);
346
+ }
347
+ if (module.type === "calendar") {
348
+ setIsShowAddCalendarModal(true);
349
+ }
350
+ },
351
+ onDelete: () => {
352
+ deleteModule(module.id);
353
+ },
354
+ onCopy: () => {
355
+ const data = JSON.parse(JSON.stringify(module));
356
+ delete data.id;
357
+ delete data.i;
358
+ addModule(data);
359
+ },
360
+ onStartDragOrResize: () => {
361
+ setIsDragOrResize(true);
362
+ },
363
+ onStopDragOrResize: () => {
364
+ setIsDragOrResize(false);
365
+ }
366
+ }
367
+ )
368
+ ]
369
+ },
370
+ module.id
371
+ ))
372
+ }
373
+ )
374
+ }
375
+ ) }) }),
359
376
  /* @__PURE__ */ jsx(
360
377
  AddStatisticsModal,
361
378
  {