@fibrae/semi-foundation 0.1.0 → 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 +17 -17
- 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
|
@@ -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
|
}
|
|
@@ -10,7 +10,7 @@ var PaginationFoundation = class PaginationFoundation extends BaseFoundation {
|
|
|
10
10
|
page = Math.trunc(page);
|
|
11
11
|
if (page > totalPageNum) page = totalPageNum;
|
|
12
12
|
if (page <= 0) page = 1;
|
|
13
|
-
this.
|
|
13
|
+
this.adapter.updateQuickJumpPage("");
|
|
14
14
|
this.goPage(page);
|
|
15
15
|
}
|
|
16
16
|
static getInitialState(props) {
|
|
@@ -126,50 +126,50 @@ var PaginationFoundation = class PaginationFoundation extends BaseFoundation {
|
|
|
126
126
|
const firstLargerIndex = pageSizeOpts.findIndex((el) => el > pageSize);
|
|
127
127
|
return firstLargerIndex === -1 ? [...pageSizeOpts, pageSize] : pageSizeOpts.toSpliced(firstLargerIndex, 0, pageSize);
|
|
128
128
|
}
|
|
129
|
-
goPage(targetPageIndex) {
|
|
129
|
+
goPage = (targetPageIndex) => {
|
|
130
130
|
if (targetPageIndex === "...") return;
|
|
131
131
|
const { pageSize, currentPage } = this.getStates();
|
|
132
132
|
if (targetPageIndex === currentPage) return;
|
|
133
|
-
if (!this.
|
|
134
|
-
this.
|
|
135
|
-
this.
|
|
136
|
-
}
|
|
137
|
-
updatePage(targetPageIndex = 1, pageSize) {
|
|
133
|
+
if (!this.isControlledComponent("currentPage")) this.updatePage(targetPageIndex);
|
|
134
|
+
this.adapter.notifyPageChange(targetPageIndex);
|
|
135
|
+
this.adapter.notifyChange(targetPageIndex, pageSize);
|
|
136
|
+
};
|
|
137
|
+
updatePage = (targetPageIndex = 1, pageSize) => {
|
|
138
138
|
const { currentPage, pageSize: currentPageSize } = this.getStates();
|
|
139
139
|
const newPageSize = pageSize ?? currentPageSize;
|
|
140
|
-
if (targetPageIndex !== currentPage) this.
|
|
141
|
-
if (newPageSize !== currentPageSize) this.
|
|
142
|
-
}
|
|
143
|
-
goPrev() {
|
|
140
|
+
if (targetPageIndex !== currentPage) this.adapter.setCurrentPage(targetPageIndex);
|
|
141
|
+
if (newPageSize !== currentPageSize) this.adapter.updatePageSize(newPageSize);
|
|
142
|
+
};
|
|
143
|
+
goPrev = () => {
|
|
144
144
|
const { currentPage } = this.getStates();
|
|
145
145
|
if (currentPage > 1) this.goPage(currentPage - 1);
|
|
146
|
-
}
|
|
147
|
-
goNext() {
|
|
146
|
+
};
|
|
147
|
+
goNext = () => {
|
|
148
148
|
const { currentPage, pageSize } = this.getStates();
|
|
149
149
|
if (currentPage <= PaginationFoundation.getTotalPageNumber(this.getProp("total"), pageSize) - 1) this.goPage(currentPage + 1);
|
|
150
|
-
}
|
|
151
|
-
changePageSize(newPageSize) {
|
|
150
|
+
};
|
|
151
|
+
changePageSize = (newPageSize) => {
|
|
152
152
|
const { pageSize, currentPage } = this.getStates();
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
153
|
+
this.adapter.updatePageSize(newPageSize);
|
|
154
|
+
this.adapter.notifyPageSizeChange(newPageSize);
|
|
155
155
|
let newCurrentPage = currentPage;
|
|
156
156
|
if (!this.getProp("preventPageChangeOnPageSizeChange")) {
|
|
157
157
|
const currentPageFirstItemIndex = (currentPage - 1) * pageSize + 1;
|
|
158
158
|
newCurrentPage = Math.ceil(currentPageFirstItemIndex / newPageSize);
|
|
159
159
|
}
|
|
160
|
-
if (!this.
|
|
161
|
-
if (currentPage !== newCurrentPage) this.
|
|
162
|
-
this.
|
|
163
|
-
}
|
|
164
|
-
handleQuickJumpNumberChange(targetPage) {
|
|
165
|
-
this.
|
|
166
|
-
}
|
|
167
|
-
handleQuickJumpBlur() {
|
|
160
|
+
if (!this.isControlledComponent("currentPage")) this.updatePage(newCurrentPage, newPageSize);
|
|
161
|
+
if (currentPage !== newCurrentPage) this.adapter.notifyPageChange(newCurrentPage);
|
|
162
|
+
this.adapter.notifyChange(newCurrentPage, newPageSize);
|
|
163
|
+
};
|
|
164
|
+
handleQuickJumpNumberChange = (targetPage) => {
|
|
165
|
+
this.adapter.updateQuickJumpPage(targetPage);
|
|
166
|
+
};
|
|
167
|
+
handleQuickJumpBlur = () => {
|
|
168
168
|
const { quickJumpPage } = this.getStates();
|
|
169
169
|
if (typeof quickJumpPage === "string" && quickJumpPage || typeof quickJumpPage === "number") this.#handleQuickJump(quickJumpPage);
|
|
170
|
-
}
|
|
171
|
-
handleQuickJumpEnterPress(targetPage) {
|
|
170
|
+
};
|
|
171
|
+
handleQuickJumpEnterPress = (targetPage) => {
|
|
172
172
|
this.#handleQuickJump(targetPage);
|
|
173
|
-
}
|
|
173
|
+
};
|
|
174
174
|
};
|
|
175
175
|
export { PaginationFoundation as default };
|
|
@@ -23,17 +23,17 @@ export interface PinCodeAdapter<P extends PinCodeBaseProps = PinCodeBaseProps, S
|
|
|
23
23
|
export default class PinCodeFoundation<P extends PinCodeBaseProps = PinCodeBaseProps, S extends PinCodeBaseState = PinCodeBaseState> extends BaseFoundation<PinCodeAdapter<P, S>, P, S> {
|
|
24
24
|
static numberReg: RegExp;
|
|
25
25
|
static mixedReg: RegExp;
|
|
26
|
-
handleCurrentActiveIndexChange(index: number, state:
|
|
26
|
+
handleCurrentActiveIndexChange: (index: number, state: "focus" | "blur") => void;
|
|
27
27
|
completeSingleInput(i: number, singleInputValue: string): Promise<void>;
|
|
28
28
|
/** `data` is the InputEvent or CompositionEvent data of the change, if any */
|
|
29
|
-
handleCellChange(index: number, value: string, data?: string | null)
|
|
29
|
+
handleCellChange: (index: number, value: string, data?: string | null) => void;
|
|
30
30
|
validateValue(value?: string): boolean;
|
|
31
|
-
updateValueList(newValueList: PinCodeBaseState[
|
|
32
|
-
handlePaste(e: ClipboardEvent, startInputIndex: number)
|
|
31
|
+
updateValueList: (newValueList: PinCodeBaseState["valueList"]) => Promise<void>;
|
|
32
|
+
handlePaste: (e: ClipboardEvent, startInputIndex: number) => Promise<void>;
|
|
33
33
|
/**
|
|
34
34
|
* Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
|
|
35
35
|
* virtual keyboard's delete).
|
|
36
36
|
*/
|
|
37
37
|
removeCell(index: number): void;
|
|
38
|
-
handleKeyDownOnSingleInput(e: KeyboardEvent, index: number)
|
|
38
|
+
handleKeyDownOnSingleInput: (e: KeyboardEvent, index: number) => void;
|
|
39
39
|
}
|
|
@@ -3,31 +3,31 @@ import BaseFoundation from "../base/foundation.js";
|
|
|
3
3
|
var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
|
|
4
4
|
static numberReg = /^\d*$/;
|
|
5
5
|
static mixedReg = /^[0-9a-zA-Z]$/;
|
|
6
|
-
handleCurrentActiveIndexChange(index, state) {
|
|
7
|
-
if (state === "focus") this.
|
|
8
|
-
}
|
|
6
|
+
handleCurrentActiveIndexChange = (index, state) => {
|
|
7
|
+
if (state === "focus") this.adapter.onCurrentActiveIndexChange(index);
|
|
8
|
+
};
|
|
9
9
|
async completeSingleInput(i, singleInputValue) {
|
|
10
|
-
const isControlledComponent = this.
|
|
10
|
+
const isControlledComponent = this.isControlledComponent("value");
|
|
11
11
|
const index = Math.min(i, this.getState("valueList").length);
|
|
12
|
-
await this.
|
|
12
|
+
await this.adapter.onCurrentActiveIndexChange(index + 1);
|
|
13
13
|
const valueList = [...this.getState("valueList")];
|
|
14
14
|
valueList[index] = singleInputValue;
|
|
15
|
-
this.
|
|
15
|
+
this.adapter.notifyValueChange(valueList);
|
|
16
16
|
if (!isControlledComponent) await this.updateValueList(valueList);
|
|
17
17
|
const count = this.getProp("count");
|
|
18
|
-
if (index + 1 > count - 1) this.
|
|
19
|
-
else this.
|
|
20
|
-
if (valueList.length === count) this.
|
|
18
|
+
if (index + 1 > count - 1) this.adapter.changeSpecificInputFocusState(index, "blur");
|
|
19
|
+
else this.adapter.changeSpecificInputFocusState(index + 1, "focus");
|
|
20
|
+
if (valueList.length === count) this.adapter.notifyComplete(valueList.join(""));
|
|
21
21
|
}
|
|
22
22
|
/** `data` is the InputEvent or CompositionEvent data of the change, if any */
|
|
23
|
-
handleCellChange(index, value, data) {
|
|
23
|
+
handleCellChange = (index, value, data) => {
|
|
24
24
|
if (value === "") {
|
|
25
25
|
this.removeCell(index);
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const char = data && Array.from(data).length === 1 ? data : Array.from(value).at(-1);
|
|
29
29
|
if (this.validateValue(char)) this.completeSingleInput(index, char);
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
validateValue(value = "") {
|
|
32
32
|
const format = this.getProp("format");
|
|
33
33
|
let validateFunction = (_value) => true;
|
|
@@ -41,10 +41,10 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
|
|
|
41
41
|
else if (typeof format === "function") validateFunction = format;
|
|
42
42
|
return validateFunction(value);
|
|
43
43
|
}
|
|
44
|
-
async
|
|
45
|
-
await this.
|
|
46
|
-
}
|
|
47
|
-
async
|
|
44
|
+
updateValueList = async (newValueList) => {
|
|
45
|
+
await this.adapter.updateValueList(newValueList);
|
|
46
|
+
};
|
|
47
|
+
handlePaste = async (e, startInputIndex) => {
|
|
48
48
|
e.preventDefault();
|
|
49
49
|
const textWillPaste = Array.from(e.clipboardData.getData("text"));
|
|
50
50
|
const count = this.getProp("count");
|
|
@@ -54,7 +54,7 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
|
|
|
54
54
|
if (this.validateValue(currentChar)) await this.completeSingleInput(i, currentChar);
|
|
55
55
|
else break;
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
};
|
|
58
58
|
/**
|
|
59
59
|
* Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
|
|
60
60
|
* virtual keyboard's delete).
|
|
@@ -62,25 +62,25 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
|
|
|
62
62
|
removeCell(index) {
|
|
63
63
|
const valueList = this.getState("valueList").toSpliced(index, 1);
|
|
64
64
|
this.updateValueList(valueList);
|
|
65
|
-
this.
|
|
65
|
+
this.adapter.notifyValueChange(valueList);
|
|
66
66
|
}
|
|
67
|
-
handleKeyDownOnSingleInput(e, index) {
|
|
67
|
+
handleKeyDownOnSingleInput = (e, index) => {
|
|
68
68
|
const lastIndex = this.getProp("count") - 1;
|
|
69
69
|
if (e.key === "Backspace") {
|
|
70
70
|
this.removeCell(index);
|
|
71
|
-
this.
|
|
71
|
+
this.adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
|
|
72
72
|
e.preventDefault();
|
|
73
73
|
} else if (e.key === "Delete") {
|
|
74
74
|
this.removeCell(index);
|
|
75
75
|
e.preventDefault();
|
|
76
76
|
} else if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
77
77
|
else if (e.key === "ArrowLeft") {
|
|
78
|
-
this.
|
|
78
|
+
this.adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
|
|
79
79
|
e.preventDefault();
|
|
80
80
|
} else if (e.key === "ArrowRight") {
|
|
81
|
-
this.
|
|
81
|
+
this.adapter.changeSpecificInputFocusState(Math.min(lastIndex, index + 1), "focus");
|
|
82
82
|
e.preventDefault();
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
85
|
};
|
|
86
86
|
export { PinCodeFoundation as default };
|
|
@@ -3,8 +3,8 @@ export interface PopconfirmAdapter<P extends PopconfirmBaseProps = PopconfirmBas
|
|
|
3
3
|
setVisible: (visible: boolean) => void;
|
|
4
4
|
updateConfirmLoading: (loading: boolean) => void;
|
|
5
5
|
updateCancelLoading: (loading: boolean) => void;
|
|
6
|
-
notifyConfirm: (e:
|
|
7
|
-
notifyCancel: (e:
|
|
6
|
+
notifyConfirm: (e: MouseEvent) => unknown;
|
|
7
|
+
notifyCancel: (e: MouseEvent) => unknown;
|
|
8
8
|
notifyVisibleChange: (visible: boolean) => void;
|
|
9
9
|
focusCancelButton: () => void;
|
|
10
10
|
focusOkButton: () => void;
|
|
@@ -27,12 +27,12 @@ export interface PopconfirmBaseState {
|
|
|
27
27
|
}
|
|
28
28
|
export default class PopConfirmFoundation<P extends PopconfirmBaseProps = PopconfirmBaseProps, S extends PopconfirmBaseState = PopconfirmBaseState> extends BaseFoundation<PopconfirmAdapter<P, S>, P, S> {
|
|
29
29
|
#private;
|
|
30
|
-
handleCancel(e:
|
|
31
|
-
handleConfirm(e:
|
|
32
|
-
handleVisibleChange(visible: boolean)
|
|
30
|
+
handleCancel: (e: MouseEvent) => void;
|
|
31
|
+
handleConfirm: (e: MouseEvent) => void;
|
|
32
|
+
handleVisibleChange: (visible: boolean) => void;
|
|
33
33
|
/** Hosts call this when the popup really opens, whoever set `visible` */
|
|
34
|
-
handlePopupOpen()
|
|
34
|
+
handlePopupOpen: () => void;
|
|
35
35
|
/** Hosts call this when the popup really closes, whoever set `visible`; the card is still mounted */
|
|
36
|
-
handlePopupClose()
|
|
36
|
+
handlePopupClose: () => void;
|
|
37
37
|
}
|
|
38
38
|
export {};
|