@dovetail-v2/refine 0.4.2-beta.0 → 0.4.3

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 CHANGED
@@ -475,6 +475,8 @@ const state$1 = "Status";
475
475
  const name$1 = "Name";
476
476
  const pod$1 = "Pod";
477
477
  const cancel$1 = "Cancel";
478
+ const prev_step$1 = "Previous";
479
+ const next_step$1 = "Next";
478
480
  const create$1 = "Create";
479
481
  const confirm_delete_text$1 = "Are you sure you want to delete the {{kind}} <0>{{target}}</0>?";
480
482
  const edit$1 = "Edit";
@@ -637,6 +639,7 @@ const edit_form$1 = "Edit form";
637
639
  const data_expired$1 = "Data expired";
638
640
  const data_expired_body$1 = "The data in this form is no longer the latest version. To avoid saving errors, please discard this edit and reopen the form to edit again.";
639
641
  const data_expired_note$1 = "Your current entries will not be saved.";
642
+ const resource_version_conflict$1 = "The data in this form is no longer the latest version. Please discard this edit and reopen the form to edit again.";
640
643
  const abandon_edit$1 = "Discard edit";
641
644
  const exit_yaml_tip$1 = "If you go back to the form, any changes made to the YAML file will be lost.";
642
645
  const value_optional$1 = "Value (optional)";
@@ -753,6 +756,8 @@ const dovetail$1 = {
753
756
  name: name$1,
754
757
  pod: pod$1,
755
758
  cancel: cancel$1,
759
+ prev_step: prev_step$1,
760
+ next_step: next_step$1,
756
761
  "delete": "Delete",
757
762
  create: create$1,
758
763
  confirm_delete_text: confirm_delete_text$1,
@@ -918,6 +923,7 @@ const dovetail$1 = {
918
923
  data_expired: data_expired$1,
919
924
  data_expired_body: data_expired_body$1,
920
925
  data_expired_note: data_expired_note$1,
926
+ resource_version_conflict: resource_version_conflict$1,
921
927
  abandon_edit: abandon_edit$1,
922
928
  exit_yaml_tip: exit_yaml_tip$1,
923
929
  value_optional: value_optional$1,
@@ -1029,6 +1035,8 @@ const edit_yaml = "编辑 YAML";
1029
1035
  const copied = "已复制";
1030
1036
  const already_reset = "已重置";
1031
1037
  const cancel = "取消";
1038
+ const prev_step = "上一步";
1039
+ const next_step = "下一步";
1032
1040
  const create = "创建";
1033
1041
  const delete_resource = "删除{{resource}}";
1034
1042
  const confirm_delete_text = "确认删除{{kind}} <0>{{target}}</0> 吗?";
@@ -1201,6 +1209,7 @@ const edit_form = "编辑表单";
1201
1209
  const data_expired = "数据已过期";
1202
1210
  const data_expired_body = "当前表单中的数据已不是最新版。为避免保存失败,请放弃本次编辑,并重新打开表单进行编辑。";
1203
1211
  const data_expired_note = "当前已填写内容将不会保留。";
1212
+ const resource_version_conflict = "当前表单中的数据已不是最新版,请放弃本次编辑,并重新打开表单进行编辑。";
1204
1213
  const abandon_edit = "放弃编辑";
1205
1214
  const exit_yaml_tip = "返回编辑表单,不会保留对 YAML 文件做出的所有更改。";
1206
1215
  const form = "表单";
@@ -1306,6 +1315,8 @@ const dovetail = {
1306
1315
  copied,
1307
1316
  already_reset,
1308
1317
  cancel,
1318
+ prev_step,
1319
+ next_step,
1309
1320
  "delete": "删除",
1310
1321
  create,
1311
1322
  delete_resource,
@@ -1481,6 +1492,7 @@ const dovetail = {
1481
1492
  data_expired,
1482
1493
  data_expired_body,
1483
1494
  data_expired_note,
1495
+ resource_version_conflict,
1484
1496
  abandon_edit,
1485
1497
  exit_yaml_tip,
1486
1498
  form,
@@ -10706,26 +10718,6 @@ function usePathMap(options) {
10706
10718
  transformApplyValues
10707
10719
  };
10708
10720
  }
10709
- const useResourceVersionCheck = ({
10710
- queryResult
10711
- }) => {
10712
- var _a, _b, _c;
10713
- const initialResourceVersionRef = React.useRef();
10714
- const [isExpired, setIsExpired] = React.useState(false);
10715
- const currentResourceVersion = (_c = (_b = (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data) == null ? void 0 : _b.metadata) == null ? void 0 : _c.resourceVersion;
10716
- React.useEffect(() => {
10717
- if (!currentResourceVersion)
10718
- return;
10719
- if (!initialResourceVersionRef.current) {
10720
- initialResourceVersionRef.current = currentResourceVersion;
10721
- return;
10722
- }
10723
- if (currentResourceVersion !== initialResourceVersionRef.current) {
10724
- setIsExpired(true);
10725
- }
10726
- }, [currentResourceVersion]);
10727
- return isExpired;
10728
- };
10729
10721
  function getInitialValues(resourceConfig) {
10730
10722
  return resourceConfig.initValue || {
10731
10723
  apiVersion: resourceConfig.apiVersion,
@@ -10734,42 +10726,6 @@ function getInitialValues(resourceConfig) {
10734
10726
  spec: {}
10735
10727
  };
10736
10728
  }
10737
- const button_1v659kh = "";
10738
- const WarningButtonStyle = "wwyz7ti";
10739
- const DataExpiredModal_eazxh6 = "";
10740
- const NoteStyle = "n609wlp";
10741
- function DataExpiredModal({
10742
- onAbandon
10743
- }) {
10744
- const {
10745
- t: t2
10746
- } = common.useTranslation();
10747
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.SmallDialog, {
10748
- title: t2("dovetail.data_expired"),
10749
- closable: false,
10750
- maskClosable: false,
10751
- cancelButtonProps: {
10752
- style: {
10753
- display: "none"
10754
- }
10755
- },
10756
- okText: t2("dovetail.abandon_edit"),
10757
- okButtonProps: {
10758
- className: WarningButtonStyle
10759
- },
10760
- onOk: (popModal) => {
10761
- popModal();
10762
- onAbandon();
10763
- },
10764
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
10765
- className: eagle.Typo.Label.l2_regular,
10766
- children: t2("dovetail.data_expired_body")
10767
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
10768
- className: `${eagle.Typo.Label.l2_regular} ${NoteStyle}`,
10769
- children: t2("dovetail.data_expired_note")
10770
- })]
10771
- });
10772
- }
10773
10729
  const index_az4wrx = "";
10774
10730
  const WrapperStyle$5 = "w1akirqw";
10775
10731
  const TitleStyle$2 = "t30srnq";
@@ -10809,7 +10765,7 @@ const Separator = () => {
10809
10765
  const style_1o641u6 = "";
10810
10766
  const ToolBarStyle = "t1joof7s";
10811
10767
  const ToolBarHeaderStyle = "tti58uh";
10812
- const ErrorIconStyle = "e15yt16p";
10768
+ const ErrorIconStyle$1 = "e15yt16p";
10813
10769
  const WrapperStyle$4 = "w3ccqks";
10814
10770
  const TitleStyle$1 = "t7zbd78";
10815
10771
  const IconStyle = "i1e4ouxy";
@@ -11039,7 +10995,7 @@ const YamlEditorComponent = React.forwardRef(
11039
10995
  ] })
11040
10996
  ] }),
11041
10997
  errorMsgs.length ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ErrorWrapperStyle, size: 8, align: "start", children: [
11042
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle }),
10998
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle$1 }),
11043
10999
  /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs("pre", { className: ErrorMsgStyle, children: [
11044
11000
  errorMsgs.length > 1 ? `${index2 + 1}. ` : "",
11045
11001
  errorMsg
@@ -11099,6 +11055,67 @@ function copyToClipboard(text) {
11099
11055
  document.execCommand("copy");
11100
11056
  document.body.removeChild(input);
11101
11057
  }
11058
+ const useGlobalStore = (name2 = "default") => {
11059
+ const globalStores = React.useContext(GlobalStoreContext);
11060
+ return globalStores[name2];
11061
+ };
11062
+ const ResourceVersionConflictRetryContext = React.createContext(null);
11063
+ function Retry409Provider({
11064
+ children
11065
+ }) {
11066
+ const initialResourceRef = React.useRef();
11067
+ return React.createElement(
11068
+ ResourceVersionConflictRetryContext.Provider,
11069
+ {
11070
+ value: initialResourceRef
11071
+ },
11072
+ children
11073
+ );
11074
+ }
11075
+ function use409Retry({
11076
+ action,
11077
+ dataProviderName,
11078
+ id,
11079
+ mutationMeta
11080
+ }) {
11081
+ const { t: t2 } = common.useTranslation();
11082
+ const globalStore = useGlobalStore(dataProviderName);
11083
+ const sharedInitialResourceRef = React.useContext(ResourceVersionConflictRetryContext);
11084
+ const localInitialResourceRef = React.useRef();
11085
+ const initialResourceRef = sharedInitialResourceRef || localInitialResourceRef;
11086
+ const isEditAction = action === "edit" || !!id;
11087
+ const captureInitialResource = React.useCallback((resource) => {
11088
+ var _a;
11089
+ if (!isEditAction || initialResourceRef.current || !resource) {
11090
+ return;
11091
+ }
11092
+ const rawResource = (_a = globalStore == null ? void 0 : globalStore.restoreItem) == null ? void 0 : _a.call(globalStore, resource);
11093
+ if (!rawResource) {
11094
+ return;
11095
+ }
11096
+ initialResourceRef.current = lodashEs.cloneDeep(rawResource);
11097
+ }, [globalStore, initialResourceRef, isEditAction]);
11098
+ const retryMutationMeta = React.useMemo(() => {
11099
+ const restMutationMeta = lodashEs.omit(mutationMeta, "resourceVersionConflictRetry");
11100
+ if (!isEditAction) {
11101
+ return restMutationMeta;
11102
+ }
11103
+ return {
11104
+ ...restMutationMeta,
11105
+ resourceVersionConflictRetry: {
11106
+ // refine 的 mutationMeta 在 hook 创建时就会固定;用 getter 让 provider 在保存瞬间读取最新的初始版本。
11107
+ get initialResource() {
11108
+ return initialResourceRef.current;
11109
+ },
11110
+ conflictMessage: t2("dovetail.resource_version_conflict")
11111
+ }
11112
+ };
11113
+ }, [initialResourceRef, isEditAction, mutationMeta, t2]);
11114
+ return {
11115
+ captureInitialResource,
11116
+ mutationMeta: retryMutationMeta
11117
+ };
11118
+ }
11102
11119
  function useK8sYamlEditor() {
11103
11120
  const foldSymbol = React.useCallback(function(editor, symbol) {
11104
11121
  const model = editor.getModel();
@@ -11209,10 +11226,6 @@ function generateYamlBySchema(defaultValue, schema) {
11209
11226
  const content = yaml$2.dump(merged);
11210
11227
  return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
11211
11228
  }
11212
- const useGlobalStore = (name2 = "default") => {
11213
- const globalStores = React.useContext(GlobalStoreContext);
11214
- return globalStores[name2];
11215
- };
11216
11229
  const useYamlForm = ({
11217
11230
  action: actionFromProps,
11218
11231
  resource,
@@ -11250,7 +11263,7 @@ const useYamlForm = ({
11250
11263
  onSubmitAbort,
11251
11264
  rules
11252
11265
  } = {}) => {
11253
- var _a;
11266
+ var _a, _b;
11254
11267
  const editor = React.useRef(null);
11255
11268
  const { t: t2 } = common.useTranslation();
11256
11269
  const [isYamlValid, setIsYamlValid] = React.useState(true);
@@ -11261,7 +11274,17 @@ const useYamlForm = ({
11261
11274
  const [beforeSubmitErrors, setBeforeSubmitErrors] = React.useState([]);
11262
11275
  const [errorResponseBody, setErrorResponseBody] = React.useState(null);
11263
11276
  const useResourceResult = core.useResource();
11264
- const globalStore = useGlobalStore();
11277
+ const globalStore = useGlobalStore(dataProviderName);
11278
+ const action = React.useMemo(
11279
+ () => actionFromProps || useResourceResult.action,
11280
+ [actionFromProps, useResourceResult.action]
11281
+ );
11282
+ const { captureInitialResource, mutationMeta: finalMutationMeta } = use409Retry({
11283
+ action,
11284
+ dataProviderName,
11285
+ id: idFromProps,
11286
+ mutationMeta
11287
+ });
11265
11288
  const {
11266
11289
  schema,
11267
11290
  loading: isLoadingSchema,
@@ -11298,7 +11321,7 @@ const useYamlForm = ({
11298
11321
  meta: core.pickNotDeprecated(meta, metaData),
11299
11322
  metaData: core.pickNotDeprecated(meta, metaData),
11300
11323
  queryMeta,
11301
- mutationMeta,
11324
+ mutationMeta: finalMutationMeta,
11302
11325
  liveMode,
11303
11326
  liveParams,
11304
11327
  mutationMode,
@@ -11313,12 +11336,12 @@ const useYamlForm = ({
11313
11336
  overtimeOptions
11314
11337
  });
11315
11338
  const { formLoading, onFinish, queryResult } = useFormCoreResult;
11339
+ React.useEffect(() => {
11340
+ var _a2;
11341
+ captureInitialResource((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data);
11342
+ }, [captureInitialResource, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data]);
11316
11343
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = core.useWarnAboutChange();
11317
11344
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
11318
- const action = React.useMemo(
11319
- () => actionFromProps || useResourceResult.action,
11320
- [actionFromProps, useResourceResult.action]
11321
- );
11322
11345
  const initialValues = React.useMemo(() => {
11323
11346
  var _a2;
11324
11347
  const initialValues2 = (action === "edit" && ((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) ? initialValuesForEdit || (globalStore == null ? void 0 : globalStore.restoreItem(queryResult.data.data)) : initialValuesForCreate) || {};
@@ -11361,10 +11384,10 @@ const useYamlForm = ({
11361
11384
  }
11362
11385
  },
11363
11386
  onEditorCreate(editorInstance) {
11364
- var _a3, _b;
11387
+ var _a3, _b2;
11365
11388
  const editorValue = yaml$2.dump(initialValues);
11366
11389
  (_a3 = editor.current) == null ? void 0 : _a3.setEditorValue(editorValue);
11367
- (_b = editor.current) == null ? void 0 : _b.setValue(editorValue);
11390
+ (_b2 = editor.current) == null ? void 0 : _b2.setValue(editorValue);
11368
11391
  if (action === "edit") {
11369
11392
  fold2(editorInstance);
11370
11393
  }
@@ -11377,7 +11400,7 @@ const useYamlForm = ({
11377
11400
  initialValues,
11378
11401
  schemas,
11379
11402
  resource,
11380
- (_a = useResourceResult.resource) == null ? void 0 : _a.name,
11403
+ (_b = useResourceResult.resource) == null ? void 0 : _b.name,
11381
11404
  action,
11382
11405
  finalErrors,
11383
11406
  fold2
@@ -11417,7 +11440,7 @@ const useYamlForm = ({
11417
11440
  formProps: {
11418
11441
  ...formSF.formProps,
11419
11442
  onFinish: async (values) => {
11420
- var _a2, _b;
11443
+ var _a2, _b2;
11421
11444
  setBeforeSubmitErrors([]);
11422
11445
  onSubmitStart == null ? void 0 : onSubmitStart();
11423
11446
  const errors = [
@@ -11437,7 +11460,7 @@ const useYamlForm = ({
11437
11460
  return;
11438
11461
  }
11439
11462
  try {
11440
- const objectValues = editor.current ? yaml$2.load(((_b = editor.current) == null ? void 0 : _b.getEditorValue()) || "") : values;
11463
+ const objectValues = editor.current ? yaml$2.load(((_b2 = editor.current) == null ? void 0 : _b2.getEditorValue()) || "") : values;
11441
11464
  let finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
11442
11465
  if (beforeSubmit) {
11443
11466
  try {
@@ -11539,6 +11562,7 @@ function YamlForm(props) {
11539
11562
  id,
11540
11563
  action: actionFromProps,
11541
11564
  resource: resource == null ? void 0 : resource.name,
11565
+ dataProviderName: resourceConfig.dataProviderName,
11542
11566
  editorOptions: {
11543
11567
  isSkipSchema: schemaStrategy === "None"
11544
11568
  /* None */
@@ -11661,31 +11685,6 @@ function YamlFormContainer({
11661
11685
  onSaveButtonPropsChange
11662
11686
  }) {
11663
11687
  const action = id ? "edit" : "create";
11664
- const pushModal = eagle.usePushModal();
11665
- const popModal = eagle.usePopModal();
11666
- const hasShownExpiredRef = React.useRef(false);
11667
- const [isSubmitting, setIsSubmitting] = React.useState(false);
11668
- const queryResult = core.useOne({
11669
- resource: resourceConfig.name,
11670
- id,
11671
- liveMode: id ? "auto" : "off",
11672
- queryOptions: { enabled: !!id }
11673
- });
11674
- const isExpired = useResourceVersionCheck({ queryResult });
11675
- React.useEffect(() => {
11676
- if (!isExpired || isSubmitting || hasShownExpiredRef.current) {
11677
- return;
11678
- }
11679
- hasShownExpiredRef.current = true;
11680
- pushModal({
11681
- component: DataExpiredModal,
11682
- props: {
11683
- onAbandon: () => {
11684
- popModal();
11685
- }
11686
- }
11687
- });
11688
- }, [isExpired, isSubmitting, pushModal, popModal]);
11689
11688
  const { transformInitValues, transformApplyValues } = usePathMap({
11690
11689
  pathMap: formConfig == null ? void 0 : formConfig.pathMap,
11691
11690
  transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
@@ -11705,13 +11704,7 @@ function YamlFormContainer({
11705
11704
  action,
11706
11705
  isShowLayout: false,
11707
11706
  useFormProps: {
11708
- redirect: false,
11709
- onSubmitStart: () => {
11710
- setIsSubmitting(true);
11711
- },
11712
- onSubmitAbort: () => {
11713
- setIsSubmitting(false);
11714
- }
11707
+ redirect: false
11715
11708
  },
11716
11709
  rules: void 0,
11717
11710
  onSaveButtonPropsChange,
@@ -12990,31 +12983,63 @@ function readFileAsBase64(file) {
12990
12983
  reader.readAsArrayBuffer(file);
12991
12984
  });
12992
12985
  }
12993
- const LabelFormatPopover_piveun = "";
12994
- const PodLabelFormatRulePopoverStyle = "p5jt6nm";
12995
- const LabelFormatPopover = ({
12996
- noValueValidation
12997
- }) => {
12998
- const {
12999
- t: t2
13000
- } = common.useTranslation();
13001
- const data2 = [{
13002
- object: t2("dovetail.key"),
13003
- contains: t2("dovetail.prefix"),
13004
- optional: t2("dovetail.no"),
13005
- rule: [t2("dovetail.prefix_format_rule_1"), t2("dovetail.prefix_format_rule_2"), t2("dovetail.prefix_format_rule_3")]
13006
- }, {
13007
- object: t2("dovetail.key"),
13008
- contains: t2("dovetail.name"),
13009
- optional: t2("dovetail.yes"),
13010
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
13011
- }];
12986
+ const FormatRulePopover_1b8vyke = "";
12987
+ const FormatRulePopoverStyle = "f1eyh8ow";
12988
+ const FormatRulePopover = ({
12989
+ buttonText,
12990
+ columns,
12991
+ dataSource
12992
+ }) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Popover, {
12993
+ trigger: "click",
12994
+ overlayClassName: FormatRulePopoverStyle,
12995
+ placement: "bottomRight",
12996
+ content: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.AntdTable, {
12997
+ bordered: true,
12998
+ dataSource,
12999
+ columns,
13000
+ pagination: false,
13001
+ rowKey: (_, index2) => String(index2)
13002
+ }),
13003
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13004
+ size: "small",
13005
+ type: "link",
13006
+ children: buttonText
13007
+ })
13008
+ });
13009
+ const LabelFormatPopover = ({ noValueValidation }) => {
13010
+ const { t: t2 } = common.useTranslation();
13011
+ const data2 = [
13012
+ {
13013
+ object: t2("dovetail.key"),
13014
+ contains: t2("dovetail.prefix"),
13015
+ optional: t2("dovetail.no"),
13016
+ rule: [
13017
+ t2("dovetail.prefix_format_rule_1"),
13018
+ t2("dovetail.prefix_format_rule_2"),
13019
+ t2("dovetail.prefix_format_rule_3")
13020
+ ]
13021
+ },
13022
+ {
13023
+ object: t2("dovetail.key"),
13024
+ contains: t2("dovetail.name"),
13025
+ optional: t2("dovetail.yes"),
13026
+ rule: [
13027
+ t2("dovetail.name_format_rule_1"),
13028
+ t2("dovetail.name_format_rule_2"),
13029
+ t2("dovetail.name_format_rule_3")
13030
+ ]
13031
+ }
13032
+ ];
13012
13033
  if (!noValueValidation) {
13013
13034
  data2.push({
13014
13035
  object: t2("dovetail.value"),
13015
13036
  contains: t2("dovetail.name"),
13016
13037
  optional: t2("dovetail.no"),
13017
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
13038
+ rule: [
13039
+ t2("dovetail.name_format_rule_1"),
13040
+ t2("dovetail.name_format_rule_2"),
13041
+ t2("dovetail.name_format_rule_3")
13042
+ ]
13018
13043
  });
13019
13044
  } else {
13020
13045
  data2.push({
@@ -13024,57 +13049,42 @@ const LabelFormatPopover = ({
13024
13049
  rule: [t2("dovetail.no_limitation_rule")]
13025
13050
  });
13026
13051
  }
13027
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Popover, {
13028
- trigger: "click",
13029
- overlayClassName: PodLabelFormatRulePopoverStyle,
13030
- placement: "bottomRight",
13031
- content: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.AntdTable, {
13032
- bordered: true,
13052
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
13053
+ FormatRulePopover,
13054
+ {
13055
+ buttonText: t2("dovetail.look_format_requirement"),
13033
13056
  dataSource: data2,
13034
- columns: [{
13035
- key: "object",
13036
- title: t2("dovetail.object"),
13037
- dataIndex: "object",
13038
- render: (cell, record, index2) => {
13039
- return {
13040
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13041
- className: eagle.Typo.Label.l4_bold,
13042
- children: cell
13043
- }),
13057
+ columns: [
13058
+ {
13059
+ key: "object",
13060
+ title: t2("dovetail.object"),
13061
+ dataIndex: "object",
13062
+ render: (cell, _record, index2) => ({
13063
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", { className: eagle.Typo.Label.l4_bold, children: cell }),
13044
13064
  props: {
13045
13065
  rowSpan: index2 === 0 ? 2 : index2 === 1 ? 0 : 1
13046
13066
  }
13047
- };
13048
- }
13049
- }, {
13050
- key: "contains",
13051
- title: t2("dovetail.contains"),
13052
- dataIndex: "contains"
13053
- }, {
13054
- key: "optional",
13055
- title: t2("dovetail.optional"),
13056
- dataIndex: "optional"
13057
- }, {
13058
- key: "rule",
13059
- title: t2("dovetail.format_requirements"),
13060
- dataIndex: "rule",
13061
- render: (cell) => {
13062
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx("ul", {
13063
- className: "rule-list",
13064
- children: cell.map((rule2, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsx("li", {
13065
- children: rule2
13066
- }, index2))
13067
- });
13067
+ })
13068
+ },
13069
+ {
13070
+ key: "contains",
13071
+ title: t2("dovetail.contains"),
13072
+ dataIndex: "contains"
13073
+ },
13074
+ {
13075
+ key: "optional",
13076
+ title: t2("dovetail.optional"),
13077
+ dataIndex: "optional"
13078
+ },
13079
+ {
13080
+ key: "rule",
13081
+ title: t2("dovetail.format_requirements"),
13082
+ dataIndex: "rule",
13083
+ render: (cell) => /* @__PURE__ */ common.jsxRuntimeExports.jsx("ul", { style: { listStyle: "disc", listStylePosition: "inside" }, children: cell.map((rule2, i2) => /* @__PURE__ */ common.jsxRuntimeExports.jsx("li", { style: { textIndent: 8 }, children: rule2 }, i2)) })
13068
13084
  }
13069
- }],
13070
- pagination: false
13071
- }),
13072
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13073
- size: "small",
13074
- type: "link",
13075
- children: t2("dovetail.look_format_requirement")
13076
- })
13077
- });
13085
+ ]
13086
+ }
13087
+ );
13078
13088
  };
13079
13089
  const index_t3zi07 = "";
13080
13090
  function _KeyValueTableForm(props, ref) {
@@ -13095,7 +13105,8 @@ function _KeyValueTableForm(props, ref) {
13095
13105
  validateKey,
13096
13106
  validateValue,
13097
13107
  onSubmit,
13098
- keyTitle
13108
+ keyTitle,
13109
+ formatPopover
13099
13110
  } = props;
13100
13111
  const {
13101
13112
  t: t2,
@@ -13279,7 +13290,7 @@ function _KeyValueTableForm(props, ref) {
13279
13290
  validateTriggerType: eagle.ValidateTriggerType.Aggressive,
13280
13291
  disableBatchFilling: true,
13281
13292
  hideEmptyTable: true
13282
- }), isHideLabelFormatPopover || _value.length === 0 ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(LabelFormatPopover, {
13293
+ }), isHideLabelFormatPopover || _value.length === 0 ? null : formatPopover ?? /* @__PURE__ */ common.jsxRuntimeExports.jsx(LabelFormatPopover, {
13283
13294
  noValueValidation
13284
13295
  })]
13285
13296
  });
@@ -16075,8 +16086,121 @@ function ResourceShow(props) {
16075
16086
  }
16076
16087
  );
16077
16088
  }
16089
+ const button_1v659kh = "";
16090
+ const WarningButtonStyle = "wwyz7ti";
16078
16091
  const modal_1eijuvm = "";
16079
16092
  const SmallModalStyle = "s1nc293e";
16093
+ const ExtraSubmitFooter_15u4r8u = "";
16094
+ const FooterStyle = "f16wn4bu";
16095
+ const FooterLeftStyle = "fk5l2b4";
16096
+ const FooterRightStyle = "f1r3vl4u";
16097
+ const ErrorStyle = "e1y8i1r4";
16098
+ const ErrorIconStyle = "e16fn5cj";
16099
+ const PrevIconStyle = "prji3wx";
16100
+ function useExtraSubmitFooter({
16101
+ action,
16102
+ cancelText,
16103
+ defaultSubmitText,
16104
+ errorText,
16105
+ extraSubmitButton,
16106
+ fallbackFooter,
16107
+ isYamlMode,
16108
+ nextStepText,
16109
+ prevStepText,
16110
+ saveButtonProps,
16111
+ step,
16112
+ stepCount,
16113
+ onCancel,
16114
+ onNextStep,
16115
+ onPrevStep,
16116
+ onSubmit
16117
+ }) {
16118
+ const shouldShowExtraSubmitButton = React.useMemo(() => {
16119
+ if (!extraSubmitButton || isYamlMode) {
16120
+ return false;
16121
+ }
16122
+ if (extraSubmitButton.action && extraSubmitButton.action !== action) {
16123
+ return false;
16124
+ }
16125
+ if (extraSubmitButton.step !== step) {
16126
+ return false;
16127
+ }
16128
+ return step < stepCount - 1;
16129
+ }, [action, extraSubmitButton, isYamlMode, step, stepCount]);
16130
+ return React.useMemo(() => {
16131
+ if (!shouldShowExtraSubmitButton) {
16132
+ return fallbackFooter;
16133
+ }
16134
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ExtraSubmitFooter, {
16135
+ cancelText,
16136
+ errorText,
16137
+ extraSubmitText: (extraSubmitButton == null ? void 0 : extraSubmitButton.text) || defaultSubmitText,
16138
+ nextStepText,
16139
+ prevText: prevStepText,
16140
+ saveButtonProps,
16141
+ showPrevButton: step > 0,
16142
+ onCancel,
16143
+ onNextStep,
16144
+ onPrevStep,
16145
+ onSubmit
16146
+ });
16147
+ }, [cancelText, defaultSubmitText, errorText, extraSubmitButton == null ? void 0 : extraSubmitButton.text, fallbackFooter, onCancel, onNextStep, onPrevStep, onSubmit, nextStepText, prevStepText, saveButtonProps, shouldShowExtraSubmitButton, step]);
16148
+ }
16149
+ const ExtraSubmitFooter = ({
16150
+ cancelText,
16151
+ errorText,
16152
+ extraSubmitText,
16153
+ nextStepText,
16154
+ prevText,
16155
+ saveButtonProps,
16156
+ showPrevButton,
16157
+ onCancel,
16158
+ onNextStep,
16159
+ onPrevStep,
16160
+ onSubmit
16161
+ }) => {
16162
+ const finalSaveButtonProps = lodashEs.omit(saveButtonProps, "onClick");
16163
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
16164
+ className: FooterStyle,
16165
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
16166
+ className: FooterLeftStyle,
16167
+ children: [showPrevButton ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Button, {
16168
+ type: "link",
16169
+ onClick: onPrevStep,
16170
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.ArrowChevronLeft16BoldBlueIcon, {
16171
+ className: PrevIconStyle
16172
+ }), prevText]
16173
+ }) : null, errorText ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs("span", {
16174
+ className: common.cx_default(ErrorStyle, eagle.Typo.Label.l2_regular),
16175
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.ExclamationErrorCircleFill16RedIcon, {
16176
+ className: ErrorIconStyle
16177
+ }), errorText]
16178
+ }) : null]
16179
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
16180
+ className: FooterRightStyle,
16181
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
16182
+ type: "quiet",
16183
+ size: "large",
16184
+ onClick: onCancel,
16185
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
16186
+ className: eagle.Typo.Label.l1_bold_title,
16187
+ children: cancelText
16188
+ })
16189
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
16190
+ size: "large",
16191
+ type: "secondary",
16192
+ onClick: onNextStep,
16193
+ children: nextStepText
16194
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
16195
+ ...finalSaveButtonProps,
16196
+ size: "large",
16197
+ type: "primary",
16198
+ onClick: onSubmit,
16199
+ children: extraSubmitText
16200
+ })]
16201
+ })]
16202
+ });
16203
+ };
16080
16204
  function FormModeSegmentControl({
16081
16205
  formConfig,
16082
16206
  mode,
@@ -16910,9 +17034,16 @@ const useForm = ({
16910
17034
  onSubmitAbort,
16911
17035
  ...rest
16912
17036
  } = {}) => {
17037
+ var _a;
16913
17038
  const { options } = core.useRefineContext();
16914
17039
  const disableServerSideValidation = (options == null ? void 0 : options.disableServerSideValidation) || disableServerSideValidationProp;
16915
17040
  const translate = core.useTranslate();
17041
+ const { captureInitialResource, mutationMeta } = use409Retry({
17042
+ action: refineCoreProps == null ? void 0 : refineCoreProps.action,
17043
+ dataProviderName: refineCoreProps == null ? void 0 : refineCoreProps.dataProviderName,
17044
+ id: refineCoreProps == null ? void 0 : refineCoreProps.id,
17045
+ mutationMeta: refineCoreProps == null ? void 0 : refineCoreProps.mutationMeta
17046
+ });
16916
17047
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = core.useWarnAboutChange();
16917
17048
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
16918
17049
  const useHookFormResult = reactHookForm.useForm({
@@ -16932,10 +17063,11 @@ const useForm = ({
16932
17063
  } = useHookFormResult;
16933
17064
  const useFormCoreResult = core.useForm({
16934
17065
  ...refineCoreProps,
17066
+ mutationMeta,
16935
17067
  onMutationError: (error, _variables, _context) => {
16936
- var _a, _b;
17068
+ var _a2, _b;
16937
17069
  if (disableServerSideValidation) {
16938
- (_a = refineCoreProps == null ? void 0 : refineCoreProps.onMutationError) == null ? void 0 : _a.call(refineCoreProps, error, _variables, _context);
17070
+ (_a2 = refineCoreProps == null ? void 0 : refineCoreProps.onMutationError) == null ? void 0 : _a2.call(refineCoreProps, error, _variables, _context);
16939
17071
  return;
16940
17072
  }
16941
17073
  const errors = error == null ? void 0 : error.errors;
@@ -16968,10 +17100,14 @@ const useForm = ({
16968
17100
  });
16969
17101
  const { queryResult, onFinish, formLoading, onFinishAutoSave } = useFormCoreResult;
16970
17102
  React.useEffect(() => {
16971
- var _a;
17103
+ var _a2;
17104
+ captureInitialResource((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data);
17105
+ }, [captureInitialResource, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data]);
17106
+ React.useEffect(() => {
17107
+ var _a2;
16972
17108
  if (formState.isDirty)
16973
17109
  return;
16974
- const data2 = (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data;
17110
+ const data2 = (_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data;
16975
17111
  if (!data2)
16976
17112
  return;
16977
17113
  const transformedData = transformInitValues ? transformInitValues(data2) : data2;
@@ -16999,13 +17135,13 @@ const useForm = ({
16999
17135
  }, [watch]);
17000
17136
  const onValuesChange = React.useCallback(
17001
17137
  (changeValues) => {
17002
- var _a;
17138
+ var _a2;
17003
17139
  if (warnWhenUnsavedChanges) {
17004
17140
  setWarnWhen(true);
17005
17141
  }
17006
17142
  if (refineCoreProps == null ? void 0 : refineCoreProps.autoSave) {
17007
17143
  setWarnWhen(false);
17008
- const onFinishProps = (_a = refineCoreProps.autoSave) == null ? void 0 : _a.onFinish;
17144
+ const onFinishProps = (_a2 = refineCoreProps.autoSave) == null ? void 0 : _a2.onFinish;
17009
17145
  if (onFinishProps) {
17010
17146
  return onFinishAutoSave(onFinishProps(changeValues));
17011
17147
  }
@@ -17102,6 +17238,10 @@ const useRefineForm = (props) => {
17102
17238
  errorNotification: false,
17103
17239
  successNotification: () => {
17104
17240
  var _a;
17241
+ if (formConfig == null ? void 0 : formConfig.successMessage) {
17242
+ const msg = typeof formConfig.successMessage === "function" ? formConfig.successMessage(id ? "edit" : "create") : formConfig.successMessage;
17243
+ return { message: msg, description: "Success", type: "success" };
17244
+ }
17105
17245
  const formValue = result.getValues();
17106
17246
  return {
17107
17247
  message: i18n2.t(id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast", {
@@ -17119,6 +17259,7 @@ const useRefineForm = (props) => {
17119
17259
  resource: resourceConfig.name,
17120
17260
  action: id ? "edit" : "create",
17121
17261
  id,
17262
+ dataProviderName: resourceConfig.dataProviderName,
17122
17263
  liveMode: id ? "auto" : "off",
17123
17264
  ...refineProps
17124
17265
  },
@@ -17132,10 +17273,11 @@ const useRefineForm = (props) => {
17132
17273
  ...formConfig == null ? void 0 : formConfig.useFormProps
17133
17274
  });
17134
17275
  React.useEffect(() => {
17135
- var _a, _b;
17276
+ var _a, _b, _c;
17136
17277
  const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
17278
+ const message2 = (_b = result.refineCore.mutationResult.error) == null ? void 0 : _b.message;
17137
17279
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
17138
- (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
17280
+ (_c = response.json) == null ? void 0 : _c.call(response).then((body) => {
17139
17281
  var _a2;
17140
17282
  setResponseErrorMsgs(
17141
17283
  [].concat(
@@ -17143,8 +17285,10 @@ const useRefineForm = (props) => {
17143
17285
  )
17144
17286
  );
17145
17287
  });
17288
+ } else if (message2 && responseErrorMsgs[0] !== message2) {
17289
+ setResponseErrorMsgs([message2]);
17146
17290
  }
17147
- }, [formConfig, result, i18n2]);
17291
+ }, [formConfig, result, i18n2, responseErrorMsgs]);
17148
17292
  return {
17149
17293
  formResult: result,
17150
17294
  responseErrorMsgs,
@@ -17165,10 +17309,6 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17165
17309
  }, ref) {
17166
17310
  var _a, _b;
17167
17311
  const action = id ? "edit" : "create";
17168
- const pushModal = eagle.usePushModal();
17169
- const popModal = eagle.usePopModal();
17170
- const hasShownExpiredRef = React.useRef(false);
17171
- const [isSubmitting, setIsSubmitting] = React.useState(false);
17172
17312
  const refineFormResult = useRefineForm({
17173
17313
  resourceConfig,
17174
17314
  id,
@@ -17177,7 +17317,6 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17177
17317
  onSuccess == null ? void 0 : onSuccess(data2);
17178
17318
  },
17179
17319
  onMutationError() {
17180
- setIsSubmitting(false);
17181
17320
  onError == null ? void 0 : onError();
17182
17321
  },
17183
17322
  redirect: false,
@@ -17191,35 +17330,11 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17191
17330
  ...options,
17192
17331
  onBeforeSubmitError: (errors) => {
17193
17332
  if (errors.length) {
17194
- setIsSubmitting(false);
17195
17333
  onError == null ? void 0 : onError();
17196
17334
  }
17197
- },
17198
- onSubmitStart: () => {
17199
- setIsSubmitting(true);
17200
- },
17201
- onSubmitAbort: () => {
17202
- setIsSubmitting(false);
17203
17335
  }
17204
17336
  }
17205
17337
  });
17206
- const isExpired = useResourceVersionCheck({
17207
- queryResult: refineFormResult.formResult.refineCore.queryResult
17208
- });
17209
- React.useEffect(() => {
17210
- if (!isExpired || isSubmitting || hasShownExpiredRef.current) {
17211
- return;
17212
- }
17213
- hasShownExpiredRef.current = true;
17214
- pushModal({
17215
- component: DataExpiredModal,
17216
- props: {
17217
- onAbandon: () => {
17218
- popModal();
17219
- }
17220
- }
17221
- });
17222
- }, [isExpired, isSubmitting, pushModal, popModal]);
17223
17338
  const fieldsConfig = useFieldsConfig(
17224
17339
  resourceConfig,
17225
17340
  { fields: formConfig == null ? void 0 : formConfig.fields },
@@ -17234,6 +17349,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17234
17349
  transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
17235
17350
  });
17236
17351
  const yamlFormProps = React.useMemo(() => {
17352
+ var _a2;
17237
17353
  if (isYamlMode) {
17238
17354
  return {
17239
17355
  ...customYamlFormProps,
@@ -17252,12 +17368,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17252
17368
  isShowLayout: false,
17253
17369
  useFormProps: {
17254
17370
  redirect: false,
17255
- onSubmitStart: () => {
17256
- setIsSubmitting(true);
17257
- },
17258
- onSubmitAbort: () => {
17259
- setIsSubmitting(false);
17260
- }
17371
+ mutationMeta: (_a2 = formConfig == null ? void 0 : formConfig.refineCoreProps) == null ? void 0 : _a2.mutationMeta
17261
17372
  },
17262
17373
  rules: fieldsConfig == null ? void 0 : fieldsConfig.filter(
17263
17374
  (config) => "isSkipValidationInYaml" in config && !config.isSkipValidationInYaml
@@ -17287,6 +17398,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17287
17398
  id,
17288
17399
  refineFormResult,
17289
17400
  formConfig == null ? void 0 : formConfig.beforeSubmit,
17401
+ (_a = formConfig == null ? void 0 : formConfig.refineCoreProps) == null ? void 0 : _a.mutationMeta,
17290
17402
  transformApplyValues,
17291
17403
  onSaveButtonPropsChange,
17292
17404
  onSuccess,
@@ -17306,18 +17418,20 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17306
17418
  }),
17307
17419
  [refineFormResult.formResult]
17308
17420
  );
17309
- if (action === "edit" && !((_b = (_a = refineFormResult.formResult.getValues()) == null ? void 0 : _a.metadata) == null ? void 0 : _b.name)) {
17421
+ const currentFormValues = refineFormResult.formResult.getValues();
17422
+ const isReady = (formConfig == null ? void 0 : formConfig.isDataReady) ? formConfig.isDataReady(currentFormValues) : !!((_b = currentFormValues == null ? void 0 : currentFormValues.metadata) == null ? void 0 : _b.name);
17423
+ if (action === "edit" && !isReady) {
17310
17424
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Loading, {});
17311
17425
  }
17312
17426
  if (isYamlMode) {
17313
17427
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(YamlForm, { ...yamlFormProps });
17314
17428
  }
17315
17429
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
17316
- !(formConfig == null ? void 0 : formConfig.isDisabledChangeMode) ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17430
+ !(formConfig == null ? void 0 : formConfig.isDisabledChangeMode) && (formConfig == null ? void 0 : formConfig.changeModeAlert) !== false ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17317
17431
  eagle.Alert,
17318
17432
  {
17319
17433
  type: "warning",
17320
- message: i18n.t("dovetail.change_form_mode_alert"),
17434
+ message: (formConfig == null ? void 0 : formConfig.changeModeAlert) ?? i18n.t("dovetail.change_form_mode_alert"),
17321
17435
  style: { marginBottom: "16px" }
17322
17436
  }
17323
17437
  ) : void 0,
@@ -17371,7 +17485,7 @@ function ConfirmModal({
17371
17485
  });
17372
17486
  }
17373
17487
  function FormModal(props) {
17374
- var _a, _b, _c, _d, _e;
17488
+ var _a, _b, _c, _d, _e, _f;
17375
17489
  const {
17376
17490
  id,
17377
17491
  yamlFormProps: customYamlFormProps,
@@ -17509,37 +17623,59 @@ function FormModal(props) {
17509
17623
  setStep(nextStep);
17510
17624
  }
17511
17625
  }, [step]);
17512
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.WizardDialog, {
17513
- style: {
17514
- "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
17515
- },
17516
- title: /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
17517
- className: TitleWrapperStyle,
17518
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
17519
- children: title
17520
- }), ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(FormModeSegmentControl, {
17521
- formConfig: resourceConfig.formConfig,
17522
- mode,
17523
- onChangeMode
17524
- }) : null]
17525
- }),
17526
- error: errorText,
17527
- steps,
17626
+ const extraSubmitButton = ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? resourceConfig.formConfig.extraSubmitButton : void 0;
17627
+ const footer = useExtraSubmitFooter({
17628
+ action,
17629
+ cancelText: (modalProps == null ? void 0 : modalProps.cancelText) || i18n2.t("dovetail.cancel"),
17630
+ defaultSubmitText: okText,
17631
+ errorText,
17632
+ extraSubmitButton,
17633
+ fallbackFooter: modalProps == null ? void 0 : modalProps.footer,
17634
+ isYamlMode,
17635
+ nextStepText: (modalProps == null ? void 0 : modalProps.nextText) || i18n2.t("dovetail.next_step"),
17636
+ prevStepText: (modalProps == null ? void 0 : modalProps.prevText) || i18n2.t("dovetail.prev_step"),
17637
+ saveButtonProps,
17528
17638
  step,
17529
- onStepChange: handleStepChange,
17530
- onOk,
17531
- okButtonProps: {
17532
- ...lodashEs.omit(saveButtonProps, "onClick"),
17533
- children: (_d = resourceConfig.formConfig) == null ? void 0 : _d.saveButtonText
17534
- },
17535
- okText: ((_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText) || okText,
17536
- destroyOnClose: true,
17537
- destroyOtherStep: true,
17538
- ...modalProps,
17539
- children: [desc ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
17540
- className: FormDescStyle,
17541
- children: desc
17542
- }) : void 0, formEle]
17639
+ stepCount: (steps == null ? void 0 : steps.length) || 0,
17640
+ onCancel: popModal,
17641
+ onNextStep: () => handleStepChange(step + 1),
17642
+ onPrevStep: () => handleStepChange(step - 1),
17643
+ onSubmit: onOk
17644
+ });
17645
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(Retry409Provider, {
17646
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.WizardDialog, {
17647
+ style: {
17648
+ "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
17649
+ },
17650
+ title: /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
17651
+ className: TitleWrapperStyle,
17652
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
17653
+ children: title
17654
+ }), ((_d = resourceConfig.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(FormModeSegmentControl, {
17655
+ formConfig: resourceConfig.formConfig,
17656
+ mode,
17657
+ onChangeMode
17658
+ }) : null]
17659
+ }),
17660
+ error: errorText,
17661
+ steps,
17662
+ step,
17663
+ onStepChange: handleStepChange,
17664
+ onOk,
17665
+ okButtonProps: {
17666
+ ...lodashEs.omit(saveButtonProps, "onClick"),
17667
+ children: (_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText
17668
+ },
17669
+ okText: ((_f = resourceConfig.formConfig) == null ? void 0 : _f.saveButtonText) || okText,
17670
+ footer,
17671
+ destroyOnClose: true,
17672
+ destroyOtherStep: true,
17673
+ ...modalProps,
17674
+ children: [desc ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
17675
+ className: FormDescStyle,
17676
+ children: desc
17677
+ }) : void 0, formEle]
17678
+ })
17543
17679
  });
17544
17680
  }
17545
17681
  const RefineFormPage_1v0fhor = "";
@@ -20696,6 +20832,7 @@ exports.FormItemLayout = FormItemLayout;
20696
20832
  exports.FormModal = FormModal;
20697
20833
  exports.FormMode = FormMode;
20698
20834
  exports.FormType = FormType;
20835
+ exports.FormatRulePopover = FormatRulePopover;
20699
20836
  exports.GlobalStoreContext = GlobalStoreContext;
20700
20837
  exports.INGRESS_INIT_VALUE = INGRESS_INIT_VALUE;
20701
20838
  exports.ImageField = ImageField;