fan-standard-comp 4.0.6 → 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.css +1 -1
- package/dist/fan-standard-comp.min.js +1 -1
- package/es/ButtonGroup/index.d.ts +2 -0
- package/es/ButtonGroup/index.js +31 -18
- package/es/ButtonGroup/styles/index.js +9 -1
- package/es/DragContent/index.js +1 -1
- package/es/DragContent/index.less +2 -3
- 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 +11 -0
- package/es/StandardContent/ContentHeader.js +101 -0
- package/es/StandardContent/SubfieldContent.d.ts +3 -1
- package/es/StandardContent/SubfieldContent.js +65 -23
- package/es/StandardContent/WrapperContent.d.ts +3 -1
- package/es/StandardContent/WrapperContent.js +66 -19
- package/es/StandardContent/styles/Header.d.ts +6 -0
- package/es/StandardContent/styles/Header.js +51 -0
- package/es/StandardContent/styles/Subfield.js +22 -4
- package/es/StandardContent/styles/Wrapper.js +8 -3
- package/es/StandardContent/styles/index.less +11 -11
- package/es/StandardForm/index.js +36 -36
- package/es/StandardForm/style/index.less +1 -1
- package/es/StandardModal/index.js +62 -62
- package/es/StandardModal/style/index.js +8 -4
- package/es/StandardModal/style/index.less +5 -5
- 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/StandardTable/index.js +9 -9
- package/es/StandardTable/style/index.js +1 -1
- package/es/components/IconNode/index.d.ts +1 -0
- package/es/components/IconNode/index.js +6 -3
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/theme/index.js +4 -4
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +3 -1
- package/es/utils/regExp.js +111 -0
- package/lib/ButtonGroup/index.d.ts +2 -0
- package/lib/ButtonGroup/index.js +31 -18
- package/lib/ButtonGroup/styles/index.js +9 -1
- package/lib/DragContent/index.js +1 -1
- package/lib/DragContent/index.less +2 -3
- 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 +11 -0
- package/lib/StandardContent/ContentHeader.js +110 -0
- package/lib/StandardContent/SubfieldContent.d.ts +3 -1
- package/lib/StandardContent/SubfieldContent.js +67 -23
- package/lib/StandardContent/WrapperContent.d.ts +3 -1
- package/lib/StandardContent/WrapperContent.js +68 -19
- package/lib/StandardContent/styles/Header.d.ts +6 -0
- package/lib/StandardContent/styles/Header.js +57 -0
- package/lib/StandardContent/styles/Subfield.js +22 -4
- package/lib/StandardContent/styles/Wrapper.js +8 -3
- package/lib/StandardContent/styles/index.less +11 -11
- package/lib/StandardForm/index.js +36 -36
- package/lib/StandardForm/style/index.less +1 -1
- package/lib/StandardModal/index.js +62 -62
- package/lib/StandardModal/style/index.js +8 -4
- package/lib/StandardModal/style/index.less +5 -5
- 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/StandardTable/index.js +9 -9
- package/lib/StandardTable/style/index.js +1 -1
- package/lib/components/IconNode/index.d.ts +1 -0
- package/lib/components/IconNode/index.js +6 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.js +8 -0
- package/lib/theme/index.js +4 -4
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +11 -0
- package/lib/utils/regExp.js +116 -0
- package/package.json +1 -1
|
@@ -35,6 +35,8 @@ interface ButtonGroupProps {
|
|
|
35
35
|
dropdownConfig?: Object;
|
|
36
36
|
moreText?: string;
|
|
37
37
|
moreIcon?: React.ReactNode | string | number;
|
|
38
|
+
size?: any;
|
|
39
|
+
showTextIcon?: boolean;
|
|
38
40
|
}
|
|
39
41
|
declare const ButtonGroup: (props: ButtonGroupProps) => any;
|
|
40
42
|
export default ButtonGroup;
|
package/es/ButtonGroup/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["code", "fn", "exName", "name", "children", "icon"],
|
|
1
|
+
var _excluded = ["code", "fn", "exName", "name", "children", "icon", "confirmText", "confirmConfig", "render"],
|
|
2
2
|
_excluded2 = ["exName", "name", "type", "icon", "ghost", "danger", "disabled", "loading", "fn", "code", "rowParams", "isHide"],
|
|
3
3
|
_excluded3 = ["code", "fn", "exName", "name", "children", "icon", "confirmText", "confirmConfig"];
|
|
4
4
|
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); }
|
|
@@ -51,7 +51,11 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
51
51
|
dropdownConfig = _providerConfig$props4 === void 0 ? {} : _providerConfig$props4,
|
|
52
52
|
_providerConfig$props5 = _providerConfig$props.moreText,
|
|
53
53
|
moreText = _providerConfig$props5 === void 0 ? '更多' : _providerConfig$props5,
|
|
54
|
-
|
|
54
|
+
_providerConfig$props6 = _providerConfig$props.size,
|
|
55
|
+
size = _providerConfig$props6 === void 0 ? 'default' : _providerConfig$props6,
|
|
56
|
+
moreIcon = _providerConfig$props.moreIcon,
|
|
57
|
+
_providerConfig$props7 = _providerConfig$props.showTextIcon,
|
|
58
|
+
showTextIcon = _providerConfig$props7 === void 0 ? false : _providerConfig$props7;
|
|
55
59
|
var _props$options = props.options,
|
|
56
60
|
options = _props$options === void 0 ? [] : _props$options,
|
|
57
61
|
_props$min = props.min,
|
|
@@ -87,6 +91,9 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
87
91
|
name = vItem.name,
|
|
88
92
|
children = vItem.children,
|
|
89
93
|
icon = vItem.icon,
|
|
94
|
+
confirmText = vItem.confirmText,
|
|
95
|
+
confirmConfig = vItem.confirmConfig,
|
|
96
|
+
render = vItem.render,
|
|
90
97
|
others = _objectWithoutProperties(vItem, _excluded);
|
|
91
98
|
return _objectSpread(_objectSpread({}, others), {}, {
|
|
92
99
|
key: code ? code + i : i,
|
|
@@ -156,7 +163,9 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
156
163
|
},
|
|
157
164
|
placement: "bottomRight"
|
|
158
165
|
}, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement(Button, {
|
|
159
|
-
type: "primary"
|
|
166
|
+
type: "primary",
|
|
167
|
+
size: size
|
|
168
|
+
// icon={item?.icon ? <IconNode icon={item?.icon}/> : null}
|
|
160
169
|
}, item.exName || item.name, " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
161
170
|
name: "down"
|
|
162
171
|
})));
|
|
@@ -168,7 +177,8 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
168
177
|
loading: loading,
|
|
169
178
|
onClick: fn ? function () {
|
|
170
179
|
return fn(item);
|
|
171
|
-
} : null
|
|
180
|
+
} : null,
|
|
181
|
+
size: size
|
|
172
182
|
}, others, {
|
|
173
183
|
icon: icon ? /*#__PURE__*/React.createElement(IconNode, {
|
|
174
184
|
icon: icon
|
|
@@ -261,10 +271,12 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
261
271
|
}));
|
|
262
272
|
};
|
|
263
273
|
// 自定义渲染显示的文本
|
|
264
|
-
var renderCustomLabel = function renderCustomLabel(gItem) {
|
|
274
|
+
var renderCustomLabel = function renderCustomLabel(gItem, hideIcon) {
|
|
265
275
|
return gItem.render ? gItem.render.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
266
276
|
return rowParams[pItem];
|
|
267
|
-
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, gItem.icon
|
|
277
|
+
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, !hideIcon && gItem.icon && showTextIcon ? /*#__PURE__*/React.createElement(IconNode, {
|
|
278
|
+
icon: gItem.icon
|
|
279
|
+
}) : '', " ", gItem.exName || gItem.name);
|
|
268
280
|
};
|
|
269
281
|
// 递归转换原来的数组结构
|
|
270
282
|
var deepTransTextMenus = function deepTransTextMenus(groupArray) {
|
|
@@ -285,7 +297,13 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
285
297
|
danger: others.danger,
|
|
286
298
|
disabled: btnIsDisabled(others.disabled, rowParams),
|
|
287
299
|
key: code ? code + i : i,
|
|
288
|
-
|
|
300
|
+
icon: icon && showTextIcon ? /*#__PURE__*/React.createElement(IconNode, {
|
|
301
|
+
icon: icon,
|
|
302
|
+
style: {
|
|
303
|
+
marginRight: '4px'
|
|
304
|
+
}
|
|
305
|
+
}) : null,
|
|
306
|
+
// 不显示图标
|
|
289
307
|
label: /*#__PURE__*/React.createElement("a", {
|
|
290
308
|
onClick: function onClick() {
|
|
291
309
|
// 配置二次确认
|
|
@@ -298,7 +316,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
298
316
|
})));
|
|
299
317
|
}
|
|
300
318
|
}
|
|
301
|
-
}, renderCustomLabel(vItem)),
|
|
319
|
+
}, renderCustomLabel(vItem, true)),
|
|
302
320
|
title: vItem.exName || vItem.name,
|
|
303
321
|
children: children && children.length > 0 ? deepTransTextMenus(children) : undefined
|
|
304
322
|
};
|
|
@@ -315,9 +333,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
315
333
|
placement: "bottomRight"
|
|
316
334
|
}, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement("a", {
|
|
317
335
|
className: 'spec-button-group-text'
|
|
318
|
-
}, item
|
|
319
|
-
return rowParams[pItem];
|
|
320
|
-
}))) : item.exName || item.name, " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
336
|
+
}, renderCustomLabel(item, true), " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
321
337
|
name: "down"
|
|
322
338
|
})));
|
|
323
339
|
}
|
|
@@ -356,9 +372,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
356
372
|
// @ts-ignore
|
|
357
373
|
,
|
|
358
374
|
disabled: btnIsDisabled(item.disabled, rowParams)
|
|
359
|
-
}, item
|
|
360
|
-
return rowParams[pItem];
|
|
361
|
-
}))) : item.exName || item.name)) : /*#__PURE__*/React.createElement("a", {
|
|
375
|
+
}, renderCustomLabel(item))) : /*#__PURE__*/React.createElement("a", {
|
|
362
376
|
className: 'spec-button-group-text',
|
|
363
377
|
title: item.exName || item.name,
|
|
364
378
|
key: item.index
|
|
@@ -370,9 +384,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
370
384
|
return rowParams[pItem];
|
|
371
385
|
})));
|
|
372
386
|
} : undefined
|
|
373
|
-
},
|
|
374
|
-
return rowParams[pItem];
|
|
375
|
-
}))) : item.exName || item.name));
|
|
387
|
+
}, renderCustomLabel(item)));
|
|
376
388
|
};
|
|
377
389
|
var RenderCustomNode = function RenderCustomNode(item) {
|
|
378
390
|
var render = item.render,
|
|
@@ -432,7 +444,8 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
432
444
|
},
|
|
433
445
|
placement: "bottomRight"
|
|
434
446
|
}, dropdownConfig), /*#__PURE__*/React.createElement(Button, {
|
|
435
|
-
type: "primary"
|
|
447
|
+
type: "primary",
|
|
448
|
+
size: size
|
|
436
449
|
}, moreText || '更多', moreIcon || /*#__PURE__*/React.createElement(DownOutlined, null))) : /*#__PURE__*/React.createElement(Popconfirm, _extends({
|
|
437
450
|
placement: "topRight",
|
|
438
451
|
open: popVisibleIndex === rowParams.rowIndex,
|
|
@@ -48,13 +48,21 @@ var SpecButtonGroupStyleFunc = function SpecButtonGroupStyleFunc(prefix) {
|
|
|
48
48
|
return [_defineProperty({}, prefixCls, _objectSpread({
|
|
49
49
|
display: 'inline-block',
|
|
50
50
|
verticalAlign: 'middle',
|
|
51
|
+
alignItems: 'center',
|
|
51
52
|
'> *': {
|
|
52
53
|
marginLeft: token.marginSM,
|
|
53
54
|
'&:first-child': {
|
|
54
55
|
marginLeft: 0
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
}, SpecButtonGroupTextStyle(prefixCls, SpecButtonGroupToken)))
|
|
58
|
+
}, SpecButtonGroupTextStyle(prefixCls, SpecButtonGroupToken))), {
|
|
59
|
+
'.ant-dropdown-menu-item': {
|
|
60
|
+
background: '#f00',
|
|
61
|
+
'.spec-icon + .ant-dropdown-menu-title-content': {
|
|
62
|
+
marginLeft: token.marginSM
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}];
|
|
58
66
|
}, prepareComponentToken // 当前组件扩展的变量
|
|
59
67
|
);
|
|
60
68
|
};
|
package/es/DragContent/index.js
CHANGED
|
@@ -143,7 +143,7 @@ var DragContent = function DragContent(props) {
|
|
|
143
143
|
};
|
|
144
144
|
return wrapSSR( /*#__PURE__*/React.createElement("div", {
|
|
145
145
|
ref: divRef,
|
|
146
|
-
className: classNames(componentName, hashId
|
|
146
|
+
className: classNames(className, componentName, hashId),
|
|
147
147
|
style: style
|
|
148
148
|
}, children, direction && direction.map(function (item, idx) {
|
|
149
149
|
return /*#__PURE__*/React.createElement(DragBar, {
|
|
@@ -8,16 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
.spec-grid-dragbar-left-horizontal{
|
|
10
10
|
height: 100%;
|
|
11
|
-
width:
|
|
11
|
+
width: 10px;
|
|
12
12
|
position: absolute;
|
|
13
13
|
left: 0;
|
|
14
14
|
top: 0;
|
|
15
15
|
cursor: col-resize;
|
|
16
|
-
|
|
17
16
|
}
|
|
18
17
|
.spec-grid-dragbar-right-horizontal{
|
|
19
18
|
height: 100%;
|
|
20
|
-
width:
|
|
19
|
+
width: 10px;
|
|
21
20
|
position: absolute;
|
|
22
21
|
right: 0;
|
|
23
22
|
top: 0;
|
|
@@ -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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ContentHeaderProps {
|
|
3
|
+
title?: string | React.ReactNode;
|
|
4
|
+
breadcrumb?: object | any;
|
|
5
|
+
componentName?: string;
|
|
6
|
+
extra?: React.ReactNode;
|
|
7
|
+
fixed?: Boolean;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
declare const ContentHeader: React.ForwardRefExoticComponent<Omit<ContentHeaderProps, "ref"> & React.RefAttributes<unknown>>;
|
|
11
|
+
export default ContentHeader;
|
|
@@ -0,0 +1,101 @@
|
|
|
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { forwardRef, useImperativeHandle, useRef, useEffect, useState } from 'react';
|
|
14
|
+
import { Breadcrumb } from "antd";
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import useStyle from "./styles/Header";
|
|
17
|
+
var Child = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
18
|
+
var _useState = useState(0),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
count = _useState2[0],
|
|
21
|
+
setCount = _useState2[1];
|
|
22
|
+
useImperativeHandle(ref, function () {
|
|
23
|
+
return {
|
|
24
|
+
getCurrentCount: function getCurrentCount() {
|
|
25
|
+
return count;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}, [count]);
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", null, "Count: ", count);
|
|
30
|
+
});
|
|
31
|
+
var ContentHeader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
32
|
+
var _breadcrumb$items;
|
|
33
|
+
var breadcrumb = props.breadcrumb,
|
|
34
|
+
className = props.className,
|
|
35
|
+
title = props.title,
|
|
36
|
+
getClientHeight = props.getClientHeight,
|
|
37
|
+
extra = props.extra;
|
|
38
|
+
var componentName = 'spec-content-header';
|
|
39
|
+
var _useStyle = useStyle(componentName),
|
|
40
|
+
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
41
|
+
wrapSSR = _useStyle2[0],
|
|
42
|
+
hashId = _useStyle2[1];
|
|
43
|
+
var _useState3 = useState(false),
|
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
|
+
visible = _useState4[0],
|
|
46
|
+
setVisible = _useState4[1];
|
|
47
|
+
var _useState5 = useState(0),
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
clientHeight = _useState6[0],
|
|
50
|
+
setClientHeight = _useState6[1];
|
|
51
|
+
var headerRef = useRef(null);
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
if (title || breadcrumb) {
|
|
54
|
+
setVisible(true);
|
|
55
|
+
}
|
|
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
|
+
|
|
66
|
+
useImperativeHandle(ref, function () {
|
|
67
|
+
return _objectSpread({
|
|
68
|
+
getClientHeight: function getClientHeight() {
|
|
69
|
+
return clientHeight;
|
|
70
|
+
}
|
|
71
|
+
}, headerRef.current);
|
|
72
|
+
}, [clientHeight]);
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
if (visible && headerRef.current) {
|
|
75
|
+
setClientHeight(headerRef.current.clientHeight);
|
|
76
|
+
// 使用 clientHeight
|
|
77
|
+
}
|
|
78
|
+
}, [visible]);
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
getClientHeight && getClientHeight(clientHeight);
|
|
81
|
+
}, [clientHeight]);
|
|
82
|
+
|
|
83
|
+
// ref 的转发
|
|
84
|
+
// 将需要暴露给父组件的属性或方法定义在这个函数中
|
|
85
|
+
// useImperativeHandle(ref, () => headerRef.current, [headerRef, breadcrumb, title]);
|
|
86
|
+
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
return wrapSSR( /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: classNames(className, componentName, !title ? componentName + '-no-title' : '', hashId),
|
|
90
|
+
ref: headerRef
|
|
91
|
+
}, breadcrumb && breadcrumb !== null && breadcrumb !== void 0 && (_breadcrumb$items = breadcrumb.items) !== null && _breadcrumb$items !== void 0 && _breadcrumb$items.length ? /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: componentName + '-breadcrumb'
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Breadcrumb, breadcrumb || {})) : null, title || extra ? /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: componentName + '-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));
|
|
100
|
+
});
|
|
101
|
+
export default ContentHeader;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ContentHeaderProps } from './ContentHeader';
|
|
2
3
|
import './styles/index.less';
|
|
3
4
|
interface SubfieldContentProps {
|
|
4
5
|
leftSiderWidth?: number;
|
|
@@ -12,7 +13,8 @@ interface SubfieldContentProps {
|
|
|
12
13
|
leftSiderDragDirection?: string[];
|
|
13
14
|
leftSiderMoveMaxWidth?: number;
|
|
14
15
|
leftSiderMoveMaxHeight?: number;
|
|
16
|
+
header?: ContentHeaderProps;
|
|
15
17
|
[k: string]: any;
|
|
16
18
|
}
|
|
17
|
-
declare const SubfieldContent:
|
|
19
|
+
declare const SubfieldContent: React.ForwardRefExoticComponent<Omit<SubfieldContentProps, "ref"> & React.RefAttributes<unknown>>;
|
|
18
20
|
export default SubfieldContent;
|
|
@@ -1,41 +1,79 @@
|
|
|
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 _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); }
|
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
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
5
|
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); }
|
|
4
6
|
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; }
|
|
5
7
|
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; } }
|
|
6
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
|
|
8
15
|
import classNames from 'classnames';
|
|
9
16
|
import { Spin } from 'antd';
|
|
10
17
|
import DragContent from "../DragContent";
|
|
18
|
+
import ContentHeader from "./ContentHeader";
|
|
11
19
|
import useStyle from "./styles/Subfield";
|
|
12
20
|
import "./styles/index.less";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
import { FanContext } from "../ConfigContext";
|
|
22
|
+
var SubfieldContent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
23
|
+
var _proLayoutProps$heade;
|
|
24
|
+
var InitFanContext = useContext(FanContext);
|
|
25
|
+
var providerConfig = InitFanContext['SubfieldContent'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
26
|
+
var proLayoutProps = InitFanContext['proLayoutProps'] || {};
|
|
27
|
+
var _providerConfig$props = _objectSpread(_objectSpread({}, providerConfig), props),
|
|
28
|
+
_providerConfig$props2 = _providerConfig$props.leftSiderWidth,
|
|
29
|
+
leftSiderWidth = _providerConfig$props2 === void 0 ? 180 : _providerConfig$props2,
|
|
30
|
+
leftSiderNode = _providerConfig$props.leftSiderNode,
|
|
31
|
+
children = _providerConfig$props.children,
|
|
32
|
+
className = _providerConfig$props.className,
|
|
33
|
+
style = _providerConfig$props.style,
|
|
34
|
+
leftSiderClassName = _providerConfig$props.leftSiderClassName,
|
|
35
|
+
_providerConfig$props3 = _providerConfig$props.loading,
|
|
36
|
+
loading = _providerConfig$props3 === void 0 ? false : _providerConfig$props3,
|
|
37
|
+
loadingTip = _providerConfig$props.loadingTip,
|
|
38
|
+
leftSiderDragDirection = _providerConfig$props.leftSiderDragDirection,
|
|
39
|
+
leftSiderMoveMaxWidth = _providerConfig$props.leftSiderMoveMaxWidth,
|
|
40
|
+
leftSiderMoveMaxHeight = _providerConfig$props.leftSiderMoveMaxHeight,
|
|
41
|
+
header = _providerConfig$props.header;
|
|
42
|
+
var _useState = useState(0),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
headerHeight = _useState2[0],
|
|
45
|
+
setHeaderHeight = _useState2[1];
|
|
27
46
|
var componentName = 'spec-grid-content';
|
|
28
47
|
var _useStyle = useStyle(componentName),
|
|
29
48
|
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
30
49
|
wrapSSR = _useStyle2[0],
|
|
31
50
|
hashId = _useStyle2[1];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
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
|
+
});
|
|
64
|
+
return wrapSSR( /*#__PURE__*/React.createElement("div", {
|
|
37
65
|
className: classNames(componentName, className, hashId),
|
|
38
|
-
style: style
|
|
66
|
+
style: style,
|
|
67
|
+
ref: contentRef
|
|
68
|
+
}, proLayoutProps !== null && proLayoutProps !== void 0 && proLayoutProps.header || header ? /*#__PURE__*/React.createElement(ContentHeader, _extends({
|
|
69
|
+
ref: headerRef,
|
|
70
|
+
getClientHeight: setHeaderHeight,
|
|
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' : '')
|
|
72
|
+
}, (proLayoutProps === null || proLayoutProps === void 0 ? void 0 : proLayoutProps.header) || {}, header || {})) : null, /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: 'spec-grid-content-body',
|
|
74
|
+
style: {
|
|
75
|
+
height: "calc(100% - ".concat(headerHeight ? headerHeight + 20 : 0, "px")
|
|
76
|
+
}
|
|
39
77
|
}, /*#__PURE__*/React.createElement(DragContent, {
|
|
40
78
|
direction: leftSiderDragDirection,
|
|
41
79
|
className: classNames('spec-grid-left', leftSiderClassName),
|
|
@@ -46,6 +84,10 @@ var SubfieldContent = function SubfieldContent(props) {
|
|
|
46
84
|
moveMaxHeight: leftSiderMoveMaxHeight
|
|
47
85
|
}, leftSiderNode), /*#__PURE__*/React.createElement("div", {
|
|
48
86
|
className: "spec-grid-right"
|
|
49
|
-
},
|
|
50
|
-
|
|
87
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
88
|
+
spinning: loading,
|
|
89
|
+
tip: loadingTip,
|
|
90
|
+
wrapperClassName: 'spec-grid-content-spinning'
|
|
91
|
+
}, children)))));
|
|
92
|
+
});
|
|
51
93
|
export default SubfieldContent;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './styles/index.less';
|
|
3
|
+
import { ContentHeaderProps } from './ContentHeader';
|
|
3
4
|
interface WrapperContentProps {
|
|
4
5
|
className?: string;
|
|
5
6
|
loading?: boolean;
|
|
@@ -8,6 +9,7 @@ interface WrapperContentProps {
|
|
|
8
9
|
style?: React.CSSProperties;
|
|
9
10
|
noMargin?: boolean;
|
|
10
11
|
light?: boolean;
|
|
12
|
+
header?: ContentHeaderProps;
|
|
11
13
|
}
|
|
12
|
-
declare const WrapperContent:
|
|
14
|
+
declare const WrapperContent: React.ForwardRefExoticComponent<WrapperContentProps & React.RefAttributes<unknown>>;
|
|
13
15
|
export default WrapperContent;
|