@douyinfe/semi-foundation 2.97.0 → 2.99.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/cascader/foundation.ts +3 -1
- package/codeHighlight/codeHighlight.scss +1 -1
- package/datePicker/foundation.ts +7 -0
- package/datePicker/inputFoundation.ts +5 -0
- package/form/foundation.ts +50 -4
- package/inputNumber/foundation.ts +119 -3
- package/jsonViewer/jsonViewer.scss +2 -2
- package/lib/cjs/aiChatInput/aiChatInput.css +7 -7
- package/lib/cjs/anchor/anchor.css +3 -3
- package/lib/cjs/autoComplete/autoComplete.css +1 -1
- package/lib/cjs/avatar/avatar.css +5 -5
- package/lib/cjs/badge/badge.css +1 -1
- package/lib/cjs/breadcrumb/breadcrumb.css +2 -2
- package/lib/cjs/calendar/calendar.css +9 -9
- package/lib/cjs/cascader/cascader.css +6 -6
- package/lib/cjs/cascader/foundation.js +4 -1
- package/lib/cjs/checkbox/checkbox.css +2 -2
- package/lib/cjs/codeHighlight/codeHighlight.css +1 -1
- package/lib/cjs/codeHighlight/codeHighlight.scss +1 -1
- package/lib/cjs/collapse/collapse.css +2 -2
- package/lib/cjs/datePicker/datePicker.css +8 -8
- package/lib/cjs/datePicker/foundation.d.ts +5 -0
- package/lib/cjs/datePicker/foundation.js +2 -0
- package/lib/cjs/datePicker/inputFoundation.d.ts +5 -0
- package/lib/cjs/descriptions/descriptions.css +6 -6
- package/lib/cjs/dropdown/dropdown.css +2 -2
- package/lib/cjs/form/form.css +4 -4
- package/lib/cjs/form/foundation.js +51 -3
- package/lib/cjs/hotKeys/hotKeys.css +2 -2
- package/lib/cjs/image/image.css +2 -2
- package/lib/cjs/input/input.css +8 -8
- package/lib/cjs/input/textarea.css +2 -2
- package/lib/cjs/inputNumber/foundation.d.ts +15 -0
- package/lib/cjs/inputNumber/foundation.js +113 -3
- package/lib/cjs/jsonViewer/jsonViewer.css +2 -2
- package/lib/cjs/jsonViewer/jsonViewer.scss +2 -2
- package/lib/cjs/list/list.css +1 -1
- package/lib/cjs/modal/modal.css +1 -1
- package/lib/cjs/navigation/navigation.css +2 -2
- package/lib/cjs/notification/notification.css +4 -4
- package/lib/cjs/pagination/pagination.css +5 -5
- package/lib/cjs/popconfirm/popconfirm.css +1 -1
- package/lib/cjs/popover/popover.css +5 -5
- package/lib/cjs/radio/radio.css +2 -2
- package/lib/cjs/scrollList/itemFoundation.js +12 -0
- package/lib/cjs/scrollList/scrollList.css +2 -2
- package/lib/cjs/select/select.css +6 -6
- package/lib/cjs/sideSheet/sideSheet.css +2 -2
- package/lib/cjs/sidebar/sidebar.css +11 -11
- package/lib/cjs/slider/foundation.js +46 -12
- package/lib/cjs/slider/rtl.scss +62 -0
- package/lib/cjs/slider/slider.css +45 -0
- package/lib/cjs/slider/slider.scss +2 -0
- package/lib/cjs/steps/steps.css +11 -11
- package/lib/cjs/table/foundation.d.ts +36 -0
- package/lib/cjs/table/foundation.js +162 -28
- package/lib/cjs/table/rtl.scss +21 -0
- package/lib/cjs/table/table.css +38 -2
- package/lib/cjs/table/table.scss +49 -0
- package/lib/cjs/tabs/tabs.css +2 -2
- package/lib/cjs/tag/tag.css +2 -2
- package/lib/cjs/tagInput/tagInput.css +2 -2
- package/lib/cjs/timePicker/timePicker.css +1 -1
- package/lib/cjs/timeline/timeline.css +2 -2
- package/lib/cjs/toast/toast.css +1 -1
- package/lib/cjs/tooltip/arrow.scss +4 -4
- package/lib/cjs/tooltip/foundation.js +72 -5
- package/lib/cjs/tooltip/tooltip.css +5 -5
- package/lib/cjs/transfer/constants.d.ts +3 -1
- package/lib/cjs/transfer/constants.js +3 -1
- package/lib/cjs/transfer/foundation.d.ts +3 -0
- package/lib/cjs/transfer/foundation.js +4 -0
- package/lib/cjs/transfer/transfer.css +14 -5
- package/lib/cjs/transfer/transfer.scss +10 -0
- package/lib/cjs/tree/foundation.d.ts +3 -0
- package/lib/cjs/tree/foundation.js +31 -4
- package/lib/cjs/tree/tree.css +1 -1
- package/lib/cjs/treeSelect/foundation.d.ts +1 -0
- package/lib/cjs/treeSelect/foundation.js +8 -1
- package/lib/cjs/treeSelect/treeSelect.css +36 -4
- package/lib/cjs/treeSelect/treeSelect.scss +49 -1
- package/lib/cjs/typography/typography.css +8 -8
- package/lib/cjs/upload/upload.css +8 -8
- package/lib/cjs/utils/Store.d.ts +1 -1
- package/lib/cjs/utils/Store.js +1 -0
- package/lib/es/aiChatInput/aiChatInput.css +7 -7
- package/lib/es/anchor/anchor.css +3 -3
- package/lib/es/autoComplete/autoComplete.css +1 -1
- package/lib/es/avatar/avatar.css +5 -5
- package/lib/es/badge/badge.css +1 -1
- package/lib/es/breadcrumb/breadcrumb.css +2 -2
- package/lib/es/calendar/calendar.css +9 -9
- package/lib/es/cascader/cascader.css +6 -6
- package/lib/es/cascader/foundation.js +4 -1
- package/lib/es/checkbox/checkbox.css +2 -2
- package/lib/es/codeHighlight/codeHighlight.css +1 -1
- package/lib/es/codeHighlight/codeHighlight.scss +1 -1
- package/lib/es/collapse/collapse.css +2 -2
- package/lib/es/datePicker/datePicker.css +8 -8
- package/lib/es/datePicker/foundation.d.ts +5 -0
- package/lib/es/datePicker/foundation.js +2 -0
- package/lib/es/datePicker/inputFoundation.d.ts +5 -0
- package/lib/es/descriptions/descriptions.css +6 -6
- package/lib/es/dropdown/dropdown.css +2 -2
- package/lib/es/form/form.css +4 -4
- package/lib/es/form/foundation.js +51 -3
- package/lib/es/hotKeys/hotKeys.css +2 -2
- package/lib/es/image/image.css +2 -2
- package/lib/es/input/input.css +8 -8
- package/lib/es/input/textarea.css +2 -2
- package/lib/es/inputNumber/foundation.d.ts +15 -0
- package/lib/es/inputNumber/foundation.js +113 -3
- package/lib/es/jsonViewer/jsonViewer.css +2 -2
- package/lib/es/jsonViewer/jsonViewer.scss +2 -2
- package/lib/es/list/list.css +1 -1
- package/lib/es/modal/modal.css +1 -1
- package/lib/es/navigation/navigation.css +2 -2
- package/lib/es/notification/notification.css +4 -4
- package/lib/es/pagination/pagination.css +5 -5
- package/lib/es/popconfirm/popconfirm.css +1 -1
- package/lib/es/popover/popover.css +5 -5
- package/lib/es/radio/radio.css +2 -2
- package/lib/es/scrollList/itemFoundation.js +12 -0
- package/lib/es/scrollList/scrollList.css +2 -2
- package/lib/es/select/select.css +6 -6
- package/lib/es/sideSheet/sideSheet.css +2 -2
- package/lib/es/sidebar/sidebar.css +11 -11
- package/lib/es/slider/foundation.js +46 -12
- package/lib/es/slider/rtl.scss +62 -0
- package/lib/es/slider/slider.css +45 -0
- package/lib/es/slider/slider.scss +2 -0
- package/lib/es/steps/steps.css +11 -11
- package/lib/es/table/foundation.d.ts +36 -0
- package/lib/es/table/foundation.js +162 -28
- package/lib/es/table/rtl.scss +21 -0
- package/lib/es/table/table.css +38 -2
- package/lib/es/table/table.scss +49 -0
- package/lib/es/tabs/tabs.css +2 -2
- package/lib/es/tag/tag.css +2 -2
- package/lib/es/tagInput/tagInput.css +2 -2
- package/lib/es/timePicker/timePicker.css +1 -1
- package/lib/es/timeline/timeline.css +2 -2
- package/lib/es/toast/toast.css +1 -1
- package/lib/es/tooltip/arrow.scss +4 -4
- package/lib/es/tooltip/foundation.js +72 -5
- package/lib/es/tooltip/tooltip.css +5 -5
- package/lib/es/transfer/constants.d.ts +3 -1
- package/lib/es/transfer/constants.js +3 -1
- package/lib/es/transfer/foundation.d.ts +3 -0
- package/lib/es/transfer/foundation.js +4 -0
- package/lib/es/transfer/transfer.css +14 -5
- package/lib/es/transfer/transfer.scss +10 -0
- package/lib/es/tree/foundation.d.ts +3 -0
- package/lib/es/tree/foundation.js +31 -4
- package/lib/es/tree/tree.css +1 -1
- package/lib/es/treeSelect/foundation.d.ts +1 -0
- package/lib/es/treeSelect/foundation.js +8 -1
- package/lib/es/treeSelect/treeSelect.css +36 -4
- package/lib/es/treeSelect/treeSelect.scss +49 -1
- package/lib/es/typography/typography.css +8 -8
- package/lib/es/upload/upload.css +8 -8
- package/lib/es/utils/Store.d.ts +1 -1
- package/lib/es/utils/Store.js +1 -0
- package/package.json +19 -4
- package/scrollList/itemFoundation.ts +12 -0
- package/slider/foundation.ts +55 -15
- package/slider/rtl.scss +62 -0
- package/slider/slider.scss +2 -0
- package/table/foundation.ts +197 -29
- package/table/rtl.scss +21 -0
- package/table/table.scss +49 -0
- package/tooltip/arrow.scss +4 -4
- package/tooltip/foundation.ts +86 -5
- package/transfer/constants.ts +3 -1
- package/transfer/foundation.ts +8 -1
- package/transfer/transfer.scss +10 -0
- package/tree/foundation.ts +34 -5
- package/treeSelect/foundation.ts +10 -1
- package/treeSelect/treeSelect.scss +49 -1
- package/utils/Store.ts +2 -1
package/transfer/foundation.ts
CHANGED
|
@@ -40,7 +40,9 @@ export interface TransferAdapter<P = Record<string, any>, S = Record<string, any
|
|
|
40
40
|
notifyDeselect: (items: BasicDataItem) => void;
|
|
41
41
|
updateInput: (input: string) => void;
|
|
42
42
|
updateSearchResult: (searchResult: Set<number | string>) => void;
|
|
43
|
-
searchTree: (keyword: string) => void
|
|
43
|
+
searchTree: (keyword: string) => void;
|
|
44
|
+
updateCurrentPage: (currentPage: number) => void;
|
|
45
|
+
notifyPageChange: (currentPage: number) => void;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export default class TransferFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<TransferAdapter<P, S>> {
|
|
@@ -253,4 +255,9 @@ export default class TransferFoundation<P = Record<string, any>, S = Record<stri
|
|
|
253
255
|
this._notifyChange(newSelectedItems);
|
|
254
256
|
}
|
|
255
257
|
|
|
258
|
+
handlePageChange(currentPage: number) {
|
|
259
|
+
this._adapter.updateCurrentPage(currentPage);
|
|
260
|
+
this._adapter.notifyPageChange(currentPage);
|
|
261
|
+
}
|
|
262
|
+
|
|
256
263
|
}
|
package/transfer/transfer.scss
CHANGED
|
@@ -118,6 +118,16 @@ $module: #{$prefix}-transfer;
|
|
|
118
118
|
flex-grow: 1;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
&-pagination {
|
|
122
|
+
padding-top: $spacing-base-tight;
|
|
123
|
+
padding-bottom: $spacing-base-tight;
|
|
124
|
+
padding-left: $spacing-base-tight;
|
|
125
|
+
padding-right: $spacing-base-tight;
|
|
126
|
+
flex-shrink: 0;
|
|
127
|
+
display: flex;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
}
|
|
130
|
+
|
|
121
131
|
&-empty {
|
|
122
132
|
height: $height-transfer_left_empty;
|
|
123
133
|
}
|
package/tree/foundation.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* https://github.com/react-component/tree
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { isUndefined, difference, pick, get } from 'lodash';
|
|
6
|
+
import { isUndefined, difference, pick, get, throttle } from 'lodash';
|
|
7
7
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
8
8
|
import {
|
|
9
9
|
flattenTreeData,
|
|
@@ -322,11 +322,35 @@ export interface TreeAdapter extends DefaultAdapter<BasicTreeProps, BasicTreeInn
|
|
|
322
322
|
|
|
323
323
|
export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTreeProps, BasicTreeInnerData> {
|
|
324
324
|
delayedDragEnterLogic: any;
|
|
325
|
+
throttledDragOverUpdate: ReturnType<typeof throttle>;
|
|
325
326
|
|
|
326
327
|
constructor(adapter: TreeAdapter) {
|
|
327
328
|
super({
|
|
328
329
|
...adapter,
|
|
329
330
|
});
|
|
331
|
+
// Throttle drag over state updates to improve performance during fast dragging
|
|
332
|
+
// 16ms ≈ 60fps, ensuring smooth updates without excessive re-renders
|
|
333
|
+
this.throttledDragOverUpdate = throttle((dropPosition: number) => {
|
|
334
|
+
this._adapter.updateState({
|
|
335
|
+
dropPosition,
|
|
336
|
+
});
|
|
337
|
+
}, 16);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
destroy() {
|
|
341
|
+
super.destroy();
|
|
342
|
+
// Cancel any pending throttled updates
|
|
343
|
+
if (this.throttledDragOverUpdate) {
|
|
344
|
+
this.throttledDragOverUpdate.cancel();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Clear pending delayed drag enter timers to avoid updates after unmount
|
|
348
|
+
if (this.delayedDragEnterLogic) {
|
|
349
|
+
Object.keys(this.delayedDragEnterLogic).forEach(key => {
|
|
350
|
+
clearTimeout(this.delayedDragEnterLogic[key]);
|
|
351
|
+
});
|
|
352
|
+
this.delayedDragEnterLogic = null;
|
|
353
|
+
}
|
|
330
354
|
}
|
|
331
355
|
|
|
332
356
|
_isMultiple() {
|
|
@@ -863,21 +887,22 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
|
|
|
863
887
|
return;
|
|
864
888
|
}
|
|
865
889
|
|
|
866
|
-
// Update the drag position
|
|
890
|
+
// Update the drag position with throttle to improve performance
|
|
867
891
|
if (dragNode && eventKey === dragOverNodeKey) {
|
|
868
892
|
const newPos = calcDropRelativePosition(e, treeNode);
|
|
869
893
|
if (dropPosition === newPos) {
|
|
870
894
|
return;
|
|
871
895
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
});
|
|
896
|
+
// Use throttled update to reduce re-renders during fast dragging
|
|
897
|
+
this.throttledDragOverUpdate(newPos);
|
|
875
898
|
}
|
|
876
899
|
|
|
877
900
|
this.triggerDragEvent('onDragOver', e, treeNode);
|
|
878
901
|
}
|
|
879
902
|
|
|
880
903
|
handleNodeDragLeave(e: any, treeNode: BasicTreeNodeData) {
|
|
904
|
+
// Cancel pending throttled updates when leaving a node
|
|
905
|
+
this.throttledDragOverUpdate.cancel();
|
|
881
906
|
this._adapter.updateState({
|
|
882
907
|
dragOverNodeKey: '',
|
|
883
908
|
});
|
|
@@ -885,12 +910,16 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
|
|
|
885
910
|
}
|
|
886
911
|
|
|
887
912
|
handleNodeDragEnd(e: any, treeNode: BasicTreeNodeData) {
|
|
913
|
+
// Flush any pending throttled updates before clearing drag state
|
|
914
|
+
this.throttledDragOverUpdate.flush();
|
|
888
915
|
this.clearDragState();
|
|
889
916
|
this.triggerDragEvent('onDragEnd', e, treeNode);
|
|
890
917
|
this._adapter.setDragNode(null);
|
|
891
918
|
}
|
|
892
919
|
|
|
893
920
|
handleNodeDrop(e: any, treeNode: BasicTreeNodeData, dragNode: any) {
|
|
921
|
+
// Flush any pending throttled updates to ensure accurate drop position
|
|
922
|
+
this.throttledDragOverUpdate.flush();
|
|
894
923
|
const { dropPosition, dragNodesKeys } = this.getStates();
|
|
895
924
|
const { eventKey, pos } = treeNode;
|
|
896
925
|
this.clearDragState();
|
package/treeSelect/foundation.ts
CHANGED
|
@@ -119,6 +119,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps,
|
|
|
119
119
|
outerTopSlot?: any;
|
|
120
120
|
placeholder?: string;
|
|
121
121
|
prefix?: any;
|
|
122
|
+
remote?: boolean;
|
|
122
123
|
searchAutoFocus?: boolean;
|
|
123
124
|
searchPlaceholder?: string;
|
|
124
125
|
showSearchClear?: boolean;
|
|
@@ -626,7 +627,15 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
626
627
|
// Input is used as controlled component
|
|
627
628
|
this._adapter.updateInputValue(sugInput);
|
|
628
629
|
const { flattenNodes, expandedKeys, selectedKeys, keyEntities, treeData } = this.getStates();
|
|
629
|
-
const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps } = this.getProps();
|
|
630
|
+
const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps, remote } = this.getProps();
|
|
631
|
+
|
|
632
|
+
// When remote is true, skip local filtering, only update inputValue and trigger onSearch callback
|
|
633
|
+
if (remote) {
|
|
634
|
+
this._adapter.notifySearch(sugInput, [], []);
|
|
635
|
+
this._adapter.rePositionDropdown();
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
|
|
630
639
|
const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : get(keyMaps, 'label', 'label');
|
|
631
640
|
const newExpandedKeys: Set<string> = new Set(expandedKeys);
|
|
632
641
|
let filteredNodes: BasicTreeNodeData[] = [];
|
|
@@ -258,7 +258,6 @@ $module: #{$prefix}-tree-select;
|
|
|
258
258
|
|
|
259
259
|
&-multiple {
|
|
260
260
|
display: inline-flex;
|
|
261
|
-
|
|
262
261
|
.#{$module}-selection {
|
|
263
262
|
padding-left: $spacing-treeSelect_selection_multiple-paddingLeft;
|
|
264
263
|
padding-right: 0;
|
|
@@ -269,6 +268,55 @@ $module: #{$prefix}-tree-select;
|
|
|
269
268
|
}
|
|
270
269
|
}
|
|
271
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Enable wrapping selected tags in trigger.
|
|
273
|
+
* Only takes effect in multiple + searchPosition="trigger" mode (class added by component).
|
|
274
|
+
*/
|
|
275
|
+
&-triggerTagWrap {
|
|
276
|
+
// Prevent trigger from expanding beyond its container
|
|
277
|
+
max-width: 100%;
|
|
278
|
+
|
|
279
|
+
.#{$module}-selection {
|
|
280
|
+
// Allow selection area to shrink so inner TagInput can wrap
|
|
281
|
+
min-width: 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
&.#{$module}-multiple {
|
|
285
|
+
// multiple tags may wrap to multiple lines
|
|
286
|
+
height: auto;
|
|
287
|
+
|
|
288
|
+
.#{$module}-selection {
|
|
289
|
+
// allow height to grow when wrapping
|
|
290
|
+
height: auto;
|
|
291
|
+
min-height: $height-treeSelect_default - 2 * $width-treeSelect-border;
|
|
292
|
+
overflow: visible;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
&.#{$module}-small {
|
|
296
|
+
.#{$module}-selection {
|
|
297
|
+
min-height: $height-treeSelect_small - 2 * $width-treeSelect-border;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&.#{$module}-large {
|
|
302
|
+
.#{$module}-selection {
|
|
303
|
+
min-height: $height-treeSelect_large - 2 * $width-treeSelect-border;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Make TagInput shrinkable as a flex item, and constrain measured input width
|
|
309
|
+
.#{$prefix}-tagInput {
|
|
310
|
+
min-width: 0;
|
|
311
|
+
max-width: 100%;
|
|
312
|
+
flex: 1 1 auto;
|
|
313
|
+
|
|
314
|
+
.#{$prefix}-tagInput-wrapper-input {
|
|
315
|
+
max-width: 100%;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
272
320
|
&-small {
|
|
273
321
|
min-height: $height-treeSelect_small;
|
|
274
322
|
line-height: $font-treeSelect_small-lineHeight;
|
package/utils/Store.ts
CHANGED
|
@@ -7,7 +7,8 @@ class Store<T = Record<string, any>> {
|
|
|
7
7
|
this._listeners = [];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// Listener return value is ignored, but keep type compatible with older signature
|
|
11
|
+
subscribe(listener: (state: T) => void | (() => void)) {
|
|
11
12
|
this._listeners.push(listener);
|
|
12
13
|
const unsubscribe = () => {
|
|
13
14
|
const index = this._listeners.indexOf(listener);
|