@bit-sun/business-component 2.2.2 → 2.2.4
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/index.esm.js
CHANGED
|
@@ -14316,12 +14316,30 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
|
|
|
14316
14316
|
};
|
|
14317
14317
|
}());
|
|
14318
14318
|
};
|
|
14319
|
+
var formatData = function formatData(value) {
|
|
14320
|
+
if (labelInValue) {
|
|
14321
|
+
var formatResult = multiple ? value.map(function (i) {
|
|
14322
|
+
return _objectSpread2(_objectSpread2({}, i), {}, {
|
|
14323
|
+
key: i.value
|
|
14324
|
+
});
|
|
14325
|
+
}) : _objectSpread2(_objectSpread2({}, value), {}, {
|
|
14326
|
+
key: value === null || value === void 0 ? void 0 : value.value
|
|
14327
|
+
});
|
|
14328
|
+
return formatResult;
|
|
14329
|
+
} else {
|
|
14330
|
+
var _formatResult = multiple ? value.map(function (i) {
|
|
14331
|
+
return (i === null || i === void 0 ? void 0 : i.value) || i;
|
|
14332
|
+
}) : _.get(value[0], 'value') || value;
|
|
14333
|
+
return _formatResult;
|
|
14334
|
+
}
|
|
14335
|
+
};
|
|
14319
14336
|
var handleChange = function handleChange(data, dataName) {
|
|
14320
14337
|
var _ctx$form2;
|
|
14321
|
-
|
|
14338
|
+
var handleData = formatData(data);
|
|
14339
|
+
onChange(handleData, data);
|
|
14322
14340
|
onChangeName && onChangeName(dataName);
|
|
14323
14341
|
getTreeData && getTreeData(treeData); // 把树节点暴露出去
|
|
14324
|
-
ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldValue(ctx.name,
|
|
14342
|
+
ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldValue(ctx.name, handleData);
|
|
14325
14343
|
};
|
|
14326
14344
|
useEffect(function () {
|
|
14327
14345
|
handleSearch(initialValue);
|
|
@@ -20069,10 +20087,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20069
20087
|
var replaceRouter = routerArray.filter(function (itemRoute) {
|
|
20070
20088
|
return pathToRegexp(itemRoute.key || '').test(route.pathname);
|
|
20071
20089
|
})[0];
|
|
20072
|
-
if (!istParent) {
|
|
20073
|
-
if (route.pathname === '/') return;
|
|
20074
|
-
window.parent.postMessage("/parent/".concat(itemPath).concat(route.pathname), '*');
|
|
20075
|
-
}
|
|
20076
20090
|
var currentKey = '';
|
|
20077
20091
|
if (replaceRouter && replaceRouter.isOnlyOnePage) {
|
|
20078
20092
|
// 处理中英文和特殊字符
|
|
@@ -20080,6 +20094,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20080
20094
|
} else {
|
|
20081
20095
|
currentKey = decodeURIComponent(route.pathname + _this2.parseQueryString(route.search));
|
|
20082
20096
|
}
|
|
20097
|
+
if (!istParent) {
|
|
20098
|
+
if (route.pathname === '/') return;
|
|
20099
|
+
window.parent.postMessage("/parent/".concat(itemPath).concat(currentKey), '*');
|
|
20100
|
+
}
|
|
20083
20101
|
// 防止出错
|
|
20084
20102
|
if (listenRouterKey.length !== listenRouterState.length) {
|
|
20085
20103
|
listenRouterState.forEach(function (item, index) {
|
package/dist/index.js
CHANGED
|
@@ -14334,12 +14334,30 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
|
|
|
14334
14334
|
};
|
|
14335
14335
|
}());
|
|
14336
14336
|
};
|
|
14337
|
+
var formatData = function formatData(value) {
|
|
14338
|
+
if (labelInValue) {
|
|
14339
|
+
var formatResult = multiple ? value.map(function (i) {
|
|
14340
|
+
return _objectSpread2(_objectSpread2({}, i), {}, {
|
|
14341
|
+
key: i.value
|
|
14342
|
+
});
|
|
14343
|
+
}) : _objectSpread2(_objectSpread2({}, value), {}, {
|
|
14344
|
+
key: value === null || value === void 0 ? void 0 : value.value
|
|
14345
|
+
});
|
|
14346
|
+
return formatResult;
|
|
14347
|
+
} else {
|
|
14348
|
+
var _formatResult = multiple ? value.map(function (i) {
|
|
14349
|
+
return (i === null || i === void 0 ? void 0 : i.value) || i;
|
|
14350
|
+
}) : ___default['default'].get(value[0], 'value') || value;
|
|
14351
|
+
return _formatResult;
|
|
14352
|
+
}
|
|
14353
|
+
};
|
|
14337
14354
|
var handleChange = function handleChange(data, dataName) {
|
|
14338
14355
|
var _ctx$form2;
|
|
14339
|
-
|
|
14356
|
+
var handleData = formatData(data);
|
|
14357
|
+
onChange(handleData, data);
|
|
14340
14358
|
onChangeName && onChangeName(dataName);
|
|
14341
14359
|
getTreeData && getTreeData(treeData); // 把树节点暴露出去
|
|
14342
|
-
ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldValue(ctx.name,
|
|
14360
|
+
ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldValue(ctx.name, handleData);
|
|
14343
14361
|
};
|
|
14344
14362
|
React.useEffect(function () {
|
|
14345
14363
|
handleSearch(initialValue);
|
|
@@ -20087,10 +20105,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20087
20105
|
var replaceRouter = routerArray.filter(function (itemRoute) {
|
|
20088
20106
|
return pathToRegexp(itemRoute.key || '').test(route.pathname);
|
|
20089
20107
|
})[0];
|
|
20090
|
-
if (!istParent) {
|
|
20091
|
-
if (route.pathname === '/') return;
|
|
20092
|
-
window.parent.postMessage("/parent/".concat(itemPath).concat(route.pathname), '*');
|
|
20093
|
-
}
|
|
20094
20108
|
var currentKey = '';
|
|
20095
20109
|
if (replaceRouter && replaceRouter.isOnlyOnePage) {
|
|
20096
20110
|
// 处理中英文和特殊字符
|
|
@@ -20098,6 +20112,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20098
20112
|
} else {
|
|
20099
20113
|
currentKey = decodeURIComponent(route.pathname + _this2.parseQueryString(route.search));
|
|
20100
20114
|
}
|
|
20115
|
+
if (!istParent) {
|
|
20116
|
+
if (route.pathname === '/') return;
|
|
20117
|
+
window.parent.postMessage("/parent/".concat(itemPath).concat(currentKey), '*');
|
|
20118
|
+
}
|
|
20101
20119
|
// 防止出错
|
|
20102
20120
|
if (listenRouterKey.length !== listenRouterState.length) {
|
|
20103
20121
|
listenRouterState.forEach(function (item, index) {
|
package/package.json
CHANGED
|
@@ -375,11 +375,6 @@ class BasicLayout extends React.PureComponent {
|
|
|
375
375
|
pathToRegexp(itemRoute.key || '').test(route.pathname),
|
|
376
376
|
)[0];
|
|
377
377
|
|
|
378
|
-
if (!istParent) {
|
|
379
|
-
if (route.pathname === '/') return;
|
|
380
|
-
window.parent.postMessage(`/parent/${itemPath}${route.pathname}`, '*');
|
|
381
|
-
}
|
|
382
|
-
|
|
383
378
|
let currentKey = '';
|
|
384
379
|
|
|
385
380
|
if (replaceRouter && replaceRouter.isOnlyOnePage) {
|
|
@@ -391,6 +386,11 @@ class BasicLayout extends React.PureComponent {
|
|
|
391
386
|
);
|
|
392
387
|
}
|
|
393
388
|
|
|
389
|
+
if (!istParent) {
|
|
390
|
+
if (route.pathname === '/') return;
|
|
391
|
+
window.parent.postMessage(`/parent/${itemPath}${currentKey}`, '*');
|
|
392
|
+
}
|
|
393
|
+
|
|
394
394
|
// 防止出错
|
|
395
395
|
if (listenRouterKey.length !== listenRouterState.length) {
|
|
396
396
|
listenRouterState.forEach((item, index) => {
|
|
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
2
2
|
import { TreeSelect, Tooltip, Tag } from 'antd';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { stringify } from 'querystring';
|
|
5
|
+
import _ from "lodash"
|
|
5
6
|
|
|
6
7
|
const TreeSearchSelect = (props: any) => {
|
|
7
8
|
const [treeData, setTreeData] = useState([]);
|
|
@@ -85,11 +86,21 @@ const TreeSearchSelect = (props: any) => {
|
|
|
85
86
|
});
|
|
86
87
|
};
|
|
87
88
|
|
|
89
|
+
const formatData = (value: any) => {
|
|
90
|
+
if (labelInValue) {
|
|
91
|
+
const formatResult = multiple ? value.map((i: any) => ({...i, key: i.value})) : { ...value, key: value?.value };
|
|
92
|
+
return formatResult
|
|
93
|
+
} else {
|
|
94
|
+
const formatResult = multiple ? value.map((i: any) => (i?.value || i)) : (_.get(value[0], 'value') || value)
|
|
95
|
+
return formatResult
|
|
96
|
+
}
|
|
97
|
+
}
|
|
88
98
|
const handleChange = (data: any, dataName: any) => {
|
|
89
|
-
|
|
99
|
+
const handleData = formatData(data);
|
|
100
|
+
onChange(handleData,data);
|
|
90
101
|
onChangeName && onChangeName(dataName);
|
|
91
102
|
getTreeData && getTreeData(treeData); // 把树节点暴露出去
|
|
92
|
-
ctx?.form?.setFieldValue(ctx.name,
|
|
103
|
+
ctx?.form?.setFieldValue(ctx.name, handleData);
|
|
93
104
|
};
|
|
94
105
|
|
|
95
106
|
useEffect(() => {
|