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