@dartech/arsenal-ui 1.4.33 → 1.4.34
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/index.js +8 -4
- package/package.json +1 -1
- package/src/lib/Forms/ControlAceEditor.d.ts +1 -1
package/index.js
CHANGED
@@ -1189,6 +1189,7 @@ const ControlAceEditor = /*#__PURE__*/forwardRef((_a, ref) => {
|
|
1189
1189
|
python: [langs.python()]
|
1190
1190
|
}), []);
|
1191
1191
|
const safeValue = useMemo(() => {
|
1192
|
+
if (mode === 'text' && typeof value !== 'string') return JSON.stringify(value, null, 2);
|
1192
1193
|
if (mode === 'json' && typeof value !== 'string') {
|
1193
1194
|
if (value === null) return '';
|
1194
1195
|
return useCleanValue ? JSON.stringify(value, null, 2).replace(/\\"/g, '') : JSON.stringify(value, null, 2);
|
@@ -1250,8 +1251,9 @@ const ControlAceEditor = /*#__PURE__*/forwardRef((_a, ref) => {
|
|
1250
1251
|
},
|
1251
1252
|
readOnly: readOnly,
|
1252
1253
|
value: safeValue,
|
1253
|
-
onChange: handleChange
|
1254
|
-
|
1254
|
+
onChange: handleChange
|
1255
|
+
}, mode === 'text' ? {} : {
|
1256
|
+
extentions: extensions[mode]
|
1255
1257
|
}, otherProps)), error && !hideErrorMessage && jsx(FormHelperText, Object.assign({
|
1256
1258
|
variant: "standard",
|
1257
1259
|
error: true
|
@@ -6192,7 +6194,8 @@ const PropertyFiller = ({
|
|
6192
6194
|
label: valueLabel,
|
6193
6195
|
parseValue: true,
|
6194
6196
|
hideErrorMessage: true,
|
6195
|
-
useCleanValue: true
|
6197
|
+
useCleanValue: true,
|
6198
|
+
mode: propertyType === PropertyType.ANY ? 'text' : 'json'
|
6196
6199
|
}) : jsx(ControlInput, {
|
6197
6200
|
control: control,
|
6198
6201
|
name: name,
|
@@ -6452,7 +6455,8 @@ const MultiplePropertyFiller = ({
|
|
6452
6455
|
label: valueLabel,
|
6453
6456
|
parseValue: true,
|
6454
6457
|
hideErrorMessage: true,
|
6455
|
-
useCleanValue: true
|
6458
|
+
useCleanValue: true,
|
6459
|
+
mode: propertyType === PropertyType.ANY ? 'text' : 'json'
|
6456
6460
|
}) : jsx(ControlInput, {
|
6457
6461
|
required: true,
|
6458
6462
|
hideErrorMessage: true,
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@ import { ReactNode } from 'react';
|
|
4
4
|
export interface ControlAceEditorProps {
|
5
5
|
name: string;
|
6
6
|
control: Control<any>;
|
7
|
-
mode?: 'json' | 'javascript' | 'python';
|
7
|
+
mode?: 'json' | 'javascript' | 'python' | 'text';
|
8
8
|
label?: ReactNode;
|
9
9
|
width?: string;
|
10
10
|
height?: string;
|