@fibrae/semi-foundation 0.1.1 → 0.3.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 -4
- package/dist/anchor/foundation.js +21 -22
- package/dist/audio-player/foundation.d.ts +10 -13
- package/dist/audio-player/foundation.js +19 -20
- package/dist/auto-complete/foundation.d.ts +12 -14
- package/dist/auto-complete/foundation.js +51 -52
- package/dist/avatar/foundation.d.ts +5 -6
- package/dist/avatar/foundation.js +16 -16
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +2 -5
- package/dist/backtop/foundation.js +7 -8
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -9
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -4
- package/dist/base/foundation.js +12 -11
- package/dist/base/list-store.d.ts +0 -1
- 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.d.ts +0 -10
- package/dist/calendar/event-util.js +1 -11
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +5 -9
- package/dist/calendar/month-foundation.d.ts +2 -3
- package/dist/calendar/month-foundation.js +6 -7
- package/dist/carousel/foundation.d.ts +17 -19
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +36 -32
- package/dist/cascader/foundation.js +145 -132
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +3 -7
- package/dist/checkbox/checkbox-foundation.js +15 -17
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -2
- 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-picker.scss +0 -2
- 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/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +15 -16
- package/dist/cropper/foundation.js +26 -24
- package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
- package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
- package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
- package/dist/date-picker/_utils/parser.d.ts +0 -3
- package/dist/date-picker/_utils/parser.js +0 -7
- package/dist/date-picker/_utils/picker-type.d.ts +1 -3
- package/dist/date-picker/_utils/picker-type.js +0 -2
- package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
- package/dist/date-picker/_utils/to-callback-args.js +0 -1
- package/dist/date-picker/date-picker.scss +0 -3
- package/dist/date-picker/foundation.d.ts +39 -58
- package/dist/date-picker/foundation.js +126 -153
- package/dist/date-picker/input-foundation.d.ts +10 -16
- package/dist/date-picker/input-foundation.js +28 -30
- package/dist/date-picker/month-foundation.d.ts +0 -3
- package/dist/date-picker/month-foundation.js +0 -2
- package/dist/date-picker/months-grid-foundation.d.ts +17 -26
- package/dist/date-picker/months-grid-foundation.js +65 -75
- 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 -3
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -7
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -2
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -10
- package/dist/feedback/foundation.js +33 -33
- package/dist/feedback/variables.scss +1 -5
- package/dist/float-button/float-button.css +0 -1
- package/dist/float-button/float-button.scss +0 -2
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/form.scss +0 -12
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -76
- package/dist/form/interface.d.ts +2 -15
- package/dist/form/utils.d.ts +0 -8
- package/dist/form/utils.js +0 -7
- package/dist/form/variables.scss +1 -4
- package/dist/grid/variables.scss +0 -10
- package/dist/highlight/foundation.d.ts +0 -2
- package/dist/highlight/foundation.js +1 -3
- package/dist/hot-keys/foundation.d.ts +2 -3
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -6
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -4
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -9
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -10
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -11
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -5
- package/dist/input/text-entry-foundation.js +14 -15
- package/dist/input/textarea-foundation.d.ts +7 -8
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +16 -19
- package/dist/input-number/foundation.js +54 -58
- package/dist/json-viewer/foundation.d.ts +8 -10
- package/dist/json-viewer/foundation.js +23 -24
- package/dist/locale/interface.d.ts +0 -3
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +2 -7
- package/dist/markdown-render/foundation.js +5 -9
- 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 -8
- package/dist/navigation/foundation.js +14 -20
- 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 -4
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -8
- package/dist/notification/notification-list-foundation.js +12 -13
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +4 -6
- package/dist/overflow-list/foundation.js +18 -19
- package/dist/pagination/foundation.d.ts +8 -10
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +6 -9
- package/dist/pincode/foundation.js +23 -26
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/progress/generates.d.ts +1 -4
- package/dist/progress/generates.js +1 -4
- package/dist/progress/utils.d.ts +1 -1
- package/dist/progress/utils.js +1 -1
- package/dist/radio/radio-foundation.d.ts +5 -9
- package/dist/radio/radio-foundation.js +15 -16
- package/dist/radio/radio-group-foundation.d.ts +2 -3
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -15
- package/dist/rating/foundation.js +35 -38
- package/dist/resizable/group/index.d.ts +6 -10
- package/dist/resizable/group/index.js +40 -44
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +3 -7
- package/dist/resizable/single/index.js +10 -13
- package/dist/scroll-list/item-foundation.d.ts +7 -9
- package/dist/scroll-list/item-foundation.js +35 -36
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +42 -57
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -28
- package/dist/select/option-foundation.js +10 -19
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
- package/dist/side-sheet/side-sheet-foundation.js +23 -27
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +17 -28
- package/dist/slider/foundation.js +47 -59
- package/dist/slider/variables.scss +1 -5
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -4
- package/dist/spin/foundation.js +6 -7
- package/dist/spin/variables.scss +1 -3
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -3
- package/dist/switch/foundation.js +7 -7
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +24 -33
- package/dist/table/foundation.js +144 -108
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +2 -10
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +5 -14
- package/dist/tabs/foundation.js +17 -21
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +11 -13
- package/dist/tag-input/foundation.js +52 -53
- package/dist/tag-input/tag-input.scss +0 -1
- package/dist/tag-input/utils/tag-focus.d.ts +0 -1
- package/dist/tag-input/utils/tag-focus.js +0 -1
- package/dist/time-picker/combox-foundation.d.ts +3 -11
- package/dist/time-picker/combox-foundation.js +3 -10
- package/dist/time-picker/foundation.d.ts +13 -23
- package/dist/time-picker/foundation.js +39 -48
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/adjust-position.d.ts +1 -2
- package/dist/tooltip/constants.d.ts +0 -3
- package/dist/tooltip/constants.js +0 -3
- package/dist/tooltip/foundation.d.ts +9 -12
- package/dist/tooltip/foundation.js +67 -63
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +22 -13
- package/dist/transfer/foundation.js +38 -24
- package/dist/tree/foundation.d.ts +14 -16
- package/dist/tree/foundation.js +61 -62
- package/dist/tree/shared.d.ts +2 -4
- package/dist/tree/shared.js +0 -2
- package/dist/tree/tree-util.d.ts +0 -5
- package/dist/tree/tree-util.js +0 -5
- package/dist/tree-select/foundation.d.ts +26 -22
- package/dist/tree-select/foundation.js +91 -86
- package/dist/typography/ellipsis.d.ts +5 -7
- package/dist/typography/ellipsis.js +8 -10
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -23
- package/dist/upload/foundation.js +93 -103
- package/dist/upload/utils.d.ts +3 -8
- package/dist/upload/utils.js +6 -11
- package/dist/user-guide/foundation.d.ts +3 -5
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +2 -6
- package/dist/utils/a11y.js +1 -4
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/array.d.ts +0 -6
- package/dist/utils/array.js +0 -6
- package/dist/utils/date-fns-extra.js +1 -5
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/dom.js +0 -1
- package/dist/utils/escape-html.js +0 -3
- package/dist/utils/field-sizing.d.ts +0 -2
- package/dist/utils/field-sizing.js +0 -2
- package/dist/utils/focus-handle.d.ts +1 -2
- package/dist/utils/focus-handle.js +1 -3
- package/dist/utils/focus-scope.d.ts +5 -6
- package/dist/utils/focus-scope.js +10 -11
- 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/utils/scroll-lock.d.ts +3 -4
- package/dist/utils/scroll-lock.js +3 -4
- package/dist/utils/tween.d.ts +0 -1
- package/dist/utils/tween.js +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/uuid.js +0 -1
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -1
- 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 -3
- package/dist/video-player/progress-foundation.js +12 -13
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
|
@@ -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;
|
|
@@ -46,11 +46,10 @@ export default class NotificationListStore {
|
|
|
46
46
|
};
|
|
47
47
|
subscribe: (listener: () => void) => () => void;
|
|
48
48
|
getSnapshot: () => NotificationListState;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
resetConfig(): void;
|
|
49
|
+
add: (notice: NoticeInstance) => void;
|
|
50
|
+
remove: (id: string) => void;
|
|
51
|
+
finishLeave: (id: string) => void;
|
|
52
|
+
clear: () => void;
|
|
53
|
+
config: (opts: ConfigProps) => void;
|
|
54
|
+
resetConfig: () => void;
|
|
56
55
|
}
|
|
@@ -17,20 +17,19 @@ var NotificationListStore = class {
|
|
|
17
17
|
defaults = { ...builtInDefaults };
|
|
18
18
|
subscribe = (listener) => this.#items.subscribe(listener);
|
|
19
19
|
getSnapshot = () => this.#items.getSnapshot();
|
|
20
|
-
|
|
21
|
-
add(notice) {
|
|
20
|
+
add = (notice) => {
|
|
22
21
|
this.#items.add(notice);
|
|
23
|
-
}
|
|
24
|
-
remove(id) {
|
|
22
|
+
};
|
|
23
|
+
remove = (id) => {
|
|
25
24
|
this.#items.remove(id);
|
|
26
|
-
}
|
|
27
|
-
finishLeave(id) {
|
|
25
|
+
};
|
|
26
|
+
finishLeave = (id) => {
|
|
28
27
|
this.#items.finishLeave(id);
|
|
29
|
-
}
|
|
30
|
-
clear() {
|
|
28
|
+
};
|
|
29
|
+
clear = () => {
|
|
31
30
|
this.#items.clear();
|
|
32
|
-
}
|
|
33
|
-
config(opts) {
|
|
31
|
+
};
|
|
32
|
+
config = (opts) => {
|
|
34
33
|
for (const pos of [
|
|
35
34
|
"top",
|
|
36
35
|
"left",
|
|
@@ -41,9 +40,9 @@ var NotificationListStore = class {
|
|
|
41
40
|
if (typeof opts.duration === "number") this.defaults.duration = opts.duration;
|
|
42
41
|
if (typeof opts.position === "string") this.defaults.position = opts.position;
|
|
43
42
|
if ("stack" in opts) this.defaults.stack = opts.stack;
|
|
44
|
-
}
|
|
45
|
-
resetConfig() {
|
|
43
|
+
};
|
|
44
|
+
resetConfig = () => {
|
|
46
45
|
this.defaults = { ...builtInDefaults };
|
|
47
|
-
}
|
|
46
|
+
};
|
|
48
47
|
};
|
|
49
48
|
export { NotificationListStore as default };
|
|
@@ -16,7 +16,6 @@ $color-notification_info_light-bg: var(--semi-color-info-light-default); // 彩
|
|
|
16
16
|
$color-notification_info_light-border: var(--semi-color-info); // 彩色通知信息描边色
|
|
17
17
|
$color-notification_danger_light-bg: var(--semi-color-danger-light-default); // 彩色通知危险背景色
|
|
18
18
|
$color-notification_danger_light-border: var(--semi-color-danger); // 彩色通知危险描边色
|
|
19
|
-
// keep equal to bg-0
|
|
20
19
|
$color-notification_ambient-bg: var(--semi-color-bg-0); // 透明背景色叠加层(与bg0保持一致不建议修改)
|
|
21
20
|
|
|
22
21
|
$width-notification_notice: auto; // 通知宽度
|
|
@@ -32,7 +32,6 @@ export interface VisibleLayout {
|
|
|
32
32
|
step: 1 | -1;
|
|
33
33
|
fromStart: boolean;
|
|
34
34
|
}
|
|
35
|
-
/** The props the foundation reads */
|
|
36
35
|
export interface OverflowListBaseProps {
|
|
37
36
|
collapseFrom?: 'start' | 'end';
|
|
38
37
|
items?: Array<Record<string, any>>;
|
|
@@ -68,11 +67,10 @@ export default class OverflowListFoundation<P extends OverflowListBaseProps = Ov
|
|
|
68
67
|
* object to one position.
|
|
69
68
|
*/
|
|
70
69
|
static getVisibleLayout({ items, visible }: Pick<OverflowListView, 'items' | 'visible'>, fromStart: boolean, reversed: boolean): VisibleLayout;
|
|
71
|
-
/** The view a change of items or style starts from; the measurement then settles it */
|
|
72
70
|
static resetView({ items, style, renderMode, collapseFrom, itemKey }: OverflowListBaseProps, view: OverflowListView, containerWidth: number): OverflowListView;
|
|
73
71
|
/** 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()
|
|
72
|
+
recordItemSize: (key: ItemKey, width: number, maxCount: number) => boolean;
|
|
73
|
+
handleKeysChange: (keys: ItemKey[]) => void;
|
|
74
|
+
handleIntersect: (entries: Array<IntersectionObserverEntry>) => void;
|
|
75
|
+
handleCollapseOverflow: () => void;
|
|
78
76
|
}
|
|
@@ -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() {
|
|
@@ -67,7 +67,6 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
67
67
|
fromStart
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
/** The view a change of items or style starts from; the measurement then settles it */
|
|
71
70
|
static resetView({ items, style, renderMode, collapseFrom, itemKey }, view, containerWidth) {
|
|
72
71
|
const keys = OverflowListFoundation.getItemKeys(items, itemKey);
|
|
73
72
|
const next = {
|
|
@@ -101,21 +100,21 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
101
100
|
};
|
|
102
101
|
}
|
|
103
102
|
/** Returns whether the list must be measured again: an item changed width, or every visible item has reported */
|
|
104
|
-
recordItemSize(key, width, maxCount) {
|
|
103
|
+
recordItemSize = (key, width, maxCount) => {
|
|
105
104
|
const previous = this.#itemSizes.get(key);
|
|
106
105
|
this.#itemSizes.set(key, width);
|
|
107
106
|
return Boolean(previous && previous !== width) || this.#itemSizes.size === maxCount;
|
|
108
|
-
}
|
|
109
|
-
handleKeysChange(keys) {
|
|
107
|
+
};
|
|
108
|
+
handleKeysChange = (keys) => {
|
|
110
109
|
const keySet = new Set(keys);
|
|
111
110
|
this.#itemSizes.forEach((_, key) => keySet.has(key) || this.#itemSizes.delete(key));
|
|
112
111
|
this.setState({ visibleState: /* @__PURE__ */ new Map() });
|
|
113
|
-
}
|
|
114
|
-
handleIntersect(entries) {
|
|
112
|
+
};
|
|
113
|
+
handleIntersect = (entries) => {
|
|
115
114
|
const visibleState = new Map(this.getState("visibleState"));
|
|
116
115
|
const res = {};
|
|
117
116
|
entries.forEach((entry) => {
|
|
118
|
-
const itemKey =
|
|
117
|
+
const itemKey = entry?.target?.getAttribute("data-scrollkey") ?? void 0;
|
|
119
118
|
const visible = entry.isIntersecting;
|
|
120
119
|
res[itemKey] = entry;
|
|
121
120
|
visibleState.set(itemKey, visible);
|
|
@@ -128,18 +127,18 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
128
127
|
return;
|
|
129
128
|
}
|
|
130
129
|
this.#previousY = currentY;
|
|
131
|
-
this.
|
|
130
|
+
this.adapter.updateVisibleState(visibleState);
|
|
132
131
|
this.#syncScrollOverflowCache(visibleState);
|
|
133
|
-
this.
|
|
134
|
-
}
|
|
135
|
-
handleCollapseOverflow() {
|
|
132
|
+
this.adapter.notifyIntersect(res);
|
|
133
|
+
};
|
|
134
|
+
handleCollapseOverflow = () => {
|
|
136
135
|
const { minVisibleItems, collapseFrom, itemKey } = this.getProps();
|
|
137
136
|
const { overflowWidth, containerWidth } = this.getStates();
|
|
138
137
|
const { items } = this.getProps();
|
|
139
138
|
let itemWidths = 0, _pivot = 0;
|
|
140
139
|
let overflowed = false;
|
|
141
140
|
if (items.length === 0) {
|
|
142
|
-
this.
|
|
141
|
+
this.adapter.updateView({
|
|
143
142
|
overflowStatus: "normal",
|
|
144
143
|
pivot: -1,
|
|
145
144
|
visible: items,
|
|
@@ -159,7 +158,7 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
159
158
|
break;
|
|
160
159
|
}
|
|
161
160
|
if (isLast) {
|
|
162
|
-
this.
|
|
161
|
+
this.adapter.updateView({
|
|
163
162
|
overflowStatus: "normal",
|
|
164
163
|
pivot: items.length - 1,
|
|
165
164
|
visible: items,
|
|
@@ -173,9 +172,9 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
173
172
|
if (overflowed) {
|
|
174
173
|
const pivot = Math.max(minVisibleItems, _pivot);
|
|
175
174
|
const isCollapseFromStart = collapseFrom === Boundary.START;
|
|
176
|
-
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).
|
|
177
|
-
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).
|
|
178
|
-
this.
|
|
175
|
+
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).toReversed() : items.slice(0, pivot);
|
|
176
|
+
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).toReversed() : items.slice(pivot);
|
|
177
|
+
this.adapter.updateView({
|
|
179
178
|
overflowStatus: "overflowed",
|
|
180
179
|
pivot,
|
|
181
180
|
visible,
|
|
@@ -184,6 +183,6 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
184
183
|
this.#notifyOverflow(overflow);
|
|
185
184
|
return;
|
|
186
185
|
}
|
|
187
|
-
}
|
|
186
|
+
};
|
|
188
187
|
};
|
|
189
188
|
export { OverflowListFoundation as default };
|
|
@@ -19,13 +19,11 @@ export interface AdapterPageList {
|
|
|
19
19
|
restLeftRange: PageRange;
|
|
20
20
|
restRightRange: PageRange;
|
|
21
21
|
}
|
|
22
|
-
/** The props the foundation reads */
|
|
23
22
|
export interface PaginationBaseProps {
|
|
24
23
|
currentPage?: number;
|
|
25
24
|
preventPageChangeOnPageSizeChange?: boolean;
|
|
26
25
|
total?: number;
|
|
27
26
|
}
|
|
28
|
-
/** The state the foundation reads */
|
|
29
27
|
export interface PaginationBaseState {
|
|
30
28
|
currentPage: number;
|
|
31
29
|
pageSize: number;
|
|
@@ -50,12 +48,12 @@ export default class PaginationFoundation<P extends PaginationBaseProps = Pagina
|
|
|
50
48
|
};
|
|
51
49
|
static getPageList(currentPage: number, total: number, pageSize: number): AdapterPageList;
|
|
52
50
|
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)
|
|
51
|
+
goPage: (targetPageIndex: number | "...") => void;
|
|
52
|
+
updatePage: (targetPageIndex?: number, pageSize?: number) => void;
|
|
53
|
+
goPrev: () => void;
|
|
54
|
+
goNext: () => void;
|
|
55
|
+
changePageSize: (newPageSize: number) => void;
|
|
56
|
+
handleQuickJumpNumberChange: (targetPage: string | number) => void;
|
|
57
|
+
handleQuickJumpBlur: () => void;
|
|
58
|
+
handleQuickJumpEnterPress: (targetPage: string) => void;
|
|
61
59
|
}
|
|
@@ -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,14 @@ 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)
|
|
33
|
-
/**
|
|
34
|
-
* Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
|
|
35
|
-
* virtual keyboard's delete).
|
|
36
|
-
*/
|
|
31
|
+
updateValueList: (newValueList: PinCodeBaseState["valueList"]) => Promise<void>;
|
|
32
|
+
handlePaste: (e: ClipboardEvent, startInputIndex: number) => Promise<void>;
|
|
33
|
+
/** Also covers a cell emptied without Backspace or Delete (cut, a virtual keyboard's delete). */
|
|
37
34
|
removeCell(index: number): void;
|
|
38
|
-
handleKeyDownOnSingleInput(e: KeyboardEvent, index: number)
|
|
35
|
+
handleKeyDownOnSingleInput: (e: KeyboardEvent, index: number) => void;
|
|
39
36
|
}
|
|
@@ -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,33 +54,30 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
|
|
|
54
54
|
if (this.validateValue(currentChar)) await this.completeSingleInput(i, currentChar);
|
|
55
55
|
else break;
|
|
56
56
|
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
|
|
60
|
-
* virtual keyboard's delete).
|
|
61
|
-
*/
|
|
57
|
+
};
|
|
58
|
+
/** Also covers a cell emptied without Backspace or Delete (cut, a virtual keyboard's delete). */
|
|
62
59
|
removeCell(index) {
|
|
63
60
|
const valueList = this.getState("valueList").toSpliced(index, 1);
|
|
64
61
|
this.updateValueList(valueList);
|
|
65
|
-
this.
|
|
62
|
+
this.adapter.notifyValueChange(valueList);
|
|
66
63
|
}
|
|
67
|
-
handleKeyDownOnSingleInput(e, index) {
|
|
64
|
+
handleKeyDownOnSingleInput = (e, index) => {
|
|
68
65
|
const lastIndex = this.getProp("count") - 1;
|
|
69
66
|
if (e.key === "Backspace") {
|
|
70
67
|
this.removeCell(index);
|
|
71
|
-
this.
|
|
68
|
+
this.adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
|
|
72
69
|
e.preventDefault();
|
|
73
70
|
} else if (e.key === "Delete") {
|
|
74
71
|
this.removeCell(index);
|
|
75
72
|
e.preventDefault();
|
|
76
73
|
} else if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
77
74
|
else if (e.key === "ArrowLeft") {
|
|
78
|
-
this.
|
|
75
|
+
this.adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
|
|
79
76
|
e.preventDefault();
|
|
80
77
|
} else if (e.key === "ArrowRight") {
|
|
81
|
-
this.
|
|
78
|
+
this.adapter.changeSpecificInputFocusState(Math.min(lastIndex, index + 1), "focus");
|
|
82
79
|
e.preventDefault();
|
|
83
80
|
}
|
|
84
|
-
}
|
|
81
|
+
};
|
|
85
82
|
};
|
|
86
83
|
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;
|
|
@@ -14,25 +14,23 @@ interface FooterButtonProps {
|
|
|
14
14
|
autoFocus?: boolean;
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
}
|
|
17
|
-
/** The props the foundation reads */
|
|
18
17
|
export interface PopconfirmBaseProps {
|
|
19
18
|
cancelButtonProps?: FooterButtonProps;
|
|
20
19
|
okButtonProps?: FooterButtonProps;
|
|
21
20
|
visible?: boolean;
|
|
22
21
|
}
|
|
23
|
-
/** The state the foundation reads */
|
|
24
22
|
export interface PopconfirmBaseState {
|
|
25
23
|
visible: boolean;
|
|
26
24
|
cancelLoading: boolean;
|
|
27
25
|
}
|
|
28
26
|
export default class PopConfirmFoundation<P extends PopconfirmBaseProps = PopconfirmBaseProps, S extends PopconfirmBaseState = PopconfirmBaseState> extends BaseFoundation<PopconfirmAdapter<P, S>, P, S> {
|
|
29
27
|
#private;
|
|
30
|
-
handleCancel(e:
|
|
31
|
-
handleConfirm(e:
|
|
32
|
-
handleVisibleChange(visible: boolean)
|
|
28
|
+
handleCancel: (e: MouseEvent) => void;
|
|
29
|
+
handleConfirm: (e: MouseEvent) => void;
|
|
30
|
+
handleVisibleChange: (visible: boolean) => void;
|
|
33
31
|
/** Hosts call this when the popup really opens, whoever set `visible` */
|
|
34
|
-
handlePopupOpen()
|
|
32
|
+
handlePopupOpen: () => void;
|
|
35
33
|
/** Hosts call this when the popup really closes, whoever set `visible`; the card is still mounted */
|
|
36
|
-
handlePopupClose()
|
|
34
|
+
handlePopupClose: () => void;
|
|
37
35
|
}
|
|
38
36
|
export {};
|
|
@@ -4,54 +4,54 @@ import isPromise from "../utils/is-promise.js";
|
|
|
4
4
|
var PopConfirmFoundation = class extends BaseFoundation {
|
|
5
5
|
#closeCount = 0;
|
|
6
6
|
#isOpen() {
|
|
7
|
-
return Boolean(this.
|
|
7
|
+
return Boolean(this.isControlledComponent("visible") ? this.getProps().visible : this.getStates().visible);
|
|
8
8
|
}
|
|
9
9
|
#closeIfUnchanged(closeCountAtStart) {
|
|
10
10
|
if (closeCountAtStart === this.#closeCount && this.#isOpen()) this.handleVisibleChange(false);
|
|
11
11
|
}
|
|
12
|
-
handleCancel(e) {
|
|
12
|
+
handleCancel = (e) => {
|
|
13
13
|
if (this.getStates().cancelLoading) return;
|
|
14
14
|
const closeCountAtStart = this.#closeCount;
|
|
15
|
-
const maybePromise = this.
|
|
15
|
+
const maybePromise = this.adapter.notifyCancel(e);
|
|
16
16
|
if (isPromise(maybePromise)) {
|
|
17
|
-
this.
|
|
17
|
+
this.adapter.updateCancelLoading(true);
|
|
18
18
|
maybePromise.then(() => {
|
|
19
19
|
this.#closeIfUnchanged(closeCountAtStart);
|
|
20
|
-
this.
|
|
20
|
+
this.adapter.updateCancelLoading(false);
|
|
21
21
|
}, () => {
|
|
22
|
-
this.
|
|
22
|
+
this.adapter.updateCancelLoading(false);
|
|
23
23
|
});
|
|
24
24
|
} else this.handleVisibleChange(false);
|
|
25
|
-
}
|
|
26
|
-
handleConfirm(e) {
|
|
25
|
+
};
|
|
26
|
+
handleConfirm = (e) => {
|
|
27
27
|
const closeCountAtStart = this.#closeCount;
|
|
28
|
-
const maybePromise = this.
|
|
28
|
+
const maybePromise = this.adapter.notifyConfirm(e);
|
|
29
29
|
if (isPromise(maybePromise)) {
|
|
30
|
-
this.
|
|
30
|
+
this.adapter.updateConfirmLoading(true);
|
|
31
31
|
maybePromise.then(() => {
|
|
32
|
-
this.
|
|
32
|
+
this.adapter.updateConfirmLoading(false);
|
|
33
33
|
this.#closeIfUnchanged(closeCountAtStart);
|
|
34
34
|
}, () => {
|
|
35
|
-
this.
|
|
35
|
+
this.adapter.updateConfirmLoading(false);
|
|
36
36
|
});
|
|
37
37
|
} else this.handleVisibleChange(false);
|
|
38
|
-
}
|
|
39
|
-
handleVisibleChange(visible) {
|
|
40
|
-
if (!this.
|
|
38
|
+
};
|
|
39
|
+
handleVisibleChange = (visible) => {
|
|
40
|
+
if (!this.isControlledComponent("visible") || !visible) this.adapter.setVisible(visible);
|
|
41
41
|
if (!visible) this.#closeCount++;
|
|
42
|
-
this.
|
|
43
|
-
}
|
|
42
|
+
this.adapter.notifyVisibleChange(visible);
|
|
43
|
+
};
|
|
44
44
|
/** Hosts call this when the popup really opens, whoever set `visible` */
|
|
45
|
-
handlePopupOpen() {
|
|
46
|
-
const { cancelButtonProps, okButtonProps } = this.
|
|
47
|
-
if (cancelButtonProps?.autoFocus && !cancelButtonProps.disabled) this.
|
|
48
|
-
else if (okButtonProps?.autoFocus && !okButtonProps.disabled) this.
|
|
49
|
-
}
|
|
45
|
+
handlePopupOpen = () => {
|
|
46
|
+
const { cancelButtonProps, okButtonProps } = this.adapter.getProps();
|
|
47
|
+
if (cancelButtonProps?.autoFocus && !cancelButtonProps.disabled) this.adapter.focusCancelButton();
|
|
48
|
+
else if (okButtonProps?.autoFocus && !okButtonProps.disabled) this.adapter.focusOkButton();
|
|
49
|
+
};
|
|
50
50
|
/** Hosts call this when the popup really closes, whoever set `visible`; the card is still mounted */
|
|
51
|
-
handlePopupClose() {
|
|
52
|
-
this.
|
|
51
|
+
handlePopupClose = () => {
|
|
52
|
+
this.adapter.setVisible(false);
|
|
53
53
|
this.#closeCount++;
|
|
54
|
-
this.
|
|
55
|
-
}
|
|
54
|
+
this.adapter.focusPrevFocusElement();
|
|
55
|
+
};
|
|
56
56
|
};
|
|
57
57
|
export { PopConfirmFoundation as default };
|
|
@@ -3,9 +3,6 @@ type StrokeSet = {
|
|
|
3
3
|
color: string;
|
|
4
4
|
};
|
|
5
5
|
export type StrokeArr = Array<StrokeSet>;
|
|
6
|
-
/**
|
|
7
|
-
* Picks the stroke color for `percent` from the color stops in `s`. The result is a CSS color expression
|
|
8
|
-
* (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render.
|
|
9
|
-
*/
|
|
6
|
+
/** The result is a CSS color expression (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render. */
|
|
10
7
|
export declare function generateColor(s: StrokeArr, percent: number, gradient: boolean): string | undefined;
|
|
11
8
|
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { strings } from "./constants.js";
|
|
2
2
|
// src/progress/generates.ts
|
|
3
3
|
const PALETTE_TOKEN = /^(?:(black|white)|(amber|blue|cyan|green|grey|indigo|light-blue|light-green|lime|orange|pink|purple|red|teal|violet|yellow)(?:-(\d))?)$/;
|
|
4
|
-
/**
|
|
5
|
-
* Picks the stroke color for `percent` from the color stops in `s`. The result is a CSS color expression
|
|
6
|
-
* (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render.
|
|
7
|
-
*/
|
|
4
|
+
/** The result is a CSS color expression (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render. */
|
|
8
5
|
function generateColor(s, percent, gradient) {
|
|
9
6
|
if (s.length === 0) return void 0;
|
|
10
7
|
const sorted = s.toSorted((a, b) => a.percent - b.percent);
|
package/dist/progress/utils.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export interface PercentAnimation {
|
|
|
14
14
|
/** Cancels the running tween; call on unmount */
|
|
15
15
|
stop: () => void;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
17
|
+
/** A new update or `stop` cancels the running tween */
|
|
18
18
|
export declare function createPercentAnimation(setShown: (value: number) => void): PercentAnimation;
|
package/dist/progress/utils.js
CHANGED
|
@@ -16,7 +16,7 @@ function calcCircleGeometry(diameter, strokeWidth, percent, indeterminate) {
|
|
|
16
16
|
strokeDashoffset: indeterminate ? 0 : (1 - percent / 100) * circumference
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
19
|
+
/** A new update or `stop` cancels the running tween */
|
|
20
20
|
function createPercentAnimation(setShown) {
|
|
21
21
|
let cancel;
|
|
22
22
|
const stop = () => {
|