assui 2.1.55 → 2.2.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/es/color-select/index.d.ts +23 -0
- package/es/color-select/index.js +106 -0
- package/es/color-select/style/index.css +1821 -0
- package/es/color-select/style/index.d.ts +2 -0
- package/es/color-select/style/index.js +2 -0
- package/es/color-select/style/index.less +46 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +1 -0
- package/es/messages/en_US.d.ts +3 -0
- package/es/messages/en_US.js +3 -0
- package/es/messages/index.d.ts +7 -2
- package/es/messages/zh_CN.d.ts +3 -0
- package/es/messages/zh_CN.js +3 -0
- package/lib/color-select/index.d.ts +23 -0
- package/lib/color-select/index.js +165 -0
- package/lib/color-select/style/index.css +1821 -0
- package/lib/color-select/style/index.d.ts +2 -0
- package/lib/color-select/style/index.js +9 -0
- package/lib/color-select/style/index.less +46 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +10 -1
- package/lib/messages/en_US.d.ts +3 -0
- package/lib/messages/en_US.js +3 -0
- package/lib/messages/index.d.ts +7 -2
- package/lib/messages/zh_CN.d.ts +3 -0
- package/lib/messages/zh_CN.js +3 -0
- package/package.json +5 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@import '~antd/lib/style/index.less';
|
|
2
|
+
|
|
3
|
+
.color-select-wrap {
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.color-select {
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 130px;
|
|
10
|
+
padding: @input-padding-vertical-base @input-padding-horizontal-base;
|
|
11
|
+
border: @border-width-base @border-style-base @input-border-color;
|
|
12
|
+
border-radius: @control-border-radius;
|
|
13
|
+
|
|
14
|
+
&:hover {
|
|
15
|
+
border: 1px solid @primary-color;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&:focus,
|
|
19
|
+
&-focused {
|
|
20
|
+
border-color: @primary-color-hover;
|
|
21
|
+
border-right-width: 1px;
|
|
22
|
+
outline: 0;
|
|
23
|
+
box-shadow: @input-outline-offset @outline-blur-size @outline-width @primary-color-outline;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-value {
|
|
27
|
+
width: 80px;
|
|
28
|
+
height: 20px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-placeholder {
|
|
32
|
+
color: #bfbfbf;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.color-select-arrow {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 50%;
|
|
38
|
+
right: 15px;
|
|
39
|
+
transform: translateY(-50%);
|
|
40
|
+
|
|
41
|
+
.spotecicon {
|
|
42
|
+
width: 12px;
|
|
43
|
+
height: 12px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export type { TextInputProps } from './text-input';
|
|
|
40
40
|
export { default as TextInput } from './text-input';
|
|
41
41
|
export type { LabelInputProps } from './label-input';
|
|
42
42
|
export { default as LabelInput } from './label-input';
|
|
43
|
+
export type { ColorSelectProps } from './color-select';
|
|
44
|
+
export { default as ColorSelect } from './color-select';
|
|
43
45
|
export type { LabelSelectProps } from './label-select';
|
|
44
46
|
export { default as LabelSelect } from './label-select';
|
|
45
47
|
export type { ASelectProps } from './a-select';
|
package/es/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export { default as SplitPane } from './split-pane';
|
|
|
20
20
|
export { default as TextArea } from './text-area';
|
|
21
21
|
export { default as TextInput } from './text-input';
|
|
22
22
|
export { default as LabelInput } from './label-input';
|
|
23
|
+
export { default as ColorSelect } from './color-select';
|
|
23
24
|
export { default as LabelSelect } from './label-select';
|
|
24
25
|
export { default as ASelect } from './a-select';
|
|
25
26
|
export { default as LabelTextArea } from './label-text-area';
|
package/es/messages/en_US.d.ts
CHANGED
package/es/messages/en_US.js
CHANGED
package/es/messages/index.d.ts
CHANGED
|
@@ -15,8 +15,13 @@ export declare type LabelCustomizeRangePickerType = {
|
|
|
15
15
|
last180days: string;
|
|
16
16
|
last365days: string;
|
|
17
17
|
};
|
|
18
|
+
export declare type Global = {
|
|
19
|
+
placeholder: string;
|
|
20
|
+
};
|
|
21
|
+
export declare type All = LabelCustomizeRangePickerType & Global;
|
|
18
22
|
export declare type LangType = {
|
|
19
23
|
labelCustomizeRangePicker: LabelCustomizeRangePickerType;
|
|
24
|
+
global: Global;
|
|
20
25
|
};
|
|
21
|
-
export declare type DisplayNameType = 'labelCustomizeRangePicker';
|
|
22
|
-
export default function formatMessage(message: LangType, displayName: DisplayNameType, key: keyof
|
|
26
|
+
export declare type DisplayNameType = 'labelCustomizeRangePicker' | 'global';
|
|
27
|
+
export default function formatMessage(message: LangType, displayName: DisplayNameType, key: keyof All): any;
|
package/es/messages/zh_CN.d.ts
CHANGED
package/es/messages/zh_CN.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SketchPickerProps } from 'react-color';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { TriggerProps } from 'rc-trigger';
|
|
4
|
+
export declare type ColorSelectProps = {
|
|
5
|
+
value?: {
|
|
6
|
+
hex?: string;
|
|
7
|
+
rgb?: string;
|
|
8
|
+
};
|
|
9
|
+
/** 自定义总容器 class */
|
|
10
|
+
classNameWrap?: string;
|
|
11
|
+
/** 自定义其余描述展示 */
|
|
12
|
+
renderExtra?: (value: ColorSelectProps['value']) => React.ReactElement;
|
|
13
|
+
/** 自定义value class */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** 组件react-color的props */
|
|
16
|
+
reactColorProps?: Omit<SketchPickerProps, 'onChange'>;
|
|
17
|
+
/** 组件rc-trigger */
|
|
18
|
+
RcTriggerProps?: Omit<TriggerProps, 'popup'>;
|
|
19
|
+
/** 自定义value的展示 */
|
|
20
|
+
renderValueNode?: (value: ColorSelectProps['value']) => React.ReactElement;
|
|
21
|
+
};
|
|
22
|
+
declare const ColorSelect: React.FC<ColorSelectProps>;
|
|
23
|
+
export default ColorSelect;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
|
|
8
|
+
for (var p in s) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return __assign.apply(this, arguments);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
22
|
+
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return m[k];
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
} : function (o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
39
|
+
Object.defineProperty(o, "default", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
value: v
|
|
42
|
+
});
|
|
43
|
+
} : function (o, v) {
|
|
44
|
+
o["default"] = v;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k in mod) {
|
|
51
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
__setModuleDefault(result, mod);
|
|
55
|
+
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
var __read = this && this.__read || function (o, n) {
|
|
60
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
61
|
+
if (!m) return o;
|
|
62
|
+
var i = m.call(o),
|
|
63
|
+
r,
|
|
64
|
+
ar = [],
|
|
65
|
+
e;
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
69
|
+
ar.push(r.value);
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
e = {
|
|
73
|
+
error: error
|
|
74
|
+
};
|
|
75
|
+
} finally {
|
|
76
|
+
try {
|
|
77
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
78
|
+
} finally {
|
|
79
|
+
if (e) throw e.error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return ar;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
87
|
+
return mod && mod.__esModule ? mod : {
|
|
88
|
+
"default": mod
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
Object.defineProperty(exports, "__esModule", {
|
|
93
|
+
value: true
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
var react_color_1 = require("react-color");
|
|
97
|
+
|
|
98
|
+
var react_1 = __importStar(require("react"));
|
|
99
|
+
|
|
100
|
+
var rc_trigger_1 = __importDefault(require("rc-trigger"));
|
|
101
|
+
|
|
102
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
103
|
+
|
|
104
|
+
var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
|
|
105
|
+
|
|
106
|
+
var ChevronRightOutlined_1 = __importDefault(require("a-icons/lib/ChevronRightOutlined"));
|
|
107
|
+
|
|
108
|
+
var context_1 = __importDefault(require("../config-provider/context"));
|
|
109
|
+
|
|
110
|
+
var messages_1 = __importDefault(require("../messages"));
|
|
111
|
+
|
|
112
|
+
var ColorSelect = function ColorSelect(props) {
|
|
113
|
+
var className = props.className,
|
|
114
|
+
classNameWrap = props.classNameWrap,
|
|
115
|
+
reactColorProps = props.reactColorProps,
|
|
116
|
+
RcTriggerProps = props.RcTriggerProps,
|
|
117
|
+
renderValueNode = props.renderValueNode,
|
|
118
|
+
renderExtra = props.renderExtra;
|
|
119
|
+
|
|
120
|
+
var _a = __read((0, useControllableValue_1["default"])(props), 2),
|
|
121
|
+
value = _a[0],
|
|
122
|
+
onChangeValue = _a[1];
|
|
123
|
+
|
|
124
|
+
var messages = (0, react_1.useContext)(context_1["default"]);
|
|
125
|
+
|
|
126
|
+
var onChange = function onChange(nextValue) {
|
|
127
|
+
onChangeValue({
|
|
128
|
+
hex: nextValue.hex,
|
|
129
|
+
rgb: "".concat(nextValue.rgb.r, ",").concat(nextValue.rgb.g, ",").concat(nextValue.rgb.b)
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
var defaultValueNode = react_1["default"].createElement("div", {
|
|
134
|
+
className: (0, classnames_1["default"])('color-select', className),
|
|
135
|
+
tabIndex: 0
|
|
136
|
+
}, value ? react_1["default"].createElement("div", {
|
|
137
|
+
className: "color-select-value",
|
|
138
|
+
style: value ? {
|
|
139
|
+
backgroundColor: value.hex
|
|
140
|
+
} : undefined
|
|
141
|
+
}) : react_1["default"].createElement("span", {
|
|
142
|
+
className: "color-select-placeholder"
|
|
143
|
+
}, (0, messages_1["default"])(messages, 'global', 'placeholder')), react_1["default"].createElement("div", {
|
|
144
|
+
className: "color-select-arrow"
|
|
145
|
+
}, react_1["default"].createElement(ChevronRightOutlined_1["default"], {
|
|
146
|
+
rotate: 90
|
|
147
|
+
})));
|
|
148
|
+
return react_1["default"].createElement("div", {
|
|
149
|
+
className: (0, classnames_1["default"])('color-select-wrap', classNameWrap)
|
|
150
|
+
}, react_1["default"].createElement(rc_trigger_1["default"], __assign({
|
|
151
|
+
popupAlign: {
|
|
152
|
+
points: ['tl', 'bl'],
|
|
153
|
+
offset: [0, 3]
|
|
154
|
+
},
|
|
155
|
+
action: ['click']
|
|
156
|
+
}, RcTriggerProps, {
|
|
157
|
+
popup: react_1["default"].createElement(react_color_1.SketchPicker, __assign({
|
|
158
|
+
width: "320px",
|
|
159
|
+
color: value ? value.hex : undefined,
|
|
160
|
+
onChange: onChange
|
|
161
|
+
}, reactColorProps))
|
|
162
|
+
}), renderValueNode ? renderValueNode(value) : defaultValueNode), renderExtra && renderExtra(value));
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
exports["default"] = ColorSelect;
|