@ant-design/pro-components 3.0.1-0 → 3.1.0-0
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/pro-components.min.js +1 -1
- package/es/card/ProCard.js +4 -2
- package/es/card/components/Actions/style.d.ts +1 -1
- package/es/card/components/Card/index.js +8 -4
- package/es/card/components/Card/style.d.ts +1 -1
- package/es/card/components/CheckCard/index.d.ts +6 -0
- package/es/card/components/CheckCard/index.js +2 -1
- package/es/card/components/CheckCard/style.d.ts +1 -1
- package/es/card/components/Divider/style.d.ts +1 -1
- package/es/card/components/Loading/style.d.ts +1 -1
- package/es/card/components/Operation/style.d.ts +1 -1
- package/es/card/components/Statistic/style.d.ts +1 -1
- package/es/card/components/Statistic/style.js +2 -6
- package/es/card/components/StatisticCard/index.js +4 -2
- package/es/card/components/StatisticCard/style.d.ts +1 -1
- package/es/card/typing.d.ts +5 -0
- package/es/descriptions/index.js +2 -1
- package/es/field/ValueTypeToComponent.js +4 -4
- package/es/field/components/Cascader/index.d.ts +0 -1
- package/es/field/components/Checkbox/index.d.ts +0 -1
- package/es/field/components/ColorPicker/index.d.ts +1 -1
- package/es/field/components/Percent/util.d.ts +1 -1
- package/es/field/components/Radio/index.d.ts +0 -1
- package/es/field/components/Segmented/index.d.ts +0 -1
- package/es/field/components/Select/LightSelect/index.js +1 -2
- package/es/field/components/Select/SearchSelect/index.d.ts +6 -1
- package/es/field/components/Select/SearchSelect/index.js +101 -15
- package/es/field/components/Select/index.d.ts +0 -3
- package/es/field/components/Select/index.js +5 -3
- package/es/field/components/TreeSelect/index.d.ts +0 -1
- package/es/form/BaseForm/BaseForm.d.ts +3 -0
- package/es/form/BaseForm/BaseForm.js +9 -2
- package/es/form/BaseForm/LightWrapper/style.d.ts +1 -1
- package/es/form/components/Captcha/index.d.ts +8 -2
- package/es/form/components/Captcha/index.js +9 -1
- package/es/form/components/DatePicker/BaseDatePicker.js +20 -12
- package/es/form/components/DateRangePicker/BaseDateRanger.js +38 -13
- package/es/form/components/FormItem/Group/index.js +1 -1
- package/es/form/components/FormItem/Group/style.d.ts +1 -1
- package/es/form/components/List/index.d.ts +1 -1
- package/es/form/components/List/style.d.ts +1 -1
- package/es/form/components/SchemaForm/index.js +1 -2
- package/es/form/components/Text/index.js +4 -2
- package/es/form/components/UploadButton/index.d.ts +1 -1
- package/es/form/components/UploadButton/index.js +3 -3
- package/es/form/index.d.ts +1 -0
- package/es/form/layouts/DrawerForm/index.d.ts +1 -1
- package/es/form/layouts/DrawerForm/index.js +3 -2
- package/es/form/layouts/DrawerForm/style.d.ts +1 -1
- package/es/form/layouts/LightFilter/style.d.ts +1 -1
- package/es/form/layouts/LoginForm/index.d.ts +1 -1
- package/es/form/layouts/LoginForm/style.d.ts +1 -1
- package/es/form/layouts/LoginFormPage/index.d.ts +1 -1
- package/es/form/layouts/LoginFormPage/style.d.ts +1 -1
- package/es/form/layouts/ModalForm/index.js +2 -1
- package/es/form/layouts/ProForm/index.d.ts +1 -1
- package/es/form/layouts/QueryFilter/index.d.ts +2 -1
- package/es/form/layouts/QueryFilter/style.d.ts +1 -1
- package/es/form/layouts/StepsForm/index.js +15 -2
- package/es/form/layouts/StepsForm/style.d.ts +1 -1
- package/es/layout/components/AppsLogoComponents/index.js +3 -1
- package/es/layout/components/AppsLogoComponents/style/index.d.ts +1 -1
- package/es/layout/components/CollapsedIcon/style.d.ts +1 -1
- package/es/layout/components/FooterToolbar/style/index.d.ts +1 -1
- package/es/layout/components/FooterToolbar/style/stylish.d.ts +1 -1
- package/es/layout/components/GlobalFooter/index.d.ts +1 -1
- package/es/layout/components/GlobalFooter/style.d.ts +1 -1
- package/es/layout/components/GlobalHeader/rightContentStyle.d.ts +1 -1
- package/es/layout/components/GlobalHeader/style.d.ts +1 -1
- package/es/layout/components/GridContent/style.d.ts +1 -1
- package/es/layout/components/Header/style/header.d.ts +1 -1
- package/es/layout/components/Header/style/stylish.d.ts +1 -1
- package/es/layout/components/Help/ProHelpDrawer.d.ts +1 -1
- package/es/layout/components/Help/ProHelpDrawer.js +3 -1
- package/es/layout/components/Help/ProHelpPopover.js +1 -1
- package/es/layout/components/Help/style.d.ts +1 -1
- package/es/layout/components/PageContainer/style/index.d.ts +1 -1
- package/es/layout/components/PageContainer/style/stylish.d.ts +1 -1
- package/es/layout/components/PageHeader/style/index.d.ts +1 -1
- package/es/layout/components/SettingDrawer/index.js +2 -2
- package/es/layout/components/SettingDrawer/style/index.d.ts +1 -1
- package/es/layout/components/SiderMenu/BaseMenu.d.ts +1 -1
- package/es/layout/components/SiderMenu/BaseMenu.js +3 -3
- package/es/layout/components/SiderMenu/SiderMenu.js +8 -8
- package/es/layout/components/SiderMenu/index.js +11 -6
- package/es/layout/components/SiderMenu/style/index.d.ts +1 -1
- package/es/layout/components/SiderMenu/style/menu.d.ts +1 -1
- package/es/layout/components/SiderMenu/style/stylish.d.ts +1 -1
- package/es/layout/components/TopNavHeader/style.d.ts +1 -1
- package/es/layout/defaultSettings.d.ts +6 -0
- package/es/layout/style/index.d.ts +1 -1
- package/es/list/style/index.d.ts +1 -1
- package/es/provider/index.d.ts +1 -0
- package/es/provider/index.js +11 -6
- package/es/provider/useStyle/index.d.ts +2 -1
- package/es/provider/useStyle/index.js +20 -12
- package/es/table/Table.js +412 -280
- package/es/table/components/Alert/index.d.ts +1 -1
- package/es/table/components/Alert/style.d.ts +1 -1
- package/es/table/components/ColumnSetting/index.d.ts +1 -1
- package/es/table/components/ColumnSetting/index.js +15 -3
- package/es/table/components/ColumnSetting/style.d.ts +1 -1
- package/es/table/components/DragSortTable/index.d.ts +1 -1
- package/es/table/components/DragSortTable/style.d.ts +1 -1
- package/es/table/components/EditableTable/index.js +530 -197
- package/es/table/components/ListToolBar/style.d.ts +1 -1
- package/es/table/style/index.d.ts +1 -1
- package/es/table/typing.d.ts +37 -12
- package/es/table/useFetchData.js +8 -13
- package/es/table/utils/columnRender.d.ts +1 -1
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +5 -17
- package/es/table/utils/index.d.ts +60 -5
- package/es/table/utils/index.js +157 -18
- package/es/utils/components/DropdownFooter/style.d.ts +1 -1
- package/es/utils/components/FieldLabel/style.d.ts +1 -1
- package/es/utils/components/FilterDropdown/index.js +1 -1
- package/es/utils/components/FilterDropdown/style.d.ts +1 -1
- package/es/utils/components/InlineErrorFormItem/style.d.ts +1 -1
- package/es/utils/components/LabelIconTip/style.d.ts +1 -1
- package/es/utils/conversionMomentValue/index.js +14 -2
- package/es/utils/proFieldParsingText/index.js +1 -1
- package/es/utils/typing.d.ts +1 -1
- package/es/utils/useEditableArray/index.d.ts +3 -6
- package/es/utils/useEditableArray/index.js +562 -318
- package/es/utils/useEditableMap/index.js +82 -25
- package/es/utils/useMediaQuery/query.js +11 -5
- package/lib/card/ProCard.js +4 -2
- package/lib/card/components/Actions/style.d.ts +1 -1
- package/lib/card/components/Card/index.js +8 -4
- package/lib/card/components/Card/style.d.ts +1 -1
- package/lib/card/components/CheckCard/index.d.ts +6 -0
- package/lib/card/components/CheckCard/index.js +2 -1
- package/lib/card/components/CheckCard/style.d.ts +1 -1
- package/lib/card/components/Divider/style.d.ts +1 -1
- package/lib/card/components/Loading/style.d.ts +1 -1
- package/lib/card/components/Operation/style.d.ts +1 -1
- package/lib/card/components/Statistic/style.d.ts +1 -1
- package/lib/card/components/Statistic/style.js +2 -6
- package/lib/card/components/StatisticCard/index.js +4 -2
- package/lib/card/components/StatisticCard/style.d.ts +1 -1
- package/lib/card/typing.d.ts +5 -0
- package/lib/descriptions/index.js +2 -1
- package/lib/field/ValueTypeToComponent.js +4 -4
- package/lib/field/components/Cascader/index.d.ts +0 -1
- package/lib/field/components/Checkbox/index.d.ts +0 -1
- package/lib/field/components/ColorPicker/index.d.ts +1 -1
- package/lib/field/components/Percent/util.d.ts +1 -1
- package/lib/field/components/Radio/index.d.ts +0 -1
- package/lib/field/components/Segmented/index.d.ts +0 -1
- package/lib/field/components/Select/LightSelect/index.js +1 -2
- package/lib/field/components/Select/SearchSelect/index.d.ts +6 -1
- package/lib/field/components/Select/SearchSelect/index.js +101 -15
- package/lib/field/components/Select/index.d.ts +0 -3
- package/lib/field/components/Select/index.js +5 -3
- package/lib/field/components/TreeSelect/index.d.ts +0 -1
- package/lib/form/BaseForm/BaseForm.d.ts +3 -0
- package/lib/form/BaseForm/BaseForm.js +9 -2
- package/lib/form/BaseForm/LightWrapper/style.d.ts +1 -1
- package/lib/form/components/Captcha/index.d.ts +8 -2
- package/lib/form/components/Captcha/index.js +9 -1
- package/lib/form/components/DatePicker/BaseDatePicker.js +19 -11
- package/lib/form/components/DateRangePicker/BaseDateRanger.js +37 -12
- package/lib/form/components/Digit/DigitRange.d.ts +1 -1
- package/lib/form/components/FormItem/Group/index.js +1 -1
- package/lib/form/components/FormItem/Group/style.d.ts +1 -1
- package/lib/form/components/List/index.d.ts +1 -1
- package/lib/form/components/List/style.d.ts +1 -1
- package/lib/form/components/SchemaForm/index.js +1 -2
- package/lib/form/components/Text/index.js +4 -2
- package/lib/form/components/UploadButton/index.d.ts +1 -1
- package/lib/form/components/UploadButton/index.js +3 -3
- package/lib/form/index.d.ts +1 -0
- package/lib/form/layouts/DrawerForm/index.d.ts +1 -1
- package/lib/form/layouts/DrawerForm/index.js +3 -2
- package/lib/form/layouts/DrawerForm/style.d.ts +1 -1
- package/lib/form/layouts/LightFilter/style.d.ts +1 -1
- package/lib/form/layouts/LoginForm/index.d.ts +1 -1
- package/lib/form/layouts/LoginForm/style.d.ts +1 -1
- package/lib/form/layouts/LoginFormPage/index.d.ts +1 -1
- package/lib/form/layouts/LoginFormPage/style.d.ts +1 -1
- package/lib/form/layouts/ModalForm/index.js +2 -1
- package/lib/form/layouts/ProForm/index.d.ts +2 -2
- package/lib/form/layouts/QueryFilter/index.d.ts +2 -1
- package/lib/form/layouts/QueryFilter/style.d.ts +1 -1
- package/lib/form/layouts/StepsForm/index.js +15 -2
- package/lib/form/layouts/StepsForm/style.d.ts +1 -1
- package/lib/layout/components/AppsLogoComponents/index.js +3 -1
- package/lib/layout/components/AppsLogoComponents/style/index.d.ts +1 -1
- package/lib/layout/components/CollapsedIcon/style.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/style/index.d.ts +1 -1
- package/lib/layout/components/FooterToolbar/style/stylish.d.ts +1 -1
- package/lib/layout/components/GlobalFooter/index.d.ts +1 -1
- package/lib/layout/components/GlobalFooter/style.d.ts +1 -1
- package/lib/layout/components/GlobalHeader/rightContentStyle.d.ts +1 -1
- package/lib/layout/components/GlobalHeader/style.d.ts +1 -1
- package/lib/layout/components/GridContent/style.d.ts +1 -1
- package/lib/layout/components/Header/style/header.d.ts +1 -1
- package/lib/layout/components/Header/style/stylish.d.ts +1 -1
- package/lib/layout/components/Help/ProHelpDrawer.d.ts +1 -1
- package/lib/layout/components/Help/ProHelpDrawer.js +3 -1
- package/lib/layout/components/Help/ProHelpPopover.js +1 -1
- package/lib/layout/components/Help/style.d.ts +1 -1
- package/lib/layout/components/PageContainer/style/index.d.ts +1 -1
- package/lib/layout/components/PageContainer/style/stylish.d.ts +1 -1
- package/lib/layout/components/PageHeader/style/index.d.ts +1 -1
- package/lib/layout/components/SettingDrawer/index.js +2 -2
- package/lib/layout/components/SettingDrawer/style/index.d.ts +1 -1
- package/lib/layout/components/SiderMenu/BaseMenu.d.ts +1 -1
- package/lib/layout/components/SiderMenu/BaseMenu.js +3 -3
- package/lib/layout/components/SiderMenu/SiderMenu.js +8 -8
- package/lib/layout/components/SiderMenu/index.js +11 -6
- package/lib/layout/components/SiderMenu/style/index.d.ts +1 -1
- package/lib/layout/components/SiderMenu/style/menu.d.ts +1 -1
- package/lib/layout/components/SiderMenu/style/stylish.d.ts +1 -1
- package/lib/layout/components/TopNavHeader/style.d.ts +1 -1
- package/lib/layout/defaultSettings.d.ts +6 -0
- package/lib/layout/style/index.d.ts +1 -1
- package/lib/list/style/index.d.ts +1 -1
- package/lib/provider/index.d.ts +1 -0
- package/lib/provider/index.js +11 -6
- package/lib/provider/useStyle/index.d.ts +2 -1
- package/lib/provider/useStyle/index.js +20 -12
- package/lib/table/Table.js +422 -290
- package/lib/table/components/Alert/index.d.ts +1 -1
- package/lib/table/components/Alert/style.d.ts +1 -1
- package/lib/table/components/ColumnSetting/index.d.ts +1 -1
- package/lib/table/components/ColumnSetting/index.js +15 -3
- package/lib/table/components/ColumnSetting/style.d.ts +1 -1
- package/lib/table/components/DragSortTable/index.d.ts +1 -1
- package/lib/table/components/DragSortTable/style.d.ts +1 -1
- package/lib/table/components/EditableTable/index.js +529 -196
- package/lib/table/components/ListToolBar/style.d.ts +1 -1
- package/lib/table/style/index.d.ts +1 -1
- package/lib/table/typing.d.ts +37 -12
- package/lib/table/useFetchData.js +8 -13
- package/lib/table/utils/columnRender.d.ts +1 -1
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +4 -16
- package/lib/table/utils/index.d.ts +60 -5
- package/lib/table/utils/index.js +159 -20
- package/lib/utils/components/DropdownFooter/style.d.ts +1 -1
- package/lib/utils/components/FieldLabel/style.d.ts +1 -1
- package/lib/utils/components/FilterDropdown/index.js +1 -1
- package/lib/utils/components/FilterDropdown/style.d.ts +1 -1
- package/lib/utils/components/InlineErrorFormItem/style.d.ts +1 -1
- package/lib/utils/components/LabelIconTip/style.d.ts +1 -1
- package/lib/utils/conversionMomentValue/index.js +14 -2
- package/lib/utils/proFieldParsingText/index.js +1 -1
- package/lib/utils/typing.d.ts +1 -1
- package/lib/utils/useEditableArray/index.d.ts +3 -6
- package/lib/utils/useEditableArray/index.js +568 -324
- package/lib/utils/useEditableMap/index.js +82 -25
- package/lib/utils/useMediaQuery/query.js +10 -4
- package/package.json +45 -45
package/es/card/ProCard.js
CHANGED
|
@@ -4,8 +4,10 @@ import Divider from "./components/Divider";
|
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
var Group = function Group(props) {
|
|
6
6
|
return /*#__PURE__*/_jsx(Card, _objectSpread({
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
styles: {
|
|
8
|
+
body: {
|
|
9
|
+
padding: 0
|
|
10
|
+
}
|
|
9
11
|
}
|
|
10
12
|
}, props));
|
|
11
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export default function useStyle(prefixCls?: string): {
|
|
3
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
3
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
4
4
|
hashId: string;
|
|
5
5
|
};
|
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["className", "style", "bodyStyle", "headStyle", "title", "subTitle", "extra", "wrap", "layout", "loading", "gutter", "tooltip", "split", "headerBordered", "variant", "boxShadow", "children", "size", "actions", "ghost", "hoverable", "direction", "collapsed", "collapsible", "collapsibleIconRender", "colStyle", "defaultCollapsed", "onCollapse", "checked", "onChecked", "tabs", "type"];
|
|
6
|
+
var _excluded = ["className", "style", "bodyStyle", "headStyle", "styles", "title", "subTitle", "extra", "wrap", "layout", "loading", "gutter", "tooltip", "split", "headerBordered", "variant", "boxShadow", "children", "size", "actions", "ghost", "hoverable", "direction", "collapsed", "collapsible", "collapsibleIconRender", "colStyle", "defaultCollapsed", "onCollapse", "checked", "onChecked", "tabs", "type"];
|
|
7
7
|
import { RightOutlined } from '@ant-design/icons';
|
|
8
8
|
import { omit, useMergedState } from '@rc-component/util';
|
|
9
9
|
import { ConfigProvider, Tabs } from 'antd';
|
|
@@ -22,6 +22,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22
22
|
style = props.style,
|
|
23
23
|
bodyStyle = props.bodyStyle,
|
|
24
24
|
headStyle = props.headStyle,
|
|
25
|
+
styles = props.styles,
|
|
25
26
|
title = props.title,
|
|
26
27
|
subTitle = props.subTitle,
|
|
27
28
|
extra = props.extra,
|
|
@@ -182,10 +183,13 @@ var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
182
183
|
});
|
|
183
184
|
var cardCls = classNames("".concat(prefixCls), className, hashId, (_classNames2 = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classNames2, "".concat(prefixCls, "-border"), variant === 'outlined'), "".concat(prefixCls, "-box-shadow"), boxShadow), "".concat(prefixCls, "-contain-card"), containProCard), "".concat(prefixCls, "-loading"), loading), "".concat(prefixCls, "-split"), split === 'vertical' || split === 'horizontal'), "".concat(prefixCls, "-ghost"), ghost), "".concat(prefixCls, "-hoverable"), hoverable), "".concat(prefixCls, "-size-").concat(size), size), "".concat(prefixCls, "-type-").concat(type), type), "".concat(prefixCls, "-collapse"), collapsed), _defineProperty(_classNames2, "".concat(prefixCls, "-checked"), checked)));
|
|
184
185
|
var bodyCls = classNames("".concat(prefixCls, "-body"), hashId, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-body-center"), layout === 'center'), "".concat(prefixCls, "-body-direction-column"), split === 'horizontal' || direction === 'column'), "".concat(prefixCls, "-body-wrap"), wrap && containProCard));
|
|
185
|
-
|
|
186
|
+
|
|
187
|
+
// 支持新的 styles API,同时保持向后兼容
|
|
188
|
+
var cardBodyStyle = (styles === null || styles === void 0 ? void 0 : styles.body) || bodyStyle;
|
|
189
|
+
var cardHeadStyle = (styles === null || styles === void 0 ? void 0 : styles.header) || headStyle;
|
|
186
190
|
var loadingDOM = /*#__PURE__*/React.isValidElement(loading) ? loading : /*#__PURE__*/_jsx(Loading, {
|
|
187
191
|
prefix: prefixCls,
|
|
188
|
-
style: (
|
|
192
|
+
style: (cardBodyStyle === null || cardBodyStyle === void 0 ? void 0 : cardBodyStyle.padding) === 0 || (cardBodyStyle === null || cardBodyStyle === void 0 ? void 0 : cardBodyStyle.padding) === '0px' ? {
|
|
189
193
|
padding: 24
|
|
190
194
|
} : undefined
|
|
191
195
|
});
|
|
@@ -211,7 +215,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
211
215
|
}, omit(rest, ['prefixCls', 'colSpan'])), {}, {
|
|
212
216
|
children: [(title || extra || collapsibleButton) && /*#__PURE__*/_jsxs("div", {
|
|
213
217
|
className: classNames("".concat(prefixCls, "-header"), hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-header-border"), headerBordered || type === 'inner'), "".concat(prefixCls, "-header-collapsible"), collapsibleButton)),
|
|
214
|
-
style:
|
|
218
|
+
style: cardHeadStyle,
|
|
215
219
|
onClick: function onClick() {
|
|
216
220
|
if (collapsible === 'header' || collapsible === true) setCollapsed(!collapsed);
|
|
217
221
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export default function useStyle(prefixCls: string): {
|
|
3
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
3
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
4
4
|
hashId: string;
|
|
5
5
|
};
|
|
@@ -140,6 +140,12 @@ interface CheckCardProps {
|
|
|
140
140
|
* Custom style for the content area.
|
|
141
141
|
*/
|
|
142
142
|
bodyStyle?: React.CSSProperties;
|
|
143
|
+
/**
|
|
144
|
+
* Styles configuration.
|
|
145
|
+
*/
|
|
146
|
+
styles?: {
|
|
147
|
+
body?: React.CSSProperties;
|
|
148
|
+
};
|
|
143
149
|
/**
|
|
144
150
|
* The action area in the bottom right corner.
|
|
145
151
|
*/
|
|
@@ -17,6 +17,7 @@ import { useStyle } from "./style";
|
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
var CheckCard = function CheckCard(props) {
|
|
20
|
+
var _props$styles;
|
|
20
21
|
var _useMountMergeState = useMountMergeState(props.defaultChecked || false, {
|
|
21
22
|
value: props.checked,
|
|
22
23
|
onChange: props.onChange
|
|
@@ -166,7 +167,7 @@ var CheckCard = function CheckCard(props) {
|
|
|
166
167
|
onMouseEnter: props.onMouseEnter,
|
|
167
168
|
children: [metaDom, props.children ? /*#__PURE__*/_jsx("div", {
|
|
168
169
|
className: classNames("".concat(prefixCls, "-body"), hashId),
|
|
169
|
-
style: props.bodyStyle,
|
|
170
|
+
style: ((_props$styles = props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.body) || props.bodyStyle,
|
|
170
171
|
children: props.children
|
|
171
172
|
}) : null, props.actions ? /*#__PURE__*/_jsx(ProCardActions, {
|
|
172
173
|
actions: props.actions,
|
|
@@ -6,6 +6,6 @@ export interface ProListToken extends ProAliasToken {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const cardLoading: Keyframes;
|
|
8
8
|
export declare function useStyle(prefixCls: string): {
|
|
9
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
9
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
10
10
|
hashId: string;
|
|
11
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export default function useStyle(prefixCls: string): {
|
|
3
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
3
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
4
4
|
hashId: string;
|
|
5
5
|
};
|
|
@@ -6,6 +6,6 @@ export interface ProToken extends ProAliasToken {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const cardLoading: Keyframes;
|
|
8
8
|
export declare function useStyle(prefixCls: string): {
|
|
9
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
9
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
10
10
|
hashId: string;
|
|
11
11
|
};
|
|
@@ -4,6 +4,6 @@ export interface ProToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -4,6 +4,6 @@ export interface ProListToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
|
@@ -33,13 +33,9 @@ var genProStyle = function genProStyle(token) {
|
|
|
33
33
|
transform: 'rotate(180deg)'
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
'&-content':
|
|
36
|
+
'&-content': {
|
|
37
37
|
width: '100%'
|
|
38
|
-
},
|
|
39
|
-
'&-value-int': {
|
|
40
|
-
fontSize: token.fontSizeHeading3
|
|
41
|
-
}
|
|
42
|
-
}),
|
|
38
|
+
},
|
|
43
39
|
'&-description': {
|
|
44
40
|
width: '100%'
|
|
45
41
|
}
|
|
@@ -59,8 +59,10 @@ var StatisticCard = function StatisticCard(props) {
|
|
|
59
59
|
};
|
|
60
60
|
var Group = function Group(props) {
|
|
61
61
|
return /*#__PURE__*/_jsx(StatisticCard, _objectSpread({
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
styles: {
|
|
63
|
+
body: {
|
|
64
|
+
padding: 0
|
|
65
|
+
}
|
|
64
66
|
}
|
|
65
67
|
}, props));
|
|
66
68
|
};
|
|
@@ -4,6 +4,6 @@ export interface ProListToken extends ProAliasToken {
|
|
|
4
4
|
componentCls: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useStyle(prefixCls: string): {
|
|
7
|
-
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").
|
|
7
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
hashId: string;
|
|
9
9
|
};
|
package/es/card/typing.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ type CardPropsBase = {
|
|
|
10
10
|
headStyle?: React.CSSProperties;
|
|
11
11
|
/** 内容样式 */
|
|
12
12
|
bodyStyle?: React.CSSProperties;
|
|
13
|
+
/** 样式配置 */
|
|
14
|
+
styles?: {
|
|
15
|
+
header?: React.CSSProperties;
|
|
16
|
+
body?: React.CSSProperties;
|
|
17
|
+
};
|
|
13
18
|
/** 页头是否有分割线 */
|
|
14
19
|
headerBordered?: boolean;
|
|
15
20
|
/** 卡片标题 */
|
package/es/descriptions/index.js
CHANGED
|
@@ -754,22 +754,22 @@ var ValueTypeToComponentMap = {
|
|
|
754
754
|
render: function render(text, props) {
|
|
755
755
|
var fieldProps = pickProProps(props.fieldProps);
|
|
756
756
|
var placeholder = typeof props.placeholder === 'string' ? props.placeholder : undefined;
|
|
757
|
-
return /*#__PURE__*/_jsx(FieldCascader, {
|
|
757
|
+
return /*#__PURE__*/_jsx(FieldCascader, _objectSpread(_objectSpread({}, props), {}, {
|
|
758
758
|
mode: props.mode,
|
|
759
759
|
text: text,
|
|
760
760
|
placeholder: placeholder,
|
|
761
761
|
fieldProps: fieldProps
|
|
762
|
-
});
|
|
762
|
+
}));
|
|
763
763
|
},
|
|
764
764
|
formItemRender: function formItemRender(text, props) {
|
|
765
765
|
var fieldProps = pickProProps(props.fieldProps);
|
|
766
766
|
var placeholder = typeof props.placeholder === 'string' ? props.placeholder : undefined;
|
|
767
|
-
return /*#__PURE__*/_jsx(FieldCascader, {
|
|
767
|
+
return /*#__PURE__*/_jsx(FieldCascader, _objectSpread(_objectSpread({}, props), {}, {
|
|
768
768
|
mode: props.mode,
|
|
769
769
|
text: text,
|
|
770
770
|
placeholder: placeholder,
|
|
771
771
|
fieldProps: fieldProps
|
|
772
|
-
});
|
|
772
|
+
}));
|
|
773
773
|
}
|
|
774
774
|
},
|
|
775
775
|
treeSelect: {
|
|
@@ -21,7 +21,6 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
|
|
|
21
21
|
fieldProps?: any;
|
|
22
22
|
variant?: "filled" | "outlined" | "borderless" | undefined;
|
|
23
23
|
id?: string | undefined;
|
|
24
|
-
children?: React.ReactNode;
|
|
25
24
|
defaultKeyWords?: string | undefined;
|
|
26
25
|
} & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
|
|
27
26
|
export default _default;
|
|
@@ -17,7 +17,6 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
|
|
|
17
17
|
fieldProps?: any;
|
|
18
18
|
variant?: "filled" | "outlined" | "borderless" | undefined;
|
|
19
19
|
id?: string | undefined;
|
|
20
|
-
children?: React.ReactNode;
|
|
21
20
|
defaultKeyWords?: string | undefined;
|
|
22
21
|
} & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
|
|
23
22
|
export default _default;
|
|
@@ -3,5 +3,5 @@ import React from 'react';
|
|
|
3
3
|
declare const _default: React.ForwardRefExoticComponent<import("src/provider").BaseProFieldFC & import("src/provider").ProRenderFieldPropsType & {
|
|
4
4
|
text: string;
|
|
5
5
|
mode?: "update" | "read" | "edit" | undefined;
|
|
6
|
-
} & Partial<Omit<ColorPickerProps, "
|
|
6
|
+
} & Partial<Omit<ColorPickerProps, "mode" | "value">> & React.RefAttributes<any>>;
|
|
7
7
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** 获取展示符号 */
|
|
2
2
|
export declare function getSymbolByRealValue(realValue: number): "-" | "+" | null;
|
|
3
3
|
/** 获取颜色 */
|
|
4
|
-
export declare function getColorByRealValue(realValue: number /** ,color: string */): "#
|
|
4
|
+
export declare function getColorByRealValue(realValue: number /** ,color: string */): "#595959" | "#52c41a" | "#ff4d4f";
|
|
5
5
|
/** 获取到最后展示的数字 */
|
|
6
6
|
export declare function getRealTextWithPrecision(realValue: number, precision?: number): string | number;
|
|
7
7
|
/**
|
|
@@ -17,7 +17,6 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
|
|
|
17
17
|
fieldProps?: any;
|
|
18
18
|
variant?: "filled" | "outlined" | "borderless" | undefined;
|
|
19
19
|
id?: string | undefined;
|
|
20
|
-
children?: React.ReactNode;
|
|
21
20
|
defaultKeyWords?: string | undefined;
|
|
22
21
|
} & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
|
|
23
22
|
export default _default;
|
|
@@ -11,7 +11,6 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
|
|
|
11
11
|
fieldProps?: any;
|
|
12
12
|
variant?: "filled" | "outlined" | "borderless" | undefined;
|
|
13
13
|
id?: string | undefined;
|
|
14
|
-
children?: React.ReactNode;
|
|
15
14
|
defaultKeyWords?: string | undefined;
|
|
16
15
|
} & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
|
|
17
16
|
export default _default;
|
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
6
|
-
var _excluded = ["label", "prefixCls", "onChange", "value", "mode", "
|
|
6
|
+
var _excluded = ["label", "prefixCls", "onChange", "value", "mode", "defaultValue", "size", "showSearch", "disabled", "style", "className", "options", "onSearch", "allowClear", "labelInValue", "fieldNames", "lightLabel", "labelTrigger", "optionFilterProp", "optionLabelProp", "valueMaxLength", "fetchDataOnSearch", "fetchData", "variant"];
|
|
7
7
|
import { SearchOutlined } from '@ant-design/icons';
|
|
8
8
|
import { toArray } from '@rc-component/util';
|
|
9
9
|
import { ConfigProvider, Input, Select } from 'antd';
|
|
@@ -30,7 +30,6 @@ export var LightSelect = function LightSelect(props, ref) {
|
|
|
30
30
|
_onChange = props.onChange,
|
|
31
31
|
value = props.value,
|
|
32
32
|
mode = props.mode,
|
|
33
|
-
children = props.children,
|
|
34
33
|
defaultValue = props.defaultValue,
|
|
35
34
|
size = props.size,
|
|
36
35
|
showSearch = props.showSearch,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { SelectProps } from 'antd';
|
|
2
|
-
import type { LabeledValue } from 'antd/lib/select';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import type { RequestOptionsType } from '../../../../utils';
|
|
4
|
+
export type LabeledValue = {
|
|
5
|
+
key?: string;
|
|
6
|
+
label: React.ReactNode;
|
|
7
|
+
value: string | number;
|
|
8
|
+
};
|
|
9
|
+
export type DefaultOptionType = NonNullable<SelectProps['options']>[number];
|
|
5
10
|
export type KeyLabel = Partial<LabeledValue> & RequestOptionsType;
|
|
6
11
|
/** 用户扩展数据后的值类型 */
|
|
7
12
|
export type DataValueType<T> = KeyLabel & T;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
@@ -45,7 +47,7 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
45
47
|
fieldNames = props.fieldNames,
|
|
46
48
|
defaultSearchValue = props.defaultSearchValue,
|
|
47
49
|
_props$preserveOrigin = props.preserveOriginalLabel,
|
|
48
|
-
|
|
50
|
+
_preserveOriginalLabel = _props$preserveOrigin === void 0 ? false : _props$preserveOrigin,
|
|
49
51
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
50
52
|
var _ref = fieldNames || {},
|
|
51
53
|
_ref$label = _ref.label,
|
|
@@ -78,6 +80,40 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
78
80
|
// 兼容 renderXXX API。
|
|
79
81
|
|
|
80
82
|
var classString = classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-disabled"), disabled));
|
|
83
|
+
|
|
84
|
+
// 获取原始 label 的辅助函数
|
|
85
|
+
var getOriginalLabel = function getOriginalLabel(item, fallbackValue) {
|
|
86
|
+
// 优先使用 dataItem.label(原始字符串),避免使用 value.label(可能是 optionItemRender 渲染的组件)
|
|
87
|
+
if (item && typeof item.label === 'string' && item.label) {
|
|
88
|
+
return item.label;
|
|
89
|
+
}
|
|
90
|
+
if (item && item.text && typeof item.text === 'string') {
|
|
91
|
+
return item.text;
|
|
92
|
+
}
|
|
93
|
+
if (item && item.label) {
|
|
94
|
+
return String(item.label);
|
|
95
|
+
}
|
|
96
|
+
if (item && item.text) {
|
|
97
|
+
return String(item.text);
|
|
98
|
+
}
|
|
99
|
+
// 如果 dataItem 不存在,尝试从 value 中提取原始 label
|
|
100
|
+
// 但 value.label 可能是组件,需要从组件中提取原始 label
|
|
101
|
+
if (fallbackValue && fallbackValue.label) {
|
|
102
|
+
// 如果是 React 元素(Highlight 组件),尝试提取其 props.label
|
|
103
|
+
// 检查多种可能的 React 元素格式
|
|
104
|
+
var labelValue = fallbackValue.label;
|
|
105
|
+
if (( /*#__PURE__*/React.isValidElement(labelValue) || labelValue && _typeof(labelValue) === 'object' && 'props' in labelValue) && labelValue.props && labelValue.props.label) {
|
|
106
|
+
return String(labelValue.props.label);
|
|
107
|
+
}
|
|
108
|
+
// 如果是字符串,直接返回
|
|
109
|
+
if (typeof labelValue === 'string') {
|
|
110
|
+
return labelValue;
|
|
111
|
+
}
|
|
112
|
+
// 最后尝试转换为字符串
|
|
113
|
+
return String(labelValue);
|
|
114
|
+
}
|
|
115
|
+
return '';
|
|
116
|
+
};
|
|
81
117
|
var getMergeValue = function getMergeValue(value, option) {
|
|
82
118
|
if (Array.isArray(value) && Array.isArray(option) && value.length > 0) {
|
|
83
119
|
// 多选情况且用户有选择
|
|
@@ -85,8 +121,9 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
85
121
|
return value.map(function (item, index) {
|
|
86
122
|
var optionItem = option === null || option === void 0 ? void 0 : option[index];
|
|
87
123
|
var dataItem = optionItem === null || optionItem === void 0 ? void 0 : optionItem['data-item'];
|
|
124
|
+
var originalLabel = getOriginalLabel(dataItem, item);
|
|
88
125
|
return _objectSpread(_objectSpread(_objectSpread({}, dataItem || {}), item), {}, {
|
|
89
|
-
label:
|
|
126
|
+
label: originalLabel || item.label
|
|
90
127
|
});
|
|
91
128
|
});
|
|
92
129
|
}
|
|
@@ -94,12 +131,14 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
94
131
|
};
|
|
95
132
|
var genOptions = function genOptions(mapOptions) {
|
|
96
133
|
return mapOptions.map(function (item, index) {
|
|
97
|
-
var _item$optionsPropsNam;
|
|
134
|
+
var _item$labelPropsName, _item$optionsPropsNam;
|
|
98
135
|
var _ref2 = item,
|
|
99
136
|
itemClassName = _ref2.className,
|
|
100
137
|
optionType = _ref2.optionType,
|
|
101
138
|
resetItem = _objectWithoutProperties(_ref2, _excluded2);
|
|
102
|
-
|
|
139
|
+
|
|
140
|
+
// 获取 label,优先使用 labelPropsName,如果没有则使用 text(valueEnum 的情况)
|
|
141
|
+
var label = (_item$labelPropsName = item[labelPropsName]) !== null && _item$labelPropsName !== void 0 ? _item$labelPropsName : item.text;
|
|
103
142
|
var value = item[valuePropsName];
|
|
104
143
|
var itemOptions = (_item$optionsPropsNam = item[optionsPropsName]) !== null && _item$optionsPropsNam !== void 0 ? _item$optionsPropsNam : [];
|
|
105
144
|
if (optionType === 'optGroup' || item.options) {
|
|
@@ -140,18 +179,25 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
140
179
|
_onClear === null || _onClear === void 0 || _onClear();
|
|
141
180
|
fetchData(undefined);
|
|
142
181
|
if (showSearch) {
|
|
143
|
-
|
|
182
|
+
onSearch === null || onSearch === void 0 || onSearch('');
|
|
183
|
+
setSearchValue('');
|
|
144
184
|
}
|
|
145
185
|
}
|
|
146
186
|
}, restProps), {}, {
|
|
147
187
|
filterOption: restProps.filterOption == false ? false : function (inputValue, option) {
|
|
148
|
-
var _option$data_title, _option
|
|
188
|
+
var _option$data_title, _option;
|
|
189
|
+
// 当 inputValue 为空或 searchValue 为空时,显示所有选项
|
|
190
|
+
// 这样可以确保 searchOnFocus 时能够显示所有选项
|
|
191
|
+
var effectiveSearchValue = searchValue === '' ? '' : inputValue || searchValue;
|
|
192
|
+
if (!effectiveSearchValue) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
149
195
|
if (restProps.filterOption && typeof restProps.filterOption === 'function') {
|
|
150
|
-
return restProps.filterOption(
|
|
196
|
+
return restProps.filterOption(effectiveSearchValue, _objectSpread(_objectSpread({}, option), {}, {
|
|
151
197
|
label: option === null || option === void 0 ? void 0 : option.data_title
|
|
152
198
|
}));
|
|
153
199
|
}
|
|
154
|
-
return !!(option !== null && option !== void 0 && (_option$data_title = option.data_title) !== null && _option$data_title !== void 0 && _option$data_title.toString().toLowerCase().includes(
|
|
200
|
+
return !!(option !== null && option !== void 0 && (_option$data_title = option.data_title) !== null && _option$data_title !== void 0 && _option$data_title.toString().toLowerCase().includes(effectiveSearchValue.toLowerCase()) || option !== null && option !== void 0 && (_option = option[optionFilterProp]) !== null && _option !== void 0 && _option.toString().toLowerCase().includes(effectiveSearchValue.toLowerCase()));
|
|
155
201
|
} // 这里使用pro-components的过滤逻辑
|
|
156
202
|
,
|
|
157
203
|
onSearch: showSearch ? function (value) {
|
|
@@ -166,7 +212,7 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
166
212
|
if (showSearch && autoClearSearchValue) {
|
|
167
213
|
fetchData(undefined);
|
|
168
214
|
onSearch === null || onSearch === void 0 || onSearch('');
|
|
169
|
-
setSearchValue(
|
|
215
|
+
setSearchValue('');
|
|
170
216
|
} else if (showSearch && !autoClearSearchValue) {
|
|
171
217
|
// 当 autoClearSearchValue 为 false 时,保持搜索值不变
|
|
172
218
|
// 但是需要确保我们的状态与 Ant Design 的内部状态同步
|
|
@@ -187,16 +233,50 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
187
233
|
if (mode !== 'multiple' && !Array.isArray(optionList)) {
|
|
188
234
|
// 单选情况且用户选择了选项
|
|
189
235
|
var dataItem = optionList && optionList['data-item'];
|
|
236
|
+
|
|
237
|
+
// 如果 dataItem 不存在,尝试从 options 中查找对应的原始数据
|
|
238
|
+
var foundDataItem = dataItem;
|
|
239
|
+
if (!foundDataItem && value && options) {
|
|
240
|
+
var _value$valuePropsName;
|
|
241
|
+
var optionValue = (_value$valuePropsName = value[valuePropsName]) !== null && _value$valuePropsName !== void 0 ? _value$valuePropsName : value.value;
|
|
242
|
+
var findDataItem = function findDataItem(opts) {
|
|
243
|
+
var _iterator = _createForOfIteratorHelper(opts),
|
|
244
|
+
_step;
|
|
245
|
+
try {
|
|
246
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
247
|
+
var _opt$valuePropsName;
|
|
248
|
+
var opt = _step.value;
|
|
249
|
+
var optValue = (_opt$valuePropsName = opt[valuePropsName]) !== null && _opt$valuePropsName !== void 0 ? _opt$valuePropsName : opt.value;
|
|
250
|
+
if (optValue === optionValue) {
|
|
251
|
+
return opt;
|
|
252
|
+
}
|
|
253
|
+
if (opt[optionsPropsName] || opt.options) {
|
|
254
|
+
var found = findDataItem(opt[optionsPropsName] || opt.options || []);
|
|
255
|
+
if (found) return found;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
} catch (err) {
|
|
259
|
+
_iterator.e(err);
|
|
260
|
+
} finally {
|
|
261
|
+
_iterator.f();
|
|
262
|
+
}
|
|
263
|
+
return null;
|
|
264
|
+
};
|
|
265
|
+
foundDataItem = findDataItem(options);
|
|
266
|
+
}
|
|
267
|
+
|
|
190
268
|
// 如果value值为空则是清空时产生的回调,直接传值就可以了
|
|
191
|
-
if (!value || !
|
|
269
|
+
if (!value || !foundDataItem) {
|
|
270
|
+
var originalLabel = getOriginalLabel(foundDataItem, value);
|
|
192
271
|
var changedValue = value ? _objectSpread(_objectSpread({}, value), {}, {
|
|
193
|
-
|
|
194
|
-
label: preserveOriginalLabel && dataItem ? (dataItem === null || dataItem === void 0 ? void 0 : dataItem.label) || value.label : value.label
|
|
272
|
+
label: originalLabel
|
|
195
273
|
}) : value;
|
|
196
274
|
_onChange === null || _onChange === void 0 || _onChange.apply(void 0, [changedValue, optionList].concat(rest));
|
|
197
275
|
} else {
|
|
198
|
-
|
|
199
|
-
|
|
276
|
+
// 确保使用 dataItem.label(原始字符串),避免使用 value.label(可能是 optionItemRender 渲染的组件)
|
|
277
|
+
var _originalLabel = getOriginalLabel(foundDataItem, value);
|
|
278
|
+
_onChange === null || _onChange === void 0 || _onChange.apply(void 0, [_objectSpread(_objectSpread(_objectSpread({}, value), foundDataItem), {}, {
|
|
279
|
+
label: _originalLabel
|
|
200
280
|
}), optionList].concat(rest));
|
|
201
281
|
}
|
|
202
282
|
return;
|
|
@@ -210,7 +290,13 @@ var SearchSelect = function SearchSelect(props, ref) {
|
|
|
210
290
|
},
|
|
211
291
|
onFocus: function onFocus(e) {
|
|
212
292
|
if (searchOnFocus) {
|
|
213
|
-
|
|
293
|
+
// 当 searchOnFocus 为 true 时,应该清空搜索关键词以显示所有选项
|
|
294
|
+
fetchData(undefined);
|
|
295
|
+
// 同时清空搜索值
|
|
296
|
+
if (showSearch) {
|
|
297
|
+
onSearch === null || onSearch === void 0 || onSearch('');
|
|
298
|
+
setSearchValue('');
|
|
299
|
+
}
|
|
214
300
|
}
|
|
215
301
|
_onFocus === null || _onFocus === void 0 || _onFocus(e);
|
|
216
302
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { SelectProps } from 'antd';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { ProFieldRequestData, ProFieldValueEnumType, RequestOptionsType } from '../../../utils';
|
|
5
4
|
import type { ProFieldLightProps } from '../../PureProField';
|
|
@@ -18,7 +17,6 @@ export type FieldSelectProps<FieldProps = any> = {
|
|
|
18
17
|
fieldProps?: FieldProps;
|
|
19
18
|
variant?: 'outlined' | 'filled' | 'borderless';
|
|
20
19
|
id?: string;
|
|
21
|
-
children?: ReactNode;
|
|
22
20
|
/** 默认搜素条件 */
|
|
23
21
|
defaultKeyWords?: string;
|
|
24
22
|
} & ProFieldLightProps;
|
|
@@ -47,7 +45,6 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
|
|
|
47
45
|
fieldProps?: any;
|
|
48
46
|
variant?: "filled" | "outlined" | "borderless" | undefined;
|
|
49
47
|
id?: string | undefined;
|
|
50
|
-
children?: ReactNode;
|
|
51
48
|
/** 默认搜素条件 */
|
|
52
49
|
defaultKeyWords?: string | undefined;
|
|
53
50
|
} & ProFieldLightProps & Pick<SelectProps<any, import("antd/es/select").DefaultOptionType>, "style" | "className" | "fieldNames"> & React.RefAttributes<any>>;
|
|
@@ -5,7 +5,7 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
|
5
5
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
7
|
var _excluded = ["value", "text"],
|
|
8
|
-
_excluded2 = ["mode", "valueEnum", "render", "formItemRender", "request", "fieldProps", "
|
|
8
|
+
_excluded2 = ["mode", "valueEnum", "render", "formItemRender", "request", "fieldProps", "light", "proFieldKey", "params", "label", "variant", "id", "lightLabel", "labelTrigger"];
|
|
9
9
|
import { ConfigProvider, Spin } from 'antd';
|
|
10
10
|
import React, { useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
11
11
|
import useSWR from 'swr';
|
|
@@ -261,8 +261,6 @@ var FieldSelect = function FieldSelect(props, ref) {
|
|
|
261
261
|
formItemRender = props.formItemRender,
|
|
262
262
|
request = props.request,
|
|
263
263
|
fieldProps = props.fieldProps,
|
|
264
|
-
plain = props.plain,
|
|
265
|
-
children = props.children,
|
|
266
264
|
light = props.light,
|
|
267
265
|
proFieldKey = props.proFieldKey,
|
|
268
266
|
params = props.params,
|
|
@@ -368,6 +366,10 @@ var FieldSelect = function FieldSelect(props, ref) {
|
|
|
368
366
|
fetchData: function fetchData(keyWord) {
|
|
369
367
|
keyWordsRef.current = keyWord !== null && keyWord !== void 0 ? keyWord : '';
|
|
370
368
|
_fetchData(keyWord);
|
|
369
|
+
// 当 keyWord 为 undefined 时,清空 keyWordsRef 以确保 filterOption 不进行过滤
|
|
370
|
+
if (keyWord === undefined) {
|
|
371
|
+
keyWordsRef.current = '';
|
|
372
|
+
}
|
|
371
373
|
},
|
|
372
374
|
resetData: resetData,
|
|
373
375
|
optionItemRender: function optionItemRender(item) {
|
|
@@ -27,7 +27,6 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
|
|
|
27
27
|
fieldProps?: any;
|
|
28
28
|
variant?: "filled" | "outlined" | "borderless" | undefined;
|
|
29
29
|
id?: string | undefined;
|
|
30
|
-
children?: React.ReactNode;
|
|
31
30
|
defaultKeyWords?: string | undefined;
|
|
32
31
|
} & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
|
|
33
32
|
export default _default;
|
|
@@ -6,7 +6,10 @@ import type { FieldProps, ProFormGridConfig, ProFormGroupProps } from '../typing
|
|
|
6
6
|
import type { SubmitterProps } from './Submitter';
|
|
7
7
|
export type ProFormInstance<T = any> = FormInstance<T> & ProFormInstanceType<T>;
|
|
8
8
|
type ProFormRef<T> = ProFormInstance<T> & {
|
|
9
|
+
/** 原生 DOM 元素引用 */
|
|
9
10
|
nativeElement?: HTMLElement;
|
|
11
|
+
/** 聚焦方法 */
|
|
12
|
+
focus?: () => void;
|
|
10
13
|
};
|
|
11
14
|
export type CommonFormProps<T = Record<string, any>, U = Record<string, any>> = {
|
|
12
15
|
/**
|