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