@sia.soul/sia-react-ui 0.1.156 → 0.1.157
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/index.cjs +1 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28216,7 +28216,6 @@ function QueryForm({
|
|
|
28216
28216
|
const [saveOpen, setSaveOpen] = (0, import_react111.useState)(false);
|
|
28217
28217
|
const [saveName, setSaveName] = (0, import_react111.useState)("");
|
|
28218
28218
|
const [saveError, setSaveError] = (0, import_react111.useState)("");
|
|
28219
|
-
const [error, setError] = (0, import_react111.useState)("");
|
|
28220
28219
|
const [activeShortcut, setActiveShortcut] = (0, import_react111.useState)("");
|
|
28221
28220
|
const source = (0, import_react111.useRef)({ source: "submit" });
|
|
28222
28221
|
const searchLock = (0, import_react111.useRef)(false);
|
|
@@ -28347,11 +28346,9 @@ function QueryForm({
|
|
|
28347
28346
|
if (searchLock.current || disabled || loading) return;
|
|
28348
28347
|
searchLock.current = true;
|
|
28349
28348
|
setSearching(true);
|
|
28350
|
-
setError("");
|
|
28351
28349
|
try {
|
|
28352
28350
|
await onSearch(values, info);
|
|
28353
28351
|
} catch (reason) {
|
|
28354
|
-
setError(reason instanceof Error ? reason.message : "\u67E5\u8BE2\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
|
|
28355
28352
|
onError?.(reason, "search");
|
|
28356
28353
|
} finally {
|
|
28357
28354
|
searchLock.current = false;
|
|
@@ -28370,7 +28367,6 @@ function QueryForm({
|
|
|
28370
28367
|
if (busy) return;
|
|
28371
28368
|
form.resetFields();
|
|
28372
28369
|
setActiveShortcut("");
|
|
28373
|
-
setError("");
|
|
28374
28370
|
if (resetSearch) {
|
|
28375
28371
|
source.current = { source: "reset" };
|
|
28376
28372
|
form.submit();
|
|
@@ -28391,9 +28387,6 @@ function QueryForm({
|
|
|
28391
28387
|
await onSaveQuery({ name, values: snapshot.current });
|
|
28392
28388
|
setSaveOpen(false);
|
|
28393
28389
|
} catch (reason) {
|
|
28394
|
-
setSaveError(
|
|
28395
|
-
reason instanceof Error ? reason.message : "\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"
|
|
28396
|
-
);
|
|
28397
28390
|
onError?.(reason, "save");
|
|
28398
28391
|
return false;
|
|
28399
28392
|
} finally {
|
|
@@ -28405,12 +28398,10 @@ function QueryForm({
|
|
|
28405
28398
|
if (!onRemoveQuery || shortcutBusy || removeLock.current) return;
|
|
28406
28399
|
removeLock.current = true;
|
|
28407
28400
|
setRemoving(true);
|
|
28408
|
-
setError("");
|
|
28409
28401
|
try {
|
|
28410
28402
|
await onRemoveQuery(query);
|
|
28411
28403
|
if (activeShortcut === `saved:${query.key}`) setActiveShortcut("");
|
|
28412
28404
|
} catch (reason) {
|
|
28413
|
-
setError(reason instanceof Error ? reason.message : "\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
|
|
28414
28405
|
onError?.(reason, "remove");
|
|
28415
28406
|
} finally {
|
|
28416
28407
|
removeLock.current = false;
|
|
@@ -28560,8 +28551,7 @@ function QueryForm({
|
|
|
28560
28551
|
query.key
|
|
28561
28552
|
)),
|
|
28562
28553
|
" "
|
|
28563
|
-
] }) : null
|
|
28564
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
28554
|
+
] }) : null
|
|
28565
28555
|
]
|
|
28566
28556
|
}
|
|
28567
28557
|
),
|
package/dist/index.d.cts
CHANGED
|
@@ -3574,7 +3574,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
|
|
|
3574
3574
|
}) => void | Promise<void>;
|
|
3575
3575
|
/** 删除已保存快捷项时调用,query 为被删除的完整快捷项。业务方负责持久化并更新 savedQueries;失败保留该项,删除操作不会触发查询。 */
|
|
3576
3576
|
onRemoveQuery?: (query: QueryFormShortcut<T>) => void | Promise<void>;
|
|
3577
|
-
/**
|
|
3577
|
+
/** 查询、保存或删除失败时调用,error 为原始异常,operation 为 search、save 或 remove。组件结束等待并保留条件/草稿,不渲染接口异常或额外弹出消息;错误展示由业务回调或统一请求层负责。未提供回调时也不展示接口异常。快捷查询名称为空等本地校验仍显示。 */
|
|
3578
3578
|
onError?: (error: unknown, operation: "search" | "save" | "remove") => void;
|
|
3579
3579
|
/**
|
|
3580
3580
|
* 查询按钮文案。
|
package/dist/index.d.ts
CHANGED
|
@@ -3574,7 +3574,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
|
|
|
3574
3574
|
}) => void | Promise<void>;
|
|
3575
3575
|
/** 删除已保存快捷项时调用,query 为被删除的完整快捷项。业务方负责持久化并更新 savedQueries;失败保留该项,删除操作不会触发查询。 */
|
|
3576
3576
|
onRemoveQuery?: (query: QueryFormShortcut<T>) => void | Promise<void>;
|
|
3577
|
-
/**
|
|
3577
|
+
/** 查询、保存或删除失败时调用,error 为原始异常,operation 为 search、save 或 remove。组件结束等待并保留条件/草稿,不渲染接口异常或额外弹出消息;错误展示由业务回调或统一请求层负责。未提供回调时也不展示接口异常。快捷查询名称为空等本地校验仍显示。 */
|
|
3578
3578
|
onError?: (error: unknown, operation: "search" | "save" | "remove") => void;
|
|
3579
3579
|
/**
|
|
3580
3580
|
* 查询按钮文案。
|
package/dist/index.js
CHANGED
|
@@ -11622,7 +11622,6 @@ function QueryForm({
|
|
|
11622
11622
|
const [saveOpen, setSaveOpen] = useState28(false);
|
|
11623
11623
|
const [saveName, setSaveName] = useState28("");
|
|
11624
11624
|
const [saveError, setSaveError] = useState28("");
|
|
11625
|
-
const [error, setError] = useState28("");
|
|
11626
11625
|
const [activeShortcut, setActiveShortcut] = useState28("");
|
|
11627
11626
|
const source = useRef29({ source: "submit" });
|
|
11628
11627
|
const searchLock = useRef29(false);
|
|
@@ -11753,11 +11752,9 @@ function QueryForm({
|
|
|
11753
11752
|
if (searchLock.current || disabled || loading) return;
|
|
11754
11753
|
searchLock.current = true;
|
|
11755
11754
|
setSearching(true);
|
|
11756
|
-
setError("");
|
|
11757
11755
|
try {
|
|
11758
11756
|
await onSearch(values, info);
|
|
11759
11757
|
} catch (reason) {
|
|
11760
|
-
setError(reason instanceof Error ? reason.message : "\u67E5\u8BE2\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
|
|
11761
11758
|
onError?.(reason, "search");
|
|
11762
11759
|
} finally {
|
|
11763
11760
|
searchLock.current = false;
|
|
@@ -11776,7 +11773,6 @@ function QueryForm({
|
|
|
11776
11773
|
if (busy) return;
|
|
11777
11774
|
form.resetFields();
|
|
11778
11775
|
setActiveShortcut("");
|
|
11779
|
-
setError("");
|
|
11780
11776
|
if (resetSearch) {
|
|
11781
11777
|
source.current = { source: "reset" };
|
|
11782
11778
|
form.submit();
|
|
@@ -11797,9 +11793,6 @@ function QueryForm({
|
|
|
11797
11793
|
await onSaveQuery({ name, values: snapshot.current });
|
|
11798
11794
|
setSaveOpen(false);
|
|
11799
11795
|
} catch (reason) {
|
|
11800
|
-
setSaveError(
|
|
11801
|
-
reason instanceof Error ? reason.message : "\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"
|
|
11802
|
-
);
|
|
11803
11796
|
onError?.(reason, "save");
|
|
11804
11797
|
return false;
|
|
11805
11798
|
} finally {
|
|
@@ -11811,12 +11804,10 @@ function QueryForm({
|
|
|
11811
11804
|
if (!onRemoveQuery || shortcutBusy || removeLock.current) return;
|
|
11812
11805
|
removeLock.current = true;
|
|
11813
11806
|
setRemoving(true);
|
|
11814
|
-
setError("");
|
|
11815
11807
|
try {
|
|
11816
11808
|
await onRemoveQuery(query);
|
|
11817
11809
|
if (activeShortcut === `saved:${query.key}`) setActiveShortcut("");
|
|
11818
11810
|
} catch (reason) {
|
|
11819
|
-
setError(reason instanceof Error ? reason.message : "\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
|
|
11820
11811
|
onError?.(reason, "remove");
|
|
11821
11812
|
} finally {
|
|
11822
11813
|
removeLock.current = false;
|
|
@@ -11966,8 +11957,7 @@ function QueryForm({
|
|
|
11966
11957
|
query.key
|
|
11967
11958
|
)),
|
|
11968
11959
|
" "
|
|
11969
|
-
] }) : null
|
|
11970
|
-
error ? /* @__PURE__ */ jsx34("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
11960
|
+
] }) : null
|
|
11971
11961
|
]
|
|
11972
11962
|
}
|
|
11973
11963
|
),
|