@autobest-ui/components 2.3.0 → 2.4.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/esm/accordion/Item.js +6 -23
- package/esm/accordion/index.js +8 -36
- package/esm/affix/PortalAffix.js +7 -11
- package/esm/affix/index.js +30 -70
- package/esm/carousel/index.js +45 -141
- package/esm/checkbox/index.js +12 -37
- package/esm/collapse/index.js +11 -49
- package/esm/confirm/index.d.ts +8 -0
- package/esm/confirm/index.js +23 -31
- package/esm/date-picker/DateEnum.js +0 -3
- package/esm/date-picker/calendar/Day.js +62 -78
- package/esm/date-picker/calendar/MonthYear.js +20 -53
- package/esm/date-picker/calendar/grid/index.js +7 -12
- package/esm/date-picker/calendar/index.js +4 -31
- package/esm/date-picker/index.js +11 -51
- package/esm/date-picker/utils.js +6 -11
- package/esm/drawer/Child.js +10 -20
- package/esm/drawer/index.js +22 -71
- package/esm/ellipsis/index.js +9 -17
- package/esm/guide/index.js +25 -63
- package/esm/index.d.ts +1 -1
- package/esm/input-number/ControlArrow.js +0 -2
- package/esm/input-number/constants.js +2 -2
- package/esm/input-number/index.js +26 -106
- package/esm/lazy-image/index.js +10 -55
- package/esm/link-list/index.js +11 -35
- package/esm/loading/index.js +15 -42
- package/esm/loading-container/index.js +3 -6
- package/esm/loading-icon/index.js +0 -2
- package/esm/mask/index.js +6 -9
- package/esm/message/index.d.ts +17 -6
- package/esm/message/index.js +68 -96
- package/esm/message/renderMessage.d.ts +17 -0
- package/esm/message/renderMessage.js +137 -0
- package/esm/message/style/index.css +1 -1
- package/esm/modal/Title.js +5 -12
- package/esm/modal/getPopupLocation.js +5 -7
- package/esm/modal/index.js +44 -125
- package/esm/move/index.js +32 -132
- package/esm/move/range.js +6 -12
- package/esm/move/utils.js +3 -10
- package/esm/popover/index.js +9 -28
- package/esm/portal/index.js +1 -22
- package/esm/script/index.js +19 -59
- package/esm/select/index.js +28 -106
- package/esm/show-more/index.js +40 -103
- package/esm/skeleton/Item.js +1 -3
- package/esm/skeleton/index.js +5 -11
- package/esm/style.css +1 -1
- package/esm/table/body/BodyRow.js +11 -28
- package/esm/table/body/CheckIcon.js +10 -18
- package/esm/table/body/index.js +8 -12
- package/esm/table/header/CheckIcon.js +3 -11
- package/esm/table/header/HeaderCell.js +12 -33
- package/esm/table/header/HeaderRow.js +6 -17
- package/esm/table/index.js +30 -100
- package/esm/tabs/index.js +35 -118
- package/esm/tooltip/index.js +0 -4
- package/esm/trigger/align.js +6 -6
- package/esm/trigger/bottomAlign.js +33 -45
- package/esm/trigger/constants.js +0 -1
- package/esm/trigger/getPopupLocation.js +48 -68
- package/esm/trigger/index.js +52 -187
- package/esm/trigger/leftAlign.js +33 -47
- package/esm/trigger/ref.js +2 -7
- package/esm/trigger/rightAlign.js +33 -45
- package/esm/trigger/topAlign.js +33 -45
- package/esm/trigger/utils.js +28 -45
- package/lib/accordion/Item.js +6 -27
- package/lib/accordion/index.js +8 -41
- package/lib/affix/PortalAffix.js +7 -17
- package/lib/affix/index.js +30 -75
- package/lib/carousel/index.js +45 -146
- package/lib/checkbox/index.js +12 -41
- package/lib/collapse/index.js +11 -53
- package/lib/confirm/index.d.ts +8 -0
- package/lib/confirm/index.js +23 -38
- package/lib/date-picker/DateEnum.js +0 -3
- package/lib/date-picker/calendar/Day.js +62 -87
- package/lib/date-picker/calendar/MonthYear.js +20 -62
- package/lib/date-picker/calendar/grid/index.js +7 -16
- package/lib/date-picker/calendar/index.js +4 -37
- package/lib/date-picker/index.js +9 -58
- package/lib/date-picker/utils.js +6 -26
- package/lib/drawer/Child.js +10 -25
- package/lib/drawer/index.js +22 -78
- package/lib/ellipsis/index.js +9 -23
- package/lib/guide/index.js +25 -71
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -29
- package/lib/input-number/ControlArrow.js +0 -4
- package/lib/input-number/constants.js +2 -2
- package/lib/input-number/index.js +26 -114
- package/lib/lazy-image/index.js +10 -58
- package/lib/link-list/index.js +11 -40
- package/lib/loading/index.js +13 -48
- package/lib/loading-bar/index.js +0 -5
- package/lib/loading-container/index.js +3 -11
- package/lib/loading-icon/index.js +0 -7
- package/lib/mask/index.js +6 -17
- package/lib/message/index.d.ts +17 -6
- package/lib/message/index.js +67 -104
- package/lib/message/renderMessage.d.ts +17 -0
- package/lib/message/renderMessage.js +144 -0
- package/lib/message/style/index.css +1 -1
- package/lib/modal/Affix.js +0 -4
- package/lib/modal/Title.js +5 -15
- package/lib/modal/getPopupLocation.js +5 -9
- package/lib/modal/index.js +44 -135
- package/lib/move/index.js +32 -144
- package/lib/move/range.js +6 -14
- package/lib/move/utils.js +3 -12
- package/lib/popover/index.js +9 -33
- package/lib/portal/index.js +1 -25
- package/lib/script/index.js +19 -61
- package/lib/select/index.js +28 -113
- package/lib/show-more/index.js +40 -110
- package/lib/skeleton/Item.js +1 -8
- package/lib/skeleton/index.js +5 -16
- package/lib/style.css +1 -1
- package/lib/table/body/BodyRow.js +11 -33
- package/lib/table/body/CheckIcon.js +10 -22
- package/lib/table/body/index.js +8 -17
- package/lib/table/header/CheckIcon.js +3 -15
- package/lib/table/header/HeaderCell.js +12 -37
- package/lib/table/header/HeaderRow.js +6 -22
- package/lib/table/index.js +30 -107
- package/lib/tabs/index.js +35 -122
- package/lib/tooltip/index.js +0 -9
- package/lib/trigger/align.js +0 -4
- package/lib/trigger/bottomAlign.js +33 -48
- package/lib/trigger/constants.js +0 -2
- package/lib/trigger/getPopupLocation.js +48 -74
- package/lib/trigger/index.js +52 -198
- package/lib/trigger/leftAlign.js +33 -50
- package/lib/trigger/ref.js +2 -12
- package/lib/trigger/rightAlign.js +33 -48
- package/lib/trigger/topAlign.js +33 -48
- package/lib/trigger/utils.js +28 -53
- package/package.json +7 -3
package/esm/tabs/index.js
CHANGED
|
@@ -9,30 +9,23 @@ var __extends = this && this.__extends || function () {
|
|
|
9
9
|
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
|
|
13
12
|
return _extendStatics(d, b);
|
|
14
13
|
};
|
|
15
|
-
|
|
16
14
|
return function (d, b) {
|
|
17
15
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18
|
-
|
|
19
16
|
_extendStatics(d, b);
|
|
20
|
-
|
|
21
17
|
function __() {
|
|
22
18
|
this.constructor = d;
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
26
21
|
};
|
|
27
22
|
}();
|
|
28
|
-
|
|
29
23
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
30
24
|
function adopt(value) {
|
|
31
25
|
return value instanceof P ? value : new P(function (resolve) {
|
|
32
26
|
resolve(value);
|
|
33
27
|
});
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
30
|
function fulfilled(value) {
|
|
38
31
|
try {
|
|
@@ -41,7 +34,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
41
34
|
reject(e);
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
function rejected(value) {
|
|
46
38
|
try {
|
|
47
39
|
step(generator["throw"](value));
|
|
@@ -49,29 +41,26 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
49
41
|
reject(e);
|
|
50
42
|
}
|
|
51
43
|
}
|
|
52
|
-
|
|
53
44
|
function step(result) {
|
|
54
45
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
55
46
|
}
|
|
56
|
-
|
|
57
47
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
58
48
|
});
|
|
59
49
|
};
|
|
60
|
-
|
|
61
50
|
var __generator = this && this.__generator || function (thisArg, body) {
|
|
62
51
|
var _ = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
label: 0,
|
|
53
|
+
sent: function sent() {
|
|
54
|
+
if (t[0] & 1) throw t[1];
|
|
55
|
+
return t[1];
|
|
56
|
+
},
|
|
57
|
+
trys: [],
|
|
58
|
+
ops: []
|
|
67
59
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
y,
|
|
73
|
-
t,
|
|
74
|
-
g;
|
|
60
|
+
f,
|
|
61
|
+
y,
|
|
62
|
+
t,
|
|
63
|
+
g;
|
|
75
64
|
return g = {
|
|
76
65
|
next: verb(0),
|
|
77
66
|
"throw": verb(1),
|
|
@@ -79,79 +68,60 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
79
68
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
80
69
|
return this;
|
|
81
70
|
}), g;
|
|
82
|
-
|
|
83
71
|
function verb(n) {
|
|
84
72
|
return function (v) {
|
|
85
73
|
return step([n, v]);
|
|
86
74
|
};
|
|
87
75
|
}
|
|
88
|
-
|
|
89
76
|
function step(op) {
|
|
90
77
|
if (f) throw new TypeError("Generator is already executing.");
|
|
91
|
-
|
|
92
78
|
while (_) {
|
|
93
79
|
try {
|
|
94
80
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
95
81
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
96
|
-
|
|
97
82
|
switch (op[0]) {
|
|
98
83
|
case 0:
|
|
99
84
|
case 1:
|
|
100
85
|
t = op;
|
|
101
86
|
break;
|
|
102
|
-
|
|
103
87
|
case 4:
|
|
104
88
|
_.label++;
|
|
105
89
|
return {
|
|
106
90
|
value: op[1],
|
|
107
91
|
done: false
|
|
108
92
|
};
|
|
109
|
-
|
|
110
93
|
case 5:
|
|
111
94
|
_.label++;
|
|
112
95
|
y = op[1];
|
|
113
96
|
op = [0];
|
|
114
97
|
continue;
|
|
115
|
-
|
|
116
98
|
case 7:
|
|
117
99
|
op = _.ops.pop();
|
|
118
|
-
|
|
119
100
|
_.trys.pop();
|
|
120
|
-
|
|
121
101
|
continue;
|
|
122
|
-
|
|
123
102
|
default:
|
|
124
103
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
125
104
|
_ = 0;
|
|
126
105
|
continue;
|
|
127
106
|
}
|
|
128
|
-
|
|
129
107
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
130
108
|
_.label = op[1];
|
|
131
109
|
break;
|
|
132
110
|
}
|
|
133
|
-
|
|
134
111
|
if (op[0] === 6 && _.label < t[1]) {
|
|
135
112
|
_.label = t[1];
|
|
136
113
|
t = op;
|
|
137
114
|
break;
|
|
138
115
|
}
|
|
139
|
-
|
|
140
116
|
if (t && _.label < t[2]) {
|
|
141
117
|
_.label = t[2];
|
|
142
|
-
|
|
143
118
|
_.ops.push(op);
|
|
144
|
-
|
|
145
119
|
break;
|
|
146
120
|
}
|
|
147
|
-
|
|
148
121
|
if (t[2]) _.ops.pop();
|
|
149
|
-
|
|
150
122
|
_.trys.pop();
|
|
151
|
-
|
|
152
123
|
continue;
|
|
153
124
|
}
|
|
154
|
-
|
|
155
125
|
op = body.call(thisArg, _);
|
|
156
126
|
} catch (e) {
|
|
157
127
|
op = [6, e];
|
|
@@ -160,7 +130,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
160
130
|
f = t = 0;
|
|
161
131
|
}
|
|
162
132
|
}
|
|
163
|
-
|
|
164
133
|
if (op[0] & 5) throw op[1];
|
|
165
134
|
return {
|
|
166
135
|
value: op[0] ? op[1] : void 0,
|
|
@@ -168,19 +137,13 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
168
137
|
};
|
|
169
138
|
}
|
|
170
139
|
};
|
|
171
|
-
|
|
172
140
|
import React from 'react';
|
|
173
141
|
import classNames from 'classnames';
|
|
174
142
|
import { getActualOffsetAndSize, isBlank, isEmptyArray, addEventListener, throttleWithRAF } from '@autobest-ui/utils';
|
|
175
|
-
|
|
176
|
-
var Tabs =
|
|
177
|
-
/** @class */
|
|
178
|
-
function (_super) {
|
|
143
|
+
var Tabs = /** @class */function (_super) {
|
|
179
144
|
__extends(Tabs, _super);
|
|
180
|
-
|
|
181
145
|
function Tabs(props) {
|
|
182
146
|
var _this = _super.call(this, props) || this;
|
|
183
|
-
|
|
184
147
|
_this.prefixCls = 'ab-tabs';
|
|
185
148
|
_this.resizeHandler = null;
|
|
186
149
|
_this.ulRef = /*#__PURE__*/React.createRef();
|
|
@@ -188,50 +151,39 @@ function (_super) {
|
|
|
188
151
|
* 处理value在使用data-value后,将number转成string问题
|
|
189
152
|
* @param value
|
|
190
153
|
*/
|
|
191
|
-
|
|
192
154
|
_this.getValue = function (value) {
|
|
193
155
|
if (!value) {
|
|
194
156
|
return value;
|
|
195
157
|
}
|
|
196
|
-
|
|
197
158
|
var valueNumber = Number(value);
|
|
198
159
|
return isNaN(valueNumber) ? value : valueNumber;
|
|
199
160
|
};
|
|
200
161
|
/**
|
|
201
162
|
* 根据placement不同,设置bar的位置
|
|
202
163
|
*/
|
|
203
|
-
|
|
204
|
-
|
|
205
164
|
_this.setBarStyles = function () {
|
|
206
165
|
var activeValue = _this.state.activeValue;
|
|
207
166
|
var element = _this.ulRef.current;
|
|
208
|
-
|
|
209
167
|
if (!element || isBlank(activeValue)) {
|
|
210
168
|
return;
|
|
211
169
|
}
|
|
212
|
-
|
|
213
170
|
var activeElement = Array.from(element.children).find(function (child) {
|
|
214
171
|
if (!child || !child.dataset) {
|
|
215
172
|
return null;
|
|
216
173
|
}
|
|
217
|
-
|
|
218
174
|
var value = _this.getValue(child.dataset.value);
|
|
219
|
-
|
|
220
175
|
return value === activeValue;
|
|
221
176
|
});
|
|
222
|
-
|
|
223
177
|
if (!activeElement) {
|
|
224
178
|
return;
|
|
225
179
|
}
|
|
226
|
-
|
|
227
180
|
var _a = _this.props,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
181
|
+
placement = _a.placement,
|
|
182
|
+
barSize = _a.barSize,
|
|
183
|
+
actualPositionValue = _a.actualPositionValue,
|
|
184
|
+
actualDisplayValue = _a.actualDisplayValue;
|
|
232
185
|
var offsetAndSize = getActualOffsetAndSize(activeElement, actualDisplayValue, actualPositionValue);
|
|
233
186
|
var barStyles = {};
|
|
234
|
-
|
|
235
187
|
if (placement === 'top' || placement === 'bottom') {
|
|
236
188
|
barStyles.width = "".concat(offsetAndSize.width, "px");
|
|
237
189
|
barStyles.height = barSize;
|
|
@@ -241,83 +193,59 @@ function (_super) {
|
|
|
241
193
|
barStyles.width = barSize;
|
|
242
194
|
barStyles.transform = "translate(0, ".concat(offsetAndSize.offsetTop, "px)");
|
|
243
195
|
}
|
|
244
|
-
|
|
245
196
|
_this.setState({
|
|
246
197
|
barStyles: barStyles
|
|
247
198
|
});
|
|
248
199
|
};
|
|
249
|
-
|
|
250
200
|
_this.onChange = function (ev) {
|
|
251
201
|
return __awaiter(_this, void 0, void 0, function () {
|
|
252
202
|
var dataset, value, findItem, _a, onBeforeChange, onAfterChange, _b;
|
|
253
|
-
|
|
254
203
|
return __generator(this, function (_c) {
|
|
255
204
|
switch (_c.label) {
|
|
256
205
|
case 0:
|
|
257
206
|
dataset = ev.currentTarget.dataset;
|
|
258
|
-
|
|
259
207
|
if (!dataset) {
|
|
260
|
-
return [2
|
|
261
|
-
/*return*/
|
|
262
|
-
];
|
|
208
|
+
return [2 /*return*/];
|
|
263
209
|
}
|
|
264
210
|
|
|
265
|
-
value = this.getValue(dataset.value);
|
|
266
|
-
|
|
211
|
+
value = this.getValue(dataset.value);
|
|
212
|
+
// 相同将不触发change
|
|
267
213
|
if (value === this.state.activeValue) {
|
|
268
|
-
return [2
|
|
269
|
-
/*return*/
|
|
270
|
-
];
|
|
214
|
+
return [2 /*return*/];
|
|
271
215
|
}
|
|
272
216
|
|
|
273
217
|
findItem = this.props.options.find(function (item) {
|
|
274
218
|
return item.value === value;
|
|
275
219
|
});
|
|
276
|
-
|
|
277
220
|
if (findItem && findItem.disabled) {
|
|
278
|
-
return [2
|
|
279
|
-
/*return*/
|
|
280
|
-
];
|
|
221
|
+
return [2 /*return*/];
|
|
281
222
|
}
|
|
282
223
|
|
|
283
224
|
_a = this.props, onBeforeChange = _a.onBeforeChange, onAfterChange = _a.onAfterChange;
|
|
284
225
|
_b = onBeforeChange;
|
|
285
|
-
if (!_b) return [3
|
|
286
|
-
/*
|
|
287
|
-
, 2];
|
|
288
|
-
return [4
|
|
289
|
-
/*yield*/
|
|
290
|
-
, onBeforeChange(value, ev)];
|
|
291
|
-
|
|
226
|
+
if (!_b) return [3 /*break*/, 2];
|
|
227
|
+
return [4 /*yield*/, onBeforeChange(value, ev)];
|
|
292
228
|
case 1:
|
|
293
229
|
_b = !_c.sent();
|
|
294
230
|
_c.label = 2;
|
|
295
|
-
|
|
296
231
|
case 2:
|
|
297
232
|
// before change 拦截,返回false将不改变active value
|
|
298
233
|
if (_b) {
|
|
299
|
-
return [2
|
|
300
|
-
/*return*/
|
|
301
|
-
];
|
|
234
|
+
return [2 /*return*/];
|
|
302
235
|
}
|
|
303
236
|
|
|
304
237
|
if (onAfterChange) {
|
|
305
238
|
onAfterChange(value, ev);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
239
|
+
}
|
|
240
|
+
// 如果外部控制,则不用再setstate
|
|
309
241
|
if ('activeValue' in this.props) {
|
|
310
|
-
return [2
|
|
311
|
-
/*return*/
|
|
312
|
-
];
|
|
242
|
+
return [2 /*return*/];
|
|
313
243
|
}
|
|
314
244
|
|
|
315
245
|
this.setState({
|
|
316
246
|
activeValue: value
|
|
317
247
|
});
|
|
318
|
-
return [2
|
|
319
|
-
/*return*/
|
|
320
|
-
];
|
|
248
|
+
return [2 /*return*/];
|
|
321
249
|
}
|
|
322
250
|
});
|
|
323
251
|
});
|
|
@@ -328,29 +256,24 @@ function (_super) {
|
|
|
328
256
|
};
|
|
329
257
|
return _this;
|
|
330
258
|
}
|
|
331
|
-
|
|
332
259
|
Tabs.getDerivedStateFromProps = function (nextProps) {
|
|
333
260
|
if ('activeValue' in nextProps) {
|
|
334
261
|
return {
|
|
335
262
|
activeValue: nextProps.activeValue
|
|
336
263
|
};
|
|
337
264
|
}
|
|
338
|
-
|
|
339
265
|
return null;
|
|
340
266
|
};
|
|
341
|
-
|
|
342
267
|
Tabs.prototype.componentDidMount = function () {
|
|
343
268
|
var _this = this;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
269
|
+
this.setBarStyles();
|
|
270
|
+
// 加入 resize 监听
|
|
347
271
|
if (!this.resizeHandler) {
|
|
348
272
|
this.resizeHandler = addEventListener(window, 'resize', throttleWithRAF(function () {
|
|
349
273
|
return _this.setBarStyles();
|
|
350
274
|
}));
|
|
351
275
|
}
|
|
352
276
|
};
|
|
353
|
-
|
|
354
277
|
Tabs.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
355
278
|
// 等待activeValue更新后,在计算bar的样式,
|
|
356
279
|
// 主要解决active后,active样式发生改变,bar也需要相应调整
|
|
@@ -358,31 +281,27 @@ function (_super) {
|
|
|
358
281
|
this.setBarStyles();
|
|
359
282
|
}
|
|
360
283
|
};
|
|
361
|
-
|
|
362
284
|
Tabs.prototype.componentWillUnmount = function () {
|
|
363
285
|
if (this.resizeHandler) {
|
|
364
286
|
this.resizeHandler.remove();
|
|
365
287
|
this.resizeHandler = null;
|
|
366
288
|
}
|
|
367
289
|
};
|
|
368
|
-
|
|
369
290
|
Tabs.prototype.render = function () {
|
|
370
291
|
var _this = this;
|
|
371
|
-
|
|
372
292
|
var cls = this.prefixCls;
|
|
373
293
|
var _a = this.props,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
294
|
+
className = _a.className,
|
|
295
|
+
options = _a.options,
|
|
296
|
+
placement = _a.placement;
|
|
377
297
|
var _b = this.state,
|
|
378
|
-
|
|
379
|
-
|
|
298
|
+
activeValue = _b.activeValue,
|
|
299
|
+
barStyles = _b.barStyles;
|
|
380
300
|
return /*#__PURE__*/React.createElement("div", {
|
|
381
301
|
className: classNames(cls, className, "".concat(cls, "-").concat(placement)),
|
|
382
302
|
ref: this.ulRef
|
|
383
303
|
}, options.map(function (item) {
|
|
384
304
|
var _a;
|
|
385
|
-
|
|
386
305
|
return /*#__PURE__*/React.createElement("div", {
|
|
387
306
|
key: item.value,
|
|
388
307
|
className: classNames("".concat(cls, "-item"), item.className, (_a = {}, _a["".concat(cls, "-active")] = activeValue === item.value, _a["".concat(cls, "-disabled")] = item.disabled, _a)),
|
|
@@ -394,7 +313,6 @@ function (_super) {
|
|
|
394
313
|
style: barStyles
|
|
395
314
|
}));
|
|
396
315
|
};
|
|
397
|
-
|
|
398
316
|
Tabs.defaultProps = {
|
|
399
317
|
barSize: '1px',
|
|
400
318
|
placement: 'top',
|
|
@@ -403,5 +321,4 @@ function (_super) {
|
|
|
403
321
|
};
|
|
404
322
|
return Tabs;
|
|
405
323
|
}(React.Component);
|
|
406
|
-
|
|
407
324
|
export default Tabs;
|
package/esm/tooltip/index.js
CHANGED
|
@@ -2,18 +2,14 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
import React from 'react';
|
|
18
14
|
import Popover from '../popover';
|
|
19
15
|
var cls = 'ab-tooltip';
|
package/esm/trigger/align.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// left 位置方法
|
|
2
|
-
export { getLeftLocationInfo, getLeftBottomLocationInfo, getLeftTopLocationInfo } from './leftAlign';
|
|
3
|
-
|
|
4
|
-
export { getRightLocationInfo, getRightBottomLocationInfo, getRightTopLocationInfo } from './rightAlign';
|
|
5
|
-
|
|
6
|
-
export { getTopLocationInfo, getTopLeftLocationInfo, getTopRightLocationInfo } from './topAlign';
|
|
7
|
-
|
|
2
|
+
export { getLeftLocationInfo, getLeftBottomLocationInfo, getLeftTopLocationInfo } from './leftAlign';
|
|
3
|
+
// right 位置方法
|
|
4
|
+
export { getRightLocationInfo, getRightBottomLocationInfo, getRightTopLocationInfo } from './rightAlign';
|
|
5
|
+
// top 位置方法
|
|
6
|
+
export { getTopLocationInfo, getTopLeftLocationInfo, getTopRightLocationInfo } from './topAlign';
|
|
7
|
+
// bottom 位置方法
|
|
8
8
|
export { getBottomLeftLocationInfo, getBottomLocationInfo, getBottomRightLocationInfo } from './bottomAlign';
|
|
@@ -2,28 +2,23 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
import { getArrowLeft, getAvailPosition } from './utils';
|
|
18
|
-
|
|
19
14
|
function getBottomCommon(_a) {
|
|
20
15
|
var top = _a.top,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
rootInfo = _a.rootInfo,
|
|
17
|
+
popInfo = _a.popInfo,
|
|
18
|
+
arrowLeft = _a.arrowLeft,
|
|
19
|
+
hiddenArrow = _a.hiddenArrow,
|
|
20
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
21
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
|
|
27
22
|
return {
|
|
28
23
|
rootWidth: rootInfo.width,
|
|
29
24
|
width: popInfo.width,
|
|
@@ -37,22 +32,19 @@ function getBottomCommon(_a) {
|
|
|
37
32
|
transformOrigin: isTransformHorizontalDirection ? 'center top' : "".concat(arrowLeft, "px top")
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
export function getBottomLocationInfo(_a) {
|
|
42
36
|
var rootInfo = _a.rootInfo,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
popInfo = _a.popInfo,
|
|
38
|
+
_b = _a.translateX,
|
|
39
|
+
translateX = _b === void 0 ? 0 : _b,
|
|
40
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
41
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
42
|
+
hiddenArrow = _a.hiddenArrow,
|
|
43
|
+
isInsertNode = _a.isInsertNode;
|
|
50
44
|
var arrowLeft = getArrowLeft(popInfo.width / 2 - translateX, popInfo.width);
|
|
51
|
-
|
|
52
45
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
left = _c.left,
|
|
47
|
+
top = _c.top;
|
|
56
48
|
return __assign(__assign({}, getBottomCommon({
|
|
57
49
|
top: top,
|
|
58
50
|
rootInfo: rootInfo,
|
|
@@ -67,19 +59,17 @@ export function getBottomLocationInfo(_a) {
|
|
|
67
59
|
}
|
|
68
60
|
export function getBottomLeftLocationInfo(_a) {
|
|
69
61
|
var rootInfo = _a.rootInfo,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
popInfo = _a.popInfo,
|
|
63
|
+
_b = _a.translateX,
|
|
64
|
+
translateX = _b === void 0 ? 0 : _b,
|
|
65
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
66
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
67
|
+
hiddenArrow = _a.hiddenArrow,
|
|
68
|
+
isInsertNode = _a.isInsertNode;
|
|
77
69
|
var arrowLeft = getArrowLeft(rootInfo.width / 2 - translateX, popInfo.width);
|
|
78
|
-
|
|
79
70
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
left = _c.left,
|
|
72
|
+
top = _c.top;
|
|
83
73
|
return __assign(__assign({}, getBottomCommon({
|
|
84
74
|
top: top,
|
|
85
75
|
rootInfo: rootInfo,
|
|
@@ -94,19 +84,17 @@ export function getBottomLeftLocationInfo(_a) {
|
|
|
94
84
|
}
|
|
95
85
|
export function getBottomRightLocationInfo(_a) {
|
|
96
86
|
var rootInfo = _a.rootInfo,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
popInfo = _a.popInfo,
|
|
88
|
+
_b = _a.translateX,
|
|
89
|
+
translateX = _b === void 0 ? 0 : _b,
|
|
90
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
91
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
92
|
+
hiddenArrow = _a.hiddenArrow,
|
|
93
|
+
isInsertNode = _a.isInsertNode;
|
|
104
94
|
var arrowLeft = getArrowLeft(popInfo.width - rootInfo.width / 2 - translateX, popInfo.width);
|
|
105
|
-
|
|
106
95
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
left = _c.left,
|
|
97
|
+
top = _c.top;
|
|
110
98
|
return __assign(__assign({}, getBottomCommon({
|
|
111
99
|
top: top,
|
|
112
100
|
rootInfo: rootInfo,
|
package/esm/trigger/constants.js
CHANGED
|
@@ -64,6 +64,5 @@ export function getLocationInfo(placement) {
|
|
|
64
64
|
if (!LocationType[placement]) {
|
|
65
65
|
throw new TypeError('Support placement: Top, TopLeft, TopRight, Bottom, BottomLeft, BottomRight, Right, RightTop, RightBottom, Left, LeftTop, LeftBottom');
|
|
66
66
|
}
|
|
67
|
-
|
|
68
67
|
return LocationType[placement];
|
|
69
68
|
}
|