@open-mercato/ui 0.6.6-develop.6413.1.ae875fb682 → 0.6.6-develop.6419.1.a632f417c4
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/backend/CrudForm.js +16 -7
- package/dist/backend/CrudForm.js.map +2 -2
- package/dist/backend/detail/AttachmentMetadataDialog.js +78 -45
- package/dist/backend/detail/AttachmentMetadataDialog.js.map +2 -2
- package/dist/backend/filters/AdvancedFilterPanel.js +1 -0
- package/dist/backend/filters/AdvancedFilterPanel.js.map +2 -2
- package/dist/backend/messages/useMessageCompose.js +26 -9
- package/dist/backend/messages/useMessageCompose.js.map +2 -2
- package/package.json +3 -3
- package/src/backend/CrudForm.tsx +15 -4
- package/src/backend/__tests__/AttachmentMetadataDialog.test.tsx +145 -0
- package/src/backend/__tests__/CrudForm.readonlyFields.test.tsx +120 -0
- package/src/backend/detail/AttachmentMetadataDialog.tsx +73 -39
- package/src/backend/filters/AdvancedFilterPanel.tsx +1 -1
- package/src/backend/messages/__tests__/MessageComposer.test.tsx +174 -1
- package/src/backend/messages/message-composer.types.ts +6 -0
- package/src/backend/messages/useMessageCompose.ts +34 -9
package/dist/backend/CrudForm.js
CHANGED
|
@@ -2955,6 +2955,7 @@ function TextInput({
|
|
|
2955
2955
|
autoFocus,
|
|
2956
2956
|
onSubmit,
|
|
2957
2957
|
disabled,
|
|
2958
|
+
readOnly,
|
|
2958
2959
|
suggestions,
|
|
2959
2960
|
inputType = "text"
|
|
2960
2961
|
}) {
|
|
@@ -2972,12 +2973,12 @@ function TextInput({
|
|
|
2972
2973
|
}
|
|
2973
2974
|
}, [value]);
|
|
2974
2975
|
const handleChange = React.useCallback((e) => {
|
|
2975
|
-
if (disabled) return;
|
|
2976
|
+
if (disabled || readOnly) return;
|
|
2976
2977
|
const next = e.target.value;
|
|
2977
2978
|
userTypingRef.current = true;
|
|
2978
2979
|
setLocal(next);
|
|
2979
2980
|
onChange(next);
|
|
2980
|
-
}, [disabled, onChange]);
|
|
2981
|
+
}, [disabled, readOnly, onChange]);
|
|
2981
2982
|
const handleKeyDown = React.useCallback((e) => {
|
|
2982
2983
|
if (disabled) return;
|
|
2983
2984
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
@@ -3007,7 +3008,8 @@ function TextInput({
|
|
|
3007
3008
|
spellCheck: false,
|
|
3008
3009
|
autoFocus,
|
|
3009
3010
|
"data-crud-focus-target": "",
|
|
3010
|
-
disabled
|
|
3011
|
+
disabled,
|
|
3012
|
+
readOnly
|
|
3011
3013
|
}
|
|
3012
3014
|
);
|
|
3013
3015
|
}
|
|
@@ -3026,6 +3028,7 @@ function TextInput({
|
|
|
3026
3028
|
autoFocus,
|
|
3027
3029
|
"data-crud-focus-target": "",
|
|
3028
3030
|
disabled,
|
|
3031
|
+
readOnly,
|
|
3029
3032
|
list: suggestions && suggestions.length > 0 ? datalistId : void 0
|
|
3030
3033
|
}
|
|
3031
3034
|
),
|
|
@@ -3095,7 +3098,8 @@ function TextAreaInput({
|
|
|
3095
3098
|
maxLength,
|
|
3096
3099
|
showCount,
|
|
3097
3100
|
rows,
|
|
3098
|
-
disabled
|
|
3101
|
+
disabled,
|
|
3102
|
+
readOnly
|
|
3099
3103
|
}) {
|
|
3100
3104
|
const [local, setLocal] = React.useState(value);
|
|
3101
3105
|
const isFocusedRef = React.useRef(false);
|
|
@@ -3107,10 +3111,11 @@ function TextAreaInput({
|
|
|
3107
3111
|
if (!isFocusedRef.current) setLocal(value);
|
|
3108
3112
|
}, [value]);
|
|
3109
3113
|
const handleChange = React.useCallback((e) => {
|
|
3114
|
+
if (disabled || readOnly) return;
|
|
3110
3115
|
const next = e.target.value;
|
|
3111
3116
|
setLocal(next);
|
|
3112
3117
|
onChange(next);
|
|
3113
|
-
}, [onChange]);
|
|
3118
|
+
}, [disabled, readOnly, onChange]);
|
|
3114
3119
|
const handleFocus = React.useCallback(() => {
|
|
3115
3120
|
isFocusedRef.current = true;
|
|
3116
3121
|
}, []);
|
|
@@ -3131,6 +3136,7 @@ function TextAreaInput({
|
|
|
3131
3136
|
showCount,
|
|
3132
3137
|
rows,
|
|
3133
3138
|
disabled,
|
|
3139
|
+
readOnly,
|
|
3134
3140
|
"data-crud-focus-target": ""
|
|
3135
3141
|
}
|
|
3136
3142
|
);
|
|
@@ -3373,6 +3379,7 @@ const FieldControl = React.memo(
|
|
|
3373
3379
|
autoFocus: autoFocusField,
|
|
3374
3380
|
onSubmit: onSubmitRequest,
|
|
3375
3381
|
disabled,
|
|
3382
|
+
readOnly,
|
|
3376
3383
|
suggestions: field.type === "text" ? field.suggestions : void 0
|
|
3377
3384
|
}
|
|
3378
3385
|
),
|
|
@@ -3385,6 +3392,7 @@ const FieldControl = React.memo(
|
|
|
3385
3392
|
autoFocus: autoFocusField,
|
|
3386
3393
|
onSubmit: onSubmitRequest,
|
|
3387
3394
|
disabled,
|
|
3395
|
+
readOnly,
|
|
3388
3396
|
inputType: "password"
|
|
3389
3397
|
}
|
|
3390
3398
|
),
|
|
@@ -3479,7 +3487,8 @@ const FieldControl = React.memo(
|
|
|
3479
3487
|
maxLength: builtin?.maxLength,
|
|
3480
3488
|
showCount: builtin?.showCount,
|
|
3481
3489
|
rows: builtin?.rows,
|
|
3482
|
-
disabled
|
|
3490
|
+
disabled,
|
|
3491
|
+
readOnly
|
|
3483
3492
|
}
|
|
3484
3493
|
),
|
|
3485
3494
|
field.type === "richtext" && builtin?.editor === "simple" && /* @__PURE__ */ jsx(SimpleMarkdownEditor, { value: String(value ?? ""), onChange: fieldSetValue }),
|
|
@@ -3543,7 +3552,7 @@ const FieldControl = React.memo(
|
|
|
3543
3552
|
}
|
|
3544
3553
|
setValue(field.id, next);
|
|
3545
3554
|
},
|
|
3546
|
-
disabled,
|
|
3555
|
+
disabled: disabled || readOnly,
|
|
3547
3556
|
children: [
|
|
3548
3557
|
/* @__PURE__ */ jsx(SelectTrigger, { "data-crud-focus-target": "", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("ui.forms.select.emptyOption", "\u2014"), children: singleSelectLabel }) }),
|
|
3549
3558
|
/* @__PURE__ */ jsxs(SelectContent, { children: [
|