@dartech/arsenal-ui 1.4.33 → 1.4.35
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 +11 -5
- package/package.json +1 -1
- package/src/lib/Forms/ControlAceEditor.d.ts +1 -1
package/index.js
CHANGED
@@ -1189,11 +1189,14 @@ 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') {
|
1193
|
+
return JSON.stringify(value, null, 2);
|
1194
|
+
}
|
1192
1195
|
if (mode === 'json' && typeof value !== 'string') {
|
1193
1196
|
if (value === null) return '';
|
1194
1197
|
return useCleanValue ? JSON.stringify(value, null, 2).replace(/\\"/g, '') : JSON.stringify(value, null, 2);
|
1195
1198
|
}
|
1196
|
-
if (typeof value === 'string') {
|
1199
|
+
if (typeof value === 'string' && mode !== 'text') {
|
1197
1200
|
return useCleanValue ? value.replace(/\\"/g, '') : value;
|
1198
1201
|
}
|
1199
1202
|
return value;
|
@@ -1250,8 +1253,9 @@ const ControlAceEditor = /*#__PURE__*/forwardRef((_a, ref) => {
|
|
1250
1253
|
},
|
1251
1254
|
readOnly: readOnly,
|
1252
1255
|
value: safeValue,
|
1253
|
-
onChange: handleChange
|
1254
|
-
|
1256
|
+
onChange: handleChange
|
1257
|
+
}, mode === 'text' ? {} : {
|
1258
|
+
extentions: extensions[mode]
|
1255
1259
|
}, otherProps)), error && !hideErrorMessage && jsx(FormHelperText, Object.assign({
|
1256
1260
|
variant: "standard",
|
1257
1261
|
error: true
|
@@ -6192,7 +6196,8 @@ const PropertyFiller = ({
|
|
6192
6196
|
label: valueLabel,
|
6193
6197
|
parseValue: true,
|
6194
6198
|
hideErrorMessage: true,
|
6195
|
-
useCleanValue: true
|
6199
|
+
useCleanValue: true,
|
6200
|
+
mode: propertyType === PropertyType.ANY ? 'text' : 'json'
|
6196
6201
|
}) : jsx(ControlInput, {
|
6197
6202
|
control: control,
|
6198
6203
|
name: name,
|
@@ -6452,7 +6457,8 @@ const MultiplePropertyFiller = ({
|
|
6452
6457
|
label: valueLabel,
|
6453
6458
|
parseValue: true,
|
6454
6459
|
hideErrorMessage: true,
|
6455
|
-
useCleanValue: true
|
6460
|
+
useCleanValue: true,
|
6461
|
+
mode: propertyType === PropertyType.ANY ? 'text' : 'json'
|
6456
6462
|
}) : jsx(ControlInput, {
|
6457
6463
|
required: true,
|
6458
6464
|
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;
|