@dsh-workbench/shared 1.5.2-alpha.4 → 1.5.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Activity.css +69 -0
- package/dist/components/Activity.d.ts +56 -0
- package/dist/components/Activity.js +47 -0
- package/dist/components/ApprovalDetail.css +3 -0
- package/dist/components/ApprovalDetail.d.ts +42 -0
- package/dist/components/ApprovalDetail.js +53 -0
- package/dist/components/ApprovalPlan.css +39 -0
- package/dist/components/ApprovalPlan.d.ts +27 -0
- package/dist/components/ApprovalPlan.js +19 -0
- package/dist/components/Card.css +19 -0
- package/dist/components/Card.d.ts +26 -0
- package/dist/components/Card.js +18 -0
- package/dist/components/CardAnchor.d.ts +21 -0
- package/dist/components/CardAnchor.js +19 -0
- package/dist/components/CardAnchor.module.css +3 -0
- package/dist/components/CardBoundary.d.ts +42 -0
- package/dist/components/CardBoundary.js +58 -0
- package/dist/components/CardBoundary.module.css +5 -0
- package/dist/components/CardHead.css +87 -0
- package/dist/components/CardHead.d.ts +30 -0
- package/dist/components/CardHead.js +27 -0
- package/dist/components/ChoiceGroup.css +182 -0
- package/dist/components/ChoiceGroup.d.ts +54 -0
- package/dist/components/ChoiceGroup.js +63 -0
- package/dist/components/ConfirmBar.css +26 -0
- package/dist/components/ConfirmBar.d.ts +36 -0
- package/dist/components/ConfirmBar.js +26 -0
- package/dist/components/EmptyIllustration.d.ts +12 -0
- package/dist/components/EmptyIllustration.js +32 -0
- package/dist/components/Field.css +20 -0
- package/dist/components/Field.d.ts +18 -0
- package/dist/components/Field.js +15 -0
- package/dist/components/Form.css +6 -0
- package/dist/components/Form.d.ts +22 -0
- package/dist/components/Form.js +60 -0
- package/dist/components/FormActions.css +13 -0
- package/dist/components/FormActions.d.ts +29 -0
- package/dist/components/FormActions.js +43 -0
- package/dist/components/FormNodes.d.ts +107 -0
- package/dist/components/FormNodes.js +165 -0
- package/dist/components/FormRows.css +107 -0
- package/dist/components/FormRows.d.ts +36 -0
- package/dist/components/FormRows.js +26 -0
- package/dist/components/FormTypes.d.ts +84 -0
- package/dist/components/FormTypes.js +1 -0
- package/dist/components/Link.css +22 -0
- package/dist/components/Link.d.ts +22 -0
- package/dist/components/Link.js +17 -0
- package/dist/components/LongTaskRow.css +171 -0
- package/dist/components/LongTaskRow.d.ts +94 -0
- package/dist/components/LongTaskRow.js +103 -0
- package/dist/components/Note.css +13 -0
- package/dist/components/Note.d.ts +20 -0
- package/dist/components/Note.js +14 -0
- package/dist/components/ResourceStates.css +114 -0
- package/dist/components/ResourceStates.d.ts +44 -0
- package/dist/components/ResourceStates.js +41 -0
- package/dist/components/Rows.css +42 -0
- package/dist/components/Rows.d.ts +28 -0
- package/dist/components/Rows.js +21 -0
- package/dist/components/SaveBar.d.ts +24 -0
- package/dist/components/SaveBar.js +25 -0
- package/dist/components/SelectField.css +182 -0
- package/dist/components/SelectField.d.ts +89 -0
- package/dist/components/SelectField.js +260 -0
- package/dist/components/SelectFieldNodes.d.ts +49 -0
- package/dist/components/SelectFieldNodes.js +43 -0
- package/dist/components/SettingsSection.css +25 -0
- package/dist/components/SettingsSection.d.ts +20 -0
- package/dist/components/SettingsSection.js +17 -0
- package/dist/components/SetupShell.d.ts +93 -0
- package/dist/components/SetupShell.js +64 -0
- package/dist/components/SetupShell.module.css +81 -0
- package/dist/components/Spinner.css +5 -0
- package/dist/components/Spinner.d.ts +15 -0
- package/dist/components/Spinner.js +13 -0
- package/dist/components/Stack.css +6 -0
- package/dist/components/Stack.d.ts +14 -0
- package/dist/components/Stack.js +10 -0
- package/dist/components/StateBlock.css +38 -0
- package/dist/components/StateBlock.d.ts +24 -0
- package/dist/components/StateBlock.js +22 -0
- package/dist/components/TextField.css +32 -0
- package/dist/components/TextField.d.ts +14 -0
- package/dist/components/TextField.js +10 -0
- package/dist/components/board-module.d.ts +307 -0
- package/dist/components/board-module.js +1 -0
- package/dist/components/card-view-validate.d.ts +5 -0
- package/dist/components/card-view-validate.js +256 -0
- package/dist/components/icons.d.ts +63 -0
- package/dist/components/icons.js +107 -0
- package/dist/components/layout/icon-command.d.ts +8 -0
- package/dist/components/layout/icon-command.js +21 -0
- package/dist/contract/capture.d.ts +16 -0
- package/dist/contract/capture.js +1 -0
- package/dist/contract/diagnostics.d.ts +34 -0
- package/dist/contract/diagnostics.js +124 -0
- package/dist/contract/needs.d.ts +3 -1
- package/dist/contract/needs.js +4 -2
- package/dist/contract/protocol/bundle-install.d.ts +1 -1
- package/dist/contract/protocol/unit-manager.d.ts +50 -0
- package/dist/contract/protocol/unit-manager.js +2 -0
- package/dist/contract/unit.js +2 -1
- package/dist/host/adapter-contract.d.ts +3 -0
- package/dist/host/adapter-contract.js +95 -0
- package/dist/host/adapter-set.d.ts +27 -0
- package/dist/host/adapter-set.js +258 -0
- package/dist/host/adapter-types.d.ts +87 -0
- package/dist/host/adapter-types.js +23 -0
- package/dist/host/adapters/platform.d.ts +14 -0
- package/dist/host/adapters/platform.js +40 -0
- package/dist/host/adapters.d.ts +28 -0
- package/dist/host/adapters.js +9 -0
- package/dist/host/auth-loss.d.ts +33 -0
- package/dist/host/auth-loss.js +107 -0
- package/dist/host/board-fact.d.ts +8 -0
- package/dist/host/board-fact.js +16 -0
- package/dist/host/boot-record.d.ts +11 -0
- package/dist/host/boot-record.js +31 -0
- package/dist/host/browser.d.ts +3 -0
- package/dist/host/browser.js +3 -0
- package/dist/host/bundle-manager.d.ts +4 -0
- package/dist/host/bundle-manager.js +338 -0
- package/dist/host/changelog.d.ts +28 -0
- package/dist/host/changelog.js +201 -0
- package/dist/host/cli-error.d.ts +8 -0
- package/dist/host/cli-error.js +70 -0
- package/dist/host/cli.d.ts +4 -0
- package/dist/host/cli.js +9 -0
- package/dist/host/config-sync.d.ts +40 -0
- package/dist/host/config-sync.js +267 -0
- package/dist/host/context-ref.d.ts +13 -0
- package/dist/host/context-ref.js +41 -0
- package/dist/host/data-error.d.ts +15 -0
- package/dist/host/data-error.js +23 -0
- package/dist/host/data-plan-check.d.ts +10 -0
- package/dist/host/data-plan-check.js +315 -0
- package/dist/host/data-plan.d.ts +15 -0
- package/dist/host/data-plan.js +283 -0
- package/dist/host/data-root.d.ts +5 -0
- package/dist/host/data-root.js +23 -0
- package/dist/host/diy-debug.d.ts +80 -0
- package/dist/host/diy-debug.js +89 -0
- package/dist/host/diy-preset.d.ts +26 -0
- package/dist/host/diy-preset.js +115 -0
- package/dist/host/diy-record.d.ts +135 -0
- package/dist/host/diy-record.js +163 -0
- package/dist/host/dsh-compat.d.ts +27 -0
- package/dist/host/dsh-compat.js +75 -0
- package/dist/host/dsh-plugins.d.ts +5 -0
- package/dist/host/dsh-plugins.js +51 -0
- package/dist/host/env-policy.d.ts +82 -0
- package/dist/host/env-policy.js +181 -0
- package/dist/host/extension.d.ts +7 -0
- package/dist/host/extension.js +40 -0
- package/dist/host/facts.d.ts +31 -0
- package/dist/host/facts.js +58 -0
- package/dist/host/fs-write.d.ts +96 -0
- package/dist/host/fs-write.js +183 -0
- package/dist/host/git.d.ts +5 -0
- package/dist/host/git.js +1 -0
- package/dist/host/host-actions.d.ts +2 -0
- package/dist/host/host-actions.js +5 -0
- package/dist/host/host-kit.d.ts +37 -0
- package/dist/host/host-kit.js +27 -0
- package/dist/host/http.d.ts +47 -0
- package/dist/host/http.js +289 -0
- package/dist/host/install-failure.d.ts +50 -0
- package/dist/host/install-failure.js +184 -0
- package/dist/host/installed-module.d.ts +25 -0
- package/dist/host/installed-module.js +289 -0
- package/dist/host/installed-sources.d.ts +10 -0
- package/dist/host/installed-sources.js +63 -0
- package/dist/host/lease.d.ts +70 -0
- package/dist/host/lease.js +264 -0
- package/dist/host/lib-capabilities.d.ts +22 -0
- package/dist/host/lib-capabilities.js +37 -0
- package/dist/host/lib-install.d.ts +19 -0
- package/dist/host/lib-install.js +40 -0
- package/dist/host/lib-runners.d.ts +18 -0
- package/dist/host/lib-runners.js +46 -0
- package/dist/host/local-declaration.d.ts +7 -0
- package/dist/host/local-declaration.js +33 -0
- package/dist/host/long-task.d.ts +97 -0
- package/dist/host/long-task.js +297 -0
- package/dist/host/market-index-claim.d.ts +19 -0
- package/dist/host/market-index-claim.js +87 -0
- package/dist/host/market-index-doc.d.ts +12 -0
- package/dist/host/market-index-doc.js +1 -0
- package/dist/host/market-index-parse.d.ts +28 -0
- package/dist/host/market-index-parse.js +413 -0
- package/dist/host/market-index.d.ts +13 -0
- package/dist/host/market-index.js +105 -0
- package/dist/host/module-root.d.ts +1 -0
- package/dist/host/module-root.js +5 -0
- package/dist/host/needs.d.ts +4 -0
- package/dist/host/needs.js +2 -0
- package/dist/host/npm-registry.d.ts +10 -0
- package/dist/host/npm-registry.js +16 -0
- package/dist/host/package-content.d.ts +8 -0
- package/dist/host/package-content.js +90 -0
- package/dist/host/package-kind.d.ts +13 -0
- package/dist/host/package-kind.js +51 -0
- package/dist/host/package-route.d.ts +33 -0
- package/dist/host/package-route.js +68 -0
- package/dist/host/panel-state.d.ts +120 -0
- package/dist/host/panel-state.js +177 -0
- package/dist/host/patch-blocks.d.ts +13 -0
- package/dist/host/patch-blocks.js +52 -0
- package/dist/host/patch.d.ts +4 -0
- package/dist/host/patch.js +7 -0
- package/dist/host/paths.d.ts +12 -0
- package/dist/host/paths.js +20 -0
- package/dist/host/payload.d.ts +12 -0
- package/dist/host/payload.js +16 -0
- package/dist/host/plan-results.d.ts +5 -0
- package/dist/host/plan-results.js +71 -0
- package/dist/host/plan-run.d.ts +41 -0
- package/dist/host/plan-run.js +87 -0
- package/dist/host/platform.d.ts +14 -0
- package/dist/host/platform.js +40 -0
- package/dist/host/plugin-ledger.d.ts +32 -0
- package/dist/host/plugin-ledger.js +106 -0
- package/dist/host/plugin.d.ts +3 -0
- package/dist/host/plugin.js +38 -0
- package/dist/host/port-types.d.ts +233 -0
- package/dist/host/port-types.js +1 -0
- package/dist/host/preflight.d.ts +32 -0
- package/dist/host/preflight.js +1 -0
- package/dist/host/process-alive.d.ts +6 -0
- package/dist/host/process-alive.js +16 -0
- package/dist/host/profile-bundles.d.ts +20 -0
- package/dist/host/profile-bundles.js +48 -0
- package/dist/host/profile-create.d.ts +19 -0
- package/dist/host/profile-create.js +124 -0
- package/dist/host/profile-port.d.ts +4 -0
- package/dist/host/profile-port.js +4 -0
- package/dist/host/profile-registries.d.ts +10 -0
- package/dist/host/profile-registries.js +149 -0
- package/dist/host/provision.d.ts +32 -0
- package/dist/host/provision.js +105 -0
- package/dist/host/read-json.d.ts +1 -0
- package/dist/host/read-json.js +11 -0
- package/dist/host/recipe-rules.d.ts +5 -0
- package/dist/host/recipe-rules.js +412 -0
- package/dist/host/recipe.d.ts +14 -0
- package/dist/host/recipe.js +332 -0
- package/dist/host/registry-declaration.d.ts +21 -0
- package/dist/host/registry-declaration.js +42 -0
- package/dist/host/reinstall-record.d.ts +16 -0
- package/dist/host/reinstall-record.js +54 -0
- package/dist/host/release-age.d.ts +24 -0
- package/dist/host/release-age.js +92 -0
- package/dist/host/release-packages.generated.d.ts +1 -0
- package/dist/host/release-packages.generated.js +10 -0
- package/dist/host/release-probe.d.ts +37 -0
- package/dist/host/release-probe.js +156 -0
- package/dist/host/runtime/browser-argv.d.ts +1 -0
- package/dist/host/runtime/browser-argv.js +9 -0
- package/dist/host/runtime/dsh-compat.d.ts +4 -0
- package/dist/host/runtime/dsh-compat.js +32 -16
- package/dist/host/runtime/front-app.d.ts +6 -0
- package/dist/host/runtime/front-app.js +70 -0
- package/dist/host/runtime/verified-dsh.d.ts +5 -0
- package/dist/host/runtime/verified-dsh.js +20 -0
- package/dist/host/shell-render.d.ts +52 -0
- package/dist/host/shell-render.js +117 -0
- package/dist/host/shell-text.d.ts +30 -0
- package/dist/host/shell-text.js +40 -0
- package/dist/host/shell.d.ts +25 -0
- package/dist/host/shell.js +55 -0
- package/dist/host/site.d.ts +45 -0
- package/dist/host/site.js +182 -0
- package/dist/host/spec.d.ts +8 -0
- package/dist/host/spec.js +24 -0
- package/dist/host/submit-confirm.d.ts +19 -0
- package/dist/host/submit-confirm.js +45 -0
- package/dist/host/supply/builtin-catalog.d.ts +3 -0
- package/dist/host/supply/builtin-catalog.js +38 -0
- package/dist/host/supply/preflight.d.ts +14 -1
- package/dist/host/supply/supply-index.js +6 -0
- package/dist/host/supply-index.d.ts +38 -0
- package/dist/host/supply-index.js +209 -0
- package/dist/host/supply-port.d.ts +5 -0
- package/dist/host/supply-port.js +50 -0
- package/dist/host/time.d.ts +22 -0
- package/dist/host/time.js +33 -0
- package/dist/host/tokens.d.ts +26 -0
- package/dist/host/tokens.js +154 -0
- package/dist/host/tool-approval.d.ts +86 -0
- package/dist/host/tool-approval.js +118 -0
- package/dist/host/tool-kit.d.ts +8 -0
- package/dist/host/tool-kit.js +22 -0
- package/dist/host/toolbox-port.d.ts +16 -0
- package/dist/host/toolbox-port.js +1 -0
- package/dist/host/unit-config.d.ts +34 -0
- package/dist/host/unit-config.js +28 -0
- package/dist/host/unit-data.d.ts +3 -0
- package/dist/host/unit-data.js +127 -0
- package/dist/host/unit-face.d.ts +95 -0
- package/dist/host/unit-face.js +1 -0
- package/dist/host/unit-plugin.d.ts +24 -0
- package/dist/host/unit-plugin.js +25 -0
- package/dist/host/update-journal-manifest.d.ts +19 -0
- package/dist/host/update-journal-manifest.js +134 -0
- package/dist/host/update-journal-types.d.ts +33 -0
- package/dist/host/update-journal-types.js +2 -0
- package/dist/host/update-journal.d.ts +43 -0
- package/dist/host/update-journal.js +409 -0
- package/dist/host/value-handoff.d.ts +16 -0
- package/dist/host/value-handoff.js +22 -0
- package/dist/host/version-range.d.ts +2 -0
- package/dist/host/version-range.js +13 -0
- package/dist/host/version.d.ts +4 -0
- package/dist/host/version.js +32 -0
- package/dist/host/workspace-store.d.ts +19 -0
- package/dist/host/workspace-store.js +133 -0
- package/dist/host/write-result.d.ts +1 -0
- package/dist/host/write-result.js +18 -0
- package/dist/host.d.ts +2 -0
- package/dist/host.js +2 -0
- package/dist/i18n/en.js +14 -3
- package/dist/i18n/index.d.ts +15 -4
- package/dist/i18n/zh.d.ts +14 -3
- package/dist/i18n/zh.js +14 -3
- package/dist/lib/bundle-requirements.d.ts +1 -0
- package/dist/lib/bundle-requirements.js +9 -0
- package/package.json +1 -1
- package/src/contract/__tests__/unit.test.ts +7 -0
- package/src/contract/needs.ts +5 -3
- package/src/contract/protocol/bundle-install.ts +1 -0
- package/src/contract/unit.ts +2 -1
- package/src/host/runtime/__tests__/dsh-compat.test.ts +19 -1
- package/src/host/runtime/__tests__/verified-dsh.test.ts +55 -0
- package/src/host/runtime/dsh-compat.ts +36 -12
- package/src/host/runtime/verified-dsh.ts +22 -0
- package/src/host/supply/__tests__/builtin-catalog.test.ts +44 -0
- package/src/host/supply/builtin-catalog.ts +38 -0
- package/src/host/supply/preflight.ts +16 -1
- package/src/host/supply/supply-index.ts +3 -0
- package/src/host.ts +2 -0
- package/src/i18n/en.ts +17 -3
- package/src/i18n/zh.ts +16 -3
- package/src/lib/bundle-requirements.ts +11 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
.wb-centered.wb-centeredCompact {
|
|
2
|
+
flex: none;
|
|
3
|
+
min-height: 0;
|
|
4
|
+
gap: var(--wb-len-8);
|
|
5
|
+
padding: var(--wb-len-20) var(--wb-len-16);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.wb-centered.wb-centeredCompact .wb-centeredHero {
|
|
9
|
+
margin-bottom: var(--wb-len-4);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.wb-skeleton {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.wb-skeletonRow {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: var(--wb-len-8);
|
|
21
|
+
padding: var(--wb-len-8);
|
|
22
|
+
border-radius: var(--dsw-radius-md);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.wb-skeletonRow + .wb-skeletonRow::before {
|
|
26
|
+
content: '';
|
|
27
|
+
align-self: stretch;
|
|
28
|
+
height: var(--wb-len-0-5);
|
|
29
|
+
margin: 0 var(--wb-len-8) var(--wb-len-neg-0-5);
|
|
30
|
+
background: var(--dsw-alias-border-l2);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.wb-skeletonBar {
|
|
34
|
+
display: block;
|
|
35
|
+
height: var(--wb-len-13);
|
|
36
|
+
border-radius: var(--dsw-radius-xs);
|
|
37
|
+
background: var(--dsw-alias-bg-skeleton);
|
|
38
|
+
animation: wb-skeleton-pulse var(--wb-dur-1-4) var(--ds-ease-in-out) infinite;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.wb-skeletonBarTitle {
|
|
42
|
+
width: 62%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.wb-skeletonBarMeta {
|
|
46
|
+
width: 32%;
|
|
47
|
+
height: var(--wb-len-10);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.wb-skeletonRow:nth-child(2n) .wb-skeletonBarTitle {
|
|
51
|
+
width: 74%;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.wb-skeletonRow:nth-child(3n) .wb-skeletonBarTitle {
|
|
55
|
+
width: 52%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@keyframes wb-skeleton-pulse {
|
|
59
|
+
50% {
|
|
60
|
+
opacity: 0.45;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.wb-centered {
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: var(--wb-len-14);
|
|
71
|
+
flex: 1;
|
|
72
|
+
min-height: var(--wb-len-240);
|
|
73
|
+
padding: 0 var(--wb-len-24) var(--wb-len-24);
|
|
74
|
+
text-align: center;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.wb-centeredHero {
|
|
78
|
+
display: flex;
|
|
79
|
+
margin-bottom: var(--wb-len-16);
|
|
80
|
+
color: var(--dsw-alias-label-dimmed);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.wb-centeredTitle {
|
|
84
|
+
font-size: var(--dsw-font-s-14-font-size);
|
|
85
|
+
line-height: var(--wb-line-22);
|
|
86
|
+
color: var(--dsw-alias-label-primary);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.wb-centeredHint {
|
|
90
|
+
max-width: var(--wb-len-300);
|
|
91
|
+
font-size: var(--dsw-font-xxs-12-font-size);
|
|
92
|
+
line-height: var(--wb-line-18);
|
|
93
|
+
color: var(--dsw-alias-label-tertiary);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.wb-centeredDetail {
|
|
97
|
+
max-width: var(--wb-len-320);
|
|
98
|
+
font-family: var(--ds-font-family-code, monospace);
|
|
99
|
+
font-size: var(--dsw-font-xxxs-11-font-size);
|
|
100
|
+
line-height: var(--wb-line-16);
|
|
101
|
+
color: var(--dsw-alias-label-dimmed);
|
|
102
|
+
word-break: break-all;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.wb-centeredAction {
|
|
106
|
+
display: flex;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
gap: var(--wb-len-8);
|
|
109
|
+
margin-top: var(--wb-len-2);
|
|
110
|
+
}
|
|
111
|
+
@media (prefers-reduced-motion: reduce) {
|
|
112
|
+
.wb-skeletonBar {
|
|
113
|
+
animation: none;
|
|
114
|
+
}}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import './ResourceStates.css';
|
|
3
|
+
/**
|
|
4
|
+
* 骨架屏:读数期间已经知道大概形状时用它(连形状都不知道就用 `CenteredState` 那句"正在读")。
|
|
5
|
+
* @param props.rows - 画几行骨架(默认 4);整块 `aria-hidden`,不读给读屏。
|
|
6
|
+
* @returns 一叠占位条。
|
|
7
|
+
*/
|
|
8
|
+
export declare function SkeletonRows({ rows }: {
|
|
9
|
+
rows?: number;
|
|
10
|
+
}): JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* `CenteredState` 的契约:图标、标题、说明、明细与动作。
|
|
13
|
+
*/
|
|
14
|
+
export interface CenteredStateProps {
|
|
15
|
+
icon: ReactNode;
|
|
16
|
+
title: ReactNode;
|
|
17
|
+
hint?: string;
|
|
18
|
+
detail?: string;
|
|
19
|
+
action?: ReactNode;
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 居中一屏:要他先选一个 / 正在读 / 读不到时用它占住卡片版面。
|
|
24
|
+
* @param props.icon - 标题上方那枚图标;给 `null` 就只留标题(加载与报错常见)。
|
|
25
|
+
* @param props.title - 正中那行大字。
|
|
26
|
+
* @param props.hint - 标题下的一行说明。
|
|
27
|
+
* @param props.detail - 更细的一行(如原始错误码与那句话);"读不到"时把错误放这里,绝不显示 0。
|
|
28
|
+
* @param props.action - 底部动作(如"重试");不给不画。
|
|
29
|
+
* @param props.compact - 紧凑档(默认 false),卡里空间小的时候给 true。
|
|
30
|
+
* @returns 一个 `role="status"` 的居中块。
|
|
31
|
+
*/
|
|
32
|
+
export declare function CenteredState({ icon, title, hint, detail, action, compact }: CenteredStateProps): JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* 就绪但空:它只是 `CenteredState` 的简写,标题就是那句空态文案。
|
|
35
|
+
* @param props.text - 空态那句话。
|
|
36
|
+
* @param props.icon - 标题上方的图标;不给就用空态插画,要纯文字给 `null`。
|
|
37
|
+
* @param props.compact - 紧凑档,默认 false。
|
|
38
|
+
* @returns 一个居中块。
|
|
39
|
+
*/
|
|
40
|
+
export declare function EmptyState({ text, icon, compact, }: {
|
|
41
|
+
text: string;
|
|
42
|
+
icon?: ReactNode;
|
|
43
|
+
compact?: boolean;
|
|
44
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { h } from '../lib/react.js';
|
|
2
|
+
import { EmptyIllustration } from './EmptyIllustration.js';
|
|
3
|
+
import './ResourceStates.css';
|
|
4
|
+
/**
|
|
5
|
+
* 骨架屏:读数期间已经知道大概形状时用它(连形状都不知道就用 `CenteredState` 那句"正在读")。
|
|
6
|
+
* @param props.rows - 画几行骨架(默认 4);整块 `aria-hidden`,不读给读屏。
|
|
7
|
+
* @returns 一叠占位条。
|
|
8
|
+
*/
|
|
9
|
+
export function SkeletonRows({ rows = 4 }) {
|
|
10
|
+
return (h("div", { className: "wb-skeleton", "aria-hidden": "true" }, Array.from({ length: rows }, (_, index) => (h("span", { key: index, className: "wb-skeletonRow" },
|
|
11
|
+
h("span", { className: "wb-skeletonBar wb-skeletonBarTitle" }),
|
|
12
|
+
h("span", { className: "wb-skeletonBar wb-skeletonBarMeta" }))))));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 居中一屏:要他先选一个 / 正在读 / 读不到时用它占住卡片版面。
|
|
16
|
+
* @param props.icon - 标题上方那枚图标;给 `null` 就只留标题(加载与报错常见)。
|
|
17
|
+
* @param props.title - 正中那行大字。
|
|
18
|
+
* @param props.hint - 标题下的一行说明。
|
|
19
|
+
* @param props.detail - 更细的一行(如原始错误码与那句话);"读不到"时把错误放这里,绝不显示 0。
|
|
20
|
+
* @param props.action - 底部动作(如"重试");不给不画。
|
|
21
|
+
* @param props.compact - 紧凑档(默认 false),卡里空间小的时候给 true。
|
|
22
|
+
* @returns 一个 `role="status"` 的居中块。
|
|
23
|
+
*/
|
|
24
|
+
export function CenteredState({ icon, title, hint, detail, action, compact = false }) {
|
|
25
|
+
return (h("div", { className: compact ? 'wb-centered wb-centeredCompact' : 'wb-centered', role: "status" },
|
|
26
|
+
icon === null ? null : (h("span", { className: "wb-centeredHero", "aria-hidden": "true" }, icon)),
|
|
27
|
+
h("div", { className: "wb-centeredTitle" }, title),
|
|
28
|
+
hint === undefined ? null : h("div", { className: "wb-centeredHint" }, hint),
|
|
29
|
+
detail === undefined ? null : h("div", { className: "wb-centeredDetail" }, detail),
|
|
30
|
+
action === undefined ? null : h("div", { className: "wb-centeredAction" }, action)));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 就绪但空:它只是 `CenteredState` 的简写,标题就是那句空态文案。
|
|
34
|
+
* @param props.text - 空态那句话。
|
|
35
|
+
* @param props.icon - 标题上方的图标;不给就用空态插画,要纯文字给 `null`。
|
|
36
|
+
* @param props.compact - 紧凑档,默认 false。
|
|
37
|
+
* @returns 一个居中块。
|
|
38
|
+
*/
|
|
39
|
+
export function EmptyState({ text, icon = h(EmptyIllustration, { size: 72 }), compact = false, }) {
|
|
40
|
+
return h(CenteredState, { icon: icon, title: text, compact: compact });
|
|
41
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.wb-rows {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: minmax(72px, max-content) minmax(0, 1fr);
|
|
4
|
+
column-gap: var(--wb-len-8);
|
|
5
|
+
}
|
|
6
|
+
.wb-rows > :not(.wb-row) {
|
|
7
|
+
grid-column: 1 / -1;
|
|
8
|
+
}
|
|
9
|
+
.wb-row {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-column: 1 / -1;
|
|
12
|
+
grid-template-columns: minmax(72px, max-content) minmax(0, 1fr);
|
|
13
|
+
align-items: baseline;
|
|
14
|
+
gap: var(--wb-len-8);
|
|
15
|
+
padding: var(--wb-len-4) 0;
|
|
16
|
+
}
|
|
17
|
+
.wb-row + .wb-row {
|
|
18
|
+
border-top: 0.5px solid var(--dsw-alias-border-l2);
|
|
19
|
+
}
|
|
20
|
+
.wb-rowKey {
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
font-size: var(--dsw-font-xxxs-11-font-size);
|
|
23
|
+
line-height: var(--wb-line-16);
|
|
24
|
+
color: var(--dsw-alias-label-tertiary);
|
|
25
|
+
}
|
|
26
|
+
.wb-rowValue {
|
|
27
|
+
min-width: 0;
|
|
28
|
+
font-size: var(--dsw-font-xxs-12-font-size);
|
|
29
|
+
line-height: var(--wb-line-18);
|
|
30
|
+
color: var(--dsw-alias-label-primary);
|
|
31
|
+
overflow-wrap: anywhere;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.wb-rows > .wb-row {
|
|
35
|
+
grid-template-columns: subgrid;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@supports not (grid-template-columns: subgrid) {
|
|
39
|
+
.wb-rows > .wb-row {
|
|
40
|
+
grid-template-columns: minmax(72px, max-content) minmax(0, 1fr);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from '../lib/react.js';
|
|
2
|
+
import './Rows.css';
|
|
3
|
+
/**
|
|
4
|
+
* `Rows` 的契约:一组键值行的容器。
|
|
5
|
+
*/
|
|
6
|
+
export interface RowsProps {
|
|
7
|
+
readonly children?: ReactNode | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 键值行的容器:分隔线、行距与两端对齐在它和 `Row` 里,别自己写 `ul` / `li` 拼。
|
|
11
|
+
* @param props.children - 一串 `Row`。
|
|
12
|
+
* @returns 竖排的 div。
|
|
13
|
+
*/
|
|
14
|
+
export declare function Rows({ children }: RowsProps): JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* `Row` 的契约:左边名字 + 右边值。
|
|
17
|
+
*/
|
|
18
|
+
export interface RowProps {
|
|
19
|
+
readonly label: ReactNode;
|
|
20
|
+
readonly value: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 一行键值:左边名字、右边值;要成对说明一项数据就用它,别自己写两栏。
|
|
24
|
+
* @param props.label - 左边那格(键)。
|
|
25
|
+
* @param props.value - 右边那格(值),可以是数字、时间或一小段节点。
|
|
26
|
+
* @returns 一行两格。
|
|
27
|
+
*/
|
|
28
|
+
export declare function Row({ label, value }: RowProps): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { h } from '../lib/react.js';
|
|
2
|
+
import './Rows.css';
|
|
3
|
+
/**
|
|
4
|
+
* 键值行的容器:分隔线、行距与两端对齐在它和 `Row` 里,别自己写 `ul` / `li` 拼。
|
|
5
|
+
* @param props.children - 一串 `Row`。
|
|
6
|
+
* @returns 竖排的 div。
|
|
7
|
+
*/
|
|
8
|
+
export function Rows({ children }) {
|
|
9
|
+
return h("div", { className: "wb-rows" }, children);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 一行键值:左边名字、右边值;要成对说明一项数据就用它,别自己写两栏。
|
|
13
|
+
* @param props.label - 左边那格(键)。
|
|
14
|
+
* @param props.value - 右边那格(值),可以是数字、时间或一小段节点。
|
|
15
|
+
* @returns 一行两格。
|
|
16
|
+
*/
|
|
17
|
+
export function Row({ label, value }) {
|
|
18
|
+
return (h("div", { className: "wb-row" },
|
|
19
|
+
h("span", { className: "wb-rowKey" }, label),
|
|
20
|
+
h("span", { className: "wb-rowValue" }, value)));
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `SaveBar` 的契约:忙碌态、三句文案与两个回调。
|
|
3
|
+
*/
|
|
4
|
+
export interface SaveBarProps {
|
|
5
|
+
readonly busy: boolean;
|
|
6
|
+
readonly disabled?: boolean | undefined;
|
|
7
|
+
readonly labels: {
|
|
8
|
+
readonly cancel: string;
|
|
9
|
+
readonly save: string;
|
|
10
|
+
readonly saving: string;
|
|
11
|
+
};
|
|
12
|
+
readonly onCancel: () => void;
|
|
13
|
+
readonly onSave: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 设置面底下那条"取消 / 保存":就是 `FormActions` 的两颗固定动作,顺序与间距不归调用点。
|
|
17
|
+
* @param props.busy - 保存中:两颗钮一起禁用,保存那颗换成 `saving` 文案并带转圈。
|
|
18
|
+
* @param props.disabled - 再额外禁掉保存钮(如没改动可存);默认不禁,取消钮不受它管。
|
|
19
|
+
* @param props.labels - 三句文案:`cancel` / `save` / `saving`。
|
|
20
|
+
* @param props.onCancel - 点取消。
|
|
21
|
+
* @param props.onSave - 点保存。
|
|
22
|
+
* @returns 一组按钮。
|
|
23
|
+
*/
|
|
24
|
+
export declare function SaveBar({ busy, disabled, labels, onCancel, onSave }: SaveBarProps): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { h } from '../lib/react.js';
|
|
2
|
+
import { FormActions } from './FormActions.js';
|
|
3
|
+
/**
|
|
4
|
+
* 设置面底下那条"取消 / 保存":就是 `FormActions` 的两颗固定动作,顺序与间距不归调用点。
|
|
5
|
+
* @param props.busy - 保存中:两颗钮一起禁用,保存那颗换成 `saving` 文案并带转圈。
|
|
6
|
+
* @param props.disabled - 再额外禁掉保存钮(如没改动可存);默认不禁,取消钮不受它管。
|
|
7
|
+
* @param props.labels - 三句文案:`cancel` / `save` / `saving`。
|
|
8
|
+
* @param props.onCancel - 点取消。
|
|
9
|
+
* @param props.onSave - 点保存。
|
|
10
|
+
* @returns 一组按钮。
|
|
11
|
+
*/
|
|
12
|
+
export function SaveBar({ busy, disabled, labels, onCancel, onSave }) {
|
|
13
|
+
const actions = [
|
|
14
|
+
{ key: 'cancel', label: labels.cancel, kind: 'default', onClick: onCancel, disabled: busy },
|
|
15
|
+
{
|
|
16
|
+
key: 'save',
|
|
17
|
+
label: busy ? labels.saving : labels.save,
|
|
18
|
+
kind: 'primary',
|
|
19
|
+
onClick: onSave,
|
|
20
|
+
disabled: busy || disabled === true,
|
|
21
|
+
busy,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
return h(FormActions, { actions: actions });
|
|
25
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
:where(.wb-selectTrigger) {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--wb-len-8);
|
|
6
|
+
width: 100%;
|
|
7
|
+
min-height: var(--wb-len-28);
|
|
8
|
+
padding: var(--wb-len-4) var(--wb-len-10);
|
|
9
|
+
border: 0.5px solid var(--dsw-alias-border-l4);
|
|
10
|
+
border-radius: var(--dsw-radius-md);
|
|
11
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
12
|
+
font: var(--dsw-font-xs-13);
|
|
13
|
+
color: var(--dsw-alias-label-primary);
|
|
14
|
+
text-align: left;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.wb-selectTrigger:focus-visible {
|
|
19
|
+
outline: none;
|
|
20
|
+
border-color: var(--dsw-alias-state-business-primary);
|
|
21
|
+
box-shadow: inset 0 0 0 0.5px var(--dsw-alias-state-business-primary);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.wb-selectTrigger[aria-invalid='true'] {
|
|
25
|
+
border-color: var(--dsw-alias-state-error-primary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.wb-selectTrigger[aria-invalid='true']:focus-visible {
|
|
29
|
+
box-shadow: inset 0 0 0 0.5px var(--dsw-alias-state-error-primary);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.wb-selectTrigger:disabled {
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
opacity: 0.4;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.wb-selectLoading:disabled {
|
|
38
|
+
cursor: default;
|
|
39
|
+
opacity: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.wb-selectGhost {
|
|
43
|
+
gap: var(--wb-gap-xs);
|
|
44
|
+
min-height: 0;
|
|
45
|
+
height: var(--wb-len-34);
|
|
46
|
+
padding: 0 var(--wb-len-8);
|
|
47
|
+
border: none;
|
|
48
|
+
background: transparent;
|
|
49
|
+
font-size: var(--wb-font-row);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.wb-selectGhost:hover:not(:disabled) {
|
|
53
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.wb-selectGhost:focus-visible {
|
|
57
|
+
outline: var(--dsw-focus-ring-width) solid
|
|
58
|
+
var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
|
59
|
+
outline-offset: -2px;
|
|
60
|
+
border-color: transparent;
|
|
61
|
+
box-shadow: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.wb-selectIconOnly {
|
|
65
|
+
width: var(--wb-len-36);
|
|
66
|
+
height: var(--wb-len-36);
|
|
67
|
+
min-height: 0;
|
|
68
|
+
gap: 0;
|
|
69
|
+
padding: 0;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.wb-selectIconOnly .wb-selectIcon {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.wb-selectAnchor {
|
|
79
|
+
display: block;
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.wb-selectIcon {
|
|
84
|
+
flex: none;
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
width: var(--wb-len-16);
|
|
89
|
+
height: var(--wb-len-20);
|
|
90
|
+
color: var(--dsw-alias-label-tertiary);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.wb-selectValue {
|
|
94
|
+
flex: 1;
|
|
95
|
+
min-width: 0;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: baseline;
|
|
98
|
+
gap: var(--wb-len-6);
|
|
99
|
+
line-height: var(--wb-line-20);
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.wb-selectPlaceholder {
|
|
104
|
+
color: var(--dsw-alias-label-tertiary);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.wb-selectChevron {
|
|
108
|
+
flex: none;
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
color: var(--dsw-alias-label-caption);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.wb-selectChevron[data-hidden] {
|
|
114
|
+
visibility: hidden;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.wb-selectMenu {
|
|
118
|
+
min-width: var(--wb-len-240);
|
|
119
|
+
max-width: var(--wb-len-360);
|
|
120
|
+
max-height: min(var(--wb-len-320), calc(100vh - var(--wb-len-24)));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:where(.wb-selectSearch) {
|
|
124
|
+
box-sizing: border-box;
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: var(--wb-len-8);
|
|
128
|
+
width: 100%;
|
|
129
|
+
min-height: var(--wb-len-28);
|
|
130
|
+
padding: var(--wb-len-4) var(--wb-len-10);
|
|
131
|
+
border: 0.5px solid var(--dsw-alias-border-l4);
|
|
132
|
+
border-radius: var(--dsw-radius-md);
|
|
133
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.wb-selectSearch:focus-within {
|
|
137
|
+
border-color: var(--dsw-alias-state-business-primary);
|
|
138
|
+
box-shadow: inset 0 0 0 0.5px var(--dsw-alias-state-business-primary);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.wb-selectSearch.wb-selectGhost {
|
|
142
|
+
gap: var(--wb-gap-xs);
|
|
143
|
+
min-height: 0;
|
|
144
|
+
height: var(--wb-len-34);
|
|
145
|
+
padding: 0 var(--wb-len-8);
|
|
146
|
+
border: 0.5px solid var(--dsw-alias-border-l3);
|
|
147
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.wb-selectSearch.wb-selectGhost:focus-within {
|
|
151
|
+
border-color: var(--dsw-alias-state-business-primary);
|
|
152
|
+
box-shadow: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.wb-selectSearchIcon {
|
|
156
|
+
flex: none;
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
color: var(--dsw-alias-label-tertiary);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.wb-textField.wb-selectSearchInput {
|
|
162
|
+
flex: 1;
|
|
163
|
+
min-width: 0;
|
|
164
|
+
min-height: 0;
|
|
165
|
+
padding: 0;
|
|
166
|
+
border: none;
|
|
167
|
+
background: transparent;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.wb-textField.wb-selectSearchInput:focus {
|
|
171
|
+
box-shadow: none;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.wb-selectFallback {
|
|
175
|
+
width: 100%;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.wb-selectHint {
|
|
179
|
+
font-size: var(--dsw-font-xxs-12-font-size);
|
|
180
|
+
line-height: var(--wb-line-18);
|
|
181
|
+
color: var(--dsw-alias-label-tertiary);
|
|
182
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
3
|
+
import './SelectField.css';
|
|
4
|
+
/** 一个候选项:值、人看的标签,可带搜索词、图标、分组与禁用标记。 */
|
|
5
|
+
export interface SelectFieldOption {
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly label: ReactNode;
|
|
8
|
+
readonly searchText?: string | undefined;
|
|
9
|
+
readonly icon?: ReactNode | undefined;
|
|
10
|
+
readonly group?: string | undefined;
|
|
11
|
+
readonly disabled?: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** 名单读不到时的退路:值 + 变更回调,`SelectField` 会由下拉改成手填输入框。 */
|
|
14
|
+
export interface SelectFieldFallback {
|
|
15
|
+
readonly value: string;
|
|
16
|
+
readonly onChange: (next: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/** 列表底部固定那一条(如"添加工作区"):文案 + 可选图标。 */
|
|
19
|
+
export interface SelectFieldFooter {
|
|
20
|
+
readonly label: ReactNode;
|
|
21
|
+
readonly icon?: ReactNode | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** `SelectField` 的契约:值、候选、变更回调,外加搜索 / 分组 / 加载 / 空态 / 页脚那一整套开关。 */
|
|
24
|
+
export interface SelectFieldProps {
|
|
25
|
+
readonly value: string;
|
|
26
|
+
readonly options: readonly SelectFieldOption[];
|
|
27
|
+
readonly onChange: (value: string) => void;
|
|
28
|
+
readonly label?: ReactNode | undefined;
|
|
29
|
+
readonly hint?: ReactNode | undefined;
|
|
30
|
+
readonly icon?: ReactNode | undefined;
|
|
31
|
+
readonly renderValue?: ((current: SelectFieldOption | undefined) => ReactNode) | undefined;
|
|
32
|
+
readonly placeholder?: ReactNode | undefined;
|
|
33
|
+
readonly search?: boolean | undefined;
|
|
34
|
+
readonly searchLabel?: string | undefined;
|
|
35
|
+
readonly searchPlaceholder?: string | undefined;
|
|
36
|
+
readonly filter?: ((option: SelectFieldOption, query: string) => boolean) | undefined;
|
|
37
|
+
readonly emptyText?: string | ((query: string) => string) | undefined;
|
|
38
|
+
readonly open?: boolean | undefined;
|
|
39
|
+
readonly onOpenChange?: ((open: boolean) => void) | undefined;
|
|
40
|
+
readonly disabled?: boolean | undefined;
|
|
41
|
+
readonly invalid?: boolean | undefined;
|
|
42
|
+
readonly loading?: boolean | undefined;
|
|
43
|
+
readonly loadingText?: string | undefined;
|
|
44
|
+
readonly fallback?: SelectFieldFallback | undefined;
|
|
45
|
+
readonly footer?: SelectFieldFooter | undefined;
|
|
46
|
+
readonly onFooter?: (() => void) | undefined;
|
|
47
|
+
readonly selection?: 'check' | 'fill' | undefined;
|
|
48
|
+
readonly variant?: 'ghost' | 'boxed' | undefined;
|
|
49
|
+
readonly iconOnly?: boolean | undefined;
|
|
50
|
+
readonly chevronHidden?: boolean | undefined;
|
|
51
|
+
readonly ariaLabel?: string | undefined;
|
|
52
|
+
readonly title?: string | undefined;
|
|
53
|
+
readonly id?: string | undefined;
|
|
54
|
+
readonly name?: string | undefined;
|
|
55
|
+
readonly className?: string | undefined;
|
|
56
|
+
readonly menuClassName?: string | undefined;
|
|
57
|
+
}
|
|
58
|
+
/** 算候选项用来匹配搜索的文本:有 `searchText` 就用它,否则取字符串标签;标签不是字符串又没给它是空串(这项搜不到)。 */
|
|
59
|
+
export declare function searchTextOf(option: SelectFieldOption): string;
|
|
60
|
+
/** 默认匹配:查询去空白折成小写后看它是不是 `searchTextOf` 的子串;查询为空或纯空白时一律命中(留在列表里)。 */
|
|
61
|
+
export declare function defaultSelectFilter(option: SelectFieldOption, query: string): boolean;
|
|
62
|
+
/** 按查询过滤候选 —— 组件与模块自己算列表都用它,好让同一份口径管两处:`filter` 不给就用 `defaultSelectFilter`,顺序不变。 */
|
|
63
|
+
export declare function filterSelectOptions(options: readonly SelectFieldOption[], query: string, filter?: (option: SelectFieldOption, query: string) => boolean): readonly SelectFieldOption[];
|
|
64
|
+
/** 把键盘游标换算成当前该高亮那项的 value:游标 `null`(还没动过键盘)或列表为空时没有高亮;太大的游标收到最后一项,负游标取不到项也回 `null`。 */
|
|
65
|
+
export declare function selectCursorValue(shown: readonly SelectFieldOption[], cursor: number | null): string | null;
|
|
66
|
+
/** 按上下键移动游标(两头环绕):还没选过时向下取第一项、向上取最后一项;列表为空回 `null`(一步都动不了)。`step` 1 向下、-1 向上。 */
|
|
67
|
+
export declare function stepSelectCursor(shown: readonly SelectFieldOption[], cursor: number | null, step: 1 | -1): number | null;
|
|
68
|
+
/** 把候选排成 `Menu` 要的条目表:按 `group` 插分组标题(`groups: false` 时平铺);一项都没有时退回 `emptyText` 那一行(不给就是空表)。 */
|
|
69
|
+
export declare function selectEntries(shown: readonly SelectFieldOption[], emptyText: string | undefined, options?: {
|
|
70
|
+
readonly groups?: boolean;
|
|
71
|
+
}): readonly MenuEntry[];
|
|
72
|
+
/**
|
|
73
|
+
* 下拉选择:默认是跟 `TextField` 一套的常规下拉框(不是原生 `<select>`),无边框那种给 `variant: 'ghost'`。
|
|
74
|
+
* `open` 不给就内部自己管(两种接法下 `onOpenChange` 都会通知),`loading` 把触发器换成转圈 + `loadingText`(默认 `…`),
|
|
75
|
+
* `selection` 选选中行标记(`fill` 整行底色 / `check` 行尾勾),`footer` 是列表底部那一条(点它走 `onFooter`,不改当前值)。
|
|
76
|
+
* @param props.value - 当前值;在 `options` 里找不到就按"没选"画 `placeholder`。
|
|
77
|
+
* @param props.options - 全量候选;空数组且给了 `fallback` 时改画手填输入框。
|
|
78
|
+
* @param props.onChange - 选中一项后的回调,回的是那一项的 `value`。
|
|
79
|
+
* @param props.label - 没进 `FormRow` 时的标签兜底;进了那一行就别再给它和 `hint`,否则会多一个标签。
|
|
80
|
+
* @param props.renderValue - 自己渲染触发器上那份当前值;不给就用候选项的 `label`。
|
|
81
|
+
* @param props.placeholder - 没选中时那句话;不给是 `—`。
|
|
82
|
+
* @param props.chevronHidden - 箭头留着位置但不画:调用方在那个位置叠自己的操作钮。
|
|
83
|
+
* @param props.search - 是否可搜(默认 true);`false` 时不画搜索框、也不自动聚焦。
|
|
84
|
+
* @param props.filter - 自定义匹配;不给用 `defaultSelectFilter`(空白查询一律命中)。
|
|
85
|
+
* @param props.emptyText - 无匹配时的文案,或按查询生成文案的函数(能说"没有匹配 X 的项")。
|
|
86
|
+
* @param props.fallback - 退路:`options` 为空时改成手填(`value` + `onChange`)。
|
|
87
|
+
* @returns 触发器,以及打开时的搜索框与列表。
|
|
88
|
+
*/
|
|
89
|
+
export declare function SelectField(props: SelectFieldProps): ReactNode;
|