@openviking/react 0.1.1 → 0.1.2
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 +18 -15
- package/dist/3~0.js +2113 -4
- package/dist/ark-message-list-view~0.js +310 -0
- package/dist/c7~0.js +24 -0
- package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
- package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
- package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
- package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect.d.ts +3 -3
- package/dist/components/agent-connect/content-en.d.ts +137 -0
- package/dist/components/agent-connect/content-zh.d.ts +137 -0
- package/dist/components/agent-connect/style.css +495 -6
- package/dist/components/agent-connect/types.d.ts +20 -166
- package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
- package/dist/components/file-preview/file-preview-body.d.ts +24 -12
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
- package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
- package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
- package/dist/components/file-preview/file-preview-header.d.ts +23 -14
- package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
- package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
- package/dist/components/file-preview/file-preview-path.d.ts +30 -0
- package/dist/components/file-preview/file-preview-source.d.ts +24 -0
- package/dist/components/file-preview/file-preview-state.d.ts +28 -0
- package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
- package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
- package/dist/components/file-preview/file-preview.d.ts +8 -11
- package/dist/components/file-preview/style.css +3984 -128
- package/dist/components/file-preview/types.d.ts +250 -169
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +23 -0
- package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
- package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
- package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
- package/dist/components/file-preview.js +1 -442
- package/dist/components/file-tree/file-tree-body.d.ts +8 -4
- package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
- package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
- package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
- package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
- package/dist/components/file-tree/file-tree-info.d.ts +29 -0
- package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
- package/dist/components/file-tree/file-tree-row-context.d.ts +31 -9
- package/dist/components/file-tree/file-tree-row-shared.d.ts +11 -0
- package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
- package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
- package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
- package/dist/components/file-tree/file-tree-tooltip.d.ts +9 -3
- package/dist/components/file-tree/file-tree.d.ts +12 -1
- package/dist/components/file-tree/style.css +225 -57
- package/dist/components/file-tree/types.d.ts +183 -0
- package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
- package/dist/components/file-tree.js +1 -1
- package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
- package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
- package/dist/components/scope-switcher/style.css +282 -76
- package/dist/components/scope-switcher/types.d.ts +230 -108
- package/dist/components/style.css +13845 -372
- package/dist/components/tui/command-catalog.d.ts +58 -0
- package/dist/components/tui/command-completion.d.ts +19 -0
- package/dist/components/tui/command-definitions.d.ts +10 -0
- package/dist/components/tui/command-input.d.ts +16 -0
- package/dist/components/tui/style.css +1543 -5
- package/dist/components/tui/tui-assist.d.ts +15 -0
- package/dist/components/tui/tui-code-block.d.ts +8 -0
- package/dist/components/tui/tui-command-help.d.ts +9 -0
- package/dist/components/tui/tui-command-text.d.ts +6 -0
- package/dist/components/tui/tui-composer.d.ts +24 -0
- package/dist/components/tui/tui-copy-button.d.ts +9 -0
- package/dist/components/tui/tui-input-mirror.d.ts +14 -0
- package/dist/components/tui/tui-labels-zh.d.ts +2 -0
- package/dist/components/tui/tui-labels.d.ts +5 -0
- package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
- package/dist/components/tui/tui-markdown.d.ts +6 -0
- package/dist/components/tui/tui-param-hint.d.ts +7 -0
- package/dist/components/tui/tui-record-time.d.ts +11 -0
- package/dist/components/tui/tui-record.d.ts +13 -0
- package/dist/components/tui/tui-resource-preview.d.ts +10 -0
- package/dist/components/tui/tui-resource-tree.d.ts +10 -0
- package/dist/components/tui/tui-result-header.d.ts +7 -0
- package/dist/components/tui/tui-result-text.d.ts +5 -0
- package/dist/components/tui/tui-search-list.d.ts +8 -0
- package/dist/components/tui/tui-skeleton.d.ts +6 -0
- package/dist/components/tui/tui-status-card.d.ts +7 -0
- package/dist/components/tui/tui-text.d.ts +10 -0
- package/dist/components/tui/tui-uri-text.d.ts +19 -0
- package/dist/components/tui/tui-write-result.d.ts +7 -0
- package/dist/components/tui/tui.d.ts +10 -2
- package/dist/components/tui/types.d.ts +57 -15
- package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
- package/dist/components/tui/use-tui-completion.d.ts +14 -0
- package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
- package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
- package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
- package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
- package/dist/components/viking-bot/index.d.ts +10 -0
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
- package/dist/components/viking-bot/interaction/index.d.ts +4 -0
- package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
- package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
- package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
- package/dist/components/viking-bot/interaction/style.css +189 -0
- package/dist/components/viking-bot/interaction/types.d.ts +188 -0
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
- package/dist/components/viking-bot/interaction.js +2 -0
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
- package/dist/components/viking-bot/message-groups.d.ts +12 -0
- package/dist/components/viking-bot/model.d.ts +252 -0
- package/dist/components/viking-bot/render-part.d.ts +12 -0
- package/dist/components/viking-bot/style.css +7135 -0
- package/dist/components/viking-bot/style.js +0 -0
- package/dist/components/viking-bot/types.d.ts +140 -0
- package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
- package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
- package/dist/components/viking-bot/viking-bot.d.ts +16 -0
- package/dist/components/viking-bot.js +4 -0
- package/dist/c~0.js +201 -0
- package/dist/file-preview-viewer~0.js +191 -0
- package/dist/f~0.js +149 -77
- package/dist/g~0.js +1207 -0
- package/dist/h~0.js +58 -0
- package/dist/icons/file-type-icon.d.ts +31 -0
- package/dist/icons/index.d.ts +33 -23
- package/dist/icons/nextjs-icon.d.ts +19 -0
- package/dist/icons.js +1 -25
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/k~0.js +1440 -0
- package/dist/lk~0.js +25 -12
- package/dist/modules/console/style.css +83 -1
- package/dist/modules/file-browser/style.css +89 -6
- package/dist/modules/scope-cascade/style.css +282 -76
- package/dist/modules/style.css +533 -110
- package/dist/n~0.js +434 -206
- package/dist/shared/components/tooltip/index.d.ts +1 -0
- package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
- package/dist/shared/components/tooltip/types.d.ts +42 -0
- package/dist/shared/components/tooltip/use-tooltip-position.d.ts +38 -0
- package/dist/style.css +14451 -474
- package/dist/u~0.js +1597 -4
- package/dist/viking-bot-composer~0.js +164 -0
- package/dist/viking-bot-interaction~0.js +284 -0
- package/dist/w~0.js +19 -0
- package/package.json +18 -10
- package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
- package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
- package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
- package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
- package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
- package/dist/i~0.js +0 -21
- package/dist/modules/task-center/columns.d.ts +0 -129
- package/dist/modules/task-center/index.d.ts +0 -1
- package/dist/modules/task-center/style.css +0 -29
- package/dist/modules/task-center/task-center.d.ts +0 -4
- package/dist/modules/task-center/types.d.ts +0 -168
- package/dist/modules/task-center.js +0 -1
- /package/dist/{modules/task-center → components/viking-bot/interaction}/style.js +0 -0
|
@@ -42,20 +42,12 @@ export interface ScopeSwitcherOption {
|
|
|
42
42
|
disabled?: boolean;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* 层级的身份:稳定标识、无障碍名与末尾标记。这些值基本不随请求变化。
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* 只让部分层级可切换。
|
|
50
|
-
*
|
|
51
|
-
* Fields shared by every level: its identity, the trigger's accessible name and
|
|
52
|
-
* what the trigger shows.
|
|
53
|
-
*
|
|
54
|
-
* A level is either fixed or selectable, see `ScopeSwitcherFixedLevel` and
|
|
55
|
-
* `ScopeSwitcherSelectableLevel`. Both can be mixed in one row, so a host can
|
|
56
|
-
* make only some levels switchable.
|
|
47
|
+
* A level's identity: its stable key, accessible name and trailing marker. These
|
|
48
|
+
* values rarely change with a request.
|
|
57
49
|
*/
|
|
58
|
-
export interface
|
|
50
|
+
export interface ScopeSwitcherIdentity {
|
|
59
51
|
/**
|
|
60
52
|
* 稳定标识,例如 `library`、`account` 或 `user`。
|
|
61
53
|
* Stable key, for example `library`, `account` or `user`.
|
|
@@ -67,23 +59,6 @@ export interface ScopeSwitcherLevelBase {
|
|
|
67
59
|
* `aria-label` is written when omitted.
|
|
68
60
|
*/
|
|
69
61
|
ariaLabel?: string;
|
|
70
|
-
/**
|
|
71
|
-
* 触发器上展示的当前选中项文本。
|
|
72
|
-
*
|
|
73
|
-
* 由宿主单独给出,不要求等于 `options` 中对应项的 `label`:当前值可能不在已
|
|
74
|
-
* 加载的那一页里,此时展示宿主给的文本。
|
|
75
|
-
*
|
|
76
|
-
* Text shown on the trigger for the current selection.
|
|
77
|
-
*
|
|
78
|
-
* Supplied by the host and not required to equal the matching `label` in
|
|
79
|
-
* `options`: the current value may not be on the loaded page.
|
|
80
|
-
*/
|
|
81
|
-
selectedLabel: string;
|
|
82
|
-
/**
|
|
83
|
-
* 触发器图标,也可以是头像。
|
|
84
|
-
* Trigger icon, which can also be an avatar.
|
|
85
|
-
*/
|
|
86
|
-
icon?: ReactNode;
|
|
87
62
|
/**
|
|
88
63
|
* 触发器末尾的标记,例如套餐名。不传时不渲染。
|
|
89
64
|
* Tag at the end of the trigger, for example a plan name. Not rendered when
|
|
@@ -92,71 +67,117 @@ export interface ScopeSwitcherLevelBase {
|
|
|
92
67
|
tag?: ReactNode;
|
|
93
68
|
}
|
|
94
69
|
/**
|
|
95
|
-
*
|
|
70
|
+
* 触发器展示的内容:当前值文本与图标。
|
|
96
71
|
*
|
|
97
|
-
*
|
|
98
|
-
* 管理模式下不能切换的数据空间。这类层级在视觉上同样是一条面包屑,只是没有
|
|
99
|
-
* 展开箭头、不可点击,也不需要宿主伪造一份空选项列表。
|
|
100
|
-
*
|
|
101
|
-
* A fixed level: shows the current value only, renders no dropdown and takes no
|
|
102
|
-
* option or panel fields.
|
|
103
|
-
*
|
|
104
|
-
* Used where the current scope cannot be switched, for example a library and
|
|
105
|
-
* data space fixed by the sign-in in a personal terminal, or a data space that
|
|
106
|
-
* cannot be switched in management mode. It still looks like a breadcrumb
|
|
107
|
-
* segment, just without an expand affordance and not clickable, and the host
|
|
108
|
-
* does not have to fabricate an empty option list.
|
|
72
|
+
* What the trigger shows: the current value and its icon.
|
|
109
73
|
*/
|
|
110
|
-
export interface
|
|
74
|
+
export interface ScopeSwitcherTrigger {
|
|
111
75
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
76
|
+
* 触发器上展示的当前选中项文本。不传时按 `data.selectedId` 从 `data.options`
|
|
77
|
+
* 里取对应项的 `label`;两者都没有时触发器为空。
|
|
78
|
+
*
|
|
79
|
+
* 当前值不在已加载的那一页里时,传这一项由宿主给出文本。
|
|
80
|
+
*
|
|
81
|
+
* Text shown on the trigger for the current selection. When omitted it is read
|
|
82
|
+
* from the matching `data.options` entry by `data.selectedId`; with neither the
|
|
83
|
+
* trigger is empty.
|
|
84
|
+
*
|
|
85
|
+
* Supply it when the current value is not on the loaded page.
|
|
114
86
|
*/
|
|
115
|
-
|
|
87
|
+
label?: string;
|
|
88
|
+
/**
|
|
89
|
+
* 触发器图标,也可以是头像。不传时用选中项的 `icon`。
|
|
90
|
+
* Trigger icon, which can also be an avatar. Falls back to the selected
|
|
91
|
+
* option's `icon` when omitted.
|
|
92
|
+
*/
|
|
93
|
+
icon?: ReactNode;
|
|
116
94
|
}
|
|
117
95
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* 面板结构、搜索、分页与选中状态全部受控,由宿主传入。同一行里可以只有一个
|
|
121
|
-
* 可切换层级,也可以三个都可切换。
|
|
122
|
-
*
|
|
123
|
-
* A selectable level: renders an expandable trigger and its dropdown panel.
|
|
96
|
+
* 层级的数据:可选项与当前选中项。每次请求后都会变。
|
|
124
97
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
98
|
+
* A level's data: the options and the current selection. Changes after every
|
|
99
|
+
* request.
|
|
127
100
|
*/
|
|
128
|
-
export interface
|
|
101
|
+
export interface ScopeSwitcherData {
|
|
129
102
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
103
|
+
* 该层级的权威选项集合,按宿主给定的顺序渲染。它是判断当前选中值是否仍然
|
|
104
|
+
* 有效的依据,因此不要只放当前搜索结果:搜索过滤后的子集请通过
|
|
105
|
+
* `visibleOptions` 传入。
|
|
106
|
+
*
|
|
107
|
+
* The level's authoritative option set, rendered in the order the host gives.
|
|
108
|
+
* It is what decides whether the current selection is still valid, so do not
|
|
109
|
+
* pass only the current search result: hand a filtered subset in through
|
|
110
|
+
* `visibleOptions` instead.
|
|
132
111
|
*/
|
|
133
|
-
|
|
112
|
+
options: readonly ScopeSwitcherOption[];
|
|
134
113
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
114
|
+
* 面板里实际渲染的选项。不传时渲染 `options`。搜索过滤、分页追加的下一屏都
|
|
115
|
+
* 走这里,不影响选中值是否有效的判断。
|
|
116
|
+
*
|
|
117
|
+
* Options actually rendered in the panel; `options` is rendered when omitted.
|
|
118
|
+
* Search filtering and an appended page go here and never affect whether the
|
|
119
|
+
* current selection is still valid.
|
|
137
120
|
*/
|
|
138
|
-
|
|
121
|
+
visibleOptions?: readonly ScopeSwitcherOption[];
|
|
139
122
|
/**
|
|
140
123
|
* 当前选中项 id,由宿主持有。命中项渲染勾选标记并使用
|
|
141
124
|
* `role="option"` + `aria-selected` 表达状态。
|
|
142
125
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
126
|
+
* 组件只按传入的值渲染,不做归一化:id 为空或不在 `options` 里时,列表里没有
|
|
127
|
+
* 任何一行被标记为选中;id 命中一个禁用项时照常标记选中(禁用只阻止交互,不
|
|
128
|
+
* 抹掉选中态),直到宿主把它归一化掉。组件不会替宿主改选中值,也不会回调
|
|
129
|
+
* `actions.onSelect`。
|
|
130
|
+
*
|
|
131
|
+
* 作用域始终要有一个确定的值,因此**归一化由宿主负责**:在数据到达后检查
|
|
132
|
+
* `selectedId` 是否仍有效,无效则改选第一个可选项,并把结果写回 URL 与请求
|
|
133
|
+
* 参数。使用 `ScopeCascade` 时这层已经内置——它的 controller 在权威列表到达
|
|
134
|
+
* 后完成回退、清空下游并加载下一级。
|
|
135
|
+
*
|
|
136
|
+
* 只出现在 `visibleOptions` 之外不算失效:那只说明它被搜索过滤掉了。
|
|
145
137
|
*
|
|
146
138
|
* Selected option id, owned by the host. The matching option renders a check
|
|
147
139
|
* mark and expresses its state with `role="option"` and `aria-selected`.
|
|
148
140
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
141
|
+
* The component renders the value it is given and never normalises it: an id
|
|
142
|
+
* that is empty or absent from `options` marks no row as selected, while an id
|
|
143
|
+
* matching a disabled option is still rendered as selected — disabled blocks
|
|
144
|
+
* interaction, it does not clear the selection — until the host normalises it.
|
|
145
|
+
* The component neither changes the value nor calls `actions.onSelect` on the
|
|
146
|
+
* host's behalf.
|
|
147
|
+
*
|
|
148
|
+
* A scope still needs a definite value, so **normalisation belongs to the
|
|
149
|
+
* host**: after data arrives, check whether `selectedId` is still valid and
|
|
150
|
+
* pick the first selectable option when it is not, then write the result back
|
|
151
|
+
* to the URL and request parameters. `ScopeCascade` already does this — its
|
|
152
|
+
* controller falls back, resets descendants and loads the next level once the
|
|
153
|
+
* authoritative list arrives.
|
|
154
|
+
*
|
|
155
|
+
* Being absent from `visibleOptions` alone does not invalidate it: that only
|
|
156
|
+
* means the current search filtered it out.
|
|
152
157
|
*/
|
|
153
158
|
selectedId: string;
|
|
154
159
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
160
|
+
* 该层级的总条数,用于判断搜索框是否可见。不传时以 `options` 的条数为准。
|
|
161
|
+
*
|
|
162
|
+
* 搜索可见性始终取 `options`、`visibleOptions` 与 `total` 三者的最大值,因此
|
|
163
|
+
* 宿主只传当前一页的 `visibleOptions` 时,只要权威集合超过阈值,搜索框照样
|
|
164
|
+
* 出现。
|
|
165
|
+
*
|
|
166
|
+
* Total number of entries, used to decide whether the search box is shown. The
|
|
167
|
+
* `options` count is used when omitted.
|
|
168
|
+
*
|
|
169
|
+
* Visibility takes the largest of `options`, `visibleOptions` and `total`, so a
|
|
170
|
+
* host that passes only the current page still gets a search box once the
|
|
171
|
+
* authoritative set crosses the threshold.
|
|
158
172
|
*/
|
|
159
173
|
total?: number;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 层级的交互状态。随用户操作与请求进度变化。
|
|
177
|
+
*
|
|
178
|
+
* A level's interaction state. Changes with user actions and request progress.
|
|
179
|
+
*/
|
|
180
|
+
export interface ScopeSwitcherState {
|
|
160
181
|
/**
|
|
161
182
|
* 选项列表是否正在首次加载。为 `true` 时面板显示加载态,不渲染列表。
|
|
162
183
|
* Whether the option list is loading for the first time. While true the panel
|
|
@@ -164,11 +185,20 @@ export interface ScopeSwitcherSelectableLevel extends ScopeSwitcherLevelBase {
|
|
|
164
185
|
*/
|
|
165
186
|
loading?: boolean;
|
|
166
187
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
188
|
+
* 选项列表是否加载失败。为 `true` 时面板渲染 `slots.errorFallback`。
|
|
189
|
+
* Whether the option list failed to load. While true the panel renders
|
|
190
|
+
* `slots.errorFallback`.
|
|
170
191
|
*/
|
|
171
|
-
|
|
192
|
+
error?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* 该层级是否有一个变更正在进行,例如正在删除某个库或正在切换数据空间。
|
|
195
|
+
* 为 `true` 时组件禁用整个列表,避免并发切换。
|
|
196
|
+
*
|
|
197
|
+
* Whether a change is in flight for this level, for example deleting a library
|
|
198
|
+
* or switching the data space. While true the component disables the whole
|
|
199
|
+
* list so no second switch can start.
|
|
200
|
+
*/
|
|
201
|
+
busy?: boolean;
|
|
172
202
|
/**
|
|
173
203
|
* 该层级是否暂时不可切换,例如权限尚未就绪。为 `true` 时触发器置灰、不响应
|
|
174
204
|
* 点击,也不渲染下拉。恒为可切换的宿主不传。
|
|
@@ -179,20 +209,24 @@ export interface ScopeSwitcherSelectableLevel extends ScopeSwitcherLevelBase {
|
|
|
179
209
|
*/
|
|
180
210
|
disabled?: boolean;
|
|
181
211
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* `errorFallback`.
|
|
212
|
+
* 可选受控展开状态;不传时由本级选择器独立维护。
|
|
213
|
+
* Optional controlled visibility; otherwise local to this selector.
|
|
185
214
|
*/
|
|
186
|
-
|
|
215
|
+
visible?: boolean;
|
|
187
216
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* Whether a change is in flight for this level, for example deleting a library
|
|
192
|
-
* or switching the data space. While true the component disables the whole
|
|
193
|
-
* list so no second switch can start.
|
|
217
|
+
* 当前搜索关键字。非空时搜索框保持可见,并用于高亮命中片段。
|
|
218
|
+
* Current search keyword. A non-empty value keeps the search box visible and
|
|
219
|
+
* drives hit highlighting.
|
|
194
220
|
*/
|
|
195
|
-
|
|
221
|
+
searchKeyword?: string;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* 层级的插槽:由宿主替换或补充组件渲染的内容。
|
|
225
|
+
*
|
|
226
|
+
* A level's slots: content the host replaces or adds to what the component
|
|
227
|
+
* renders.
|
|
228
|
+
*/
|
|
229
|
+
export interface ScopeSwitcherSlots {
|
|
196
230
|
/**
|
|
197
231
|
* 面板内除列表以外的全部内容,由宿主自行实现。
|
|
198
232
|
*
|
|
@@ -209,6 +243,9 @@ export interface ScopeSwitcherSelectableLevel extends ScopeSwitcherLevelBase {
|
|
|
209
243
|
* entries, bottom management entries and explanatory text are all rendered by
|
|
210
244
|
* the host with its own components, links and router. When omitted the panel
|
|
211
245
|
* renders `search` and `list` alone.
|
|
246
|
+
*
|
|
247
|
+
* The panel keeps its height cap either way: a host layout that needs more room
|
|
248
|
+
* scrolls inside the panel instead of growing it.
|
|
212
249
|
*/
|
|
213
250
|
renderPanel?: (panel: ScopeSwitcherPanelContent) => ReactNode;
|
|
214
251
|
/**
|
|
@@ -244,26 +281,28 @@ export interface ScopeSwitcherSelectableLevel extends ScopeSwitcherLevelBase {
|
|
|
244
281
|
* when omitted.
|
|
245
282
|
*/
|
|
246
283
|
errorFallback?: ReactNode;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* 层级的回调:把用户意图交给宿主。
|
|
287
|
+
*
|
|
288
|
+
* A level's callbacks: user intent handed back to the host.
|
|
289
|
+
*/
|
|
290
|
+
export interface ScopeSwitcherActions {
|
|
247
291
|
/**
|
|
248
292
|
* 选中时触发;组件关闭本级面板,不改变搜索词和业务选中值。
|
|
249
293
|
* Invoked on selection. Closes this panel; selection and search remain host-owned.
|
|
250
294
|
*/
|
|
251
295
|
onSelect?: (option: ScopeSwitcherOption) => void;
|
|
252
|
-
/**
|
|
253
|
-
* 可选受控展开状态;不传时由本级选择器独立维护。
|
|
254
|
-
* Optional controlled visibility; otherwise local to this selector.
|
|
255
|
-
*/
|
|
256
|
-
visible?: boolean;
|
|
257
296
|
/**
|
|
258
297
|
* 面板可见性变化时触发,打开和关闭都会调用,参数是变化后的状态。
|
|
259
298
|
*
|
|
260
|
-
* 宿主在这里写回 `visible`,同时可按需取数,例如打开时才请求第一页选项。
|
|
299
|
+
* 宿主在这里写回 `state.visible`,同时可按需取数,例如打开时才请求第一页选项。
|
|
261
300
|
*
|
|
262
301
|
* Invoked whenever the panel's visibility changes — on both open and close —
|
|
263
302
|
* with the new state.
|
|
264
303
|
*
|
|
265
|
-
* The host writes it back to `visible` and can load data on demand from
|
|
266
|
-
* for example requesting the first page only when the panel opens.
|
|
304
|
+
* The host writes it back to `state.visible` and can load data on demand from
|
|
305
|
+
* it, for example requesting the first page only when the panel opens.
|
|
267
306
|
*/
|
|
268
307
|
onVisibleChange?: (visible: boolean) => void;
|
|
269
308
|
/**
|
|
@@ -274,18 +313,18 @@ export interface ScopeSwitcherSelectableLevel extends ScopeSwitcherLevelBase {
|
|
|
274
313
|
onSearchKeywordChange?: (keyword: string) => void;
|
|
275
314
|
/**
|
|
276
315
|
* 选项列表滚动时触发,参数是滚动后的位置信息。是否加载下一页由宿主判断,加载
|
|
277
|
-
* 完成后把新一页通过 `options` 传回。不传时不响应滚动。
|
|
316
|
+
* 完成后把新一页通过 `data.options` 传回。不传时不响应滚动。
|
|
278
317
|
*
|
|
279
318
|
* Invoked when the option list scrolls, with the resulting scroll metrics. The
|
|
280
319
|
* host decides whether to load the next page and passes it back through
|
|
281
|
-
* `options`. Scrolling is not observed when omitted.
|
|
320
|
+
* `data.options`. Scrolling is not observed when omitted.
|
|
282
321
|
*/
|
|
283
322
|
onScroll?: (metrics: ScopeSwitcherScrollMetrics) => void;
|
|
284
323
|
}
|
|
285
324
|
/**
|
|
286
|
-
* 组件渲染好的面板内容,作为参数传给 `renderPanel`。
|
|
325
|
+
* 组件渲染好的面板内容,作为参数传给 `slots.renderPanel`。
|
|
287
326
|
*
|
|
288
|
-
* Panel content the component rendered, passed to `renderPanel`.
|
|
327
|
+
* Panel content the component rendered, passed to `slots.renderPanel`.
|
|
289
328
|
*/
|
|
290
329
|
export interface ScopeSwitcherPanelContent {
|
|
291
330
|
/**
|
|
@@ -300,10 +339,10 @@ export interface ScopeSwitcherPanelContent {
|
|
|
300
339
|
list: ReactNode;
|
|
301
340
|
}
|
|
302
341
|
/**
|
|
303
|
-
* 选项列表滚动时的位置信息,由组件从列表元素上读取后传入 `onScroll`。
|
|
342
|
+
* 选项列表滚动时的位置信息,由组件从列表元素上读取后传入 `actions.onScroll`。
|
|
304
343
|
*
|
|
305
344
|
* Scroll metrics of the option list, read from the list element and passed to
|
|
306
|
-
* `onScroll`.
|
|
345
|
+
* `actions.onScroll`.
|
|
307
346
|
*/
|
|
308
347
|
export interface ScopeSwitcherScrollMetrics {
|
|
309
348
|
/**
|
|
@@ -322,13 +361,6 @@ export interface ScopeSwitcherScrollMetrics {
|
|
|
322
361
|
*/
|
|
323
362
|
clientHeight: number;
|
|
324
363
|
}
|
|
325
|
-
/**
|
|
326
|
-
* 面包屑中的一个层级。按 `kind` 区分固定与可切换两种形态,同一行里可以混用。
|
|
327
|
-
*
|
|
328
|
-
* One level of the breadcrumb. `kind` separates the fixed and selectable forms;
|
|
329
|
-
* both can be mixed in one row.
|
|
330
|
-
*/
|
|
331
|
-
export type ScopeSwitcherLevel = ScopeSwitcherFixedLevel | ScopeSwitcherSelectableLevel;
|
|
332
364
|
/**
|
|
333
365
|
* 可替换文案,组件内置英文默认值。
|
|
334
366
|
* Replaceable copy; the component ships English defaults.
|
|
@@ -360,8 +392,98 @@ export interface ScopeSwitcherLabels {
|
|
|
360
392
|
}
|
|
361
393
|
/** Layout only: each child owns its state and data subscription. */
|
|
362
394
|
export type ScopeSwitcherProps = HTMLAttributes<HTMLDivElement>;
|
|
363
|
-
/**
|
|
364
|
-
|
|
365
|
-
|
|
395
|
+
/**
|
|
396
|
+
* 两种层级共有的入参:身份与触发器内容。
|
|
397
|
+
*
|
|
398
|
+
* Props shared by both level forms: identity and what the trigger shows.
|
|
399
|
+
*/
|
|
400
|
+
export interface ScopeSelectorBaseProps {
|
|
401
|
+
/**
|
|
402
|
+
* 层级身份:稳定标识、无障碍名与末尾标记。
|
|
403
|
+
* Level identity: stable key, accessible name and trailing marker.
|
|
404
|
+
*/
|
|
405
|
+
identity: ScopeSwitcherIdentity;
|
|
406
|
+
/**
|
|
407
|
+
* 触发器展示的当前值文本与图标。不传时从 `data.options` 里按 `data.selectedId`
|
|
408
|
+
* 取对应项;固定层级没有 `data`,因此固定层级需要在这里给出 `label`。
|
|
409
|
+
*
|
|
410
|
+
* The current value and icon shown on the trigger. When omitted they are read
|
|
411
|
+
* from `data.options` by `data.selectedId`; a fixed level has no `data`, so it
|
|
412
|
+
* supplies `label` here.
|
|
413
|
+
*/
|
|
414
|
+
trigger?: ScopeSwitcherTrigger;
|
|
415
|
+
/**
|
|
416
|
+
* 可替换文案,缺省为英文。
|
|
417
|
+
* Replaceable copy; English by default.
|
|
418
|
+
*/
|
|
366
419
|
labels?: ScopeSwitcherLabels;
|
|
367
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* 固定层级的入参:只展示当前值,不渲染下拉,也不接收任何选项或面板字段。
|
|
423
|
+
*
|
|
424
|
+
* 用于当前作用域不可切换的情形,例如个人终端里跟随登录态固定的库与数据空间、
|
|
425
|
+
* 管理模式下不能切换的数据空间。这类层级在视觉上同样是一条面包屑,只是没有
|
|
426
|
+
* 展开箭头、不可点击,也不需要宿主伪造一份空选项列表。
|
|
427
|
+
*
|
|
428
|
+
* Props of a fixed level: shows the current value only, renders no dropdown and
|
|
429
|
+
* takes no option or panel fields.
|
|
430
|
+
*
|
|
431
|
+
* Used where the current scope cannot be switched, for example a library and
|
|
432
|
+
* data space fixed by the sign-in in a personal terminal, or a data space that
|
|
433
|
+
* cannot be switched in management mode. It still looks like a breadcrumb
|
|
434
|
+
* segment, just without an expand affordance and not clickable, and the host
|
|
435
|
+
* does not have to fabricate an empty option list.
|
|
436
|
+
*/
|
|
437
|
+
export interface ScopeSelectorFixedProps extends ScopeSelectorBaseProps {
|
|
438
|
+
/**
|
|
439
|
+
* 判别字段,固定层级为 `'fixed'`。
|
|
440
|
+
* Discriminant, always `'fixed'` for a fixed level.
|
|
441
|
+
*/
|
|
442
|
+
kind: 'fixed';
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* 可切换层级的入参:渲染可展开的触发器与下拉面板。
|
|
446
|
+
*
|
|
447
|
+
* 面板结构、搜索、分页与选中状态全部受控,由宿主传入。同一行里可以只有一个
|
|
448
|
+
* 可切换层级,也可以三个都可切换。
|
|
449
|
+
*
|
|
450
|
+
* Props of a selectable level: renders an expandable trigger and its dropdown
|
|
451
|
+
* panel.
|
|
452
|
+
*
|
|
453
|
+
* The panel structure, search, paging and selection are all controlled and come
|
|
454
|
+
* from the host. A row can hold one selectable level or several.
|
|
455
|
+
*/
|
|
456
|
+
export interface ScopeSelectorSelectableProps extends ScopeSelectorBaseProps {
|
|
457
|
+
/**
|
|
458
|
+
* 判别字段,可切换层级为 `'selectable'`。
|
|
459
|
+
* Discriminant, always `'selectable'` for a selectable level.
|
|
460
|
+
*/
|
|
461
|
+
kind: 'selectable';
|
|
462
|
+
/**
|
|
463
|
+
* 可选项与当前选中项。
|
|
464
|
+
* The options and the current selection.
|
|
465
|
+
*/
|
|
466
|
+
data: ScopeSwitcherData;
|
|
467
|
+
/**
|
|
468
|
+
* 加载、错误、忙碌、禁用、展开与搜索关键字等交互状态。
|
|
469
|
+
* Interaction state: loading, error, busy, disabled, visibility and keyword.
|
|
470
|
+
*/
|
|
471
|
+
state?: ScopeSwitcherState;
|
|
472
|
+
/**
|
|
473
|
+
* 用户意图回调。
|
|
474
|
+
* Callbacks for user intent.
|
|
475
|
+
*/
|
|
476
|
+
actions?: ScopeSwitcherActions;
|
|
477
|
+
/**
|
|
478
|
+
* 宿主替换或补充的渲染内容。
|
|
479
|
+
* Content the host replaces or adds.
|
|
480
|
+
*/
|
|
481
|
+
slots?: ScopeSwitcherSlots;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* 一个作用域选择器的入参。按 `kind` 区分固定与可切换两种形态,同一行里可以混用。
|
|
485
|
+
*
|
|
486
|
+
* Props of one scope selector. `kind` separates the fixed and selectable forms;
|
|
487
|
+
* both can be mixed in one row.
|
|
488
|
+
*/
|
|
489
|
+
export type ScopeSelectorProps = ScopeSelectorFixedProps | ScopeSelectorSelectableProps;
|