uiw 4.13.12 → 4.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/uiw.js CHANGED
@@ -190,7 +190,6 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
190
190
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
191
191
 
192
192
  "use strict";
193
- var __webpack_unused_export__;
194
193
  /** @license React v17.0.2
195
194
  * react-jsx-runtime.production.min.js
196
195
  *
@@ -199,7 +198,7 @@ var __webpack_unused_export__;
199
198
  * This source code is licensed under the MIT license found in the
200
199
  * LICENSE file in the root directory of this source tree.
201
200
  */
202
- __webpack_require__(382);var f=__webpack_require__(787),g=60103;__webpack_unused_export__=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");__webpack_unused_export__=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
201
+ __webpack_require__(382);var f=__webpack_require__(787),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
203
202
  function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
204
203
 
205
204
 
@@ -388,6 +387,7 @@ __webpack_require__.d(__webpack_exports__, {
388
387
  "TimePicker": () => (/* reexport */ TimePicker),
389
388
  "TimePickerTime": () => (/* reexport */ TimePickerTime),
390
389
  "Tooltip": () => (/* reexport */ react_tooltip_esm),
390
+ "Transfer": () => (/* reexport */ react_transfer_esm),
391
391
  "Tree": () => (/* reexport */ Tree),
392
392
  "TreeChecked": () => (/* reexport */ TreeChecked),
393
393
  "canUseDOM": () => (/* reexport */ canUseDOM),
@@ -8894,9 +8894,9 @@ function TheadComponent(props) {
8894
8894
  thProps.className = (thProps.className || '') + " " + prefixCls + "-ellipsis";
8895
8895
  }
8896
8896
 
8897
- return /*#__PURE__*/(0,jsx_runtime.jsx)("th", _extends({
8898
- onClick: evn => onCellHead(item, colNum, rowNum, evn)
8899
- }, thProps, {
8897
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("th", _extends({}, thProps, {
8898
+ className: prefixCls + "-tr-children-" + ((item == null ? void 0 : item.align) || 'left') + " " + (className || ''),
8899
+ onClick: evn => onCellHead(item, colNum, rowNum, evn),
8900
8900
  children: titleNode
8901
8901
  }), colNum);
8902
8902
  })
@@ -9059,23 +9059,173 @@ function getAllColumnsKeys(data, keys) {
9059
9059
  if (data[i].children) {
9060
9060
  keys = keys.concat(getAllColumnsKeys(data[i].children || []));
9061
9061
  } else if (data[i].key) {
9062
- keys.push(data[i].key);
9062
+ keys.push(data[i]);
9063
9063
  }
9064
9064
  }
9065
9065
 
9066
9066
  return keys;
9067
9067
  }
9068
9068
 
9069
+ ;// CONCATENATED MODULE: ../react-table/esm/Expandable.js
9070
+
9071
+
9072
+
9073
+ /**
9074
+ * 可展开配置
9075
+ */
9076
+ function ExpandableComponent(_ref) {
9077
+ var {
9078
+ defaultExpand,
9079
+ onClick: _onClick,
9080
+ expandIcon
9081
+ } = _ref;
9082
+ var [expand, setExpand] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(defaultExpand);
9083
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
9084
+ style: {
9085
+ display: 'flex',
9086
+ justifyContent: 'center',
9087
+ alignItems: 'center'
9088
+ },
9089
+ onClick: () => {
9090
+ setExpand(!expand);
9091
+
9092
+ _onClick(expand); // record: T, index: number, expanded: boolean
9093
+
9094
+ },
9095
+ children: expandIcon(expand)
9096
+ });
9097
+ }
9098
+
9099
+ ;// CONCATENATED MODULE: ../react-table/esm/TableTr.js
9100
+
9101
+
9102
+
9103
+
9104
+
9105
+
9106
+
9107
+
9108
+
9109
+ function TableTr(props) {
9110
+ var {
9111
+ rowKey,
9112
+ data,
9113
+ keys,
9114
+ render,
9115
+ ellipsis,
9116
+ prefixCls,
9117
+ onCell = noop,
9118
+ isExpandedDom,
9119
+ hierarchy,
9120
+ indentSize,
9121
+ childrenColumnName
9122
+ } = props;
9123
+ var [isOpacity, setIsOpacity] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
9124
+ var [expandIndex, setExpandIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
9125
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9126
+ setIsOpacity(!!(data != null && data.find(it => it[childrenColumnName])));
9127
+ }, [data]);
9128
+ var IconDom = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
9129
+ return (key, isOpacity) => {
9130
+ var flag = expandIndex.includes(key);
9131
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
9132
+ type: flag ? 'minus-square-o' : 'plus-square-o',
9133
+ style: {
9134
+ marginRight: 10,
9135
+ opacity: isOpacity ? 1 : 0,
9136
+ marginLeft: hierarchy * indentSize,
9137
+ float: 'left',
9138
+ marginTop: 3.24
9139
+ },
9140
+ onClick: () => {
9141
+ setExpandIndex(flag ? expandIndex.filter(it => it !== key) : [...expandIndex, key]);
9142
+ }
9143
+ });
9144
+ };
9145
+ }, [expandIndex]);
9146
+
9147
+ if (!Array.isArray(data) || !data.length) {
9148
+ return null;
9149
+ }
9150
+
9151
+ return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
9152
+ children: data.map((trData, rowNum) => {
9153
+ var key = rowKey ? trData[rowKey] : rowNum;
9154
+ return /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
9155
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)("tr", {
9156
+ children: keys.map((keyName, colNum) => {
9157
+ var objs = {
9158
+ children: trData[keyName.key]
9159
+ };
9160
+
9161
+ if (render[keyName.key]) {
9162
+ var child = render[keyName.key](trData[keyName.key], keyName.key, trData, rowNum, colNum);
9163
+
9164
+ if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(child)) {
9165
+ objs.children = child;
9166
+ } else {
9167
+ if (child.props) {
9168
+ objs = _extends({}, child.props, {
9169
+ children: objs.children
9170
+ });
9171
+ if (child.props.rowSpan === 0 || child.props.colSpan === 0) return null;
9172
+ }
9173
+
9174
+ if (child.children) {
9175
+ objs.children = child.children;
9176
+ }
9177
+ }
9178
+ }
9179
+
9180
+ if (ellipsis && ellipsis[keyName.key]) {
9181
+ objs.className = prefixCls + "-ellipsis";
9182
+ }
9183
+
9184
+ var isHasChildren = Array.isArray(trData[childrenColumnName]);
9185
+
9186
+ if (colNum === 0 && (isOpacity || hierarchy || isHasChildren)) {
9187
+ objs.children = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
9188
+ children: [IconDom(key, isHasChildren), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
9189
+ style: {
9190
+ paddingLeft: hierarchy * indentSize
9191
+ }
9192
+ }), objs.children]
9193
+ });
9194
+ }
9195
+
9196
+ return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement)("td", _extends({}, objs, {
9197
+ key: colNum // style={keyName?.style}
9198
+ ,
9199
+ className: objs.className + " " + prefixCls + "-tr-children-" + ((keyName == null ? void 0 : keyName.align) || 'left') + " " + (keyName.className || ''),
9200
+ onClick: evn => onCell(trData, {
9201
+ rowNum,
9202
+ colNum,
9203
+ keyName: keyName.key
9204
+ }, evn)
9205
+ }));
9206
+ })
9207
+ }, key), expandIndex.includes(key) && /*#__PURE__*/(0,jsx_runtime.jsx)(TableTr, _extends({}, props, {
9208
+ data: trData[childrenColumnName],
9209
+ hierarchy: hierarchy + 1
9210
+ })), isExpandedDom(trData, rowNum)]
9211
+ }, rowNum);
9212
+ })
9213
+ });
9214
+ }
9215
+
9069
9216
  ;// CONCATENATED MODULE: ../react-table/esm/index.js
9070
9217
 
9071
9218
 
9072
- var react_table_esm_excluded = ["prefixCls", "className", "columns", "data", "title", "footer", "bordered", "onCell", "onCellHead", "empty", "children"];
9219
+ var react_table_esm_excluded = ["prefixCls", "className", "columns", "data", "title", "footer", "bordered", "onCell", "onCellHead", "empty", "children", "expandable", "rowKey"];
9220
+
9073
9221
 
9074
9222
 
9075
9223
 
9076
9224
 
9077
9225
 
9078
9226
 
9227
+ // 展开配置
9228
+
9079
9229
 
9080
9230
 
9081
9231
  function Table(props) {
@@ -9093,17 +9243,126 @@ function Table(props) {
9093
9243
  bordered,
9094
9244
  onCell = noop,
9095
9245
  onCellHead = noop,
9096
- empty
9246
+ empty,
9247
+ expandable,
9248
+ rowKey
9097
9249
  } = props,
9098
9250
  other = _objectWithoutPropertiesLoose(props, react_table_esm_excluded);
9099
9251
 
9252
+ var [expandIndex, setExpandIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
9253
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9254
+ if (expandable) {
9255
+ if (expandable.defaultExpandAllRows) {
9256
+ setExpandIndex(data.map((it, index) => rowKey ? it[rowKey] : index));
9257
+ return;
9258
+ }
9259
+
9260
+ if (expandable.defaultExpandedRowKeys) {
9261
+ setExpandIndex(expandable.defaultExpandedRowKeys);
9262
+ return;
9263
+ }
9264
+ }
9265
+ }, []);
9266
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9267
+ if (expandable) {
9268
+ if (expandable.expandedRowKeys && JSON.stringify(expandable.expandedRowKeys) !== JSON.stringify(expandIndex)) {
9269
+ setExpandIndex(expandable.expandedRowKeys);
9270
+ }
9271
+ }
9272
+ }, [expandable == null ? void 0 : expandable.expandedRowKeys]);
9273
+ var isExpandedDom = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
9274
+ return (record, index) => {
9275
+ if (!expandable) {
9276
+ return false;
9277
+ }
9278
+
9279
+ if (!expandable.expandedRowRender) {
9280
+ return false;
9281
+ }
9282
+
9283
+ var flag = true;
9284
+
9285
+ if (expandable.rowExpandable) {
9286
+ flag = expandable.rowExpandable(record);
9287
+ }
9288
+
9289
+ return flag && /*#__PURE__*/(0,jsx_runtime.jsx)("tr", {
9290
+ style: expandIndex.includes(rowKey ? record[rowKey] : index) ? {} : {
9291
+ display: 'none'
9292
+ },
9293
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("td", {
9294
+ style: {
9295
+ paddingLeft: 16
9296
+ },
9297
+ colSpan: columns.length + 1,
9298
+ children: expandable.expandedRowRender(record, index, true)
9299
+ })
9300
+ });
9301
+ };
9302
+ }, [expandable, expandIndex]);
9303
+ var self = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
9304
+ var keys = getAllColumnsKeys(columns);
9305
+ var selfColumns = [];
9306
+
9307
+ if (expandable != null && expandable.expandedRowRender) {
9308
+ keys = [{
9309
+ key: 'uiw-expanded',
9310
+ align: 'center'
9311
+ }, ...keys];
9312
+ selfColumns = [{
9313
+ title: '',
9314
+ key: 'uiw-expanded',
9315
+ width: 50,
9316
+ align: 'center',
9317
+ render: (text, key, record, index) => {
9318
+ var _expandable$defaultEx;
9319
+
9320
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(ExpandableComponent, {
9321
+ defaultExpand: expandable.defaultExpandAllRows === undefined ? !!((_expandable$defaultEx = expandable.defaultExpandedRowKeys) != null && _expandable$defaultEx.includes(rowKey ? record[rowKey] : index)) : !!expandable.defaultExpandAllRows,
9322
+ onClick: expand => {
9323
+ expandable.onExpand == null ? void 0 : expandable.onExpand(expand, record, index);
9324
+
9325
+ if (expand) {
9326
+ var result = expandIndex.filter(it => rowKey ? it !== record[rowKey] : it !== index);
9327
+ expandable.onExpandedRowsChange ? expandable.onExpandedRowsChange(result) : setExpandIndex(result);
9328
+ } else {
9329
+ var _result = [...expandIndex, rowKey ? record[rowKey] : index];
9330
+ expandable.onExpandedRowsChange ? expandable.onExpandedRowsChange(_result) : setExpandIndex(_result);
9331
+ }
9332
+ },
9333
+ expandIcon: expand => {
9334
+ if (expandable.rowExpandable && !(expandable.rowExpandable != null && expandable.rowExpandable(record))) {
9335
+ return null;
9336
+ }
9337
+
9338
+ if (expandable.expandIcon) {
9339
+ return expandable.expandIcon(expand, record, index);
9340
+ }
9341
+
9342
+ return expand ? /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
9343
+ type: "minus-square-o"
9344
+ }) : /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
9345
+ type: "plus-square-o"
9346
+ });
9347
+ }
9348
+ });
9349
+ }
9350
+ }, ...columns];
9351
+ } else {
9352
+ selfColumns = [...columns];
9353
+ }
9354
+
9355
+ return {
9356
+ keys,
9357
+ selfColumns
9358
+ };
9359
+ }, [columns, expandIndex]);
9100
9360
  var cls = [prefixCls, className, bordered ? prefixCls + "-bordered" : null].filter(Boolean).join(' ').trim();
9101
9361
  var {
9102
9362
  header,
9103
9363
  render,
9104
9364
  ellipsis
9105
- } = getLevelItems(columns);
9106
- var keys = getAllColumnsKeys(columns);
9365
+ } = getLevelItems(self.selfColumns);
9107
9366
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
9108
9367
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", _extends({
9109
9368
  style: {
@@ -9121,45 +9380,19 @@ function Table(props) {
9121
9380
  onCellHead: onCellHead,
9122
9381
  data: header
9123
9382
  }), data && data.length > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
9124
- children: data.map((trData, rowNum) => /*#__PURE__*/(0,jsx_runtime.jsx)("tr", {
9125
- children: keys.map((keyName, colNum) => {
9126
- var objs = {
9127
- children: trData[keyName]
9128
- };
9129
-
9130
- if (render[keyName]) {
9131
- var child = render[keyName](trData[keyName], keyName, trData, rowNum, colNum);
9132
-
9133
- if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(child)) {
9134
- objs.children = child;
9135
- } else {
9136
- if (child.props) {
9137
- objs = _extends({}, child.props, {
9138
- children: objs.children
9139
- });
9140
- if (child.props.rowSpan === 0 || child.props.colSpan === 0) return null;
9141
- }
9142
-
9143
- if (child.children) {
9144
- objs.children = child.children;
9145
- }
9146
- }
9147
- }
9148
-
9149
- if (ellipsis && ellipsis[keyName]) {
9150
- objs.className = prefixCls + "-ellipsis";
9151
- }
9152
-
9153
- return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement)("td", _extends({}, objs, {
9154
- key: colNum,
9155
- onClick: evn => onCell(trData, {
9156
- rowNum,
9157
- colNum,
9158
- keyName
9159
- }, evn)
9160
- }));
9161
- })
9162
- }, rowNum))
9383
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)(TableTr, {
9384
+ rowKey: rowKey,
9385
+ data: data,
9386
+ keys: self.keys,
9387
+ render: render,
9388
+ ellipsis: ellipsis,
9389
+ prefixCls: prefixCls,
9390
+ onCell: onCell,
9391
+ hierarchy: 0,
9392
+ isExpandedDom: isExpandedDom,
9393
+ indentSize: (expandable == null ? void 0 : expandable.indentSize) || 16,
9394
+ childrenColumnName: (expandable == null ? void 0 : expandable.childrenColumnName) || 'children'
9395
+ })
9163
9396
  }), data && data.length === 0 && empty && /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
9164
9397
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("tr", {
9165
9398
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("td", {
@@ -9308,7 +9541,7 @@ function Tabs(props) {
9308
9541
  if (activeItem.current && type === 'line') {
9309
9542
  setSlideStyle({
9310
9543
  width: activeItem.current.clientWidth,
9311
- left: activeItem.current.offsetLeft
9544
+ left: activeItem.current.offsetLeft + 15
9312
9545
  });
9313
9546
  }
9314
9547
  }
@@ -9559,6 +9792,9 @@ function TreeNode(props) {
9559
9792
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
9560
9793
  className: prefixCls + "-label",
9561
9794
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
9795
+ style: {
9796
+ display: noChild ? 'none' : 'auto'
9797
+ },
9562
9798
  className: prefixCls + "-switcher",
9563
9799
  onClick: evn => onItemClick(item, evn),
9564
9800
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
@@ -9639,7 +9875,10 @@ var getChildKeys = function getChildKeys(childs, result, depth) {
9639
9875
  }
9640
9876
 
9641
9877
  childs.forEach(item => {
9642
- result.push(item.key);
9878
+ if (!item.hideNode) {
9879
+ result.push(item.key);
9880
+ }
9881
+
9643
9882
  if (typeof depth === 'number' && !(depth - 1)) return;
9644
9883
 
9645
9884
  if (item.children && item.children.length > 0) {
@@ -10268,6 +10507,322 @@ function SearchTree(props) {
10268
10507
 
10269
10508
  /* harmony default export */ const react_search_tree_esm = (SearchTree);
10270
10509
 
10510
+ ;// CONCATENATED MODULE: ../react-transfer/esm/style/index.css
10511
+ // extracted by mini-css-extract-plugin
10512
+ /* harmony default export */ const react_transfer_esm_style = ({});
10513
+ ;// CONCATENATED MODULE: ../react-transfer/esm/index.js
10514
+
10515
+
10516
+
10517
+
10518
+
10519
+
10520
+
10521
+
10522
+
10523
+
10524
+ var CheckedStatus;
10525
+
10526
+ (function (CheckedStatus) {
10527
+ CheckedStatus[CheckedStatus["UnChecked"] = 0] = "UnChecked";
10528
+ CheckedStatus[CheckedStatus["AllChecked"] = 1] = "AllChecked";
10529
+ CheckedStatus[CheckedStatus["Indeterminate"] = 2] = "Indeterminate";
10530
+ })(CheckedStatus || (CheckedStatus = {}));
10531
+
10532
+ function Transfer(props) {
10533
+ var {
10534
+ placeholder,
10535
+ options,
10536
+ value = [],
10537
+ showSearch = false,
10538
+ selectedAll = false,
10539
+ bodyStyle,
10540
+ style,
10541
+ className,
10542
+ prefixCls = 'w-transfer'
10543
+ } = props;
10544
+ var cls = [prefixCls, className].filter(Boolean).join(' ').trim();
10545
+ var [searchValueLeft, searchValueLeftSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
10546
+ var [searchValueRight, searchValueRightSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
10547
+ var [selectedOptions, selectedOptionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(options || []);
10548
+ var selectedOptionsShowCount = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
10549
+ var [selectOption, selectOptionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(new Map());
10550
+ var [leftSelectOption, leftSelectOptionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(new Map());
10551
+ var [leftSelectedKeys, leftSelectedKeySet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
10552
+ var [rightSelectedKeys, rightSelectedKeySet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
10553
+ var [rightOpions, rightOpionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
10554
+ var [selectAllChecked, selectAllCheckedSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
10555
+ left: CheckedStatus.UnChecked,
10556
+ right: CheckedStatus.UnChecked
10557
+ });
10558
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
10559
+ if (value) {
10560
+ rightOpionSet(value || []);
10561
+ value == null ? void 0 : value.forEach(selectd => selectOption.set(selectd.key, selectd.label));
10562
+ hiddenNode(child => !!(value != null && value.find(selectd => child.key === selectd.key)));
10563
+ }
10564
+ }, [JSON.stringify(value)]);
10565
+
10566
+ var hiddenNode = callBackfn => {
10567
+ selectedOptionsShowCount.current = 0;
10568
+
10569
+ var hiddenNodeForSeach = childrens => {
10570
+ childrens.forEach(child => {
10571
+ var _child$children;
10572
+
10573
+ var isHide = callBackfn(child); // && parentIsHide;
10574
+
10575
+ if (!!((_child$children = child.children) != null && _child$children.length)) {
10576
+ hiddenNodeForSeach(child.children);
10577
+ var find = child.children.find(item => !item.hideNode);
10578
+ child.hideNode = isHide && !find;
10579
+ } else {
10580
+ child.hideNode = isHide;
10581
+ }
10582
+
10583
+ if (!child.hideNode) {
10584
+ selectedOptionsShowCount.current++;
10585
+ }
10586
+ });
10587
+ };
10588
+
10589
+ hiddenNodeForSeach(selectedOptions);
10590
+ selectedOptionSet([...selectedOptions]);
10591
+ };
10592
+
10593
+ var getOptionsRecursion = (childrens, selectOption, isAdd) => {
10594
+ var addOrDel = (key, label, isAdd) => {
10595
+ if (isAdd) {
10596
+ selectOption.set(key, label);
10597
+ } else {
10598
+ selectOption.delete(key);
10599
+ }
10600
+ };
10601
+
10602
+ var iteratorParent = child => {
10603
+ if (child.parent) {
10604
+ var selectCount = child.parent.children.filter(child => !selectOption.get(child.key) && !child.hideNode).length;
10605
+ addOrDel(child.parent.key, child.parent.label, selectCount === 0);
10606
+ iteratorParent(child.parent);
10607
+ }
10608
+ };
10609
+
10610
+ childrens.forEach(child => {
10611
+ var _child$children2, _child$label;
10612
+
10613
+ if (!!((_child$children2 = child.children) != null && _child$children2.length)) {
10614
+ selectOption = getOptionsRecursion(child.children, selectOption, isAdd);
10615
+ }
10616
+
10617
+ addOrDel(child.key, (_child$label = child.label) == null ? void 0 : _child$label.toString(), isAdd);
10618
+ iteratorParent(child);
10619
+ });
10620
+ return selectOption;
10621
+ };
10622
+
10623
+ var leftTreeOnSelected = (selectedKeys, _1, isChecked, evn) => {
10624
+ leftSelectedKeySet(selectedKeys);
10625
+ var selectOptionTemp = getOptionsRecursion([evn], leftSelectOption, isChecked);
10626
+ leftSelectOptionSet(selectOptionTemp);
10627
+ };
10628
+
10629
+ var rightTreeOnSelected = selectedKeys => {
10630
+ rightSelectedKeySet(selectedKeys);
10631
+ };
10632
+
10633
+ var transferClick = transferType => {
10634
+ if (transferType === 'left') {
10635
+ leftSelectOption.forEach((value, key) => {
10636
+ selectOption.set(key, value);
10637
+ });
10638
+ leftSelectOptionSet(new Map());
10639
+ leftSelectedKeySet([]);
10640
+ } else {
10641
+ rightSelectedKeys.forEach(key => {
10642
+ selectOption.delete(key);
10643
+ });
10644
+ rightSelectedKeySet([]);
10645
+ }
10646
+
10647
+ selectOptionSet(selectOption);
10648
+ var option = [];
10649
+ selectOption.forEach((label, key) => option.push({
10650
+ key,
10651
+ label
10652
+ }));
10653
+ props.onChange == null ? void 0 : props.onChange(transferType, option);
10654
+ };
10655
+
10656
+ var searchValueLeftChange = searchValue => {
10657
+ hiddenNode(child => {
10658
+ var searchIsMatch = !child.label.includes(searchValue.trim());
10659
+
10660
+ if (!searchIsMatch) {
10661
+ var isSekected = rightOpions.find(selected => selected.key === child.key);
10662
+ searchIsMatch = !!isSekected;
10663
+ }
10664
+
10665
+ return searchIsMatch;
10666
+ });
10667
+ searchValueLeftSet(searchValue);
10668
+ props.onSearch == null ? void 0 : props.onSearch('left', searchValue);
10669
+ };
10670
+
10671
+ var searchValueRightChange = searchValue => {
10672
+ searchValueRightSet(searchValue);
10673
+ rightOpions.forEach(option => {
10674
+ var isHide = !option.label.includes(searchValue.trim());
10675
+ option.hideNode = isHide;
10676
+ });
10677
+ rightOpionSet(rightOpions);
10678
+ props.onSearch == null ? void 0 : props.onSearch('right', searchValue);
10679
+ };
10680
+
10681
+ var selectAllLeftChange = e => {
10682
+ var isChecked = e.target.checked;
10683
+ selectAllChecked.left = isChecked ? 1 : 0;
10684
+
10685
+ if (isChecked) {
10686
+ var keys = [];
10687
+
10688
+ var selectedOptionsRecursion = selectedOptions => {
10689
+ selectedOptions.forEach(child => {
10690
+ var _child$children3;
10691
+
10692
+ if ((_child$children3 = child.children) != null && _child$children3.length) {
10693
+ selectedOptionsRecursion(child.children);
10694
+ }
10695
+
10696
+ if (!child.hideNode) {
10697
+ leftSelectOption.set(child.key, child.label);
10698
+ keys.push(child.key);
10699
+ }
10700
+ });
10701
+ };
10702
+
10703
+ selectedOptionsRecursion(selectedOptions);
10704
+ leftSelectOptionSet(leftSelectOption);
10705
+ leftSelectedKeySet(keys);
10706
+ } else {
10707
+ leftSelectedKeySet([]);
10708
+ leftSelectOptionSet(new Map());
10709
+ }
10710
+
10711
+ selectAllCheckedSet(selectAllChecked);
10712
+ };
10713
+
10714
+ var selectAllRightChange = e => {
10715
+ var isChecked = e.target.checked;
10716
+ selectAllChecked.right = isChecked ? 1 : 0;
10717
+
10718
+ if (isChecked) {
10719
+ var keys = rightOpions.map(child => child.key);
10720
+ rightSelectedKeySet(keys);
10721
+ } else {
10722
+ rightSelectedKeySet([]);
10723
+ }
10724
+
10725
+ selectAllCheckedSet(selectAllChecked);
10726
+ };
10727
+
10728
+ var Arrow = props => /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
10729
+ onClick: () => props.click(),
10730
+ type: "down-square-o",
10731
+ className: prefixCls + "-arrow",
10732
+ style: _extends({
10733
+ fontSize: 20,
10734
+ stroke: '#e9e9e9',
10735
+ fill: '#333'
10736
+ }, props.style)
10737
+ });
10738
+
10739
+ return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10740
+ className: cls,
10741
+ style: _extends({
10742
+ width: 400
10743
+ }, style),
10744
+ children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(react_card_esm, {
10745
+ bodyStyle: {
10746
+ padding: '5px 9px'
10747
+ },
10748
+ title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10749
+ children: [selectedAll && /*#__PURE__*/(0,jsx_runtime.jsx)(react_checkbox_esm, {
10750
+ indeterminate: leftSelectedKeys.length < selectedOptionsShowCount.current && !!leftSelectedKeys.length,
10751
+ checked: leftSelectedKeys.length >= selectedOptionsShowCount.current && !!leftSelectedKeys.length,
10752
+ onChange: selectAllLeftChange
10753
+ }), /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
10754
+ style: {
10755
+ marginLeft: 3
10756
+ },
10757
+ children: [leftSelectedKeys.length, "/", selectedOptionsShowCount.current]
10758
+ })]
10759
+ }),
10760
+ className: prefixCls + "-card",
10761
+ children: [showSearch && /*#__PURE__*/(0,jsx_runtime.jsx)(react_input_esm, {
10762
+ placeholder: placeholder,
10763
+ value: searchValueLeft,
10764
+ onChange: e => searchValueLeftChange(e.target.value)
10765
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
10766
+ className: prefixCls + "-cheked-content",
10767
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)(TreeChecked, {
10768
+ defaultExpandAll: true,
10769
+ placeholder: placeholder || '搜索选项',
10770
+ data: selectedOptions,
10771
+ selectedKeys: leftSelectedKeys,
10772
+ onSelected: leftTreeOnSelected
10773
+ })
10774
+ })]
10775
+ }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10776
+ className: prefixCls + "-arrow-content",
10777
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Arrow, {
10778
+ click: () => transferClick('left'),
10779
+ style: {
10780
+ transform: 'rotate(-90deg)',
10781
+ background: leftSelectedKeys.length > 0 ? '#393E48' : 'none'
10782
+ }
10783
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)(Arrow, {
10784
+ click: () => transferClick('right'),
10785
+ style: {
10786
+ transform: 'rotate(90deg)',
10787
+ background: rightSelectedKeys.length > 0 ? '#393E48' : 'none'
10788
+ }
10789
+ })]
10790
+ }), /*#__PURE__*/(0,jsx_runtime.jsxs)(react_card_esm, {
10791
+ bodyStyle: {
10792
+ padding: '5px 9px'
10793
+ },
10794
+ className: prefixCls + "-card",
10795
+ title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10796
+ children: [selectedAll && /*#__PURE__*/(0,jsx_runtime.jsx)(react_checkbox_esm, {
10797
+ indeterminate: rightSelectedKeys.length < rightOpions.length && !!rightSelectedKeys.length,
10798
+ checked: rightSelectedKeys.length === rightOpions.length && !!rightSelectedKeys.length,
10799
+ onChange: selectAllRightChange
10800
+ }), /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
10801
+ style: {
10802
+ marginLeft: 3
10803
+ },
10804
+ children: [rightSelectedKeys.length, "/", rightOpions.length]
10805
+ })]
10806
+ }),
10807
+ children: [showSearch && /*#__PURE__*/(0,jsx_runtime.jsx)(react_input_esm, {
10808
+ placeholder: placeholder,
10809
+ value: searchValueRight,
10810
+ onChange: e => searchValueRightChange(e.target.value)
10811
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
10812
+ className: prefixCls + "-cheked-content",
10813
+ style: bodyStyle,
10814
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)(TreeChecked, {
10815
+ data: rightOpions,
10816
+ selectedKeys: rightSelectedKeys,
10817
+ onSelected: rightTreeOnSelected
10818
+ })
10819
+ })]
10820
+ })]
10821
+ });
10822
+ }
10823
+
10824
+ /* harmony default export */ const react_transfer_esm = (Transfer);
10825
+
10271
10826
  ;// CONCATENATED MODULE: ./src/index.ts
10272
10827
 
10273
10828
  })();