@chaoswise/ui 3.0.8 → 3.0.9

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.
@@ -190,7 +190,8 @@ var genCardStyle = function genCardStyle(token) {
190
190
  background: token.colorBgContainer,
191
191
  borderRadius: token.borderRadiusLG
192
192
  }, "&:not(".concat(componentCls, "-bordered)"), {
193
- boxShadow: boxShadowTertiary
193
+ // boxShadow: boxShadowTertiary,
194
+ boxShadow: "none"
194
195
  }), "".concat(componentCls, "-head"), genCardHeadStyle(token)), "".concat(componentCls, "-extra"), {
195
196
  // https://stackoverflow.com/a/22429853/3040605
196
197
  marginInlineStart: 'auto',
@@ -45,10 +45,12 @@ var genCustomBadgeStyle = function genCustomBadgeStyle(token) {
45
45
  display: "inline-block",
46
46
  height: "20px",
47
47
  lineHeight: "20px"
48
- })), "".concat(badgePrefix).concat(badgePrefix, "-wrapper"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(badgePrefix, "-multiple-words"), {
48
+ })), "".concat(badgePrefix).concat(badgePrefix, "-wrapper"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(badgePrefix, "-multiple-words"), {
49
49
  padding: "0 6px"
50
50
  }), "".concat(badgePrefix, "-count"), {
51
51
  boxShadow: "none !important"
52
+ }), "".concat(badgePrefix, "-status-dot:only-child"), {
53
+ marginRight: "8px"
52
54
  }), "".concat(badgePrefix, "-dot"), {
53
55
  boxShadow: "none !important"
54
56
  }), "".concat(badgePrefix, "-scroll-number"), {
@@ -0,0 +1,54 @@
1
+ var _excluded = ["children", "id"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
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."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
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; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
11
+ import React, { useLayoutEffect, useRef, useEffect } from "react";
12
+ import useConfigContext from "../useConfigContext";
13
+ import { eventManager } from "../utils";
14
+ import classnames from "classnames";
15
+ import useStyle from "./style/footer";
16
+ function Footer(_ref) {
17
+ var children = _ref.children,
18
+ _ref$id = _ref.id,
19
+ id = _ref$id === void 0 ? "" : _ref$id,
20
+ res = _objectWithoutProperties(_ref, _excluded);
21
+ var _useConfigContext = useConfigContext(),
22
+ getPrefixCls = _useConfigContext.getPrefixCls;
23
+ var prefixCls = getPrefixCls("basic-layout");
24
+ var dom = useRef(null);
25
+ var _useStyle = useStyle("".concat(prefixCls, "-cw-layout-bottom-footer")),
26
+ _useStyle2 = _slicedToArray(_useStyle, 3),
27
+ wrapCSSVar = _useStyle2[0],
28
+ hashId = _useStyle2[1],
29
+ cssVarCls = _useStyle2[2];
30
+ useLayoutEffect(function () {
31
+ // 通知layout已加载 fixed 路由懒加载找不到节点
32
+ eventManager.emit("footerLoaded", {
33
+ children: children,
34
+ props: res,
35
+ dom: dom.current
36
+ });
37
+ return function () {
38
+ eventManager.emit("footerUnmount");
39
+ };
40
+ }, []);
41
+
42
+ // 修复属性不更新
43
+ useEffect(function () {
44
+ eventManager.emit("footerUpdate", {
45
+ children: children,
46
+ props: res
47
+ });
48
+ });
49
+ return wrapCSSVar( /*#__PURE__*/React.createElement("div", _extends({
50
+ className: classnames(hashId, cssVarCls, "".concat(prefixCls, "-cw-layout-bottom-footer")),
51
+ ref: dom
52
+ }, res), children));
53
+ }
54
+ export default Footer;
@@ -2,6 +2,7 @@ import _Icon from "@chaoswise/ui/lib/Icon";
2
2
  import _ErrorBoundary from "@chaoswise/ui/lib/ErrorBoundary";
3
3
  import _Header from "@chaoswise/ui/lib/Header";
4
4
  import _Layout from "@chaoswise/ui/lib/Layout";
5
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
5
6
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
7
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
8
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -13,8 +14,10 @@ import ReactDOM from "react-dom";
13
14
  import PropTypes from "prop-types";
14
15
  import classnames from "classnames";
15
16
  import Breadcrumb from "./Breadcrumb";
17
+ import Footer from "./Footer";
16
18
  import Sider from "./Sider";
17
19
  import Nav from "./Nav";
20
+ import { eventManager } from '../utils';
18
21
  import { judgeIsIframe } from "./utils";
19
22
  import intl from "../locales";
20
23
  import useStyle from "./style/index";
@@ -93,6 +96,18 @@ var BasicLayout = function BasicLayout(_ref) {
93
96
  _menuOptions$resizabl = menuOptions.resizableProps,
94
97
  _menuOptions$resizabl2 = _menuOptions$resizabl === void 0 ? {} : _menuOptions$resizabl,
95
98
  siderDragWidth = _menuOptions$resizabl2.siderDragWidth;
99
+ // footer -- todo:删除+文档描述
100
+ var footerRef = useRef(null);
101
+ var _useState = useState(null),
102
+ _useState2 = _slicedToArray(_useState, 2),
103
+ cloneFooter = _useState2[0],
104
+ setCloneFooter = _useState2[1];
105
+ var isWatchFooter = useRef(false);
106
+ var _useState3 = useState(false),
107
+ _useState4 = _slicedToArray(_useState3, 2),
108
+ hasFooter = _useState4[0],
109
+ setHasFooter = _useState4[1];
110
+ // footer -- todo:删除+文档描述
96
111
  var contentRef = useRef(null);
97
112
  var layoutRef = useRef(null);
98
113
  var SIDER_WIDTH_MAP = {
@@ -101,10 +116,10 @@ var BasicLayout = function BasicLayout(_ref) {
101
116
  zh_TW: siderWidth
102
117
  };
103
118
  var defaultSiderWidth = SIDER_WIDTH_MAP[currentLocale];
104
- var _useState = useState(defaultSiderWidth),
105
- _useState2 = _slicedToArray(_useState, 2),
106
- _siderDragWidth = _useState2[0],
107
- _setSiderDragWidth = _useState2[1];
119
+ var _useState5 = useState(defaultSiderWidth),
120
+ _useState6 = _slicedToArray(_useState5, 2),
121
+ _siderDragWidth = _useState6[0],
122
+ _setSiderDragWidth = _useState6[1];
108
123
  useEffect(function () {
109
124
  onPassWidth(_siderDragWidth);
110
125
  }, [_siderDragWidth]);
@@ -124,6 +139,51 @@ var BasicLayout = function BasicLayout(_ref) {
124
139
  _setSiderDragWidth(defaultSiderWidth);
125
140
  }
126
141
  }, [currentLocale, defaultSiderWidth]);
142
+ // ----- footer先使用后面删除+文档描述 -----
143
+ var onFooterLoaded = function onFooterLoaded(args) {
144
+ // 移动footer到指定位置展示 统一布局
145
+ setTimeout(function () {
146
+ // 如果是portal不监听
147
+ var contentDom = ReactDOM.findDOMNode(contentRef.current);
148
+ if (!contentDom) {
149
+ return;
150
+ }
151
+ var footerBoxNum = contentDom.getElementsByClassName("cw-layout-footer-box").length;
152
+ if (footerBoxNum === 1) {
153
+ var _hasFooter = contentDom.getElementsByClassName("".concat(prefixCls, "-cw-layout-bottom-footer")).length > 0;
154
+ // fixed storybook 多个demo冲突
155
+ if (_hasFooter) {
156
+ setHasFooter(true);
157
+ placeFooter(args);
158
+ }
159
+ }
160
+ });
161
+ };
162
+ var onFooterUpdate = function onFooterUpdate(_ref2) {
163
+ var props = _ref2.props,
164
+ children = _ref2.children;
165
+ setCloneFooter(function (preFooter) {
166
+ if (preFooter) {
167
+ return /*#__PURE__*/React.createElement("div", _extends({
168
+ className: "".concat(prefixCls, "-cw-layout-bottom-footer")
169
+ }, props), children);
170
+ }
171
+ return null;
172
+ });
173
+ };
174
+ if (!isWatchFooter.current) {
175
+ isWatchFooter.current = true;
176
+ eventManager.on("footerLoaded", onFooterLoaded);
177
+ }
178
+ useEffect(function () {
179
+ eventManager.on("footerUnmount", onFooterUnmount);
180
+ eventManager.on("footerUpdate", onFooterUpdate);
181
+ return function () {
182
+ eventManager.off("footerUnmount", onFooterUnmount);
183
+ eventManager.off("footerLoaded", onFooterLoaded);
184
+ eventManager.off("footerUpdate", onFooterUpdate);
185
+ };
186
+ }, []);
127
187
  useEffect(function () {
128
188
  var contentDom = ReactDOM.findDOMNode(contentRef.current);
129
189
  // 判断是否是嵌套 隐藏子元素的header portal嵌套
@@ -133,6 +193,32 @@ var BasicLayout = function BasicLayout(_ref) {
133
193
  childHeader[0].setAttribute("style", "display: none");
134
194
  }
135
195
  });
196
+ var onFooterUnmount = function onFooterUnmount() {
197
+ setCloneFooter(null);
198
+ setHasFooter(false);
199
+ };
200
+ /**
201
+ * 移动footer
202
+ */
203
+ var placeFooter = function placeFooter(_ref3) {
204
+ var children = _ref3.children,
205
+ dom = _ref3.dom,
206
+ props = _ref3.props;
207
+ setCloneFooter( /*#__PURE__*/React.createElement("div", _extends({
208
+ className: "".concat(prefixCls, "-cw-layout-bottom-footer")
209
+ }, props), children));
210
+
211
+ // 拿到父节点 卸载掉原始
212
+ var parent = dom.parentElement;
213
+
214
+ // fixed storybook内多实例报错
215
+ if (parent) {
216
+ // Fixed 协助dom与react内部方法冲突
217
+ // parent.removeChild(dom);
218
+ dom.style.display = "none";
219
+ }
220
+ };
221
+ // ----- footer -----
136
222
  return wrapCSSVar( /*#__PURE__*/React.createElement("div", {
137
223
  className: classnames(hashId, cssVarCls, "".concat(prefixCls, "-cw-layout-out"), className),
138
224
  style: style,
@@ -182,7 +268,9 @@ var BasicLayout = function BasicLayout(_ref) {
182
268
  menuOptions: menuOptions
183
269
  }), /*#__PURE__*/React.createElement(Content, {
184
270
  ref: contentRef,
185
- className: classnames("cw-content-wrapper", isShowNav ? "cw-content-wrapper-hasnav" : "", customContent ? "cw-content-wrapper-custom" : "" // 内容区自定义
271
+ className: classnames("cw-content-wrapper", hasFooter ? "cw-content-wrapper-footer" : "",
272
+ // footer
273
+ isShowNav ? "cw-content-wrapper-hasnav" : "", customContent ? "cw-content-wrapper-custom" : "" // 内容区自定义
186
274
  )
187
275
  }, /*#__PURE__*/React.createElement(Nav, {
188
276
  customContent: customContent,
@@ -203,7 +291,10 @@ var BasicLayout = function BasicLayout(_ref) {
203
291
  })
204
292
  }, /*#__PURE__*/React.createElement("div", {
205
293
  className: "cw-show-area-hack"
206
- }, ErrorBoundary ? /*#__PURE__*/React.createElement(_ErrorBoundary, null, children) : children)))))));
294
+ }, ErrorBoundary ? /*#__PURE__*/React.createElement(_ErrorBoundary, null, children) : children)), /*#__PURE__*/React.createElement("div", {
295
+ className: "cw-layout-footer-box",
296
+ ref: footerRef
297
+ }, cloneFooter))))));
207
298
  };
208
299
  BasicLayout.defaultProps = {
209
300
  showSider: true,
@@ -393,4 +484,5 @@ BasicLayout.propTypes = {
393
484
  */
394
485
  topNavigationOption: PropTypes.object
395
486
  };
487
+ BasicLayout.Footer = Footer;
396
488
  export default BasicLayout;
@@ -0,0 +1,28 @@
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 _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4
+ 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); }
5
+ import { genStyleHooks } from "../../Antd5/theme/internal";
6
+ var genCustomFooterStyle = function genCustomFooterStyle(token) {
7
+ var prefixCls = token.antCls;
8
+ var basicLayoutPrefixCls = "".concat(prefixCls, "-basic-layout");
9
+ return _defineProperty({}, "".concat(basicLayoutPrefixCls, "-cw-layout-bottom-footer"), {
10
+ position: "absolute",
11
+ bottom: 0,
12
+ left: 0,
13
+ width: "100%",
14
+ height: "52px",
15
+ boxShadow: "0 -1px 2px 0 rgba(0,0,0,0.06)",
16
+ display: "flex",
17
+ alignItems: "center",
18
+ backgroundColor: token.colorBgContainer,
19
+ // @body-background;
20
+ padding: "0 20px 2px"
21
+ });
22
+ };
23
+ // ============================== Export ==============================
24
+ export default genStyleHooks(["BasicLayout", "Footer"], function (token) {
25
+ return [
26
+ //
27
+ genCustomFooterStyle(token)];
28
+ });
@@ -6,7 +6,7 @@ import { genStyleHooks } from "../../Antd5/theme/internal";
6
6
  var genCustomBasicLayoutStyle = function genCustomBasicLayoutStyle(token) {
7
7
  var prefixCls = token.antCls;
8
8
  var basicLayoutPrefixCls = "".concat(prefixCls, "-basic-layout");
9
- return _defineProperty({}, "".concat(basicLayoutPrefixCls, "-cw-layout-out"), {
9
+ return _defineProperty({}, "".concat(basicLayoutPrefixCls, "-cw-layout-out"), _defineProperty({
10
10
  height: "100%",
11
11
  width: "100%",
12
12
  overflowX: "auto",
@@ -88,10 +88,25 @@ var genCustomBasicLayoutStyle = function genCustomBasicLayoutStyle(token) {
88
88
  // 内容区自定义
89
89
  ".cw-content-wrapper-custom": {
90
90
  padding: 0
91
+ },
92
+ ".cw-content-wrapper-footer": {
93
+ paddingBottom: "52px"
91
94
  }
92
95
  }
93
96
  }
94
- });
97
+ }, "".concat(basicLayoutPrefixCls, "-cw-layout-bottom-footer"), {
98
+ position: "absolute",
99
+ bottom: 0,
100
+ left: 0,
101
+ width: "100%",
102
+ height: "52px",
103
+ boxShadow: "0 -1px 2px 0 rgba(0,0,0,0.06)",
104
+ display: "flex",
105
+ alignItems: "center",
106
+ backgroundColor: token.colorBgContainer,
107
+ // @body-background;
108
+ padding: "0 20px 2px"
109
+ }));
95
110
  };
96
111
  // ============================== Export ==============================
97
112
  export default genStyleHooks("BasicLayout", function (token) {
@@ -3,9 +3,11 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
3
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4
4
  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); }
5
5
  import { genStyleHooks } from "../Antd5/theme/internal";
6
+ import { unit } from '@ant-design/cssinjs';
6
7
  var prepareComponentToken = function prepareComponentToken(token) {
7
8
  return {
8
- headerColorLayout: token.Layout.headerColor
9
+ headerColorLayout: token.Layout.headerColor,
10
+ headerHeightLayout: token.Layout.headerHeight
9
11
  };
10
12
  };
11
13
  var genCustomCWMessageStyle = function genCustomCWMessageStyle(token) {
@@ -15,9 +17,17 @@ var genCustomCWMessageStyle = function genCustomCWMessageStyle(token) {
15
17
  var drawerPrefix = "".concat(prefixCls, "-drawer");
16
18
  var emptyPrefix = "".concat(prefixCls, "-empty");
17
19
  var tabPrefix = "".concat(prefixCls, "-tabs");
18
- return _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-notification"), _defineProperty(_defineProperty({}, "&:has(".concat(messagePrefixCls, "-notification-wrapper)"), {
19
- margin: "0"
20
- }), "".concat(messagePrefixCls, "-notification-wrapper"), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-notification-notice-message"), {
20
+ return _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-notification"), _defineProperty(_defineProperty({}, "&:has(".concat(messagePrefixCls, "-notification-wrapper)"), _defineProperty({
21
+ overflowX: "hidden",
22
+ overflowY: "auto",
23
+ height: "calc(100% - ".concat(unit(token.headerHeightLayout), ")"),
24
+ margin: "0",
25
+ width: "404px"
26
+ }, "".concat(prefixCls, "-notification-notice-wrapper"), _defineProperty({
27
+ boxShadow: "0 4px 12px rgba(0, 0, 0, .15) !important"
28
+ }, "".concat(prefixCls, "-business-message-notification-wrapper"), _defineProperty({}, "".concat(prefixCls, "-notification-notice-close"), {
29
+ backgroundColor: "transparent !important"
30
+ })))), "".concat(messagePrefixCls, "-notification-wrapper"), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-notification-notice-message"), {
21
31
  width: "100%",
22
32
  textOverflow: "ellipsis",
23
33
  overflow: "hidden",
@@ -581,7 +581,8 @@ var CWTable = function CWTable(_ref, ref) {
581
581
  columns: tableColumns,
582
582
  dataSource: finalDataSource,
583
583
  rowSelection: rowSelection && _objectSpread({
584
- columnWidth: 40
584
+ columnWidth: 40,
585
+ preserveSelectedRowKeys: true
585
586
  }, rowSelection),
586
587
  pagination: false,
587
588
  onExpand: onExpand,
@@ -162,6 +162,9 @@ export default {
162
162
  Notification: {
163
163
  zIndexPopup: 950
164
164
  },
165
+ Message: {
166
+ contentPadding: "9px 16px"
167
+ },
165
168
  // Empty: {
166
169
  // // 组件内部需要调整符合UI规范的样式
167
170
  // // 1.空状态默认图标替换
@@ -199,11 +202,11 @@ export default {
199
202
  headerColor: "rgba(0, 0, 0, 0.65)",
200
203
  // token变量 colorTextSecondary
201
204
  fontWeightStrong: 400,
202
- rowHoverBg: "rgba(0, 0, 0, 0.02)",
205
+ rowHoverBg: "#fafafa",
203
206
  // token变量 colorFillQuaternary
204
- rowSelectedBg: "rgba(0, 0, 0, 0.02)",
207
+ rowSelectedBg: "#fafafa",
205
208
  // token变量 colorFillQuaternary
206
- rowSelectedHoverBg: "rgba(0, 0, 0, 0.02)",
209
+ rowSelectedHoverBg: "#fafafa",
207
210
  // token变量 colorFillQuaternary
208
211
  cellPaddingBlock: 12,
209
212
  cellPaddingInline: 12,
@@ -54,12 +54,12 @@ var CWDrawer = /*#__PURE__*/forwardRef(function (_ref, ref) {
54
54
  middle: 660,
55
55
  large: 920
56
56
  };
57
- var headerHeight = useMemo(function () {
58
- return title ? 52 : 0;
59
- }, [title]);
57
+ // const headerHeight = useMemo(() => {
58
+ // return title ? 52 : 0;
59
+ // }, [title]);
60
60
  var _bodyStyle = {
61
- height: "calc(100% - ".concat(headerHeight, "px)"),
62
- overflow: "auto"
61
+ // height: `calc(100% - ${headerHeight}px)`,
62
+ // overflow: "auto",
63
63
  };
64
64
  var cwExtra = useMemo(function () {
65
65
  if (title) {
@@ -32,6 +32,7 @@ var genCustomCWDrawerStyle = function genCustomCWDrawerStyle(token) {
32
32
  lineHeight: "51px",
33
33
  // UI规范
34
34
  cursor: "pointer",
35
+ background: "transparent !important",
35
36
  "&:focus, &:hover": {
36
37
  color: "".concat(token.colorPrimaryHover, " !important")
37
38
  }
@@ -60,7 +61,7 @@ var genCustomCWDrawerStyle = function genCustomCWDrawerStyle(token) {
60
61
  lineHeight: "51px !important",
61
62
  flex: "none !important",
62
63
  padding: "0 24px !important",
63
- borderBottom: "".concat(unit(token.lineWidth), " ").concat(token.lineType).concat(token.colorBorderSecondary)
64
+ borderBottom: "".concat(unit(token.lineWidth), " ").concat(token.lineType, " ").concat(token.colorBorderSecondary)
64
65
  }, "".concat(drawerPrefix, "-close"), {
65
66
  marginRight: "0"
66
67
  }), "&-title", _defineProperty({
@@ -10,8 +10,8 @@ var genCustomCWFormStyle = function genCustomCWFormStyle(token) {
10
10
  var formItemPrefix = "".concat(prefixCls, "-form-item");
11
11
  return _defineProperty({}, "".concat(prefixCls, "-form").concat(prefixCls, "-form-wrapper"), _defineProperty(_defineProperty(_defineProperty({}, "&".concat(prefixCls, "-form-inline"), _defineProperty({}, "".concat(formItemPrefix), {
12
12
  marginBottom: "24px"
13
- })), "".concat(formItemPrefix), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(formItemPrefix, "-label-horizontal"), _defineProperty({
14
- display: "flex !important",
13
+ })), "".concat(formItemPrefix), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(formItemPrefix, "-label").concat(formItemPrefix, "-label-horizontal"), _defineProperty({
14
+ display: "flex",
15
15
  alignItems: "center",
16
16
  height: unit(token.controlHeight)
17
17
  }, "&".concat(formItemPrefix, "-label > label"), _defineProperty(_defineProperty(_defineProperty({
@@ -2,6 +2,7 @@ import _Upload from "@chaoswise/ui/lib/Upload";
2
2
  import _Button from "@chaoswise/ui/lib/Button";
3
3
  import _message from "@chaoswise/ui/lib/message";
4
4
  import React from "react";
5
+ import { UploadOutlined } from '@ant-design/icons';
5
6
  import { useIntl } from "../../../locales";
6
7
  var CustomImg = function CustomImg(_ref) {
7
8
  var onChange = _ref.onChange,
@@ -76,7 +77,7 @@ var CustomImg = function CustomImg(_ref) {
76
77
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
77
78
  className: "custom-img"
78
79
  }, /*#__PURE__*/React.createElement(_Button, {
79
- icon: "upload"
80
+ icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
80
81
  }, intl.get("1a190483-11d6-4fc7-bdd8-9ebed6dcf14e").d("上传本地图片")), /*#__PURE__*/React.createElement("div", {
81
82
  className: "custom-img-tip"
82
83
  }, intl.get("718c1df1-dba2-4e7a-a078-46c54ee4875a").d("推荐上传40*40的PNG、SVG、JPG、JGPG,⼤⼩不超过2M"))))));
@@ -18,7 +18,7 @@ var genCustomIconSelectStyle = function genCustomIconSelectStyle(token) {
18
18
  textAlign: "left"
19
19
  }))), "".concat(iconSelectPrefix, "-dropdown"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
20
20
  background: token.colorBgContainer,
21
- width: "240px",
21
+ width: "250px",
22
22
  borderRadius: "4px",
23
23
  outline: "none",
24
24
  WebkitBoxShadow: token.boxShadow,
@@ -0,0 +1,78 @@
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
+ import _Breadcrumb from "@chaoswise/ui/lib/Breadcrumb";
3
+ var _excluded = ["formatData", "itemRender", "render", "data", "style"];
4
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
5
+ 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; }
6
+ 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; }
7
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
+ 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); }
10
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
11
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
12
+ import React, { useMemo } from 'react';
13
+ import { useHistory } from 'react-router-dom';
14
+ import { Link } from 'react-router-dom';
15
+ function BreadcrumbShow(_ref) {
16
+ var _ref$routes = _ref.routes,
17
+ routes = _ref$routes === void 0 ? [] : _ref$routes,
18
+ currentPath = _ref.currentPath,
19
+ breadcrumbOptions = _ref.breadcrumbOptions;
20
+ var formatData = breadcrumbOptions.formatData,
21
+ itemRender = breadcrumbOptions.itemRender,
22
+ render = breadcrumbOptions.render,
23
+ breadData = breadcrumbOptions.data,
24
+ _breadcrumbOptions$st = breadcrumbOptions.style,
25
+ style = _breadcrumbOptions$st === void 0 ? {} : _breadcrumbOptions$st,
26
+ resP = _objectWithoutProperties(breadcrumbOptions, _excluded);
27
+ var _useHistory = useHistory(),
28
+ location = _useHistory.location;
29
+ var pathname = currentPath ? currentPath : location.pathname;
30
+ var breadcrumbData = useMemo(function () {
31
+ var finalData = routes;
32
+ var breadcrumbNameMap = {};
33
+ function getBreadcrumbByRoutes(routes) {
34
+ routes.forEach(function (item) {
35
+ if (item.path || item.pathName) {
36
+ breadcrumbNameMap[item.path || item.pathName] = item;
37
+ }
38
+ if (item.routes && item.routes.length > 0 || item.children && item.children.length > 0) {
39
+ getBreadcrumbByRoutes(item.routes || item.children);
40
+ }
41
+ });
42
+ }
43
+ getBreadcrumbByRoutes(finalData);
44
+ var pathSnippets = pathname.split('/').filter(function (i) {
45
+ return i;
46
+ });
47
+ var data = pathSnippets.map(function (_, index) {
48
+ var path = "/".concat(pathSnippets.slice(0, index + 1).join('/'));
49
+ return _objectSpread({
50
+ path: path
51
+ }, breadcrumbNameMap[path]);
52
+ });
53
+ if (formatData) {
54
+ return formatData(data);
55
+ }
56
+ return data;
57
+ }, [routes, pathname, formatData]);
58
+ if (render) {
59
+ return render({
60
+ routes: routes,
61
+ data: data,
62
+ currentPath: currentPath,
63
+ breadcrumbOptions: breadcrumbOptions
64
+ });
65
+ }
66
+ var _breadcrumbData = breadData ? breadData : breadcrumbData;
67
+ return /*#__PURE__*/React.createElement(_Breadcrumb, _extends({
68
+ style: _objectSpread({}, style)
69
+ }, resP), _breadcrumbData.map(function (bread, index) {
70
+ var item = index === _breadcrumbData.length - 1 ? bread.name : /*#__PURE__*/React.createElement(Link, {
71
+ to: bread.path
72
+ }, bread.name);
73
+ return /*#__PURE__*/React.createElement(_Breadcrumb.Item, {
74
+ key: bread.path
75
+ }, itemRender ? itemRender(bread, index) : item);
76
+ }));
77
+ }
78
+ export default BreadcrumbShow;
@@ -168,8 +168,6 @@ LayoutWrapper.defaultProps = {
168
168
  // 默认为false
169
169
  goBack: function goBack() {},
170
170
  // 默认为空函数
171
- hasHeader: true,
172
- // 默认为true
173
171
  className: '',
174
172
  // 默认为空字符串
175
173
  extra: null,
@@ -34,6 +34,7 @@ function CWMenu(_ref) {
34
34
  rest = _objectWithoutProperties(_ref, _excluded);
35
35
  var _useConfigContext = useConfigContext(),
36
36
  getPrefixCls = _useConfigContext.getPrefixCls;
37
+ var menuPrefixCls = getPrefixCls("menu");
37
38
  var prefixCls = getPrefixCls("sider-menu");
38
39
  var _useStyle = useStyle(prefixCls),
39
40
  _useStyle2 = _slicedToArray(_useStyle, 3),
@@ -123,6 +124,15 @@ function CWMenu(_ref) {
123
124
  return true;
124
125
  }
125
126
  return false;
127
+ }).map(function (item) {
128
+ if (item.children || item.routes) {
129
+ var children = filterData(item.children || item.routes);
130
+ return _objectSpread(_objectSpread({}, item), {}, {
131
+ children: children,
132
+ routes: children
133
+ });
134
+ }
135
+ return item;
126
136
  });
127
137
  }, []);
128
138
  var items = useMemo(function () {
@@ -133,6 +143,7 @@ function CWMenu(_ref) {
133
143
  var omitProps = hasParent ? omit(item, ["pathName", "name", "icon"]) : omit(item, ["pathName", "name"]);
134
144
  var record = _objectSpread(_objectSpread({
135
145
  label: /*#__PURE__*/React.createElement("span", {
146
+ className: "".concat(menuPrefixCls, "-title-content"),
136
147
  style: {
137
148
  paddingLeft: !hasParent ? 0 : !collapsed ? 12 : 0
138
149
  }
@@ -38,13 +38,17 @@ var genCustomCWTabsStyle = function genCustomCWTabsStyle(token) {
38
38
  borderColor: token.tabsBorderColor
39
39
  }))), "".concat(tabsPrefixCls, "-nav"), _defineProperty({}, "".concat(tabsPrefixCls, "-tab"), _defineProperty(_defineProperty({}, token.iconCls, {
40
40
  marginRight: "0"
41
- }), "".concat(tabsPrefixCls, "-tab-btn"), _defineProperty({}, token.iconCls, {
41
+ }), "".concat(tabsPrefixCls, "-tab-btn"), _defineProperty({
42
+ fontSize: "inherit"
43
+ }, token.iconCls, {
42
44
  "&:first-of-type": {
43
45
  marginRight: "4px"
44
46
  }
45
- })))), "".concat(tabsPrefixCls, "-content-holder"), {
46
- flex: "1" // Fix for height issue in some versions of Google Chrome when using flex:auto in Tabs
47
- }))), "".concat(tabsPrefixCls, "-popup"), _defineProperty({}, "&".concat(tabsPrefixCls, "-dropdown"), _defineProperty({
47
+ })))), "".concat(tabsPrefixCls, "-content-holder"), _defineProperty({
48
+ flex: "1"
49
+ }, "".concat(tabsPrefixCls, "-content"), _defineProperty({}, "".concat(tabsPrefixCls, "-tabpane"), {
50
+ height: "100%"
51
+ }))))), "".concat(tabsPrefixCls, "-popup"), _defineProperty({}, "&".concat(tabsPrefixCls, "-dropdown"), _defineProperty({
48
52
  pointerEvents: "auto !important"
49
53
  }, "&".concat(tabsPrefixCls, "-slide-up-leave"), {
50
54
  display: "none !important"
@@ -0,0 +1,95 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ 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
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ 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
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import React from "react";
8
+ import PropTypes from "prop-types";
9
+ import useStyle from "./index.style";
10
+ import classnames from "classnames";
11
+ var _ = require("lodash-es");
12
+
13
+ /**
14
+ *
15
+ * 图表布局组件,用于规则地排列图表,可以设置展示模式,以适应不同的展示场景。
16
+ */
17
+ export default function UniversalLayout(_ref) {
18
+ var mode = _ref.mode,
19
+ style = _ref.style,
20
+ itemStyle = _ref.itemStyle,
21
+ children = _ref.children;
22
+ var _useStyle = useStyle("cw-universal-layout"),
23
+ _useStyle2 = _slicedToArray(_useStyle, 3),
24
+ wrapCSSVar = _useStyle2[0],
25
+ hashId = _useStyle2[1],
26
+ cssVarCls = _useStyle2[2];
27
+ if (React.Children.count(children) == 1) {
28
+ return wrapCSSVar( /*#__PURE__*/React.createElement("div", {
29
+ className: classnames(hashId, cssVarCls, "cw-universal-layout", "cw-universal-layout-one"),
30
+ style: style
31
+ }, /*#__PURE__*/React.createElement("div", {
32
+ className: "cw-chart-item",
33
+ style: itemStyle
34
+ }, children)));
35
+ } else if (React.Children.count(children) > 1) {
36
+ if (mode.mode === "grid") {
37
+ var proportion = Number.parseInt(1 / mode.number * 100);
38
+ return wrapCSSVar( /*#__PURE__*/React.createElement("div", {
39
+ className: classnames(hashId, cssVarCls, "cw-universal-layout", "cw-universal-layout-grid"),
40
+ style: style
41
+ }, React.Children.map(children, function (child) {
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: "cw-chart-item",
44
+ style: _.merge(itemStyle, {
45
+ flexBasis: "".concat(proportion, "%"),
46
+ width: "auto"
47
+ })
48
+ }, child);
49
+ })));
50
+ } else if (mode.mode === "queue") {
51
+ return wrapCSSVar( /*#__PURE__*/React.createElement("div", {
52
+ className: classnames(hashId, cssVarCls, "cw-universal-layout", "cw-universal-layout-queue"),
53
+ style: _.merge(style, mode.enter ? {
54
+ flexWrap: "wrap"
55
+ } : {
56
+ width: "max-content"
57
+ })
58
+ }, React.Children.map(children, function (child) {
59
+ return /*#__PURE__*/React.createElement("div", {
60
+ className: "cw-chart-item",
61
+ style: _.merge({
62
+ width: "100px"
63
+ }, itemStyle)
64
+ }, child);
65
+ })));
66
+ }
67
+ }
68
+ }
69
+ UniversalLayout.defaultProps = {
70
+ mode: {
71
+ mode: "grid",
72
+ number: 2
73
+ }
74
+ };
75
+ UniversalLayout.propTypes = {
76
+ /**
77
+ * 多个图表的展示模式。mode表示展示模式,可选参数为栅格(grid)或队列(queue);
78
+ * 可设置每行显示的图表个数(number);
79
+ * 可设置队列布局是否换行。
80
+ */
81
+ mode: PropTypes.shape({
82
+ mode: PropTypes.oneOf(["grid", "queue"]).isRequired,
83
+ number: PropTypes.number,
84
+ enter: PropTypes.bool
85
+ }),
86
+ /**
87
+ * 布局样式
88
+ */
89
+ style: PropTypes.object,
90
+ /**
91
+ * 每个布局元素样式,
92
+ * 栅格不支持设置固定宽度。
93
+ */
94
+ itemStyle: PropTypes.object
95
+ };
@@ -0,0 +1,32 @@
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 _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4
+ 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); }
5
+ import { genStyleHooks } from "../Antd5/theme/internal";
6
+ var genCustomUniversalLayoutStyle = function genCustomUniversalLayoutStyle() {
7
+ return _defineProperty({}, ".cw-universal-layout", _defineProperty(_defineProperty(_defineProperty({
8
+ width: "100%",
9
+ height: "100%",
10
+ overflow: "auto"
11
+ }, "&.cw-universal-layout-one", {
12
+ display: "flex",
13
+ justifyContent: "center",
14
+ alignItems: "center",
15
+ ".cw-chart-item": {
16
+ width: "100%"
17
+ }
18
+ }), "&.cw-universal-layout-grid", {
19
+ display: "flex",
20
+ justifyContent: "center",
21
+ alignItems: "center",
22
+ alignContent: "center",
23
+ flexWrap: "wrap"
24
+ }), "&.cw-universal-layout-queue", {
25
+ display: "flex",
26
+ alignItems: "center"
27
+ }));
28
+ };
29
+ // ============================== Export ==============================
30
+ export default genStyleHooks("UniversalLayout", function (token) {
31
+ return [genCustomUniversalLayoutStyle(token)];
32
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chaoswise/ui",
3
3
  "packageName": "chaoswiseUI",
4
- "version": "3.0.8",
4
+ "version": "3.0.9",
5
5
  "description": "公共UI库",
6
6
  "keywords": [
7
7
  "ui",