@chaoswise/ui 2.3.2 → 2.3.3
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/lib/BasicLayout/index.js +16 -3
- package/lib/CWRangePicker/Refresh/index.js +2 -3
- package/lib/CWRangePicker/TimeSpan/index.js +0 -1
- package/lib/CWRangePicker/index.js +70 -25
- package/lib/CWRangePicker/utils/index.js +6 -2
- package/lib/CWSelect/index.js +4 -0
- package/lib/CWTable/header.js +19 -4
- package/lib/Header/TopNavigationMenu/index.js +59 -0
- package/lib/Header/TopNavigationMenu/index.less +41 -0
- package/lib/Header/index.js +12 -4
- package/lib/InputNumber/index.js +4 -0
- package/package.json +2 -2
package/lib/BasicLayout/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import _ErrorBoundary from "@chaoswise/ui/lib/ErrorBoundary";
|
|
|
4
4
|
import "@chaoswise/ui/lib/Header/index.less";
|
|
5
5
|
import _Header from "@chaoswise/ui/lib/Header";
|
|
6
6
|
import _Layout from "@chaoswise/ui/lib/Antd/Layout";
|
|
7
|
-
var _excluded = ["logo", "headerTitle", "headerExtra", "showHome", "onClickHome", "showTopNavigation", "topNavigation", "topNavigationClassName", "topNavigationTrigger", "onClickTopNavigation", "siderMenu", "children", "siderWidth", "siderCollapsedWidth", "collapsed", "onCollapse", "showHead", "showBreadcrumb", "showBack", "onClickBack", "backNavigationTitle", "backIcon", "showSider", "breadcrumbOptions", "menuOptions", "contentClassName", "currentPath", "className", "version", "versionTooltip", "customContent", "allProductsTitle", "logoText", "localeSwitcherOption", "messageOption", "documentOption", "userSetingOption", "logoSize", "renderSetting", "showMessage", "homeIcon", "contentOption", "ErrorBoundary", "onPassWidth"];
|
|
7
|
+
var _excluded = ["logo", "headerTitle", "headerExtra", "showHome", "onClickHome", "showTopNavigation", "topNavigation", "topNavigationClassName", "topNavigationTrigger", "onClickTopNavigation", "siderMenu", "children", "siderWidth", "siderCollapsedWidth", "collapsed", "onCollapse", "showHead", "showBreadcrumb", "showBack", "onClickBack", "backNavigationTitle", "backIcon", "showSider", "breadcrumbOptions", "menuOptions", "contentClassName", "currentPath", "className", "version", "versionTooltip", "customContent", "allProductsTitle", "logoText", "localeSwitcherOption", "messageOption", "documentOption", "userSetingOption", "logoSize", "renderSetting", "showMessage", "homeIcon", "contentOption", "ErrorBoundary", "onPassWidth", "topNavigationOption"];
|
|
8
8
|
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); }
|
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
10
|
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."); }
|
|
@@ -93,6 +93,8 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
93
93
|
ErrorBoundary = _ref$ErrorBoundary === void 0 ? true : _ref$ErrorBoundary,
|
|
94
94
|
_ref$onPassWidth = _ref.onPassWidth,
|
|
95
95
|
onPassWidth = _ref$onPassWidth === void 0 ? function () {} : _ref$onPassWidth,
|
|
96
|
+
_ref$topNavigationOpt = _ref.topNavigationOption,
|
|
97
|
+
topNavigationOption = _ref$topNavigationOpt === void 0 ? {} : _ref$topNavigationOpt,
|
|
96
98
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
97
99
|
var _useConfigContext = useConfigContext(),
|
|
98
100
|
getPrefixCls = _useConfigContext.getPrefixCls;
|
|
@@ -271,7 +273,8 @@ var BasicLayout = function BasicLayout(_ref) {
|
|
|
271
273
|
documentOption: documentOption,
|
|
272
274
|
userSetingOption: userSetingOption,
|
|
273
275
|
showMessage: showMessage,
|
|
274
|
-
homeIcon: homeIcon
|
|
276
|
+
homeIcon: homeIcon,
|
|
277
|
+
topNavigationOption: topNavigationOption
|
|
275
278
|
})), specialContent && /*#__PURE__*/React.createElement("div", {
|
|
276
279
|
className: classnames(specialContentClassName)
|
|
277
280
|
}, specialContent), /*#__PURE__*/React.createElement(_Layout, {
|
|
@@ -497,7 +500,17 @@ BasicLayout.propTypes = {
|
|
|
497
500
|
/**
|
|
498
501
|
* 左侧菜单展开宽度值
|
|
499
502
|
*/
|
|
500
|
-
onPassWidth: PropTypes.func
|
|
503
|
+
onPassWidth: PropTypes.func,
|
|
504
|
+
/**
|
|
505
|
+
* 顶部导航配置(主要针对unfold类型):{
|
|
506
|
+
* topNavigationType: PropTypes.oneOf(["fold", "unfold"]), // 默认为fold,fold会将所有产品折叠收纳,unfold会将所有产品平铺
|
|
507
|
+
* activeKey: PropTypes.string, // 受控的活跃的key
|
|
508
|
+
* unfoldMaxCount: PropTypes.number // 默认值为4,topNavigationType为unfold类型时,超过unfoldMaxCount数目将会展示到更多中
|
|
509
|
+
* moreOverlayClassName: PropTypes.string // 更多浮层类名
|
|
510
|
+
* topNavigationWrapperClassName: PropTypes.string // 导航外壳容器类名
|
|
511
|
+
* }
|
|
512
|
+
*/
|
|
513
|
+
topNavigationOption: PropTypes.object
|
|
501
514
|
};
|
|
502
515
|
BasicLayout.Footer = Footer;
|
|
503
516
|
export default BasicLayout;
|
|
@@ -39,7 +39,6 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
39
39
|
setRecordDateValue = props.setRecordDateValue,
|
|
40
40
|
onChange = props.onChange,
|
|
41
41
|
value = props.value,
|
|
42
|
-
isAutoRefresh = props.isAutoRefresh,
|
|
43
42
|
setIsAutoRefresh = props.setIsAutoRefresh,
|
|
44
43
|
refreshOption = props.refreshOption,
|
|
45
44
|
isHasDate = props.isHasDate,
|
|
@@ -88,7 +87,7 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
88
87
|
// 自动刷新
|
|
89
88
|
var onAutoRefresh = function onAutoRefresh() {
|
|
90
89
|
setBackTooltipVisible(false);
|
|
91
|
-
onClickAutoRefresh(!
|
|
90
|
+
onClickAutoRefresh(!enableAutoRefresh);
|
|
92
91
|
isClickAutoRefresh.current = true;
|
|
93
92
|
if (isHasDate) {
|
|
94
93
|
var values = recordDateValue.value,
|
|
@@ -154,7 +153,7 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
154
153
|
title: localeObj["refresh"]
|
|
155
154
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
156
155
|
onClick: onRefresh,
|
|
157
|
-
disabled: isDisabledRefresh
|
|
156
|
+
disabled: isDisabledRefresh || !enableAutoRefresh
|
|
158
157
|
}, /*#__PURE__*/React.createElement(Refresh1Svg, null))), showAutoRefresh && /*#__PURE__*/React.createElement(_Tooltip, {
|
|
159
158
|
title: localeObj["autoRefresh"]
|
|
160
159
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
@@ -24,7 +24,6 @@ var TimeSpan = function TimeSpan(props) {
|
|
|
24
24
|
isHasDate = props.isHasDate,
|
|
25
25
|
onRecover = props.onRecover,
|
|
26
26
|
timeSpanOption = props.timeSpanOption,
|
|
27
|
-
isAutoRefresh = props.isAutoRefresh,
|
|
28
27
|
forwardTooltipVisible = props.forwardTooltipVisible,
|
|
29
28
|
setForwardTooltipVisible = props.setForwardTooltipVisible,
|
|
30
29
|
backTooltipVisible = props.backTooltipVisible,
|
|
@@ -82,7 +82,11 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
82
82
|
onAutoRefreshChange = _refreshOption$onAuto2 === void 0 ? function () {} : _refreshOption$onAuto2,
|
|
83
83
|
_refreshOption$delay = refreshOption.delay,
|
|
84
84
|
delay = _refreshOption$delay === void 0 ? 5000 : _refreshOption$delay,
|
|
85
|
-
openAutoRefresh = refreshOption.openAutoRefresh
|
|
85
|
+
openAutoRefresh = refreshOption.openAutoRefresh,
|
|
86
|
+
_refreshOption$showAu = refreshOption.showAutoRefresh,
|
|
87
|
+
showAutoRefresh = _refreshOption$showAu === void 0 ? true : _refreshOption$showAu,
|
|
88
|
+
_refreshOption$isRece = refreshOption.isRecentlyOpenRefresh,
|
|
89
|
+
isRecentlyOpenRefresh = _refreshOption$isRece === void 0 ? true : _refreshOption$isRece;
|
|
86
90
|
var _menuOption$showCalen = menuOption.showCalendar,
|
|
87
91
|
showCalendar = _menuOption$showCalen === void 0 ? true : _menuOption$showCalen,
|
|
88
92
|
_menuOption$exceedSho = menuOption.exceedShowInMore,
|
|
@@ -156,6 +160,10 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
156
160
|
var inputRef = useRef(null);
|
|
157
161
|
// 含有刷新组件暴露的方法
|
|
158
162
|
var refreshRef = useRef(null);
|
|
163
|
+
var _useState21 = useState([]),
|
|
164
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
165
|
+
rangePickerValue = _useState22[0],
|
|
166
|
+
setRangePickerValue = _useState22[1];
|
|
159
167
|
// 组件内部方法抛出
|
|
160
168
|
useImperativeHandle(ref, function () {
|
|
161
169
|
var _refreshRef$current;
|
|
@@ -220,40 +228,37 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
220
228
|
_judgeType4 = _slicedToArray(_judgeType3, 1),
|
|
221
229
|
isRule = _judgeType4[0];
|
|
222
230
|
var isHasDate = !isRule && !recordDateValue.value ? false : true;
|
|
231
|
+
var _isAutoRefresh = false;
|
|
223
232
|
if (isHasDate) {
|
|
224
|
-
if (
|
|
233
|
+
if (!isRecentlyOpenRefresh) {
|
|
225
234
|
if (!isRule) {
|
|
226
|
-
if (
|
|
235
|
+
if (enableAutoRefresh) {
|
|
227
236
|
onAutoRefreshChange(false);
|
|
228
237
|
}
|
|
229
238
|
} else {
|
|
230
239
|
if (isRule && isClickAutoRefresh.current) {
|
|
231
240
|
onAutoRefreshChange(true);
|
|
241
|
+
_isAutoRefresh = true;
|
|
232
242
|
}
|
|
233
243
|
}
|
|
234
244
|
isClickAutoRefresh.current = false;
|
|
235
245
|
} else {
|
|
236
246
|
if (isRule) {
|
|
237
|
-
if (!
|
|
247
|
+
if (!enableAutoRefresh) {
|
|
238
248
|
onAutoRefreshChange(true);
|
|
249
|
+
_isAutoRefresh = true;
|
|
239
250
|
}
|
|
240
251
|
} else {
|
|
241
|
-
if (
|
|
252
|
+
if (enableAutoRefresh) {
|
|
242
253
|
onAutoRefreshChange(false);
|
|
243
254
|
}
|
|
244
255
|
}
|
|
245
256
|
}
|
|
246
|
-
setIsAutoRefresh(
|
|
247
|
-
if (isRule) {
|
|
248
|
-
return true;
|
|
249
|
-
} else {
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
});
|
|
257
|
+
setIsAutoRefresh(_isAutoRefresh);
|
|
253
258
|
} else {
|
|
254
259
|
isClickAutoRefresh.current = false;
|
|
255
260
|
}
|
|
256
|
-
}, [recordDateValue,
|
|
261
|
+
}, [recordDateValue, isRecentlyOpenRefresh]);
|
|
257
262
|
useEffect(function () {
|
|
258
263
|
var values = recordDateValue.value;
|
|
259
264
|
var _judgeType5 = judgeType(recordDateValue),
|
|
@@ -261,7 +266,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
261
266
|
isRule = _judgeType6[0],
|
|
262
267
|
captureUnit = _judgeType6[1],
|
|
263
268
|
recordUnit = _judgeType6[2];
|
|
264
|
-
if (enableAutoRefresh && isRule) {
|
|
269
|
+
if (enableAutoRefresh && isRule && showAutoRefresh) {
|
|
265
270
|
timeRef.current = setInterval(function () {
|
|
266
271
|
var newValue = _objectSpread(_objectSpread({}, recordDateValue), {}, {
|
|
267
272
|
timeDomain: recordUnit,
|
|
@@ -273,7 +278,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
273
278
|
onAutoRefresh(newValue);
|
|
274
279
|
}, delay);
|
|
275
280
|
}
|
|
276
|
-
if (enableAutoRefresh && !isRule && !values) {
|
|
281
|
+
if (enableAutoRefresh && !isRule && !values && showAutoRefresh) {
|
|
277
282
|
timeRef.current = setInterval(function () {
|
|
278
283
|
onAutoRefresh(recordDateValue);
|
|
279
284
|
}, delay);
|
|
@@ -281,14 +286,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
281
286
|
return function () {
|
|
282
287
|
clearInterval(timeRef.current);
|
|
283
288
|
};
|
|
284
|
-
}, [enableAutoRefresh, recordDateValue, delay]);
|
|
285
|
-
// 点击空白处日历切换
|
|
286
|
-
useEffect(function () {
|
|
287
|
-
document.addEventListener("click", clickBody);
|
|
288
|
-
return function () {
|
|
289
|
-
document.removeEventListener("click", clickBody);
|
|
290
|
-
};
|
|
291
|
-
}, []);
|
|
289
|
+
}, [enableAutoRefresh, recordDateValue, delay, showAutoRefresh]);
|
|
292
290
|
// 日期是否存在
|
|
293
291
|
var _useMemo = useMemo(function () {
|
|
294
292
|
// 不符合最近时间格式和没有日期数据返回false
|
|
@@ -313,6 +311,16 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
313
311
|
isHasDate = _useMemo2[0],
|
|
314
312
|
_defaultValue = _useMemo2[1],
|
|
315
313
|
isRightDisabled = _useMemo2[2];
|
|
314
|
+
// 点击空白处日历切换
|
|
315
|
+
useEffect(function () {
|
|
316
|
+
document.addEventListener("click", clickBody);
|
|
317
|
+
return function () {
|
|
318
|
+
document.removeEventListener("click", clickBody);
|
|
319
|
+
};
|
|
320
|
+
}, [_defaultValue]);
|
|
321
|
+
useEffect(function () {
|
|
322
|
+
setRangePickerValue(_defaultValue);
|
|
323
|
+
}, [_defaultValue]);
|
|
316
324
|
// 重组数据源
|
|
317
325
|
var regroupDataSource = useMemo(function () {
|
|
318
326
|
if (exceedShowInMore) {
|
|
@@ -327,6 +335,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
327
335
|
if (targetCalendar) {
|
|
328
336
|
if (!targetCalendar.contains(e.target)) {
|
|
329
337
|
setIsCalendar(false);
|
|
338
|
+
setRangePickerValue(_defaultValue);
|
|
330
339
|
}
|
|
331
340
|
}
|
|
332
341
|
if (targetInput) {
|
|
@@ -399,7 +408,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
399
408
|
};
|
|
400
409
|
// 外部获取ref停止自动刷新
|
|
401
410
|
var onStop = function onStop() {
|
|
402
|
-
if (
|
|
411
|
+
if (enableAutoRefresh) {
|
|
403
412
|
var _refreshRef$current2, _refreshRef$current3;
|
|
404
413
|
((_refreshRef$current2 = refreshRef.current) === null || _refreshRef$current2 === void 0 ? void 0 : _refreshRef$current2.onAutoRefresh) && ((_refreshRef$current3 = refreshRef.current) === null || _refreshRef$current3 === void 0 ? void 0 : _refreshRef$current3.onAutoRefresh());
|
|
405
414
|
}
|
|
@@ -520,6 +529,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
520
529
|
},
|
|
521
530
|
dropdownClassName: classnames(dropdownCalendarClassName),
|
|
522
531
|
format: format,
|
|
532
|
+
allowClear: false,
|
|
523
533
|
onChange: function onChange(_value, mode) {
|
|
524
534
|
setIsCalendar(false);
|
|
525
535
|
setIsFocus(false);
|
|
@@ -595,8 +605,43 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
595
605
|
}
|
|
596
606
|
}
|
|
597
607
|
},
|
|
598
|
-
|
|
608
|
+
value: rangePickerValue // 默认为当前已经选择的时间
|
|
599
609
|
,
|
|
610
|
+
onCalendarChange: function onCalendarChange(data, dataString, info) {
|
|
611
|
+
var _ref = data || [],
|
|
612
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
613
|
+
data0 = _ref2[0],
|
|
614
|
+
data1 = _ref2[1];
|
|
615
|
+
var range = info.range;
|
|
616
|
+
var _ref3 = rangePickerValue || [],
|
|
617
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
618
|
+
value0 = _ref4[0],
|
|
619
|
+
value1 = _ref4[1];
|
|
620
|
+
if (range === "start" && data0) {
|
|
621
|
+
if (value0) {
|
|
622
|
+
data0 = moment(data0).set({
|
|
623
|
+
"hour": 0,
|
|
624
|
+
"minute": 0,
|
|
625
|
+
"second": 0,
|
|
626
|
+
"millisecond": 0
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (range === "end" && data1) {
|
|
631
|
+
if (value1 && !moment(value1).isSame(data1, "day")) {
|
|
632
|
+
data1 = moment(data1).set({
|
|
633
|
+
"hour": 23,
|
|
634
|
+
"minute": 59,
|
|
635
|
+
"second": 59,
|
|
636
|
+
"millisecond": 0
|
|
637
|
+
});
|
|
638
|
+
if (moment().isSame(data1, "day")) {
|
|
639
|
+
data1 = moment();
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
setRangePickerValue([data0, data1]);
|
|
644
|
+
},
|
|
600
645
|
showTime: {
|
|
601
646
|
hideDisabledOptions: true
|
|
602
647
|
}
|
|
@@ -162,21 +162,25 @@ export var echoInputValue = function echoInputValue() {
|
|
|
162
162
|
}
|
|
163
163
|
if (!isRule && !values) return title || "Live Tail";
|
|
164
164
|
if (isAutoRefresh) {
|
|
165
|
+
var _value3;
|
|
165
166
|
if (isRule) {
|
|
166
167
|
if (isFoucs) {
|
|
167
168
|
return recordUnit;
|
|
168
169
|
}
|
|
169
170
|
return echoRecentlyTimeTitle(locale, captureUnit);
|
|
170
171
|
}
|
|
172
|
+
if (Array.isArray(value) && (_value3 = value) !== null && _value3 !== void 0 && _value3.length) {
|
|
173
|
+
return echoAbsoluteTimeTitle(value, format);
|
|
174
|
+
}
|
|
171
175
|
} else {
|
|
172
|
-
var
|
|
176
|
+
var _value4;
|
|
173
177
|
if (isRule) {
|
|
174
178
|
if (isFoucs) {
|
|
175
179
|
return recordUnit;
|
|
176
180
|
}
|
|
177
181
|
return echoRecentlyTimeTitle(locale, captureUnit);
|
|
178
182
|
}
|
|
179
|
-
if (Array.isArray(value) && (
|
|
183
|
+
if (Array.isArray(value) && (_value4 = value) !== null && _value4 !== void 0 && _value4.length) {
|
|
180
184
|
return echoAbsoluteTimeTitle(value, format);
|
|
181
185
|
}
|
|
182
186
|
}
|
package/lib/CWSelect/index.js
CHANGED
|
@@ -187,6 +187,10 @@ var CWSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
187
187
|
var rcSelect = selectRef.current;
|
|
188
188
|
var selectWrapperDom = ReactDom.findDOMNode(rcSelect);
|
|
189
189
|
var selectInputDom = selectWrapperDom.querySelector(".".concat(prefixCls, "-select-selector"));
|
|
190
|
+
var ExistingSlotDom = selectInputDom.querySelector(".cw-select-custom-slot-wrapper");
|
|
191
|
+
if (ExistingSlotDom) {
|
|
192
|
+
selectInputDom.removeChild(ExistingSlotDom);
|
|
193
|
+
}
|
|
190
194
|
var selectSearchDom = selectInputDom.querySelector(".".concat(prefixCls, "-select-selection-search"));
|
|
191
195
|
var divEle = document.createElement('div');
|
|
192
196
|
divEle.className = "cw-select-custom-slot-wrapper";
|
package/lib/CWTable/header.js
CHANGED
|
@@ -3,7 +3,7 @@ import _TooltipText from "@chaoswise/ui/lib/TooltipText";
|
|
|
3
3
|
import _Dropdown from "@chaoswise/ui/lib/Antd/Dropdown";
|
|
4
4
|
import _Menu from "@chaoswise/ui/lib/Menu";
|
|
5
5
|
var _excluded = ["onResize", "width"],
|
|
6
|
-
_excluded2 = ["children"];
|
|
6
|
+
_excluded2 = ["children", "onClick"];
|
|
7
7
|
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); }
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
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; }
|
|
14
14
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
import React, { useState } from "react";
|
|
16
|
+
import React, { useState, useRef } from "react";
|
|
17
17
|
import { Resizable } from "react-resizable";
|
|
18
18
|
import SortContext from "./SortContext";
|
|
19
19
|
import SortSvg from './icon/SortSvg';
|
|
@@ -83,6 +83,7 @@ export function HeaderCell(props) {
|
|
|
83
83
|
var _onResize = props.onResize,
|
|
84
84
|
width = props.width,
|
|
85
85
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
86
|
+
var isResizeRef = useRef(null);
|
|
86
87
|
var _useConfigContext = useConfigContext(),
|
|
87
88
|
getPrefixCls = _useConfigContext.getPrefixCls;
|
|
88
89
|
var prefixCls = getPrefixCls();
|
|
@@ -129,6 +130,8 @@ export function HeaderCell(props) {
|
|
|
129
130
|
restProps.children = children;
|
|
130
131
|
}
|
|
131
132
|
var _children = restProps.children,
|
|
133
|
+
_restProps$onClick = restProps.onClick,
|
|
134
|
+
_onClick = _restProps$onClick === void 0 ? function () {} : _restProps$onClick,
|
|
132
135
|
rest = _objectWithoutProperties(restProps, _excluded2);
|
|
133
136
|
var findColumnItem = columns === null || columns === void 0 ? void 0 : columns.find(function (item) {
|
|
134
137
|
return (item.dataIndex || item.key) === rest.dataIndex;
|
|
@@ -136,7 +139,9 @@ export function HeaderCell(props) {
|
|
|
136
139
|
var ellipsis = findColumnItem ? findColumnItem.ellipsis && !findColumnItem.filters && !findColumnItem.sorter ? true : false : false;
|
|
137
140
|
var renderChildren = ellipsis ? /*#__PURE__*/React.createElement(_TooltipText, null, _children) : _children;
|
|
138
141
|
if (!width) {
|
|
139
|
-
return /*#__PURE__*/React.createElement("th", rest,
|
|
142
|
+
return /*#__PURE__*/React.createElement("th", _extends({}, rest, {
|
|
143
|
+
onClick: _onClick
|
|
144
|
+
}), renderChildren);
|
|
140
145
|
}
|
|
141
146
|
return /*#__PURE__*/React.createElement(Resizable, {
|
|
142
147
|
width: width,
|
|
@@ -149,6 +154,7 @@ export function HeaderCell(props) {
|
|
|
149
154
|
document.body.onselectstart = function () {
|
|
150
155
|
return false;
|
|
151
156
|
};
|
|
157
|
+
isResizeRef.current = true;
|
|
152
158
|
},
|
|
153
159
|
onResizeStop: function onResizeStop(e, data) {
|
|
154
160
|
// 页面选中功能开启
|
|
@@ -157,12 +163,21 @@ export function HeaderCell(props) {
|
|
|
157
163
|
};
|
|
158
164
|
// 第三个参数是拖拽是否结束
|
|
159
165
|
_onResize(e, data, true);
|
|
166
|
+
setTimeout(function () {
|
|
167
|
+
isResizeRef.current = false;
|
|
168
|
+
});
|
|
160
169
|
},
|
|
161
170
|
className: "cw-table-react-resizable",
|
|
162
171
|
draggableOpts: {
|
|
163
172
|
enableUserSelectHack: false
|
|
164
173
|
}
|
|
165
|
-
}, /*#__PURE__*/React.createElement("th", rest,
|
|
174
|
+
}, /*#__PURE__*/React.createElement("th", _extends({}, rest, {
|
|
175
|
+
onClick: function onClick() {
|
|
176
|
+
if (!isResizeRef.current && _onClick) {
|
|
177
|
+
_onClick.apply(void 0, arguments);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}), renderChildren));
|
|
166
181
|
};
|
|
167
182
|
return /*#__PURE__*/React.createElement(SortContext.Consumer, null, render);
|
|
168
183
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _Dropdown from "@chaoswise/ui/lib/Antd/Dropdown";
|
|
2
|
+
import _Icon from "@chaoswise/ui/lib/Antd/Icon";
|
|
3
|
+
import _Menu from "@chaoswise/ui/lib/Menu";
|
|
4
|
+
import "@chaoswise/ui/lib/TooltipText/index.less";
|
|
5
|
+
import _TooltipText from "@chaoswise/ui/lib/TooltipText";
|
|
6
|
+
import React, { useMemo } from "react";
|
|
7
|
+
import classnames from "classnames";
|
|
8
|
+
import "./index.less";
|
|
9
|
+
// 产品直接在头部容器中展示
|
|
10
|
+
var TopNavigationMenu = function TopNavigationMenu(props) {
|
|
11
|
+
var topNavigation = props.topNavigation,
|
|
12
|
+
onClickTopNavigationSelf = props.onClickTopNavigationSelf,
|
|
13
|
+
topNavigationOption = props.topNavigationOption;
|
|
14
|
+
var _topNavigationOption$ = topNavigationOption.unfoldMaxCount,
|
|
15
|
+
unfoldMaxCount = _topNavigationOption$ === void 0 ? 4 : _topNavigationOption$,
|
|
16
|
+
_topNavigationOption$2 = topNavigationOption.activeKey,
|
|
17
|
+
activeKey = _topNavigationOption$2 === void 0 ? "" : _topNavigationOption$2,
|
|
18
|
+
moreOverlayClassName = topNavigationOption.moreOverlayClassName,
|
|
19
|
+
topNavigationWrapperClassName = topNavigationOption.topNavigationWrapperClassName;
|
|
20
|
+
var _activeKey = useMemo(function () {
|
|
21
|
+
return activeKey;
|
|
22
|
+
}, [activeKey]);
|
|
23
|
+
if (!topNavigation || !topNavigation.length) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
var menu = /*#__PURE__*/React.createElement(_Menu, {
|
|
27
|
+
selectable: true,
|
|
28
|
+
selectedKeys: [_activeKey]
|
|
29
|
+
}, topNavigation.slice(unfoldMaxCount).map(function (item) {
|
|
30
|
+
return /*#__PURE__*/React.createElement(_Menu.Item, {
|
|
31
|
+
onClick: function onClick(_ref) {
|
|
32
|
+
var domEvent = _ref.domEvent;
|
|
33
|
+
onClickTopNavigationSelf(domEvent, item);
|
|
34
|
+
},
|
|
35
|
+
key: item.value
|
|
36
|
+
}, /*#__PURE__*/React.createElement(_TooltipText, null, item.name));
|
|
37
|
+
}));
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: classnames("cw-header-top-navigation-menu-wrapper", topNavigationWrapperClassName)
|
|
40
|
+
}, topNavigation.slice(0, unfoldMaxCount).map(function (item) {
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
key: item.value,
|
|
43
|
+
onClick: function onClick(e) {
|
|
44
|
+
return onClickTopNavigationSelf(e, item);
|
|
45
|
+
},
|
|
46
|
+
className: classnames("cw-header-top-navigation-menu-item", {
|
|
47
|
+
"cw-header-top-navigation-menu-item-seleted": _activeKey === item.value
|
|
48
|
+
})
|
|
49
|
+
}, item.name);
|
|
50
|
+
}), (topNavigation === null || topNavigation === void 0 ? void 0 : topNavigation.length) > unfoldMaxCount && /*#__PURE__*/React.createElement(_Dropdown, {
|
|
51
|
+
overlay: menu,
|
|
52
|
+
overlayClassName: classnames(moreOverlayClassName)
|
|
53
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "cw-header-top-navigation-menu-more-wrapper"
|
|
55
|
+
}, /*#__PURE__*/React.createElement(_Icon, {
|
|
56
|
+
type: "ellipsis"
|
|
57
|
+
}))));
|
|
58
|
+
};
|
|
59
|
+
export default TopNavigationMenu;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.cw-header-top-navigation-menu-wrapper {
|
|
2
|
+
margin-left: 16px;
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: 20px;
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
|
|
9
|
+
.cw-header-top-navigation-menu-item {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
height: 20px;
|
|
14
|
+
line-height: 20px;
|
|
15
|
+
padding: 0 12px;
|
|
16
|
+
&:hover{
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
&:not(.cw-header-top-navigation-menu-item-seleted):hover {
|
|
20
|
+
color: @primary-5;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:not(:first-child) {
|
|
24
|
+
margin-left: 8px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.cw-header-top-navigation-menu-item-seleted {
|
|
28
|
+
background-color: @primary-color;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
border-radius: 10px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.cw-header-top-navigation-menu-more-wrapper {
|
|
35
|
+
margin-left: 20px;
|
|
36
|
+
&:hover{
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
color: @primary-5;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
package/lib/Header/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import PropTypes from 'prop-types';
|
|
|
13
13
|
import { ConfigConsumer } from 'antd/es/config-provider';
|
|
14
14
|
import Message from './Message';
|
|
15
15
|
import Document from './Document';
|
|
16
|
+
import TopNavigationMenu from './TopNavigationMenu';
|
|
16
17
|
import './index.less';
|
|
17
18
|
/**
|
|
18
19
|
*
|
|
@@ -106,7 +107,10 @@ function CWHeader(_ref) {
|
|
|
106
107
|
userSetingOption = _ref.userSetingOption,
|
|
107
108
|
_ref$logoSize = _ref.logoSize,
|
|
108
109
|
logoSize = _ref$logoSize === void 0 ? '50%' : _ref$logoSize,
|
|
109
|
-
homeIcon = _ref.homeIcon
|
|
110
|
+
homeIcon = _ref.homeIcon,
|
|
111
|
+
topNavigationOption = _ref.topNavigationOption;
|
|
112
|
+
var _topNavigationOption$ = topNavigationOption.topNavigationType,
|
|
113
|
+
topNavigationType = _topNavigationOption$ === void 0 ? "fold" : _topNavigationOption$;
|
|
110
114
|
var logoContainerRef = useRef(null);
|
|
111
115
|
var _useState = useState(false),
|
|
112
116
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -224,7 +228,7 @@ function CWHeader(_ref) {
|
|
|
224
228
|
onClick: onClickHome
|
|
225
229
|
}, homeIcon ? homeIcon : /*#__PURE__*/React.createElement(_Icon, {
|
|
226
230
|
component: homeIconSvg
|
|
227
|
-
})) : null, showTopNavigation && /*#__PURE__*/React.createElement(_Dropdown, {
|
|
231
|
+
})) : null, showTopNavigation && (topNavigationType === "fold" ? /*#__PURE__*/React.createElement(_Dropdown, {
|
|
228
232
|
trigger: topNavigationTrigger,
|
|
229
233
|
overlayClassName: "".concat(prefixCls, "-cw-header-dropdown-out-wrapper ").concat(topNavigationClassName !== undefined ? topNavigationClassName : ''),
|
|
230
234
|
overlay: renderTopNavigationMenu(),
|
|
@@ -239,11 +243,15 @@ function CWHeader(_ref) {
|
|
|
239
243
|
}
|
|
240
244
|
}, allProductsTitle, " ", /*#__PURE__*/React.createElement(_Icon, {
|
|
241
245
|
type: "caret-down"
|
|
242
|
-
})))
|
|
246
|
+
}))) : /*#__PURE__*/React.createElement(TopNavigationMenu, {
|
|
247
|
+
onClickTopNavigationSelf: onClickTopNavigationSelf,
|
|
248
|
+
topNavigation: topNavigation,
|
|
249
|
+
topNavigationOption: topNavigationOption
|
|
250
|
+
})), topNavigationType === "fold" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
243
251
|
className: "cw-division"
|
|
244
252
|
}), /*#__PURE__*/React.createElement("div", {
|
|
245
253
|
className: "cw-page-name"
|
|
246
|
-
}, title)), /*#__PURE__*/React.createElement("div", {
|
|
254
|
+
}, title))), /*#__PURE__*/React.createElement("div", {
|
|
247
255
|
className: "cw-header-right"
|
|
248
256
|
}, extra, /*#__PURE__*/React.createElement(Message, {
|
|
249
257
|
option: messageOption
|
package/lib/InputNumber/index.js
CHANGED
|
@@ -25,6 +25,10 @@ var CWInputNumber = /*#__PURE__*/forwardRef(function (props, inputNumberRef) {
|
|
|
25
25
|
var inputNumberInputDom = ReactDom.findDOMNode(ref.current);
|
|
26
26
|
// rc-input-number底层依赖升级以后需要向上查找
|
|
27
27
|
var inputNumberWrapperDom = inputNumberInputDom.closest(".".concat(prefixCls, "-input-number"));
|
|
28
|
+
var ExistingSlotDom = inputNumberWrapperDom.querySelector(".cw-input-number-custom-slot-wrapper");
|
|
29
|
+
if (ExistingSlotDom) {
|
|
30
|
+
inputNumberWrapperDom.removeChild(ExistingSlotDom);
|
|
31
|
+
}
|
|
28
32
|
var divEle = document.createElement("div");
|
|
29
33
|
divEle.className = "cw-input-number-custom-slot-wrapper";
|
|
30
34
|
if (inputNumberWrapperDom) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaoswise/ui",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "公共UI库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"access": "public"
|
|
141
141
|
},
|
|
142
142
|
"license": "MIT",
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "d4b92c78c796d0e79769112f642e46aaf7453ed5"
|
|
144
144
|
}
|