function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useState, useRef } from 'react';
import { Card, Typography, Alert, Button, Space } from 'antd';
import BatchSelector from "./SelectorGroup";
import { CheckOutlined, InfoCircleOutlined } from '@ant-design/icons';
var Title = Typography.Title;

// 简化数据源：演示嵌套条件与 show 组能力
var dataSource = [{
  id: 1,
  title: '主菜',
  mode: 'single',
  valueType: 'primitive',
  fieldNames: {
    value: 'value',
    label: 'title'
  },
  dataSource: [{
    id: 1,
    title: '汉堡',
    value: 'burger'
  }, {
    id: 2,
    title: '披萨',
    value: 'pizza'
  }],
  ruleConfig: {
    required: 1,
    autoValidate: true
  },
  titleProps: {
    renderExtra: function renderExtra() {
      return /*#__PURE__*/React.createElement("div", {
        style: {
          flex: 1,
          textAlign: 'right'
        }
      }, "\u989D\u5916\u5185\u5BB9");
    }
  }
}, {
  id: 4,
  title: '汉堡定制',
  mode: 'multiple',
  valueType: 'object',
  fieldNames: {
    value: 'value',
    label: 'title'
  },
  dataSource: [{
    id: 1,
    title: '加倍牛肉',
    value: 'double-meat',
    ruleConfig: {
      min: 3
    }
  }, {
    id: 2,
    title: '额外芝士',
    value: 'extra-cheese'
  }],
  itemProps: {
    selectedTypeVariant: 'default',
    indicatorPosition: 'right'
  },
  variant: 'card',
  preset: {
    variant: '3'
  },
  ruleConfig: {
    min: 5,
    max: 9,
    required: 1,
    autoValidate: true
  }
}, {
  id: 5,
  title: '披萨定制',
  mode: 'multiple',
  valueType: 'object',
  fieldNames: {
    value: 'value',
    label: 'title'
  },
  dataSource: [{
    id: 1,
    title: '额外芝士',
    value: 'extra-cheese',
    cover: 'https://file.mypisell-dev.com/pisel/image/9/52fe9ca4233877f2c06865d27b9fb7912022_12_01_13_32_47_147_00076174656__1080_1073__.jpeg',
    ruleConfig: {
      min: 1,
      max: 3
    }
  }, {
    id: 2,
    title: '薄底',
    value: 'thin-crust',
    cover: 'https://file.mypisell-dev.com/pisel/image/9/52fe9ca4233877f2c06865d27b9fb7912022_12_01_13_32_47_147_00076174656__1080_1073__.jpeg'
  }, {
    id: 3,
    title: '额外洋葱',
    value: 'extra-onion',
    cover: 'https://file.mypisell-dev.com/pisel/image/9/52fe9ca4233877f2c06865d27b9fb7912022_12_01_13_32_47_147_00076174656__1080_1073__.jpeg'
  }],
  variant: 'card',
  itemProps: {
    layout: 'vertical',
    renderContent: function renderContent(dataSource) {
      return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
        src: dataSource.cover,
        alt: dataSource.title,
        style: {
          width: '100%',
          height: '120px',
          objectFit: 'cover'
        }
      }), /*#__PURE__*/React.createElement("div", null, dataSource.title));
    }
  },
  ruleConfig: {
    min: 1,
    max: 2,
    required: 1,
    autoValidate: true
  }
}, {
  id: 31,
  title: '汉堡定制1',
  mode: 'single',
  valueType: 'object',
  fieldNames: {
    value: 'value',
    label: 'title'
  },
  dataSource: [{
    id: 1,
    title: '加倍牛肉',
    value: 'double-meat',
    ruleConfig: {
      min: 1,
      max: 3
    }
  }, {
    id: 2,
    title: '额外芝士',
    value: 'extra-cheese'
  }],
  variant: 'card',
  indicatorProps: {
    render: function render() {
      return /*#__PURE__*/React.createElement(CheckOutlined, null);
    }
  }
}, {
  id: 32,
  title: '汉堡定制2',
  mode: 'single',
  valueType: 'object',
  fieldNames: {
    value: 'value',
    label: 'title'
  },
  dataSource: [{
    id: 1,
    title: '加倍牛肉',
    value: 'double-meat',
    ruleConfig: {
      min: 1,
      max: 3
    }
  }, {
    id: 2,
    title: '额外芝士',
    value: 'extra-cheese'
  }],
  variant: 'card'
}, {
  id: 33,
  title: '汉堡定制3',
  mode: 'single',
  valueType: 'object',
  fieldNames: {
    value: 'value',
    label: 'title'
  },
  dataSource: [{
    id: 1,
    title: '加倍牛肉',
    value: 'double-meat',
    ruleConfig: {
      min: 1,
      max: 3
    }
  }, {
    id: 2,
    title: '额外芝士',
    value: 'extra-cheese'
  }],
  variant: 'card'
}, {
  id: 34,
  title: '汉堡定制4',
  mode: 'single',
  valueType: 'object',
  fieldNames: {
    value: 'value',
    label: 'title'
  },
  dataSource: [{
    id: 1,
    title: '加倍牛肉',
    value: 'double-meat',
    ruleConfig: {
      min: 1,
      max: 3
    }
  }, {
    id: 2,
    title: '额外芝士',
    value: 'extra-cheese'
  }],
  variant: 'card'
}];

// 分支控制演示：
var linkageRules = [{
  type: 'expr',
  when: {
    and: [{
      groupId: '1',
      op: 'eq',
      value: 'burger'
    }]
  },
  then: [{
    type: 'show',
    groupId: '4'
  }],
  stopAfterApply: true
}, {
  type: 'expr',
  when: {
    and: [{
      groupId: '1',
      op: 'eq',
      value: 'pizza'
    }]
  },
  then: [{
    type: 'show',
    groupId: '5'
  }],
  priority: 10
}];
export var BatchSelectorDemo = function BatchSelectorDemo() {
  var _useState = useState({}),
    _useState2 = _slicedToArray(_useState, 2),
    values1 = _useState2[0],
    setValues1 = _useState2[1];
  var _useState3 = useState({}),
    _useState4 = _slicedToArray(_useState3, 2),
    values2 = _useState4[0],
    setValues2 = _useState4[1];
  var _useState5 = useState({}),
    _useState6 = _slicedToArray(_useState5, 2),
    values3 = _useState6[0],
    setValues3 = _useState6[1];
  var _useState7 = useState({}),
    _useState8 = _slicedToArray(_useState7, 2),
    values4 = _useState8[0],
    setValues4 = _useState8[1];
  var ref = useRef(null);
  var ref2 = useRef(null);
  var containerRef = useRef(null);
  return /*#__PURE__*/React.createElement("div", {
    style: {
      padding: '0',
      margin: '0 auto',
      height: '100vh',
      overflow: 'auto',
      '--theme-color': '#5d3f9f'
    },
    ref: containerRef
  }, /*#__PURE__*/React.createElement(Title, {
    level: 2
  }, "\u5D4C\u5957\u6761\u4EF6 + \u5206\u652F\u63A7\u5236\uFF08elseThen/stopAfterApply\uFF09\u6F14\u793A"), /*#__PURE__*/React.createElement(Alert, {
    message: "\u8BF4\u660E",
    description: "\u5F53\u9009\u62E9\u6C49\u5821\u4E14\u4E0D\u4E3A\u591A\u7CD6\u65F6\u663E\u793A\u201C\u6C49\u5821\u5B9A\u5236\u201D\uFF08\u77ED\u8DEF\uFF09\uFF1B\u672A\u547D\u4E2D\u65F6\u663E\u793A\u201C\u9ED8\u8BA4\u5B9A\u5236\u201D\uFF08\u4E0D\u77ED\u8DEF\uFF0C\u53EF\u7EE7\u7EED\u8BC4\u4F30\u540E\u7EED\u89C4\u5219\uFF09\uFF1B\u5F53\u9009\u62E9\u62AB\u8428\u4E14\u6EE1\u8DB3\uFF08\u6E29\u5EA6\u4E3A\u70ED/\u70EB \u6216 \u7CD6\u5EA6\u4E3A\u5C11\u7CD6\uFF09\u65F6\u663E\u793A\u201C\u62AB\u8428\u5B9A\u5236\u201D\u3002\u672A\u547D\u4E2D\u65F6\uFF0C\u5B9A\u5236\u5206\u7EC4\u9ED8\u8BA4\u9690\u85CF\u3002",
    type: "info",
    showIcon: true,
    style: {
      marginBottom: 16
    }
  }), /*#__PURE__*/React.createElement(Card, {
    title: "BatchSelector"
  }, /*#__PURE__*/React.createElement(BatchSelector, {
    dataSource: dataSource,
    linkageRules: linkageRules,
    allowedValuesPolicy: "strict",
    value: values1,
    onChange: function onChange(v) {
      return setValues1(_objectSpread({}, v || {}));
    },
    customScrollParent: containerRef.current
  }), /*#__PURE__*/React.createElement("div", {
    style: {
      marginTop: 12
    }
  }, /*#__PURE__*/React.createElement(Alert, {
    message: "\u5B9E\u65F6\u503C",
    description: /*#__PURE__*/React.createElement("pre", {
      style: {
        margin: 0,
        whiteSpace: 'pre-wrap'
      }
    }, JSON.stringify(values1, null, 2)),
    type: "success",
    showIcon: true
  }))), /*#__PURE__*/React.createElement(Title, {
    level: 2,
    style: {
      marginTop: 32
    }
  }, "\u8054\u52A8\u6F14\u793A\uFF1A\u9009\u9879\u5F71\u54CD\u53E6\u4E00\u4E2A\u5206\u7EC4\u7684\u53EF\u9009\u9879"), /*#__PURE__*/React.createElement(Alert, {
    message: "\u8BF4\u660E",
    description: "\u5F53\u9009\u62E9\u996E\u54C1\u4E3A Coffee \u65F6\uFF0C\u52A0\u6599\u4EC5\u5141\u8BB8 Milk/Sugar\uFF1B\u9009\u62E9 Tea \u65F6\uFF0C\u52A0\u6599\u4EC5\u5141\u8BB8 Lemon/Honey\u3002\u672A\u5141\u8BB8\u7684\u9009\u9879\u4F1A\u5728 UI \u4E2D\u7981\u7528\uFF08soft \u6A21\u5F0F\u6F14\u793A\uFF09\u3002",
    type: "info",
    showIcon: true,
    style: {
      marginBottom: 16
    }
  }), function () {
    var dataSource2 = [{
      id: 11,
      title: '饮品',
      mode: 'single',
      valueType: 'primitive',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: 'Coffee',
        value: 'coffee'
      }, {
        id: 2,
        title: 'Tea',
        value: 'tea'
      }],
      titleProps: {
        visible: true,
        title: {
          visible: true,
          text: '选择饮品'
        },
        icon: {
          visible: true,
          icon: /*#__PURE__*/React.createElement(InfoCircleOutlined, null)
        }
      }
    }, {
      id: 12,
      title: '加料',
      mode: 'single',
      valueType: 'primitive',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: 'Milk',
        value: 'milk'
      }, {
        id: 2,
        title: 'Sugar',
        value: 'sugar'
      }, {
        id: 3,
        title: 'Lemon',
        value: 'lemon'
      }, {
        id: 4,
        title: 'Honey',
        value: 'honey'
      }],
      variant: 'card',
      titleProps: {
        visible: true,
        tip: {
          visible: true,
          text: '根据饮品选择加料'
        }
      }
    }];
    var linkageRules2 = [
    // 当选择 Coffee 时，仅允许 milk/sugar；未选择或选择 Tea 时不受这条规则影响
    {
      type: 'expr',
      when: {
        and: [{
          groupId: '11',
          op: 'eq',
          value: 'coffee'
        }]
      },
      then: [{
        type: 'allowOnly',
        groupId: '12',
        values: ['milk', 'sugar'],
        message: '请选择 Milk 或 Sugar',
        tip: '加料仅允许 Milk/Sugar'
      }],
      priority: 30
    },
    // 当选择 Tea 时，仅允许 lemon/honey；未选择或选择 Coffee 时不受这条规则影响
    {
      type: 'expr',
      when: {
        and: [{
          groupId: '11',
          op: 'eq',
          value: 'tea'
        }]
      },
      then: [{
        type: 'allowOnly',
        groupId: '12',
        values: ['lemon', 'honey'],
        message: '请选择 Lemon 或 Honey',
        tip: '加料仅允许 Lemon/Honey'
      }],
      priority: 30
    }];
    return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Title, {
      level: 2,
      style: {
        marginTop: 32
      }
    }, "\u8054\u52A8\u6F14\u793A\uFF1A\u9009\u9879\u5F71\u54CD\u53E6\u4E00\u4E2A\u5206\u7EC4\u7684\u53EF\u9009\u9879"), /*#__PURE__*/React.createElement(Alert, {
      message: "\u8BF4\u660E",
      description: "\u5F53\u9009\u62E9\u996E\u54C1\u4E3A Coffee \u65F6\uFF0C\u52A0\u6599\u4EC5\u5141\u8BB8 Milk/Sugar\uFF1B\u9009\u62E9 Tea \u65F6\uFF0C\u52A0\u6599\u4EC5\u5141\u8BB8 Lemon/Honey\u3002\u672A\u5141\u8BB8\u7684\u9009\u9879\u4F1A\u5728 UI \u4E2D\u7981\u7528\uFF08relaxed \u6A21\u5F0F\u6F14\u793A\uFF09\u3002",
      type: "info",
      showIcon: true,
      style: {
        marginBottom: 16
      }
    }), /*#__PURE__*/React.createElement(Card, {
      title: "BatchSelector\uFF08\u9009\u9879\u8054\u52A8\u793A\u4F8B\uFF09"
    }, /*#__PURE__*/React.createElement(BatchSelector, {
      ref: ref,
      dataSource: dataSource2,
      linkageRules: linkageRules2,
      allowedValuesPolicy: "relaxed",
      value: values2,
      onChange: function onChange(v) {
        return setValues2(_objectSpread({}, v || {}));
      },
      customScrollParent: containerRef.current
    }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
      onClick: function onClick() {
        var _ref$current;
        return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.validate();
      }
    }, "validate")), /*#__PURE__*/React.createElement("div", {
      style: {
        marginTop: 12
      }
    }, /*#__PURE__*/React.createElement(Alert, {
      message: "\u5B9E\u65F6\u503C",
      description: /*#__PURE__*/React.createElement("pre", {
        style: {
          margin: 0,
          whiteSpace: 'pre-wrap'
        }
      }, JSON.stringify(values2, null, 2)),
      type: "success",
      showIcon: true
    }))));
  }(), function () {
    // preserve 和 tabProps 演示
    var dataSource3 = [{
      id: 21,
      title: '基础套餐',
      mode: 'single',
      valueType: 'primitive',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: '标准套餐',
        value: 'standard'
      }, {
        id: 2,
        title: '豪华套餐',
        value: 'deluxe'
      }],
      ruleConfig: {
        required: 1,
        autoValidate: true
      },
      preserve: true
    }, {
      id: 22,
      title: '附加服务',
      mode: 'multiple',
      valueType: 'object',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: '快递配送',
        value: 'delivery',
        ruleConfig: {
          min: 1,
          max: 5
        }
      }, {
        id: 2,
        title: '礼品包装',
        value: 'gift-wrap',
        ruleConfig: {
          min: 1,
          max: 3
        }
      }, {
        id: 3,
        title: '延长保修',
        value: 'warranty'
      }],
      variant: 'card',
      itemProps: {
        layout: 'vertical'
      },
      preserve: false
    }, {
      id: 23,
      title: '支付方式',
      mode: 'single',
      valueType: 'primitive',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: '支付宝',
        value: 'alipay'
      }, {
        id: 2,
        title: '微信支付',
        value: 'wechat'
      }, {
        id: 3,
        title: '银行卡',
        value: 'card'
      }],
      ruleConfig: {
        required: 1
      }
    }];
    return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Title, {
      level: 2,
      style: {
        marginTop: 32
      }
    }, "Preserve \u548C TabProps \u6F14\u793A"), /*#__PURE__*/React.createElement(Alert, {
      message: "\u8BF4\u660E",
      description: "preserve \u5C5E\u6027\u63A7\u5236\u5206\u7EC4\u9690\u85CF\u65F6\u662F\u5426\u4FDD\u7559\u503C\u3002\u57FA\u7840\u5957\u9910\u548C\u652F\u4ED8\u65B9\u5F0F\u8BBE\u7F6E preserve=true\uFF0C\u9644\u52A0\u670D\u52A1\u8BBE\u7F6E preserve=false\u3002tabProps \u63A7\u5236\u6807\u7B7E\u9875\u663E\u793A\u3002",
      type: "info",
      showIcon: true,
      style: {
        marginBottom: 16
      }
    }), /*#__PURE__*/React.createElement(Card, {
      title: "BatchSelector\uFF08Preserve \u793A\u4F8B\uFF09"
    }, /*#__PURE__*/React.createElement(BatchSelector, {
      dataSource: dataSource3,
      value: values3,
      onChange: function onChange(v) {
        return setValues3(_objectSpread({}, v || {}));
      },
      preserve: true,
      tabProps: {
        visible: true
      },
      customScrollParent: containerRef.current
    }), /*#__PURE__*/React.createElement("div", {
      style: {
        marginTop: 12
      }
    }, /*#__PURE__*/React.createElement(Alert, {
      message: "\u5B9E\u65F6\u503C",
      description: /*#__PURE__*/React.createElement("pre", {
        style: {
          margin: 0,
          whiteSpace: 'pre-wrap'
        }
      }, JSON.stringify(values3, null, 2)),
      type: "success",
      showIcon: true
    }))));
  }(), function () {
    // 复杂规则组合演示
    var dataSource4 = [{
      id: 31,
      title: '房间类型',
      mode: 'single',
      valueType: 'primitive',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: '单人间',
        value: 'single'
      }, {
        id: 2,
        title: '双人间',
        value: 'double'
      }, {
        id: 3,
        title: '豪华套房',
        value: 'suite'
      }],
      variant: 'card',
      itemProps: {
        layout: 'horizontal',
        selectedTypeVariant: 'bordered'
      },
      ruleConfig: {
        required: 1,
        autoValidate: true
      }
    }, {
      id: 32,
      title: '床型偏好（单人间）',
      mode: 'single',
      valueType: 'primitive',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: '标准单人床',
        value: 'single-bed'
      }, {
        id: 2,
        title: '加大单人床',
        value: 'king-single'
      }]
    }, {
      id: 33,
      title: '床型偏好（双人间）',
      mode: 'single',
      valueType: 'primitive',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: '双床',
        value: 'twin'
      }, {
        id: 2,
        title: '大床',
        value: 'queen'
      }, {
        id: 3,
        title: '特大床',
        value: 'king'
      }]
    }, {
      id: 34,
      title: '额外需求',
      mode: 'multiple',
      valueType: 'object',
      fieldNames: {
        value: 'value',
        label: 'title'
      },
      dataSource: [{
        id: 1,
        title: '早餐',
        value: 'breakfast',
        ruleConfig: {
          min: 0,
          max: 10
        }
      }, {
        id: 2,
        title: '接机服务',
        value: 'pickup'
      }, {
        id: 3,
        title: '免费升级',
        value: 'upgrade'
      }],
      variant: 'card',
      itemProps: {
        layout: 'vertical'
      },
      ruleConfig: {
        max: 8,
        min: 2,
        autoValidate: true
      }
    }];
    var linkageRules4 = [
    // 单人间显示单人床型
    {
      type: 'expr',
      when: {
        and: [{
          groupId: '31',
          op: 'eq',
          value: 'single'
        }]
      },
      then: [{
        type: 'show',
        groupId: '32'
      }, {
        type: 'hide',
        groupId: '33'
      }],
      stopAfterApply: false
    },
    // 双人间显示双人床型
    {
      type: 'expr',
      when: {
        and: [{
          groupId: '31',
          op: 'eq',
          value: 'double'
        }]
      },
      then: [{
        type: 'show',
        groupId: '33'
      }, {
        type: 'hide',
        groupId: '32'
      }],
      stopAfterApply: false
    },
    // 豪华套房隐藏床型选择
    {
      type: 'expr',
      when: {
        and: [{
          groupId: '31',
          op: 'eq',
          value: 'suite'
        }]
      },
      then: [{
        type: 'hide',
        groupId: '32'
      }, {
        type: 'hide',
        groupId: '33'
      }],
      stopAfterApply: false
    },
    // 豪华套房时，额外需求中允许免费升级
    {
      type: 'expr',
      when: {
        and: [{
          groupId: '31',
          op: 'eq',
          value: 'suite'
        }]
      },
      then: [{
        type: 'allowOnly',
        groupId: '34',
        values: ['breakfast', 'pickup', 'upgrade']
      }]
    },
    // 非豪华套房时，不允许免费升级
    {
      type: 'expr',
      when: {
        and: [{
          groupId: '31',
          op: 'in',
          value: ['single', 'double']
        }]
      },
      then: [{
        type: 'allowOnly',
        groupId: '34',
        values: ['breakfast', 'pickup'],
        message: '该房型不支持免费升级'
      }]
    }];
    return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Title, {
      level: 2,
      style: {
        marginTop: 32
      }
    }, "\u590D\u6742\u8054\u52A8\u89C4\u5219\u6F14\u793A"), /*#__PURE__*/React.createElement(Alert, {
      message: "\u8BF4\u660E",
      description: "\u6839\u636E\u623F\u95F4\u7C7B\u578B\u663E\u793A\u4E0D\u540C\u7684\u5E8A\u578B\u9009\u9879\uFF0C\u8C6A\u534E\u5957\u623F\u53EF\u4EE5\u514D\u8D39\u5347\u7EA7\uFF0C\u5176\u4ED6\u623F\u578B\u4E0D\u5141\u8BB8\u3002\u6F14\u793A\u591A\u6761\u89C4\u5219\u7684\u7EC4\u5408\u4F7F\u7528\u3002",
      type: "info",
      showIcon: true,
      style: {
        marginBottom: 16
      }
    }), /*#__PURE__*/React.createElement(Card, {
      title: "BatchSelector\uFF08\u590D\u6742\u89C4\u5219\u7EC4\u5408\uFF09"
    }, /*#__PURE__*/React.createElement(BatchSelector, {
      ref: ref2,
      dataSource: dataSource4,
      linkageRules: linkageRules4,
      allowedValuesPolicy: "strict",
      value: values4,
      onChange: function onChange(v) {
        return setValues4(_objectSpread({}, v || {}));
      },
      customScrollParent: containerRef.current
    }), /*#__PURE__*/React.createElement(Space, {
      style: {
        marginTop: 12
      }
    }, /*#__PURE__*/React.createElement(Button, {
      onClick: function onClick() {
        var _ref2$current;
        return (_ref2$current = ref2.current) === null || _ref2$current === void 0 ? void 0 : _ref2$current.validate();
      }
    }, "\u624B\u52A8\u6821\u9A8C"), /*#__PURE__*/React.createElement(Button, {
      onClick: function onClick() {
        return setValues4({});
      }
    }, "\u91CD\u7F6E")), /*#__PURE__*/React.createElement("div", {
      style: {
        marginTop: 12
      }
    }, /*#__PURE__*/React.createElement(Alert, {
      message: "\u5B9E\u65F6\u503C",
      description: /*#__PURE__*/React.createElement("pre", {
        style: {
          margin: 0,
          whiteSpace: 'pre-wrap'
        }
      }, JSON.stringify(values4, null, 2)),
      type: "success",
      showIcon: true
    }))));
  }());
};
export default BatchSelectorDemo;