fan-standard-comp 4.0.7 → 4.0.8
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/fan-standard-comp.min.js +1 -1
- package/es/FormComp/VarTemplate/index.js +27 -9
- package/es/FormComp/index.d.ts +1 -0
- package/es/FormComp/index.js +3 -1
- package/es/StandardContent/ContentHeader.d.ts +3 -1
- package/es/StandardContent/ContentHeader.js +29 -7
- package/es/StandardContent/SubfieldContent.d.ts +1 -1
- package/es/StandardContent/SubfieldContent.js +19 -4
- package/es/StandardContent/WrapperContent.d.ts +1 -1
- package/es/StandardContent/WrapperContent.js +21 -9
- package/es/StandardContent/styles/Header.js +21 -3
- package/es/StandardContent/styles/Wrapper.js +1 -0
- package/es/StandardForm/index.js +36 -36
- package/es/StandardModal/index.js +62 -62
- package/es/StandardModal/style/index.js +3 -1
- package/es/StandardPanel/index.d.ts +1 -0
- package/es/StandardPanel/index.js +8 -7
- package/es/StandardPanel/style/index.js +9 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/lib/FormComp/VarTemplate/index.js +27 -9
- package/lib/FormComp/index.d.ts +1 -0
- package/lib/FormComp/index.js +7 -0
- package/lib/StandardContent/ContentHeader.d.ts +3 -1
- package/lib/StandardContent/ContentHeader.js +28 -7
- package/lib/StandardContent/SubfieldContent.d.ts +1 -1
- package/lib/StandardContent/SubfieldContent.js +18 -3
- package/lib/StandardContent/WrapperContent.d.ts +1 -1
- package/lib/StandardContent/WrapperContent.js +20 -8
- package/lib/StandardContent/styles/Header.js +21 -3
- package/lib/StandardContent/styles/Wrapper.js +1 -0
- package/lib/StandardForm/index.js +36 -36
- package/lib/StandardModal/index.js +62 -62
- package/lib/StandardModal/style/index.js +3 -1
- package/lib/StandardPanel/index.d.ts +1 -0
- package/lib/StandardPanel/index.js +8 -7
- package/lib/StandardPanel/style/index.js +9 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +8 -0
- package/package.json +1 -1
|
@@ -197,27 +197,39 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
|
|
|
197
197
|
size = _this$props.size,
|
|
198
198
|
style = _this$props.style,
|
|
199
199
|
tags = _this$props.tags,
|
|
200
|
-
disabled = _this$props.disabled
|
|
200
|
+
disabled = _this$props.disabled,
|
|
201
|
+
fieldStatus = _this$props.fieldStatus,
|
|
202
|
+
_this$props$tagsOptio = _this$props.tagsOptionName,
|
|
203
|
+
tagsOptionName = _this$props$tagsOptio === void 0 ? {
|
|
204
|
+
key: 'key',
|
|
205
|
+
label: 'label',
|
|
206
|
+
value: 'value'
|
|
207
|
+
} : _this$props$tagsOptio,
|
|
208
|
+
showCountTip = _this$props.showCountTip;
|
|
201
209
|
var _this$state3 = this.state,
|
|
202
210
|
currentContent = _this$state3.currentContent,
|
|
203
211
|
wordCount = _this$state3.wordCount;
|
|
204
212
|
return /*#__PURE__*/React.createElement("div", {
|
|
205
|
-
className: "vart-wrap",
|
|
213
|
+
className: "spec-vart-wrap",
|
|
206
214
|
style: style,
|
|
207
215
|
ref: function ref(cRef) {
|
|
208
216
|
_this2.content = cRef;
|
|
209
217
|
}
|
|
210
218
|
}, tags && Array.isArray(tags) && /*#__PURE__*/React.createElement("div", {
|
|
211
|
-
className: "vart-header"
|
|
219
|
+
className: "spec-vart-header"
|
|
212
220
|
}, tags.map(function (item) {
|
|
213
221
|
return /*#__PURE__*/React.createElement(Tag, {
|
|
214
|
-
|
|
222
|
+
style: {
|
|
223
|
+
marginBottom: '4px',
|
|
224
|
+
cursor: 'pointer'
|
|
225
|
+
},
|
|
226
|
+
key: item[tagsOptionName === null || tagsOptionName === void 0 ? void 0 : tagsOptionName.key],
|
|
215
227
|
onClick: function onClick() {
|
|
216
|
-
return !disabled && _this2.setTagWords(item.
|
|
228
|
+
return !(disabled || fieldStatus === 'disabled') && _this2.setTagWords(item[tagsOptionName === null || tagsOptionName === void 0 ? void 0 : tagsOptionName.value]);
|
|
217
229
|
}
|
|
218
|
-
}, item.
|
|
230
|
+
}, item[tagsOptionName === null || tagsOptionName === void 0 ? void 0 : tagsOptionName.label]);
|
|
219
231
|
})), /*#__PURE__*/React.createElement("div", {
|
|
220
|
-
className: "vart-input"
|
|
232
|
+
className: "spec-vart-input"
|
|
221
233
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
222
234
|
type: "text",
|
|
223
235
|
size: size,
|
|
@@ -228,8 +240,14 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
|
|
|
228
240
|
onChange: function onChange(e) {
|
|
229
241
|
return _this2.handleInputChange(e);
|
|
230
242
|
},
|
|
231
|
-
disabled: disabled
|
|
232
|
-
}))
|
|
243
|
+
disabled: disabled || fieldStatus === 'disabled'
|
|
244
|
+
})), showCountTip && /*#__PURE__*/React.createElement("div", {
|
|
245
|
+
className: "spec-vart-desc",
|
|
246
|
+
style: {
|
|
247
|
+
marginTop: '4px',
|
|
248
|
+
fontSize: '12px'
|
|
249
|
+
}
|
|
250
|
+
}, " \u60A8\u5DF2\u5F55\u5165 ", /*#__PURE__*/React.createElement("b", null, wordCount), " \u4E2A\u5B57"));
|
|
233
251
|
}
|
|
234
252
|
}], [{
|
|
235
253
|
key: "getDerivedStateFromProps",
|
package/es/FormComp/index.d.ts
CHANGED
package/es/FormComp/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface ContentHeaderProps {
|
|
3
3
|
title?: string | React.ReactNode;
|
|
4
|
-
breadcrumb?: object;
|
|
4
|
+
breadcrumb?: object | any;
|
|
5
5
|
componentName?: string;
|
|
6
|
+
extra?: React.ReactNode;
|
|
7
|
+
fixed?: Boolean;
|
|
6
8
|
[key: string]: any;
|
|
7
9
|
}
|
|
8
10
|
declare const ContentHeader: React.ForwardRefExoticComponent<Omit<ContentHeaderProps, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
1
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
8
|
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."); }
|
|
3
9
|
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); }
|
|
@@ -23,10 +29,12 @@ var Child = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
23
29
|
return /*#__PURE__*/React.createElement("div", null, "Count: ", count);
|
|
24
30
|
});
|
|
25
31
|
var ContentHeader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
32
|
+
var _breadcrumb$items;
|
|
26
33
|
var breadcrumb = props.breadcrumb,
|
|
27
34
|
className = props.className,
|
|
28
35
|
title = props.title,
|
|
29
|
-
getClientHeight = props.getClientHeight
|
|
36
|
+
getClientHeight = props.getClientHeight,
|
|
37
|
+
extra = props.extra;
|
|
30
38
|
var componentName = 'spec-content-header';
|
|
31
39
|
var _useStyle = useStyle(componentName),
|
|
32
40
|
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
@@ -46,12 +54,21 @@ var ContentHeader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
46
54
|
setVisible(true);
|
|
47
55
|
}
|
|
48
56
|
}, [title, breadcrumb]);
|
|
57
|
+
|
|
58
|
+
// useImperativeHandle(ref, () => headerRef.current, [headerRef, breadcrumb, title]);
|
|
59
|
+
// useLayoutEffect(() => {
|
|
60
|
+
// if (headerRef.current) {
|
|
61
|
+
// // 确保在 DOM 更新后执行的逻辑
|
|
62
|
+
// // console.log('更新后执行的逻辑', contentRef.current)
|
|
63
|
+
// }
|
|
64
|
+
// });
|
|
65
|
+
|
|
49
66
|
useImperativeHandle(ref, function () {
|
|
50
|
-
return {
|
|
67
|
+
return _objectSpread({
|
|
51
68
|
getClientHeight: function getClientHeight() {
|
|
52
69
|
return clientHeight;
|
|
53
70
|
}
|
|
54
|
-
};
|
|
71
|
+
}, headerRef.current);
|
|
55
72
|
}, [clientHeight]);
|
|
56
73
|
useEffect(function () {
|
|
57
74
|
if (visible && headerRef.current) {
|
|
@@ -62,18 +79,23 @@ var ContentHeader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
62
79
|
useEffect(function () {
|
|
63
80
|
getClientHeight && getClientHeight(clientHeight);
|
|
64
81
|
}, [clientHeight]);
|
|
82
|
+
|
|
65
83
|
// ref 的转发
|
|
66
84
|
// 将需要暴露给父组件的属性或方法定义在这个函数中
|
|
67
85
|
// useImperativeHandle(ref, () => headerRef.current, [headerRef, breadcrumb, title]);
|
|
68
86
|
|
|
69
87
|
// @ts-ignore
|
|
70
88
|
return wrapSSR( /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
className: classNames(className, componentName, hashId),
|
|
89
|
+
className: classNames(className, componentName, !title ? componentName + '-no-title' : '', hashId),
|
|
72
90
|
ref: headerRef
|
|
73
|
-
}, breadcrumb ? /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
}, breadcrumb && breadcrumb !== null && breadcrumb !== void 0 && (_breadcrumb$items = breadcrumb.items) !== null && _breadcrumb$items !== void 0 && _breadcrumb$items.length ? /*#__PURE__*/React.createElement("div", {
|
|
74
92
|
className: componentName + '-breadcrumb'
|
|
75
|
-
}, /*#__PURE__*/React.createElement(Breadcrumb, breadcrumb || {})) : null, title ? /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Breadcrumb, breadcrumb || {})) : null, title || extra ? /*#__PURE__*/React.createElement("div", {
|
|
76
94
|
className: componentName + '-title'
|
|
77
|
-
}, title
|
|
95
|
+
}, title && /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: componentName + '-title-name'
|
|
97
|
+
}, " ", title), extra && /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: componentName + '-title-extra'
|
|
99
|
+
}, " ", extra)) : null));
|
|
78
100
|
});
|
|
79
101
|
export default ContentHeader;
|
|
@@ -16,5 +16,5 @@ interface SubfieldContentProps {
|
|
|
16
16
|
header?: ContentHeaderProps;
|
|
17
17
|
[k: string]: any;
|
|
18
18
|
}
|
|
19
|
-
declare const SubfieldContent:
|
|
19
|
+
declare const SubfieldContent: React.ForwardRefExoticComponent<Omit<SubfieldContentProps, "ref"> & React.RefAttributes<unknown>>;
|
|
20
20
|
export default SubfieldContent;
|
|
@@ -11,7 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
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; }
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
13
|
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); }
|
|
14
|
-
import React, { useContext, useState } from 'react';
|
|
14
|
+
import React, { useContext, useRef, useState, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import { Spin } from 'antd';
|
|
17
17
|
import DragContent from "../DragContent";
|
|
@@ -19,7 +19,7 @@ import ContentHeader from "./ContentHeader";
|
|
|
19
19
|
import useStyle from "./styles/Subfield";
|
|
20
20
|
import "./styles/index.less";
|
|
21
21
|
import { FanContext } from "../ConfigContext";
|
|
22
|
-
var SubfieldContent = function
|
|
22
|
+
var SubfieldContent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
23
23
|
var _proLayoutProps$heade;
|
|
24
24
|
var InitFanContext = useContext(FanContext);
|
|
25
25
|
var providerConfig = InitFanContext['SubfieldContent'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
@@ -48,10 +48,25 @@ var SubfieldContent = function SubfieldContent(props) {
|
|
|
48
48
|
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
49
49
|
wrapSSR = _useStyle2[0],
|
|
50
50
|
hashId = _useStyle2[1];
|
|
51
|
+
var headerRef = useRef();
|
|
52
|
+
var contentRef = useRef();
|
|
53
|
+
useImperativeHandle(ref, function () {
|
|
54
|
+
return contentRef === null || contentRef === void 0 ? void 0 : contentRef.current;
|
|
55
|
+
});
|
|
56
|
+
// useImperativeHandle 是一个 React 钩子,它可以用来自定义使用 ref 时暴露给父组件的属性。如果你在自定义组件中使用 useImperativeHandle 来暴露一个方法,并且这个方法依赖于组件的 DOM 节点,比如 clientHeight,那么你可能会遇到在组件挂载之初调用这个方法时取不到 clientHeight 的问题,因为 DOM 节点可能还没有被渲染。
|
|
57
|
+
// 解决这个问题的方法是确保在调用这个方法之前 DOM 节点已经被渲染。你可以通过使用 useLayoutEffect 来确保你的方法在 DOM 更新后执行,例如
|
|
58
|
+
useLayoutEffect(function () {
|
|
59
|
+
if (contentRef.current) {
|
|
60
|
+
// 确保在 DOM 更新后执行的逻辑
|
|
61
|
+
// console.log('更新后执行的逻辑', contentRef.current)
|
|
62
|
+
}
|
|
63
|
+
});
|
|
51
64
|
return wrapSSR( /*#__PURE__*/React.createElement("div", {
|
|
52
65
|
className: classNames(componentName, className, hashId),
|
|
53
|
-
style: style
|
|
66
|
+
style: style,
|
|
67
|
+
ref: contentRef
|
|
54
68
|
}, proLayoutProps !== null && proLayoutProps !== void 0 && proLayoutProps.header || header ? /*#__PURE__*/React.createElement(ContentHeader, _extends({
|
|
69
|
+
ref: headerRef,
|
|
55
70
|
getClientHeight: setHeaderHeight,
|
|
56
71
|
className: classNames('spec-grid-content-header', proLayoutProps !== null && proLayoutProps !== void 0 && (_proLayoutProps$heade = proLayoutProps.header) !== null && _proLayoutProps$heade !== void 0 && _proLayoutProps$heade.fixed || header !== null && header !== void 0 && header.fixed ? 'spec-grid-content-header-fixed' : '')
|
|
57
72
|
}, (proLayoutProps === null || proLayoutProps === void 0 ? void 0 : proLayoutProps.header) || {}, header || {})) : null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -74,5 +89,5 @@ var SubfieldContent = function SubfieldContent(props) {
|
|
|
74
89
|
tip: loadingTip,
|
|
75
90
|
wrapperClassName: 'spec-grid-content-spinning'
|
|
76
91
|
}, children)))));
|
|
77
|
-
};
|
|
92
|
+
});
|
|
78
93
|
export default SubfieldContent;
|
|
@@ -11,5 +11,5 @@ interface WrapperContentProps {
|
|
|
11
11
|
light?: boolean;
|
|
12
12
|
header?: ContentHeaderProps;
|
|
13
13
|
}
|
|
14
|
-
declare const WrapperContent:
|
|
14
|
+
declare const WrapperContent: React.ForwardRefExoticComponent<WrapperContentProps & React.RefAttributes<unknown>>;
|
|
15
15
|
export default WrapperContent;
|
|
@@ -11,14 +11,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
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; }
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
13
|
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); }
|
|
14
|
-
import React, { useContext, useRef, useState } from 'react';
|
|
14
|
+
import React, { forwardRef, useContext, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import { Spin } from 'antd';
|
|
17
17
|
import "./styles/index.less";
|
|
18
18
|
import useStyle from "./styles/Wrapper";
|
|
19
19
|
import { FanContext } from "../ConfigContext";
|
|
20
20
|
import ContentHeader from "./ContentHeader";
|
|
21
|
-
var WrapperContent = function
|
|
21
|
+
var WrapperContent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
22
22
|
var _proLayoutProps$heade, _proLayoutProps$heade2;
|
|
23
23
|
var InitFanContext = useContext(FanContext);
|
|
24
24
|
var providerConfig = InitFanContext['SubfieldContent'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
@@ -43,12 +43,23 @@ var WrapperContent = function WrapperContent(props) {
|
|
|
43
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
44
|
headerHeight = _useState2[0],
|
|
45
45
|
setHeaderHeight = _useState2[1];
|
|
46
|
-
var
|
|
46
|
+
var contentRef = useRef();
|
|
47
|
+
useImperativeHandle(ref, function () {
|
|
48
|
+
return contentRef === null || contentRef === void 0 ? void 0 : contentRef.current;
|
|
49
|
+
});
|
|
50
|
+
// useImperativeHandle 是一个 React 钩子,它可以用来自定义使用 ref 时暴露给父组件的属性。如果你在自定义组件中使用 useImperativeHandle 来暴露一个方法,并且这个方法依赖于组件的 DOM 节点,比如 clientHeight,那么你可能会遇到在组件挂载之初调用这个方法时取不到 clientHeight 的问题,因为 DOM 节点可能还没有被渲染。
|
|
51
|
+
// 解决这个问题的方法是确保在调用这个方法之前 DOM 节点已经被渲染。你可以通过使用 useLayoutEffect 来确保你的方法在 DOM 更新后执行,例如
|
|
52
|
+
useLayoutEffect(function () {
|
|
53
|
+
if (contentRef.current) {
|
|
54
|
+
// 确保在 DOM 更新后执行的逻辑
|
|
55
|
+
// console.log('更新后执行的逻辑', contentRef.current)
|
|
56
|
+
}
|
|
57
|
+
});
|
|
47
58
|
return wrapSSR( /*#__PURE__*/React.createElement("div", {
|
|
48
59
|
className: classNames(componentName, className, noMargin ? 'has-margin' : '', hashId),
|
|
49
|
-
style: style
|
|
60
|
+
style: style,
|
|
61
|
+
ref: contentRef
|
|
50
62
|
}, proLayoutProps !== null && proLayoutProps !== void 0 && proLayoutProps.header || header ? /*#__PURE__*/React.createElement(ContentHeader, _extends({
|
|
51
|
-
ref: headerRef,
|
|
52
63
|
getClientHeight: setHeaderHeight,
|
|
53
64
|
className: classNames('spec-wrapper-content-header', proLayoutProps !== null && proLayoutProps !== void 0 && (_proLayoutProps$heade = proLayoutProps.header) !== null && _proLayoutProps$heade !== void 0 && _proLayoutProps$heade.fixed || header !== null && header !== void 0 && header.fixed ? 'spec-wrapper-content-header-fixed' : '')
|
|
54
65
|
}, (proLayoutProps === null || proLayoutProps === void 0 ? void 0 : proLayoutProps.header) || {}, header || {})) : null, light ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -61,13 +72,14 @@ var WrapperContent = function WrapperContent(props) {
|
|
|
61
72
|
wrapperClassName: 'spec-wrapper-content-spinning'
|
|
62
73
|
}, " ", children))) : /*#__PURE__*/React.createElement("div", {
|
|
63
74
|
className: 'spec-wrapper-content-body',
|
|
64
|
-
style: {
|
|
65
|
-
height:
|
|
66
|
-
|
|
75
|
+
style: proLayoutProps !== null && proLayoutProps !== void 0 && (_proLayoutProps$heade2 = proLayoutProps.header) !== null && _proLayoutProps$heade2 !== void 0 && _proLayoutProps$heade2.fixed || header !== null && header !== void 0 && header.fixed ? {
|
|
76
|
+
height: "calc(100% - ".concat(headerHeight ? headerHeight + 20 : 0, "px)"),
|
|
77
|
+
overflow: 'auto'
|
|
78
|
+
} : {}
|
|
67
79
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
68
80
|
spinning: loading,
|
|
69
81
|
tip: loadingTip,
|
|
70
82
|
wrapperClassName: 'spec-wrapper-content-spinning'
|
|
71
83
|
}, " ", children, " "))));
|
|
72
|
-
};
|
|
84
|
+
});
|
|
73
85
|
export default WrapperContent;
|
|
@@ -13,18 +13,36 @@ var SubfieldContentStyleFunc = function SubfieldContentStyleFunc(prefix) {
|
|
|
13
13
|
var prefixCls = ".".concat(prefix);
|
|
14
14
|
// console.log(' new TinyColor(token.colorPrimary).setAlpha(0.1)' ,new TinyColor(token.colorPrimary).setAlpha(0.1).toRgbString(), )
|
|
15
15
|
return [_defineProperty({}, prefixCls, {
|
|
16
|
-
marginBottom: token.marginMD,
|
|
16
|
+
// marginBottom: token.marginMD,
|
|
17
|
+
'&.spec-content-header-no-title': {
|
|
18
|
+
'.spec-content-header-breadcrumb': {
|
|
19
|
+
marginBottom: token.marginMD
|
|
20
|
+
}
|
|
21
|
+
},
|
|
17
22
|
'.spec-content-header-breadcrumb': {
|
|
18
|
-
height: '
|
|
23
|
+
height: '22px',
|
|
19
24
|
'& +.spec-content-header-title': {
|
|
20
25
|
marginTop: token.marginXS
|
|
21
26
|
// marginTop: token.margin
|
|
22
27
|
}
|
|
23
28
|
},
|
|
24
29
|
'.spec-content-header-title': {
|
|
30
|
+
marginBottom: token.marginMD,
|
|
31
|
+
display: 'flex',
|
|
32
|
+
alignItems: 'center'
|
|
33
|
+
},
|
|
34
|
+
'.spec-content-header-title-name': {
|
|
25
35
|
fontSize: token.fontSizeLG,
|
|
26
36
|
fontWeight: 'bold',
|
|
27
|
-
lineHeight: '20px'
|
|
37
|
+
lineHeight: '20px',
|
|
38
|
+
flex: 1,
|
|
39
|
+
'& + .spec-content-header-title-extra': {
|
|
40
|
+
paddingLeft: token.paddingMD
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
'.spec-content-header-title-extra': {
|
|
44
|
+
// flex: 1,
|
|
45
|
+
textAlign: 'right'
|
|
28
46
|
}
|
|
29
47
|
})];
|
|
30
48
|
}, prepareComponentToken // 当前组件扩展的变量
|
|
@@ -17,6 +17,7 @@ var WrapperContentStyleFunc = function WrapperContentStyleFunc(prefix) {
|
|
|
17
17
|
return [_defineProperty(_defineProperty(_defineProperty({}, prefixCls, _objectSpread(_objectSpread({
|
|
18
18
|
position: 'relative',
|
|
19
19
|
padding: token.paddingMD,
|
|
20
|
+
margin: -token.marginMD,
|
|
20
21
|
background: token.colorBgLayout,
|
|
21
22
|
height: '100%',
|
|
22
23
|
overflow: 'auto'
|
package/es/StandardForm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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); }
|
|
2
1
|
var _excluded = ["formItemGroup", "className", "initialValues", "layout", "grid", "getFormFields", "fieldStatus", "onSubmit", "confirmText", "onCancel", "cancelText", "confirmButtonProps", "cancelButtonProps", "actionAlign", "actionGroup", "onFinishFailed", "children", "prefix", "postfix", "fieldSize", "displayLayout", "itemGroupConfig"];
|
|
2
|
+
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); }
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
5
|
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."); }
|
|
@@ -7,13 +7,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
7
7
|
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; }
|
|
8
8
|
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; } }
|
|
9
9
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
12
|
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; }
|
|
11
13
|
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; }
|
|
12
14
|
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; }
|
|
13
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
16
|
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); }
|
|
15
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
17
|
import React, { useContext, useEffect, useMemo } from 'react';
|
|
18
18
|
import { Form, Button } from 'antd';
|
|
19
19
|
import classNames from 'classnames';
|
|
@@ -26,38 +26,38 @@ import { FanContext } from "../ConfigContext";
|
|
|
26
26
|
var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
27
27
|
var InitFanContext = useContext(FanContext);
|
|
28
28
|
var providerConfig = InitFanContext['StandardForm'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
formItemGroup =
|
|
32
|
-
className =
|
|
33
|
-
initialValues =
|
|
34
|
-
|
|
35
|
-
layout =
|
|
36
|
-
|
|
37
|
-
grid =
|
|
38
|
-
getFormFields =
|
|
39
|
-
fieldStatus =
|
|
40
|
-
onSubmit =
|
|
41
|
-
|
|
42
|
-
confirmText =
|
|
43
|
-
onCancel =
|
|
44
|
-
|
|
45
|
-
cancelText =
|
|
46
|
-
|
|
47
|
-
confirmButtonProps =
|
|
48
|
-
|
|
49
|
-
cancelButtonProps =
|
|
50
|
-
actionAlign =
|
|
51
|
-
actionGroup =
|
|
52
|
-
onFinishFailed =
|
|
53
|
-
children =
|
|
54
|
-
prefix =
|
|
55
|
-
postfix =
|
|
56
|
-
fieldSize =
|
|
57
|
-
displayLayout =
|
|
58
|
-
|
|
59
|
-
itemGroupConfig =
|
|
60
|
-
baseProps = _objectWithoutProperties(
|
|
29
|
+
var ConcatFormProps = _objectSpread(_objectSpread({}, providerConfig), props);
|
|
30
|
+
var _ConcatFormProps$form = ConcatFormProps.formItemGroup,
|
|
31
|
+
formItemGroup = _ConcatFormProps$form === void 0 ? [] : _ConcatFormProps$form,
|
|
32
|
+
className = ConcatFormProps.className,
|
|
33
|
+
initialValues = ConcatFormProps.initialValues,
|
|
34
|
+
_ConcatFormProps$layo = ConcatFormProps.layout,
|
|
35
|
+
layout = _ConcatFormProps$layo === void 0 ? 'horizontal' : _ConcatFormProps$layo,
|
|
36
|
+
_ConcatFormProps$grid = ConcatFormProps.grid,
|
|
37
|
+
grid = _ConcatFormProps$grid === void 0 ? 1 : _ConcatFormProps$grid,
|
|
38
|
+
getFormFields = ConcatFormProps.getFormFields,
|
|
39
|
+
fieldStatus = ConcatFormProps.fieldStatus,
|
|
40
|
+
onSubmit = ConcatFormProps.onSubmit,
|
|
41
|
+
_ConcatFormProps$conf = ConcatFormProps.confirmText,
|
|
42
|
+
confirmText = _ConcatFormProps$conf === void 0 ? '确认' : _ConcatFormProps$conf,
|
|
43
|
+
onCancel = ConcatFormProps.onCancel,
|
|
44
|
+
_ConcatFormProps$canc = ConcatFormProps.cancelText,
|
|
45
|
+
cancelText = _ConcatFormProps$canc === void 0 ? '取消' : _ConcatFormProps$canc,
|
|
46
|
+
_ConcatFormProps$conf2 = ConcatFormProps.confirmButtonProps,
|
|
47
|
+
confirmButtonProps = _ConcatFormProps$conf2 === void 0 ? {} : _ConcatFormProps$conf2,
|
|
48
|
+
_ConcatFormProps$canc2 = ConcatFormProps.cancelButtonProps,
|
|
49
|
+
cancelButtonProps = _ConcatFormProps$canc2 === void 0 ? {} : _ConcatFormProps$canc2,
|
|
50
|
+
actionAlign = ConcatFormProps.actionAlign,
|
|
51
|
+
actionGroup = ConcatFormProps.actionGroup,
|
|
52
|
+
onFinishFailed = ConcatFormProps.onFinishFailed,
|
|
53
|
+
children = ConcatFormProps.children,
|
|
54
|
+
prefix = ConcatFormProps.prefix,
|
|
55
|
+
postfix = ConcatFormProps.postfix,
|
|
56
|
+
fieldSize = ConcatFormProps.fieldSize,
|
|
57
|
+
displayLayout = ConcatFormProps.displayLayout,
|
|
58
|
+
_ConcatFormProps$item = ConcatFormProps.itemGroupConfig,
|
|
59
|
+
itemGroupConfig = _ConcatFormProps$item === void 0 ? {} : _ConcatFormProps$item,
|
|
60
|
+
baseProps = _objectWithoutProperties(ConcatFormProps, _excluded);
|
|
61
61
|
var componentName = 'spec-standard-form';
|
|
62
62
|
var _useStyle = useStyle(componentName),
|
|
63
63
|
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
@@ -130,7 +130,7 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
130
130
|
list: actionGroup,
|
|
131
131
|
form: initForm,
|
|
132
132
|
align: actionAlign,
|
|
133
|
-
other:
|
|
133
|
+
other: ConcatFormProps
|
|
134
134
|
}));
|
|
135
135
|
}
|
|
136
136
|
return actionGroup;
|