@chaoswise/ui 3.1.0 → 3.1.1

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.
@@ -22,7 +22,6 @@ import PaperClipOutlined from '@ant-design/icons/PaperClipOutlined';
22
22
  import PictureTwoTone from '@ant-design/icons/PictureTwoTone';
23
23
  import classNames from 'classnames';
24
24
  import CSSMotion, { CSSMotionList } from 'rc-motion';
25
- import omit from 'rc-util/lib/omit';
26
25
  import useForceUpdate from '../../_util/hooks/useForceUpdate';
27
26
  import initCollapseMotion from '../../_util/motion';
28
27
  import { cloneElement } from '../../_util/reactNode';
@@ -54,7 +53,6 @@ var InternalUploadList = function InternalUploadList(props, ref) {
54
53
  removeIcon = props.removeIcon,
55
54
  previewIcon = props.previewIcon,
56
55
  downloadIcon = props.downloadIcon,
57
- extra = props.extra,
58
56
  _props$progress = props.progress,
59
57
  progress = _props$progress === void 0 ? {
60
58
  size: [-1, 2],
@@ -70,22 +68,22 @@ var InternalUploadList = function InternalUploadList(props, ref) {
70
68
  _React$useState2 = _slicedToArray(_React$useState, 2),
71
69
  motionAppear = _React$useState2[0],
72
70
  setMotionAppear = _React$useState2[1];
73
- var isPictureCardOrCirle = ['picture-card', 'picture-circle'].includes(listType);
74
71
  // ============================= Effect =============================
75
72
  React.useEffect(function () {
76
- if (!listType.startsWith('picture')) {
73
+ if (listType !== 'picture' && listType !== 'picture-card' && listType !== 'picture-circle') {
77
74
  return;
78
75
  }
79
76
  (items || []).forEach(function (file) {
80
- if (!(file.originFileObj instanceof File || file.originFileObj instanceof Blob) || file.thumbUrl !== undefined) {
77
+ if (typeof document === 'undefined' || typeof window === 'undefined' || !window.FileReader || !window.File || !(file.originFileObj instanceof File || file.originFileObj) || file.thumbUrl !== undefined) {
81
78
  return;
82
79
  }
83
- file.thumbUrl = '';
84
- previewFile === null || previewFile === void 0 || previewFile(file.originFileObj).then(function (previewDataUrl) {
85
- // Need append '' to avoid dead loop
86
- file.thumbUrl = previewDataUrl || '';
87
- forceUpdate();
88
- });
80
+ if (previewFile) {
81
+ previewFile(file.originFileObj).then(function (previewDataUrl) {
82
+ // Need append '' to avoid dead loop
83
+ file.thumbUrl = previewDataUrl || '';
84
+ forceUpdate();
85
+ });
86
+ }
89
87
  });
90
88
  }, [listType, items, previewFile]);
91
89
  React.useEffect(function () {
@@ -114,12 +112,14 @@ var InternalUploadList = function InternalUploadList(props, ref) {
114
112
  return iconRender(file, listType);
115
113
  }
116
114
  var isLoading = file.status === 'uploading';
117
- if (listType.startsWith('picture')) {
118
- var loadingIcon = listType === 'picture' ? _jsx(LoadingOutlined, {}) : locale.uploading;
119
- var fileIcon = isImgUrl !== null && isImgUrl !== void 0 && isImgUrl(file) ? _jsx(PictureTwoTone, {}) : _jsx(FileTwoTone, {});
120
- return isLoading ? loadingIcon : fileIcon;
115
+ var fileIcon = isImgUrl && isImgUrl(file) ? _jsx(PictureTwoTone, {}) : _jsx(FileTwoTone, {});
116
+ var icon = isLoading ? _jsx(LoadingOutlined, {}) : _jsx(PaperClipOutlined, {});
117
+ if (listType === 'picture') {
118
+ icon = isLoading ? _jsx(LoadingOutlined, {}) : fileIcon;
119
+ } else if (listType === 'picture-card' || listType === 'picture-circle') {
120
+ icon = isLoading ? locale.uploading : fileIcon;
121
121
  }
122
- return isLoading ? _jsx(LoadingOutlined, {}) : _jsx(PaperClipOutlined, {});
122
+ return icon;
123
123
  };
124
124
  var actionIconRender = function actionIconRender(customIcon, callback, prefixCls, title, acceptUploadDisabled) {
125
125
  var btnProps = {
@@ -138,11 +138,15 @@ var InternalUploadList = function InternalUploadList(props, ref) {
138
138
  if (acceptUploadDisabled) {
139
139
  btnProps.disabled = disabled;
140
140
  }
141
- return /*#__PURE__*/React.isValidElement(customIcon) ? _jsx(Button, _objectSpread(_objectSpread({}, btnProps), {}, {
142
- icon: cloneElement(customIcon, _objectSpread(_objectSpread({}, customIcon.props), {}, {
141
+ if (/*#__PURE__*/React.isValidElement(customIcon)) {
142
+ var btnIcon = cloneElement(customIcon, _objectSpread(_objectSpread({}, customIcon.props), {}, {
143
143
  onClick: function onClick() {}
144
- }))
145
- })) : _jsx(Button, _objectSpread(_objectSpread({}, btnProps), {}, {
144
+ }));
145
+ return _jsx(Button, _objectSpread(_objectSpread({}, btnProps), {}, {
146
+ icon: btnIcon
147
+ }));
148
+ }
149
+ return _jsx(Button, _objectSpread(_objectSpread({}, btnProps), {}, {
146
150
  children: _jsx("span", {
147
151
  children: customIcon
148
152
  })
@@ -162,20 +166,31 @@ var InternalUploadList = function InternalUploadList(props, ref) {
162
166
  var prefixCls = getPrefixCls('upload', customizePrefixCls);
163
167
  var rootPrefixCls = getPrefixCls();
164
168
  var listClassNames = classNames("".concat(prefixCls, "-list"), "".concat(prefixCls, "-list-").concat(listType));
165
- var listItemMotion = React.useMemo(function () {
166
- return omit(initCollapseMotion(rootPrefixCls), ['onAppearEnd', 'onEnterEnd', 'onLeaveEnd']);
167
- }, [rootPrefixCls]);
168
- var motionConfig = _objectSpread(_objectSpread({}, isPictureCardOrCirle ? {} : listItemMotion), {}, {
169
+ // >>> Motion config
170
+ var motionKeyList = _toConsumableArray(items.map(function (file) {
171
+ return {
172
+ key: file.uid,
173
+ file: file
174
+ };
175
+ }));
176
+ var animationDirection = listType === 'picture-card' || listType === 'picture-circle' ? 'animate-inline' : 'animate';
177
+ // const transitionName = list.length === 0 ? '' : `${prefixCls}-${animationDirection}`;
178
+ var motionConfig = {
169
179
  motionDeadline: 2000,
170
- motionName: "".concat(prefixCls, "-").concat(isPictureCardOrCirle ? 'animate-inline' : 'animate'),
171
- keys: _toConsumableArray(items.map(function (file) {
172
- return {
173
- key: file.uid,
174
- file: file
175
- };
176
- })),
180
+ motionName: "".concat(prefixCls, "-").concat(animationDirection),
181
+ keys: motionKeyList,
177
182
  motionAppear: motionAppear
178
- });
183
+ };
184
+ var listItemMotion = React.useMemo(function () {
185
+ var motion = _objectSpread({}, initCollapseMotion(rootPrefixCls));
186
+ delete motion.onAppearEnd;
187
+ delete motion.onEnterEnd;
188
+ delete motion.onLeaveEnd;
189
+ return motion;
190
+ }, [rootPrefixCls]);
191
+ if (listType !== 'picture-card' && listType !== 'picture-circle') {
192
+ motionConfig = _objectSpread(_objectSpread({}, listItemMotion), motionConfig);
193
+ }
179
194
  return _jsxs("div", {
180
195
  className: listClassNames,
181
196
  children: [_jsx(CSSMotionList, _objectSpread(_objectSpread({}, motionConfig), {}, {
@@ -201,7 +216,6 @@ var InternalUploadList = function InternalUploadList(props, ref) {
201
216
  removeIcon: removeIcon,
202
217
  previewIcon: previewIcon,
203
218
  downloadIcon: downloadIcon,
204
- extra: extra,
205
219
  iconRender: internalIconRender,
206
220
  actionIconRender: actionIconRender,
207
221
  itemRender: itemRender,
@@ -17,7 +17,7 @@ var genDraggerStyle = function genDraggerStyle(token) {
17
17
  cursor: 'pointer',
18
18
  transition: "border-color ".concat(token.motionDurationSlow)
19
19
  }, componentCls, {
20
- padding: token.padding
20
+ // padding: token.padding, // 删除符合UI规范
21
21
  }), "".concat(componentCls, "-btn"), {
22
22
  display: 'table',
23
23
  width: '100%',
@@ -27,10 +27,23 @@ var genDraggerStyle = function genDraggerStyle(token) {
27
27
  '&:focus-visible': {
28
28
  outline: "".concat(unit(token.lineWidthFocus), " solid ").concat(token.colorPrimaryBorder)
29
29
  }
30
- }), "".concat(componentCls, "-drag-container"), {
30
+ }), "".concat(componentCls, "-drag-container"), _defineProperty({
31
31
  display: 'table-cell',
32
32
  verticalAlign: 'middle'
33
- }), "\n &:not(".concat(componentCls, "-disabled):hover,\n &-hover:not(").concat(componentCls, "-disabled)\n "), {
33
+ }, "".concat(componentCls, "-drag-wrapper"), _defineProperty(_defineProperty(_defineProperty({
34
+ padding: "39px 0"
35
+ }, "".concat(componentCls, "-drag-icon-wrapper"), _defineProperty({
36
+ marginBottom: "8px"
37
+ }, iconCls, {
38
+ color: token.colorPrimaryHover,
39
+ fontSize: "48px"
40
+ })), "".concat(componentCls, "-drag-text"), {
41
+ lineHeight: "20px"
42
+ }), "".concat(componentCls, "-drag-desc"), {
43
+ color: token.colorTextTertiary,
44
+ marginTop: "8px",
45
+ lineHeight: "20px"
46
+ }))), "\n &:not(".concat(componentCls, "-disabled):hover,\n &-hover:not(").concat(componentCls, "-disabled)\n "), {
34
47
  borderColor: token.colorPrimaryHover
35
48
  }), "p".concat(componentCls, "-drag-icon"), _defineProperty({
36
49
  marginBottom: token.margin
@@ -44,8 +57,16 @@ var genDraggerStyle = function genDraggerStyle(token) {
44
57
  }), "p".concat(componentCls, "-hint"), {
45
58
  color: token.colorTextDescription,
46
59
  fontSize: token.fontSize
47
- }), "&".concat(componentCls, "-disabled"), _defineProperty({}, "p".concat(componentCls, "-drag-icon ").concat(iconCls, ",\n p").concat(componentCls, "-text,\n p").concat(componentCls, "-hint\n "), {
60
+ }), "&".concat(componentCls, "-disabled"), _defineProperty(_defineProperty({
61
+ background: token.colorBgContainerDisabled
62
+ }, "p".concat(componentCls, "-drag-icon ").concat(iconCls, ",\n p").concat(componentCls, "-text,\n p").concat(componentCls, "-hint,\n "), {
63
+ color: token.colorTextDisabled
64
+ }), "".concat(componentCls, "-drag-wrapper"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-drag-icon-wrapper"), _defineProperty({}, iconCls, {
65
+ color: token.colorTextDisabled
66
+ })), "".concat(componentCls, "-drag-text"), {
67
+ color: token.colorTextDisabled
68
+ }), "".concat(componentCls, "-drag-desc"), {
48
69
  color: token.colorTextDisabled
49
- }))));
70
+ })))));
50
71
  };
51
72
  export default genDraggerStyle;
@@ -8,6 +8,7 @@ import { unit } from '@ant-design/cssinjs';
8
8
  import { clearFix, textEllipsis } from '../../style';
9
9
  var genListStyle = function genListStyle(token) {
10
10
  var componentCls = token.componentCls,
11
+ antCls = token.antCls,
11
12
  iconCls = token.iconCls,
12
13
  fontSize = token.fontSize,
13
14
  lineHeight = token.lineHeight,
@@ -15,6 +16,7 @@ var genListStyle = function genListStyle(token) {
15
16
  var itemCls = "".concat(componentCls, "-list-item");
16
17
  var actionsCls = "".concat(itemCls, "-actions");
17
18
  var actionCls = "".concat(itemCls, "-action");
19
+ var listItemHeightSM = token.fontHeightSM;
18
20
  return _defineProperty({}, "".concat(componentCls, "-wrapper"), _defineProperty({}, "".concat(componentCls, "-list"), _objectSpread(_objectSpread({}, clearFix()), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({
19
21
  lineHeight: token.lineHeight
20
22
  }, itemCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({
@@ -25,7 +27,6 @@ var genListStyle = function genListStyle(token) {
25
27
  display: 'flex',
26
28
  alignItems: 'center',
27
29
  transition: "background-color ".concat(token.motionDurationSlow),
28
- borderRadius: token.borderRadiusSM,
29
30
  '&:hover': {
30
31
  backgroundColor: token.controlItemBgHover
31
32
  }
@@ -34,7 +35,7 @@ var genListStyle = function genListStyle(token) {
34
35
  lineHeight: lineHeight,
35
36
  flex: 'auto',
36
37
  transition: "all ".concat(token.motionDurationSlow)
37
- })), actionsCls, _defineProperty(_defineProperty(_defineProperty({
38
+ })), actionsCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({
38
39
  whiteSpace: 'nowrap'
39
40
  }, actionCls, {
40
41
  opacity: 0
@@ -43,6 +44,10 @@ var genListStyle = function genListStyle(token) {
43
44
  transition: "all ".concat(token.motionDurationSlow)
44
45
  }), "\n ".concat(actionCls, ":focus-visible,\n &.picture ").concat(actionCls, "\n "), {
45
46
  opacity: 1
47
+ }), "".concat(actionCls).concat(antCls, "-btn"), {
48
+ height: listItemHeightSM,
49
+ border: 0,
50
+ lineHeight: 1
46
51
  })), "".concat(componentCls, "-icon ").concat(iconCls), {
47
52
  color: token.colorTextDescription,
48
53
  fontSize: fontSize
@@ -1,4 +1,5 @@
1
1
  import _App from "@chaoswise/ui/lib/App";
2
+ import { memo } from "react";
2
3
  var message;
3
4
  var notification;
4
5
  var modal;
@@ -9,7 +10,7 @@ var AppHolder = function AppHolder() {
9
10
  notification = staticFunction.notification;
10
11
  return null;
11
12
  };
12
- export default AppHolder;
13
+ export default /*#__PURE__*/memo(AppHolder);
13
14
  // 这里的问题是 AppHolder 组件在首次定义的时候,message、modal 和 notification 还没有被赋值。当你在其他地方尝试访问 AppHolder.message 时,这些属性是 undefined 的。
14
15
  // AppHolder.message = message;
15
16
  // AppHolder.modal = modal;
@@ -25,6 +25,8 @@ import intlContext from "./intlContext";
25
25
  import { getDateLocal } from "./generate/dayjs";
26
26
  import { legacyLogicalPropertiesTransformer, StyleProvider } from "@ant-design/cssinjs";
27
27
  var Provider = intlContext.Provider;
28
+ // 导出intlContext与低版本ui组件同步,@chaoswise/business需要用到
29
+ export { intlContext };
28
30
  var CWConfigProvider = function CWConfigProvider(_ref) {
29
31
  var defaultLocale = _ref.defaultLocale,
30
32
  theme = _ref.theme,
@@ -16,7 +16,9 @@ export var defaultComponentToken = {
16
16
  headerColor: ["colorWhite"]
17
17
  },
18
18
  Breadcrumb: {
19
- colorBgTextHover: ["colorWhite"] // token变量 fff
19
+ colorBgTextHover: "transparent",
20
+ // token变量 fff
21
+ linkHoverColor: ["colorPrimaryHover"]
20
22
  },
21
23
  Tooltip: {
22
24
  colorBgSpotlight: ["colorWhite"],
@@ -33,7 +35,9 @@ export var defaultComponentToken = {
33
35
  trackBgDisabled: "rgb(217, 217, 217)"
34
36
  },
35
37
  Select: {
36
- colorText: ["colorText"] // token变量 colorText
38
+ optionSelectedBg: ["colorPrimaryBg"],
39
+ optionActiveBg: ["colorPrimaryBg"],
40
+ optionSelectedColor: ["colorPrimary"]
37
41
  },
38
42
  Tag: {
39
43
  colorBorder: "rgba(0,0,0,0.09)"
@@ -67,6 +71,9 @@ export var defaultComponentToken = {
67
71
  itemSelectedBg: "#F6F7F8",
68
72
  subMenuItemBg: "transparent",
69
73
  itemBg: ["colorWhite"]
74
+ },
75
+ DatePicker: {
76
+ cellHoverBg: ["colorPrimaryBg"]
70
77
  }
71
78
  };
72
79
 
@@ -23,7 +23,6 @@ function TenantTree(_ref) {
23
23
  padding: "10px"
24
24
  }
25
25
  }, /*#__PURE__*/React.createElement(_CWTree, _extends({
26
- // switcherIcon={<Icon type="down" />}
27
26
  defaultSelectedKeys: [defaultKey],
28
27
  onSelect: onTreeClick,
29
28
  defaultExpandAll: true,
@@ -108,7 +108,7 @@ var genCustomCWPaginationStyle = function genCustomCWPaginationStyle(token) {
108
108
  backgroundColor: token.colorPrimary,
109
109
  fontWeight: "500",
110
110
  a: {
111
- color: token.white
111
+ color: token.colorWhite
112
112
  }
113
113
  }), "".concat(paginationPrefix, "-jump-wrapper"), _defineProperty({
114
114
  display: "inline-block",
@@ -7,7 +7,7 @@ var genCustomSiderMenuStyle = function genCustomSiderMenuStyle(token) {
7
7
  var prefixCls = token.antCls,
8
8
  iconCls = token.iconCls;
9
9
  var SiderMenuPrefix = "".concat(prefixCls, "-sider-menu");
10
- return _defineProperty(_defineProperty({}, "".concat(SiderMenuPrefix, "-goup-label"), {
10
+ return _defineProperty(_defineProperty(_defineProperty({}, "".concat(SiderMenuPrefix, "-goup-label"), {
11
11
  borderBottom: "1px solid rgb(246, 247, 248)",
12
12
  width: "calc(100% + 14px)",
13
13
  marginLeft: "-7px",
@@ -29,7 +29,9 @@ var genCustomSiderMenuStyle = function genCustomSiderMenuStyle(token) {
29
29
  color: token.colorPrimary
30
30
  }, iconCls, {
31
31
  transform: "rotate(180deg)"
32
- })));
32
+ }))), "".concat(SiderMenuPrefix, "-cw-menu-box-collapsed"), _defineProperty({}, "".concat(SiderMenuPrefix, "-expand-arrow"), {
33
+ display: "none"
34
+ }));
33
35
  };
34
36
  // ============================== Export ==============================
35
37
  export default genStyleHooks("SiderMenu", function (token) {
@@ -51,7 +51,8 @@ var genCustomCWSliderStyle = function genCustomCWSliderStyle(token) {
51
51
  backgroundSize: "contain",
52
52
  boxShadow: "none !important",
53
53
  borderRadius: "0",
54
- position: "static"
54
+ position: "static",
55
+ outline: "none"
55
56
  }
56
57
  }, "&".concat(prefixCls, "-tooltip-open"), {
57
58
  background: token.colorPrimaryHover,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chaoswise/ui",
3
3
  "packageName": "chaoswiseUI",
4
- "version": "3.1.0",
4
+ "version": "3.1.1",
5
5
  "description": "公共UI库",
6
6
  "keywords": [
7
7
  "ui",