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