@fibrae/semi-ui-svelte 0.9.0 → 0.10.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/README.md +8 -4
- package/README.zh-CN.md +8 -4
- package/dist/components/anchor/interface.d.ts +14 -0
- package/dist/components/audio-player/interface.d.ts +5 -0
- package/dist/components/auto-complete/interface.d.ts +29 -0
- package/dist/components/avatar/interface.d.ts +24 -0
- package/dist/components/backtop/interface.d.ts +2 -0
- package/dist/components/badge/interface.d.ts +7 -0
- package/dist/components/banner/interface.d.ts +7 -0
- package/dist/components/breadcrumb/interface.d.ts +10 -0
- package/dist/components/button/interface.d.ts +18 -0
- package/dist/components/calendar/interface.d.ts +16 -0
- package/dist/components/card/interface.d.ts +18 -0
- package/dist/components/carousel/interface.d.ts +16 -0
- package/dist/components/cascader/cascader.svelte +1 -0
- package/dist/components/cascader/interface.d.ts +57 -0
- package/dist/components/checkbox/interface.d.ts +19 -0
- package/dist/components/code-highlight/interface.d.ts +3 -0
- package/dist/components/collapse/interface.d.ts +16 -0
- package/dist/components/collapsible/interface.d.ts +10 -0
- package/dist/components/color-picker/interface.d.ts +10 -0
- package/dist/components/config-provider/interface.d.ts +7 -0
- package/dist/components/cropper/interface.d.ts +11 -0
- package/dist/components/date-picker/interface.d.ts +47 -0
- package/dist/components/descriptions/interface.d.ts +6 -0
- package/dist/components/divider/interface.d.ts +4 -0
- package/dist/components/dropdown/interface.d.ts +8 -0
- package/dist/components/empty/interface.d.ts +7 -0
- package/dist/components/feedback/interface.d.ts +16 -0
- package/dist/components/float-button/interface.d.ts +14 -0
- package/dist/components/form/interface.d.ts +47 -0
- package/dist/components/form/label.svelte +2 -2
- package/dist/components/grid/interface.d.ts +13 -0
- package/dist/components/highlight/interface.d.ts +7 -0
- package/dist/components/hot-keys/interface.d.ts +3 -0
- package/dist/components/image/interface.d.ts +59 -0
- package/dist/components/input/interface.d.ts +67 -0
- package/dist/components/input-number/interface.d.ts +24 -0
- package/dist/components/json-viewer/interface.d.ts +7 -0
- package/dist/components/layout/interface.d.ts +3 -0
- package/dist/components/list/interface.d.ts +18 -0
- package/dist/components/locale/interface.d.ts +4 -0
- package/dist/components/lottie/interface.d.ts +2 -0
- package/dist/components/markdown-render/interface.d.ts +5 -0
- package/dist/components/modal/interface.d.ts +29 -0
- package/dist/components/navigation/interface.d.ts +47 -0
- package/dist/components/overflow-list/interface.d.ts +11 -0
- package/dist/components/pagination/interface.d.ts +12 -0
- package/dist/components/pincode/interface.d.ts +8 -0
- package/dist/components/popconfirm/interface.d.ts +12 -0
- package/dist/components/popover/interface.d.ts +30 -0
- package/dist/components/progress/interface.d.ts +13 -0
- package/dist/components/radio/interface.d.ts +22 -0
- package/dist/components/rating/interface.d.ts +12 -0
- package/dist/components/resizable/interface.d.ts +30 -0
- package/dist/components/scroll-list/interface.d.ts +6 -0
- package/dist/components/select/interface.d.ts +63 -0
- package/dist/components/side-sheet/interface.d.ts +19 -0
- package/dist/components/skeleton/interface.d.ts +7 -0
- package/dist/components/slider/interface.d.ts +23 -0
- package/dist/components/space/interface.d.ts +4 -0
- package/dist/components/spin/interface.d.ts +7 -0
- package/dist/components/steps/interface.d.ts +9 -0
- package/dist/components/switch/interface.d.ts +7 -0
- package/dist/components/table/interface.d.ts +48 -0
- package/dist/components/tabs/interface.d.ts +29 -0
- package/dist/components/tag/interface.d.ts +22 -0
- package/dist/components/tag-input/interface.d.ts +29 -0
- package/dist/components/time-picker/interface.d.ts +31 -0
- package/dist/components/timeline/interface.d.ts +5 -0
- package/dist/components/tooltip/interface.d.ts +20 -0
- package/dist/components/tooltip/tooltip.svelte +3 -0
- package/dist/components/transfer/interface.d.ts +18 -0
- package/dist/components/tree/interface.d.ts +45 -0
- package/dist/components/tree-select/interface.d.ts +55 -0
- package/dist/components/typography/interface.d.ts +33 -0
- package/dist/components/upload/interface.d.ts +64 -0
- package/dist/components/user-guide/interface.d.ts +15 -0
- package/dist/components/video-player/interface.d.ts +22 -0
- package/dist/styles.css +1 -1
- package/docs/advanced/dark-mode.md +288 -0
- package/docs/basic/button.md +605 -0
- package/docs/basic/divider.md +103 -0
- package/docs/basic/float-button.md +246 -0
- package/docs/basic/grid.md +427 -0
- package/docs/basic/layout.md +459 -0
- package/docs/basic/resizable.md +584 -0
- package/docs/basic/space.md +163 -0
- package/docs/basic/tokens.md +425 -0
- package/docs/basic/typography.md +615 -0
- package/docs/changes-from-semi.md +105 -0
- package/docs/ecosystem/tailwind.md +210 -0
- package/docs/experience/accessibility.md +82 -0
- package/docs/experience/content-guidelines.md +819 -0
- package/docs/experience/internationalization.md +7 -0
- package/docs/feedback/banner.md +198 -0
- package/docs/feedback/feedback.md +294 -0
- package/docs/feedback/notification.md +401 -0
- package/docs/feedback/popconfirm.md +243 -0
- package/docs/feedback/progress.md +389 -0
- package/docs/feedback/skeleton.md +388 -0
- package/docs/feedback/spin.md +172 -0
- package/docs/feedback/toast.md +393 -0
- package/docs/input/auto-complete.md +399 -0
- package/docs/input/cascader.md +1558 -0
- package/docs/input/checkbox.md +408 -0
- package/docs/input/color-picker.md +175 -0
- package/docs/input/date-picker.md +942 -0
- package/docs/input/form.md +2550 -0
- package/docs/input/input-number.md +451 -0
- package/docs/input/input.md +640 -0
- package/docs/input/pincode.md +191 -0
- package/docs/input/radio.md +337 -0
- package/docs/input/rating.md +214 -0
- package/docs/input/select.md +1230 -0
- package/docs/input/slider.md +347 -0
- package/docs/input/switch.md +206 -0
- package/docs/input/tag-input.md +465 -0
- package/docs/input/time-picker.md +358 -0
- package/docs/input/transfer.md +1061 -0
- package/docs/input/tree-select.md +1300 -0
- package/docs/input/upload.md +1811 -0
- package/docs/llms.txt +147 -0
- package/docs/navigation/anchor.md +377 -0
- package/docs/navigation/backtop.md +100 -0
- package/docs/navigation/breadcrumb.md +284 -0
- package/docs/navigation/navigation.md +851 -0
- package/docs/navigation/pagination.md +217 -0
- package/docs/navigation/steps.md +315 -0
- package/docs/navigation/tabs.md +754 -0
- package/docs/navigation/tree.md +1956 -0
- package/docs/other/config-provider.md +599 -0
- package/docs/other/locale.md +353 -0
- package/docs/plus/audio-player.md +155 -0
- package/docs/plus/code-highlight.md +150 -0
- package/docs/plus/drag-move.md +214 -0
- package/docs/plus/hot-keys.md +174 -0
- package/docs/plus/json-viewer.md +392 -0
- package/docs/plus/lottie.md +176 -0
- package/docs/plus/markdown-render.md +240 -0
- package/docs/plus/video-player.md +325 -0
- package/docs/show/avatar.md +475 -0
- package/docs/show/badge.md +276 -0
- package/docs/show/calendar.md +352 -0
- package/docs/show/card.md +485 -0
- package/docs/show/carousel.md +592 -0
- package/docs/show/collapse.md +289 -0
- package/docs/show/collapsible.md +216 -0
- package/docs/show/cropper.md +285 -0
- package/docs/show/descriptions.md +325 -0
- package/docs/show/dropdown.md +466 -0
- package/docs/show/empty.md +225 -0
- package/docs/show/highlight.md +144 -0
- package/docs/show/image.md +433 -0
- package/docs/show/list.md +927 -0
- package/docs/show/modal.md +517 -0
- package/docs/show/overflow-list.md +272 -0
- package/docs/show/popover.md +534 -0
- package/docs/show/scroll-list.md +156 -0
- package/docs/show/side-sheet.md +274 -0
- package/docs/show/table.md +5437 -0
- package/docs/show/tag.md +428 -0
- package/docs/show/timeline.md +277 -0
- package/docs/show/tooltip.md +442 -0
- package/docs/show/user-guide.md +419 -0
- package/docs/start/getting-started.md +234 -0
- package/docs/start/introduction.md +57 -0
- package/docs/start/overview.md +21 -0
- package/package.json +5 -4
|
@@ -33,42 +33,62 @@ export interface TooltipProps extends TooltipBaseProps {
|
|
|
33
33
|
child?: Snippet<[{
|
|
34
34
|
props: TooltipTriggerProps;
|
|
35
35
|
}]>;
|
|
36
|
+
/** Snippet for the popup content, with the parameter `{ initialFocusRef }`: write `{@attach initialFocusRef}` on the element that should receive focus when the popup opens. */
|
|
36
37
|
content?: Snippet<[RenderContentProps]>;
|
|
38
|
+
/** Snippet that replaces the default arrow while showArrow is true. */
|
|
37
39
|
arrow?: Snippet;
|
|
40
|
+
/** Class name of the popup. */
|
|
38
41
|
class?: string;
|
|
39
42
|
/** On the popup, before the positioning declarations; its `background-color` also colors the arrow */
|
|
40
43
|
style?: string;
|
|
44
|
+
/** Whether the popup is animated. */
|
|
41
45
|
motion?: boolean;
|
|
46
|
+
/** Whether the popup flips automatically when it would be clipped. */
|
|
42
47
|
autoAdjustOverflow?: boolean;
|
|
48
|
+
/** Position of the popup relative to the trigger element. */
|
|
43
49
|
position?: Position;
|
|
50
|
+
/** Distance in pixels between the popup and the trigger. An object sets the horizontal and vertical distances. */
|
|
44
51
|
spacing?: number | {
|
|
45
52
|
x: number;
|
|
46
53
|
y: number;
|
|
47
54
|
};
|
|
55
|
+
/** Whether the arrow is shown. */
|
|
48
56
|
showArrow?: boolean;
|
|
57
|
+
/** ARIA role of the popup. */
|
|
49
58
|
role?: string;
|
|
50
59
|
/** Name and description of a role="dialog" popup (F12); ignored for other roles */
|
|
51
60
|
'aria-label'?: string;
|
|
61
|
+
/** aria-labelledby of the popup when its role is dialog. */
|
|
52
62
|
'aria-labelledby'?: string;
|
|
63
|
+
/** aria-describedby of the popup when its role is dialog. */
|
|
53
64
|
'aria-describedby'?: string;
|
|
65
|
+
/** Whether the arrow points at the center of the trigger. Requires showArrow. */
|
|
54
66
|
arrowPointAtCenter?: boolean;
|
|
67
|
+
/** Whether click, mousedown and focus in/out events on the popup stop propagating. */
|
|
55
68
|
stopPropagation?: boolean;
|
|
56
69
|
/** `wrapper` exists only when the trigger is wrapped: text, several nodes, or a disabled or loading trigger */
|
|
57
70
|
classNames?: Partial<Record<TooltipPart, ClassValue>>;
|
|
71
|
+
/** Inline style strings of the inner parts, keyed like `classNames`; applied after the span's built-in style. */
|
|
58
72
|
styles?: Partial<Record<TooltipPart, string>>;
|
|
73
|
+
/** id of the popup element, referenced by the trigger's ARIA attributes. Generated when omitted. */
|
|
59
74
|
wrapperId?: string;
|
|
60
75
|
/**
|
|
61
76
|
* Whether a disabled or loading Semi Button, Switch or Checkbox that fills the default span gets its pointer events
|
|
62
77
|
* through the span (F4); false leaves it as it is
|
|
63
78
|
*/
|
|
64
79
|
wrapWhenSpecial?: boolean;
|
|
80
|
+
/** Whether the popup content stays mounted while closed. */
|
|
65
81
|
keepDOM?: boolean;
|
|
82
|
+
/** Called when the visibility of the popup changes; with a controlled visible it reports only requests from user interaction, not changes the parent makes to visible. */
|
|
66
83
|
onVisibleChange?: (visible: boolean) => void;
|
|
84
|
+
/** Called when the mouse is pressed outside of the trigger and the open popup. Only for trigger click, contextMenu or custom, or with clickTriggerToHide. */
|
|
67
85
|
onClickOutSide?: (event: MouseEvent) => void;
|
|
86
|
+
/** Called when Esc is pressed while the popup is open and closeOnEsc is true. */
|
|
68
87
|
onEscKeyDown?: (event: KeyboardEvent) => void;
|
|
69
88
|
/** Once per opening when the popup is shown, as its enter transition starts */
|
|
70
89
|
onOpen?: () => void;
|
|
71
90
|
/** Once per opening after the enter transition, not for an opening closed before it finishes */
|
|
72
91
|
afterOpen?: () => void;
|
|
92
|
+
/** Called after the popup has closed and its leave animation has finished. */
|
|
73
93
|
afterClose?: () => void;
|
|
74
94
|
}
|
|
@@ -50,23 +50,33 @@ type NativeKeys = 'onchange' | 'onselect' | 'children';
|
|
|
50
50
|
export interface TransferProps extends Omit<HTMLAttributes<HTMLDivElement>, NativeKeys> {
|
|
51
51
|
/** Bindable; leave it out for an uncontrolled transfer. `bind:value={get, set}` makes it fully controlled */
|
|
52
52
|
value?: TransferValue;
|
|
53
|
+
/** Data source: an array of items for list, an array of groups for groupList, or tree data with children for treeList (a leaf writes `children: []`). The tree of a treeList only updates when a new array is passed, changes made in place are not seen. */
|
|
53
54
|
dataSource?: TransferDataSource;
|
|
55
|
+
/** Transfer type: list, groupList or treeList. */
|
|
54
56
|
type?: TransferType;
|
|
57
|
+
/** Whether the whole transfer is disabled. */
|
|
55
58
|
disabled?: boolean;
|
|
59
|
+
/** Enables drag sorting of the selected items on the right. After a sort, value and onChange carry the new order. */
|
|
56
60
|
draggable?: boolean;
|
|
61
|
+
/** Whether the options on the left are loading. */
|
|
57
62
|
loading?: boolean;
|
|
58
63
|
/** treeList only: the selected items show their path from the root */
|
|
59
64
|
showPath?: boolean;
|
|
60
65
|
/** false hides the search box; a function replaces the default case-insensitive label match */
|
|
61
66
|
filter?: boolean | ((searchValue: string, item: TransferDataItem) => boolean);
|
|
67
|
+
/** Props passed to the search Input, see Input for the options. Transfer owns its value and onChange; to search from outside, call the search method. */
|
|
62
68
|
inputProps?: TransferInputProps;
|
|
63
69
|
/** treeList only; of the Tree's snippets only `label` is forwarded */
|
|
64
70
|
treeProps?: TransferTreeProps;
|
|
71
|
+
/** Paging of the left panel, for list and groupList only. onPageChange lives inside the object. */
|
|
65
72
|
pagination?: TransferPagination;
|
|
66
73
|
/** Renders the selected list virtually; ignored while `draggable` */
|
|
67
74
|
virtualize?: TransferVirtualize;
|
|
75
|
+
/** Called when the selection changes, including after a drag sort, with the array of values and the array of their items. This is the callback of Transfer, not the native change of the root element. */
|
|
68
76
|
onChange?: (values: TransferValue, items: TransferDataItem[]) => void;
|
|
77
|
+
/** Called when an item is checked, with that item. */
|
|
69
78
|
onSelect?: (item: TransferDataItem) => void;
|
|
79
|
+
/** Called when an item is unchecked, with that item. */
|
|
70
80
|
onDeselect?: (item: TransferDataItem) => void;
|
|
71
81
|
/** Typing in the search box; the `search` method does not fire it */
|
|
72
82
|
onSearch?: (searchValue: string) => void;
|
|
@@ -74,15 +84,23 @@ export interface TransferProps extends Omit<HTMLAttributes<HTMLDivElement>, Nati
|
|
|
74
84
|
onBlur?: (event: FocusEvent) => void;
|
|
75
85
|
/** Content of an item in both lists; the dataSource label is the default */
|
|
76
86
|
label?: Snippet<[TransferLabelSnippetProps]>;
|
|
87
|
+
/** Replaces one item on the left. index is the position among the shown items after filtering and paging, not the position in dataSource. */
|
|
77
88
|
sourceItem?: Snippet<[TransferSourceItemSnippetProps]>;
|
|
89
|
+
/** Replaces one selected item on the right. With draggable, handle is a `Snippet<[Snippet]>`: write the drag icon as a snippet and wrap it with `{@render handle?.(grip)}`. With treeList and showPath, fullPath holds the whole path. */
|
|
78
90
|
selectedItem?: Snippet<[TransferSelectedItemSnippetProps]>;
|
|
91
|
+
/** Replaces the header of the left panel. leafOnlyNum is provided for treeList only. */
|
|
79
92
|
sourceHeader?: Snippet<[TransferSourceHeaderSnippetProps]>;
|
|
93
|
+
/** Replaces the header of the right panel. */
|
|
80
94
|
selectedHeader?: Snippet<[TransferSelectedHeaderSnippetProps]>;
|
|
95
|
+
/** Replaces the whole left panel, reusing the filtering and selection logic of Transfer. */
|
|
81
96
|
sourcePanel?: Snippet<[TransferSourcePanelSnippetProps]>;
|
|
97
|
+
/** Replaces the whole right panel. Call onSortEnd after a drag sort you implemented has finished. */
|
|
82
98
|
selectedPanel?: Snippet<[TransferSelectedPanelSnippetProps]>;
|
|
83
99
|
/** `false` hides the empty state */
|
|
84
100
|
emptyLeft?: Snippet | false;
|
|
101
|
+
/** Shown when nothing is selected. The locale text appears when it is not provided; false hides the empty state. */
|
|
85
102
|
emptyRight?: Snippet | false;
|
|
103
|
+
/** Shown when the search matches nothing. The locale text appears when it is not provided; false hides the empty state. */
|
|
86
104
|
emptySearch?: Snippet | false;
|
|
87
105
|
}
|
|
88
106
|
/** The methods on a Transfer instance from `bind:this` */
|
|
@@ -100,64 +100,109 @@ export interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, NativeKe
|
|
|
100
100
|
value?: TreeValue;
|
|
101
101
|
/** Only a new array updates the tree: changes made in place are not seen */
|
|
102
102
|
treeData?: TreeNodeData[];
|
|
103
|
+
/** Node data as a plain JSON object; the value is a JSON object holding the selected nodes. */
|
|
103
104
|
treeDataSimpleJson?: TreeDataSimpleJson;
|
|
105
|
+
/** Custom field names for key, label and value in a node. When label is mapped and search is on, set treeNodeFilterProp to one of the keys in treeData or provide filterTreeNode. */
|
|
104
106
|
keyMaps?: TreeKeyMapProps;
|
|
105
107
|
/** Bindable, like `value` */
|
|
106
108
|
expandedKeys?: string[];
|
|
109
|
+
/** Expands every node on mount. Later changes of treeData or treeDataSimpleJson do not affect it; use expandAll for that. */
|
|
107
110
|
defaultExpandAll?: boolean;
|
|
111
|
+
/** Expands every node, and keeps doing so when the data changes. */
|
|
108
112
|
expandAll?: boolean;
|
|
113
|
+
/** Whether the parents of the nodes in expandedKeys expand automatically when expandedKeys changes; they always do on mount. When on, a controlled tree collapses a parent only after its expanded children are collapsed. */
|
|
109
114
|
autoExpandParent?: boolean;
|
|
115
|
+
/** Whether dragging over a collapsed node expands it. */
|
|
110
116
|
autoExpandWhenDragEnter?: boolean;
|
|
117
|
+
/** When a parent is selected the value leaves out its descendants; applies when leafOnly is false. */
|
|
111
118
|
autoMergeValue?: boolean;
|
|
119
|
+
/** Shows each node as a whole row, highlighting the row on hover and selection; when off only the label is highlighted. */
|
|
112
120
|
blockNode?: boolean;
|
|
121
|
+
/** How the checked states of nodes relate in a multiple tree: related links parents and children, unRelated keeps them independent. */
|
|
113
122
|
checkRelation?: CheckRelation;
|
|
123
|
+
/** Directory mode with built-in folder icons, which the icon snippet can replace. */
|
|
114
124
|
directory?: boolean;
|
|
125
|
+
/** Disables the whole tree. A node with disabled: false does not lift it. */
|
|
115
126
|
disabled?: boolean;
|
|
127
|
+
/** Strict disabling: a disabled node cannot change state through the selection of its parent or children. */
|
|
116
128
|
disableStrictly?: boolean;
|
|
129
|
+
/** Whether nodes can be dragged, used together with onDrop. It cannot be combined with virtualize. */
|
|
117
130
|
draggable?: boolean;
|
|
131
|
+
/** Hides the drag image of the node being dragged. */
|
|
118
132
|
hideDraggingNode?: boolean;
|
|
133
|
+
/** How a node expands: false only through the arrow, click on a click, doubleClick on a double click. The keyboard does not use it. */
|
|
119
134
|
expandAction?: ExpandAction;
|
|
135
|
+
/** In a multiple tree, the value and the payload of onChange hold leaf nodes only. */
|
|
120
136
|
leafOnly?: boolean;
|
|
121
137
|
/** Bindable, like `value` */
|
|
122
138
|
loadedKeys?: string[];
|
|
139
|
+
/** Whether expanding and collapsing are animated; animation is off for a virtualized tree. */
|
|
123
140
|
motion?: boolean;
|
|
141
|
+
/** Whether several nodes can be selected. A parent is checked automatically once all its children are. */
|
|
124
142
|
multiple?: boolean;
|
|
143
|
+
/** When true the argument of onChange is the node object with value, label and other fields instead of the value; a controlled value must then be objects with a value. */
|
|
125
144
|
onChangeWithObject?: boolean;
|
|
145
|
+
/** Whether the search box shows a clear button. */
|
|
126
146
|
showClear?: boolean;
|
|
147
|
+
/** Shows only the filtered nodes while searching. */
|
|
127
148
|
showFilteredOnly?: boolean;
|
|
149
|
+
/** Shows connecting lines between nodes. */
|
|
128
150
|
showLine?: boolean;
|
|
151
|
+
/** The node field matched against the search input, label by default. */
|
|
129
152
|
treeNodeFilterProp?: string;
|
|
130
153
|
/** On by default for a virtualized tree */
|
|
131
154
|
labelEllipsis?: boolean;
|
|
155
|
+
/** List virtualization for many nodes: height, width and itemSize (required). Animation is off once enabled. */
|
|
132
156
|
virtualize?: TreeVirtualize;
|
|
157
|
+
/** Class names of the inner parts, keyed by search (the search box container); values take anything class takes (string, array or object) and merge with the built-in classes. */
|
|
133
158
|
classNames?: Partial<Record<TreePart, ClassValue>>;
|
|
159
|
+
/** Style strings of the inner parts, keyed like classNames. */
|
|
134
160
|
styles?: Partial<Record<TreePart, string>>;
|
|
161
|
+
/** Placeholder of the search box. */
|
|
135
162
|
searchPlaceholder?: string;
|
|
163
|
+
/** Whether search is on. true matches by treeNodeFilterProp; a function customizes the match, with data as the node. */
|
|
136
164
|
filterTreeNode?: boolean | ((inputValue: string, treeNodeString: string, data?: TreeNodeData) => boolean);
|
|
137
165
|
/** Loads a node's children; a node without `isLeaf` shows the expand arrow while it is set */
|
|
138
166
|
loadData?: (treeNode?: TreeNodeData) => Promise<void>;
|
|
167
|
+
/** Called when the selection changes, with the current value. */
|
|
139
168
|
onChange?: (value: TreeValue) => void;
|
|
169
|
+
/** Called when a node expands or collapses, with the array of expanded keys and an info object holding expanded and node. */
|
|
140
170
|
onExpand?: (expandedKeys: string[], info: TreeExpandedOtherProps) => void;
|
|
171
|
+
/** Called when a node has loaded, with the set of loaded nodes and the node just loaded. */
|
|
141
172
|
onLoad?: (loadedKeys: Set<string>, node: TreeNodeData) => void;
|
|
173
|
+
/** Called when a node is selected or deselected, with its key, whether it is selected and its data. */
|
|
142
174
|
onSelect?: (selectedKey: string, selected: boolean, node: TreeNodeData) => void;
|
|
175
|
+
/** Called when the search input changes; filteredExpandedKeys are the nodes expanded by the search or by value, which controlled expansion can use to show the results. */
|
|
143
176
|
onSearch?: (input: string, filteredExpandedKeys: string[]) => void;
|
|
177
|
+
/** Called on a right click on a node, with the event and the node data. */
|
|
144
178
|
onContextMenu?: (event: MouseEvent, node: TreeNodeData) => void;
|
|
179
|
+
/** Called on a double click on a node, with the event and the node data. */
|
|
145
180
|
onDoubleClick?: (event: MouseEvent, node: TreeNodeData) => void;
|
|
181
|
+
/** Called when a node starts to be dragged. */
|
|
146
182
|
onDragStart?: (info: TreeDragProps) => void;
|
|
183
|
+
/** Called when a drag enters a node; the argument holds expandedKeys when that expanded a collapsed node. */
|
|
147
184
|
onDragEnter?: (info: TreeDragEnterProps) => void;
|
|
185
|
+
/** Called while a drag is over a node. */
|
|
148
186
|
onDragOver?: (info: TreeDragProps) => void;
|
|
187
|
+
/** Called when a drag leaves a node. */
|
|
149
188
|
onDragLeave?: (info: TreeDragProps) => void;
|
|
189
|
+
/** Called when a drag ends. */
|
|
150
190
|
onDragEnd?: (info: TreeDragProps) => void;
|
|
191
|
+
/** Called when a node is dropped; the argument holds node, dragNode, dragNodesKeys, dropPosition and dropToGap. */
|
|
151
192
|
onDrop?: (info: TreeOnDragProps) => void;
|
|
193
|
+
/** Content of a node's label, with `{ item, label, searchWord }` as its argument. Search still matches the label text in treeData. */
|
|
152
194
|
label?: Snippet<[TreeLabelSnippetProps]>;
|
|
153
195
|
/** A row's icon, in place of the directory icon */
|
|
154
196
|
icon?: Snippet<[TreeIconSnippetProps]>;
|
|
197
|
+
/** The expand icon, with `{ onClick, class, expanded }` as its argument; put `class` and `onclick` on the element it renders. */
|
|
155
198
|
expandIcon?: Snippet<[TreeExpandIconSnippetProps]>;
|
|
156
199
|
/** Content of a whole row; the row element carrying the id, role and state wraps it */
|
|
157
200
|
fullLabel?: Snippet<[TreeFullLabelSnippetProps]>;
|
|
158
201
|
/** Replaces the search box; `false` hides it while `filterTreeNode` still filters */
|
|
159
202
|
search?: Snippet<[TreeSearchSnippetProps]> | false;
|
|
203
|
+
/** Content shown when there are no nodes, or when the search finds none with showFilteredOnly on. */
|
|
160
204
|
emptyContent?: Snippet;
|
|
205
|
+
/** The element the browser shows while a node is dragged, with the node element nodeInstance and the node data node as arguments; on dragstart the snippet is rendered into a detached container and used as the drag image, so only app-level context reaches it. */
|
|
161
206
|
renderDraggingNode?: Snippet<[TreeDraggingNodeSnippetProps]>;
|
|
162
207
|
}
|
|
163
208
|
/** The methods on a Tree instance from `bind:this` */
|
|
@@ -69,74 +69,120 @@ type NativeKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onselect
|
|
|
69
69
|
export interface TreeSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, NativeKeys> {
|
|
70
70
|
/** Bindable; leave it out for an uncontrolled TreeSelect. `bind:value={get, set}` makes it fully controlled */
|
|
71
71
|
value?: TreeSelectValue;
|
|
72
|
+
/** Whether several nodes can be selected. */
|
|
72
73
|
multiple?: boolean;
|
|
73
74
|
/** Only a new array updates the options: changes made in place are not seen */
|
|
74
75
|
treeData?: TreeNodeData[];
|
|
76
|
+
/** Custom names of the key, label, value, disabled, children, isLeaf and icon fields in a node. If you rename the label field and enable search, set `treeNodeFilterProp` to one of the fields in `treeData`, or pass a custom search function to `filterTreeNode`. */
|
|
75
77
|
keyMaps?: TreeSelectKeyMapProps;
|
|
78
|
+
/** Property of `TreeNodeData` used to display the text. */
|
|
76
79
|
treeNodeLabelProp?: string;
|
|
80
|
+
/** Property of `TreeNodeData` matched by search. */
|
|
77
81
|
treeNodeFilterProp?: string;
|
|
82
|
+
/** Whether the component is searchable, or a function that customizes the search; its third argument is the node data `data`. */
|
|
78
83
|
filterTreeNode?: boolean | ((inputValue: string, treeNodeString: string, data?: TreeNodeData) => boolean);
|
|
84
|
+
/** Whether only the filtered results are displayed while searching. */
|
|
79
85
|
showFilteredOnly?: boolean;
|
|
86
|
+
/** Position of the search box: `dropdown` or `trigger`. */
|
|
80
87
|
searchPosition?: TreeSelectSearchPosition;
|
|
88
|
+
/** Placeholder of the search box in the dropdown. */
|
|
81
89
|
searchPlaceholder?: string;
|
|
90
|
+
/** Whether the search box is focused on mount. */
|
|
82
91
|
searchAutoFocus?: boolean;
|
|
92
|
+
/** Whether the search box in the dropdown can be cleared. */
|
|
83
93
|
showSearchClear?: boolean;
|
|
94
|
+
/** Whether remote search is enabled. When enabled, input skips local filtering and only triggers `onSearch`; the caller fetches the data and updates `treeData`. */
|
|
84
95
|
remote?: boolean;
|
|
96
|
+
/** Whether to expand all nodes by default. The expansion still follows this prop after `treeData` changes. */
|
|
85
97
|
expandAll?: boolean;
|
|
98
|
+
/** Whether to expand all nodes on initialization. After `treeData` changes this prop no longer takes effect; use `expandAll` if you need that. */
|
|
86
99
|
defaultExpandAll?: boolean;
|
|
87
100
|
/** Bindable, like `value` */
|
|
88
101
|
expandedKeys?: string[];
|
|
102
|
+
/** Whether parent nodes expand automatically. */
|
|
89
103
|
autoExpandParent?: boolean;
|
|
104
|
+
/** How a node expands: `false` (only the expand icon expands it), `click` or `doubleClick`. */
|
|
90
105
|
expandAction?: TreeSelectExpandAction;
|
|
106
|
+
/** Whether expanding and collapsing nodes animates. */
|
|
91
107
|
motionExpand?: boolean;
|
|
92
108
|
/** Loads a node's children; a node without `isLeaf` shows the expand arrow while it is set */
|
|
93
109
|
loadData?: (data: TreeNodeData) => Promise<void>;
|
|
94
110
|
/** Bindable, like `value` */
|
|
95
111
|
loadedKeys?: string[];
|
|
112
|
+
/** In multiple mode, whether only leaf nodes are displayed as tags, and the values passed to `onChange` are leaf nodes only. */
|
|
96
113
|
leafOnly?: boolean;
|
|
114
|
+
/** In multiple mode, the relationship between the checked states of nodes: `related` or `unRelated`. With `unRelated`, the checked states of nodes do not affect each other. */
|
|
97
115
|
checkRelation?: CheckRelation;
|
|
116
|
+
/** Strict disabling: when a node is disabled, its checked state cannot be changed through its parent or child nodes. */
|
|
98
117
|
disableStrictly?: boolean;
|
|
118
|
+
/** Whether to merge the value: when on, selecting a parent node keeps its descendants out of the value. Works only when `leafOnly` is false. */
|
|
99
119
|
autoMergeValue?: boolean;
|
|
100
120
|
/** `value` and `onChange` carry the nodes instead of their values */
|
|
101
121
|
onChangeWithObject?: boolean;
|
|
122
|
+
/** Maximum number of tags displayed; the rest are shown as +N. */
|
|
102
123
|
maxTagCount?: number;
|
|
124
|
+
/** When the number of tags exceeds `maxTagCount`, whether hovering +N shows the remaining tags in a Popover. */
|
|
103
125
|
showRestTagsPopover?: boolean;
|
|
126
|
+
/** Popover configuration for the collapsed tags beyond `maxTagCount`. */
|
|
104
127
|
restTagsPopoverProps?: PopoverProps;
|
|
105
128
|
/** On by default for a virtualized list */
|
|
106
129
|
labelEllipsis?: boolean;
|
|
130
|
+
/** Whether the nodes in the option panel show connecting lines. */
|
|
107
131
|
showLine?: boolean;
|
|
132
|
+
/** Virtual list configuration: an object with `itemSize` (required, the height of each row), `height` (the height of the dropdown, a number recommended) and `width`. Animation is disabled when virtualized. */
|
|
108
133
|
virtualize?: TreeVirtualize;
|
|
134
|
+
/** Placeholder of the input box. */
|
|
109
135
|
placeholder?: string;
|
|
136
|
+
/** Whether the component is disabled. */
|
|
110
137
|
disabled?: boolean;
|
|
138
|
+
/** Size of the input box: `large`, `small` or `default`. */
|
|
111
139
|
size?: TreeSelectSize;
|
|
140
|
+
/** Whether to use the borderless style. */
|
|
112
141
|
borderless?: boolean;
|
|
142
|
+
/** Validation status: `warning`, `error` or `default`. It only affects the background color of the component. */
|
|
113
143
|
validateStatus?: ValidateStatus;
|
|
114
144
|
/** The id of the element around the `insetLabel` snippet */
|
|
115
145
|
insetLabelId?: string;
|
|
146
|
+
/** Whether the trigger shows the clear button when the value is not empty. */
|
|
116
147
|
showClear?: boolean;
|
|
117
148
|
/** Closes the dropdown once a node is selected in single mode */
|
|
118
149
|
clickToHide?: boolean;
|
|
150
|
+
/** When the panel is open, whether clicking the trigger closes it. */
|
|
119
151
|
clickTriggerToHide?: boolean;
|
|
120
152
|
/** Opens the dropdown on mount; TreeSelect has no controlled open state */
|
|
121
153
|
defaultOpen?: boolean;
|
|
154
|
+
/** Whether the dropdown animates in and out. */
|
|
122
155
|
motion?: boolean;
|
|
156
|
+
/** Whether the popup flips its direction automatically when it is covered. */
|
|
123
157
|
autoAdjustOverflow?: boolean;
|
|
158
|
+
/** Position of the popup; the values follow the position of Tooltip. Defaults to `bottomLeft` (`bottomRight` in RTL). */
|
|
124
159
|
position?: Position;
|
|
160
|
+
/** Whether click events on the dropdown panel stop bubbling. */
|
|
125
161
|
stopPropagation?: boolean | string;
|
|
162
|
+
/** Class names of the inner parts, keyed by dropdown (the dropdown panel) and optionList (the option list, the role="tree" element); values take anything class takes (string, array or object) and merge with the built-in classes. */
|
|
126
163
|
classNames?: Partial<Record<TreeSelectPart, ClassValue>>;
|
|
164
|
+
/** Style strings of the inner parts, keyed like classNames. */
|
|
127
165
|
styles?: Partial<Record<TreeSelectPart, string>>;
|
|
166
|
+
/** Whether the minimum width of the dropdown panel matches the width of the select box. */
|
|
128
167
|
dropdownMatchSelectWidth?: boolean;
|
|
168
|
+
/** Whether the browser avoids scrolling the document to show the newly focused element when the component calls `focus` internally. It does not apply to elements passed in by the user. */
|
|
129
169
|
preventScroll?: boolean;
|
|
170
|
+
/** Whether selected tags wrap onto multiple lines within the trigger. Only works when `multiple` and search are enabled and `searchPosition` is `trigger`. */
|
|
130
171
|
triggerTagWrap?: boolean;
|
|
131
172
|
/** With `onChangeWithObject` the value and the node are both the node */
|
|
132
173
|
onChange?: (value: TreeSelectValue | undefined, node: TreeNodeData | TreeNodeData[] | undefined, event: TreeSelectChangeEvent) => void;
|
|
174
|
+
/** Called when a node expands or collapses, with the array of expanded keys and `{ expanded, node }`. */
|
|
133
175
|
onExpand?: (expandedKeys: string[], info: {
|
|
134
176
|
expanded: boolean;
|
|
135
177
|
node: TreeNodeData;
|
|
136
178
|
}) => void;
|
|
179
|
+
/** Called when a node has finished loading. */
|
|
137
180
|
onLoad?: (loadedKeys: Set<string>, node: TreeNodeData) => void;
|
|
181
|
+
/** Called when a node is selected or deselected, with the key of the node, whether it is selected, and the node data. */
|
|
138
182
|
onSelect?: (selectedKey: string, selected: boolean, node: TreeNodeData) => void;
|
|
183
|
+
/** Called when the search value changes, with the search value, `filteredExpandedKeys` (keys of the nodes expanded by the search or by the value, useful when the expansion is controlled) and `filteredNodes` (the nodes that match the search). */
|
|
139
184
|
onSearch?: (input: string, filteredExpandedKeys: string[], filteredNodes: TreeNodeData[]) => void;
|
|
185
|
+
/** Called when the dropdown panel is shown or hidden, with whether it is visible. */
|
|
140
186
|
onVisibleChange?: (visible: boolean) => void;
|
|
141
187
|
/**
|
|
142
188
|
* Focus entering the trigger or the dropdown from outside (the focusin); moving within them does not fire it again.
|
|
@@ -148,8 +194,11 @@ export interface TreeSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, Na
|
|
|
148
194
|
* the trigger and the dropdown
|
|
149
195
|
*/
|
|
150
196
|
onBlur?: (event: MouseEvent | KeyboardEvent | FocusEvent) => void;
|
|
197
|
+
/** Called when the clear button is clicked. */
|
|
151
198
|
onClear?: (event: TreeSelectChangeEvent) => void;
|
|
199
|
+
/** Snippet for a node's label, receiving `{ item, label, searchWord }`: the node data, the original label and the search word; usage is the same as the `label` of Tree. */
|
|
152
200
|
label?: Snippet<[TreeLabelSnippetProps]>;
|
|
201
|
+
/** Snippet for a node's icon, receiving `{ item, level, expanded, isLeaf, loading, selected, checked, halfChecked }`; usage is the same as the `icon` of Tree. */
|
|
153
202
|
icon?: Snippet<[TreeIconSnippetProps]>;
|
|
154
203
|
/** A single element gets the class and the click that expands */
|
|
155
204
|
expandIcon?: Snippet<[TreeExpandIconSnippetProps]>;
|
|
@@ -159,19 +208,25 @@ export interface TreeSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, Na
|
|
|
159
208
|
selectedItem?: Snippet<[TreeSelectSelectedItemSnippetProps]>;
|
|
160
209
|
/** Replaces each tag in multiple mode, ahead of `selectedItem` */
|
|
161
210
|
tag?: Snippet<[TreeSelectSelectedItemSnippetProps]>;
|
|
211
|
+
/** Snippet that replaces the trigger content. Its parameters are `value` (the data of the selected nodes), `inputValue`, `placeholder`, `disabled`, `componentProps` (all the props given to TreeSelect), `onSearch` (updates the search keyword; needs `filterTreeNode` and a `searchPosition` of `trigger`), `onClear` (pass the click event when bound to a control inside the trigger, so the click does not open the dropdown) and `onRemove` (unchecks the node with the key). */
|
|
162
212
|
trigger?: Snippet<[TreeSelectTriggerSnippetProps]>;
|
|
163
213
|
/** Replaces the search box; `false` hides it while `filterTreeNode` still filters */
|
|
164
214
|
search?: Snippet<[TreeSelectSearchSnippetProps]> | false;
|
|
215
|
+
/** Snippet for the content in front of the select box. */
|
|
165
216
|
prefix?: Snippet;
|
|
217
|
+
/** Snippet for the content after the select box. */
|
|
166
218
|
suffix?: Snippet;
|
|
219
|
+
/** Snippet for a label inside the select box, which also names the dropdown tree. It is not rendered, and does not name the component, when `prefix` is used. */
|
|
167
220
|
insetLabel?: Snippet;
|
|
168
221
|
/** `null` hides the arrow */
|
|
169
222
|
arrowIcon?: Snippet | null;
|
|
223
|
+
/** Snippet for the icon of the clear button, effective when `showClear` is true. */
|
|
170
224
|
clearIcon?: Snippet;
|
|
171
225
|
/** `null` hides the empty state */
|
|
172
226
|
emptyContent?: Snippet | null;
|
|
173
227
|
/** Above the tree; it takes the place of the dropdown search box */
|
|
174
228
|
outerTopSlot?: Snippet;
|
|
229
|
+
/** Snippet rendered at the bottom of the dropdown panel, at the same level as the option list. */
|
|
175
230
|
outerBottomSlot?: Snippet;
|
|
176
231
|
}
|
|
177
232
|
/** The methods on a TreeSelect instance from `bind:this` */
|
|
@@ -44,14 +44,23 @@ export interface TypographyProps extends HTMLAttributes<HTMLElement> {
|
|
|
44
44
|
}
|
|
45
45
|
/** Props every Typography component takes besides the attributes of its root element */
|
|
46
46
|
export interface TypographyCommonProps {
|
|
47
|
+
/** Tag name of the element to render. Defaults to span. */
|
|
47
48
|
component?: string;
|
|
49
|
+
/** Whether the text can be copied; pass an object for the Copyable Config. */
|
|
48
50
|
copyable?: TypographyCopyableConfig | boolean;
|
|
51
|
+
/** Adds a strikethrough. */
|
|
49
52
|
delete?: boolean;
|
|
53
|
+
/** Disables the text. */
|
|
50
54
|
disabled?: boolean;
|
|
55
|
+
/** Whether the text is a link; with an object, its attributes (href, target, class, style, onclick and so on) are applied to the a element. */
|
|
51
56
|
link?: LinkType;
|
|
57
|
+
/** Adds a highlight. */
|
|
52
58
|
mark?: boolean;
|
|
59
|
+
/** Whether the text is bold. */
|
|
53
60
|
strong?: boolean;
|
|
61
|
+
/** Text type. */
|
|
54
62
|
type?: TypographyBaseType;
|
|
63
|
+
/** Adds an underline. */
|
|
55
64
|
underline?: boolean;
|
|
56
65
|
}
|
|
57
66
|
export interface TypographyCopyActionProps {
|
|
@@ -60,9 +69,13 @@ export interface TypographyCopyActionProps {
|
|
|
60
69
|
config: TypographyCopyableConfig;
|
|
61
70
|
}
|
|
62
71
|
export interface TypographyCopySnippets {
|
|
72
|
+
/** Snippet for the content of the copy button; a single node with an aria-label names the button, otherwise the locale's "Copy" does. */
|
|
63
73
|
copyIcon?: Snippet;
|
|
74
|
+
/** Snippet for the tooltip content of the copy button. */
|
|
64
75
|
copyTip?: Snippet;
|
|
76
|
+
/** Snippet for the content shown after a successful copy. */
|
|
65
77
|
copySuccessTip?: Snippet;
|
|
78
|
+
/** Snippet that replaces the whole copy node, with the argument `{ copied, copy, config }`; `copy` takes the click event. */
|
|
66
79
|
copyAction?: Snippet<[TypographyCopyActionProps]>;
|
|
67
80
|
}
|
|
68
81
|
export interface TypographyEllipsisTooltipProps {
|
|
@@ -71,32 +84,52 @@ export interface TypographyEllipsisTooltipProps {
|
|
|
71
84
|
trigger: Snippet;
|
|
72
85
|
}
|
|
73
86
|
export interface TypographyEllipsisSnippets {
|
|
87
|
+
/** Snippet for the content of the floating layer when truncated; defaults to the full text. */
|
|
74
88
|
ellipsisContent?: Snippet;
|
|
89
|
+
/** Snippet for a custom floating layer, rendered only when the text overflows; its argument is `{ content, trigger }`, where `content` is the full text and `trigger` is a snippet of the text element, to be placed in your own layer with `{@render trigger()}`. */
|
|
75
90
|
ellipsisTooltip?: Snippet<[TypographyEllipsisTooltipProps]>;
|
|
76
91
|
}
|
|
77
92
|
export interface TypographyTextProps extends HTMLAttributes<HTMLSpanElement>, TypographyCommonProps, TypographyCopySnippets, TypographyEllipsisSnippets {
|
|
93
|
+
/** Whether the text is wrapped in a code element. */
|
|
78
94
|
code?: boolean;
|
|
95
|
+
/** Truncates overflowing text; pass an object for the Ellipsis Config. */
|
|
79
96
|
ellipsis?: Ellipsis | boolean;
|
|
97
|
+
/** Text size; inherit takes the size of the enclosing Text or Paragraph. */
|
|
80
98
|
size?: TypographyBaseSize;
|
|
99
|
+
/** Font weight as a number. */
|
|
81
100
|
weight?: number;
|
|
101
|
+
/** Snippet for the prefix icon; a Semi icon is set to small or default according to size. */
|
|
82
102
|
icon?: Snippet;
|
|
83
103
|
}
|
|
84
104
|
export interface TypographyTitleProps extends HTMLAttributes<HTMLHeadingElement>, TypographyCommonProps, TypographyCopySnippets, TypographyEllipsisSnippets {
|
|
105
|
+
/** Truncates overflowing text; pass an object for the Ellipsis Config. */
|
|
85
106
|
ellipsis?: Ellipsis | boolean;
|
|
107
|
+
/** Heading level, matching h1 to h6. */
|
|
86
108
|
heading?: ArrayElement<typeof strings.HEADING>;
|
|
109
|
+
/** Font weight: light, regular, medium, semibold, bold, default, or a number. */
|
|
87
110
|
weight?: ArrayElement<typeof strings.WEIGHT> | number;
|
|
88
111
|
}
|
|
89
112
|
export interface TypographyParagraphProps extends HTMLAttributes<HTMLParagraphElement>, TypographyCommonProps, TypographyCopySnippets, TypographyEllipsisSnippets {
|
|
113
|
+
/** Truncates overflowing text; pass an object for the Ellipsis Config. */
|
|
90
114
|
ellipsis?: Ellipsis | boolean;
|
|
115
|
+
/** Text size; inherit takes the size of the enclosing Text or Paragraph. */
|
|
91
116
|
size?: TypographyBaseSize;
|
|
117
|
+
/** Line spacing; extended is looser. */
|
|
92
118
|
spacing?: TypographyBaseSpacing;
|
|
93
119
|
}
|
|
94
120
|
export interface TypographyNumeralProps extends HTMLAttributes<HTMLSpanElement>, TypographyCommonProps, TypographyCopySnippets {
|
|
121
|
+
/** Whether the text is wrapped in a code element. */
|
|
95
122
|
code?: boolean;
|
|
123
|
+
/** Custom number parser. */
|
|
96
124
|
parser?: (value: string) => string;
|
|
125
|
+
/** Number of decimal places to keep. */
|
|
97
126
|
precision?: number;
|
|
127
|
+
/** Parsing rule: text only rounds, numbers filters out non-numeric characters, bytes-decimal and bytes-binary convert byte units, percentages converts to percent, exponential converts to scientific notation. */
|
|
98
128
|
rule?: TypographyBaseRule;
|
|
129
|
+
/** Text size; inherit takes the size of the enclosing Text or Paragraph. */
|
|
99
130
|
size?: TypographyBaseSize;
|
|
131
|
+
/** How the kept decimals are rounded, matching Math.round, Math.ceil and Math.floor. */
|
|
100
132
|
truncate?: TypographyBaseTruncate;
|
|
133
|
+
/** Snippet for the prefix icon; a Semi icon is set to small or default according to size. */
|
|
101
134
|
icon?: Snippet;
|
|
102
135
|
}
|