@gingkoo/pandora-metabase 1.0.0-alpha.6 → 1.0.0-alpha.7

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.
@@ -10,6 +10,7 @@ interface PropsType {
10
10
  onChange: (reocrd: MetaFilter_Item) => void;
11
11
  didUpdate?: Function;
12
12
  isCustom?: boolean;
13
+ container?: any;
13
14
  }
14
15
  declare const _default: (props: PropsType) => import("react/jsx-runtime").JSX.Element;
15
16
  export default _default;
package/lib/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @gingkoo/pandora-metabase v1.0.0-alpha.6
2
+ * @gingkoo/pandora-metabase v1.0.0-alpha.7
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import * as React from 'react';
@@ -3962,7 +3962,8 @@ const SelectFilterColumn = ({
3962
3962
  value,
3963
3963
  onChange,
3964
3964
  didUpdate,
3965
- isCustom: _isCustom = false
3965
+ isCustom: _isCustom = false,
3966
+ container: _container = null
3966
3967
  }) => {
3967
3968
  const [curColumn, setCurColumn] = useState(value);
3968
3969
  const [condition, setCondition] = useState(value.condition);
@@ -4379,6 +4380,7 @@ const SelectFilterColumn = ({
4379
4380
  store.setPopup2({
4380
4381
  visible: true,
4381
4382
  node: e.currentTarget,
4383
+ container: _container,
4382
4384
  content: jsx(SelectList, {
4383
4385
  value: valType,
4384
4386
  list: store.constantList || [],
@@ -4401,6 +4403,7 @@ const SelectFilterColumn = ({
4401
4403
  store.setPopup2({
4402
4404
  visible: true,
4403
4405
  node: e.currentTarget,
4406
+ container: _container,
4404
4407
  content: jsx(SelectList, {
4405
4408
  value: valType,
4406
4409
  list: [{
@@ -4435,6 +4438,7 @@ const SelectFilterColumn = ({
4435
4438
  store.setPopup2({
4436
4439
  visible: true,
4437
4440
  node: e.currentTarget,
4441
+ container: _container,
4438
4442
  content: jsx(SelectJoinColumn, {
4439
4443
  data: [..._data],
4440
4444
  value: value,
@@ -6540,12 +6544,12 @@ const CaseEditor = props => {
6540
6544
  onOk,
6541
6545
  onCancel
6542
6546
  } = props;
6543
- const [popup, setPopup] = useState({
6544
- visible: false
6545
- }); // 弹框信息
6547
+ // const [popup, setPopup] = useState<PopupType>({ visible: false }); // 弹框信息
6546
6548
  const [caseList, setCaseList] = useState(value.formulaList || []);
6547
6549
  const [name, setName] = useState(value?.name || ''); // 表达式名字
6548
6550
  const [ind, setInd] = useState(-1);
6551
+ const ref = useRef(null);
6552
+ const store = useStore$1();
6549
6553
  const filterCase = useMemo(() => {
6550
6554
  const hasCase = caseList.some(item => item.type === OptionsTypeEnum.OTHER && item.operator === 'case');
6551
6555
  if (hasCase) {
@@ -6557,24 +6561,22 @@ const CaseEditor = props => {
6557
6561
  const usable = useMemo(() => {
6558
6562
  return Array.from(caseList).length > 0 && name;
6559
6563
  }, [caseList, name]);
6560
- const popupContent = useMemo(() => {
6561
- let {
6562
- visible,
6563
- content
6564
- } = popup;
6565
- if (!visible) return null;
6566
- return content;
6567
- }, [popup]);
6564
+ // const popupContent = useMemo(() => {
6565
+ // let { visible, content } = popup;
6566
+ // if (!visible) return null;
6567
+ // return content;
6568
+ // }, [popup]);
6568
6569
  function closePopup() {
6569
- setPopup({
6570
+ store.setPopup({
6570
6571
  visible: false
6571
6572
  });
6572
6573
  }
6573
6574
  // 字段
6574
6575
  function handleField(e, i, val) {
6575
- setPopup({
6576
+ store.setPopup({
6576
6577
  visible: true,
6577
6578
  node: e.currentTarget,
6579
+ container: ref.current,
6578
6580
  content: jsx(SelectJoinColumn, {
6579
6581
  data: data,
6580
6582
  value: val,
@@ -6604,11 +6606,13 @@ const CaseEditor = props => {
6604
6606
  };
6605
6607
  // 表达式
6606
6608
  function handleExpression(e, i, val) {
6607
- setPopup({
6609
+ store.setPopup({
6608
6610
  visible: true,
6609
6611
  node: e.currentTarget,
6612
+ container: ref.current,
6610
6613
  content: jsx(SelectFilter, {
6611
6614
  isCustom: true,
6615
+ container: ref.current,
6612
6616
  data: data,
6613
6617
  value: val,
6614
6618
  onChange: data => {
@@ -6810,6 +6814,7 @@ const CaseEditor = props => {
6810
6814
  };
6811
6815
  return jsxs("div", {
6812
6816
  className: 'custom-box',
6817
+ ref: ref,
6813
6818
  children: [jsx(VisualBox$1, {
6814
6819
  children: jsx("div", {
6815
6820
  className: `Sqb-item Sqb-case-editor mb-2 mt-2`,
@@ -6947,13 +6952,6 @@ const CaseEditor = props => {
6947
6952
  })]
6948
6953
  })
6949
6954
  })
6950
- }), jsx(Popup, {
6951
- visible: popup.visible,
6952
- closable: true,
6953
- node: popup.node,
6954
- innerSpacing: popup.innerSpacing,
6955
- hideVisible: closePopup,
6956
- children: popupContent
6957
6955
  }), jsx("div", {
6958
6956
  className: `btns p-4`,
6959
6957
  children: jsxs("div", {
@@ -7085,7 +7083,7 @@ const CustomColumn = props => {
7085
7083
  }
7086
7084
  return data;
7087
7085
  }
7088
- // 子查询弹窗
7086
+ // 自定义弹窗
7089
7087
  const showSubQuery = (e, i) => {
7090
7088
  let newMeta = store.metaList[groupIndex].list.slice();
7091
7089
  const _value = newMeta[index].customColumn[i] || [];
@@ -8746,7 +8744,7 @@ const Metabase = props => {
8746
8744
  onClick: onSave,
8747
8745
  children: btnText || __('SqlQueryBuilder.visualize')
8748
8746
  }) : null, store.popupContainer.current && jsx(Popup, {
8749
- container: store.popupContainer.current,
8747
+ container: store.popupData.container || store.popupContainer.current,
8750
8748
  visible: store.popupData.visible,
8751
8749
  node: store.popupData.node,
8752
8750
  closable: store.popupClosable,
@@ -8758,7 +8756,7 @@ const Metabase = props => {
8758
8756
  },
8759
8757
  children: popupContent
8760
8758
  }), store.popupContainer.current && jsx(Popup, {
8761
- container: store.popupContainer.current,
8759
+ container: store.popupData2.container || store.popupContainer.current,
8762
8760
  visible: store.popupData2.visible,
8763
8761
  node: store.popupData2.node,
8764
8762
  closable: store.popupClosable2,