@dartech/arsenal-ui 1.3.20 → 1.3.22
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 +3 -202
- package/package.json +1 -1
package/index.js
CHANGED
@@ -11,7 +11,7 @@ import CircularProgress from '@mui/material/CircularProgress';
|
|
11
11
|
import { __rest, __awaiter } from 'tslib';
|
12
12
|
import { useController, useWatch, useFormContext, useFieldArray } from 'react-hook-form';
|
13
13
|
import TextField from '@mui/material/TextField';
|
14
|
-
import React, { useRef, useEffect, useState, useCallback, useMemo, createElement, forwardRef, createContext, useContext,
|
14
|
+
import React, { useRef, useEffect, useState, useCallback, useMemo, createElement, forwardRef, createContext, useContext, Suspense } from 'react';
|
15
15
|
import MenuItem from '@mui/material/MenuItem';
|
16
16
|
import ClearIcon from '@mui/icons-material/Clear';
|
17
17
|
import IconButton from '@mui/material/IconButton';
|
@@ -75,7 +75,6 @@ import StepConnector from '@mui/material/StepConnector';
|
|
75
75
|
import Select from '@mui/material/Select';
|
76
76
|
import CloseIcon from '@mui/icons-material/Close';
|
77
77
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
78
|
-
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
79
78
|
import classnames from 'classnames';
|
80
79
|
import { toast } from 'react-toastify';
|
81
80
|
import CssBaseline from '@mui/material/CssBaseline';
|
@@ -4907,197 +4906,6 @@ const CreateDefinition = ({
|
|
4907
4906
|
}));
|
4908
4907
|
};
|
4909
4908
|
|
4910
|
-
const labels = {
|
4911
|
-
name: 'Name',
|
4912
|
-
key: 'Key',
|
4913
|
-
propertyType: 'Property Type',
|
4914
|
-
defaultValue: 'Default Value',
|
4915
|
-
defaultValues: 'Default Values',
|
4916
|
-
sortOrder: 'Sort Order',
|
4917
|
-
isRequired: 'Required',
|
4918
|
-
isMultiple: 'Multiple',
|
4919
|
-
isEnabled: 'Enabled',
|
4920
|
-
isViewableInList: 'Is Viewable In List',
|
4921
|
-
precisionScale: 'Precision Scale',
|
4922
|
-
roundingMode: 'Rounding Mode',
|
4923
|
-
format: 'Format',
|
4924
|
-
definitionCode: 'Definition Code',
|
4925
|
-
definitionVersion: 'Definition Version',
|
4926
|
-
labelPropertyCode: 'Label Property Code',
|
4927
|
-
valuePropertyCode: 'Value Property Code',
|
4928
|
-
restrictedValues: 'Restricted Values',
|
4929
|
-
value: 'Value',
|
4930
|
-
values: 'Values',
|
4931
|
-
uiSettings: 'UI Settings',
|
4932
|
-
validationNode: 'Validation Node'
|
4933
|
-
};
|
4934
|
-
const ValueDisplay = ({
|
4935
|
-
value,
|
4936
|
-
type
|
4937
|
-
}) => {
|
4938
|
-
if ((type === PropertyType.JSON || type === PropertyType.ENTITY || type === PropertyType.ANY) && value) {
|
4939
|
-
return jsx(JsonView, {
|
4940
|
-
value: value
|
4941
|
-
});
|
4942
|
-
} else {
|
4943
|
-
return jsx(Typography, Object.assign({
|
4944
|
-
variant: "subtitle1",
|
4945
|
-
display: "inline",
|
4946
|
-
style: {
|
4947
|
-
wordBreak: 'break-word'
|
4948
|
-
}
|
4949
|
-
}, {
|
4950
|
-
children: value === null ? 'null' : value.toString()
|
4951
|
-
}));
|
4952
|
-
}
|
4953
|
-
};
|
4954
|
-
const formatDiplayValue = (value, key, type) => {
|
4955
|
-
switch (key) {
|
4956
|
-
case 'isRequired':
|
4957
|
-
case 'isMultiple':
|
4958
|
-
case 'isEnabled':
|
4959
|
-
case 'isViewableInList':
|
4960
|
-
return value ? jsx(CheckCircleIcon, {
|
4961
|
-
color: "primary",
|
4962
|
-
fontSize: "small"
|
4963
|
-
}) : null;
|
4964
|
-
case 'restrictedValues':
|
4965
|
-
return value ? jsx(Box, Object.assign({
|
4966
|
-
display: "flex",
|
4967
|
-
flexWrap: "wrap"
|
4968
|
-
}, {
|
4969
|
-
children: value.map(restrictedValue => jsx(Chip, {
|
4970
|
-
label: restrictedValue,
|
4971
|
-
style: {
|
4972
|
-
wordBreak: 'break-word',
|
4973
|
-
maxWidth: '500px'
|
4974
|
-
}
|
4975
|
-
}, restrictedValue))
|
4976
|
-
})) : null;
|
4977
|
-
case 'defaultValue':
|
4978
|
-
case 'value':
|
4979
|
-
return jsx(ValueDisplay, {
|
4980
|
-
value: value,
|
4981
|
-
type: type
|
4982
|
-
});
|
4983
|
-
case 'values':
|
4984
|
-
case 'defaultValues':
|
4985
|
-
if (!Array.isArray(value) || type === PropertyType.ENTITY || type === PropertyType.JSON || type === PropertyType.ANY) {
|
4986
|
-
return jsx(JsonView, {
|
4987
|
-
value: value
|
4988
|
-
});
|
4989
|
-
} else {
|
4990
|
-
return jsxs("div", {
|
4991
|
-
children: ["[", value === null || value === void 0 ? void 0 : value.map((v, index) => jsx("div", {
|
4992
|
-
children: jsx(ValueDisplay, {
|
4993
|
-
value: v,
|
4994
|
-
type: type
|
4995
|
-
})
|
4996
|
-
}, index)), "]"]
|
4997
|
-
});
|
4998
|
-
}
|
4999
|
-
case 'uiSettings':
|
5000
|
-
case 'validationNode':
|
5001
|
-
return value ? jsx(JsonView, {
|
5002
|
-
value: value
|
5003
|
-
}) : null;
|
5004
|
-
default:
|
5005
|
-
return jsx(Typography, Object.assign({
|
5006
|
-
variant: "subtitle1",
|
5007
|
-
display: "inline",
|
5008
|
-
style: {
|
5009
|
-
wordBreak: 'break-word'
|
5010
|
-
}
|
5011
|
-
}, {
|
5012
|
-
children: value
|
5013
|
-
}));
|
5014
|
-
}
|
5015
|
-
};
|
5016
|
-
const PropertyDataTable = ({
|
5017
|
-
property
|
5018
|
-
}) => {
|
5019
|
-
const propertyData = useMemo(() => {
|
5020
|
-
if (property) {
|
5021
|
-
if (property.isMultiple) {
|
5022
|
-
delete property.defaultValue;
|
5023
|
-
delete property['value'];
|
5024
|
-
} else {
|
5025
|
-
delete property.defaultValues;
|
5026
|
-
delete property['values'];
|
5027
|
-
}
|
5028
|
-
}
|
5029
|
-
return property;
|
5030
|
-
}, [property]);
|
5031
|
-
return jsx(MuiTable, Object.assign({
|
5032
|
-
size: "small"
|
5033
|
-
}, {
|
5034
|
-
children: jsx(TableBody, {
|
5035
|
-
children: Object.keys(labels).map(key => key in propertyData ? jsxs(TableRow, {
|
5036
|
-
children: [jsx(TableCell, Object.assign({
|
5037
|
-
width: "30%"
|
5038
|
-
}, {
|
5039
|
-
children: jsx(Typography, {
|
5040
|
-
children: labels[key]
|
5041
|
-
})
|
5042
|
-
})), jsx(TableCell, {
|
5043
|
-
children: formatDiplayValue(propertyData[key], key, propertyData.propertyType)
|
5044
|
-
})]
|
5045
|
-
}, key) : null)
|
5046
|
-
})
|
5047
|
-
}));
|
5048
|
-
};
|
5049
|
-
var PropertyDataTable$1 = PropertyDataTable;
|
5050
|
-
|
5051
|
-
const EntityPropertiesView = ({
|
5052
|
-
properties,
|
5053
|
-
parentNames: _parentNames = []
|
5054
|
-
}) => {
|
5055
|
-
const hasProperties = useMemo(() => {
|
5056
|
-
let hasProps = false;
|
5057
|
-
properties.every(property => {
|
5058
|
-
if (property.propertyType === PropertyType.ENTITY) {
|
5059
|
-
hasProps = true;
|
5060
|
-
return false;
|
5061
|
-
}
|
5062
|
-
return true;
|
5063
|
-
});
|
5064
|
-
return hasProps;
|
5065
|
-
}, [properties]);
|
5066
|
-
return jsxs(Box, Object.assign({
|
5067
|
-
mt: 4
|
5068
|
-
}, {
|
5069
|
-
children: [jsx(Typography, Object.assign({
|
5070
|
-
variant: "h6"
|
5071
|
-
}, {
|
5072
|
-
children: "Properties"
|
5073
|
-
})), jsxs(Stepper, Object.assign({
|
5074
|
-
orientation: "vertical",
|
5075
|
-
style: {
|
5076
|
-
paddingLeft: '4px'
|
5077
|
-
}
|
5078
|
-
}, {
|
5079
|
-
children: [properties.map(property => jsxs(Step, Object.assign({
|
5080
|
-
expanded: true
|
5081
|
-
}, {
|
5082
|
-
children: [jsx(StepLabel, {
|
5083
|
-
StepIconProps: {
|
5084
|
-
icon: '',
|
5085
|
-
completed: false,
|
5086
|
-
active: true
|
5087
|
-
}
|
5088
|
-
}), jsx(StepContent, {
|
5089
|
-
children: jsx(ViewProperty, {
|
5090
|
-
property: property,
|
5091
|
-
parentNames: [..._parentNames],
|
5092
|
-
defaultExpanded: false
|
5093
|
-
})
|
5094
|
-
})]
|
5095
|
-
}), property.key)), hasProperties && jsx(Step, {})]
|
5096
|
-
}))]
|
5097
|
-
}));
|
5098
|
-
};
|
5099
|
-
var EntityPropertiesView$1 = /*#__PURE__*/memo(EntityPropertiesView);
|
5100
|
-
|
5101
4909
|
const ViewProperty = ({
|
5102
4910
|
property,
|
5103
4911
|
parentNames: _parentNames = [],
|
@@ -5127,16 +4935,9 @@ const ViewProperty = ({
|
|
5127
4935
|
children: property.name
|
5128
4936
|
}))
|
5129
4937
|
})), jsx(AccordionDetails, {
|
5130
|
-
children:
|
4938
|
+
children: jsx(Box, {
|
5131
4939
|
width: "100%"
|
5132
|
-
}
|
5133
|
-
children: [jsx(PropertyDataTable$1, {
|
5134
|
-
property: property
|
5135
|
-
}), property.propertyType === PropertyType.ENTITY && jsx(EntityPropertiesView$1, {
|
5136
|
-
properties: propertiesObjectToArray(property.properties),
|
5137
|
-
parentNames: [..._parentNames, property.name]
|
5138
|
-
})]
|
5139
|
-
}))
|
4940
|
+
})
|
5140
4941
|
})]
|
5141
4942
|
}));
|
5142
4943
|
};
|