@aloudata/aloudata-design 2.0.0-beta.2 → 2.0.0-beta.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.
@@ -23,7 +23,7 @@
23
23
 
24
24
  @button-height-small: 28px;
25
25
  @button-text-size-small: 12px;
26
- @button-border-radius-small: 2px;
26
+ @button-border-radius-small: var(--alias-radius-50, 4px);
27
27
  @button-padding-small: var(--alias-padding-75-minus-1, 6px)
28
28
  var(--alias-padding-150-minus-1, 12px);
29
29
  @button-line-height-small: 16px;
@@ -7,6 +7,7 @@
7
7
  flex-direction: column;
8
8
  align-items: center;
9
9
  justify-content: center;
10
+ height: 100%;
10
11
 
11
12
  .ald-empty-image-wrap {
12
13
  display: flex;
@@ -2,10 +2,12 @@
2
2
  // 纯input 输入框,比如普通的<Input /> <Input.textarea />
3
3
  &:not(.ant-input-affix-wrapper) {
4
4
  box-shadow: none;
5
+ width: auto;
5
6
  }
6
7
  // 带有其他内容的输入框,比如带 allowClear图标、prefix、suffix、密码图标等。
7
8
  &.ant-input-affix-wrapper {
8
9
  box-shadow: none;
10
+ width: auto;
9
11
  // 输入框
10
12
  .ant-input.ant-input {
11
13
  color: inherit;
@@ -8,6 +8,7 @@ interface Props extends ScrollAreaProps {
8
8
  onViewportScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
9
9
  innerClassName?: string;
10
10
  scrollBarHidden?: Array<'horizontal' | 'vertical'>;
11
+ contentDeterminesWidth?: boolean;
11
12
  }
12
13
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>>;
13
14
  export default _default;
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "className", "innerClassName", "horizontalScrollBarClassName", "verticalScrollBarClassName", "onViewportScroll", "scrollBarHidden"];
1
+ var _excluded = ["children", "className", "innerClassName", "horizontalScrollBarClassName", "verticalScrollBarClassName", "onViewportScroll", "contentDeterminesWidth", "scrollBarHidden"];
2
2
  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); }
3
3
  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; }
4
4
  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; }
@@ -12,6 +12,7 @@ var ScrollArea = function ScrollArea(props, ref) {
12
12
  horizontalScrollBarClassName = props.horizontalScrollBarClassName,
13
13
  verticalScrollBarClassName = props.verticalScrollBarClassName,
14
14
  onViewportScroll = props.onViewportScroll,
15
+ contentDeterminesWidth = props.contentDeterminesWidth,
15
16
  scrollBarHidden = props.scrollBarHidden,
16
17
  rest = _objectWithoutProperties(props, _excluded);
17
18
  var isHorizontalScrollBarHidden = scrollBarHidden === null || scrollBarHidden === void 0 ? void 0 : scrollBarHidden.includes('horizontal');
@@ -20,7 +21,9 @@ var ScrollArea = function ScrollArea(props, ref) {
20
21
  scrollHideDelay: 50,
21
22
  className: classNames('ald-scroll-area', className)
22
23
  }), /*#__PURE__*/React.createElement(ScrollAreaComponent.Viewport, {
23
- className: classNames('ald-scroll-area-inner', innerClassName),
24
+ className: classNames('ald-scroll-area-inner', {
25
+ 'ald-scroll-area-width-auto': !contentDeterminesWidth
26
+ }, innerClassName),
24
27
  onScroll: function onScroll(event) {
25
28
  onViewportScroll === null || onViewportScroll === void 0 ? void 0 : onViewportScroll(event);
26
29
  },
@@ -46,4 +46,9 @@
46
46
  height: 100%;
47
47
  box-sizing: border-box;
48
48
  position: relative;
49
+
50
+ &.ald-scroll-area-width-auto > div {
51
+ // 覆盖内联的display:table;
52
+ display: block !important;
53
+ }
49
54
  }
@@ -23,6 +23,7 @@ import { FormItemInputContext } from 'antd/lib/form/context';
23
23
  import useStyle from 'antd/lib/select/style';
24
24
  import { useCompactItemContext } from 'antd/lib/space/Compact';
25
25
  import classNames from 'classnames';
26
+ import _ from 'lodash';
26
27
  import List from 'rc-virtual-list';
27
28
  import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
28
29
  import { ConfigContext } from "../ConfigProvider";
@@ -363,6 +364,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
363
364
  updatedRef.current = true;
364
365
  }
365
366
  }, [value, innerOptions, isMultiple, defaultValue]);
367
+ console.log(value, !_.isEmpty(value !== null && value !== void 0 ? value : currentValue), 'value');
366
368
  return /*#__PURE__*/React.createElement("div", {
367
369
  onMouseDown: function onMouseDown() {
368
370
  if (disabled) return;
@@ -370,7 +372,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
370
372
  setIsOpen(!isOpen);
371
373
  }
372
374
  },
373
- className: classNames('ald-select', className, (_classNames = {}, _defineProperty(_classNames, "ald-select-".concat(type), type === 'primary' || type === 'secondary'), _defineProperty(_classNames, 'ald-select-multiple', isMultiple), _defineProperty(_classNames, 'ald-select-single', !isMultiple), _defineProperty(_classNames, 'ald-select-large', size === 'large'), _defineProperty(_classNames, 'ald-select-small', size === 'small'), _defineProperty(_classNames, 'ald-select-disabled', mergedDisabled), _defineProperty(_classNames, 'ald-select-middle', size !== 'large' && size !== 'small'), _defineProperty(_classNames, 'ald-select-open', typeof _open === 'boolean' ? _open : isOpen), _defineProperty(_classNames, 'ald-select-focus', isFocus), _defineProperty(_classNames, "ald-select-status-".concat(mergedStatus), mergedStatus), _classNames), compactItemClassnames, hashId),
375
+ className: classNames('ald-select', className, (_classNames = {}, _defineProperty(_classNames, "ald-select-".concat(type), type === 'primary' || type === 'secondary'), _defineProperty(_classNames, 'ald-select-multiple', isMultiple), _defineProperty(_classNames, 'ald-select-single', !isMultiple), _defineProperty(_classNames, 'ald-select-large', size === 'large'), _defineProperty(_classNames, 'ald-select-small', size === 'small'), _defineProperty(_classNames, 'ald-select-disabled', mergedDisabled), _defineProperty(_classNames, 'ald-select-middle', size !== 'large' && size !== 'small'), _defineProperty(_classNames, 'ald-select-open', typeof _open === 'boolean' ? _open : isOpen), _defineProperty(_classNames, 'ald-select-focus', isFocus), _defineProperty(_classNames, "ald-select-status-".concat(mergedStatus), mergedStatus), _defineProperty(_classNames, 'ald-select-has-value', !_.isEmpty(value) || !_.isEmpty(currentValue)), _classNames), compactItemClassnames, hashId),
374
376
  spellCheck: false,
375
377
  style: Object.assign(styleVar, style)
376
378
  }, !!prefix && /*#__PURE__*/React.createElement("span", {
@@ -404,6 +406,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
404
406
  className: "ald-select-suffix-icon"
405
407
  }),
406
408
  onDropdownVisibleChange: function onDropdownVisibleChange(open) {
409
+ console.log(open, 'open');
407
410
  setIsOpen(open);
408
411
  if (!open) {
409
412
  dropDownTimeRef.current = Date.now();
@@ -47,6 +47,9 @@
47
47
  align-items: center;
48
48
  transition: none;
49
49
  padding-right: 0;
50
+ padding-top: 0;
51
+ padding-bottom: 0;
52
+ position: relative;
50
53
 
51
54
  .ant-select-selection-search {
52
55
  display: flex;
@@ -59,14 +62,20 @@
59
62
  // 多选中存在这个样式
60
63
  .ant-select-selection-overflow {
61
64
  align-self: normal;
65
+ flex-wrap: nowrap;
66
+ margin-left: 6px;
67
+ min-width: 52px;
62
68
 
63
69
  .ant-select-selection-overflow-item {
64
70
  align-items: center;
65
71
  line-height: inherit;
66
- height: 100%;
72
+ flex: 1;
73
+ min-width: 0;
74
+ // height: 100%;
67
75
 
68
76
  & > span {
69
77
  display: inline-flex;
78
+ min-width: 0;
70
79
  }
71
80
 
72
81
  .ant-select-selection-item {
@@ -89,6 +98,8 @@
89
98
  }
90
99
 
91
100
  &.ant-select-selection-overflow-item-rest {
101
+ flex: none;
102
+
92
103
  .ant-select-selection-item {
93
104
  border: none;
94
105
  background: none;
@@ -111,10 +122,16 @@
111
122
  }
112
123
  }
113
124
 
125
+ &.ant-select-selection-overflow-item-suffix {
126
+ flex: none;
127
+ }
128
+
114
129
  .ald-select-multiple-tag-default {
115
130
  color: inherit;
116
- display: inline-flex;
117
- align-items: center;
131
+ min-width: 0;
132
+ white-space: nowrap;
133
+ text-overflow: ellipsis;
134
+ overflow: hidden;
118
135
  }
119
136
 
120
137
  .ant-select-selection-search-input {
@@ -123,12 +140,6 @@
123
140
  caret-color: var(--alias-colors-text-selected, #126fdd);
124
141
  }
125
142
  }
126
-
127
- .ant-select-selection-overflow-item:first-of-type {
128
- .ald-select-multiple-tag-default::before {
129
- content: '';
130
- }
131
- }
132
143
  }
133
144
 
134
145
  .ant-select-selection-placeholder {
@@ -12,17 +12,20 @@
12
12
  }
13
13
 
14
14
  .ant-select-arrow {
15
- position: initial;
16
- margin: 0;
15
+ top: 0;
16
+ bottom: 0;
17
+ margin: auto;
17
18
  }
18
19
 
19
20
  .ant-select-clear {
21
+ position: absolute;
22
+ top: 0;
23
+ bottom: 0;
24
+ margin: auto;
20
25
  transform: none;
21
26
  opacity: 1;
22
27
  align-items: center;
23
28
  flex: none;
24
- position: relative;
25
- margin-left: 8px;
26
29
  right: 0;
27
30
 
28
31
  &::before {
@@ -30,7 +33,6 @@
30
33
  top: 0;
31
34
  bottom: 0;
32
35
  margin: auto 0;
33
- left: -8px;
34
36
  content: '';
35
37
  height: 14px;
36
38
  width: 1px;
@@ -26,14 +26,13 @@
26
26
  }
27
27
 
28
28
  .ant-select {
29
- padding-right: @select-padding-horizontal-small;
30
-
31
29
  .ant-select-selector {
32
30
  height: @selector-height-small;
33
31
  line-height: @selector-height-small;
34
32
  padding-left: calc(
35
33
  @select-padding-horizontal-small + var(--ald-select-prefix-width)
36
34
  );
35
+ padding-right: @select-padding-horizontal-small;
37
36
 
38
37
  .ant-select-selection-item {
39
38
  line-height: inherit;
@@ -59,15 +58,89 @@
59
58
  );
60
59
  }
61
60
  }
61
+
62
+ &.ant-select-show-arrow:not(.ant-select-allow-clear) {
63
+ .ant-select-selector {
64
+ padding-right: calc(
65
+ @select-padding-horizontal-small + @select-icon-use-width-small
66
+ );
67
+ }
68
+ }
69
+
70
+ .ant-select-arrow {
71
+ right: @select-padding-horizontal-small;
72
+ }
73
+
74
+ .ant-select-clear {
75
+ right: @select-padding-horizontal-small;
76
+
77
+ &::before {
78
+ left: -@selector-gap-small;
79
+ }
80
+ }
62
81
  }
63
82
 
64
83
  .ald-select-prefix-select {
84
+ // 单选值容器
65
85
  .ant-select-selection-item {
66
- margin-left: @selector-item-margin-left-small;
86
+ margin-left: @selector-gap-small;
87
+ }
88
+ // 多选值容器
89
+ .ant-select-selection-overflow {
90
+ margin-left: @selector-gap-small;
67
91
  }
68
92
 
69
93
  .ant-select-selection-placeholder {
70
- margin-left: @selector-item-margin-left-small;
94
+ margin-left: @selector-gap-small;
95
+ }
96
+ }
97
+
98
+ &.ald-select-has-value {
99
+ .ant-select {
100
+ &.ant-select-allow-clear:not(.ant-select-show-arrow),
101
+ &.ant-select-show-arrow:not(.ant-select-allow-clear) {
102
+ .ant-select-selector {
103
+ padding-right: calc(
104
+ @select-padding-horizontal-small + @select-icon-use-width-small
105
+ );
106
+ }
107
+
108
+ .ant-select-arrow {
109
+ right: @select-padding-horizontal-small;
110
+ }
111
+
112
+ .ant-select-clear {
113
+ right: @select-padding-horizontal-small;
114
+
115
+ &::before {
116
+ left: -@selector-gap-small;
117
+ }
118
+ }
119
+ }
120
+
121
+ &.ant-select-show-arrow.ant-select-allow-clear {
122
+ .ant-select-selector {
123
+ padding-right: calc(
124
+ @select-padding-horizontal-small + @selector-gap-small +
125
+ @select-icon-use-width-small + @select-icon-use-width-small
126
+ );
127
+ }
128
+
129
+ .ant-select-arrow {
130
+ right: calc(
131
+ @select-padding-horizontal-small + @select-icon-use-width-small +
132
+ @selector-gap-small
133
+ );
134
+ }
135
+
136
+ .ant-select-clear {
137
+ right: @select-padding-horizontal-small;
138
+
139
+ &::before {
140
+ left: -@selector-gap-small;
141
+ }
142
+ }
143
+ }
71
144
  }
72
145
  }
73
146
  }
@@ -83,14 +156,13 @@
83
156
  }
84
157
 
85
158
  .ant-select {
86
- padding-right: @select-padding-horizontal-middle;
87
-
88
159
  .ant-select-selector {
89
160
  height: @selector-height-middle;
90
161
  line-height: @selector-height-middle;
91
162
  padding-left: calc(
92
163
  @select-padding-horizontal-middle + var(--ald-select-prefix-width)
93
164
  );
165
+ padding-right: @select-padding-horizontal-middle;
94
166
 
95
167
  .ant-select-selection-item {
96
168
  font-size: @select-font-size-middle;
@@ -116,15 +188,89 @@
116
188
  );
117
189
  }
118
190
  }
191
+
192
+ &.ant-select-show-arrow:not(.ant-select-allow-clear) {
193
+ .ant-select-selector {
194
+ padding-right: calc(
195
+ @select-padding-horizontal-middle + @select-icon-use-width-middle
196
+ );
197
+ }
198
+ }
199
+
200
+ .ant-select-arrow {
201
+ right: @select-padding-horizontal-middle;
202
+ }
203
+
204
+ .ant-select-clear {
205
+ right: @select-padding-horizontal-middle;
206
+
207
+ &::before {
208
+ left: -@selector-gap-middle;
209
+ }
210
+ }
119
211
  }
120
212
 
121
213
  .ald-select-prefix-select {
214
+ // 单选值容器
122
215
  .ant-select-selection-item {
123
- margin-left: @selector-item-margin-left-middle;
216
+ margin-left: @selector-gap-middle;
217
+ }
218
+ // 多选值容器
219
+ .ant-select-selection-overflow {
220
+ margin-left: @selector-gap-middle;
124
221
  }
125
222
 
126
223
  .ant-select-selection-placeholder {
127
- margin-left: @selector-item-margin-left-middle;
224
+ margin-left: @selector-gap-middle;
225
+ }
226
+ }
227
+
228
+ &.ald-select-has-value {
229
+ .ant-select {
230
+ &.ant-select-allow-clear:not(.ant-select-show-arrow),
231
+ &.ant-select-show-arrow:not(.ant-select-allow-clear) {
232
+ .ant-select-selector {
233
+ padding-right: calc(
234
+ @select-padding-horizontal-middle + @select-icon-use-width-middle
235
+ );
236
+ }
237
+
238
+ .ant-select-arrow {
239
+ right: @select-padding-horizontal-middle;
240
+ }
241
+
242
+ .ant-select-clear {
243
+ right: @select-padding-horizontal-middle;
244
+
245
+ &::before {
246
+ left: -@selector-gap-middle;
247
+ }
248
+ }
249
+ }
250
+
251
+ &.ant-select-show-arrow.ant-select-allow-clear {
252
+ .ant-select-selector {
253
+ padding-right: calc(
254
+ @select-padding-horizontal-middle + @selector-gap-middle +
255
+ @select-icon-use-width-middle + @select-icon-use-width-middle
256
+ );
257
+ }
258
+
259
+ .ant-select-arrow {
260
+ right: calc(
261
+ @select-padding-horizontal-middle + @select-icon-use-width-middle +
262
+ @selector-gap-middle
263
+ );
264
+ }
265
+
266
+ .ant-select-clear {
267
+ right: @select-padding-horizontal-middle;
268
+
269
+ &::before {
270
+ left: -@selector-gap-middle;
271
+ }
272
+ }
273
+ }
128
274
  }
129
275
  }
130
276
  }
@@ -140,14 +286,13 @@
140
286
  }
141
287
 
142
288
  .ant-select {
143
- padding-right: @select-padding-horizontal-large;
144
-
145
289
  .ant-select-selector {
146
290
  height: @selector-height-large;
147
291
  line-height: @selector-height-large;
148
292
  padding-left: calc(
149
293
  @select-padding-horizontal-large + var(--ald-select-prefix-width)
150
294
  );
295
+ padding-right: @select-padding-horizontal-large;
151
296
 
152
297
  .ant-select-selection-item {
153
298
  font-size: @select-font-size-large;
@@ -172,6 +317,90 @@
172
317
  @select-padding-horizontal-large + var(--ald-select-prefix-width)
173
318
  );
174
319
  }
320
+
321
+ &.ant-select-show-arrow:not(.ant-select-allow-clear) {
322
+ .ant-select-selector {
323
+ padding-right: calc(
324
+ @select-padding-horizontal-large + @select-icon-use-width-large
325
+ );
326
+ }
327
+ }
328
+
329
+ .ant-select-arrow {
330
+ right: @select-padding-horizontal-large;
331
+ }
332
+
333
+ .ant-select-clear {
334
+ right: @select-padding-horizontal-large;
335
+
336
+ &::before {
337
+ left: -@selector-gap-large;
338
+ }
339
+ }
340
+ }
341
+ }
342
+
343
+ .ald-select-prefix-select {
344
+ // 单选值容器
345
+ .ant-select-selection-item {
346
+ margin-left: @selector-gap-large;
347
+ }
348
+ // 多选值容器
349
+ .ant-select-selection-overflow {
350
+ margin-left: @selector-gap-large;
351
+ }
352
+
353
+ .ant-select-selection-placeholder {
354
+ margin-left: @selector-gap-large;
355
+ }
356
+ }
357
+
358
+ &.ald-select-has-value {
359
+ .ant-select {
360
+ &.ant-select-allow-clear:not(.ant-select-show-arrow),
361
+ &.ant-select-show-arrow:not(.ant-select-allow-clear) {
362
+ .ant-select-selector {
363
+ padding-right: calc(
364
+ @select-padding-horizontal-large + @select-icon-use-width-large
365
+ );
366
+ }
367
+
368
+ .ant-select-arrow {
369
+ right: @select-padding-horizontal-large;
370
+ }
371
+
372
+ .ant-select-clear {
373
+ right: @select-padding-horizontal-large;
374
+
375
+ &::before {
376
+ left: -@selector-gap-large;
377
+ }
378
+ }
379
+ }
380
+
381
+ &.ant-select-show-arrow.ant-select-allow-clear {
382
+ .ant-select-selector {
383
+ padding-right: calc(
384
+ @select-padding-horizontal-large + @selector-gap-large +
385
+ @select-icon-use-width-large + @select-icon-use-width-large
386
+ );
387
+ }
388
+
389
+ .ant-select-arrow {
390
+ right: calc(
391
+ @select-padding-horizontal-large + @select-icon-use-width-large +
392
+ @selector-gap-large
393
+ );
394
+ }
395
+
396
+ .ant-select-clear {
397
+ right: @select-padding-horizontal-large;
398
+
399
+ &::before {
400
+ left: -@selector-gap-large;
401
+ }
402
+ }
403
+ }
175
404
  }
176
405
  }
177
406
  }
@@ -187,16 +416,6 @@
187
416
  margin-top: 0;
188
417
  }
189
418
 
190
- .ald-select-prefix-select {
191
- .ant-select-selection-item {
192
- margin-left: @selector-item-margin-left-large;
193
- }
194
-
195
- .ant-select-selection-placeholder {
196
- margin-left: @selector-item-margin-left-large;
197
- }
198
- }
199
-
200
419
  &.ald-select-primary {
201
420
  font-weight: 500;
202
421
  }
@@ -7,7 +7,8 @@
7
7
  @select-line-height-large: 24px;
8
8
  @select-padding-horizontal-large: var(--alias-padding-150-minus-1, 12px);
9
9
  @selector-height-large: 34px;
10
- @selector-item-margin-left-large: 8px;
10
+ @selector-gap-large: 8px;
11
+ @select-icon-use-width-large: 24px; //16+8
11
12
 
12
13
  // medium size
13
14
  @select-height-middle: 32px;
@@ -16,7 +17,8 @@
16
17
  @select-line-height-middle: 20px;
17
18
  @select-padding-horizontal-middle: var(--alias-padding-150-minus-1, 12px);
18
19
  @selector-height-middle: 30px;
19
- @selector-item-margin-left-middle: 6px;
20
+ @selector-gap-middle: 6px;
21
+ @select-icon-use-width-middle: 22px; //16+6
20
22
 
21
23
  // small size
22
24
  @select-height-small: 28px;
@@ -25,4 +27,5 @@
25
27
  @select-line-height-small: 16px;
26
28
  @select-padding-horizontal-small: var(--alias-padding-150-minus-1, 12px);
27
29
  @selector-height-small: 26px;
28
- @selector-item-margin-left-small: 4px;
30
+ @selector-gap-small: 4px;
31
+ @select-icon-use-width-small: 20px; //16+4