@hzab/list-render 1.8.3-beta2 → 1.9.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # @hzab/list-render@1.9.1
2
+
3
+ fix: Drawer 模式 首次编辑 scenario 状态不正确问题修复
4
+
1
5
  # @hzab/list-render@1.9.0
2
6
 
3
7
  feat: 列表渲染支持 tag 模式、前缀 Node (前缀圆点)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/list-render",
3
- "version": "1.8.3-beta2",
3
+ "version": "1.9.1",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -29,15 +29,15 @@ export function FormModal(props, parentRef) {
29
29
  const { modalMode, Slots = {}, modalConf = {}, modalProps = {} } = props;
30
30
  const [loading, setLoading] = useState(false);
31
31
  const [title, setTitle] = useState("新增");
32
- const [scenario, setScenario] = useState("create");
33
32
  const [open, setOpen] = useState(false);
34
33
  const formRef = useRef<IFormRef>();
34
+ const scenarioRef = useRef<string>("create");
35
35
 
36
36
  const FormSlot = useMemo(() => props.Slots?.FormSlot, [props.Slots?.FormSlot]);
37
37
 
38
38
  function show(formData = props.formInitialValues, title, scenario = "create") {
39
39
  setOpen(true);
40
- setScenario(scenario || "create");
40
+ scenarioRef.current = scenario || "create";
41
41
  // 处理 formRef.current 为 undefined 的问题
42
42
  if (formRef.current?.formRender?.setValues) {
43
43
  formRef.current?.formRender?.setValues(formData);
@@ -69,7 +69,7 @@ export function FormModal(props, parentRef) {
69
69
  const isContinue = await modalConf.beforeSubmit(submitForm, {
70
70
  cancel: close,
71
71
  formRef,
72
- scenario,
72
+ scenario: scenarioRef.current,
73
73
  });
74
74
  if (isContinue === false) {
75
75
  return;
@@ -113,7 +113,7 @@ export function FormModal(props, parentRef) {
113
113
  close,
114
114
  form: formRef.current?.formRender,
115
115
  validate,
116
- scenario,
116
+ scenario: scenarioRef.current,
117
117
  };
118
118
  if (modalConf?.footer) {
119
119
  footer = typeof modalConf?.footer === "function" ? modalConf.footer({ ...options, options }) : modalConf?.footer;
@@ -177,14 +177,14 @@ export function FormModal(props, parentRef) {
177
177
  return (
178
178
  <CModal {..._modalProps}>
179
179
  {FormSlot ? (
180
- <FormSlot {...props} formRef={formRef} scenario={scenario} schema={props.schema?.schema} />
180
+ <FormSlot {...props} formRef={formRef} scenario={scenarioRef.current} schema={props.schema?.schema} />
181
181
  ) : (
182
182
  <FormRender
183
183
  {...props.formProps}
184
184
  ref={formRef}
185
185
  schema={props.schema}
186
186
  schemaScope={{
187
- scenario: scenario,
187
+ scenario: scenarioRef.current,
188
188
  ...(props.schemaScope || {}),
189
189
  }}
190
190
  components={props.components}