@dovetail-v2/refine 0.4.0 → 0.4.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/refine.cjs +21 -13
- package/dist/refine.js +21 -13
- package/dist/types/resource.d.ts +2 -0
- package/package.json +1 -1
package/dist/refine.cjs
CHANGED
|
@@ -11741,7 +11741,7 @@ function YamlFormContainer({
|
|
|
11741
11741
|
const RawYamlFormModal_1nvs0vj = "";
|
|
11742
11742
|
const FormDescStyle$1 = "fdhreji";
|
|
11743
11743
|
function RawYamlFormModal(props) {
|
|
11744
|
-
var _a, _b;
|
|
11744
|
+
var _a, _b, _c;
|
|
11745
11745
|
const {
|
|
11746
11746
|
id,
|
|
11747
11747
|
yamlFormProps: customYamlFormProps,
|
|
@@ -11762,16 +11762,20 @@ function RawYamlFormModal(props) {
|
|
|
11762
11762
|
(_a2 = saveButtonProps.onClick) == null ? void 0 : _a2.call(saveButtonProps, e2);
|
|
11763
11763
|
}, [saveButtonProps]);
|
|
11764
11764
|
const errorText = React.useMemo(() => {
|
|
11765
|
+
var _a2;
|
|
11765
11766
|
if (isError) {
|
|
11767
|
+
const customText = (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formFailedText;
|
|
11768
|
+
if (customText)
|
|
11769
|
+
return customText;
|
|
11766
11770
|
return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
|
|
11767
11771
|
}
|
|
11768
11772
|
return "";
|
|
11769
|
-
}, [isError, id, i18n2]);
|
|
11773
|
+
}, [isError, id, i18n2, (_a = resourceConfig.formConfig) == null ? void 0 : _a.formFailedText]);
|
|
11770
11774
|
const title = React.useMemo(() => {
|
|
11771
|
-
var _a2, _b2,
|
|
11775
|
+
var _a2, _b2, _c2, _d;
|
|
11772
11776
|
if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formTitle) === "string")
|
|
11773
11777
|
return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formTitle;
|
|
11774
|
-
if (typeof ((
|
|
11778
|
+
if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
|
|
11775
11779
|
return (_d = resourceConfig.formConfig) == null ? void 0 : _d.formTitle(action);
|
|
11776
11780
|
}
|
|
11777
11781
|
const label2 = resourceConfig.displayName || (resourceConfig == null ? void 0 : resourceConfig.kind);
|
|
@@ -11780,10 +11784,10 @@ function RawYamlFormModal(props) {
|
|
|
11780
11784
|
});
|
|
11781
11785
|
}, [action, resourceConfig.formConfig, resourceConfig.displayName, resourceConfig == null ? void 0 : resourceConfig.kind, i18n2, id]);
|
|
11782
11786
|
const desc = React.useMemo(() => {
|
|
11783
|
-
var _a2, _b2,
|
|
11787
|
+
var _a2, _b2, _c2, _d;
|
|
11784
11788
|
if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formDesc) === "string")
|
|
11785
11789
|
return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formDesc;
|
|
11786
|
-
if (typeof ((
|
|
11790
|
+
if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formDesc) === "function") {
|
|
11787
11791
|
return (_d = resourceConfig.formConfig) == null ? void 0 : _d.formDesc(action);
|
|
11788
11792
|
}
|
|
11789
11793
|
return "";
|
|
@@ -11813,9 +11817,9 @@ function RawYamlFormModal(props) {
|
|
|
11813
11817
|
onOk,
|
|
11814
11818
|
okButtonProps: {
|
|
11815
11819
|
...lodashEs.omit(saveButtonProps, "onClick"),
|
|
11816
|
-
children: (
|
|
11820
|
+
children: (_b = resourceConfig.formConfig) == null ? void 0 : _b.saveButtonText
|
|
11817
11821
|
},
|
|
11818
|
-
okText: ((
|
|
11822
|
+
okText: ((_c = resourceConfig.formConfig) == null ? void 0 : _c.saveButtonText) || okText,
|
|
11819
11823
|
destroyOnClose: true,
|
|
11820
11824
|
children: [desc ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
|
|
11821
11825
|
className: FormDescStyle$1,
|
|
@@ -17365,7 +17369,7 @@ function ConfirmModal({
|
|
|
17365
17369
|
});
|
|
17366
17370
|
}
|
|
17367
17371
|
function FormModal(props) {
|
|
17368
|
-
var _a, _b, _c, _d;
|
|
17372
|
+
var _a, _b, _c, _d, _e;
|
|
17369
17373
|
const {
|
|
17370
17374
|
id,
|
|
17371
17375
|
yamlFormProps: customYamlFormProps,
|
|
@@ -17411,11 +17415,15 @@ function FormModal(props) {
|
|
|
17411
17415
|
}
|
|
17412
17416
|
}, [pushModal]);
|
|
17413
17417
|
const errorText = React.useMemo(() => {
|
|
17418
|
+
var _a2;
|
|
17414
17419
|
if (isError) {
|
|
17420
|
+
const customText = (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formFailedText;
|
|
17421
|
+
if (customText)
|
|
17422
|
+
return customText;
|
|
17415
17423
|
return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
|
|
17416
17424
|
}
|
|
17417
17425
|
return "";
|
|
17418
|
-
}, [isError, id, i18n2]);
|
|
17426
|
+
}, [isError, id, i18n2, (_b = resourceConfig.formConfig) == null ? void 0 : _b.formFailedText]);
|
|
17419
17427
|
const title = React.useMemo(() => {
|
|
17420
17428
|
var _a2, _b2, _c2, _d2;
|
|
17421
17429
|
if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formTitle) === "string")
|
|
@@ -17507,7 +17515,7 @@ function FormModal(props) {
|
|
|
17507
17515
|
className: TitleWrapperStyle,
|
|
17508
17516
|
children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
|
|
17509
17517
|
children: title
|
|
17510
|
-
}), ((
|
|
17518
|
+
}), ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(FormModeSegmentControl, {
|
|
17511
17519
|
formConfig: resourceConfig.formConfig,
|
|
17512
17520
|
mode,
|
|
17513
17521
|
onChangeMode
|
|
@@ -17520,9 +17528,9 @@ function FormModal(props) {
|
|
|
17520
17528
|
onOk,
|
|
17521
17529
|
okButtonProps: {
|
|
17522
17530
|
...lodashEs.omit(saveButtonProps, "onClick"),
|
|
17523
|
-
children: (
|
|
17531
|
+
children: (_d = resourceConfig.formConfig) == null ? void 0 : _d.saveButtonText
|
|
17524
17532
|
},
|
|
17525
|
-
okText: ((
|
|
17533
|
+
okText: ((_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText) || okText,
|
|
17526
17534
|
destroyOnClose: true,
|
|
17527
17535
|
destroyOtherStep: true,
|
|
17528
17536
|
...modalProps,
|
package/dist/refine.js
CHANGED
|
@@ -11722,7 +11722,7 @@ function YamlFormContainer({
|
|
|
11722
11722
|
const RawYamlFormModal_1nvs0vj = "";
|
|
11723
11723
|
const FormDescStyle$1 = "fdhreji";
|
|
11724
11724
|
function RawYamlFormModal(props) {
|
|
11725
|
-
var _a, _b;
|
|
11725
|
+
var _a, _b, _c;
|
|
11726
11726
|
const {
|
|
11727
11727
|
id,
|
|
11728
11728
|
yamlFormProps: customYamlFormProps,
|
|
@@ -11743,16 +11743,20 @@ function RawYamlFormModal(props) {
|
|
|
11743
11743
|
(_a2 = saveButtonProps.onClick) == null ? void 0 : _a2.call(saveButtonProps, e2);
|
|
11744
11744
|
}, [saveButtonProps]);
|
|
11745
11745
|
const errorText = useMemo(() => {
|
|
11746
|
+
var _a2;
|
|
11746
11747
|
if (isError) {
|
|
11748
|
+
const customText = (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formFailedText;
|
|
11749
|
+
if (customText)
|
|
11750
|
+
return customText;
|
|
11747
11751
|
return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
|
|
11748
11752
|
}
|
|
11749
11753
|
return "";
|
|
11750
|
-
}, [isError, id, i18n2]);
|
|
11754
|
+
}, [isError, id, i18n2, (_a = resourceConfig.formConfig) == null ? void 0 : _a.formFailedText]);
|
|
11751
11755
|
const title = useMemo(() => {
|
|
11752
|
-
var _a2, _b2,
|
|
11756
|
+
var _a2, _b2, _c2, _d;
|
|
11753
11757
|
if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formTitle) === "string")
|
|
11754
11758
|
return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formTitle;
|
|
11755
|
-
if (typeof ((
|
|
11759
|
+
if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
|
|
11756
11760
|
return (_d = resourceConfig.formConfig) == null ? void 0 : _d.formTitle(action);
|
|
11757
11761
|
}
|
|
11758
11762
|
const label2 = resourceConfig.displayName || (resourceConfig == null ? void 0 : resourceConfig.kind);
|
|
@@ -11761,10 +11765,10 @@ function RawYamlFormModal(props) {
|
|
|
11761
11765
|
});
|
|
11762
11766
|
}, [action, resourceConfig.formConfig, resourceConfig.displayName, resourceConfig == null ? void 0 : resourceConfig.kind, i18n2, id]);
|
|
11763
11767
|
const desc = useMemo(() => {
|
|
11764
|
-
var _a2, _b2,
|
|
11768
|
+
var _a2, _b2, _c2, _d;
|
|
11765
11769
|
if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formDesc) === "string")
|
|
11766
11770
|
return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formDesc;
|
|
11767
|
-
if (typeof ((
|
|
11771
|
+
if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formDesc) === "function") {
|
|
11768
11772
|
return (_d = resourceConfig.formConfig) == null ? void 0 : _d.formDesc(action);
|
|
11769
11773
|
}
|
|
11770
11774
|
return "";
|
|
@@ -11794,9 +11798,9 @@ function RawYamlFormModal(props) {
|
|
|
11794
11798
|
onOk,
|
|
11795
11799
|
okButtonProps: {
|
|
11796
11800
|
...omit$1(saveButtonProps, "onClick"),
|
|
11797
|
-
children: (
|
|
11801
|
+
children: (_b = resourceConfig.formConfig) == null ? void 0 : _b.saveButtonText
|
|
11798
11802
|
},
|
|
11799
|
-
okText: ((
|
|
11803
|
+
okText: ((_c = resourceConfig.formConfig) == null ? void 0 : _c.saveButtonText) || okText,
|
|
11800
11804
|
destroyOnClose: true,
|
|
11801
11805
|
children: [desc ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
11802
11806
|
className: FormDescStyle$1,
|
|
@@ -17346,7 +17350,7 @@ function ConfirmModal({
|
|
|
17346
17350
|
});
|
|
17347
17351
|
}
|
|
17348
17352
|
function FormModal(props) {
|
|
17349
|
-
var _a, _b, _c, _d;
|
|
17353
|
+
var _a, _b, _c, _d, _e;
|
|
17350
17354
|
const {
|
|
17351
17355
|
id,
|
|
17352
17356
|
yamlFormProps: customYamlFormProps,
|
|
@@ -17392,11 +17396,15 @@ function FormModal(props) {
|
|
|
17392
17396
|
}
|
|
17393
17397
|
}, [pushModal]);
|
|
17394
17398
|
const errorText = useMemo(() => {
|
|
17399
|
+
var _a2;
|
|
17395
17400
|
if (isError) {
|
|
17401
|
+
const customText = (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formFailedText;
|
|
17402
|
+
if (customText)
|
|
17403
|
+
return customText;
|
|
17396
17404
|
return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
|
|
17397
17405
|
}
|
|
17398
17406
|
return "";
|
|
17399
|
-
}, [isError, id, i18n2]);
|
|
17407
|
+
}, [isError, id, i18n2, (_b = resourceConfig.formConfig) == null ? void 0 : _b.formFailedText]);
|
|
17400
17408
|
const title = useMemo(() => {
|
|
17401
17409
|
var _a2, _b2, _c2, _d2;
|
|
17402
17410
|
if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formTitle) === "string")
|
|
@@ -17488,7 +17496,7 @@ function FormModal(props) {
|
|
|
17488
17496
|
className: TitleWrapperStyle,
|
|
17489
17497
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
17490
17498
|
children: title
|
|
17491
|
-
}), ((
|
|
17499
|
+
}), ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormModeSegmentControl, {
|
|
17492
17500
|
formConfig: resourceConfig.formConfig,
|
|
17493
17501
|
mode,
|
|
17494
17502
|
onChangeMode
|
|
@@ -17501,9 +17509,9 @@ function FormModal(props) {
|
|
|
17501
17509
|
onOk,
|
|
17502
17510
|
okButtonProps: {
|
|
17503
17511
|
...omit$1(saveButtonProps, "onClick"),
|
|
17504
|
-
children: (
|
|
17512
|
+
children: (_d = resourceConfig.formConfig) == null ? void 0 : _d.saveButtonText
|
|
17505
17513
|
},
|
|
17506
|
-
okText: ((
|
|
17514
|
+
okText: ((_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText) || okText,
|
|
17507
17515
|
destroyOnClose: true,
|
|
17508
17516
|
destroyOtherStep: true,
|
|
17509
17517
|
...modalProps,
|
package/dist/types/resource.d.ts
CHANGED
|
@@ -134,6 +134,8 @@ export type CommonFormConfig<Model extends ResourceModel = ResourceModel> = {
|
|
|
134
134
|
formDesc?: string | ((action: 'create' | 'edit') => string);
|
|
135
135
|
/** 保存按钮文本 */
|
|
136
136
|
saveButtonText?: string;
|
|
137
|
+
/** 提交失败时 Footer 的提示文本,如"克隆失败" */
|
|
138
|
+
formFailedText?: string;
|
|
137
139
|
/**
|
|
138
140
|
* 错误信息格式化函数,待完善
|
|
139
141
|
* @param errorBody 错误信息体
|