@zat-design/sisyphus-react 3.4.9-beta.17 → 3.4.9-beta.19
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/es/ProForm/components/combination/ProCascader/index.js +2 -2
- package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -0
- package/lib/ProForm/components/combination/ProCascader/index.js +1 -1
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +3 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ import _Typography from "antd/es/typography";
|
|
|
15
15
|
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator"];
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { useEffect, useState, memo, useMemo } from 'react';
|
|
18
|
-
import {
|
|
18
|
+
import { omit } from 'lodash';
|
|
19
19
|
import { transformDataName } from './utils/index';
|
|
20
20
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
21
21
|
import useEnum from '../../../../ProEnum/hooks/useEnum';
|
|
@@ -95,7 +95,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
95
95
|
var realDataSource = useMemo(function () {
|
|
96
96
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
97
97
|
var result = isAddressMode && realLevel === 2 ? filterDataSource(innerDataSource, level) : innerDataSource;
|
|
98
|
-
return
|
|
98
|
+
return transformDataName(result, fieldNames);
|
|
99
99
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
100
100
|
var _useRequest = _objectSpread({}, useRequest),
|
|
101
101
|
service = _useRequest.service,
|
|
@@ -5,6 +5,9 @@ export var transformDataName = function transformDataName(dataSource, fieldNames
|
|
|
5
5
|
value = fieldNames.value,
|
|
6
6
|
children = fieldNames.children,
|
|
7
7
|
extraFields = _objectWithoutProperties(fieldNames, _excluded);
|
|
8
|
+
if (!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 'label' in dataSource[0] && 'value' in dataSource[0] && 'children' in dataSource[0]) {
|
|
9
|
+
return dataSource;
|
|
10
|
+
}
|
|
8
11
|
function transformNode(node) {
|
|
9
12
|
var newNode = {
|
|
10
13
|
label: node[label],
|
|
@@ -95,7 +95,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
95
95
|
var realDataSource = (0, _react.useMemo)(function () {
|
|
96
96
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
97
97
|
var result = isAddressMode && realLevel === 2 ? filterDataSource(innerDataSource, level) : innerDataSource;
|
|
98
|
-
return (0,
|
|
98
|
+
return (0, _index.transformDataName)(result, fieldNames);
|
|
99
99
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
100
100
|
var _useRequest = (0, _objectSpread2.default)({}, useRequest),
|
|
101
101
|
service = _useRequest.service,
|
|
@@ -12,6 +12,9 @@ var transformDataName = exports.transformDataName = function transformDataName(d
|
|
|
12
12
|
value = fieldNames.value,
|
|
13
13
|
children = fieldNames.children,
|
|
14
14
|
extraFields = (0, _objectWithoutProperties2.default)(fieldNames, _excluded);
|
|
15
|
+
if (!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 'label' in dataSource[0] && 'value' in dataSource[0] && 'children' in dataSource[0]) {
|
|
16
|
+
return dataSource;
|
|
17
|
+
}
|
|
15
18
|
function transformNode(node) {
|
|
16
19
|
var newNode = {
|
|
17
20
|
label: node[label],
|