@fibrae/semi-foundation 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anchor/foundation.d.ts +1 -1
- package/dist/anchor/foundation.js +21 -21
- package/dist/audio-player/foundation.d.ts +10 -10
- package/dist/audio-player/foundation.js +19 -19
- package/dist/auto-complete/foundation.d.ts +12 -12
- package/dist/auto-complete/foundation.js +51 -51
- package/dist/avatar/foundation.d.ts +5 -5
- package/dist/avatar/foundation.js +16 -16
- package/dist/backtop/foundation.d.ts +2 -2
- package/dist/backtop/foundation.js +7 -7
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -8
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -3
- package/dist/base/foundation.js +12 -11
- package/dist/breadcrumb/foundation.d.ts +5 -5
- package/dist/breadcrumb/foundation.js +9 -10
- package/dist/breadcrumb/item-foundation.d.ts +3 -3
- package/dist/breadcrumb/item-foundation.js +6 -6
- package/dist/calendar/event-util.js +1 -1
- package/dist/calendar/foundation.js +4 -4
- package/dist/calendar/month-foundation.d.ts +2 -2
- package/dist/calendar/month-foundation.js +6 -6
- package/dist/carousel/foundation.d.ts +17 -17
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +34 -26
- package/dist/cascader/foundation.js +143 -121
- package/dist/checkbox/checkbox-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-foundation.js +15 -15
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -1
- package/dist/code-highlight/index.js +3 -3
- package/dist/collapse/foundation.d.ts +2 -2
- package/dist/collapse/foundation.js +7 -7
- package/dist/collapsible/foundation.d.ts +3 -3
- package/dist/collapsible/foundation.js +8 -8
- package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
- package/dist/color-picker/alpha-slider-foundation.js +10 -10
- package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
- package/dist/color-picker/color-choose-area-foundation.js +14 -14
- package/dist/color-picker/color-slider-foundation.d.ts +2 -4
- package/dist/color-picker/color-slider-foundation.js +10 -10
- package/dist/color-picker/data-part-foundation.d.ts +5 -5
- package/dist/color-picker/data-part-foundation.js +11 -11
- package/dist/color-picker/foundation.d.ts +4 -4
- package/dist/color-picker/foundation.js +10 -10
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/cropper/foundation.d.ts +15 -15
- package/dist/cropper/foundation.js +26 -23
- package/dist/date-picker/_utils/picker-type.d.ts +1 -1
- package/dist/date-picker/foundation.d.ts +36 -36
- package/dist/date-picker/foundation.js +125 -129
- package/dist/date-picker/input-foundation.d.ts +9 -9
- package/dist/date-picker/input-foundation.js +28 -28
- package/dist/date-picker/months-grid-foundation.d.ts +16 -16
- package/dist/date-picker/months-grid-foundation.js +64 -65
- package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
- package/dist/date-picker/year-and-month-foundation.js +11 -11
- package/dist/drag-move/foundation.d.ts +2 -2
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -5
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -1
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -9
- package/dist/feedback/foundation.js +33 -33
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -61
- package/dist/highlight/foundation.js +1 -1
- package/dist/hot-keys/foundation.d.ts +2 -2
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -4
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -3
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -8
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -9
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -10
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -3
- package/dist/input/text-entry-foundation.js +14 -14
- package/dist/input/textarea-foundation.d.ts +7 -7
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/foundation.d.ts +16 -14
- package/dist/input-number/foundation.js +54 -53
- package/dist/json-viewer/foundation.d.ts +8 -8
- package/dist/json-viewer/foundation.js +23 -23
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +1 -1
- package/dist/markdown-render/foundation.js +4 -4
- package/dist/modal/modal-content-foundation.d.ts +7 -7
- package/dist/modal/modal-content-foundation.js +20 -20
- package/dist/modal/modal-foundation.d.ts +6 -6
- package/dist/modal/modal-foundation.js +24 -24
- package/dist/navigation/foundation.d.ts +1 -1
- package/dist/navigation/foundation.js +14 -14
- package/dist/navigation/item-foundation.d.ts +1 -1
- package/dist/navigation/item-foundation.js +8 -8
- package/dist/navigation/sub-nav-foundation.d.ts +3 -3
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -7
- package/dist/notification/notification-list-foundation.js +12 -12
- package/dist/overflow-list/foundation.d.ts +4 -4
- package/dist/overflow-list/foundation.js +18 -18
- package/dist/pagination/foundation.d.ts +8 -8
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +5 -5
- package/dist/pincode/foundation.js +22 -22
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -7
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/radio/radio-foundation.d.ts +5 -5
- package/dist/radio/radio-foundation.js +15 -15
- package/dist/radio/radio-group-foundation.d.ts +2 -2
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -10
- package/dist/rating/foundation.js +35 -35
- package/dist/resizable/group/index.d.ts +6 -6
- package/dist/resizable/group/index.js +40 -40
- package/dist/resizable/single/index.d.ts +2 -2
- package/dist/resizable/single/index.js +9 -9
- package/dist/scroll-list/item-foundation.d.ts +7 -7
- package/dist/scroll-list/item-foundation.js +35 -35
- package/dist/select/foundation.d.ts +42 -56
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -27
- package/dist/select/option-foundation.js +10 -18
- package/dist/side-sheet/side-sheet-foundation.d.ts +6 -6
- package/dist/side-sheet/side-sheet-foundation.js +22 -22
- package/dist/slider/foundation.d.ts +16 -16
- package/dist/slider/foundation.js +46 -46
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -2
- package/dist/spin/foundation.js +6 -6
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -2
- package/dist/switch/foundation.js +7 -7
- package/dist/table/foundation.d.ts +14 -14
- package/dist/table/foundation.js +93 -93
- package/dist/table/utils.d.ts +2 -2
- package/dist/tabs/foundation.d.ts +5 -5
- package/dist/tabs/foundation.js +17 -17
- package/dist/tag-input/foundation.d.ts +11 -11
- package/dist/tag-input/foundation.js +52 -52
- package/dist/time-picker/foundation.d.ts +13 -13
- package/dist/time-picker/foundation.js +39 -39
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/foundation.d.ts +9 -9
- package/dist/tooltip/foundation.js +67 -61
- package/dist/transfer/foundation.d.ts +22 -9
- package/dist/transfer/foundation.js +38 -23
- package/dist/tree/foundation.d.ts +14 -14
- package/dist/tree/foundation.js +61 -61
- package/dist/tree/shared.d.ts +1 -1
- package/dist/tree-select/foundation.d.ts +26 -20
- package/dist/tree-select/foundation.js +91 -83
- package/dist/typography/ellipsis.d.ts +4 -4
- package/dist/typography/ellipsis.js +8 -8
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -17
- package/dist/upload/foundation.js +92 -92
- package/dist/upload/utils.d.ts +3 -3
- package/dist/upload/utils.js +6 -6
- package/dist/user-guide/foundation.d.ts +3 -3
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +1 -1
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/focus-handle.d.ts +1 -1
- package/dist/utils/focus-handle.js +1 -2
- package/dist/utils/focus-scope.d.ts +5 -5
- package/dist/utils/focus-scope.js +10 -10
- package/dist/utils/is-promise.d.ts +1 -1
- package/dist/utils/release-holder.d.ts +2 -2
- package/dist/utils/release-holder.js +4 -4
- package/dist/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -2
- package/dist/video-player/progress-foundation.js +12 -12
- package/package.json +2 -2
|
@@ -46,5 +46,5 @@ export default class MarkdownRenderFoundation<P extends MarkdownRenderBaseProps
|
|
|
46
46
|
* Compiles the current source and stores the result as `renderContent`. A failed compile keeps the last
|
|
47
47
|
* content and goes to `notifyCompileError`.
|
|
48
48
|
*/
|
|
49
|
-
updateContent()
|
|
49
|
+
updateContent: () => Promise<void>;
|
|
50
50
|
}
|
|
@@ -33,7 +33,7 @@ var MarkdownRenderFoundation = class MarkdownRenderFoundation extends BaseFounda
|
|
|
33
33
|
rehypePlugins: this.getProp("rehypePlugins"),
|
|
34
34
|
remarkGfm: this.getProp("remarkGfm")
|
|
35
35
|
};
|
|
36
|
-
const runtime = this.
|
|
36
|
+
const runtime = this.adapter.getRuntime();
|
|
37
37
|
if (props.format === "md") {
|
|
38
38
|
const processor = MarkdownRenderFoundation.#createMdProcessor(props);
|
|
39
39
|
const tree = await processor.run(processor.parse(raw), raw);
|
|
@@ -88,14 +88,14 @@ var MarkdownRenderFoundation = class MarkdownRenderFoundation extends BaseFounda
|
|
|
88
88
|
* Compiles the current source and stores the result as `renderContent`. A failed compile keeps the last
|
|
89
89
|
* content and goes to `notifyCompileError`.
|
|
90
90
|
*/
|
|
91
|
-
async
|
|
91
|
+
updateContent = async () => {
|
|
92
92
|
const requestId = ++this.#requestId;
|
|
93
93
|
try {
|
|
94
94
|
const renderContent = await this.evaluate(this.getProp("raw"));
|
|
95
95
|
if (requestId === this.#requestId) this.setState({ renderContent });
|
|
96
96
|
} catch (error) {
|
|
97
|
-
if (requestId === this.#requestId) this.
|
|
97
|
+
if (requestId === this.#requestId) this.adapter.notifyCompileError(error);
|
|
98
98
|
}
|
|
99
|
-
}
|
|
99
|
+
};
|
|
100
100
|
};
|
|
101
101
|
export { MarkdownRenderFoundation as default };
|
|
@@ -26,15 +26,15 @@ export interface ModalContentAdapter<P extends ModalContentProps = ModalContentP
|
|
|
26
26
|
export default class ModalContentFoundation<P extends ModalContentProps = ModalContentProps, E extends Pick<Event, 'target' | 'currentTarget'> = Pick<Event, 'target' | 'currentTarget'>> extends BaseFoundation<ModalContentAdapter<P, E>, P> {
|
|
27
27
|
#private;
|
|
28
28
|
/** Called when the dialog is shown: joins the overlay stack and moves focus into the dialog */
|
|
29
|
-
show()
|
|
29
|
+
show: () => void;
|
|
30
30
|
/**
|
|
31
31
|
* The reverse of `show`. The layer goes first: it releases the page's inert, and an inert element cannot take
|
|
32
32
|
* the focus back.
|
|
33
33
|
*/
|
|
34
|
-
hide()
|
|
35
|
-
handleDialogMouseDown()
|
|
36
|
-
handleMaskMouseUp()
|
|
37
|
-
handleMaskClick(e: E)
|
|
38
|
-
close(e: E | KeyboardEvent)
|
|
39
|
-
restoreFocus()
|
|
34
|
+
hide: () => void;
|
|
35
|
+
handleDialogMouseDown: () => void;
|
|
36
|
+
handleMaskMouseUp: () => void;
|
|
37
|
+
handleMaskClick: (e: E) => void;
|
|
38
|
+
close: (e: E | KeyboardEvent) => void;
|
|
39
|
+
restoreFocus: () => void;
|
|
40
40
|
}
|
|
@@ -12,37 +12,37 @@ var ModalContentFoundation = class extends BaseFoundation {
|
|
|
12
12
|
return true;
|
|
13
13
|
};
|
|
14
14
|
/** Called when the dialog is shown: joins the overlay stack and moves focus into the dialog */
|
|
15
|
-
show() {
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
}
|
|
15
|
+
show = () => {
|
|
16
|
+
this.adapter.openLayer(this.#handleEscape);
|
|
17
|
+
this.adapter.trapFocus();
|
|
18
|
+
};
|
|
19
19
|
/**
|
|
20
20
|
* The reverse of `show`. The layer goes first: it releases the page's inert, and an inert element cannot take
|
|
21
21
|
* the focus back.
|
|
22
22
|
*/
|
|
23
|
-
hide() {
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
23
|
+
hide = () => {
|
|
24
|
+
this.adapter.closeLayer();
|
|
25
|
+
this.adapter.releaseFocus();
|
|
26
26
|
clearTimeout(this.#mouseUpTimer);
|
|
27
27
|
this.#dialogMouseDown = false;
|
|
28
28
|
this.restoreFocus();
|
|
29
|
-
}
|
|
30
|
-
handleDialogMouseDown() {
|
|
29
|
+
};
|
|
30
|
+
handleDialogMouseDown = () => {
|
|
31
31
|
this.#dialogMouseDown = true;
|
|
32
|
-
}
|
|
33
|
-
handleMaskMouseUp() {
|
|
32
|
+
};
|
|
33
|
+
handleMaskMouseUp = () => {
|
|
34
34
|
if (this.#dialogMouseDown) this.#mouseUpTimer = setTimeout(() => {
|
|
35
35
|
this.#dialogMouseDown = false;
|
|
36
36
|
}, 0);
|
|
37
|
-
}
|
|
38
|
-
handleMaskClick(e) {
|
|
37
|
+
};
|
|
38
|
+
handleMaskClick = (e) => {
|
|
39
39
|
if (e.target === e.currentTarget && !this.#dialogMouseDown) this.close(e);
|
|
40
|
-
}
|
|
41
|
-
close(e) {
|
|
42
|
-
this.
|
|
43
|
-
}
|
|
44
|
-
restoreFocus() {
|
|
45
|
-
this.
|
|
46
|
-
}
|
|
40
|
+
};
|
|
41
|
+
close = (e) => {
|
|
42
|
+
this.adapter.notifyClose(e);
|
|
43
|
+
};
|
|
44
|
+
restoreFocus = () => {
|
|
45
|
+
this.adapter.restoreFocus();
|
|
46
|
+
};
|
|
47
47
|
};
|
|
48
48
|
export { ModalContentFoundation as default, isModal };
|
|
@@ -76,10 +76,10 @@ export default class ModalFoundation<P extends ModalProps = ModalProps, S extend
|
|
|
76
76
|
};
|
|
77
77
|
}): 'ok' | 'cancel' | undefined;
|
|
78
78
|
destroy(): void;
|
|
79
|
-
handleCancel(e: CE)
|
|
80
|
-
handleOk(e: OE)
|
|
81
|
-
beforeShow()
|
|
82
|
-
afterHide()
|
|
83
|
-
afterClose()
|
|
84
|
-
toggleDisplayNone(displayNone: boolean)
|
|
79
|
+
handleCancel: (e: CE) => void;
|
|
80
|
+
handleOk: (e: OE) => void;
|
|
81
|
+
beforeShow: () => void;
|
|
82
|
+
afterHide: () => void;
|
|
83
|
+
afterClose: () => void;
|
|
84
|
+
toggleDisplayNone: (displayNone: boolean) => void;
|
|
85
85
|
}
|
|
@@ -12,25 +12,25 @@ var ModalFoundation = class extends BaseFoundation {
|
|
|
12
12
|
this.#invokeCancel(e);
|
|
13
13
|
}, 100, { edges: ["leading"] });
|
|
14
14
|
#invokeCancel(e) {
|
|
15
|
-
const result = this.
|
|
15
|
+
const result = this.adapter.notifyCancel(e);
|
|
16
16
|
if (isPromise(result)) {
|
|
17
|
-
this.
|
|
17
|
+
this.adapter.setState({ onCancelReturnPromiseStatus: "pending" });
|
|
18
18
|
result?.then(() => {
|
|
19
|
-
this.
|
|
19
|
+
this.adapter.setState({ onCancelReturnPromiseStatus: "fulfilled" });
|
|
20
20
|
})?.catch((e) => {
|
|
21
|
-
this.
|
|
21
|
+
this.adapter.setState({ onCancelReturnPromiseStatus: "rejected" });
|
|
22
22
|
throw e;
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
#invokeOk(e) {
|
|
27
|
-
const result = this.
|
|
27
|
+
const result = this.adapter.notifyOk(e);
|
|
28
28
|
if (isPromise(result)) {
|
|
29
|
-
this.
|
|
29
|
+
this.adapter.setState({ onOKReturnPromiseStatus: "pending" });
|
|
30
30
|
result?.then(() => {
|
|
31
|
-
this.
|
|
31
|
+
this.adapter.setState({ onOKReturnPromiseStatus: "fulfilled" });
|
|
32
32
|
})?.catch((e) => {
|
|
33
|
-
this.
|
|
33
|
+
this.adapter.setState({ onOKReturnPromiseStatus: "rejected" });
|
|
34
34
|
throw e;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -45,30 +45,30 @@ var ModalFoundation = class extends BaseFoundation {
|
|
|
45
45
|
this.#debouncedOk.cancel();
|
|
46
46
|
this.#debouncedCancel.cancel();
|
|
47
47
|
}
|
|
48
|
-
handleCancel(e) {
|
|
48
|
+
handleCancel = (e) => {
|
|
49
49
|
if (!this.getProp("visible")) return;
|
|
50
50
|
const target = e?.currentTarget ?? e?.target ?? null;
|
|
51
51
|
if (target !== this.#lastCancelTarget) this.#debouncedCancel.cancel();
|
|
52
52
|
this.#lastCancelTarget = target;
|
|
53
53
|
this.#debouncedCancel(e);
|
|
54
|
-
}
|
|
55
|
-
handleOk(e) {
|
|
54
|
+
};
|
|
55
|
+
handleOk = (e) => {
|
|
56
56
|
const target = e?.currentTarget ?? e?.target ?? null;
|
|
57
57
|
if (target !== this.#lastOkTarget) this.#debouncedOk.cancel();
|
|
58
58
|
this.#lastOkTarget = target;
|
|
59
59
|
this.#debouncedOk(e);
|
|
60
|
-
}
|
|
61
|
-
beforeShow() {
|
|
62
|
-
this.
|
|
63
|
-
}
|
|
64
|
-
afterHide() {
|
|
65
|
-
this.
|
|
66
|
-
}
|
|
67
|
-
afterClose() {
|
|
68
|
-
this.
|
|
69
|
-
}
|
|
70
|
-
toggleDisplayNone(displayNone) {
|
|
71
|
-
this.
|
|
72
|
-
}
|
|
60
|
+
};
|
|
61
|
+
beforeShow = () => {
|
|
62
|
+
this.adapter.disabledBodyScroll();
|
|
63
|
+
};
|
|
64
|
+
afterHide = () => {
|
|
65
|
+
this.adapter.enabledBodyScroll();
|
|
66
|
+
};
|
|
67
|
+
afterClose = () => {
|
|
68
|
+
this.adapter.notifyClose();
|
|
69
|
+
};
|
|
70
|
+
toggleDisplayNone = (displayNone) => {
|
|
71
|
+
this.adapter.toggleDisplayNone(displayNone);
|
|
72
|
+
};
|
|
73
73
|
};
|
|
74
74
|
export { ModalFoundation as default };
|
|
@@ -64,7 +64,7 @@ export default class NavigationFoundation<P extends NavigationBaseProps = Naviga
|
|
|
64
64
|
* New items or children rebuild the menu from the props, otherwise a changed (deep compared) selectedKeys or
|
|
65
65
|
* openKeys is copied into state
|
|
66
66
|
*/
|
|
67
|
-
handlePropsUpdate(prevProps: NavigationBaseProps)
|
|
67
|
+
handlePropsUpdate: (prevProps: NavigationBaseProps) => void;
|
|
68
68
|
/**
|
|
69
69
|
* Selects keys together with their top level parents
|
|
70
70
|
*/
|
|
@@ -4,7 +4,7 @@ import { isEqual } from "es-toolkit";
|
|
|
4
4
|
// src/navigation/foundation.ts
|
|
5
5
|
var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
|
|
6
6
|
#getItemKeysMap() {
|
|
7
|
-
return NavigationFoundation.getFormattedItems(this.getProps(), this.
|
|
7
|
+
return NavigationFoundation.getFormattedItems(this.getProps(), this.adapter.getItemsFromChildren()).itemKeysMap;
|
|
8
8
|
}
|
|
9
9
|
#rebuild() {
|
|
10
10
|
const props = this.getProps();
|
|
@@ -12,8 +12,8 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
|
|
|
12
12
|
const willOpenKeys = NavigationFoundation.getWillOpenKeys(props, this.getState("openKeys"), itemKeysMap);
|
|
13
13
|
const willSelectedKeys = props.selectedKeys || props.defaultSelectedKeys || [];
|
|
14
14
|
const selectedKeys = willSelectedKeys.concat(NavigationFoundation.getZeroParentKeys(itemKeysMap, ...willSelectedKeys));
|
|
15
|
-
if (!isEqual(selectedKeys, this.getState("selectedKeys"))) this.
|
|
16
|
-
if (!isEqual(willOpenKeys, this.getState("openKeys"))) this.
|
|
15
|
+
if (!isEqual(selectedKeys, this.getState("selectedKeys"))) this.adapter.updateSelectedKeys(selectedKeys);
|
|
16
|
+
if (!isEqual(willOpenKeys, this.getState("openKeys"))) this.adapter.updateOpenKeys(willOpenKeys);
|
|
17
17
|
}
|
|
18
18
|
static getZeroParentKeys(itemKeysMap = {}, ...itemKeys) {
|
|
19
19
|
const willAddKeys = [];
|
|
@@ -119,7 +119,7 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
|
|
|
119
119
|
* New items or children rebuild the menu from the props, otherwise a changed (deep compared) selectedKeys or
|
|
120
120
|
* openKeys is copied into state
|
|
121
121
|
*/
|
|
122
|
-
handlePropsUpdate(prevProps) {
|
|
122
|
+
handlePropsUpdate = (prevProps) => {
|
|
123
123
|
const props = this.getProps();
|
|
124
124
|
if (prevProps.items !== props.items || prevProps.children !== props.children) {
|
|
125
125
|
this.#rebuild();
|
|
@@ -127,32 +127,32 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
|
|
|
127
127
|
}
|
|
128
128
|
if (props.selectedKeys && !isEqual(prevProps.selectedKeys, props.selectedKeys)) {
|
|
129
129
|
this.updateSelectedKeys(props.selectedKeys);
|
|
130
|
-
this.
|
|
131
|
-
} else if (prevProps.selectedKeys !== void 0 && props.selectedKeys === void 0) this.
|
|
132
|
-
if (props.openKeys && !isEqual(prevProps.openKeys, props.openKeys)) this.
|
|
133
|
-
else if (prevProps.openKeys !== void 0 && props.openKeys === void 0) this.
|
|
134
|
-
}
|
|
130
|
+
this.adapter.updateOpenKeys(NavigationFoundation.getWillOpenKeys(props, this.getState("openKeys"), this.#getItemKeysMap()));
|
|
131
|
+
} else if (prevProps.selectedKeys !== void 0 && props.selectedKeys === void 0) this.adapter.updateSelectedKeys([]);
|
|
132
|
+
if (props.openKeys && !isEqual(prevProps.openKeys, props.openKeys)) this.adapter.updateOpenKeys(props.openKeys);
|
|
133
|
+
else if (prevProps.openKeys !== void 0 && props.openKeys === void 0) this.adapter.updateOpenKeys(NavigationFoundation.getWillOpenKeys(props, [], this.#getItemKeysMap()));
|
|
134
|
+
};
|
|
135
135
|
/**
|
|
136
136
|
* Selects keys together with their top level parents
|
|
137
137
|
*/
|
|
138
138
|
updateSelectedKeys = (keys) => {
|
|
139
139
|
const parentKeys = NavigationFoundation.getZeroParentKeys(this.#getItemKeysMap(), ...keys);
|
|
140
|
-
this.
|
|
140
|
+
this.adapter.updateSelectedKeys(Array.from(new Set(keys.concat(parentKeys))));
|
|
141
141
|
};
|
|
142
142
|
addOpenKey = (itemKey) => {
|
|
143
143
|
const openKeys = new Set(this.getState("openKeys"));
|
|
144
144
|
if (itemKey != null) openKeys.add(itemKey);
|
|
145
|
-
this.
|
|
145
|
+
this.adapter.updateOpenKeys(Array.from(openKeys));
|
|
146
146
|
};
|
|
147
147
|
removeOpenKey = (itemKey) => {
|
|
148
148
|
const openKeys = new Set(this.getState("openKeys"));
|
|
149
149
|
if (itemKey != null) openKeys.delete(itemKey);
|
|
150
|
-
this.
|
|
150
|
+
this.adapter.updateOpenKeys(Array.from(openKeys));
|
|
151
151
|
};
|
|
152
152
|
handleCollapseChange = () => {
|
|
153
153
|
const isCollapsed = !NavigationFoundation.getIsCollapsed(this.getProps(), this.getStates());
|
|
154
|
-
if (!this.
|
|
155
|
-
this.
|
|
154
|
+
if (!this.isControlledComponent("isCollapsed")) this.adapter.setIsCollapsed(isCollapsed);
|
|
155
|
+
this.adapter.notifyCollapseChange(isCollapsed);
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
158
|
export { NavigationFoundation as default };
|
|
@@ -40,5 +40,5 @@ export declare function countPlaceholderIcons({ mode, limitIndent, isCollapsed,
|
|
|
40
40
|
}): number;
|
|
41
41
|
export default class ItemFoundation<P extends ItemProps = ItemProps, S extends object = object> extends BaseFoundation<ItemAdapter<P, S>, P, S> {
|
|
42
42
|
protected isValidKey(itemKey: string): boolean;
|
|
43
|
-
handleClick(e: MouseEvent | KeyboardEvent)
|
|
43
|
+
handleClick: (e: MouseEvent | KeyboardEvent) => void;
|
|
44
44
|
}
|
|
@@ -10,33 +10,33 @@ var ItemFoundation = class extends BaseFoundation {
|
|
|
10
10
|
isValidKey(itemKey) {
|
|
11
11
|
return itemKey != null && (typeof itemKey === "string" || typeof itemKey === "number");
|
|
12
12
|
}
|
|
13
|
-
handleClick(e) {
|
|
13
|
+
handleClick = (e) => {
|
|
14
14
|
const { isSubNav, itemKey, text, disabled } = this.getProps();
|
|
15
15
|
if (disabled) return;
|
|
16
|
-
const wasSelected = this.
|
|
17
|
-
if (!isSubNav && this.isValidKey(itemKey) && !this.
|
|
16
|
+
const wasSelected = this.adapter.getSelected();
|
|
17
|
+
if (!isSubNav && this.isValidKey(itemKey) && !this.adapter.getSelectedKeysIsControlled() && !wasSelected) this.adapter.selectSelf();
|
|
18
18
|
const selectedKeys = [itemKey];
|
|
19
19
|
if (!isSubNav) {
|
|
20
20
|
if (!wasSelected) {
|
|
21
|
-
const selectedItems = [this.
|
|
22
|
-
this.
|
|
21
|
+
const selectedItems = [this.adapter.cloneDeep(this.getProps())];
|
|
22
|
+
this.adapter.notifyGlobalOnSelect({
|
|
23
23
|
itemKey,
|
|
24
24
|
selectedKeys,
|
|
25
25
|
selectedItems,
|
|
26
26
|
domEvent: e
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
this.
|
|
29
|
+
this.adapter.notifyGlobalOnClick({
|
|
30
30
|
itemKey,
|
|
31
31
|
text,
|
|
32
32
|
domEvent: e
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
this.
|
|
35
|
+
this.adapter.notifyClick({
|
|
36
36
|
itemKey,
|
|
37
37
|
text,
|
|
38
38
|
domEvent: e
|
|
39
39
|
});
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
};
|
|
42
42
|
export { countPlaceholderIcons, ItemFoundation as default };
|
|
@@ -21,11 +21,11 @@ export interface SubNavBaseProps {
|
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
}
|
|
23
23
|
export default class SubNavFoundation<P extends SubNavBaseProps = SubNavBaseProps, S extends object = object> extends BaseFoundation<SubNavAdapter<P, S>, P, S> {
|
|
24
|
-
handleDropdownVisibleChange(visible: boolean)
|
|
25
|
-
handleClick(e: MouseEvent | KeyboardEvent)
|
|
24
|
+
handleDropdownVisibleChange: (visible: boolean) => void;
|
|
25
|
+
handleClick: (e: MouseEvent | KeyboardEvent) => void;
|
|
26
26
|
/**
|
|
27
27
|
* Only reports the click: the Dropdown owns the open state and reports it through handleDropdownVisibleChange,
|
|
28
28
|
* so toggling here would emit a second, possibly contradictory openChange.
|
|
29
29
|
*/
|
|
30
|
-
handlePopupClick(e: MouseEvent | KeyboardEvent)
|
|
30
|
+
handlePopupClick: (e: MouseEvent | KeyboardEvent) => void;
|
|
31
31
|
}
|
|
@@ -11,44 +11,44 @@ function removeKeys(originKeys = [], ...willRemoveKeys) {
|
|
|
11
11
|
return Array.from(keySet);
|
|
12
12
|
}
|
|
13
13
|
var SubNavFoundation = class extends BaseFoundation {
|
|
14
|
-
handleDropdownVisibleChange(visible) {
|
|
14
|
+
handleDropdownVisibleChange = (visible) => {
|
|
15
15
|
const itemKey = this.getProp("itemKey");
|
|
16
|
-
const rawOpenKeys = this.
|
|
16
|
+
const rawOpenKeys = this.adapter.getOpenKeys();
|
|
17
17
|
const openKeys = visible ? addKeys(rawOpenKeys, itemKey) : removeKeys(rawOpenKeys, itemKey);
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
18
|
+
this.adapter.updateOpen(visible);
|
|
19
|
+
this.adapter.notifyGlobalOpenChange({
|
|
20
20
|
itemKey,
|
|
21
21
|
openKeys,
|
|
22
22
|
isOpen: visible
|
|
23
23
|
});
|
|
24
|
-
}
|
|
25
|
-
handleClick(e) {
|
|
24
|
+
};
|
|
25
|
+
handleClick = (e) => {
|
|
26
26
|
const { itemKey, disabled } = this.getProps();
|
|
27
27
|
if (disabled) return;
|
|
28
|
-
const isOpen = !this.
|
|
28
|
+
const isOpen = !this.adapter.getIsOpen();
|
|
29
29
|
const cbVal = {
|
|
30
30
|
itemKey,
|
|
31
|
-
openKeys: isOpen ? addKeys(this.
|
|
31
|
+
openKeys: isOpen ? addKeys(this.adapter.getOpenKeys(), itemKey) : removeKeys(this.adapter.getOpenKeys(), itemKey),
|
|
32
32
|
isOpen,
|
|
33
33
|
domEvent: e
|
|
34
34
|
};
|
|
35
|
-
if (!this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
}
|
|
35
|
+
if (!this.adapter.getOpenKeysIsControlled()) this.adapter.updateOpen(isOpen);
|
|
36
|
+
this.adapter.notifyGlobalOpenChange(cbVal);
|
|
37
|
+
this.adapter.notifyGlobalOnClick(cbVal);
|
|
38
|
+
};
|
|
39
39
|
/**
|
|
40
40
|
* Only reports the click: the Dropdown owns the open state and reports it through handleDropdownVisibleChange,
|
|
41
41
|
* so toggling here would emit a second, possibly contradictory openChange.
|
|
42
42
|
*/
|
|
43
|
-
handlePopupClick(e) {
|
|
43
|
+
handlePopupClick = (e) => {
|
|
44
44
|
const { itemKey, disabled } = this.getProps();
|
|
45
45
|
if (disabled) return;
|
|
46
|
-
this.
|
|
46
|
+
this.adapter.notifyGlobalOnClick({
|
|
47
47
|
itemKey,
|
|
48
|
-
openKeys: this.
|
|
49
|
-
isOpen: this.
|
|
48
|
+
openKeys: this.adapter.getOpenKeys(),
|
|
49
|
+
isOpen: this.adapter.getIsOpen(),
|
|
50
50
|
domEvent: e
|
|
51
51
|
});
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
};
|
|
54
54
|
export { SubNavFoundation as default };
|
|
@@ -35,7 +35,7 @@ export default class NotificationListStore {
|
|
|
35
35
|
icon?: any;
|
|
36
36
|
getPopupContainer?: () => HTMLElement;
|
|
37
37
|
theme?: NoticeTheme;
|
|
38
|
-
direction?: "
|
|
38
|
+
direction?: "rtl" | "ltr";
|
|
39
39
|
className?: string;
|
|
40
40
|
style?: any;
|
|
41
41
|
stack?: boolean | number;
|
|
@@ -47,10 +47,10 @@ export default class NotificationListStore {
|
|
|
47
47
|
subscribe: (listener: () => void) => () => void;
|
|
48
48
|
getSnapshot: () => NotificationListState;
|
|
49
49
|
/** Shows a notice, or updates the shown one with the same id */
|
|
50
|
-
add(notice: NoticeInstance)
|
|
51
|
-
remove(id: string)
|
|
52
|
-
finishLeave(id: string)
|
|
53
|
-
clear()
|
|
54
|
-
config(opts: ConfigProps)
|
|
55
|
-
resetConfig()
|
|
50
|
+
add: (notice: NoticeInstance) => void;
|
|
51
|
+
remove: (id: string) => void;
|
|
52
|
+
finishLeave: (id: string) => void;
|
|
53
|
+
clear: () => void;
|
|
54
|
+
config: (opts: ConfigProps) => void;
|
|
55
|
+
resetConfig: () => void;
|
|
56
56
|
}
|
|
@@ -18,19 +18,19 @@ var NotificationListStore = class {
|
|
|
18
18
|
subscribe = (listener) => this.#items.subscribe(listener);
|
|
19
19
|
getSnapshot = () => this.#items.getSnapshot();
|
|
20
20
|
/** Shows a notice, or updates the shown one with the same id */
|
|
21
|
-
add(notice) {
|
|
21
|
+
add = (notice) => {
|
|
22
22
|
this.#items.add(notice);
|
|
23
|
-
}
|
|
24
|
-
remove(id) {
|
|
23
|
+
};
|
|
24
|
+
remove = (id) => {
|
|
25
25
|
this.#items.remove(id);
|
|
26
|
-
}
|
|
27
|
-
finishLeave(id) {
|
|
26
|
+
};
|
|
27
|
+
finishLeave = (id) => {
|
|
28
28
|
this.#items.finishLeave(id);
|
|
29
|
-
}
|
|
30
|
-
clear() {
|
|
29
|
+
};
|
|
30
|
+
clear = () => {
|
|
31
31
|
this.#items.clear();
|
|
32
|
-
}
|
|
33
|
-
config(opts) {
|
|
32
|
+
};
|
|
33
|
+
config = (opts) => {
|
|
34
34
|
for (const pos of [
|
|
35
35
|
"top",
|
|
36
36
|
"left",
|
|
@@ -41,9 +41,9 @@ var NotificationListStore = class {
|
|
|
41
41
|
if (typeof opts.duration === "number") this.defaults.duration = opts.duration;
|
|
42
42
|
if (typeof opts.position === "string") this.defaults.position = opts.position;
|
|
43
43
|
if ("stack" in opts) this.defaults.stack = opts.stack;
|
|
44
|
-
}
|
|
45
|
-
resetConfig() {
|
|
44
|
+
};
|
|
45
|
+
resetConfig = () => {
|
|
46
46
|
this.defaults = { ...builtInDefaults };
|
|
47
|
-
}
|
|
47
|
+
};
|
|
48
48
|
};
|
|
49
49
|
export { NotificationListStore as default };
|
|
@@ -71,8 +71,8 @@ export default class OverflowListFoundation<P extends OverflowListBaseProps = Ov
|
|
|
71
71
|
/** The view a change of items or style starts from; the measurement then settles it */
|
|
72
72
|
static resetView({ items, style, renderMode, collapseFrom, itemKey }: OverflowListBaseProps, view: OverflowListView, containerWidth: number): OverflowListView;
|
|
73
73
|
/** Returns whether the list must be measured again: an item changed width, or every visible item has reported */
|
|
74
|
-
recordItemSize(key: ItemKey, width: number, maxCount: number)
|
|
75
|
-
handleKeysChange(keys: ItemKey[])
|
|
76
|
-
handleIntersect(entries: Array<IntersectionObserverEntry>)
|
|
77
|
-
handleCollapseOverflow()
|
|
74
|
+
recordItemSize: (key: ItemKey, width: number, maxCount: number) => boolean;
|
|
75
|
+
handleKeysChange: (keys: ItemKey[]) => void;
|
|
76
|
+
handleIntersect: (entries: Array<IntersectionObserverEntry>) => void;
|
|
77
|
+
handleCollapseOverflow: () => void;
|
|
78
78
|
}
|
|
@@ -20,12 +20,12 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
20
20
|
if (!this.isScrollMode()) return;
|
|
21
21
|
const { items, itemKey } = this.getProps();
|
|
22
22
|
const scrollOverflow = computeScrollOverflow(items, itemKey, nextVisibleState);
|
|
23
|
-
if (scrollOverflow) this.
|
|
23
|
+
if (scrollOverflow) this.adapter.updateView({ scrollOverflow });
|
|
24
24
|
}
|
|
25
25
|
#notifyOverflow(overflow) {
|
|
26
26
|
if (!isEqual(this.#notifiedOverflow, overflow)) {
|
|
27
27
|
this.#notifiedOverflow = overflow;
|
|
28
|
-
this.
|
|
28
|
+
this.adapter.notifyOverflow(overflow);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
isScrollMode() {
|
|
@@ -101,21 +101,21 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
/** Returns whether the list must be measured again: an item changed width, or every visible item has reported */
|
|
104
|
-
recordItemSize(key, width, maxCount) {
|
|
104
|
+
recordItemSize = (key, width, maxCount) => {
|
|
105
105
|
const previous = this.#itemSizes.get(key);
|
|
106
106
|
this.#itemSizes.set(key, width);
|
|
107
107
|
return Boolean(previous && previous !== width) || this.#itemSizes.size === maxCount;
|
|
108
|
-
}
|
|
109
|
-
handleKeysChange(keys) {
|
|
108
|
+
};
|
|
109
|
+
handleKeysChange = (keys) => {
|
|
110
110
|
const keySet = new Set(keys);
|
|
111
111
|
this.#itemSizes.forEach((_, key) => keySet.has(key) || this.#itemSizes.delete(key));
|
|
112
112
|
this.setState({ visibleState: /* @__PURE__ */ new Map() });
|
|
113
|
-
}
|
|
114
|
-
handleIntersect(entries) {
|
|
113
|
+
};
|
|
114
|
+
handleIntersect = (entries) => {
|
|
115
115
|
const visibleState = new Map(this.getState("visibleState"));
|
|
116
116
|
const res = {};
|
|
117
117
|
entries.forEach((entry) => {
|
|
118
|
-
const itemKey =
|
|
118
|
+
const itemKey = entry?.target?.getAttribute("data-scrollkey") ?? void 0;
|
|
119
119
|
const visible = entry.isIntersecting;
|
|
120
120
|
res[itemKey] = entry;
|
|
121
121
|
visibleState.set(itemKey, visible);
|
|
@@ -128,18 +128,18 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
this.#previousY = currentY;
|
|
131
|
-
this.
|
|
131
|
+
this.adapter.updateVisibleState(visibleState);
|
|
132
132
|
this.#syncScrollOverflowCache(visibleState);
|
|
133
|
-
this.
|
|
134
|
-
}
|
|
135
|
-
handleCollapseOverflow() {
|
|
133
|
+
this.adapter.notifyIntersect(res);
|
|
134
|
+
};
|
|
135
|
+
handleCollapseOverflow = () => {
|
|
136
136
|
const { minVisibleItems, collapseFrom, itemKey } = this.getProps();
|
|
137
137
|
const { overflowWidth, containerWidth } = this.getStates();
|
|
138
138
|
const { items } = this.getProps();
|
|
139
139
|
let itemWidths = 0, _pivot = 0;
|
|
140
140
|
let overflowed = false;
|
|
141
141
|
if (items.length === 0) {
|
|
142
|
-
this.
|
|
142
|
+
this.adapter.updateView({
|
|
143
143
|
overflowStatus: "normal",
|
|
144
144
|
pivot: -1,
|
|
145
145
|
visible: items,
|
|
@@ -159,7 +159,7 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
161
161
|
if (isLast) {
|
|
162
|
-
this.
|
|
162
|
+
this.adapter.updateView({
|
|
163
163
|
overflowStatus: "normal",
|
|
164
164
|
pivot: items.length - 1,
|
|
165
165
|
visible: items,
|
|
@@ -173,9 +173,9 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
173
173
|
if (overflowed) {
|
|
174
174
|
const pivot = Math.max(minVisibleItems, _pivot);
|
|
175
175
|
const isCollapseFromStart = collapseFrom === Boundary.START;
|
|
176
|
-
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).
|
|
177
|
-
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).
|
|
178
|
-
this.
|
|
176
|
+
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).toReversed() : items.slice(0, pivot);
|
|
177
|
+
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).toReversed() : items.slice(pivot);
|
|
178
|
+
this.adapter.updateView({
|
|
179
179
|
overflowStatus: "overflowed",
|
|
180
180
|
pivot,
|
|
181
181
|
visible,
|
|
@@ -184,6 +184,6 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
184
184
|
this.#notifyOverflow(overflow);
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
}
|
|
187
|
+
};
|
|
188
188
|
};
|
|
189
189
|
export { OverflowListFoundation as default };
|
|
@@ -50,12 +50,12 @@ export default class PaginationFoundation<P extends PaginationBaseProps = Pagina
|
|
|
50
50
|
};
|
|
51
51
|
static getPageList(currentPage: number, total: number, pageSize: number): AdapterPageList;
|
|
52
52
|
static getPageSizeOpts(pageSizeOpts: readonly number[], pageSize: number): number[];
|
|
53
|
-
goPage(targetPageIndex: number |
|
|
54
|
-
updatePage(targetPageIndex?: number, pageSize?: number)
|
|
55
|
-
goPrev()
|
|
56
|
-
goNext()
|
|
57
|
-
changePageSize(newPageSize: number)
|
|
58
|
-
handleQuickJumpNumberChange(targetPage: string | number)
|
|
59
|
-
handleQuickJumpBlur()
|
|
60
|
-
handleQuickJumpEnterPress(targetPage: string)
|
|
53
|
+
goPage: (targetPageIndex: number | "...") => void;
|
|
54
|
+
updatePage: (targetPageIndex?: number, pageSize?: number) => void;
|
|
55
|
+
goPrev: () => void;
|
|
56
|
+
goNext: () => void;
|
|
57
|
+
changePageSize: (newPageSize: number) => void;
|
|
58
|
+
handleQuickJumpNumberChange: (targetPage: string | number) => void;
|
|
59
|
+
handleQuickJumpBlur: () => void;
|
|
60
|
+
handleQuickJumpEnterPress: (targetPage: string) => void;
|
|
61
61
|
}
|