@stoker-platform/web-app 0.5.29 → 0.5.30
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 +6 -0
- package/package.json +1 -1
- package/src/Form.tsx +19 -15
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/Form.tsx
CHANGED
|
@@ -301,7 +301,6 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
301
301
|
setCondition(!!condition)
|
|
302
302
|
|
|
303
303
|
const [
|
|
304
|
-
readOnly,
|
|
305
304
|
label,
|
|
306
305
|
description,
|
|
307
306
|
descriptionCondition,
|
|
@@ -316,7 +315,6 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
316
315
|
isRadio,
|
|
317
316
|
icon,
|
|
318
317
|
] = await Promise.all([
|
|
319
|
-
tryPromise(admin?.readOnly, [operation, record]),
|
|
320
318
|
tryFunction(admin?.label),
|
|
321
319
|
tryFunction(admin?.description?.message, [record]),
|
|
322
320
|
tryPromise(admin?.description?.condition, [record]),
|
|
@@ -362,6 +360,10 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
362
360
|
return
|
|
363
361
|
}
|
|
364
362
|
setCondition(true)
|
|
363
|
+
setTimeout(() => {
|
|
364
|
+
const readOnly = tryFunction(admin?.readOnly, [operation, form.getValues()])
|
|
365
|
+
setReadOnly(!!readOnly)
|
|
366
|
+
}, 0)
|
|
365
367
|
}, [form.watch()])
|
|
366
368
|
|
|
367
369
|
const hasUpdateAccess = useMemo(() => {
|
|
@@ -3453,19 +3455,21 @@ function RecordForm({
|
|
|
3453
3455
|
}
|
|
3454
3456
|
}
|
|
3455
3457
|
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3458
|
+
setTimeout(() => {
|
|
3459
|
+
if (isInitialized && (operation === "create" || operation === "update") && customization.admin?.onChange) {
|
|
3460
|
+
tryPromise(customization.admin.onChange, [
|
|
3461
|
+
operation,
|
|
3462
|
+
cloneDeep(form.getValues()) as StokerRecord,
|
|
3463
|
+
prevState as StokerRecord,
|
|
3464
|
+
]).then((updatedRecord: StokerRecord) => {
|
|
3465
|
+
if (updatedRecord && !isEqual(updatedRecord, formValues)) {
|
|
3466
|
+
Object.entries(updatedRecord).forEach(([key, value]) => {
|
|
3467
|
+
form.setValue(key, value)
|
|
3468
|
+
})
|
|
3469
|
+
}
|
|
3470
|
+
})
|
|
3471
|
+
}
|
|
3472
|
+
}, 0)
|
|
3469
3473
|
}, [form.watch()])
|
|
3470
3474
|
|
|
3471
3475
|
const recordLoaded = useRef(false)
|