@chaoswise/ui 2.3.2 → 2.3.4
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 +78 -30
- 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/lib/SearchBar/index.js +3 -1
- 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,
|
|
@@ -71,7 +71,9 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
71
71
|
_props$format = props.format,
|
|
72
72
|
format = _props$format === void 0 ? "YYYY/MM/DD HH:mm:ss" : _props$format,
|
|
73
73
|
forceRenderTitle = props.forceRenderTitle,
|
|
74
|
-
open = props.open
|
|
74
|
+
open = props.open,
|
|
75
|
+
_props$rangePickerFor = props.rangePickerFormat,
|
|
76
|
+
rangePickerFormat = _props$rangePickerFor === void 0 ? "YYYY/MM/DD" : _props$rangePickerFor;
|
|
75
77
|
var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
|
|
76
78
|
_ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
|
|
77
79
|
locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
|
|
@@ -82,7 +84,11 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
82
84
|
onAutoRefreshChange = _refreshOption$onAuto2 === void 0 ? function () {} : _refreshOption$onAuto2,
|
|
83
85
|
_refreshOption$delay = refreshOption.delay,
|
|
84
86
|
delay = _refreshOption$delay === void 0 ? 5000 : _refreshOption$delay,
|
|
85
|
-
openAutoRefresh = refreshOption.openAutoRefresh
|
|
87
|
+
openAutoRefresh = refreshOption.openAutoRefresh,
|
|
88
|
+
_refreshOption$showAu = refreshOption.showAutoRefresh,
|
|
89
|
+
showAutoRefresh = _refreshOption$showAu === void 0 ? true : _refreshOption$showAu,
|
|
90
|
+
_refreshOption$isRece = refreshOption.isRecentlyOpenRefresh,
|
|
91
|
+
isRecentlyOpenRefresh = _refreshOption$isRece === void 0 ? true : _refreshOption$isRece;
|
|
86
92
|
var _menuOption$showCalen = menuOption.showCalendar,
|
|
87
93
|
showCalendar = _menuOption$showCalen === void 0 ? true : _menuOption$showCalen,
|
|
88
94
|
_menuOption$exceedSho = menuOption.exceedShowInMore,
|
|
@@ -156,6 +162,10 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
156
162
|
var inputRef = useRef(null);
|
|
157
163
|
// 含有刷新组件暴露的方法
|
|
158
164
|
var refreshRef = useRef(null);
|
|
165
|
+
var _useState21 = useState([]),
|
|
166
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
167
|
+
rangePickerValue = _useState22[0],
|
|
168
|
+
setRangePickerValue = _useState22[1];
|
|
159
169
|
// 组件内部方法抛出
|
|
160
170
|
useImperativeHandle(ref, function () {
|
|
161
171
|
var _refreshRef$current;
|
|
@@ -220,40 +230,41 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
220
230
|
_judgeType4 = _slicedToArray(_judgeType3, 1),
|
|
221
231
|
isRule = _judgeType4[0];
|
|
222
232
|
var isHasDate = !isRule && !recordDateValue.value ? false : true;
|
|
233
|
+
var _isAutoRefresh = enableAutoRefresh;
|
|
223
234
|
if (isHasDate) {
|
|
224
|
-
if (
|
|
235
|
+
if (!isRecentlyOpenRefresh) {
|
|
225
236
|
if (!isRule) {
|
|
226
|
-
if (
|
|
237
|
+
if (enableAutoRefresh) {
|
|
227
238
|
onAutoRefreshChange(false);
|
|
239
|
+
_isAutoRefresh = false;
|
|
228
240
|
}
|
|
229
241
|
} else {
|
|
230
242
|
if (isRule && isClickAutoRefresh.current) {
|
|
231
|
-
|
|
243
|
+
if (!enableAutoRefresh) {
|
|
244
|
+
onAutoRefreshChange(true);
|
|
245
|
+
_isAutoRefresh = true;
|
|
246
|
+
}
|
|
232
247
|
}
|
|
233
248
|
}
|
|
234
249
|
isClickAutoRefresh.current = false;
|
|
235
250
|
} else {
|
|
236
251
|
if (isRule) {
|
|
237
|
-
if (!
|
|
252
|
+
if (!enableAutoRefresh) {
|
|
238
253
|
onAutoRefreshChange(true);
|
|
254
|
+
_isAutoRefresh = true;
|
|
239
255
|
}
|
|
240
256
|
} else {
|
|
241
|
-
if (
|
|
257
|
+
if (enableAutoRefresh) {
|
|
242
258
|
onAutoRefreshChange(false);
|
|
259
|
+
_isAutoRefresh = false;
|
|
243
260
|
}
|
|
244
261
|
}
|
|
245
262
|
}
|
|
246
|
-
setIsAutoRefresh(
|
|
247
|
-
if (isRule) {
|
|
248
|
-
return true;
|
|
249
|
-
} else {
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
});
|
|
263
|
+
setIsAutoRefresh(_isAutoRefresh);
|
|
253
264
|
} else {
|
|
254
265
|
isClickAutoRefresh.current = false;
|
|
255
266
|
}
|
|
256
|
-
}, [recordDateValue,
|
|
267
|
+
}, [recordDateValue, isRecentlyOpenRefresh]);
|
|
257
268
|
useEffect(function () {
|
|
258
269
|
var values = recordDateValue.value;
|
|
259
270
|
var _judgeType5 = judgeType(recordDateValue),
|
|
@@ -261,7 +272,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
261
272
|
isRule = _judgeType6[0],
|
|
262
273
|
captureUnit = _judgeType6[1],
|
|
263
274
|
recordUnit = _judgeType6[2];
|
|
264
|
-
if (enableAutoRefresh && isRule) {
|
|
275
|
+
if (enableAutoRefresh && isRule && showAutoRefresh) {
|
|
265
276
|
timeRef.current = setInterval(function () {
|
|
266
277
|
var newValue = _objectSpread(_objectSpread({}, recordDateValue), {}, {
|
|
267
278
|
timeDomain: recordUnit,
|
|
@@ -273,7 +284,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
273
284
|
onAutoRefresh(newValue);
|
|
274
285
|
}, delay);
|
|
275
286
|
}
|
|
276
|
-
if (enableAutoRefresh && !isRule && !values) {
|
|
287
|
+
if (enableAutoRefresh && !isRule && !values && showAutoRefresh) {
|
|
277
288
|
timeRef.current = setInterval(function () {
|
|
278
289
|
onAutoRefresh(recordDateValue);
|
|
279
290
|
}, delay);
|
|
@@ -281,14 +292,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
281
292
|
return function () {
|
|
282
293
|
clearInterval(timeRef.current);
|
|
283
294
|
};
|
|
284
|
-
}, [enableAutoRefresh, recordDateValue, delay]);
|
|
285
|
-
// 点击空白处日历切换
|
|
286
|
-
useEffect(function () {
|
|
287
|
-
document.addEventListener("click", clickBody);
|
|
288
|
-
return function () {
|
|
289
|
-
document.removeEventListener("click", clickBody);
|
|
290
|
-
};
|
|
291
|
-
}, []);
|
|
295
|
+
}, [enableAutoRefresh, recordDateValue, delay, showAutoRefresh]);
|
|
292
296
|
// 日期是否存在
|
|
293
297
|
var _useMemo = useMemo(function () {
|
|
294
298
|
// 不符合最近时间格式和没有日期数据返回false
|
|
@@ -313,6 +317,16 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
313
317
|
isHasDate = _useMemo2[0],
|
|
314
318
|
_defaultValue = _useMemo2[1],
|
|
315
319
|
isRightDisabled = _useMemo2[2];
|
|
320
|
+
// 点击空白处日历切换
|
|
321
|
+
useEffect(function () {
|
|
322
|
+
document.addEventListener("click", clickBody);
|
|
323
|
+
return function () {
|
|
324
|
+
document.removeEventListener("click", clickBody);
|
|
325
|
+
};
|
|
326
|
+
}, [_defaultValue]);
|
|
327
|
+
useEffect(function () {
|
|
328
|
+
setRangePickerValue(_defaultValue);
|
|
329
|
+
}, [_defaultValue]);
|
|
316
330
|
// 重组数据源
|
|
317
331
|
var regroupDataSource = useMemo(function () {
|
|
318
332
|
if (exceedShowInMore) {
|
|
@@ -327,6 +341,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
327
341
|
if (targetCalendar) {
|
|
328
342
|
if (!targetCalendar.contains(e.target)) {
|
|
329
343
|
setIsCalendar(false);
|
|
344
|
+
setRangePickerValue(_defaultValue);
|
|
330
345
|
}
|
|
331
346
|
}
|
|
332
347
|
if (targetInput) {
|
|
@@ -399,7 +414,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
399
414
|
};
|
|
400
415
|
// 外部获取ref停止自动刷新
|
|
401
416
|
var onStop = function onStop() {
|
|
402
|
-
if (
|
|
417
|
+
if (enableAutoRefresh) {
|
|
403
418
|
var _refreshRef$current2, _refreshRef$current3;
|
|
404
419
|
((_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
420
|
}
|
|
@@ -519,7 +534,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
519
534
|
return getPopupContainerCalendar ? getPopupContainerCalendar(triggerNode) : triggerNode;
|
|
520
535
|
},
|
|
521
536
|
dropdownClassName: classnames(dropdownCalendarClassName),
|
|
522
|
-
format:
|
|
537
|
+
format: rangePickerFormat,
|
|
538
|
+
allowClear: false,
|
|
523
539
|
onChange: function onChange(_value, mode) {
|
|
524
540
|
setIsCalendar(false);
|
|
525
541
|
setIsFocus(false);
|
|
@@ -595,8 +611,35 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
595
611
|
}
|
|
596
612
|
}
|
|
597
613
|
},
|
|
598
|
-
|
|
614
|
+
value: rangePickerValue // 默认为当前已经选择的时间
|
|
599
615
|
,
|
|
616
|
+
onCalendarChange: function onCalendarChange(data, dataString, info) {
|
|
617
|
+
var _ref = data || [],
|
|
618
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
619
|
+
data0 = _ref2[0],
|
|
620
|
+
data1 = _ref2[1];
|
|
621
|
+
var range = info.range;
|
|
622
|
+
if (range === "start" && data0) {
|
|
623
|
+
data0 = moment(data0).set({
|
|
624
|
+
"hour": 0,
|
|
625
|
+
"minute": 0,
|
|
626
|
+
"second": 0,
|
|
627
|
+
"millisecond": 0
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
if (range === "end" && data1) {
|
|
631
|
+
data1 = moment(data1).set({
|
|
632
|
+
"hour": 23,
|
|
633
|
+
"minute": 59,
|
|
634
|
+
"second": 59,
|
|
635
|
+
"millisecond": 0
|
|
636
|
+
});
|
|
637
|
+
if (moment().isSame(data1, "day")) {
|
|
638
|
+
data1 = moment();
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
setRangePickerValue([data0, data1]);
|
|
642
|
+
},
|
|
600
643
|
showTime: {
|
|
601
644
|
hideDisabledOptions: true
|
|
602
645
|
}
|
|
@@ -633,7 +676,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
633
676
|
CWRangePicker.defaultProps = {
|
|
634
677
|
moreItemDropdownPosition: "left",
|
|
635
678
|
growSize: 3,
|
|
636
|
-
format: "YYYY/MM/DD HH:mm:ss"
|
|
679
|
+
format: "YYYY/MM/DD HH:mm:ss",
|
|
680
|
+
rangePickerFormat: "YYYY/MM/DD"
|
|
637
681
|
};
|
|
638
682
|
CWRangePicker.propTypes = {
|
|
639
683
|
/**
|
|
@@ -715,6 +759,10 @@ CWRangePicker.propTypes = {
|
|
|
715
759
|
/**
|
|
716
760
|
* 下拉菜单日历模式的className属性
|
|
717
761
|
*/
|
|
718
|
-
dropdownCalendarClassName: PropTypes.string
|
|
762
|
+
dropdownCalendarClassName: PropTypes.string,
|
|
763
|
+
/**
|
|
764
|
+
* 日历选择模式format展示
|
|
765
|
+
*/
|
|
766
|
+
rangePickerFormat: PropTypes.string
|
|
719
767
|
};
|
|
720
768
|
export default CWRangePicker;
|
|
@@ -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/lib/SearchBar/index.js
CHANGED
|
@@ -336,7 +336,9 @@ var SearchBar = function SearchBar(props) {
|
|
|
336
336
|
if (index < showExtraCount) {
|
|
337
337
|
return /*#__PURE__*/React.createElement("div", {
|
|
338
338
|
style: {
|
|
339
|
-
marginLeft: index === 0 ? 0 : "8px"
|
|
339
|
+
marginLeft: index === 0 ? 0 : "8px",
|
|
340
|
+
display: 'flex',
|
|
341
|
+
alignItems: "center"
|
|
340
342
|
},
|
|
341
343
|
key: value.key ? value.key : index
|
|
342
344
|
}, value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaoswise/ui",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
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": "72a624e97dab570b1fe67879de3d4d2f757d19a0"
|
|
144
144
|
}
|