dsh-plugin-core-demo 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +228 -97
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -3893,6 +3893,15 @@ function Loader(props) {
|
|
|
3893
3893
|
|
|
3894
3894
|
// dist/ui/Button.js
|
|
3895
3895
|
var import_react9 = require("react");
|
|
3896
|
+
|
|
3897
|
+
// dist/ui/thenable.js
|
|
3898
|
+
function isThenable(value) {
|
|
3899
|
+
if (value === null || value === void 0)
|
|
3900
|
+
return false;
|
|
3901
|
+
return typeof value.then === "function";
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
// dist/ui/Button.js
|
|
3896
3905
|
var SOLID_VARIANTS = [
|
|
3897
3906
|
"primary",
|
|
3898
3907
|
"secondary",
|
|
@@ -3931,9 +3940,32 @@ function colorVars(variant, color) {
|
|
|
3931
3940
|
function buttonClass(variant, size4, block2, hasIcon, extra) {
|
|
3932
3941
|
return `dshpc-btn dshpc-btn--${variant} dshpc-btn--${size4}${block2 ? " dshpc-btn--block" : ""}${hasIcon ? " dshpc-btn--icon-start" : ""}${extra !== void 0 && extra !== "" ? ` ${extra}` : ""}`;
|
|
3933
3942
|
}
|
|
3943
|
+
function useAsyncClick(onClick, onBusyChange) {
|
|
3944
|
+
const [busy, setBusy] = (0, import_react9.useState)(false);
|
|
3945
|
+
const click = (event) => {
|
|
3946
|
+
if (onClick === void 0)
|
|
3947
|
+
return;
|
|
3948
|
+
const out = onClick(event);
|
|
3949
|
+
if (!isThenable(out))
|
|
3950
|
+
return;
|
|
3951
|
+
setBusy(true);
|
|
3952
|
+
onBusyChange?.(true);
|
|
3953
|
+
const done = () => {
|
|
3954
|
+
setBusy(false);
|
|
3955
|
+
onBusyChange?.(false);
|
|
3956
|
+
};
|
|
3957
|
+
void out.then(done, (err) => {
|
|
3958
|
+
done();
|
|
3959
|
+
console.error("[dsh-plugin-core] Button \u5F02\u6B65\u70B9\u51FB\u5931\u8D25\uFF0C\u5DF2\u6062\u590D\u53EF\u70B9\uFF1A", err);
|
|
3960
|
+
});
|
|
3961
|
+
};
|
|
3962
|
+
return { busy, click };
|
|
3963
|
+
}
|
|
3934
3964
|
function Button(props) {
|
|
3935
3965
|
ensureComponentStyles("button", BUTTON_CSS);
|
|
3936
|
-
const { variant = "outline", size: size4 = "lg", icon: icon2, iconRight, color, loading = false, block: block2 = false, width, minWidth, maxWidth, className: className2, style: style2, children, ...rest } = props;
|
|
3966
|
+
const { variant = "outline", size: size4 = "lg", icon: icon2, iconRight, color, loading: loadingProp = false, block: block2 = false, width, minWidth, maxWidth, className: className2, style: style2, children, onClick, onBusyChange, ...rest } = props;
|
|
3967
|
+
const asyncClick = useAsyncClick(onClick, onBusyChange);
|
|
3968
|
+
const loading = loadingProp || asyncClick.busy;
|
|
3937
3969
|
const widthStyle = {};
|
|
3938
3970
|
if (width !== void 0) {
|
|
3939
3971
|
widthStyle.width = width;
|
|
@@ -3948,14 +3980,26 @@ function Button(props) {
|
|
|
3948
3980
|
...rest,
|
|
3949
3981
|
type: rest.type ?? "button",
|
|
3950
3982
|
disabled: rest.disabled === true || loading,
|
|
3983
|
+
// 与 IconButton 同一口径:文字还在,但让读屏知道它正在忙、不是单纯不可点
|
|
3984
|
+
"aria-busy": loading || void 0,
|
|
3985
|
+
onClick: asyncClick.click,
|
|
3951
3986
|
className: buttonClass(variant, size4, block2, icon2 !== void 0 && icon2 !== null && !loading, className2),
|
|
3952
3987
|
style: { ...colorVars(variant, color), ...widthStyle, ...style2 }
|
|
3953
3988
|
};
|
|
3954
|
-
return (0, import_react9.createElement)(
|
|
3989
|
+
return (0, import_react9.createElement)(
|
|
3990
|
+
"button",
|
|
3991
|
+
attrs2,
|
|
3992
|
+
loading ? (0, import_react9.createElement)(Loader, { size: "xs" }) : icon2 !== void 0 && icon2 !== null ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon" }, icon2) : null,
|
|
3993
|
+
marqueeLabel ? (0, import_react9.createElement)(MarqueeText, { text: children, className: "dshpc-btn__label" }) : children,
|
|
3994
|
+
// 转圈期间所有图标位都让位:前置位被 Loader 顶替,后置位(展开 / 外链)留在禁用态里只会挤版面
|
|
3995
|
+
iconRight !== void 0 && iconRight !== null && !loading ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon-end" }, iconRight) : null
|
|
3996
|
+
);
|
|
3955
3997
|
}
|
|
3956
3998
|
function IconButton(props) {
|
|
3957
3999
|
ensureComponentStyles("button", BUTTON_CSS);
|
|
3958
|
-
const { variant = "plain", size: size4 = "lg", icon: icon2, label, color, background: background2, className: className2, style: style2, ...rest } = props;
|
|
4000
|
+
const { variant = "plain", size: size4 = "lg", icon: icon2, label, color, background: background2, loading: loadingProp = false, className: className2, style: style2, onClick, onBusyChange, ...rest } = props;
|
|
4001
|
+
const asyncClick = useAsyncClick(onClick, onBusyChange);
|
|
4002
|
+
const loading = loadingProp || asyncClick.busy;
|
|
3959
4003
|
const accent = {};
|
|
3960
4004
|
if (color !== void 0 && color !== "") {
|
|
3961
4005
|
accent["--icb-fg"] = color;
|
|
@@ -3971,10 +4015,14 @@ function IconButton(props) {
|
|
|
3971
4015
|
type: rest.type ?? "button",
|
|
3972
4016
|
title: rest.title ?? label,
|
|
3973
4017
|
"aria-label": rest["aria-label"] ?? label,
|
|
4018
|
+
// 无障碍名不变(仍是 label),只声明「正在忙」,读屏不会把圈读成内容
|
|
4019
|
+
"aria-busy": loading || void 0,
|
|
4020
|
+
disabled: rest.disabled === true || loading,
|
|
4021
|
+
onClick: asyncClick.click,
|
|
3974
4022
|
className: `dshpc-iconbtn dshpc-iconbtn--${variant} dshpc-iconbtn--${size4}${className2 !== void 0 && className2 !== "" ? ` ${className2}` : ""}`,
|
|
3975
4023
|
style: { ...accent, ...style2 }
|
|
3976
4024
|
};
|
|
3977
|
-
return (0, import_react9.createElement)("button", attrs2, icon2);
|
|
4025
|
+
return (0, import_react9.createElement)("button", attrs2, loading ? (0, import_react9.createElement)(Loader, { size: "xs" }) : icon2);
|
|
3978
4026
|
}
|
|
3979
4027
|
|
|
3980
4028
|
// dist/utils/date.js
|
|
@@ -4909,19 +4957,20 @@ function OverlayHead(props) {
|
|
|
4909
4957
|
function Modal(props) {
|
|
4910
4958
|
ensureComponentStyles("feedback", FEEDBACK_CSS);
|
|
4911
4959
|
const tt = props.translate ?? t;
|
|
4912
|
-
const
|
|
4913
|
-
|
|
4960
|
+
const busy = props.busy === true;
|
|
4961
|
+
const closeOnMask = !busy && props.closeOnMask !== false;
|
|
4962
|
+
useEscapeClose(!busy && props.escClose !== false, busy ? void 0 : props.onClose);
|
|
4914
4963
|
const sizeStyle = {
|
|
4915
4964
|
sm: { width: "360px", maxWidth: "calc(100% - 48px)" },
|
|
4916
4965
|
md: { width: "min(720px, calc(100% - 32px))", maxHeight: "86vh" },
|
|
4917
4966
|
lg: { width: "min(1120px, calc(100% - 32px))", height: "calc(100% - 80px)" }
|
|
4918
4967
|
};
|
|
4919
4968
|
const s = sizeStyle[props.size ?? "md"];
|
|
4920
|
-
const showClose = props.closable !== false && props.onClose !== void 0;
|
|
4969
|
+
const showClose = props.closable !== false && props.onClose !== void 0 && !busy;
|
|
4921
4970
|
const showHeader = props.hideHeader !== true && (props.icon !== void 0 || props.title !== void 0 || props.subtitle !== void 0 || props.headerExtra !== void 0 || props.headerActions !== void 0 || showClose);
|
|
4922
4971
|
return (0, import_react17.createElement)(
|
|
4923
4972
|
OverlayMask,
|
|
4924
|
-
{ kind: "center", closeOnMask, onClose: props.onClose },
|
|
4973
|
+
{ kind: "center", closeOnMask, onClose: busy ? void 0 : props.onClose },
|
|
4925
4974
|
// 表面(底色/描边/圆角/阴影)来自 panel.css 的 modal 档;`.dshpc-modal` 只剩家族布局,
|
|
4926
4975
|
// 且继续作为既有类名别名存在(消费方写在它上面的覆盖不受影响)。
|
|
4927
4976
|
(0, import_react17.createElement)(
|
|
@@ -5014,8 +5063,9 @@ function SideSheet(props) {
|
|
|
5014
5063
|
ensureComponentStyles("side-sheet", SIDE_SHEET_CSS);
|
|
5015
5064
|
const tt = props.translate ?? t;
|
|
5016
5065
|
const side = props.side ?? "left";
|
|
5017
|
-
const
|
|
5018
|
-
|
|
5066
|
+
const busy = props.busy === true;
|
|
5067
|
+
const closeOnMask = !busy && props.closeOnMask !== false;
|
|
5068
|
+
useEscapeClose(!busy && props.escClose !== false, busy ? void 0 : props.onClose);
|
|
5019
5069
|
const [width, setWidth] = (0, import_react18.useState)(props.width ?? 460);
|
|
5020
5070
|
const panelRef = (0, import_react18.useRef)(null);
|
|
5021
5071
|
const leaving = props.open === false;
|
|
@@ -5026,7 +5076,7 @@ function SideSheet(props) {
|
|
|
5026
5076
|
}, [leaving]);
|
|
5027
5077
|
if (unmounted)
|
|
5028
5078
|
return null;
|
|
5029
|
-
const showClose = props.closable !== false && props.onClose !== void 0;
|
|
5079
|
+
const showClose = props.closable !== false && props.onClose !== void 0 && !busy;
|
|
5030
5080
|
const hasHeader = props.header !== null;
|
|
5031
5081
|
const beginResize = (event) => {
|
|
5032
5082
|
const element = panelRef.current;
|
|
@@ -5069,7 +5119,7 @@ function SideSheet(props) {
|
|
|
5069
5119
|
}
|
|
5070
5120
|
return (0, import_react18.createElement)("div", { className: "dshpc-dock__head" }, props.icon === void 0 ? null : (0, import_react18.createElement)("div", { className: "dshpc-dock__lead" }, props.icon), (0, import_react18.createElement)("div", { className: "dshpc-dock__title" }, props.title), props.extra === void 0 ? null : (0, import_react18.createElement)("div", { className: "dshpc-dock__extra" }, props.extra));
|
|
5071
5121
|
};
|
|
5072
|
-
return (0, import_react18.createElement)(OverlayMask, { kind: "side", closeOnMask, onClose: props.onClose }, (0, import_react18.createElement)("section", {
|
|
5122
|
+
return (0, import_react18.createElement)(OverlayMask, { kind: "side", closeOnMask, onClose: busy ? void 0 : props.onClose }, (0, import_react18.createElement)("section", {
|
|
5073
5123
|
ref: (element) => {
|
|
5074
5124
|
panelRef.current = element;
|
|
5075
5125
|
},
|
|
@@ -5106,16 +5156,18 @@ function AlertModal(props) {
|
|
|
5106
5156
|
ensureComponentStyles("feedback", FEEDBACK_CSS);
|
|
5107
5157
|
const tt = props.translate ?? t;
|
|
5108
5158
|
const severity = props.severity ?? "info";
|
|
5159
|
+
const [running, setRunning] = (0, import_react19.useState)(false);
|
|
5160
|
+
const busy = running || props.confirmLoading === true;
|
|
5109
5161
|
return (0, import_react19.createElement)(Modal, {
|
|
5110
5162
|
icon: (0, import_react19.createElement)("span", { className: `dshpc-alert-sev dshpc-alert-sev--${severity}` }, SEVERITY_GLYPH[severity]),
|
|
5111
5163
|
title: props.title,
|
|
5112
5164
|
size: props.size ?? "sm",
|
|
5113
5165
|
hideHeader: props.title === void 0,
|
|
5114
5166
|
closable: false,
|
|
5115
|
-
closeOnMask: props.
|
|
5116
|
-
|
|
5117
|
-
onClose: props.
|
|
5118
|
-
footer: (0, import_react19.createElement)(Button, { variant: "primary", loading: props.confirmLoading === true, onClick: () => props.onConfirm?.() }, props.confirmText ?? tt("dialogOk"))
|
|
5167
|
+
closeOnMask: props.closeOnMask,
|
|
5168
|
+
busy,
|
|
5169
|
+
onClose: props.onConfirm,
|
|
5170
|
+
footer: (0, import_react19.createElement)(Button, { variant: "primary", loading: props.confirmLoading === true, onBusyChange: setRunning, onClick: () => props.onConfirm?.() }, props.confirmText ?? tt("dialogOk"))
|
|
5119
5171
|
}, props.message ?? null);
|
|
5120
5172
|
}
|
|
5121
5173
|
|
|
@@ -5125,15 +5177,18 @@ function ConfirmModal(props) {
|
|
|
5125
5177
|
const tt = props.translate ?? t;
|
|
5126
5178
|
const tone = props.tone ?? "primary";
|
|
5127
5179
|
const confirmVariant = tone === "danger" ? "danger" : tone === "warning" ? "warning" : "primary";
|
|
5128
|
-
const
|
|
5180
|
+
const [confirmBusy, setConfirmBusy] = (0, import_react20.useState)(false);
|
|
5181
|
+
const [cancelBusy, setCancelBusy] = (0, import_react20.useState)(false);
|
|
5182
|
+
const busy = confirmBusy || cancelBusy || props.confirmLoading === true || props.cancelLoading === true;
|
|
5129
5183
|
return (0, import_react20.createElement)(Modal, {
|
|
5130
5184
|
title: props.title,
|
|
5131
5185
|
size: props.size ?? "sm",
|
|
5132
5186
|
hideHeader: props.title === void 0,
|
|
5133
5187
|
closable: false,
|
|
5134
|
-
closeOnMask:
|
|
5135
|
-
|
|
5136
|
-
|
|
5188
|
+
closeOnMask: props.closeOnMask,
|
|
5189
|
+
busy,
|
|
5190
|
+
onClose: props.onCancel,
|
|
5191
|
+
footer: (0, import_react20.createElement)("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" } }, (0, import_react20.createElement)(Button, { variant: "outline", loading: props.cancelLoading === true, onBusyChange: setCancelBusy, onClick: () => props.onCancel?.() }, props.cancelText ?? tt("cancel")), (0, import_react20.createElement)(Button, { variant: confirmVariant, loading: props.confirmLoading === true, onBusyChange: setConfirmBusy, onClick: () => props.onConfirm?.() }, props.confirmText ?? tt("confirm")))
|
|
5137
5192
|
}, props.message ?? null);
|
|
5138
5193
|
}
|
|
5139
5194
|
|
|
@@ -5177,11 +5232,6 @@ var hostHandlers = null;
|
|
|
5177
5232
|
function registerHostDialog(handlers2) {
|
|
5178
5233
|
hostHandlers = handlers2;
|
|
5179
5234
|
}
|
|
5180
|
-
function isThenable(value) {
|
|
5181
|
-
if (value === null || value === void 0)
|
|
5182
|
-
return false;
|
|
5183
|
-
return typeof value.then === "function";
|
|
5184
|
-
}
|
|
5185
5235
|
function confirmModal(opts) {
|
|
5186
5236
|
if (opts.skin === "host") {
|
|
5187
5237
|
if (hostHandlers !== null) {
|
|
@@ -5199,47 +5249,31 @@ function confirmModal(opts) {
|
|
|
5199
5249
|
void _skin;
|
|
5200
5250
|
return new Promise((resolve) => {
|
|
5201
5251
|
const id3 = ++idSeq;
|
|
5202
|
-
const entry = { id: id3, node: null };
|
|
5203
|
-
let busy = null;
|
|
5204
5252
|
let closed = false;
|
|
5205
|
-
const draw = () => {
|
|
5206
|
-
entry.node = (0, import_react21.createElement)(ConfirmModal, {
|
|
5207
|
-
...core,
|
|
5208
|
-
confirmLoading: busy === "confirm",
|
|
5209
|
-
cancelLoading: busy === "cancel",
|
|
5210
|
-
onConfirm: () => void run("confirm"),
|
|
5211
|
-
onCancel: () => void run("cancel")
|
|
5212
|
-
});
|
|
5213
|
-
flush();
|
|
5214
|
-
};
|
|
5215
5253
|
const close = (result) => {
|
|
5254
|
+
if (closed)
|
|
5255
|
+
return;
|
|
5216
5256
|
closed = true;
|
|
5217
5257
|
dismiss(id3);
|
|
5218
5258
|
resolve(result);
|
|
5219
5259
|
};
|
|
5220
|
-
const run =
|
|
5221
|
-
if (closed
|
|
5222
|
-
return;
|
|
5260
|
+
const run = (which) => {
|
|
5261
|
+
if (closed)
|
|
5262
|
+
return void 0;
|
|
5223
5263
|
const out = (which === "confirm" ? onConfirm : onCancel)?.();
|
|
5224
5264
|
if (!isThenable(out)) {
|
|
5225
5265
|
close(which === "confirm");
|
|
5226
|
-
return;
|
|
5227
|
-
}
|
|
5228
|
-
busy = which;
|
|
5229
|
-
draw();
|
|
5230
|
-
try {
|
|
5231
|
-
await out;
|
|
5232
|
-
} catch (err) {
|
|
5233
|
-
busy = null;
|
|
5234
|
-
draw();
|
|
5235
|
-
console.error("[dsh-plugin-core] confirmModal \u56DE\u8C03\u5931\u8D25\uFF0C\u5F39\u7A97\u5DF2\u6062\u590D\u53EF\u64CD\u4F5C\uFF1A", err);
|
|
5236
|
-
return;
|
|
5266
|
+
return void 0;
|
|
5237
5267
|
}
|
|
5238
|
-
|
|
5239
|
-
|
|
5268
|
+
void out.then(() => close(which === "confirm"), () => {
|
|
5269
|
+
});
|
|
5270
|
+
return out;
|
|
5240
5271
|
};
|
|
5241
|
-
entries.push(
|
|
5242
|
-
|
|
5272
|
+
entries.push({
|
|
5273
|
+
id: id3,
|
|
5274
|
+
node: (0, import_react21.createElement)(ConfirmModal, { ...core, onConfirm: () => run("confirm"), onCancel: () => run("cancel") })
|
|
5275
|
+
});
|
|
5276
|
+
flush();
|
|
5243
5277
|
});
|
|
5244
5278
|
}
|
|
5245
5279
|
function alertModal(opts) {
|
|
@@ -5257,39 +5291,28 @@ function alertModal(opts) {
|
|
|
5257
5291
|
void _skin;
|
|
5258
5292
|
return new Promise((resolve) => {
|
|
5259
5293
|
const id3 = ++idSeq;
|
|
5260
|
-
|
|
5261
|
-
let busy = false;
|
|
5262
|
-
const draw = () => {
|
|
5263
|
-
entry.node = (0, import_react21.createElement)(AlertModal, { ...core, confirmLoading: busy, onConfirm: () => void run() });
|
|
5264
|
-
flush();
|
|
5265
|
-
};
|
|
5294
|
+
let closed = false;
|
|
5266
5295
|
const close = () => {
|
|
5296
|
+
if (closed)
|
|
5297
|
+
return;
|
|
5298
|
+
closed = true;
|
|
5267
5299
|
dismiss(id3);
|
|
5268
5300
|
resolve();
|
|
5269
5301
|
};
|
|
5270
|
-
const run =
|
|
5271
|
-
if (
|
|
5272
|
-
return;
|
|
5302
|
+
const run = () => {
|
|
5303
|
+
if (closed)
|
|
5304
|
+
return void 0;
|
|
5273
5305
|
const out = onConfirm?.();
|
|
5274
5306
|
if (!isThenable(out)) {
|
|
5275
5307
|
close();
|
|
5276
|
-
return;
|
|
5277
|
-
}
|
|
5278
|
-
busy = true;
|
|
5279
|
-
draw();
|
|
5280
|
-
try {
|
|
5281
|
-
await out;
|
|
5282
|
-
} catch (err) {
|
|
5283
|
-
busy = false;
|
|
5284
|
-
draw();
|
|
5285
|
-
console.error("[dsh-plugin-core] alertModal \u56DE\u8C03\u5931\u8D25\uFF0C\u5F39\u7A97\u5DF2\u6062\u590D\u53EF\u64CD\u4F5C\uFF1A", err);
|
|
5286
|
-
return;
|
|
5308
|
+
return void 0;
|
|
5287
5309
|
}
|
|
5288
|
-
|
|
5289
|
-
|
|
5310
|
+
void out.then(close, () => {
|
|
5311
|
+
});
|
|
5312
|
+
return out;
|
|
5290
5313
|
};
|
|
5291
|
-
entries.push(
|
|
5292
|
-
|
|
5314
|
+
entries.push({ id: id3, node: (0, import_react21.createElement)(AlertModal, { ...core, onConfirm: () => run() }) });
|
|
5315
|
+
flush();
|
|
5293
5316
|
});
|
|
5294
5317
|
}
|
|
5295
5318
|
|
|
@@ -7521,7 +7544,7 @@ function InputGroup(props) {
|
|
|
7521
7544
|
return;
|
|
7522
7545
|
const run = () => {
|
|
7523
7546
|
commit();
|
|
7524
|
-
action.onClick();
|
|
7547
|
+
return action.onClick();
|
|
7525
7548
|
};
|
|
7526
7549
|
const off = disabled === true || action.disabled === true;
|
|
7527
7550
|
const onlyIcon = action.label === void 0;
|
|
@@ -58423,7 +58446,7 @@ var DICT2 = {
|
|
|
58423
58446
|
demoInputFamily: "Input \u5BB6\u65CF",
|
|
58424
58447
|
inputHint: "Input / PrefixedInput / NumberInput / Textarea\uFF0C\u90FD\u652F\u6301 error \u63CF\u7EA2\uFF1B\u4F20 hint \u53C2\u6570\u5373\u81EA\u52A8\u5728\u884C\u5C3E\u6302\u6807\u51C6\u95EE\u53F7\u63D0\u793A\uFF08FieldHint \u672C\u4F53\u4ECD\u53EF\u5355\u72EC\u7528\uFF09\uFF1BInput \u4F20 icon \u5373\u5728\u5DE6\u4FA7\u52A0\u56FE\u6807\u69FD",
|
|
58425
58448
|
inputGroupTitle: "InputGroup\uFF08\u7EC4\u5408\u8F93\u5165\u6846\uFF09",
|
|
58426
|
-
inputGroupHint: "\u8F93\u5165\u6846 + \u540E\u7F6E\u6309\u94AE\u7EC4\u710A\u6210\u4E00\u4F53\uFF0C\u548C SplitGroup \u540C\u4E00\u5957\u76AE\u80A4\u53E3\u5F84\uFF08\u5916\u6846 / \u5706\u89D2 / 1px \u5206\u9694 / \u6574\u4F53\u805A\u7126\u5708\u90FD\u7531\u5916\u58F3\u753B\uFF09\uFF1Blabel \u662F\u524D\u7F6E\u6807\u9898\uFF08\u540C\u683C\u7070\u5E95\uFF09\uFF1Bactions \u5199\u591A\u5C11\u679A\u5C31\u6392\u591A\u5C11\uFF08\u8FD4\u56DE + \u786E\u5B9A\u3001\u56FE\u6807 / \u56FE\u6587 / \u7EAF\u6587\u5B57\u90FD\u884C\uFF09\uFF0C\u9ED8\u8BA4\u662F\u4E1A\u52A1\u8272\u5B9E\u5FC3\u6309\u94AE\u3001variant \u53EF\u6362\u4EFB\u610F\u6863\uFF1Bundoable \u5728\u6700\u524D\u9762\u52A0\u64A4\u9500\u94AE\uFF0C\u56DE\u9000\u5230\u4E0A\u4E00\u6B21\u63D0\u4EA4\u524D\u7684\u503C\uFF1Bsize \u4E09\u6863\uFF0Cheight \u76F4\u63A5\u7ED9 px \u81EA\u5B9A\u4E49\u9AD8\u5EA6",
|
|
58449
|
+
inputGroupHint: "\u8F93\u5165\u6846 + \u540E\u7F6E\u6309\u94AE\u7EC4\u710A\u6210\u4E00\u4F53\uFF0C\u548C SplitGroup \u540C\u4E00\u5957\u76AE\u80A4\u53E3\u5F84\uFF08\u5916\u6846 / \u5706\u89D2 / 1px \u5206\u9694 / \u6574\u4F53\u805A\u7126\u5708\u90FD\u7531\u5916\u58F3\u753B\uFF09\uFF1Blabel \u662F\u524D\u7F6E\u6807\u9898\uFF08\u540C\u683C\u7070\u5E95\uFF09\uFF1Bactions \u5199\u591A\u5C11\u679A\u5C31\u6392\u591A\u5C11\uFF08\u8FD4\u56DE + \u786E\u5B9A\u3001\u56FE\u6807 / \u56FE\u6587 / \u7EAF\u6587\u5B57\u90FD\u884C\uFF09\uFF0C\u9ED8\u8BA4\u662F\u4E1A\u52A1\u8272\u5B9E\u5FC3\u6309\u94AE\u3001variant \u53EF\u6362\u4EFB\u610F\u6863\uFF1Bundoable \u5728\u6700\u524D\u9762\u52A0\u64A4\u9500\u94AE\uFF0C\u56DE\u9000\u5230\u4E0A\u4E00\u6B21\u63D0\u4EA4\u524D\u7684\u503C\uFF1Bsize \u4E09\u6863\uFF0Cheight \u76F4\u63A5\u7ED9 px \u81EA\u5B9A\u4E49\u9AD8\u5EA6\uFF1Baction \u7684 onClick \u8FD4\u56DE Promise \u65F6\u90A3\u679A\u6309\u94AE\u81EA\u52A8\u8F6C\u5708\u7981\u7528\uFF08\u540C Button\uFF09\uFF0C\u4E0D\u7528\u81EA\u5DF1\u7BA1 loading",
|
|
58427
58450
|
switchTip: "\u5B98\u65B9 Switch\uFF08\u542F\u7528\u8BED\u4E49\uFF0C\u4E0D\u662F\u52FE\u9009\uFF09+ Checkbox + Segmented",
|
|
58428
58451
|
checkboxHint: "\u5916\u89C2\u5BF9\u9F50\u771F\u5B9E\u63D2\u4EF6\uFF1A\u7070\u5E95\u8F68\u9053 + \u767D\u8272\u9009\u4E2D\u7247\uFF1Bbordered \u662F\u5916\u6846\u6B3E\uFF08\u6700\u53F3\uFF0C\u53EF\u70B9\u7740\u73A9\uFF09\uFF1B\u661F\u671F\u65B9\u5757\u662F\u591A\u9009\u3002icon \u5728\u524D\u3001\u53EA\u6709\u56FE\u6807\u65F6\u81EA\u52A8\u6B63\u65B9\u5F62\u3002\u6587\u6848\u968F\u8BED\u8A00\u5207\u6362",
|
|
58429
58452
|
segToneTitle: "Segmented \u9009\u4E2D\u7247\u914D\u8272\uFF08tone\uFF09",
|
|
@@ -58678,7 +58701,7 @@ var DICT2 = {
|
|
|
58678
58701
|
demoInputFamily: "Input family",
|
|
58679
58702
|
inputHint: "Input / PrefixedInput / NumberInput / Textarea, all support error highlighting; pass a hint string and the standard FieldHint is attached automatically (FieldHint still works standalone); pass icon to Input to get a leading icon slot",
|
|
58680
58703
|
inputGroupTitle: "InputGroup (input with actions)",
|
|
58681
|
-
inputGroupHint: "Input and trailing buttons welded into one shell with the same skin rules as SplitGroup (frame, radius, 1px dividers and focus ring all come from the shell); label is a leading title sharing the cell; actions lays out as many buttons as you pass (back + confirm, icon / icon+text / text), coloured with Button\u2019s own semantic variants \u2014 info by default, pass success / warning / danger for those, no custom colours; undoable prepends an undo button that returns to the value before the last commit; three sizes, plus height in px for a custom height",
|
|
58704
|
+
inputGroupHint: "Input and trailing buttons welded into one shell with the same skin rules as SplitGroup (frame, radius, 1px dividers and focus ring all come from the shell); label is a leading title sharing the cell; actions lays out as many buttons as you pass (back + confirm, icon / icon+text / text), coloured with Button\u2019s own semantic variants \u2014 info by default, pass success / warning / danger for those, no custom colours; undoable prepends an undo button that returns to the value before the last commit; three sizes, plus height in px for a custom height; an action whose `onClick` returns a Promise spins and disables itself (same as Button) \u2014 no loading state to manage",
|
|
58682
58705
|
switchTip: "Official Switch (enable semantics, not a tick) + Checkbox + Segmented",
|
|
58683
58706
|
checkboxHint: "Looks match the real plugin: grey track with a white selected pill; bordered adds an outer frame (rightmost, clickable); the weekday squares are multi-select; icons lead the label and icon-only segments square themselves. Labels follow the locale",
|
|
58684
58707
|
segToneTitle: "Segmented selected-pill colors (tone)",
|
|
@@ -60102,6 +60125,10 @@ var docData = {
|
|
|
60102
60125
|
"zh": "IconButton\uFF1Avariant: plain|outline|danger\uFF08\u9ED8\u8BA4 plain\uFF0C**\u65E0\u5E95\u8272**\uFF09\u3001size\uFF08\u9ED8\u8BA4 lg\uFF09\u3001icon\uFF08\u5FC5\u586B\uFF09\u3001label\uFF08\u5FC5\u586B\uFF0C\u65E0\u969C\u788D\u540D\u517C title\uFF09\u3001color\uFF08\u56FE\u6807\u8272\uFF09\u3001background\uFF08\u5E95\u8272\uFF0C\u4E0D\u4F20\u5373\u65E0\u5E95\u8272\uFF09\u3002",
|
|
60103
60126
|
"en": "IconButton: variant plain|outline|danger (default plain, **no background**), size (default lg), icon (required), label (required, doubles as a11y name and title), color (icon colour), background (fill; omitted = no fill)."
|
|
60104
60127
|
},
|
|
60128
|
+
{
|
|
60129
|
+
"zh": "\u4E24\u8005\u7684 loading \u8BED\u4E49\u4E00\u81F4\uFF1A`onClick` \u8FD4\u56DE Promise \u5C31\u8F6C\u5708\uFF08\u7EAF\u56FE\u6807\u94AE\u628A\u56FE\u6807\u4F4D\u6362\u6210\u5C0F\u5708\uFF0C`aria-label` \u4E0D\u53D8\u3001\u8865 `aria-busy`\uFF09\uFF0C`onBusyChange` \u628A\u300C\u5728\u8DD1\u300D\u62A5\u51FA\u53BB\uFF1B\u53D7\u63A7 `loading` \u4E0E\u5B83\u53D6\u6216 \u2014\u2014 \u522B\u5904\u5237\u65B0\u4E5F\u80FD\u70B9\u4EAE\u540C\u4E00\u9897\u6309\u94AE\u3002\u8F6C\u5708\u671F\u95F4\u6309\u94AE\u81EA\u5DF1\u7684\u56FE\u6807\u4F4D\uFF08`icon` / `iconRight`\uFF09\u5168\u90E8\u8BA9\u4F4D\uFF0C\u53EA\u7559\u8F6C\u5708 + \u6587\u5B57\u3002",
|
|
60130
|
+
"en": 'Both share one loading semantics: a Promise-returning `onClick` spins (an icon button swaps its icon for the spinner, keeps `aria-label` and adds `aria-busy`), `onBusyChange` reports "running", and the controlled `loading` prop is OR-ed in \u2014 an external refresh lights the same button too. While spinning, the button\u2019s own icon slots (`icon` / `iconRight`) all step aside: spinner plus label only.'
|
|
60131
|
+
},
|
|
60105
60132
|
{
|
|
60106
60133
|
"zh": "Segmented\uFF1A`items`\uFF08\u5FC5\u586B\uFF09\u652F\u6301\u5355\u9009 / \u591A\u9009\uFF0C`size`\uFF08\u9ED8\u8BA4 lg\uFF1B\u4E09\u6863\u603B\u9AD8 24 / 28 / 32\uFF09\u3001`bordered`\uFF081px \u5916\u6846\uFF0C\u603B\u9AD8\u4E0D\u53D8\uFF09\u3001`multiple`\uFF08\u591A\u9009\uFF09\u3002\u5916\u89C2\u53EA\u6709\u4E00\u5957\uFF1A\u7070\u5E95\u8F68\u9053 + \u767D\u8272\u9009\u4E2D\u7247\uFF0C\u9009\u4E2D\u7247\u7684\u63CF\u8FB9\u73AF\u4E0E\u9634\u5F71\u7531\u5BBF\u4E3B elevation token \u63D0\u4F9B\uFF08\u79BB\u7EBF\u515C\u5E95\u503C\u6CA1\u6709\u90A3\u5708\u73AF\uFF09\u3002\u9009\u4E2D\u7247\u914D\u8272\u53EA\u7ECF `tone`\uFF1A\u4F20\u5185\u7F6E\u8272\u540D\uFF08\u4E0E Chip \u540C\u540D\u7684 business / success / warning / danger / purple / pink / cyan / teal / orange / indigo / rose / slate\uFF09\u65F6\u5E95\u4E0E\u5B57\u7531\u6838\u5FC3\u5B9A\u3001\u6DF1\u6D45\u4E24\u4E3B\u9898\u5404\u81EA\u6210\u7ACB\uFF1B\u4F20 `{ bg, fg }` \u65F6\u4E24\u4E2A\u4E3B\u9898\u90FD\u7528\u8C03\u7528\u65B9\u8FD9\u4E00\u5BF9\u989C\u8272\uFF08\u5BF9\u6BD4\u5EA6\u7531\u8C03\u7528\u65B9\u8D1F\u8D23\uFF09\u3002\u6BB5\u5185 `icon` \u662F\u524D\u7F6E\u56FE\u6807\u69FD\uFF08\u5B98\u65B9\u56FE\u6807\u7EC4\u4EF6 / \u6570\u7EC4 / \u81EA\u7ED8\u8282\u70B9\u5747\u53EF\uFF09\uFF0C`label` \u4E5F\u53EF\u4F20\u8282\u70B9\uFF1B\u987A\u5E8F\u56FA\u5B9A\u4E3A icon \u2192 label \u2192 count\u3002\u53EA\u6709\u56FE\u6807\uFF08\u65E0\u6587\u5B57 / \u8BA1\u6570 / \u89D2\u6807\uFF09\u65F6\u8BE5\u6BB5\u81EA\u52A8\u53D8\u6B63\u65B9\u5F62\uFF08\u5BBD = \u6BB5\u9AD8\uFF09\uFF0C\u8BFB\u5C4F\u540D\u7528 `ariaLabel`\uFF0C\u7F3A\u7701\u9000\u56DE `tooltip`\u3002\u6BB5\u5185 `count`\uFF08\u5F31\u5316\u7070\u5B57\uFF0C\u9009\u4E2D\u6BB5\u5185\u81EA\u52A8\u8DDF\u7740\u9009\u4E2D\u7247\u5B57\u8272\u63D0\u4EAE\uFF09/ `badge`\uFF08\u7EA2\u89D2\u6807\uFF09\u63A5\u53D7 `number | string`\uFF1A\u6570\u5B57 \u22640 \u4E0D\u663E\u793A\uFF0C\u5B57\u7B26\u4E32\u539F\u6837\u663E\u793A\uFF08\u5982 `1K` / `99+`\uFF09\u3002",
|
|
60107
60134
|
"en": "Segmented: `items` (required) supports single or multiple selection; `size` (default lg; totals 24 / 28 / 32), `bordered` (1px outer frame, same total height), `multiple` (multi-select). One look only: grey track + white selected pill; its stroke ring and shadow come from the host elevation token (the offline fallback has no ring). The selected pill\u2019s colors go through `tone` only: a built-in color name (business / success / warning / danger / purple / pink / cyan / teal / orange / indigo / rose / slate, same names as Chip) lets the core pick background and text per theme; `{ bg, fg }` uses that pair verbatim in both themes (contrast is the caller\u2019s call). An item\u2019s leading `icon` takes any node (official icon component, array, or custom); `label` also accepts a node; order is always icon \u2192 label \u2192 count. With only an icon (no label / count / badge) the segment squares itself (width = segment height), and the accessible name comes from `ariaLabel`, falling back to `tooltip`. An item\u2019s `count` (muted text; auto-lightened to follow the selected pill\u2019s text color while selected) and `badge` (red pill) take `number | string`: numbers \u22640 render nothing, strings render as given (e.g. `'1K'` / `'99+'`)."
|
|
@@ -60161,8 +60188,26 @@ var docData = {
|
|
|
60161
60188
|
"type": "boolean",
|
|
60162
60189
|
"def": "'false'",
|
|
60163
60190
|
"desc": {
|
|
60164
|
-
"zh": "\u6587\u6848\u524D\u663E\u793A\u540C\u8272\u5C0F\u5708\
|
|
60165
|
-
"en": "
|
|
60191
|
+
"zh": "\u53D7\u63A7 loading\uFF1A\u6587\u6848\u524D\u663E\u793A\u540C\u8272\u5C0F\u5708\u5E76\u81EA\u52A8 disabled\uFF08\u522B\u5904\u5237\u65B0\u4E5F\u80FD\u70B9\u4EAE\u5B83\uFF09\uFF1B\u4E0E\u300C\u70B9\u51FB\u81EA\u52A8 loading\u300D\u53D6\u6216",
|
|
60192
|
+
"en": "Controlled loading: same-color spinner before the label plus auto-disable (an external refresh can light it up too); OR-ed with automatic click loading"
|
|
60193
|
+
}
|
|
60194
|
+
},
|
|
60195
|
+
{
|
|
60196
|
+
"name": "onClick",
|
|
60197
|
+
"type": "(...) => unknown",
|
|
60198
|
+
"def": "\u2014",
|
|
60199
|
+
"desc": {
|
|
60200
|
+
"zh": "**\u8FD4\u56DE Promise \u5373\u81EA\u52A8 loading**\uFF1A\u8F6C\u5708 + \u7981\u7528 + \u9632\u8FDE\u70B9\uFF0Csettle \u540E\u81EA\u5DF1\u6062\u590D\uFF1Breject \u4E5F\u6062\u590D\u5E76\u628A\u9519\u8BEF\u6253\u5230\u63A7\u5236\u53F0\u3002\u540C\u6B65\u8FD4\u56DE\u503C = \u8001\u884C\u4E3A",
|
|
60201
|
+
"en": "**Returning a Promise enables loading automatically**: spinner, disabled, no double-clicks, restored on settle; a rejection also restores and logs the error. Sync return values behave as before"
|
|
60202
|
+
}
|
|
60203
|
+
},
|
|
60204
|
+
{
|
|
60205
|
+
"name": "onBusyChange",
|
|
60206
|
+
"type": "(busy: boolean) => void",
|
|
60207
|
+
"def": "\u2014",
|
|
60208
|
+
"desc": {
|
|
60209
|
+
"zh": "\u628A\u300C\u8FD9\u4E2A\u6309\u94AE\u6B63\u5728\u8DD1\u300D\u62A5\u51FA\u53BB\uFF08\u914D\u5408 `Modal` / `SideSheet` \u7684 `busy` \u9501\u6B7B\u5173\u95ED\uFF09\uFF0C\u4E0D\u6539\u53D8\u6309\u94AE\u81EA\u8EAB\u884C\u4E3A",
|
|
60210
|
+
"en": 'Reports "this button is running" outward (pair with `busy` on `Modal` / `SideSheet` to lock closing); does not change the button itself'
|
|
60166
60211
|
}
|
|
60167
60212
|
},
|
|
60168
60213
|
{
|
|
@@ -60215,8 +60260,8 @@ var docData = {
|
|
|
60215
60260
|
"type": "\u539F\u751F button \u5C5E\u6027",
|
|
60216
60261
|
"def": "\u2014",
|
|
60217
60262
|
"desc": {
|
|
60218
|
-
"zh": "type / disabled / title / aria-*
|
|
60219
|
-
"en": "type / disabled / title / aria-*
|
|
60263
|
+
"zh": "type / disabled / title / aria-* \u7B49\u539F\u6837\u900F\u4F20\uFF08onClick \u89C1\u4E0A\u9762\u90A3\u884C\uFF09",
|
|
60264
|
+
"en": "type / disabled / title / aria-* and friends pass through (onClick is documented above)"
|
|
60220
60265
|
}
|
|
60221
60266
|
}
|
|
60222
60267
|
]
|
|
@@ -60724,8 +60769,8 @@ var docData = {
|
|
|
60724
60769
|
"type": "InputGroupAction[]",
|
|
60725
60770
|
"def": "\u2014",
|
|
60726
60771
|
"desc": {
|
|
60727
|
-
"zh": "{ icon?, label?, variant?, disabled?, ariaLabel?, onClick }\uFF1B\u53EA\u7ED9 icon \u9000\u5316\u6210\u6B63\u65B9\u5F62\u56FE\u6807\u94AE\uFF08ariaLabel \u5FC5\u7ED9\uFF09\uFF0C\u7ED9 label \u8D70 Button\uFF1Bvariant \u9ED8\u8BA4 info\uFF0C\u8BED\u4E49\u8272\u5C31\u7528 Button \u73B0\u6210\u7684\u6863\uFF08success / info / warning / danger\uFF09\uFF0C\u4E0D\u53E6\u8C03\u8272",
|
|
60728
|
-
"en": "{ icon?, label?, variant?, disabled?, ariaLabel?, onClick }; icon-only degrades to a square icon button (pass ariaLabel), a label renders a Button; variant defaults to info \u2014 for a semantic colour pass Button\u2019s own variant (success / info / warning / danger) instead of a custom colour"
|
|
60772
|
+
"zh": "{ icon?, label?, variant?, disabled?, ariaLabel?, onClick }\uFF1B\u53EA\u7ED9 icon \u9000\u5316\u6210\u6B63\u65B9\u5F62\u56FE\u6807\u94AE\uFF08ariaLabel \u5FC5\u7ED9\uFF09\uFF0C\u7ED9 label \u8D70 Button\uFF1Bvariant \u9ED8\u8BA4 info\uFF0C\u8BED\u4E49\u8272\u5C31\u7528 Button \u73B0\u6210\u7684\u6863\uFF08success / info / warning / danger\uFF09\uFF0C\u4E0D\u53E6\u8C03\u8272\uFF1B**onClick \u8FD4\u56DE Promise \u65F6\u90A3\u679A\u6309\u94AE\u81EA\u52A8\u8F6C\u5708\u7981\u7528**\uFF0C\u4E0D\u7528\u81EA\u5DF1\u4F20 loading",
|
|
60773
|
+
"en": "{ icon?, label?, variant?, disabled?, ariaLabel?, onClick }; icon-only degrades to a square icon button (pass ariaLabel), a label renders a Button; variant defaults to info \u2014 for a semantic colour pass Button\u2019s own variant (success / info / warning / danger) instead of a custom colour; **a Promise-returning onClick spins and disables that button** \u2014 no loading prop to manage"
|
|
60729
60774
|
}
|
|
60730
60775
|
},
|
|
60731
60776
|
{
|
|
@@ -61788,6 +61833,15 @@ var docData = {
|
|
|
61788
61833
|
"en": "Close on Esc"
|
|
61789
61834
|
}
|
|
61790
61835
|
},
|
|
61836
|
+
{
|
|
61837
|
+
"name": "busy",
|
|
61838
|
+
"type": "boolean",
|
|
61839
|
+
"def": "false",
|
|
61840
|
+
"desc": {
|
|
61841
|
+
"zh": "\u6709\u5F02\u6B65\u5728\u8DD1\uFF08footer \u91CC\u7684 `Button` \u6B63\u5728 loading\uFF09\uFF1A\u906E\u7F69 / Esc / \u2715 \u4E09\u6761\u5173\u95ED\u8DEF\u5F84\u4E00\u8D77\u5931\u6548\uFF0C\u5185\u5BB9\u7167\u5E38\u3002\u5426\u51B3\u9879\uFF0C\u4E0D\u66FF\u4EE3 closeOnMask / escClose",
|
|
61842
|
+
"en": "Async work in flight (a footer `Button` is loading): mask / Esc / \u2715 all stop closing while content keeps rendering. A veto, not a replacement for closeOnMask / escClose"
|
|
61843
|
+
}
|
|
61844
|
+
},
|
|
61791
61845
|
{
|
|
61792
61846
|
"name": "maxWidth",
|
|
61793
61847
|
"type": "string",
|
|
@@ -61928,6 +61982,15 @@ var docData = {
|
|
|
61928
61982
|
"en": "Close on mask click / on Esc"
|
|
61929
61983
|
}
|
|
61930
61984
|
},
|
|
61985
|
+
{
|
|
61986
|
+
"name": "busy",
|
|
61987
|
+
"type": "boolean",
|
|
61988
|
+
"def": "false",
|
|
61989
|
+
"desc": {
|
|
61990
|
+
"zh": "\u6709\u5F02\u6B65\u5728\u8DD1\uFF08footer \u91CC\u7684 `Button` \u6B63\u5728 loading\uFF09\uFF1A\u906E\u7F69 / Esc / \u2715 \u4E09\u6761\u5173\u95ED\u8DEF\u5F84\u4E00\u8D77\u5931\u6548\uFF0C\u5185\u5BB9\u7167\u5E38\u3002\u5426\u51B3\u9879\uFF0C\u4E0D\u66FF\u4EE3 closeOnMask / escClose",
|
|
61991
|
+
"en": "Async work in flight (a footer `Button` is loading): mask / Esc / \u2715 all stop closing while content keeps rendering. A veto, not a replacement for closeOnMask / escClose"
|
|
61992
|
+
}
|
|
61993
|
+
},
|
|
61931
61994
|
{
|
|
61932
61995
|
"name": "width / minWidth / maxWidth",
|
|
61933
61996
|
"type": "number / number / number",
|
|
@@ -62816,7 +62879,16 @@ var CODE_BTN_STATE = `<Button variant="primary">\u9ED8\u8BA4</Button>
|
|
|
62816
62879
|
<Button variant="primary" disabled>\u7981\u7528</Button>
|
|
62817
62880
|
<Button variant="danger" disabled icon={<IconCloseOutlineRegular size={16} />}>\u7981\u7528</Button>
|
|
62818
62881
|
<Button variant="outline" loading>\u52A0\u8F7D\u4E2D</Button>
|
|
62819
|
-
<Button variant="primary" loading icon={<IconRefreshOutlineRegular size={16} />}>\u63D0\u4EA4\u4E2D</Button
|
|
62882
|
+
<Button variant="primary" loading icon={<IconRefreshOutlineRegular size={16} />}>\u63D0\u4EA4\u4E2D</Button>
|
|
62883
|
+
|
|
62884
|
+
// \u5F02\u6B65\uFF1AonClick \u8FD4\u56DE Promise \u21D2 \u81EA\u5DF1\u8F6C\u5708 + \u7981\u7528\uFF0Csettle \u540E\u6062\u590D\uFF08reject \u4E5F\u6062\u590D\uFF09
|
|
62885
|
+
<Button variant="primary" onClick={async () => { await save() }}>\u4FDD\u5B58</Button>
|
|
62886
|
+
|
|
62887
|
+
// \u5916\u90E8\u4E5F\u80FD\u70B9\u4EAE\u540C\u4E00\u4E2A\u6309\u94AE\uFF08\u6BD4\u5982\u522B\u5904\u6B63\u5728\u5237\u65B0\uFF09
|
|
62888
|
+
<Button variant="outline" loading={refreshing}>\u4FDD\u5B58</Button>
|
|
62889
|
+
|
|
62890
|
+
// \u628A\u300C\u5728\u8DD1\u300D\u62A5\u51FA\u53BB\uFF0C\u9501\u6B7B\u6240\u5728\u5F39\u7A97\uFF08\u5F39\u7A97\u4F20 busy\uFF09
|
|
62891
|
+
<Button onBusyChange={setBusy} onClick={async () => { await save() }}>\u4FDD\u5B58</Button>`;
|
|
62820
62892
|
var CODE_BTN_COLOR = `<Button variant="primary" color="#7c3aed">#7c3aed</Button>
|
|
62821
62893
|
<Button variant="outline" color="#0ea5e9">#0ea5e9</Button>`;
|
|
62822
62894
|
var CODE_BTN_WIDTH = `// \u56FA\u5B9A\u5BBD\uFF1A\u5199\u6B7B\u5BBD\u5EA6
|
|
@@ -62832,6 +62904,7 @@ var CODE_BTN_WIDTH = `// \u56FA\u5B9A\u5BBD\uFF1A\u5199\u6B7B\u5BBD\u5EA6
|
|
|
62832
62904
|
// \u4E09\u8005\u540C\u8BBE \u21D2 \u56FA\u5B9A\u5BBD\u4F18\u5148\uFF0C\u6700\u5C0F\u5BBD / \u6700\u5927\u5BBD\u81EA\u52A8\u5931\u6548
|
|
62833
62905
|
<Button variant="outline" width={120} minWidth={200} maxWidth={160}>\u56FA\u5B9A\u5BBD\u4F18\u5148</Button>`;
|
|
62834
62906
|
function ButtonPage() {
|
|
62907
|
+
const [extLoading, setExtLoading] = (0, import_react80.useState)(false);
|
|
62835
62908
|
return (0, import_react80.createElement)(
|
|
62836
62909
|
"div",
|
|
62837
62910
|
null,
|
|
@@ -62942,6 +63015,15 @@ function ButtonPage() {
|
|
|
62942
63015
|
(0, import_react80.createElement)(IconButton, { icon: (0, import_react80.createElement)(BUTTON_ICONS[0].Icon, { size: 16 }), label: "\u9ED8\u8BA4\u65E0\u5E95\u8272" }),
|
|
62943
63016
|
(0, import_react80.createElement)(IconButton, { icon: (0, import_react80.createElement)(BUTTON_ICONS[1].Icon, { size: 16 }), label: "\u81EA\u5B9A\u4E49\u56FE\u6807\u8272", color: "#7c3aed" }),
|
|
62944
63017
|
(0, import_react80.createElement)(IconButton, { icon: (0, import_react80.createElement)(BUTTON_ICONS[2].Icon, { size: 16 }), label: "\u81EA\u5B9A\u4E49\u5E95\u8272", color: "#fff", background: "#7c3aed" })
|
|
63018
|
+
),
|
|
63019
|
+
// 纯图标钮也吃同一套 loading:图标位换成小圈,文字本来就没有
|
|
63020
|
+
(0, import_react80.createElement)(
|
|
63021
|
+
Labeled,
|
|
63022
|
+
{ label: "IconButton \xB7 loading" },
|
|
63023
|
+
(0, import_react80.createElement)(IconButton, { icon: (0, import_react80.createElement)(BUTTON_ICONS[0].Icon, { size: 16 }), label: "\u5237\u65B0", onClick: async () => {
|
|
63024
|
+
await demoWait();
|
|
63025
|
+
} }),
|
|
63026
|
+
(0, import_react80.createElement)(IconButton, { variant: "outline", icon: (0, import_react80.createElement)(BUTTON_ICONS[0].Icon, { size: 16 }), label: "\u52A0\u8F7D\u4E2D", loading: true })
|
|
62945
63027
|
)
|
|
62946
63028
|
)
|
|
62947
63029
|
),
|
|
@@ -62964,6 +63046,16 @@ function ButtonPage() {
|
|
|
62964
63046
|
{ label: "loading" },
|
|
62965
63047
|
(0, import_react80.createElement)(Button, { variant: "outline", loading: true }, "\u52A0\u8F7D\u4E2D"),
|
|
62966
63048
|
(0, import_react80.createElement)(Button, { variant: "primary", loading: true, icon: iconOf("refresh", ICON_SIZE.lg) }, "\u63D0\u4EA4\u4E2D")
|
|
63049
|
+
),
|
|
63050
|
+
// 异步:onClick 返回 Promise 就自己转圈;外部 loading 与它取或(别处刷新也能点亮同一颗按钮)
|
|
63051
|
+
(0, import_react80.createElement)(
|
|
63052
|
+
Labeled,
|
|
63053
|
+
{ label: "\u5F02\u6B65 / \u5916\u90E8 loading" },
|
|
63054
|
+
(0, import_react80.createElement)(Button, { variant: "primary", onClick: async () => {
|
|
63055
|
+
await demoWait();
|
|
63056
|
+
} }, "\u70B9\u4E86\u81EA\u5DF1\u8F6C\u5708\uFF081.4s\uFF09"),
|
|
63057
|
+
(0, import_react80.createElement)(Button, { variant: "outline", loading: extLoading, onClick: () => setExtLoading((v) => !v) }, extLoading ? "\u5916\u90E8\u5237\u65B0\u4E2D\u2026" : "\u70B9\u6211\u70B9\u4EAE\u53F3\u8FB9"),
|
|
63058
|
+
(0, import_react80.createElement)(Button, { variant: "outline", loading: extLoading }, "\u88AB\u522B\u5904\u5237\u65B0\u5E26\u6210 loading")
|
|
62967
63059
|
)
|
|
62968
63060
|
)
|
|
62969
63061
|
),
|
|
@@ -63196,7 +63288,9 @@ function InputPage() {
|
|
|
63196
63288
|
{ label: "\u8FD4\u56DE", variant: "ghost", onClick: () => {
|
|
63197
63289
|
setIgValue("");
|
|
63198
63290
|
} },
|
|
63199
|
-
|
|
63291
|
+
// 返回 Promise ⇒ 这枚按钮自己转圈(同 Button),调用方不用管 loading
|
|
63292
|
+
{ label: "\u786E\u5B9A", variant: "success", onClick: async () => {
|
|
63293
|
+
await demoWait(1e3);
|
|
63200
63294
|
} }
|
|
63201
63295
|
]
|
|
63202
63296
|
}),
|
|
@@ -64372,8 +64466,11 @@ function FeedbackPage() {
|
|
|
64372
64466
|
const [confirmResult, setConfirmResult] = (0, import_react80.useState)("");
|
|
64373
64467
|
const [largeOpen, setLargeOpen] = (0, import_react80.useState)(false);
|
|
64374
64468
|
const [largeOpenB, setLargeOpenB] = (0, import_react80.useState)(false);
|
|
64469
|
+
const [asyncOpen, setAsyncOpen] = (0, import_react80.useState)(false);
|
|
64470
|
+
const [saving, setSaving] = (0, import_react80.useState)(false);
|
|
64375
64471
|
const [sheetCfg, setSheetCfg] = (0, import_react80.useState)({ side: "left", footer: false });
|
|
64376
64472
|
const [sheetOpen, setSheetOpen] = (0, import_react80.useState)(false);
|
|
64473
|
+
const [sheetSaving, setSheetSaving] = (0, import_react80.useState)(false);
|
|
64377
64474
|
const [nativeText, setNativeText] = (0, import_react80.useState)("");
|
|
64378
64475
|
const flash = (opts) => {
|
|
64379
64476
|
const handle = showLoading(opts);
|
|
@@ -64603,6 +64700,35 @@ function FeedbackPage() {
|
|
|
64603
64700
|
(0, import_react80.createElement)(Surface, { border: "faint", padding: "md", style: { marginTop: "12px", fontSize: "13px" } }, "\u4EFB\u610F\u5185\u5BB9\uFF0C\u4F8B\u5982\u4E00\u6BB5\u8BF4\u660E\u6216\u4E00\u4E2A\u4E1A\u52A1\u5361\u7247\u3002")
|
|
64604
64701
|
)
|
|
64605
64702
|
) : null
|
|
64703
|
+
),
|
|
64704
|
+
// 异步按钮 + busy:按钮自己转圈,把「在跑」报给 Modal,三条关闭路径一起封死
|
|
64705
|
+
(0, import_react80.createElement)(
|
|
64706
|
+
"div",
|
|
64707
|
+
null,
|
|
64708
|
+
(0, import_react80.createElement)("div", { style: { fontSize: "12px", color: "var(--dshpc-fg-3)", marginBottom: "6px" } }, "footer \u5F02\u6B65\uFF08\u4FDD\u5B58\u65F6\u6574\u6846\u9501\u6B7B\uFF09"),
|
|
64709
|
+
(0, import_react80.createElement)(Button, { variant: "outline", onClick: () => setAsyncOpen(true) }, "\u6253\u5F00\u5927\u5F39\u7A97\uFF08\u5F02\u6B65\u4FDD\u5B58\uFF09"),
|
|
64710
|
+
asyncOpen ? (0, import_react80.createElement)(
|
|
64711
|
+
Modal,
|
|
64712
|
+
{
|
|
64713
|
+
title: "\u7F16\u8F91\u4EFB\u52A1",
|
|
64714
|
+
busy: saving,
|
|
64715
|
+
onClose: () => setAsyncOpen(false),
|
|
64716
|
+
footer: (0, import_react80.createElement)(
|
|
64717
|
+
"div",
|
|
64718
|
+
{ style: { display: "flex", justifyContent: "flex-end", gap: "8px" } },
|
|
64719
|
+
(0, import_react80.createElement)(Button, { variant: "outline", disabled: saving, onClick: () => setAsyncOpen(false) }, "\u53D6\u6D88"),
|
|
64720
|
+
(0, import_react80.createElement)(Button, {
|
|
64721
|
+
variant: "primary",
|
|
64722
|
+
onBusyChange: setSaving,
|
|
64723
|
+
onClick: async () => {
|
|
64724
|
+
await demoWait();
|
|
64725
|
+
setAsyncOpen(false);
|
|
64726
|
+
}
|
|
64727
|
+
}, "\u4FDD\u5B58")
|
|
64728
|
+
)
|
|
64729
|
+
},
|
|
64730
|
+
(0, import_react80.createElement)("div", { style: { fontSize: "13px", lineHeight: "1.7" } }, "\u70B9\u300C\u4FDD\u5B58\u300D\uFF1A\u6309\u94AE\u81EA\u5DF1\u8F6C\u5708\uFF0C\u540C\u65F6\u628A busy \u62A5\u7ED9\u5F39\u7A97 \u2014\u2014 \u906E\u7F69 / Esc / \u2715 \u5168\u90E8\u5931\u6548\uFF0C1.4 \u79D2\u540E\u5173\u95ED\u3002footer \u90A3\u6761\u5206\u9694\u7EBF\u7167\u65E7\uFF0C\u4E0D\u56E0\u5F02\u6B65\u6539\u53D8\u3002")
|
|
64731
|
+
) : null
|
|
64606
64732
|
)
|
|
64607
64733
|
)
|
|
64608
64734
|
),
|
|
@@ -64633,7 +64759,12 @@ function FeedbackPage() {
|
|
|
64633
64759
|
title: "\u6587\u4EF6\u8BE6\u60C5",
|
|
64634
64760
|
extra: (0, import_react80.createElement)(Chip, null, "\u53EA\u8BFB"),
|
|
64635
64761
|
onClose: () => setSheetOpen(false),
|
|
64636
|
-
|
|
64762
|
+
// 底栏按钮异步:转圈期间抽屉也锁死(busy 由按钮报上来)
|
|
64763
|
+
busy: sheetSaving,
|
|
64764
|
+
footer: sheetCfg.footer ? (0, import_react80.createElement)(Button, { variant: "primary", onBusyChange: setSheetSaving, onClick: async () => {
|
|
64765
|
+
await demoWait(1e3);
|
|
64766
|
+
setSheetOpen(false);
|
|
64767
|
+
} }, "\u4FDD\u5B58\u5E76\u5173\u95ED") : void 0
|
|
64637
64768
|
},
|
|
64638
64769
|
(0, import_react80.createElement)(
|
|
64639
64770
|
"div",
|
|
@@ -66005,9 +66136,9 @@ function ReferencePage() {
|
|
|
66005
66136
|
"tbody",
|
|
66006
66137
|
null,
|
|
66007
66138
|
[
|
|
66008
|
-
[t3("buildCore"), `v${"0.
|
|
66009
|
-
[t3("buildDemo"), `v${"0.
|
|
66010
|
-
[t3("buildStamp"), "261103-
|
|
66139
|
+
[t3("buildCore"), `v${"0.22.1"}`],
|
|
66140
|
+
[t3("buildDemo"), `v${"0.22.1"}`],
|
|
66141
|
+
[t3("buildStamp"), "261103-115401-005"]
|
|
66011
66142
|
].map(
|
|
66012
66143
|
([label, value]) => (0, import_react85.createElement)(
|
|
66013
66144
|
"tr",
|
|
@@ -66329,9 +66460,9 @@ function DemoPage() {
|
|
|
66329
66460
|
lineHeight: "14px"
|
|
66330
66461
|
}
|
|
66331
66462
|
},
|
|
66332
|
-
(0, import_react87.createElement)("span", null, `core v${"0.
|
|
66333
|
-
(0, import_react87.createElement)("span", null, `demo v${"0.
|
|
66334
|
-
(0, import_react87.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261103-
|
|
66463
|
+
(0, import_react87.createElement)("span", null, `core v${"0.22.1"}`),
|
|
66464
|
+
(0, import_react87.createElement)("span", null, `demo v${"0.22.1"}`),
|
|
66465
|
+
(0, import_react87.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261103-115401-005")
|
|
66335
66466
|
)
|
|
66336
66467
|
)
|
|
66337
66468
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-core-demo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
|
|
5
5
|
"icon": "./assets/icon-components.svg",
|
|
6
6
|
"keywords": [
|