@fibrae/semi-foundation 0.2.0 → 0.3.1
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/LICENSE +0 -62
- package/README.md +36 -34
- package/README.zh-CN.md +79 -0
- package/dist/anchor/foundation.d.ts +0 -3
- package/dist/anchor/foundation.js +0 -1
- package/dist/audio-player/foundation.d.ts +0 -3
- package/dist/audio-player/foundation.js +0 -1
- package/dist/auto-complete/foundation.d.ts +0 -2
- package/dist/auto-complete/foundation.js +0 -1
- package/dist/avatar/foundation.d.ts +0 -1
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +0 -3
- package/dist/backtop/foundation.js +0 -1
- package/dist/base/auto-close-foundation.d.ts +0 -1
- package/dist/base/foundation.d.ts +0 -1
- package/dist/base/list-store.d.ts +0 -1
- package/dist/calendar/event-util.d.ts +0 -10
- package/dist/calendar/event-util.js +0 -10
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +1 -5
- package/dist/calendar/month-foundation.d.ts +0 -1
- package/dist/calendar/month-foundation.js +0 -1
- package/dist/carousel/foundation.d.ts +0 -2
- package/dist/cascader/foundation.d.ts +2 -6
- package/dist/cascader/foundation.js +2 -11
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +1 -5
- package/dist/checkbox/checkbox-foundation.js +0 -2
- package/dist/checkbox/checkbox-group-foundation.d.ts +0 -1
- package/dist/code-highlight/index.d.ts +0 -1
- package/dist/color-picker/color-picker.scss +0 -2
- package/dist/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +0 -1
- package/dist/cropper/foundation.js +0 -1
- 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 +3 -22
- package/dist/date-picker/foundation.js +1 -24
- package/dist/date-picker/input-foundation.d.ts +1 -7
- package/dist/date-picker/input-foundation.js +0 -2
- 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 +1 -10
- package/dist/date-picker/months-grid-foundation.js +1 -10
- package/dist/drag-move/foundation.d.ts +0 -1
- package/dist/dropdown/foundation.d.ts +0 -2
- package/dist/dropdown/menu-foundation.d.ts +1 -2
- package/dist/feedback/foundation.d.ts +0 -1
- 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.scss +0 -12
- package/dist/form/foundation.js +0 -15
- 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 +0 -2
- package/dist/hot-keys/foundation.d.ts +0 -1
- package/dist/image/image-foundation.d.ts +0 -2
- package/dist/image/preview-footer-foundation.d.ts +0 -1
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-image-foundation.d.ts +0 -1
- package/dist/image/preview-inner-foundation.d.ts +0 -1
- package/dist/input/foundation.d.ts +0 -1
- package/dist/input/text-entry-foundation.d.ts +0 -2
- package/dist/input/text-entry-foundation.js +0 -1
- package/dist/input/textarea-foundation.d.ts +0 -1
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +0 -5
- package/dist/input-number/foundation.js +0 -5
- package/dist/json-viewer/foundation.d.ts +0 -2
- package/dist/json-viewer/foundation.js +0 -1
- package/dist/locale/interface.d.ts +0 -3
- package/dist/markdown-render/foundation.d.ts +1 -6
- package/dist/markdown-render/foundation.js +1 -5
- package/dist/navigation/foundation.d.ts +0 -7
- package/dist/navigation/foundation.js +0 -6
- package/dist/navigation/sub-nav-foundation.d.ts +0 -1
- package/dist/notification/notification-list-foundation.d.ts +2 -3
- package/dist/notification/notification-list-foundation.js +0 -1
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +0 -2
- package/dist/overflow-list/foundation.js +0 -1
- package/dist/pagination/foundation.d.ts +0 -2
- package/dist/pincode/foundation.d.ts +1 -4
- package/dist/pincode/foundation.js +1 -4
- package/dist/popconfirm/popconfirm-foundation.d.ts +0 -2
- 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 +0 -4
- package/dist/radio/radio-foundation.js +0 -1
- package/dist/radio/radio-group-foundation.d.ts +0 -1
- package/dist/rating/foundation.d.ts +0 -5
- package/dist/rating/foundation.js +0 -3
- package/dist/resizable/group/index.d.ts +0 -4
- package/dist/resizable/group/index.js +0 -4
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +1 -5
- package/dist/resizable/single/index.js +1 -4
- package/dist/scroll-list/item-foundation.d.ts +0 -2
- package/dist/scroll-list/item-foundation.js +0 -1
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +0 -1
- package/dist/select/option-foundation.d.ts +2 -3
- package/dist/select/option-foundation.js +0 -1
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +1 -6
- package/dist/side-sheet/side-sheet-foundation.js +1 -5
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +1 -12
- package/dist/slider/foundation.js +1 -13
- package/dist/slider/variables.scss +1 -5
- package/dist/spin/foundation.d.ts +0 -2
- package/dist/spin/foundation.js +0 -1
- package/dist/spin/variables.scss +1 -3
- package/dist/switch/foundation.d.ts +0 -1
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +12 -21
- package/dist/table/foundation.js +51 -15
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +0 -8
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +0 -9
- package/dist/tabs/foundation.js +0 -4
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +0 -2
- package/dist/tag-input/foundation.js +0 -1
- 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 +0 -10
- package/dist/time-picker/foundation.js +0 -9
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- 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 +0 -3
- package/dist/tooltip/foundation.js +0 -2
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +0 -4
- package/dist/transfer/foundation.js +0 -1
- package/dist/tree/foundation.d.ts +0 -2
- package/dist/tree/foundation.js +0 -1
- package/dist/tree/shared.d.ts +1 -3
- 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 +0 -2
- package/dist/tree-select/foundation.js +0 -3
- package/dist/typography/ellipsis.d.ts +1 -3
- package/dist/typography/ellipsis.js +0 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +0 -6
- package/dist/upload/foundation.js +1 -11
- package/dist/upload/utils.d.ts +0 -5
- package/dist/upload/utils.js +0 -5
- package/dist/user-guide/foundation.d.ts +0 -2
- package/dist/utils/a11y.d.ts +1 -5
- package/dist/utils/a11y.js +1 -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 +0 -1
- package/dist/utils/focus-handle.js +0 -1
- package/dist/utils/focus-scope.d.ts +0 -1
- package/dist/utils/focus-scope.js +0 -1
- 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/progress-foundation.d.ts +0 -1
- package/dist/video-player/progress-foundation.js +0 -1
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
|
@@ -11,13 +11,10 @@ export interface MotionView {
|
|
|
11
11
|
export type MotionViewInput = Pick<MotionView, 'activeKey' | 'propsActiveKey' | 'paneKeys'>;
|
|
12
12
|
/** The members of a keyboard event the foundation reads; DOM and synthetic events both satisfy it */
|
|
13
13
|
export type TabKeyEvent = Pick<KeyboardEvent, 'key' | 'altKey' | 'ctrlKey' | 'metaKey' | 'target' | 'currentTarget' | 'preventDefault' | 'stopPropagation'>;
|
|
14
|
-
/** What a pane's slide-in depends on */
|
|
15
14
|
export interface PaneMotionInput {
|
|
16
15
|
itemKey?: string;
|
|
17
16
|
activeKey: string | null;
|
|
18
|
-
/** The key selected before activeKey, null on mount */
|
|
19
17
|
prevActiveKey: string | null;
|
|
20
|
-
/** The itemKeys of the panes in order */
|
|
21
18
|
paneKeys: ReadonlyArray<string | undefined>;
|
|
22
19
|
tabPosition: 'top' | 'left';
|
|
23
20
|
tabPaneMotion: boolean;
|
|
@@ -35,20 +32,17 @@ interface TabEntry {
|
|
|
35
32
|
itemKey?: string;
|
|
36
33
|
disabled?: boolean;
|
|
37
34
|
}
|
|
38
|
-
/** The props the foundation reads */
|
|
39
35
|
export interface TabsBaseProps {
|
|
40
36
|
activeKey?: string | null;
|
|
41
37
|
tabPosition?: 'top' | 'left';
|
|
42
38
|
preventScroll?: boolean;
|
|
43
39
|
}
|
|
44
|
-
/** The state the foundation reads */
|
|
45
40
|
export interface TabsBaseState {
|
|
46
41
|
activeKey: string | null;
|
|
47
42
|
}
|
|
48
43
|
export default class TabsFoundation<P extends TabsBaseProps = TabsBaseProps, S extends TabsBaseState = TabsBaseState, E = unknown> extends BaseFoundation<TabsAdapter<P, S, E>, P, S> {
|
|
49
44
|
#private;
|
|
50
45
|
protected handleNewActiveKey(activeKey: string | null): void;
|
|
51
|
-
/** activeKey, else defaultActiveKey, else the first enabled entry of `list` that has a key */
|
|
52
46
|
static getDefaultActiveKey(props: {
|
|
53
47
|
activeKey?: string | null;
|
|
54
48
|
defaultActiveKey?: string;
|
|
@@ -58,14 +52,12 @@ export default class TabsFoundation<P extends TabsBaseProps = TabsBaseProps, S e
|
|
|
58
52
|
* null, matches no tab, or the tab sits in the more menu), the first enabled one takes it.
|
|
59
53
|
*/
|
|
60
54
|
static getTabbableKey(tabs: ReadonlyArray<TabEntry>, activeKey: string | null): string | undefined;
|
|
61
|
-
/** The slide-in class of a pane and whether it plays: only the selected pane slides, from the side of the previous one */
|
|
62
55
|
static getPaneMotion({ itemKey, activeKey, prevActiveKey, paneKeys, tabPosition, tabPaneMotion, forceDisableMotion }: PaneMotionInput): {
|
|
63
56
|
startClassName: string;
|
|
64
57
|
hasMotion: boolean;
|
|
65
58
|
};
|
|
66
59
|
/** The next MotionView; `prev` itself when nothing it records changed, so hosts can compare by reference */
|
|
67
60
|
static getMotionView(prev: MotionView | undefined, { activeKey, propsActiveKey, paneKeys }: MotionViewInput): MotionView;
|
|
68
|
-
/** Splits `list` into the tabs that stay in the bar and the last `more` ones (or `more.count`) that move into the menu */
|
|
69
61
|
static splitMore<T>(list: readonly T[], more: number | {
|
|
70
62
|
count: number;
|
|
71
63
|
}): {
|
|
@@ -76,7 +68,6 @@ export default class TabsFoundation<P extends TabsBaseProps = TabsBaseProps, S e
|
|
|
76
68
|
static isTabsOverflowing(barEl: HTMLElement, tabPosition?: 'top' | 'left'): boolean;
|
|
77
69
|
/** `barItemKey` is the data-scrollkey of the tab, see getBarItemKey */
|
|
78
70
|
static scrollTabIntoView(barEl: HTMLElement | null | undefined, barItemKey: string, position?: ScrollLogicalPosition, behavior?: ScrollBehavior): void;
|
|
79
|
-
/** Re-keys the OverflowList visibility map by itemKey; `hasHidden` and `isShowInViewport` summarize it */
|
|
80
71
|
static readVisibleState(visibleMap: ReadonlyMap<string, boolean>): {
|
|
81
72
|
visibleState: Map<string, boolean>;
|
|
82
73
|
isShowInViewport: boolean;
|
package/dist/tabs/foundation.js
CHANGED
|
@@ -57,7 +57,6 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
57
57
|
const { activeKey: stateActiveKey } = this.getStates();
|
|
58
58
|
if (stateActiveKey !== activeKey) this.adapter.setNewActiveKey(activeKey);
|
|
59
59
|
}
|
|
60
|
-
/** activeKey, else defaultActiveKey, else the first enabled entry of `list` that has a key */
|
|
61
60
|
static getDefaultActiveKey(props, list) {
|
|
62
61
|
if (props.activeKey !== void 0) return props.activeKey;
|
|
63
62
|
if (props.defaultActiveKey !== void 0) return props.defaultActiveKey;
|
|
@@ -71,7 +70,6 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
71
70
|
if (tabs.some((tab) => tab.itemKey === activeKey)) return;
|
|
72
71
|
return tabs.find((tab) => !tab.disabled)?.itemKey;
|
|
73
72
|
}
|
|
74
|
-
/** The slide-in class of a pane and whether it plays: only the selected pane slides, from the side of the previous one */
|
|
75
73
|
static getPaneMotion({ itemKey, activeKey, prevActiveKey, paneKeys, tabPosition, tabPaneMotion, forceDisableMotion }) {
|
|
76
74
|
const activeIndex = activeKey === null ? -1 : paneKeys.indexOf(activeKey);
|
|
77
75
|
const itemIndex = itemKey === void 0 ? -1 : paneKeys.indexOf(itemKey);
|
|
@@ -100,7 +98,6 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
100
98
|
forceDisableMotion: propsActiveKey === prev.propsActiveKey ? prev.forceDisableMotion : paneKeys.includes(propsActiveKey) && !prev.paneKeys.includes(propsActiveKey)
|
|
101
99
|
};
|
|
102
100
|
}
|
|
103
|
-
/** Splits `list` into the tabs that stay in the bar and the last `more` ones (or `more.count`) that move into the menu */
|
|
104
101
|
static splitMore(list, more) {
|
|
105
102
|
if (typeof more !== "number" && typeof more !== "object") throw new Error("[Semi Tabs]: invalid tab props format: more");
|
|
106
103
|
const keep = list.length - Math.min(typeof more === "number" ? more : more.count, list.length);
|
|
@@ -126,7 +123,6 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
126
123
|
inline: position
|
|
127
124
|
});
|
|
128
125
|
}
|
|
129
|
-
/** Re-keys the OverflowList visibility map by itemKey; `hasHidden` and `isShowInViewport` summarize it */
|
|
130
126
|
static readVisibleState(visibleMap) {
|
|
131
127
|
const visibleState = new Map([...visibleMap].map(([barItemKey, visible]) => [getItemKeyByBarItemKey(barItemKey), visible]));
|
|
132
128
|
const visibles = [...visibleState.values()];
|
package/dist/tabs/tabs.scss
CHANGED
|
@@ -56,12 +56,12 @@ $ignoreIcon: '.#{$prefix}-icon-checkbox_tick, .#{$prefix}-icon-radio, .#{$prefix
|
|
|
56
56
|
display: flex;
|
|
57
57
|
align-content: center;
|
|
58
58
|
|
|
59
|
+
// :not(:not(&-icon)) outranks the generic icon rules
|
|
59
60
|
&-icon:not(:not(&-icon)) {
|
|
60
61
|
display: flex;
|
|
61
62
|
flex-shrink: 0;
|
|
62
63
|
align-items: center;
|
|
63
64
|
margin-inline: $spacing-tabs_tab-more_trigger_icon-marginLeft $spacing-tabs_tab-more_trigger_icon-marginRight;
|
|
64
|
-
// :not(:not(&-icon)) outranks the generic icon rules
|
|
65
65
|
margin-top: $spacing-tabs_tab-more_trigger_icon-marginTop;
|
|
66
66
|
margin-bottom: $spacing-tabs_tab-more_trigger_icon-marginBottom;
|
|
67
67
|
}
|
package/dist/tag/focus.js
CHANGED
|
@@ -5,7 +5,6 @@ const tagCls = cssClasses.PREFIX;
|
|
|
5
5
|
function isReachableTag(node) {
|
|
6
6
|
return node instanceof HTMLElement && node.matches(`.${tagCls}:not(.${tagCls}-invisible)`) && node.tabIndex >= 0;
|
|
7
7
|
}
|
|
8
|
-
/** Prefers the following tag, falling back to the preceding one. */
|
|
9
8
|
function findAdjacentTag(tag) {
|
|
10
9
|
for (let node = tag.nextElementSibling; node; node = node.nextElementSibling) if (isReachableTag(node)) return node;
|
|
11
10
|
for (let node = tag.previousElementSibling; node; node = node.previousElementSibling) if (isReachableTag(node)) return node;
|
|
@@ -13,7 +13,6 @@ export interface TagSortIds {
|
|
|
13
13
|
ids: string[];
|
|
14
14
|
move?: OnSortEndProps;
|
|
15
15
|
}
|
|
16
|
-
/** The props the foundation reads with getProps */
|
|
17
16
|
export interface TagInputBaseProps {
|
|
18
17
|
value?: string[] | null;
|
|
19
18
|
inputValue?: string;
|
|
@@ -65,7 +64,6 @@ export default class TagInputFoundation<P extends TagInputBaseProps = TagInputBa
|
|
|
65
64
|
* values return `prev` itself, so a caller can skip the update and an untaken sort stays pending.
|
|
66
65
|
*/
|
|
67
66
|
static getSortIds(values: string[], prev?: TagSortIds): TagSortIds;
|
|
68
|
-
/** The input text on screen: a string `inputValue` prop wins over state */
|
|
69
67
|
static getInputValue(props: {
|
|
70
68
|
inputValue?: string;
|
|
71
69
|
}, state: {
|
|
@@ -107,7 +107,6 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
107
107
|
ids: values.map((value) => unused.get(value)?.shift() ?? newId(value))
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
/** The input text on screen: a string `inputValue` prop wins over state */
|
|
111
110
|
static getInputValue(props, state) {
|
|
112
111
|
return typeof props.inputValue === "string" ? props.inputValue : state.inputValue;
|
|
113
112
|
}
|
|
@@ -5,7 +5,6 @@ import { tabbable } from "tabbable";
|
|
|
5
5
|
function tagStops(wrapper) {
|
|
6
6
|
return tabbable(wrapper, { displayCheck: "none" }).filter((node) => !node.closest(`.${cssClasses.PREFIX}-wrapper-input, .${cssClasses.PREFIX}-sortable-handle`));
|
|
7
7
|
}
|
|
8
|
-
/** The place of the focused element among the tags' tab stops in the TagInput's wrapper, or -1 */
|
|
9
8
|
function getFocusedTagStop(wrapper) {
|
|
10
9
|
return wrapper ? tagStops(wrapper).indexOf(FocusTrapHandle.getActiveElement(wrapper)) : -1;
|
|
11
10
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type TimeStamp = Date | string | number;
|
|
2
2
|
export type ColumnType = 'ampm' | 'hour' | 'minute' | 'second';
|
|
3
|
-
/** The props one time panel is computed from */
|
|
4
3
|
export interface ComboboxBaseProps {
|
|
5
4
|
timeStampValue?: TimeStamp;
|
|
6
5
|
format?: string;
|
|
@@ -19,17 +18,15 @@ export declare function formatOption(option: number, disabledOptions: number[]):
|
|
|
19
18
|
value: string;
|
|
20
19
|
disabled: boolean;
|
|
21
20
|
};
|
|
22
|
-
/** Pure calculations for one time panel: which columns show, what each lists, and the time a picked item makes */
|
|
23
21
|
export default class ComboboxFoundation {
|
|
24
|
-
/** The columns `format` asks for */
|
|
25
22
|
static getColumns(format: string): {
|
|
26
23
|
showHour: boolean;
|
|
27
24
|
showMinute: boolean;
|
|
28
25
|
showSecond: boolean;
|
|
29
26
|
};
|
|
30
27
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* Every column reads the shown time (midnight, or noon in a PM panel, while there is no value), the time a picked
|
|
29
|
+
* item is applied to.
|
|
33
30
|
*/
|
|
34
31
|
static getOptions(props: ComboboxBaseProps): {
|
|
35
32
|
isAM: boolean;
|
|
@@ -58,10 +55,7 @@ export default class ComboboxFoundation {
|
|
|
58
55
|
showMinute: boolean;
|
|
59
56
|
showSecond: boolean;
|
|
60
57
|
};
|
|
61
|
-
/**
|
|
62
|
-
* The time after picking `itemValue` in column `type`. A 12-hour hour keeps the half day `isAM` names; AM/PM moves
|
|
63
|
-
* the time by 12 hours only when it is in the other half day.
|
|
64
|
-
*/
|
|
58
|
+
/** A 12-hour hour keeps the half day `isAM` names; AM/PM moves the time by 12 hours only when it is in the other half day */
|
|
65
59
|
static applyItem(timeStampValue: TimeStamp, type: ColumnType, itemValue: string, use12Hours: boolean, isAM: boolean): Date;
|
|
66
60
|
/**
|
|
67
61
|
* `disabledHours()`, mapped onto the 12-hour column of the half day `isAM` names when `use12Hours`; the hours of
|
|
@@ -70,10 +64,8 @@ export default class ComboboxFoundation {
|
|
|
70
64
|
static getDisabledHours({ use12Hours, disabledHours, isAM }: Pick<ComboboxBaseProps, 'use12Hours' | 'disabledHours'> & {
|
|
71
65
|
isAM?: boolean;
|
|
72
66
|
}): number[];
|
|
73
|
-
/** The half day of the value; `defaultIsAM` applies while there is no value */
|
|
74
67
|
static isAM(timeStamp: TimeStamp, defaultIsAM?: boolean): boolean;
|
|
75
68
|
/** A timestamp of 0 is a value; only nothing and '' are not */
|
|
76
69
|
static hasValue(timeStamp: unknown): boolean;
|
|
77
|
-
/** The time a panel shows; without a value, today's midnight, or noon when the panel shows PM */
|
|
78
70
|
static getDisplayDateFromTimeStamp(timeStamp: TimeStamp, defaultIsPM?: boolean): Date;
|
|
79
71
|
}
|
|
@@ -19,9 +19,7 @@ function toColumn(options, disabledOptions, selected) {
|
|
|
19
19
|
selectedIndex: options.indexOf(selected)
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
/** Pure calculations for one time panel: which columns show, what each lists, and the time a picked item makes */
|
|
23
22
|
var ComboboxFoundation = class ComboboxFoundation {
|
|
24
|
-
/** The columns `format` asks for */
|
|
25
23
|
static getColumns(format) {
|
|
26
24
|
return {
|
|
27
25
|
showHour: /HH|hh|H|h/.test(format),
|
|
@@ -30,8 +28,8 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* Every column reads the shown time (midnight, or noon in a PM panel, while there is no value), the time a picked
|
|
32
|
+
* item is applied to.
|
|
35
33
|
*/
|
|
36
34
|
static getOptions(props) {
|
|
37
35
|
const { timeStampValue, use12Hours, hourStep, disabledMinutes, disabledSeconds, hideDisabledOptions, minuteStep, secondStep } = props;
|
|
@@ -57,10 +55,7 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
57
55
|
second: toColumn(secondOptions, disabledSecondOptions, dateTime.getSeconds())
|
|
58
56
|
};
|
|
59
57
|
}
|
|
60
|
-
/**
|
|
61
|
-
* The time after picking `itemValue` in column `type`. A 12-hour hour keeps the half day `isAM` names; AM/PM moves
|
|
62
|
-
* the time by 12 hours only when it is in the other half day.
|
|
63
|
-
*/
|
|
58
|
+
/** A 12-hour hour keeps the half day `isAM` names; AM/PM moves the time by 12 hours only when it is in the other half day */
|
|
64
59
|
static applyItem(timeStampValue, type, itemValue, use12Hours, isAM) {
|
|
65
60
|
const date = ComboboxFoundation.getDisplayDateFromTimeStamp(timeStampValue, use12Hours && !isAM);
|
|
66
61
|
const hours = date.getHours();
|
|
@@ -83,7 +78,6 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
83
78
|
if (use12Hours && Array.isArray(disabledOptions)) return disabledOptions.filter((h) => h < 12 === Boolean(isAM)).map((h) => h % 12 || 12);
|
|
84
79
|
return disabledOptions;
|
|
85
80
|
}
|
|
86
|
-
/** The half day of the value; `defaultIsAM` applies while there is no value */
|
|
87
81
|
static isAM(timeStamp, defaultIsAM = true) {
|
|
88
82
|
return ComboboxFoundation.hasValue(timeStamp) ? ComboboxFoundation.getDisplayDateFromTimeStamp(timeStamp).getHours() < 12 : defaultIsAM;
|
|
89
83
|
}
|
|
@@ -91,7 +85,6 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
91
85
|
static hasValue(timeStamp) {
|
|
92
86
|
return timeStamp != null && timeStamp !== "" && isValidDate(new Date(timeStamp));
|
|
93
87
|
}
|
|
94
|
-
/** The time a panel shows; without a value, today's midnight, or noon when the panel shows PM */
|
|
95
88
|
static getDisplayDateFromTimeStamp(timeStamp, defaultIsPM = false) {
|
|
96
89
|
if (!ComboboxFoundation.hasValue(timeStamp)) {
|
|
97
90
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -17,7 +17,6 @@ export interface TimePickerAdapter<P extends TimePickerBaseProps = TimePickerBas
|
|
|
17
17
|
/** focuses the input, or the focus target of a custom trigger */
|
|
18
18
|
setTriggerFocus: () => void;
|
|
19
19
|
}
|
|
20
|
-
/** The props the foundation reads with getProp */
|
|
21
20
|
export interface TimePickerBaseProps {
|
|
22
21
|
dateFnsLocale?: Locale;
|
|
23
22
|
disabled?: boolean;
|
|
@@ -53,10 +52,6 @@ export default class TimePickerFoundation<P extends TimePickerBaseProps = TimePi
|
|
|
53
52
|
protected validateDates(dates?: Array<Date>): boolean;
|
|
54
53
|
protected formatValue(dates: Date[]): string;
|
|
55
54
|
protected parseInput(str: string): Date[];
|
|
56
|
-
/**
|
|
57
|
-
* The format in use: the `format` prop when not `undefined`, else the 12- or 24-hour default; a value that is
|
|
58
|
-
* not a string falls back to the 24-hour default
|
|
59
|
-
*/
|
|
60
55
|
static getValidFormat(props: Record<string, any>): string;
|
|
61
56
|
/**
|
|
62
57
|
* The disabled-time callbacks of one panel, as the panel lists and validation both use them. `disabledTime` is
|
|
@@ -67,7 +62,6 @@ export default class TimePickerFoundation<P extends TimePickerBaseProps = TimePi
|
|
|
67
62
|
static getPosition(props: Record<string, any>, direction?: string): Position;
|
|
68
63
|
/** A controlled `open` is not copied into state, so the shown panel comes from props when they carry it; a disabled picker shows none */
|
|
69
64
|
static isPanelShown(props: Record<string, any>, state: Record<string, any>): boolean;
|
|
70
|
-
/** The value and input text of the first render, from `value` or else `defaultValue` */
|
|
71
65
|
static getInitialState(props: Record<string, any>): {
|
|
72
66
|
value: Date[];
|
|
73
67
|
inputValue: string;
|
|
@@ -76,10 +70,6 @@ export default class TimePickerFoundation<P extends TimePickerBaseProps = TimePi
|
|
|
76
70
|
handlePanelChange: (result: {
|
|
77
71
|
timeStampValue: number;
|
|
78
72
|
}, index?: number) => void;
|
|
79
|
-
/**
|
|
80
|
-
* Derives the value, input text and validity state from a `value` prop. With `prevTimeZone`, `value` is the
|
|
81
|
-
* shown value in that zone and is re-zoned into `timeZone`.
|
|
82
|
-
*/
|
|
83
73
|
syncValueFromProps: ({ value, timeZone, prevTimeZone }: {
|
|
84
74
|
value: TimeValue | (TimeValue | undefined)[];
|
|
85
75
|
timeZone?: string | number;
|
|
@@ -101,10 +101,6 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
101
101
|
if (str && typeof str === "string") return str.split(rangeSeparator).map((v) => parseToDate(v, validFormat, dateFnsLocale));
|
|
102
102
|
return [];
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
* The format in use: the `format` prop when not `undefined`, else the 12- or 24-hour default; a value that is
|
|
106
|
-
* not a string falls back to the 24-hour default
|
|
107
|
-
*/
|
|
108
104
|
static getValidFormat(props) {
|
|
109
105
|
let _format = props.format;
|
|
110
106
|
if (_format === void 0) _format = props.use12Hours ? strings.DEFAULT_FORMAT_A : strings.DEFAULT_FORMAT;
|
|
@@ -132,7 +128,6 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
132
128
|
static isPanelShown(props, state) {
|
|
133
129
|
return (props.open !== void 0 ? Boolean(props.open) : Boolean(state.open)) && !props.disabled;
|
|
134
130
|
}
|
|
135
|
-
/** The value and input text of the first render, from `value` or else `defaultValue` */
|
|
136
131
|
static getInitialState(props) {
|
|
137
132
|
const value = props.value === void 0 ? props.defaultValue : props.value;
|
|
138
133
|
const dates = TimePickerFoundation.#parseDates(value, props, props.timeZone);
|
|
@@ -161,10 +156,6 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
161
156
|
if (this.#hasChanged(value, oldValue)) this.#notifyChange(value, inputValue);
|
|
162
157
|
}
|
|
163
158
|
};
|
|
164
|
-
/**
|
|
165
|
-
* Derives the value, input text and validity state from a `value` prop. With `prevTimeZone`, `value` is the
|
|
166
|
-
* shown value in that zone and is re-zoned into `timeZone`.
|
|
167
|
-
*/
|
|
168
159
|
syncValueFromProps = ({ value, timeZone, prevTimeZone }) => {
|
|
169
160
|
const dates = TimePickerFoundation.#parseDates(value, this.getProps(), timeZone, prevTimeZone);
|
|
170
161
|
this.setState({
|
|
@@ -4,15 +4,4 @@ export declare function hourIsDisabled(disabledHours: () => number[], hour: numb
|
|
|
4
4
|
export declare function minuteIsDisabled(disabledMinutes: (hour: number) => number[], hour: number, minute: number): boolean;
|
|
5
5
|
export declare function secondIsDisabled(disabledSeconds: (hour: number, minute: number) => number[], hour: number, minute: number, second: number): boolean;
|
|
6
6
|
export declare function transformToArray<T>(value: T[]): T[];
|
|
7
|
-
/**
|
|
8
|
-
* Determine whether the time length is the same as the format
|
|
9
|
-
* e.g.
|
|
10
|
-
* format | time | return
|
|
11
|
-
* HH:mm | 12:00 | true
|
|
12
|
-
* HH:mm:ss | 12:00:00 | true
|
|
13
|
-
* yyyy HH:mm | 2021 12:00| true
|
|
14
|
-
* HH | 1 | false
|
|
15
|
-
* HH:mm | 12:0 | false
|
|
16
|
-
* HH:mm:ss | 12:00:0 | false
|
|
17
|
-
*/
|
|
18
7
|
export declare function isTimeFormatLike(time: string, formatToken: string): boolean;
|
|
@@ -32,17 +32,6 @@ function secondIsDisabled(disabledSeconds, hour, minute, second) {
|
|
|
32
32
|
function transformToArray(value) {
|
|
33
33
|
return Array.isArray(value) ? [...value] : [];
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Determine whether the time length is the same as the format
|
|
37
|
-
* e.g.
|
|
38
|
-
* format | time | return
|
|
39
|
-
* HH:mm | 12:00 | true
|
|
40
|
-
* HH:mm:ss | 12:00:00 | true
|
|
41
|
-
* yyyy HH:mm | 2021 12:00| true
|
|
42
|
-
* HH | 1 | false
|
|
43
|
-
* HH:mm | 12:0 | false
|
|
44
|
-
* HH:mm:ss | 12:00:0 | false
|
|
45
|
-
*/
|
|
46
35
|
function isTimeFormatLike(time, formatToken) {
|
|
47
36
|
let isLike = true;
|
|
48
37
|
const dateFnsSupportFormatCh = "BDEGHKLMOPQRSTXYabcehimopqstuwxyz";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Only rects and numbers go in (no DOM, window or class instance), so it can be table-tested.
|
|
3
3
|
*/
|
|
4
4
|
export interface AdjustRect {
|
|
5
5
|
left: number;
|
|
@@ -21,7 +21,6 @@ export interface AdjustPositionInput {
|
|
|
21
21
|
triggerRect: AdjustRect;
|
|
22
22
|
/** popup size, nothing is adjusted when width or height is 0 */
|
|
23
23
|
wrapperRect: Pick<AdjustRect, 'width' | 'height'>;
|
|
24
|
-
/** rect of the popup container */
|
|
25
24
|
containerRect: Pick<AdjustRect, 'left' | 'right' | 'top' | 'bottom'>;
|
|
26
25
|
viewport: {
|
|
27
26
|
width: number;
|
|
@@ -8,7 +8,6 @@ export declare const strings: {
|
|
|
8
8
|
readonly STATUS_LOADING: "loading";
|
|
9
9
|
readonly LEAVE_DELAY_WARNING: "[Semi Tooltip] 'mouseLeaveDelay' cannot be less than 'mouseEnterDelay', which may cause the dropdown layer to not be hidden.";
|
|
10
10
|
};
|
|
11
|
-
/** The DOM event names the trigger and popup listeners bind to */
|
|
12
11
|
export declare const TRIGGER_EVENT_NAMES: {
|
|
13
12
|
readonly mouseEnter: "mouseenter";
|
|
14
13
|
readonly mouseLeave: "mouseleave";
|
|
@@ -21,7 +20,6 @@ export declare const TRIGGER_EVENT_NAMES: {
|
|
|
21
20
|
readonly contextMenu: "contextmenu";
|
|
22
21
|
};
|
|
23
22
|
export declare const canRoleCarryPopupState: (role: string) => boolean;
|
|
24
|
-
/** Whether a wrapper around a trigger with this `display` must fill the width */
|
|
25
23
|
export declare const isBlockDisplay: (display?: string) => boolean;
|
|
26
24
|
/**
|
|
27
25
|
* Whether a disabled or loading trigger gets a wrapper span that takes the pointer events: a loading Button
|
|
@@ -30,7 +28,6 @@ export declare const isBlockDisplay: (display?: string) => boolean;
|
|
|
30
28
|
export declare const wrapsSpecialTrigger: (trigger: string | undefined, loading: boolean) => boolean;
|
|
31
29
|
/** The forced light and dark areas; the popup leaves the trigger's subtree, so it copies the innermost one around it */
|
|
32
30
|
export declare const COLOR_SCHEME_SELECTOR = ".semi-always-dark, .semi-always-light";
|
|
33
|
-
/** The class that keeps a popup in the scheme of `area`, the innermost COLOR_SCHEME_SELECTOR element around the trigger */
|
|
34
31
|
export declare const colorSchemeOf: (area?: Element | null) => "semi-always-dark" | "semi-always-light";
|
|
35
32
|
/**
|
|
36
33
|
* Where a popup opened from a trigger in `root` is inserted: the shadow root, else body, so forms, labels and inherited
|
|
@@ -31,7 +31,6 @@ const strings = {
|
|
|
31
31
|
STATUS_LOADING: "loading",
|
|
32
32
|
LEAVE_DELAY_WARNING: "[Semi Tooltip] 'mouseLeaveDelay' cannot be less than 'mouseEnterDelay', which may cause the dropdown layer to not be hidden."
|
|
33
33
|
};
|
|
34
|
-
/** The DOM event names the trigger and popup listeners bind to */
|
|
35
34
|
const TRIGGER_EVENT_NAMES = {
|
|
36
35
|
mouseEnter: "mouseenter",
|
|
37
36
|
mouseLeave: "mouseleave",
|
|
@@ -60,7 +59,6 @@ const BLOCK_DISPLAYS = /* @__PURE__ */ new Set([
|
|
|
60
59
|
"grid"
|
|
61
60
|
]);
|
|
62
61
|
const canRoleCarryPopupState = (role) => POPUP_TRIGGER_ROLES.has(role);
|
|
63
|
-
/** Whether a wrapper around a trigger with this `display` must fill the width */
|
|
64
62
|
const isBlockDisplay = (display) => BLOCK_DISPLAYS.has(display);
|
|
65
63
|
/**
|
|
66
64
|
* Whether a disabled or loading trigger gets a wrapper span that takes the pointer events: a loading Button
|
|
@@ -71,7 +69,6 @@ const alwaysDark = `${BASE_CLASS_PREFIX}-always-dark`;
|
|
|
71
69
|
const alwaysLight = `${BASE_CLASS_PREFIX}-always-light`;
|
|
72
70
|
/** The forced light and dark areas; the popup leaves the trigger's subtree, so it copies the innermost one around it */
|
|
73
71
|
const COLOR_SCHEME_SELECTOR = `.${alwaysDark}, .${alwaysLight}`;
|
|
74
|
-
/** The class that keeps a popup in the scheme of `area`, the innermost COLOR_SCHEME_SELECTOR element around the trigger */
|
|
75
72
|
const colorSchemeOf = (area) => area ? area.classList.contains(alwaysDark) ? alwaysDark : alwaysLight : void 0;
|
|
76
73
|
/**
|
|
77
74
|
* Where a popup opened from a trigger in `root` is inserted: the shadow root, else body, so forms, labels and inherited
|
|
@@ -32,12 +32,10 @@ export interface TooltipAdapter<P extends TooltipBaseProps = TooltipBaseProps, S
|
|
|
32
32
|
getTriggerRect(): DOMRect | null;
|
|
33
33
|
/** The element getTriggerRect measures; null while unknown, and then every scroll repositions the popup */
|
|
34
34
|
getTriggerElement(): Element | null;
|
|
35
|
-
/** Starts observing every trigger element with `observer` */
|
|
36
35
|
observeTrigger(observer: ResizeObserver | IntersectionObserver): void;
|
|
37
36
|
unobserveTrigger(observer: ResizeObserver | IntersectionObserver): void;
|
|
38
37
|
}
|
|
39
38
|
export type Position = ArrayElement<typeof strings.POSITION_SET>;
|
|
40
|
-
/** The props the foundation reads with getProp */
|
|
41
39
|
export interface TooltipBaseProps {
|
|
42
40
|
arrowPointAtCenter?: boolean;
|
|
43
41
|
autoAdjustOverflow?: boolean;
|
|
@@ -62,7 +60,6 @@ export interface TooltipBaseProps {
|
|
|
62
60
|
trigger?: ArrayElement<typeof strings.TRIGGER_SET>;
|
|
63
61
|
visible?: boolean;
|
|
64
62
|
}
|
|
65
|
-
/** The state the foundation reads with getState */
|
|
66
63
|
export interface TooltipBaseState {
|
|
67
64
|
isInsert: boolean;
|
|
68
65
|
transitionState: 'enter' | 'leave' | '';
|
|
@@ -255,7 +255,6 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
255
255
|
this.#moveWatch?.observer.disconnect();
|
|
256
256
|
this.#moveWatch = null;
|
|
257
257
|
}
|
|
258
|
-
/** Reads the layout: the trigger, the popup size and the placement; null while there is nothing to place */
|
|
259
258
|
#measure(viewport) {
|
|
260
259
|
const popup = this.adapter.getPortalContainer();
|
|
261
260
|
const triggerRect = this.adapter.getTriggerRect();
|
|
@@ -298,7 +297,6 @@ var Tooltip = class Tooltip extends BaseFoundation {
|
|
|
298
297
|
viewport
|
|
299
298
|
};
|
|
300
299
|
}
|
|
301
|
-
/** Writes a measured layout to the popup unless it is already there */
|
|
302
300
|
#apply(layout) {
|
|
303
301
|
const popup = this.adapter.getPortalContainer();
|
|
304
302
|
if (!layout || !popup) return;
|
|
@@ -22,11 +22,9 @@ export interface BasicResolvedDataItem extends BasicDataItem {
|
|
|
22
22
|
_parent?: Omit<BasicGroupItem, 'children'>;
|
|
23
23
|
/** The nodes from the root to this one in treeList mode; underscored so it never collides with the caller's `path` */
|
|
24
24
|
_path?: Array<BasicDataItem>;
|
|
25
|
-
/** Whether the node has no children in treeList mode; underscored for the same reason as `_path` */
|
|
26
25
|
_isLeaf?: boolean;
|
|
27
26
|
}
|
|
28
27
|
export type BasicFilter = boolean | ((searchValue: string, item: BasicDataItem) => boolean);
|
|
29
|
-
/** The props the foundation reads with getProp */
|
|
30
28
|
export interface TransferBaseProps {
|
|
31
29
|
dataSource?: Array<object>;
|
|
32
30
|
defaultValue?: Array<number | string>;
|
|
@@ -39,7 +37,6 @@ export interface TransferBaseProps {
|
|
|
39
37
|
type?: string;
|
|
40
38
|
value?: Array<number | string>;
|
|
41
39
|
}
|
|
42
|
-
/** The state the foundation reads with getState */
|
|
43
40
|
export interface TransferBaseState {
|
|
44
41
|
inputValue: string;
|
|
45
42
|
leftCurrentPage: number;
|
|
@@ -103,7 +100,6 @@ export default class TransferFoundation<P extends TransferBaseProps = TransferBa
|
|
|
103
100
|
};
|
|
104
101
|
/** The item as handed to callbacks: internal fields (`_parent`, `_path`, `_isLeaf`) removed, `fullPath` added */
|
|
105
102
|
static toPublicItem(item: BasicResolvedDataItem, type: string, showPath: boolean): BasicResolvedDataItem;
|
|
106
|
-
/** The treeList path label shown with `showPath`, e.g. "Asia > China > Shanghai" */
|
|
107
103
|
static generatePath({ _path }: BasicResolvedDataItem): string;
|
|
108
104
|
handleInputChange: (inputVal: string, notify: boolean) => void;
|
|
109
105
|
handleAll: (wantAllChecked: boolean) => void;
|
|
@@ -108,7 +108,6 @@ var TransferFoundation = class TransferFoundation extends BaseFoundation {
|
|
|
108
108
|
fullPath
|
|
109
109
|
} : publicItem;
|
|
110
110
|
}
|
|
111
|
-
/** The treeList path label shown with `showPath`, e.g. "Asia > China > Shanghai" */
|
|
112
111
|
static generatePath({ _path = [] }) {
|
|
113
112
|
return _path.map((p) => p.label).join(" > ");
|
|
114
113
|
}
|
|
@@ -67,7 +67,6 @@ export interface BasicFlattenNode {
|
|
|
67
67
|
pos?: string;
|
|
68
68
|
value?: string;
|
|
69
69
|
}
|
|
70
|
-
/** `show` while rows expand, `hide` while they collapse */
|
|
71
70
|
export type TreeMotionType = 'show' | 'hide';
|
|
72
71
|
/** The values and the `smart` rule are those of the adapter's virtual list */
|
|
73
72
|
export type ScrollAlign = 'center' | 'start' | 'end' | 'smart' | 'auto';
|
|
@@ -270,7 +269,6 @@ export default class TreeFoundation<E = unknown> extends BaseFoundation<TreeAdap
|
|
|
270
269
|
* Returns null when nothing changed, so a host that writes the result back settles.
|
|
271
270
|
*/
|
|
272
271
|
static deriveState(props: BasicTreeProps, prevState: BasicTreeInnerData): Partial<BasicTreeInnerData> | null;
|
|
273
|
-
/** The state of a new tree: the empty state with what the props imply */
|
|
274
272
|
static getInitialState(props: BasicTreeProps): BasicTreeInnerData;
|
|
275
273
|
destroy(): void;
|
|
276
274
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
package/dist/tree/foundation.js
CHANGED
|
@@ -311,7 +311,6 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
|
|
|
311
311
|
newState.prevProps = { ...props };
|
|
312
312
|
return newState;
|
|
313
313
|
}
|
|
314
|
-
/** The state of a new tree: the empty state with what the props imply */
|
|
315
314
|
static getInitialState(props) {
|
|
316
315
|
const state = {
|
|
317
316
|
inputValue: "",
|
package/dist/tree/shared.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BasicFlattenNode, BasicTreeInnerData, BasicTreeNodeProps, BasicTreeProps, TreeMotionType } from "./foundation.js";
|
|
2
2
|
import { Typeahead } from "../utils/a11y.js";
|
|
3
3
|
type CheckState = Pick<BasicTreeInnerData, 'keyEntities' | 'checkedKeys' | 'halfCheckedKeys' | 'disabledKeys'>;
|
|
4
|
-
/** The props a tree node renders with */
|
|
5
4
|
export declare function getTreeNodeProps(key: string, { expandedKeys, selectedKeys, checkedKeys, halfCheckedKeys, realCheckedKeys, keyEntities, filteredKeys, inputValue, loadedKeys, loadingKeys, filteredExpandedKeys, filteredShownKeys, disabledKeys, treeData }: Partial<Omit<BasicTreeInnerData, 'prevProps'>>, props: Pick<BasicTreeProps, 'checkRelation' | 'disableStrictly' | 'showFilteredOnly'>): BasicTreeNodeProps | null;
|
|
6
5
|
/** Whether a node renders as a leaf, with no expand arrow; with loadData a node is a branch until it loads empty */
|
|
7
6
|
export declare function isTreeNodeLeaf({ isLeaf, children, loaded }: Pick<BasicTreeNodeProps, 'isLeaf' | 'children' | 'loaded'>, loadData: unknown): boolean;
|
|
@@ -23,13 +22,12 @@ export interface TreeRowAria {
|
|
|
23
22
|
'aria-selected'?: boolean;
|
|
24
23
|
'aria-setsize': number;
|
|
25
24
|
}
|
|
26
|
-
/** The treeitem attributes of a row: a multiple tree states each row's check, a single one its selection */
|
|
27
25
|
export declare function getTreeRowAria(row: BasicTreeNodeProps, { disabled, isLeaf, multiple }: {
|
|
28
26
|
disabled: boolean;
|
|
29
27
|
isLeaf: boolean;
|
|
30
28
|
multiple?: boolean;
|
|
31
29
|
}): TreeRowAria;
|
|
32
|
-
/**
|
|
30
|
+
/** `fullLabel` is whether a custom full label renders the row */
|
|
33
31
|
export interface TreeRowFlags {
|
|
34
32
|
disabled: boolean;
|
|
35
33
|
focused?: boolean;
|
package/dist/tree/shared.js
CHANGED
|
@@ -29,7 +29,6 @@ function getShownSiblings(entity, keyEntities, filteredShownKeys) {
|
|
|
29
29
|
}
|
|
30
30
|
return shown;
|
|
31
31
|
}
|
|
32
|
-
/** The props a tree node renders with */
|
|
33
32
|
function getTreeNodeProps(key, { expandedKeys = /* @__PURE__ */ new Set([]), selectedKeys = [], checkedKeys = /* @__PURE__ */ new Set([]), halfCheckedKeys = /* @__PURE__ */ new Set([]), realCheckedKeys = /* @__PURE__ */ new Set([]), keyEntities = {}, filteredKeys = /* @__PURE__ */ new Set([]), inputValue = "", loadedKeys = /* @__PURE__ */ new Set([]), loadingKeys = /* @__PURE__ */ new Set([]), filteredExpandedKeys = /* @__PURE__ */ new Set([]), filteredShownKeys = /* @__PURE__ */ new Set([]), disabledKeys = /* @__PURE__ */ new Set([]), treeData = [] }, props) {
|
|
34
33
|
const { checkRelation } = props;
|
|
35
34
|
const entity = keyEntities[key];
|
|
@@ -100,7 +99,6 @@ function buildRowProps(node, state, props) {
|
|
|
100
99
|
function nodeId(baseId, key) {
|
|
101
100
|
return `${baseId}-${encodeURIComponent(key)}`;
|
|
102
101
|
}
|
|
103
|
-
/** The treeitem attributes of a row: a multiple tree states each row's check, a single one its selection */
|
|
104
102
|
function getTreeRowAria(row, { disabled, isLeaf, multiple }) {
|
|
105
103
|
return {
|
|
106
104
|
"aria-busy": row.loading || void 0,
|
package/dist/tree/tree-util.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export interface KeyMapProps {
|
|
|
21
21
|
icon?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare function getPosition(parentPos: string, index: number): string;
|
|
24
|
-
/** Flattens nested tree data into a list, as the virtual list renders it. */
|
|
25
24
|
export declare function flattenTreeData(treeNodeList: any[], expandedKeys: Set<string>, keyMaps: KeyMapProps, filteredShownKeys?: boolean | Set<any>): any[];
|
|
26
25
|
export declare function convertJsonToData(treeJson: TreeDataSimpleJson): any[];
|
|
27
26
|
export interface TraversedNode {
|
|
@@ -53,10 +52,6 @@ export declare function calcMotionKeys(oldKeySet: Set<string>, newKeySet: Set<st
|
|
|
53
52
|
motionType: "show" | "hide";
|
|
54
53
|
motionKeys: string[];
|
|
55
54
|
};
|
|
56
|
-
/**
|
|
57
|
-
* @returns whether option includes searchValue.
|
|
58
|
-
* When filterTreeNode is a function,returns the result of filterTreeNode which called with (searchValue, target, option).
|
|
59
|
-
*/
|
|
60
55
|
export declare function matchTreeNode(searchValue: string, option: any, filterTreeNode: any, filterProps: any): any;
|
|
61
56
|
/** The node field a search keyword is matched against: the default 'label' follows keyMaps.label. */
|
|
62
57
|
export declare function getFilterProp(treeNodeFilterProp: string, keyMaps?: KeyMapProps): string;
|
package/dist/tree/tree-util.js
CHANGED
|
@@ -11,7 +11,6 @@ const DRAG_OFFSET = .45;
|
|
|
11
11
|
function getPosition(parentPos, index) {
|
|
12
12
|
return `${parentPos}-${index}`;
|
|
13
13
|
}
|
|
14
|
-
/** Flattens nested tree data into a list, as the virtual list renders it. */
|
|
15
14
|
function flattenTreeData(treeNodeList, expandedKeys, keyMaps, filteredShownKeys = false) {
|
|
16
15
|
const flattenList = [];
|
|
17
16
|
const filterSearch = Boolean(filteredShownKeys);
|
|
@@ -254,10 +253,6 @@ function calcMotionKeys(oldKeySet, newKeySet, keyEntities) {
|
|
|
254
253
|
motionKeys: diffKeys.length === 1 ? findDescendantKeys(diffKeys, keyEntities, false) : []
|
|
255
254
|
};
|
|
256
255
|
}
|
|
257
|
-
/**
|
|
258
|
-
* @returns whether option includes searchValue.
|
|
259
|
-
* When filterTreeNode is a function,returns the result of filterTreeNode which called with (searchValue, target, option).
|
|
260
|
-
*/
|
|
261
256
|
function matchTreeNode(searchValue, option, filterTreeNode, filterProps) {
|
|
262
257
|
if (!filterTreeNode) return true;
|
|
263
258
|
let filterFn = filterTreeNode;
|
|
@@ -124,7 +124,6 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
|
|
|
124
124
|
* that writes the result back settles.
|
|
125
125
|
*/
|
|
126
126
|
static deriveState(props: BasicTreeSelectProps, prevState: BasicTreeSelectInnerData): Partial<BasicTreeSelectInnerData> | null;
|
|
127
|
-
/** The state of a new TreeSelect: the empty state with what the props imply */
|
|
128
127
|
static getInitialState(props: BasicTreeSelectProps): BasicTreeSelectInnerData;
|
|
129
128
|
/** The keys the trigger shows: the selection, or in multiple mode the checked keys merged as onChange reports them */
|
|
130
129
|
static getTriggerKeys(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation' | 'autoMergeValue' | 'leafOnly'>, { checkedKeys, realCheckedKeys, keyEntities, selectedKeys }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys' | 'keyEntities'>): string[];
|
|
@@ -139,7 +138,6 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
|
|
|
139
138
|
init(): void;
|
|
140
139
|
/** Writes the state derived from new props back, so handlers read what was rendered */
|
|
141
140
|
syncDerivedState: (derived: Partial<BasicTreeSelectInnerData>) => void;
|
|
142
|
-
/** Searches as if `value` were typed, opening the dropdown first */
|
|
143
141
|
search: (value: string) => void;
|
|
144
142
|
/** Focus entering the trigger (its search input, tags, clear button) or the dropdown from outside */
|
|
145
143
|
handleTriggerFocus: (e: FocusEvent) => void;
|