@aloudata/aloudata-design 0.4.8-beta.5 → 0.4.8-beta.7

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.
@@ -17,9 +17,9 @@ import { Button as AntdButton } from 'antd';
17
17
  import classNames from 'classnames';
18
18
  import React from 'react';
19
19
  var iconPrefixCls = 'aldicon';
20
- var ICON_LARGE = 24;
21
- var ICON_MIDDLE = 20;
22
- var ICON_SMALL = 16;
20
+ var ICON_LARGE = 20;
21
+ var ICON_MIDDLE = 16;
22
+ var ICON_SMALL = 14;
23
23
  export var btnPrefix = 'ald-btn';
24
24
  export function getButtonType(buttonType) {
25
25
  if (!['primary', 'secondary', 'dangerous', 'text', 'link'].includes(buttonType)) {
@@ -44,7 +44,7 @@ export function getDangerStatus(buttonType) {
44
44
  return false;
45
45
  }
46
46
  export function getButtonSizeClass(ButtonSize) {
47
- return ButtonSize === 'middle' || undefined ? "".concat(btnPrefix, "-middle") : "".concat(btnPrefix, "-").concat(ButtonSize);
47
+ return ['small', 'large'].includes(ButtonSize) ? "".concat(btnPrefix, "-").concat(ButtonSize) : "".concat(btnPrefix, "-middle");
48
48
  }
49
49
  export function getIconSize(ButtonSize) {
50
50
  if (ButtonSize === 'large') {
@@ -80,7 +80,7 @@ export var setIcon = function setIcon(iconNode, size, loading) {
80
80
  if (loading) {
81
81
  return /*#__PURE__*/React.createElement(LoadingLine, {
82
82
  spin: true,
83
- size: ICON_LARGE,
83
+ size: getIconSize(size),
84
84
  className: classNames("".concat(iconPrefixCls, "-icon-left"), iconPrefixCls),
85
85
  fill: "currentColor"
86
86
  });
@@ -254,13 +254,14 @@
254
254
 
255
255
  .aldicon-icon-left {
256
256
  svg {
257
- vertical-align: -2px;
257
+ vertical-align: -4px;
258
258
  }
259
259
  }
260
260
 
261
- .aldicon-icon-left + span {
262
- margin-left: @button-left-icon-margin-right-large;
263
- }
261
+ gap:@button-left-icon-margin-right-large;
262
+ // .aldicon-icon-left + span {
263
+ // margin-left: @button-left-icon-margin-right-large;
264
+ // }
264
265
  }
265
266
 
266
267
  &-middle {
@@ -284,13 +285,14 @@
284
285
 
285
286
  .aldicon-icon-left {
286
287
  svg {
287
- vertical-align: -2px;
288
+ vertical-align: -3px;
288
289
  }
289
290
  }
290
291
 
291
- .aldicon-icon-left + span {
292
- margin-left: @button-left-icon-margin-right-middle;
293
- }
292
+ gap:@button-left-icon-margin-right-middle;
293
+ // .aldicon-icon-left + span {
294
+ // margin-left: @button-left-icon-margin-right-middle;
295
+ // }
294
296
  }
295
297
 
296
298
  &-small {
@@ -318,39 +320,41 @@
318
320
  }
319
321
  }
320
322
 
321
- .aldicon-icon-left + span {
322
- margin-left: @button-left-icon-margin-right-small;
323
- }
323
+ gap:@button-left-icon-margin-right-small;
324
+ // .aldicon-icon-left + span {
325
+ // margin-left: @button-left-icon-margin-right-small;
326
+ // }
324
327
  }
325
328
 
326
- &-mini {
327
- height: @button-height-mini;
328
- padding: @button-border-padding-mini;
329
- font-size: @button-text-size-mini;
330
- line-height: 22px;
331
- border-radius: @button-border-radius-mini;
332
-
333
- &.ant-btn-icon-only {
334
- min-width: @button-height-mini;
335
- height: @button-height-mini;
336
- border-radius: @button-border-radius-mini;
337
- }
338
-
339
- &.ant-btn-circle {
340
- min-width: @button-height-mini;
341
- height: @button-height-mini;
342
- border-radius: 50%;
343
- }
344
-
345
- .aldicon-icon-left {
346
- svg {
347
- vertical-align: -2px;
348
- }
349
- }
350
-
351
- .aldicon-icon-left + span {
352
- margin-left: @button-left-icon-margin-right-mini;
353
- }
354
- }
329
+ // &-mini {
330
+ // height: @button-height-mini;
331
+ // padding: @button-border-padding-mini;
332
+ // font-size: @button-text-size-mini;
333
+ // line-height: 22px;
334
+ // border-radius: @button-border-radius-mini;
335
+
336
+ // &.ant-btn-icon-only {
337
+ // min-width: @button-height-mini;
338
+ // height: @button-height-mini;
339
+ // border-radius: @button-border-radius-mini;
340
+ // }
341
+
342
+ // &.ant-btn-circle {
343
+ // min-width: @button-height-mini;
344
+ // height: @button-height-mini;
345
+ // border-radius: 50%;
346
+ // }
347
+
348
+ // .aldicon-icon-left {
349
+ // svg {
350
+ // vertical-align: -2px;
351
+ // }
352
+ // }
353
+
354
+ // gap:@button-left-icon-margin-right-mini;
355
+ // // .aldicon-icon-left + span {
356
+ // // margin-left: @button-left-icon-margin-right-mini;
357
+ // // }
358
+ // }
355
359
  }
356
360
  }
@@ -6,27 +6,27 @@
6
6
  /** size控制 **/
7
7
  @button-height-large: 36px;
8
8
  @button-text-size-large: 16px;
9
- @button-border-radius-large: 8px;
10
- @button-border-padding-large: 6px 14px;
9
+ @button-border-radius-large: 6px;
10
+ @button-border-padding-large: 6px 24px;
11
11
  @button-left-icon-margin-right-large: 8px;
12
12
 
13
13
  @button-height-middle: 32px;
14
- @button-text-size-middle: 14px;
15
- @button-border-radius-middle: 8px;
16
- @button-border-padding-middle: 6px 12px;
17
- @button-left-icon-margin-right-middle: 8px;
14
+ @button-text-size-middle: 13px;
15
+ @button-border-radius-middle: 4px;
16
+ @button-border-padding-middle: 6px 20px;
17
+ @button-left-icon-margin-right-middle: 4px;
18
18
 
19
19
  @button-height-small: 28px;
20
20
  @button-text-size-small: 12px;
21
- @button-border-radius-small: 6px;
22
- @button-border-padding-small: 6px 10px;
21
+ @button-border-radius-small: 4px;
22
+ @button-border-padding-small: 6px 16px;
23
23
  @button-left-icon-margin-right-small: 4px;
24
24
 
25
- @button-height-mini: 24px;
26
- @button-text-size-mini: 12px;
27
- @button-border-radius-mini: 4px;
28
- @button-border-padding-mini: 0 7px;
29
- @button-left-icon-margin-right-mini: 4px;
25
+ // @button-height-mini: 24px;
26
+ // @button-text-size-mini: 12px;
27
+ // @button-border-radius-mini: 4px;
28
+ // @button-border-padding-mini: 0 7px;
29
+ // @button-left-icon-margin-right-mini: 4px;
30
30
 
31
31
  /**** type控制 ****/
32
32
  @button-primary-bg-color: @B40;
@@ -14,6 +14,11 @@ var SearchSmall = function SearchSmall() {
14
14
  fill: "#EFF2F5",
15
15
  stroke: "#F9FAFB",
16
16
  strokeWidth: "5"
17
+ }), /*#__PURE__*/React.createElement("path", {
18
+ fillRule: "evenodd",
19
+ clipRule: "evenodd",
20
+ d: "M19.4074 15.3333C17.1574 15.3333 15.3333 17.1574 15.3333 19.4074C15.3333 21.6575 17.1574 23.4815 19.4074 23.4815C20.5031 23.4815 21.4978 23.0489 22.23 22.3453C22.2466 22.3241 22.2646 22.3037 22.2842 22.2842C22.3037 22.2646 22.3241 22.2466 22.3453 22.23C23.0489 21.4978 23.4815 20.5031 23.4815 19.4074C23.4815 17.1574 21.6575 15.3333 19.4074 15.3333ZM23.6734 22.7306C24.3887 21.8138 24.8148 20.6603 24.8148 19.4074C24.8148 16.421 22.3938 14 19.4074 14C16.421 14 14 16.421 14 19.4074C14 22.3938 16.421 24.8148 19.4074 24.8148C20.6603 24.8148 21.8138 24.3887 22.7306 23.6734L24.8619 25.8047C25.1223 26.0651 25.5444 26.0651 25.8047 25.8047C26.0651 25.5444 26.0651 25.1223 25.8047 24.8619L23.6734 22.7306Z",
21
+ fill: "#667085"
17
22
  }));
18
23
  };
19
24
 
@@ -46,12 +46,23 @@
46
46
  width:160px;
47
47
  height: 160px;
48
48
  }
49
+
50
+ .ald-empty-title{
51
+ margin-top: 20px;
52
+ }
49
53
  }
50
54
 
51
55
  &.ald-empty-small{
56
+ padding:24px;
57
+
52
58
  .ald-empty-image-wrap{
53
59
  width:40px;
54
60
  height: 40px;
61
+
62
+ }
63
+
64
+ .ald-empty-title{
65
+ margin-top: 12px;
55
66
  }
56
67
  }
57
68
  }
@@ -68,3 +68,74 @@
68
68
  }
69
69
  }
70
70
  }
71
+
72
+ .ant-menu-submenu.ant-menu-submenu-popup.ant-menu{
73
+ .ant-menu-vertical {
74
+ border: none;
75
+ }
76
+
77
+ .ant-menu-item,
78
+ .ant-menu-submenu,
79
+ .ant-menu-item-selected {
80
+ margin: 0;
81
+ height: initial;
82
+ padding: 6px 12px;
83
+ line-height: 20px;
84
+ font-size: 13px;
85
+ width: 100%;
86
+ border-radius: 0;
87
+ border: none;
88
+ background-color: @BG100;
89
+ color: @NL0;
90
+ transition: none;
91
+
92
+ &:hover {
93
+ background-color: @BG90 !important;
94
+ }
95
+
96
+ &:active {
97
+ background-color: none;
98
+ }
99
+
100
+ &:not(.ant-menu-item-selected):active {
101
+ background-color: @BG90;
102
+ }
103
+
104
+ &.ant-menu-item-disabled {
105
+ color: @NL50 !important;
106
+ transition: none;
107
+ background-color: @BG100 !important;
108
+ cursor: default;
109
+ }
110
+
111
+ .ant-menu-submenu-title {
112
+ line-height: 20px;
113
+ font-size: 13px;
114
+ width: 100%;
115
+ padding:0;
116
+ height: initial;
117
+ margin:0;
118
+
119
+ &:hover{
120
+ background: none;
121
+ }
122
+ }
123
+ }
124
+
125
+ .ant-menu.ant-menu-sub{
126
+ padding:4px 0;
127
+ }
128
+
129
+ .ant-menu-title-content{
130
+ line-height: 20px;
131
+ font-size: 13px;
132
+ width: 100%;
133
+ padding:0;
134
+ height: initial;
135
+ margin:0;
136
+
137
+ &:hover{
138
+ background: none;
139
+ }
140
+ }
141
+ }
@@ -3,7 +3,7 @@ var _excluded = ["className", "type", "loading", "size", "disabled", "shape"],
3
3
  _excluded3 = ["icon", "okButtonProps", "cancelButtonProps", "okType", "width"],
4
4
  _excluded4 = ["icon", "okButtonProps", "cancelButtonProps", "okType", "width"],
5
5
  _excluded5 = ["icon", "okButtonProps", "cancelButtonProps", "okType", "width"],
6
- _excluded6 = ["icon", "okButtonProps", "cancelButtonProps", "okType", "width"],
6
+ _excluded6 = ["icon", "okButtonProps", "cancelButtonProps", "okType", "className", "width"],
7
7
  _excluded7 = ["icon", "okButtonProps", "cancelButtonProps", "okType", "width"];
8
8
 
9
9
  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); }
@@ -91,6 +91,7 @@ var OriginModal = function OriginModal(props) {
91
91
  width: width || DEFAULT_WIDTH,
92
92
  closeIcon: closeIcon || /*#__PURE__*/React.createElement(CloseLLine, {
93
93
  size: 16,
94
+ fill: theme.NL40,
94
95
  className: "ald-modal-close"
95
96
  })
96
97
  }), children);
@@ -172,6 +173,7 @@ Modal.warning = function modalWarn(props) {
172
173
  _props$cancelButtonPr5 = props.cancelButtonProps,
173
174
  cancelButtonProps = _props$cancelButtonPr5 === void 0 ? {} : _props$cancelButtonPr5,
174
175
  okType = props.okType,
176
+ className = props.className,
175
177
  width = props.width,
176
178
  restProps = _objectWithoutProperties(props, _excluded6);
177
179
 
@@ -179,6 +181,7 @@ Modal.warning = function modalWarn(props) {
179
181
  okButtonProps: getButtonProps(okButtonProps, 'dangerous', okType),
180
182
  cancelButtonProps: getButtonProps(cancelButtonProps, 'secondary', okType),
181
183
  width: width || DEFAULT_WIDTH,
184
+ className: classNames('ald-modal-warning', className),
182
185
  icon: icon || /*#__PURE__*/React.createElement(AlertTriangleDuotone, {
183
186
  fill: [theme.SB40, theme.ND0],
184
187
  theme: "multi-color",
@@ -17,9 +17,10 @@
17
17
  .ald-modal-title-container {
18
18
  display: flex;
19
19
  align-items: center;
20
+ gap: 12px;
20
21
 
21
22
  .ald-modal-text-container {
22
- margin-left: 12px;
23
+ // margin-left: 12px;
23
24
  flex: 1;
24
25
  }
25
26
 
@@ -61,12 +62,12 @@
61
62
  font-size: 13px;
62
63
  }
63
64
 
64
- .ant-modal-footer{
65
+ .ant-modal-footer {
65
66
  .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
66
67
  margin-bottom: 0;
67
68
  margin-inline-start: 12px;
68
69
  }
69
- }
70
+ }
70
71
  }
71
72
 
72
73
  .ant-modal-confirm {
@@ -75,15 +76,31 @@
75
76
  flex: 1;
76
77
  overflow: initial;
77
78
  margin-inline-start: 12px;
78
-
79
+
79
80
  & + .ant-modal-confirm-content {
80
81
  margin-block-start: 16px;
81
- margin-left:28px;
82
+ margin-left: 28px;
82
83
  }
83
84
  }
84
85
  }
85
86
 
86
- .ant-modal-confirm-btns{
87
+ .ant-modal-confirm-btns {
87
88
  margin-block-start: 16px;
88
89
  }
89
90
  }
91
+
92
+ .ald-modal-warning {
93
+ .ant-modal-confirm-btns {
94
+ .ald-btn {
95
+ background-color: @SB40;
96
+ border-color: @SB40;
97
+
98
+ &:hover,
99
+ &:active,
100
+ &:focus {
101
+ background-color: @SB40;
102
+ border-color: @SB40;
103
+ }
104
+ }
105
+ }
106
+ }
@@ -28,13 +28,20 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
28
28
 
29
29
  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; }
30
30
 
31
+ import { FoldDownFill } from '@aloudata/icons-react';
31
32
  import { Select as AntdSelect } from 'antd';
32
33
  import classNames from 'classnames';
33
34
  import List from 'rc-virtual-list';
34
- import React, { forwardRef, useEffect, useLayoutEffect, useMemo } from 'react';
35
+ import React, { forwardRef, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
35
36
  import Empty from "../Empty";
36
37
  import MultipleOption from "./components/MultipleOption";
37
38
  import SingleOption from "./components/SingleOption";
39
+ import theme from "../style/themes/default/themeColor.module.less";
40
+ var suffixIconSizeMap = {
41
+ large: 20,
42
+ middle: 16,
43
+ small: 14
44
+ };
38
45
 
39
46
  var getSelectedOptionsFromValue = function getSelectedOptionsFromValue(isMultiple, options, value, defaultValue) {
40
47
  if (typeof value !== 'undefined') {
@@ -92,9 +99,14 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
92
99
  className = props.className,
93
100
  popupClassName = props.popupClassName,
94
101
  listHeight = props.listHeight,
95
- listItemHeight = props.listItemHeight,
102
+ _props$listItemHeight = props.listItemHeight,
103
+ listItemHeight = _props$listItemHeight === void 0 ? 36 : _props$listItemHeight,
96
104
  _props$notFoundConten = props.notFoundContent,
97
- notFoundContent = _props$notFoundConten === void 0 ? /*#__PURE__*/React.createElement(Empty, null) : _props$notFoundConten,
105
+ notFoundContent = _props$notFoundConten === void 0 ? /*#__PURE__*/React.createElement(Empty, {
106
+ image: Empty.PRESENTED_IMAGE_SEARCH_SMALL,
107
+ size: "small",
108
+ title: "No data"
109
+ }) : _props$notFoundConten,
98
110
  value = props.value,
99
111
  _props$style = props.style,
100
112
  style = _props$style === void 0 ? {} : _props$style,
@@ -121,6 +133,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
121
133
  prefixWidth = _React$useState6[0],
122
134
  setPrefixWidth = _React$useState6[1];
123
135
 
136
+ var updatedRef = useRef(false);
137
+
124
138
  var onMultipleOptionChange = function onMultipleOptionChange(option, selected) {
125
139
  var newOptions = [];
126
140
 
@@ -147,14 +161,24 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
147
161
  }), newOptions);
148
162
  };
149
163
 
164
+ var getListHeight = function getListHeight() {
165
+ if (typeof listHeight === 'number' && options !== null && options !== void 0 && options.length) {
166
+ if (listHeight <= options.length * listItemHeight) {
167
+ return listHeight;
168
+ }
169
+ }
170
+
171
+ return 0;
172
+ };
173
+
150
174
  var multipleRender = function multipleRender() {
151
175
  return /*#__PURE__*/React.createElement("div", {
152
176
  className: "ald-multiple-option-list"
153
177
  }, /*#__PURE__*/React.createElement(List, {
154
178
  data: options || [],
155
179
  "data-id": "list",
156
- height: listHeight,
157
- itemHeight: listItemHeight || 36,
180
+ height: getListHeight(),
181
+ itemHeight: listItemHeight,
158
182
  itemKey: "value"
159
183
  }, function (option) {
160
184
  var isSelected = selectedOptions.some(function (selectedOption) {
@@ -191,8 +215,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
191
215
  }, /*#__PURE__*/React.createElement(List, {
192
216
  data: options || [],
193
217
  "data-id": "list",
194
- height: listHeight,
195
- itemHeight: listItemHeight || 36,
218
+ height: getListHeight(),
219
+ itemHeight: listItemHeight,
196
220
  itemKey: "value"
197
221
  }, function (option) {
198
222
  var isSelected = selectedOptions.some(function (selectedOption) {
@@ -273,7 +297,11 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
273
297
  };
274
298
 
275
299
  useEffect(function () {
276
- setSelectedOptions(getSelectedOptionsFromValue(isMultiple, options, value));
300
+ if (updatedRef.current) {
301
+ setSelectedOptions(getSelectedOptionsFromValue(isMultiple, options, value));
302
+ } else {
303
+ updatedRef.current = true;
304
+ }
277
305
  }, [value]);
278
306
  return /*#__PURE__*/React.createElement("div", {
279
307
  className: classNames('ald-select', className, {
@@ -314,6 +342,10 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
314
342
  style: {
315
343
  width: '100%'
316
344
  },
345
+ suffixIcon: /*#__PURE__*/React.createElement(FoldDownFill, {
346
+ size: suffixIconSizeMap[props.size || 'middle'],
347
+ fill: theme.NL50
348
+ }),
317
349
  onDropdownVisibleChange: function onDropdownVisibleChange(open) {
318
350
  setIsOpen(open);
319
351
 
@@ -23,9 +23,14 @@
23
23
  box-sizing: border-box;
24
24
  border: 1px solid @BG60;
25
25
  border-radius: 4px;
26
+ background-color: @BG100;
26
27
  // padding: 0 4px;
27
28
  cursor: pointer;
28
- width:100%;
29
+ width: 100%;
30
+
31
+ .ant-select-selector {
32
+ color: @NL0;
33
+ }
29
34
 
30
35
  .ald-select-prefix {
31
36
  color: @NL40;
@@ -50,7 +55,6 @@
50
55
  border: none;
51
56
  }
52
57
  }
53
-
54
58
  }
55
59
 
56
60
  .ant-select-selection-overflow {
@@ -15,6 +15,8 @@
15
15
  // height: 20px;
16
16
  margin-left: 0;
17
17
  display: flex;
18
+ height: 36px;
19
+ box-sizing: border-box;
18
20
 
19
21
  &:hover{
20
22
  background-color: @BG90;
@@ -8,6 +8,8 @@
8
8
  display: flex;
9
9
  align-items: center;
10
10
  margin-left: 0;
11
+ height: 36px;
12
+ box-sizing: border-box;
11
13
 
12
14
  &:hover{
13
15
  background-color: @BG90;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "0.4.8-beta.5",
3
+ "version": "0.4.8-beta.7",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",