@aloudata/aloudata-design 2.13.17 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AldSelect/BaseSelect.d.ts +70 -0
- package/dist/AldSelect/BaseSelect.js +236 -0
- package/dist/AldSelect/SelectTrigger.d.ts +23 -0
- package/dist/AldSelect/SelectTrigger.js +73 -0
- package/dist/AldSelect/Selector/MultipleResponsiveSelectedSection.d.ts +7 -0
- package/dist/AldSelect/Selector/MultipleResponsiveSelectedSection.js +32 -0
- package/dist/AldSelect/Selector/MultipleSelector.d.ts +12 -0
- package/dist/AldSelect/Selector/MultipleSelector.js +148 -0
- package/dist/AldSelect/Selector/index.d.ts +9 -0
- package/dist/AldSelect/Selector/index.js +25 -0
- package/dist/AldSelect/components/PopupContent.d.ts +8 -0
- package/dist/AldSelect/components/PopupContent.js +15 -0
- package/dist/AldSelect/components/SearchBox.d.ts +9 -0
- package/dist/AldSelect/components/SearchBox.js +26 -0
- package/dist/AldSelect/components/Suffix.d.ts +11 -0
- package/dist/AldSelect/components/Suffix.js +36 -0
- package/dist/AldSelect/hooks/useCache.d.ts +6 -0
- package/dist/AldSelect/hooks/useCache.js +50 -0
- package/dist/AldSelect/hooks/useDisplayMenu.d.ts +3 -0
- package/dist/AldSelect/hooks/useDisplayMenu.js +60 -0
- package/dist/AldSelect/hooks/useLayoutEffect.d.ts +5 -0
- package/dist/AldSelect/hooks/useLayoutEffect.js +17 -0
- package/dist/AldSelect/hooks/useOptions.d.ts +11 -0
- package/dist/AldSelect/hooks/useOptions.js +63 -0
- package/dist/AldSelect/index.d.ts +4 -0
- package/dist/AldSelect/index.js +224 -0
- package/dist/AldSelect/interface.d.ts +91 -0
- package/dist/AldSelect/interface.js +1 -0
- package/dist/AldSelect/style/color.less +54 -0
- package/dist/AldSelect/style/index.d.ts +1 -0
- package/dist/AldSelect/style/index.js +1 -0
- package/dist/AldSelect/style/index.less +138 -0
- package/dist/AldSelect/style/size.less +63 -0
- package/dist/AldSelect/utils/commonUtil.d.ts +8 -0
- package/dist/AldSelect/utils/commonUtil.js +22 -0
- package/dist/AldSelect/utils/getWidthStyle.d.ts +2 -0
- package/dist/AldSelect/utils/getWidthStyle.js +18 -0
- package/dist/AldSelect/utils/keyUtil.d.ts +2 -0
- package/dist/AldSelect/utils/keyUtil.js +10 -0
- package/dist/AldSelect/utils/valueUtil.d.ts +22 -0
- package/dist/AldSelect/utils/valueUtil.js +131 -0
- package/dist/Dropdown/index.d.ts +5 -0
- package/dist/Dropdown/index.js +25 -6
- package/dist/Form/index.d.ts +1 -1
- package/dist/Form/index.js +1 -0
- package/dist/Icon/components/ArrowDownRightFill.d.ts +10 -0
- package/dist/Icon/components/ArrowDownRightFill.js +35 -0
- package/dist/Icon/components/CloseCircleRightFill.d.ts +10 -0
- package/dist/Icon/components/CloseCircleRightFill.js +35 -0
- package/dist/Icon/index.d.ts +2 -0
- package/dist/Icon/index.js +3 -1
- package/dist/Icon/svg/arrow-down-right-fill.svg +5 -0
- package/dist/Icon/svg/close-circle-right-fill.svg +5 -0
- package/dist/Input/components/Password/index.js +1 -0
- package/dist/Menu/index.d.ts +4 -0
- package/dist/Menu/index.js +5 -4
- package/dist/ScrollArea/index.d.ts +1 -0
- package/dist/ScrollArea/index.js +9 -1
- package/dist/Table/helper.d.ts +1 -1
- package/dist/_utils/prefixCls.d.ts +4 -0
- package/dist/_utils/prefixCls.js +16 -0
- package/dist/ald.min.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.less +1 -0
- package/dist/locale/default.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.beta-ald-select {
|
|
2
|
+
border-color: #d1d5db;
|
|
3
|
+
color: #1f2937;
|
|
4
|
+
|
|
5
|
+
&-active {
|
|
6
|
+
border-color: #007bff;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&-error {
|
|
10
|
+
border-color: #dc2626;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&-validating,
|
|
14
|
+
&-success {
|
|
15
|
+
border-color: #16a34a;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-borderless {
|
|
19
|
+
border-color: transparent;
|
|
20
|
+
color: #111827;
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
background-color: #f3f4f6;
|
|
24
|
+
border-color: #f3f4f6;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.beta-ald-select-active {
|
|
28
|
+
background-color: #fff;
|
|
29
|
+
border-color: #fff;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-disabled {
|
|
34
|
+
border: 1px solid #d1d5db;
|
|
35
|
+
background: #f9fafb;
|
|
36
|
+
|
|
37
|
+
&.beta-ald-select-borderless {
|
|
38
|
+
border-color: transparent;
|
|
39
|
+
background: transparent;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.beta-ald-select-placeholder {
|
|
44
|
+
color: #9ca3af;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.beta-ald-select-prefix {
|
|
49
|
+
color: #4b5563;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.beta-ald-select-selector-multiple-responsive-selected-section {
|
|
53
|
+
border-color: #007bff;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.less";
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
@import '../../Empty/style/index.less';
|
|
2
|
+
@import '../../Tag/style/index.less';
|
|
3
|
+
@import '../../ScrollArea/style/index.less';
|
|
4
|
+
@import './size.less';
|
|
5
|
+
@import './color.less';
|
|
6
|
+
|
|
7
|
+
.beta-ald-select {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: fit-content;
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
position: relative;
|
|
12
|
+
align-items: center;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
|
|
15
|
+
&-disabled {
|
|
16
|
+
cursor: not-allowed;
|
|
17
|
+
|
|
18
|
+
.beta-ald-select-suffix {
|
|
19
|
+
opacity: 0.24;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.beta-ald-select-trigger {
|
|
24
|
+
width: 100%;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
align-content: stretch;
|
|
28
|
+
flex: 1;
|
|
29
|
+
|
|
30
|
+
.beta-ald-select-prefix {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
align-self: flex-start;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.beta-ald-select-placeholder {
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
min-width: 0;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.beta-ald-select-selector:not(.beta-ald-select-selector-multiple-default) {
|
|
44
|
+
min-width: 0;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
text-overflow: ellipsis;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.beta-ald-select-selector-multiple-responsive {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
line-height: 0;
|
|
54
|
+
gap: 4px;
|
|
55
|
+
|
|
56
|
+
.beta-ald-select-selector-overflow {
|
|
57
|
+
width: 100%;
|
|
58
|
+
flex-grow: 1;
|
|
59
|
+
flex-shrink: 1;
|
|
60
|
+
display: flex;
|
|
61
|
+
gap: 4px;
|
|
62
|
+
|
|
63
|
+
.beta-ald-select-selector-overflow-item {
|
|
64
|
+
.ald-tag-content {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
flex-wrap: nowrap;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
text-overflow: ellipsis;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.beta-ald-select-selector-overflow-item-first {
|
|
76
|
+
display: flex;
|
|
77
|
+
min-width: 32px;
|
|
78
|
+
align-items: center;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
text-overflow: ellipsis;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.beta-ald-select-selector-multiple-responsive-selected-section {
|
|
85
|
+
width: calc(100% + 2px);
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: -1px;
|
|
88
|
+
left: -1px;
|
|
89
|
+
display: flex;
|
|
90
|
+
gap: 4px;
|
|
91
|
+
flex-wrap: wrap;
|
|
92
|
+
align-items: flex-start;
|
|
93
|
+
border-width: 1px;
|
|
94
|
+
border-style: solid;
|
|
95
|
+
background-color: #fff;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.beta-ald-select-selector-multiple-default {
|
|
100
|
+
.beta-ald-select-selector-multiple-default-tags {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-wrap: wrap;
|
|
103
|
+
gap: 4px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.beta-ald-select-suffix {
|
|
109
|
+
position: absolute;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: end;
|
|
113
|
+
|
|
114
|
+
&.beta-ald-select-arrow {
|
|
115
|
+
user-select: none;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.beta-ald-select-popup-container {
|
|
122
|
+
min-width: 194px;
|
|
123
|
+
|
|
124
|
+
.beta-ald-select-popup {
|
|
125
|
+
width: 100%;
|
|
126
|
+
|
|
127
|
+
.beta-ald-select-search-box {
|
|
128
|
+
border-bottom: 1px solid #d1d5db;
|
|
129
|
+
border-radius: 0 !important;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ald-menu {
|
|
133
|
+
.szh-menu {
|
|
134
|
+
border-radius: 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@select-padding-top-large: 8px;
|
|
2
|
+
@select-padding-top-middle: 6px;
|
|
3
|
+
@select-padding-top-small: 6px;
|
|
4
|
+
@select-font-size-large: 14px;
|
|
5
|
+
@select-font-size-middle: 14px;
|
|
6
|
+
@select-font-size-small: 12px;
|
|
7
|
+
@select-line-height-large: 20px;
|
|
8
|
+
@select-line-height-middle: 20px;
|
|
9
|
+
@select-line-height-small: 16px;
|
|
10
|
+
|
|
11
|
+
.beta-ald-select {
|
|
12
|
+
&-large {
|
|
13
|
+
.beta-ald-select-size-style( @select-padding-top-large, @select-font-size-large, @select-line-height-large);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-middle {
|
|
17
|
+
.beta-ald-select-size-style( @select-padding-top-middle, @select-font-size-middle, @select-line-height-middle);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-small {
|
|
21
|
+
.beta-ald-select-size-style( @select-padding-top-small, @select-font-size-small, @select-line-height-small);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.beta-ald-select-size-style(@paddingTop,@fontSize, @lineHeight) {
|
|
26
|
+
position: relative;
|
|
27
|
+
font-size: @fontSize;
|
|
28
|
+
line-height: @lineHeight;
|
|
29
|
+
border-width: 1px;
|
|
30
|
+
border-style: solid;
|
|
31
|
+
border-radius: 6px;
|
|
32
|
+
|
|
33
|
+
.beta-ald-select-trigger {
|
|
34
|
+
padding: (@paddingTop - 1px) (7px + 16px + 4px) (@paddingTop - 1px) 7px;
|
|
35
|
+
|
|
36
|
+
.beta-ald-select-prefix {
|
|
37
|
+
margin-right: 4px;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
flex-grow: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.beta-ald-select-placeholder {
|
|
43
|
+
flex: 1;
|
|
44
|
+
height: @lineHeight;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.beta-ald-select-selector {
|
|
48
|
+
flex: 1;
|
|
49
|
+
|
|
50
|
+
.beta-ald-select-selector-multiple-responsive-selected-section {
|
|
51
|
+
padding: (@paddingTop - 1px) (7px + 16px + 4px) (@paddingTop - 1px) 7px;
|
|
52
|
+
border-radius: 6px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.beta-ald-select-suffix {
|
|
58
|
+
right: 7px;
|
|
59
|
+
top: 0;
|
|
60
|
+
bottom: 0;
|
|
61
|
+
margin: auto;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MenuProps } from '../../Menu';
|
|
3
|
+
import { DefaultOptionType } from '../interface';
|
|
4
|
+
export declare function toArray<T>(value: T | T[]): T[];
|
|
5
|
+
export declare const isClient: false | HTMLElement;
|
|
6
|
+
/** Is client side and not jsdom */
|
|
7
|
+
export declare const isBrowserClient: false | HTMLElement;
|
|
8
|
+
export declare function convertOptionsToMenu(options: DefaultOptionType[], selectedKeys: React.Key[]): MenuProps;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function toArray(value) {
|
|
2
|
+
if (Array.isArray(value)) {
|
|
3
|
+
return value;
|
|
4
|
+
}
|
|
5
|
+
return value !== undefined ? [value] : [];
|
|
6
|
+
}
|
|
7
|
+
export var isClient = typeof window !== 'undefined' && window.document && window.document.documentElement;
|
|
8
|
+
|
|
9
|
+
/** Is client side and not jsdom */
|
|
10
|
+
export var isBrowserClient = process.env.NODE_ENV !== 'test' && isClient;
|
|
11
|
+
export function convertOptionsToMenu(options, selectedKeys) {
|
|
12
|
+
return {
|
|
13
|
+
items: options.map(function (option) {
|
|
14
|
+
var _option$value;
|
|
15
|
+
return {
|
|
16
|
+
label: option.label,
|
|
17
|
+
key: ((_option$value = option.value) === null || _option$value === void 0 ? void 0 : _option$value.toString()) || ''
|
|
18
|
+
};
|
|
19
|
+
}),
|
|
20
|
+
selectedKeys: selectedKeys
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default function getWidthStyle(width) {
|
|
2
|
+
if (typeof width === 'number') {
|
|
3
|
+
return {
|
|
4
|
+
width: "".concat(width, "px")
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
if (width === 'fill') {
|
|
8
|
+
return {
|
|
9
|
+
width: '100%'
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (width === 'auto') {
|
|
13
|
+
return {
|
|
14
|
+
width: 'auto'
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import KeyCode from 'rc-util/lib/KeyCode';
|
|
2
|
+
|
|
3
|
+
/** keyCode Judgment function */
|
|
4
|
+
export function isValidateOpenKey(currentKeyCode) {
|
|
5
|
+
return ![
|
|
6
|
+
// System function button
|
|
7
|
+
KeyCode.ESC, KeyCode.SHIFT, KeyCode.BACKSPACE, KeyCode.TAB, KeyCode.WIN_KEY, KeyCode.ALT, KeyCode.META, KeyCode.WIN_KEY_RIGHT, KeyCode.CTRL, KeyCode.SEMICOLON, KeyCode.EQUALS, KeyCode.CAPS_LOCK, KeyCode.CONTEXT_MENU,
|
|
8
|
+
// F1-F12
|
|
9
|
+
KeyCode.F1, KeyCode.F2, KeyCode.F3, KeyCode.F4, KeyCode.F5, KeyCode.F6, KeyCode.F7, KeyCode.F8, KeyCode.F9, KeyCode.F10, KeyCode.F11, KeyCode.F12].includes(currentKeyCode);
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BaseOptionType, DefaultOptionType } from '../Select';
|
|
2
|
+
import type { FieldNames } from '../Select';
|
|
3
|
+
import type { FlattenOptionData } from '../interface';
|
|
4
|
+
export declare function fillFieldNames(fieldNames: FieldNames | undefined, childrenAsData: boolean): {
|
|
5
|
+
label: any;
|
|
6
|
+
value: any;
|
|
7
|
+
options: any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Flat options into flatten list.
|
|
11
|
+
* We use `optionOnly` here is aim to avoid user use nested option group.
|
|
12
|
+
* Here is simply set `key` to the index if not provided.
|
|
13
|
+
*/
|
|
14
|
+
export declare function flattenOptions<OptionType extends BaseOptionType = DefaultOptionType>(options: OptionType[], { fieldNames, childrenAsData, }?: {
|
|
15
|
+
fieldNames?: FieldNames;
|
|
16
|
+
childrenAsData?: boolean;
|
|
17
|
+
}): FlattenOptionData<OptionType>[];
|
|
18
|
+
/**
|
|
19
|
+
* Inject `props` into `option` for legacy usage
|
|
20
|
+
*/
|
|
21
|
+
export declare function injectPropsWithOption<T>(option: T): T;
|
|
22
|
+
export declare function getSeparatedContent(text: string, tokens: string[]): string[];
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
6
|
+
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
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
// @ts-nocheck
|
|
17
|
+
|
|
18
|
+
import warning from 'rc-util/lib/warning';
|
|
19
|
+
function getKey(data, index) {
|
|
20
|
+
var key = data.key;
|
|
21
|
+
var value;
|
|
22
|
+
if ('value' in data) {
|
|
23
|
+
value = data.value;
|
|
24
|
+
}
|
|
25
|
+
if (key !== null && key !== undefined) {
|
|
26
|
+
return key;
|
|
27
|
+
}
|
|
28
|
+
if (value !== undefined) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
return "rc-index-key-".concat(index);
|
|
32
|
+
}
|
|
33
|
+
export function fillFieldNames(fieldNames, childrenAsData) {
|
|
34
|
+
var _ref = fieldNames || {},
|
|
35
|
+
label = _ref.label,
|
|
36
|
+
value = _ref.value,
|
|
37
|
+
options = _ref.options;
|
|
38
|
+
return {
|
|
39
|
+
label: label || (childrenAsData ? 'children' : 'label'),
|
|
40
|
+
value: value || 'value',
|
|
41
|
+
options: options || 'options'
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Flat options into flatten list.
|
|
47
|
+
* We use `optionOnly` here is aim to avoid user use nested option group.
|
|
48
|
+
* Here is simply set `key` to the index if not provided.
|
|
49
|
+
*/
|
|
50
|
+
export function flattenOptions(options) {
|
|
51
|
+
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
52
|
+
fieldNames = _ref2.fieldNames,
|
|
53
|
+
childrenAsData = _ref2.childrenAsData;
|
|
54
|
+
var flattenList = [];
|
|
55
|
+
var _fillFieldNames = fillFieldNames(fieldNames, false),
|
|
56
|
+
fieldLabel = _fillFieldNames.label,
|
|
57
|
+
fieldValue = _fillFieldNames.value,
|
|
58
|
+
fieldOptions = _fillFieldNames.options;
|
|
59
|
+
function dig(list, isGroupOption) {
|
|
60
|
+
list.forEach(function (data) {
|
|
61
|
+
var label = data[fieldLabel];
|
|
62
|
+
if (isGroupOption || !(fieldOptions in data)) {
|
|
63
|
+
var value = data[fieldValue];
|
|
64
|
+
|
|
65
|
+
// Option
|
|
66
|
+
flattenList.push({
|
|
67
|
+
key: getKey(data, flattenList.length),
|
|
68
|
+
groupOption: isGroupOption,
|
|
69
|
+
data: data,
|
|
70
|
+
label: label,
|
|
71
|
+
value: value
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
var grpLabel = label;
|
|
75
|
+
if (grpLabel === undefined && childrenAsData) {
|
|
76
|
+
grpLabel = data.label;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Option Group
|
|
80
|
+
flattenList.push({
|
|
81
|
+
key: getKey(data, flattenList.length),
|
|
82
|
+
group: true,
|
|
83
|
+
data: data,
|
|
84
|
+
label: grpLabel
|
|
85
|
+
});
|
|
86
|
+
dig(data[fieldOptions], true);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
dig(options, false);
|
|
91
|
+
return flattenList;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Inject `props` into `option` for legacy usage
|
|
96
|
+
*/
|
|
97
|
+
export function injectPropsWithOption(option) {
|
|
98
|
+
var newOption = _objectSpread({}, option);
|
|
99
|
+
if (!('props' in newOption)) {
|
|
100
|
+
Object.defineProperty(newOption, 'props', {
|
|
101
|
+
get: function get() {
|
|
102
|
+
warning(false, 'Return type is option instead of Option instance. Please read value directly instead of reading from `props`.');
|
|
103
|
+
return newOption;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return newOption;
|
|
108
|
+
}
|
|
109
|
+
export function getSeparatedContent(text, tokens) {
|
|
110
|
+
if (!tokens || !tokens.length) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
var match = false;
|
|
114
|
+
function separate(str, _ref3) {
|
|
115
|
+
var _ref4 = _toArray(_ref3),
|
|
116
|
+
token = _ref4[0],
|
|
117
|
+
restTokens = _ref4.slice(1);
|
|
118
|
+
if (!token) {
|
|
119
|
+
return [str];
|
|
120
|
+
}
|
|
121
|
+
var list = str.split(token);
|
|
122
|
+
match = match || list.length > 1;
|
|
123
|
+
return list.reduce(function (prevList, unitStr) {
|
|
124
|
+
return [].concat(_toConsumableArray(prevList), _toConsumableArray(separate(unitStr, restTokens)));
|
|
125
|
+
}, []).filter(function (unit) {
|
|
126
|
+
return unit;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
var list = separate(text, tokens);
|
|
130
|
+
return match ? list : null;
|
|
131
|
+
}
|
package/dist/Dropdown/index.d.ts
CHANGED
|
@@ -81,5 +81,10 @@ export interface IDropdownProps {
|
|
|
81
81
|
* @description 初始化焦点,参照:https://floating-ui.com/docs/floatingfocusmanager#initialfocus
|
|
82
82
|
*/
|
|
83
83
|
initialFocus?: FloatingFocusManagerProps['initialFocus'];
|
|
84
|
+
/**
|
|
85
|
+
* @description 菜单是否跟随触发元素宽度
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
popupMatchTriggerWidth?: boolean;
|
|
84
89
|
}
|
|
85
90
|
export default function Dropdown(props: IDropdownProps): React.JSX.Element;
|
package/dist/Dropdown/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
11
11
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
12
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
import { FloatingFocusManager, autoUpdate, flip, offset, safePolygon, shift, useClick, useDismiss, useFloating, useHover, useId, useInteractions, useRole } from '@floating-ui/react';
|
|
14
|
+
import { FloatingFocusManager, FloatingNode, FloatingTree, autoUpdate, flip, offset, safePolygon, shift, size, useClick, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useHover, useId, useInteractions, useRole } from '@floating-ui/react';
|
|
15
15
|
import { useMemoizedFn } from 'ahooks';
|
|
16
16
|
import classNames from 'classnames';
|
|
17
17
|
import ResizeObserver from 'rc-resize-observer';
|
|
@@ -42,7 +42,9 @@ export default function Dropdown(props) {
|
|
|
42
42
|
delay = _props$delay === void 0 ? 0 : _props$delay,
|
|
43
43
|
_props$autoUpdatePos = props.autoUpdatePos,
|
|
44
44
|
autoUpdatePos = _props$autoUpdatePos === void 0 ? false : _props$autoUpdatePos,
|
|
45
|
-
initialFocus = props.initialFocus
|
|
45
|
+
initialFocus = props.initialFocus,
|
|
46
|
+
_props$popupMatchTrig = props.popupMatchTriggerWidth,
|
|
47
|
+
popupMatchTriggerWidth = _props$popupMatchTrig === void 0 ? false : _props$popupMatchTrig;
|
|
46
48
|
var _useState = useState(open || false),
|
|
47
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
50
|
isOpen = _useState2[0],
|
|
@@ -60,13 +62,23 @@ export default function Dropdown(props) {
|
|
|
60
62
|
}
|
|
61
63
|
onOpenChangeFn(newOpen);
|
|
62
64
|
}, [isOpenControlled, onOpenChangeFn]);
|
|
65
|
+
var nodeId = useFloatingNodeId();
|
|
63
66
|
var _useFloating = useFloating({
|
|
67
|
+
nodeId: nodeId,
|
|
64
68
|
placement: placement,
|
|
65
69
|
open: isOpen,
|
|
66
70
|
onOpenChange: onChangeOpen,
|
|
67
71
|
middleware: [offset(offsetProps), flip({
|
|
68
72
|
fallbackAxisSideDirection: 'end'
|
|
69
|
-
}), shift()
|
|
73
|
+
}), shift(), popupMatchTriggerWidth ? size({
|
|
74
|
+
apply: function apply(_ref) {
|
|
75
|
+
var rects = _ref.rects,
|
|
76
|
+
elements = _ref.elements;
|
|
77
|
+
Object.assign(elements.floating.style, {
|
|
78
|
+
width: "".concat(rects.reference.width, "px")
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}) : undefined],
|
|
70
82
|
whileElementsMounted: autoUpdatePos ? autoUpdate : undefined
|
|
71
83
|
}),
|
|
72
84
|
refs = _useFloating.refs,
|
|
@@ -78,7 +90,7 @@ export default function Dropdown(props) {
|
|
|
78
90
|
handleClose: safePolygon({}),
|
|
79
91
|
delay: delay
|
|
80
92
|
});
|
|
81
|
-
var dismiss = useDismiss(context);
|
|
93
|
+
var dismiss = useDismiss(context, {});
|
|
82
94
|
var role = useRole(context);
|
|
83
95
|
var propsList = useMemo(function () {
|
|
84
96
|
var res = [dismiss, role];
|
|
@@ -156,8 +168,15 @@ export default function Dropdown(props) {
|
|
|
156
168
|
var setTargetRef = useCallback(function (node) {
|
|
157
169
|
refs.setReference(node);
|
|
158
170
|
}, [refs]);
|
|
159
|
-
|
|
171
|
+
var content = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
160
172
|
disabled: !isOpen,
|
|
161
173
|
ref: setTargetRef
|
|
162
|
-
}, modifiedChild),
|
|
174
|
+
}, modifiedChild), /*#__PURE__*/React.createElement(FloatingNode, {
|
|
175
|
+
id: nodeId
|
|
176
|
+
}, popup));
|
|
177
|
+
var parentId = useFloatingParentNodeId();
|
|
178
|
+
if (!parentId) {
|
|
179
|
+
return /*#__PURE__*/React.createElement(FloatingTree, null, content);
|
|
180
|
+
}
|
|
181
|
+
return content;
|
|
163
182
|
}
|
package/dist/Form/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface IFormItemProps extends FormItemProps {
|
|
|
18
18
|
declare const AldFormItem: {
|
|
19
19
|
(props: IFormItemProps): React.JSX.Element;
|
|
20
20
|
useStatus: () => {
|
|
21
|
-
status?: "" | "success" | "
|
|
21
|
+
status?: "" | "success" | "error" | "warning" | "validating" | undefined;
|
|
22
22
|
errors: React.ReactNode[];
|
|
23
23
|
warnings: React.ReactNode[];
|
|
24
24
|
};
|
package/dist/Form/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
size?: number | string;
|
|
4
|
+
title?: string;
|
|
5
|
+
titleId?: string;
|
|
6
|
+
desc?: string;
|
|
7
|
+
descId?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Memo: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement> & SVGRProps, "ref"> & React.RefAttributes<SVGSVGElement>>>;
|
|
10
|
+
export default Memo;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var _excluded = ["title", "titleId", "desc", "descId"];
|
|
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
|
+
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
|
+
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; }
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { forwardRef, memo } from 'react';
|
|
7
|
+
var ArrowDownRightFill = function ArrowDownRightFill(_ref, ref) {
|
|
8
|
+
var title = _ref.title,
|
|
9
|
+
titleId = _ref.titleId,
|
|
10
|
+
desc = _ref.desc,
|
|
11
|
+
descId = _ref.descId,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
width: props.width || props.size || 16,
|
|
16
|
+
height: props.height || props.size || 16,
|
|
17
|
+
fill: "none",
|
|
18
|
+
viewBox: "0 0 16 16",
|
|
19
|
+
ref: ref,
|
|
20
|
+
"aria-labelledby": titleId,
|
|
21
|
+
"aria-describedby": descId
|
|
22
|
+
}, props), desc ? /*#__PURE__*/React.createElement("desc", {
|
|
23
|
+
id: descId
|
|
24
|
+
}, desc) : null, title ? /*#__PURE__*/React.createElement("title", {
|
|
25
|
+
id: titleId
|
|
26
|
+
}, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
fill: props.color || 'currentColor',
|
|
28
|
+
fillRule: "evenodd",
|
|
29
|
+
d: "M8.556 6.389a.556.556 0 0 0-.393.948l2.777 2.778a.555.555 0 0 0 .786 0l2.778-2.778a.556.556 0 0 0-.393-.948H8.556Z",
|
|
30
|
+
clipRule: "evenodd"
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
var ForwardRef = /*#__PURE__*/forwardRef(ArrowDownRightFill);
|
|
34
|
+
var Memo = /*#__PURE__*/memo(ForwardRef);
|
|
35
|
+
export default Memo;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
size?: number | string;
|
|
4
|
+
title?: string;
|
|
5
|
+
titleId?: string;
|
|
6
|
+
desc?: string;
|
|
7
|
+
descId?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Memo: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement> & SVGRProps, "ref"> & React.RefAttributes<SVGSVGElement>>>;
|
|
10
|
+
export default Memo;
|