@douyinfe/semi-foundation 2.0.9-alpha.2 → 2.1.0-alpha.2
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/calendar/foundation.ts +1 -1
- package/cascader/foundation.ts +1 -1
- package/collapse/foundation.ts +1 -1
- package/lib/es/anchor/foundation.js +12 -20
- package/lib/es/backtop/foundation.js +3 -5
- package/lib/es/base/foundation.js +2 -7
- package/lib/es/calendar/eventUtil.js +3 -9
- package/lib/es/cascader/foundation.d.ts +1 -1
- package/lib/es/cascader/foundation.js +4 -8
- package/lib/es/collapse/foundation.d.ts +1 -1
- package/lib/es/datePicker/_utils/formatter.js +5 -7
- package/lib/es/datePicker/_utils/getDayOfWeek.js +3 -4
- package/lib/es/datePicker/_utils/getMonthTable.js +2 -6
- package/lib/es/datePicker/_utils/isBetween.js +4 -5
- package/lib/es/datePicker/_utils/isWithinInterval.js +4 -5
- package/lib/es/datePicker/foundation.js +16 -46
- package/lib/es/datePicker/monthsGridFoundation.js +7 -15
- package/lib/es/form/foundation.js +8 -14
- package/lib/es/form/utils.js +2 -4
- package/lib/es/input/util/calculateNodeHeight.js +1 -4
- package/lib/es/inputNumber/foundation.js +5 -18
- package/lib/es/navigation/NavItem.js +1 -3
- package/lib/es/navigation/foundation.js +6 -25
- package/lib/es/navigation/subNavFoundation.js +2 -12
- package/lib/es/overflowList/foundation.js +3 -6
- package/lib/es/pagination/foundation.js +1 -5
- package/lib/es/popconfirm/popconfirmFoundation.d.ts +2 -0
- package/lib/es/popconfirm/popconfirmFoundation.js +4 -0
- package/lib/es/scrollList/itemFoundation.js +2 -4
- package/lib/es/scrollList/scrollTo.js +3 -4
- package/lib/es/select/foundation.js +11 -7
- package/lib/es/sideSheet/sideSheetFoundation.js +8 -11
- package/lib/es/slider/foundation.js +4 -11
- package/lib/es/table/bodyFoundation.js +1 -5
- package/lib/es/table/foundation.js +13 -29
- package/lib/es/table/utils.js +24 -64
- package/lib/es/tabs/foundation.d.ts +3 -0
- package/lib/es/tabs/foundation.js +4 -8
- package/lib/es/tabs/tabs.css +13 -1
- package/lib/es/tabs/tabs.scss +96 -76
- package/lib/es/tagInput/foundation.d.ts +1 -0
- package/lib/es/tagInput/foundation.js +2 -0
- package/lib/es/timePicker/ComboxFoundation.js +1 -2
- package/lib/es/timePicker/foundation.js +11 -20
- package/lib/es/timePicker/utils/index.js +5 -16
- package/lib/es/timePicker/utils/localeDate.js +2 -8
- package/lib/es/timeline/timeline.css +1 -0
- package/lib/es/timeline/timeline.scss +1 -0
- package/lib/es/timeline/variables.scss +1 -0
- package/lib/es/tooltip/foundation.js +19 -26
- package/lib/es/tree/foundation.d.ts +1 -1
- package/lib/es/tree/foundation.js +2 -4
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +19 -29
- package/lib/es/treeSelect/foundation.d.ts +10 -11
- package/lib/es/treeSelect/foundation.js +1 -2
- package/lib/es/upload/constants.d.ts +1 -1
- package/lib/es/upload/foundation.js +27 -32
- package/lib/es/utils/Event.js +4 -11
- package/lib/es/utils/Logger.js +5 -27
- package/lib/es/utils/array.js +1 -3
- package/lib/es/utils/classnames.js +2 -12
- package/lib/es/utils/dom.js +2 -10
- package/lib/es/utils/getHighlight.js +19 -24
- package/lib/es/utils/log.js +1 -5
- package/lib/es/utils/object.js +2 -5
- package/lib/es/utils/touchPolyfill.js +1 -3
- package/package.json +3 -3
- package/popconfirm/popconfirmFoundation.ts +5 -0
- package/select/foundation.ts +6 -5
- package/tabs/foundation.ts +7 -8
- package/tabs/tabs.scss +96 -76
- package/tagInput/foundation.ts +2 -0
- package/timeline/timeline.scss +1 -0
- package/timeline/variables.scss +1 -0
- package/tooltip/foundation.ts +4 -2
- package/tree/foundation.ts +1 -1
- package/tree/treeUtil.ts +1 -1
- package/treeSelect/foundation.ts +10 -9
|
@@ -28,10 +28,7 @@ const defaultRect = {
|
|
|
28
28
|
};
|
|
29
29
|
export default class Tooltip extends BaseFoundation {
|
|
30
30
|
constructor(adapter) {
|
|
31
|
-
var _this;
|
|
32
|
-
|
|
33
31
|
super(_Object$assign({}, adapter));
|
|
34
|
-
_this = this;
|
|
35
32
|
|
|
36
33
|
this.onResize = () => {
|
|
37
34
|
// this.log('resize');
|
|
@@ -77,6 +74,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
77
74
|
this._adapter.insertPortal(content, position);
|
|
78
75
|
|
|
79
76
|
if (trigger === 'custom') {
|
|
77
|
+
// eslint-disable-next-line
|
|
78
|
+
this._adapter.registerClickOutsideHandler(() => {});
|
|
79
|
+
|
|
80
80
|
this._togglePortalVisible(true);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -113,29 +113,27 @@ export default class Tooltip extends BaseFoundation {
|
|
|
113
113
|
*/
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
this.calcPosition =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
wrapperRect = (isEmpty(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) || _Object$assign({}, defaultRect); // console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
|
|
116
|
+
this.calcPosition = (triggerRect, wrapperRect, containerRect, shouldUpdatePos = true) => {
|
|
117
|
+
triggerRect = (isEmpty(triggerRect) ? this._adapter.getTriggerBounding() : triggerRect) || _Object$assign({}, defaultRect);
|
|
118
|
+
containerRect = (isEmpty(containerRect) ? this._adapter.getPopupContainerRect() : containerRect) || _Object$assign({}, defaultRect);
|
|
119
|
+
wrapperRect = (isEmpty(wrapperRect) ? this._adapter.getWrapperBounding() : wrapperRect) || _Object$assign({}, defaultRect); // console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
|
|
121
120
|
|
|
122
|
-
let style =
|
|
121
|
+
let style = this.calcPosStyle(triggerRect, wrapperRect, containerRect);
|
|
122
|
+
let position = this.getProp('position');
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (_this.getProp('autoAdjustOverflow')) {
|
|
124
|
+
if (this.getProp('autoAdjustOverflow')) {
|
|
127
125
|
// console.log('style: ', style, '\ntriggerRect: ', triggerRect, '\nwrapperRect: ', wrapperRect);
|
|
128
|
-
const adjustedPos =
|
|
126
|
+
const adjustedPos = this.adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect);
|
|
129
127
|
|
|
130
128
|
if (position !== adjustedPos) {
|
|
131
129
|
position = adjustedPos;
|
|
132
|
-
style =
|
|
130
|
+
style = this.calcPosStyle(triggerRect, wrapperRect, containerRect, position);
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
|
|
136
|
-
if (shouldUpdatePos &&
|
|
134
|
+
if (shouldUpdatePos && this._mounted) {
|
|
137
135
|
// this._adapter.updatePlacementAttr(style.position);
|
|
138
|
-
|
|
136
|
+
this._adapter.setPosition(_Object$assign(_Object$assign({}, style), {
|
|
139
137
|
position
|
|
140
138
|
}));
|
|
141
139
|
}
|
|
@@ -199,12 +197,12 @@ export default class Tooltip extends BaseFoundation {
|
|
|
199
197
|
}
|
|
200
198
|
|
|
201
199
|
_bindEvent() {
|
|
202
|
-
const
|
|
200
|
+
const trigger = this.getProp('trigger'); // get trigger type
|
|
203
201
|
|
|
204
202
|
const {
|
|
205
203
|
triggerEventSet,
|
|
206
204
|
portalEventSet
|
|
207
|
-
} = this._generateEvent(
|
|
205
|
+
} = this._generateEvent(trigger);
|
|
208
206
|
|
|
209
207
|
this._bindTriggerEvent(triggerEventSet);
|
|
210
208
|
|
|
@@ -247,10 +245,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
247
245
|
this._adapter.unregisterResizeHandler(this.onResize);
|
|
248
246
|
}
|
|
249
247
|
|
|
250
|
-
_reversePos() {
|
|
251
|
-
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
252
|
-
let isVertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
253
|
-
|
|
248
|
+
_reversePos(position = '', isVertical = false) {
|
|
254
249
|
if (isVertical) {
|
|
255
250
|
if (REGS.TOP.test(position)) {
|
|
256
251
|
return position.replace('top', 'bottom').replace('Top', 'Bottom');
|
|
@@ -609,13 +604,11 @@ export default class Tooltip extends BaseFoundation {
|
|
|
609
604
|
return style;
|
|
610
605
|
}
|
|
611
606
|
|
|
612
|
-
isLR() {
|
|
613
|
-
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
607
|
+
isLR(position = '') {
|
|
614
608
|
return _indexOfInstanceProperty(position).call(position, 'left') === 0 || _indexOfInstanceProperty(position).call(position, 'right') === 0;
|
|
615
609
|
}
|
|
616
610
|
|
|
617
|
-
isTB() {
|
|
618
|
-
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
611
|
+
isTB(position = '') {
|
|
619
612
|
return _indexOfInstanceProperty(position).call(position, 'top') === 0 || _indexOfInstanceProperty(position).call(position, 'bottom') === 0;
|
|
620
613
|
} // place the dom correctly
|
|
621
614
|
|
|
@@ -162,7 +162,7 @@ export interface BasicTreeProps {
|
|
|
162
162
|
onDragOver?: (dragProps: BasicDragProps) => void;
|
|
163
163
|
onDragStart?: (dragProps: BasicDragProps) => void;
|
|
164
164
|
onDrop?: (onDragProps: BasicOnDragProps) => void;
|
|
165
|
-
onExpand?: (expandedKeys: string[],
|
|
165
|
+
onExpand?: (expandedKeys: string[], expandedOtherProps: BasicExpandedOtherProps) => void;
|
|
166
166
|
onLoad?: (loadedKeys?: Set<string>, treeNode?: BasicTreeNodeData) => void;
|
|
167
167
|
onContextMenu?: (e: any, node: BasicTreeNodeData) => void;
|
|
168
168
|
onSearch?: (sunInput: string) => void;
|
|
@@ -37,8 +37,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
37
37
|
return this.getProp('motion');
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
_isDisabled() {
|
|
41
|
-
let treeNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
40
|
+
_isDisabled(treeNode = {}) {
|
|
42
41
|
return this.getProp('disabled') || treeNode.disabled;
|
|
43
42
|
}
|
|
44
43
|
|
|
@@ -503,8 +502,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
503
502
|
return _Object$assign(_Object$assign({}, node.data), pick(node, ['expanded', 'pos', 'children']));
|
|
504
503
|
}
|
|
505
504
|
|
|
506
|
-
triggerDragEvent(name, event, node) {
|
|
507
|
-
let extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
505
|
+
triggerDragEvent(name, event, node, extra = {}) {
|
|
508
506
|
const callEvent = this.getProp(name);
|
|
509
507
|
callEvent && callEvent(_Object$assign({
|
|
510
508
|
event,
|
|
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
|
|
|
74
74
|
export declare function normalizeValue(value: any, withObject: boolean): any;
|
|
75
75
|
export declare function updateKeys(keySet: Set<string>, keyEntities: KeyEntities): string[];
|
|
76
76
|
export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
|
|
77
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
77
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
|
|
78
78
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
79
79
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -9,6 +9,7 @@ import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
|
9
9
|
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
10
10
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
11
11
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
12
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
12
13
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
13
14
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
14
15
|
|
|
@@ -38,13 +39,11 @@ function isValid(val) {
|
|
|
38
39
|
// eslint-disable-next-line max-len
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
export function flattenTreeData(treeNodeList, expandedKeys) {
|
|
42
|
-
let filteredShownKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
42
|
+
export function flattenTreeData(treeNodeList, expandedKeys, filteredShownKeys = false) {
|
|
43
43
|
const flattenList = [];
|
|
44
44
|
const filterSearch = Boolean(filteredShownKeys);
|
|
45
45
|
|
|
46
|
-
function flatten(list) {
|
|
47
|
-
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
46
|
+
function flatten(list, parent = null) {
|
|
48
47
|
return _mapInstanceProperty(list).call(list, (treeNode, index) => {
|
|
49
48
|
const pos = getPosition(parent ? parent.pos : '0', index);
|
|
50
49
|
const mergedKey = treeNode.key; // Add FlattenDataNode into list
|
|
@@ -186,9 +185,7 @@ export function convertDataToEntities(dataNodes) {
|
|
|
186
185
|
}
|
|
187
186
|
/* Get key by value */
|
|
188
187
|
|
|
189
|
-
export function findKeysForValues(valueList, valueEntities) {
|
|
190
|
-
let isMultiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
191
|
-
|
|
188
|
+
export function findKeysForValues(valueList, valueEntities, isMultiple = false) {
|
|
192
189
|
if (!isValid(valueList)) {
|
|
193
190
|
return [];
|
|
194
191
|
}
|
|
@@ -213,8 +210,7 @@ export function findKeysForValues(valueList, valueEntities) {
|
|
|
213
210
|
|
|
214
211
|
return res;
|
|
215
212
|
}
|
|
216
|
-
export function findDescendantKeys(selectedKeys, options) {
|
|
217
|
-
let self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
213
|
+
export function findDescendantKeys(selectedKeys, options, self = true) {
|
|
218
214
|
const res = [];
|
|
219
215
|
|
|
220
216
|
const findChild = item => {
|
|
@@ -245,8 +241,7 @@ export function findDescendantKeys(selectedKeys, options) {
|
|
|
245
241
|
|
|
246
242
|
return res;
|
|
247
243
|
}
|
|
248
|
-
export function findChildKeys(keys, options) {
|
|
249
|
-
let omitKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
244
|
+
export function findChildKeys(keys, options, omitKeys = []) {
|
|
250
245
|
const res = [];
|
|
251
246
|
keys && _forEachInstanceProperty(keys).call(keys, key => {
|
|
252
247
|
var _context4;
|
|
@@ -288,8 +283,7 @@ export function findLeafKeys(keys, options) {
|
|
|
288
283
|
|
|
289
284
|
return res;
|
|
290
285
|
}
|
|
291
|
-
export function findSiblingKeys(selectedKeys, options) {
|
|
292
|
-
let self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
286
|
+
export function findSiblingKeys(selectedKeys, options, self = true) {
|
|
293
287
|
const par = [];
|
|
294
288
|
|
|
295
289
|
_forEachInstanceProperty(selectedKeys).call(selectedKeys, item => {
|
|
@@ -301,8 +295,7 @@ export function findSiblingKeys(selectedKeys, options) {
|
|
|
301
295
|
const res = findChildKeys(uniq(par), options, self ? [] : selectedKeys);
|
|
302
296
|
return res;
|
|
303
297
|
}
|
|
304
|
-
export function findAncestorKeys(selectedKeys, options) {
|
|
305
|
-
let self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
298
|
+
export function findAncestorKeys(selectedKeys, options, self = true) {
|
|
306
299
|
const res = []; // Recursively find the parent element
|
|
307
300
|
|
|
308
301
|
const findPar = item => {
|
|
@@ -408,11 +401,7 @@ export function calcCheckedKeys(values, keyEntities) {
|
|
|
408
401
|
}
|
|
409
402
|
/* Calculate the expanded node by key */
|
|
410
403
|
|
|
411
|
-
export function calcExpandedKeys() {
|
|
412
|
-
let keyList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
413
|
-
let keyEntities = arguments.length > 1 ? arguments[1] : undefined;
|
|
414
|
-
let autoExpandParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
415
|
-
|
|
404
|
+
export function calcExpandedKeys(keyList = [], keyEntities, autoExpandParent = true) {
|
|
416
405
|
if (!_Array$isArray(keyList)) {
|
|
417
406
|
keyList = [keyList];
|
|
418
407
|
}
|
|
@@ -492,8 +481,7 @@ export function normalizedArr(val) {
|
|
|
492
481
|
return val;
|
|
493
482
|
}
|
|
494
483
|
}
|
|
495
|
-
export function normalizeKeyList(keyList, keyEntities) {
|
|
496
|
-
let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
484
|
+
export function normalizeKeyList(keyList, keyEntities, leafOnly = false) {
|
|
497
485
|
let res = [];
|
|
498
486
|
const keyListSet = new _Set(keyList);
|
|
499
487
|
|
|
@@ -514,7 +502,9 @@ export function normalizeKeyList(keyList, keyEntities) {
|
|
|
514
502
|
res.push(key);
|
|
515
503
|
});
|
|
516
504
|
} else {
|
|
517
|
-
|
|
505
|
+
var _context8;
|
|
506
|
+
|
|
507
|
+
res = _filterInstanceProperty(_context8 = _Array$from(keyList)).call(_context8, key => keyEntities[key] && !isValid(keyEntities[key].children));
|
|
518
508
|
}
|
|
519
509
|
|
|
520
510
|
return res;
|
|
@@ -523,9 +513,9 @@ export function getMotionKeys(eventKey, expandedKeys, keyEntities) {
|
|
|
523
513
|
const res = [];
|
|
524
514
|
|
|
525
515
|
const getChild = itemKey => {
|
|
526
|
-
var
|
|
516
|
+
var _context9;
|
|
527
517
|
|
|
528
|
-
keyEntities[itemKey].children && _forEachInstanceProperty(
|
|
518
|
+
keyEntities[itemKey].children && _forEachInstanceProperty(_context9 = keyEntities[itemKey].children).call(_context9, item => {
|
|
529
519
|
const {
|
|
530
520
|
key
|
|
531
521
|
} = item;
|
|
@@ -641,7 +631,7 @@ export function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfC
|
|
|
641
631
|
};
|
|
642
632
|
}
|
|
643
633
|
export function filterTreeData(info) {
|
|
644
|
-
var
|
|
634
|
+
var _context10, _context11;
|
|
645
635
|
|
|
646
636
|
const {
|
|
647
637
|
showFilteredOnly,
|
|
@@ -653,7 +643,7 @@ export function filterTreeData(info) {
|
|
|
653
643
|
prevExpandedKeys
|
|
654
644
|
} = info;
|
|
655
645
|
let filteredOptsKeys = [];
|
|
656
|
-
filteredOptsKeys = _mapInstanceProperty(
|
|
646
|
+
filteredOptsKeys = _mapInstanceProperty(_context10 = _filterInstanceProperty(_context11 = _Object$values(keyEntities)).call(_context11, item => filter(inputValue, item.data, filterTreeNode, filterProps))).call(_context10, item => item.key);
|
|
657
647
|
let expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
658
648
|
|
|
659
649
|
if (prevExpandedKeys.length) {
|
|
@@ -694,9 +684,9 @@ export function updateKeys(keySet, keyEntities) {
|
|
|
694
684
|
return _filterInstanceProperty(keyArr).call(keyArr, key => key in keyEntities);
|
|
695
685
|
}
|
|
696
686
|
export function calcDisabledKeys(keyEntities) {
|
|
697
|
-
var
|
|
687
|
+
var _context12;
|
|
698
688
|
|
|
699
|
-
const disabledKeys = _filterInstanceProperty(
|
|
689
|
+
const disabledKeys = _filterInstanceProperty(_context12 = _Object$keys(keyEntities)).call(_context12, key => keyEntities[key].data.disabled);
|
|
700
690
|
|
|
701
691
|
const {
|
|
702
692
|
checkedKeys
|
|
@@ -3,16 +3,15 @@ import { BasicTreeInnerData, BasicTreeProps, BasicTreeNodeData, BasicTreeNodePro
|
|
|
3
3
|
import { Motion } from '../utils/type';
|
|
4
4
|
export declare type ValidateStatus = 'error' | 'warning' | 'default';
|
|
5
5
|
export declare type Size = 'small' | 'large' | 'default';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
6
|
+
export declare type BasicRenderSelectedItemInMultiple = (treeNode: BasicTreeNodeData, otherProps: {
|
|
7
|
+
index: number | string;
|
|
8
|
+
onClose: (tagContent: any, e: any) => void;
|
|
9
|
+
}) => {
|
|
10
|
+
isRenderInTag: boolean;
|
|
11
|
+
content: any;
|
|
12
|
+
};
|
|
13
|
+
export declare type BasicRenderSelectedItemInSingle = (treeNode: BasicTreeNodeData) => any;
|
|
14
|
+
export declare type BasicRenderSelectedItem = BasicRenderSelectedItemInSingle | BasicRenderSelectedItemInMultiple;
|
|
16
15
|
export interface BasicTriggerRenderProps {
|
|
17
16
|
[x: string]: any;
|
|
18
17
|
componentProps: BasicTreeSelectProps;
|
|
@@ -93,7 +92,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
93
92
|
setOptionWrapperWidth: (width: null | number) => void;
|
|
94
93
|
notifyChange: BasicOnChangeWithBasic;
|
|
95
94
|
notifyChangeWithObject: BasicOnChangeWithObject;
|
|
96
|
-
notifyExpand: (expandedKeys: Set<string>,
|
|
95
|
+
notifyExpand: (expandedKeys: Set<string>, expandedOtherProps: BasicExpandedOtherProps) => void;
|
|
97
96
|
notifyFocus: (e: any) => void;
|
|
98
97
|
notifyBlur: (e: any) => void;
|
|
99
98
|
toggleHovering: (bool: boolean) => void;
|
|
@@ -71,8 +71,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
71
71
|
return this.getProp('motionExpand');
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
_isDisabled() {
|
|
75
|
-
let treeNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
74
|
+
_isDisabled(treeNode = {}) {
|
|
76
75
|
return this.getProp('disabled') || treeNode.disabled;
|
|
77
76
|
}
|
|
78
77
|
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("custom" | "auto")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
|
@@ -70,15 +70,14 @@ class UploadFoundation extends BaseFoundation {
|
|
|
70
70
|
this.releaseMemory();
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
getError(
|
|
73
|
+
getError({
|
|
74
|
+
action,
|
|
75
|
+
xhr,
|
|
76
|
+
message,
|
|
77
|
+
fileName
|
|
78
|
+
}) {
|
|
74
79
|
var _context, _context2;
|
|
75
80
|
|
|
76
|
-
let {
|
|
77
|
-
action,
|
|
78
|
-
xhr,
|
|
79
|
-
message,
|
|
80
|
-
fileName
|
|
81
|
-
} = _ref;
|
|
82
81
|
const status = xhr ? xhr.status : 0;
|
|
83
82
|
|
|
84
83
|
const msg = message || _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "cannot post ".concat(fileName, " to ")).call(_context2, action, ", xhr status: ")).call(_context, status, "'");
|
|
@@ -642,11 +641,10 @@ class UploadFoundation extends BaseFoundation {
|
|
|
642
641
|
xhr.send(formData);
|
|
643
642
|
}
|
|
644
643
|
|
|
645
|
-
handleProgress(
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
} = _ref2;
|
|
644
|
+
handleProgress({
|
|
645
|
+
e,
|
|
646
|
+
fileInstance
|
|
647
|
+
}) {
|
|
650
648
|
const {
|
|
651
649
|
fileList
|
|
652
650
|
} = this.getStates();
|
|
@@ -678,12 +676,11 @@ class UploadFoundation extends BaseFoundation {
|
|
|
678
676
|
});
|
|
679
677
|
}
|
|
680
678
|
|
|
681
|
-
handleOnLoad(
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
} = _ref3;
|
|
679
|
+
handleOnLoad({
|
|
680
|
+
e,
|
|
681
|
+
xhr,
|
|
682
|
+
fileInstance
|
|
683
|
+
}) {
|
|
687
684
|
const {
|
|
688
685
|
fileList
|
|
689
686
|
} = this.getStates();
|
|
@@ -710,14 +707,13 @@ class UploadFoundation extends BaseFoundation {
|
|
|
710
707
|
}
|
|
711
708
|
}
|
|
712
709
|
|
|
713
|
-
handleSuccess(
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
} = _ref4;
|
|
710
|
+
handleSuccess({
|
|
711
|
+
e,
|
|
712
|
+
fileInstance,
|
|
713
|
+
isCustomRequest = false,
|
|
714
|
+
xhr,
|
|
715
|
+
response
|
|
716
|
+
}) {
|
|
721
717
|
const {
|
|
722
718
|
fileList
|
|
723
719
|
} = this.getStates();
|
|
@@ -820,12 +816,11 @@ class UploadFoundation extends BaseFoundation {
|
|
|
820
816
|
});
|
|
821
817
|
}
|
|
822
818
|
|
|
823
|
-
handleError(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
} = _ref5;
|
|
819
|
+
handleError({
|
|
820
|
+
e,
|
|
821
|
+
xhr,
|
|
822
|
+
fileInstance
|
|
823
|
+
}) {
|
|
829
824
|
const {
|
|
830
825
|
fileList
|
|
831
826
|
} = this.getStates();
|
package/lib/es/utils/Event.js
CHANGED
|
@@ -20,13 +20,10 @@ export default class Event {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
once(event, callback) {
|
|
23
|
-
var _this = this;
|
|
24
|
-
|
|
25
23
|
if (event && typeof callback === 'function') {
|
|
26
|
-
const fn =
|
|
27
|
-
callback(...
|
|
28
|
-
|
|
29
|
-
_this.off(event, fn);
|
|
24
|
+
const fn = (...args) => {
|
|
25
|
+
callback(...args);
|
|
26
|
+
this.off(event, fn);
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
this.on(event, fn);
|
|
@@ -53,13 +50,9 @@ export default class Event {
|
|
|
53
50
|
return this;
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
emit(event) {
|
|
53
|
+
emit(event, ...args) {
|
|
57
54
|
var _context;
|
|
58
55
|
|
|
59
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
60
|
-
args[_key - 1] = arguments[_key];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
56
|
if (!this._eventMap.has(event)) {
|
|
64
57
|
return false;
|
|
65
58
|
}
|
package/lib/es/utils/Logger.js
CHANGED
|
@@ -11,14 +11,8 @@ class Logger {
|
|
|
11
11
|
return value === null || value === undefined || value === '';
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
_baseLog() {
|
|
15
|
-
let method = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'log';
|
|
16
|
-
|
|
14
|
+
_baseLog(method = 'log', ...args) {
|
|
17
15
|
if (typeof console[method] === 'function') {
|
|
18
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
19
|
-
args[_key - 1] = arguments[_key];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
16
|
const messages = [...args];
|
|
23
17
|
|
|
24
18
|
if (!this._isEmpty(this._prefix)) {
|
|
@@ -29,35 +23,19 @@ class Logger {
|
|
|
29
23
|
}
|
|
30
24
|
}
|
|
31
25
|
|
|
32
|
-
log() {
|
|
33
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
34
|
-
args[_key2] = arguments[_key2];
|
|
35
|
-
}
|
|
36
|
-
|
|
26
|
+
log(...args) {
|
|
37
27
|
this._baseLog('log', ...args);
|
|
38
28
|
}
|
|
39
29
|
|
|
40
|
-
warn() {
|
|
41
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
42
|
-
args[_key3] = arguments[_key3];
|
|
43
|
-
}
|
|
44
|
-
|
|
30
|
+
warn(...args) {
|
|
45
31
|
this._baseLog('warn', ...args);
|
|
46
32
|
}
|
|
47
33
|
|
|
48
|
-
error() {
|
|
49
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
50
|
-
args[_key4] = arguments[_key4];
|
|
51
|
-
}
|
|
52
|
-
|
|
34
|
+
error(...args) {
|
|
53
35
|
this._baseLog('error', ...args);
|
|
54
36
|
}
|
|
55
37
|
|
|
56
|
-
info() {
|
|
57
|
-
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
58
|
-
args[_key5] = arguments[_key5];
|
|
59
|
-
}
|
|
60
|
-
|
|
38
|
+
info(...args) {
|
|
61
39
|
this._baseLog('info', ...args);
|
|
62
40
|
}
|
|
63
41
|
|
package/lib/es/utils/array.js
CHANGED
|
@@ -31,9 +31,7 @@ export function pullAll(arrayA, arrayB) {
|
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
export function withOrderSort(fn) {
|
|
35
|
-
let order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ascend';
|
|
36
|
-
|
|
34
|
+
export function withOrderSort(fn, order = 'ascend') {
|
|
37
35
|
switch (order) {
|
|
38
36
|
case 'descend':
|
|
39
37
|
return (a, b) => {
|
|
@@ -4,24 +4,14 @@ import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { split, filter, map } from 'lodash-es';
|
|
6
6
|
|
|
7
|
-
function addClass(rawCls) {
|
|
7
|
+
function addClass(rawCls, ...srcClss) {
|
|
8
8
|
const clss = split(rawCls, /\s+/);
|
|
9
|
-
|
|
10
|
-
for (var _len = arguments.length, srcClss = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11
|
-
srcClss[_key - 1] = arguments[_key];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
9
|
const validClss = filter(srcClss, cls => !_includesInstanceProperty(clss).call(clss, cls));
|
|
15
10
|
return classnames(rawCls, ...validClss);
|
|
16
11
|
}
|
|
17
12
|
|
|
18
|
-
function removeClass(rawCls) {
|
|
13
|
+
function removeClass(rawCls, ...srcClss) {
|
|
19
14
|
const clss = split(rawCls, /\s+/);
|
|
20
|
-
|
|
21
|
-
for (var _len2 = arguments.length, srcClss = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
22
|
-
srcClss[_key2 - 1] = arguments[_key2];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
15
|
map(srcClss, cls => {
|
|
26
16
|
const index = _indexOfInstanceProperty(clss).call(clss, cls);
|
|
27
17
|
|
package/lib/es/utils/dom.js
CHANGED
|
@@ -8,11 +8,7 @@ import isHTMLElement from './isElement';
|
|
|
8
8
|
* @param {HTMLElement}
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export function append(parentNode) {
|
|
12
|
-
for (var _len = arguments.length, nodes = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
13
|
-
nodes[_key - 1] = arguments[_key];
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
export function append(parentNode, ...nodes) {
|
|
16
12
|
for (const node of nodes) {
|
|
17
13
|
parentNode.appendChild(node);
|
|
18
14
|
}
|
|
@@ -27,11 +23,7 @@ export function append(parentNode) {
|
|
|
27
23
|
* @param {HTMLElement}
|
|
28
24
|
*/
|
|
29
25
|
|
|
30
|
-
export function prepend(parentNode) {
|
|
31
|
-
for (var _len2 = arguments.length, nodes = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
32
|
-
nodes[_key2 - 1] = arguments[_key2];
|
|
33
|
-
}
|
|
34
|
-
|
|
26
|
+
export function prepend(parentNode, ...nodes) {
|
|
35
27
|
if (parentNode.children && parentNode.children.length) {
|
|
36
28
|
const firstNode = parentNode.children[0];
|
|
37
29
|
|
|
@@ -13,15 +13,14 @@ const escapeRegExpFn = string => string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
const findChunks =
|
|
16
|
+
const findChunks = ({
|
|
17
|
+
autoEscape,
|
|
18
|
+
caseSensitive,
|
|
19
|
+
searchWords,
|
|
20
|
+
sourceString
|
|
21
|
+
}) => {
|
|
17
22
|
var _context;
|
|
18
23
|
|
|
19
|
-
let {
|
|
20
|
-
autoEscape,
|
|
21
|
-
caseSensitive,
|
|
22
|
-
searchWords,
|
|
23
|
-
sourceString
|
|
24
|
-
} = _ref;
|
|
25
24
|
return _reduceInstanceProperty(_context = _filterInstanceProperty(searchWords).call(searchWords, searchWord => searchWord) // Remove empty words
|
|
26
25
|
).call(_context, (chunks, searchWord) => {
|
|
27
26
|
if (autoEscape) {
|
|
@@ -59,12 +58,11 @@ const findChunks = _ref => {
|
|
|
59
58
|
*/
|
|
60
59
|
|
|
61
60
|
|
|
62
|
-
const combineChunks =
|
|
61
|
+
const combineChunks = ({
|
|
62
|
+
chunks
|
|
63
|
+
}) => {
|
|
63
64
|
var _context2;
|
|
64
65
|
|
|
65
|
-
let {
|
|
66
|
-
chunks
|
|
67
|
-
} = _ref2;
|
|
68
66
|
chunks = _reduceInstanceProperty(_context2 = _sortInstanceProperty(chunks).call(chunks, (first, second) => first.start - second.start)).call(_context2, (processedChunks, nextChunk) => {
|
|
69
67
|
// First chunk just goes straight in the array...
|
|
70
68
|
if (processedChunks.length === 0) {
|
|
@@ -100,11 +98,10 @@ const combineChunks = _ref2 => {
|
|
|
100
98
|
*/
|
|
101
99
|
|
|
102
100
|
|
|
103
|
-
const fillInChunks =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} = _ref3;
|
|
101
|
+
const fillInChunks = ({
|
|
102
|
+
chunksToHighlight,
|
|
103
|
+
totalLength
|
|
104
|
+
}) => {
|
|
108
105
|
const allChunks = [];
|
|
109
106
|
|
|
110
107
|
const append = (start, end, highlight) => {
|
|
@@ -167,14 +164,12 @@ const fillInChunks = _ref3 => {
|
|
|
167
164
|
*/
|
|
168
165
|
|
|
169
166
|
|
|
170
|
-
const findAll =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
} = _ref4;
|
|
177
|
-
|
|
167
|
+
const findAll = ({
|
|
168
|
+
autoEscape,
|
|
169
|
+
caseSensitive = false,
|
|
170
|
+
searchWords,
|
|
171
|
+
sourceString
|
|
172
|
+
}) => {
|
|
178
173
|
if (isString(searchWords)) {
|
|
179
174
|
searchWords = [searchWords];
|
|
180
175
|
}
|