@dartech/arsenal-ui 0.0.1 → 0.0.3

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 (214) hide show
  1. package/{index.ts → index.d.ts} +3 -3
  2. package/index.esm.js +1 -0
  3. package/index.umd.js +1 -0
  4. package/package.json +5 -2
  5. package/src/interfaces/common.d.ts +10 -0
  6. package/src/interfaces/definition.d.ts +117 -0
  7. package/src/interfaces/{index.ts → index.d.ts} +3 -3
  8. package/src/interfaces/ui.d.ts +33 -0
  9. package/src/lib/Alert/Alert.d.ts +53 -0
  10. package/src/lib/Alert/index.d.ts +1 -0
  11. package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +11 -0
  12. package/src/lib/Definition/CreateDefinition/{index.ts → index.d.ts} +1 -1
  13. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +8 -0
  14. package/src/lib/Definition/DefinitionFiller/WidgetDefinitionFiller.d.ts +9 -0
  15. package/src/lib/Definition/DefinitionFiller/{index.ts → index.d.ts} +2 -2
  16. package/src/lib/Definition/{index.ts → index.d.ts} +2 -2
  17. package/src/lib/DemPropertyField/DemPropertyField.d.ts +59 -0
  18. package/src/lib/DemPropertyField/DemPropertyView/DemPropertyView.d.ts +8 -0
  19. package/src/lib/DemPropertyField/DemPropertyView/{index.ts → index.d.ts} +1 -1
  20. package/src/lib/DemPropertyField/MultipleDemField/MultipleDemField.d.ts +9 -0
  21. package/src/lib/DemPropertyField/MultipleDemField/{index.tsx → index.d.ts} +1 -1
  22. package/src/lib/DemPropertyField/RestrictedValuesEditor.d.ts +6 -0
  23. package/src/lib/DemPropertyField/SingleDemField/SingleDemField.d.ts +9 -0
  24. package/src/lib/DemPropertyField/SingleDemField/{index.ts → index.d.ts} +1 -1
  25. package/src/lib/DemPropertyField/{index.ts → index.d.ts} +2 -2
  26. package/src/lib/DemPropertyField/styles.d.ts +2 -0
  27. package/src/lib/DemPropertyField/widgets/DemBooleanWidget.d.ts +7 -0
  28. package/src/lib/DemPropertyField/widgets/DemDateTimeWidget.d.ts +9 -0
  29. package/src/lib/DemPropertyField/widgets/DemDateWidget.d.ts +9 -0
  30. package/src/lib/DemPropertyField/widgets/DemFieldWidget.d.ts +11 -0
  31. package/src/lib/DemPropertyField/widgets/DemFloatWidget.d.ts +10 -0
  32. package/src/lib/DemPropertyField/widgets/DemIntegerWidget.d.ts +10 -0
  33. package/src/lib/DemPropertyField/widgets/DemJsonWidget.d.ts +9 -0
  34. package/src/lib/DemPropertyField/widgets/DemStringWidget.d.ts +10 -0
  35. package/src/lib/DemPropertyField/widgets/DemTimeWidget.d.ts +9 -0
  36. package/src/lib/DemPropertyField/widgets/{index.ts → index.d.ts} +1 -1
  37. package/src/lib/Forms/BackButton.d.ts +7 -0
  38. package/src/lib/Forms/ControlAceEditor.d.ts +20 -0
  39. package/src/lib/Forms/ControlAutocomplete.d.ts +49 -0
  40. package/src/lib/Forms/ControlCheckbox.d.ts +30 -0
  41. package/src/lib/Forms/ControlDebouncedInput.d.ts +4 -0
  42. package/src/lib/Forms/ControlInput.d.ts +54 -0
  43. package/src/lib/Forms/ControlNumberInput.d.ts +43 -0
  44. package/src/lib/Forms/ControlQueryAutocomplete.d.ts +7 -0
  45. package/src/lib/Forms/ControlRadioBtn.d.ts +26 -0
  46. package/src/lib/Forms/ControlSelect.d.ts +66 -0
  47. package/src/lib/Forms/CopyButton.d.ts +21 -0
  48. package/src/lib/Forms/{index.ts → index.d.ts} +11 -10
  49. package/src/lib/InfoItem/InfoItem.d.ts +10 -0
  50. package/src/lib/InfoItem/{index.ts → index.d.ts} +1 -1
  51. package/src/lib/InfoItem/styles.d.ts +2 -0
  52. package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +10 -0
  53. package/src/lib/JsonPathPicker/PropertyStep.d.ts +11 -0
  54. package/src/lib/JsonPathPicker/{index.ts → index.d.ts} +1 -1
  55. package/src/lib/JsonView/JsonView.d.ts +9 -0
  56. package/src/lib/JsonView/{index.ts → index.d.ts} +1 -1
  57. package/src/lib/Loader/Loader.d.ts +21 -0
  58. package/src/lib/Loader/{index.ts → index.d.ts} +1 -1
  59. package/src/lib/Modals/JsonModalView.d.ts +10 -0
  60. package/src/lib/Modals/{index.ts → index.d.ts} +1 -1
  61. package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +7 -0
  62. package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +9 -0
  63. package/src/lib/Property/PropertyValueField/DateValueField.d.ts +9 -0
  64. package/src/lib/Property/PropertyValueField/EntityValueField.d.ts +9 -0
  65. package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +10 -0
  66. package/src/lib/Property/PropertyValueField/PropertyValue.d.ts +10 -0
  67. package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +9 -0
  68. package/src/lib/Property/PropertyValueField/StringValueField.d.ts +9 -0
  69. package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +9 -0
  70. package/src/lib/Property/PropertyValueField/ValueComponent.d.ts +15 -0
  71. package/src/lib/Property/PropertyValueField/{index.ts → index.d.ts} +2 -1
  72. package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +9 -0
  73. package/src/lib/Property/PropertyWidget/{index.ts → index.d.ts} +1 -1
  74. package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +13 -0
  75. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +10 -0
  76. package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +7 -0
  77. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +6 -0
  78. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +7 -0
  79. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +8 -0
  80. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +6 -0
  81. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +10 -0
  82. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +6 -0
  83. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.ts → index.d.ts} +1 -1
  84. package/src/lib/Property/UpsertProperty/{index.ts → index.d.ts} +2 -2
  85. package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +6 -0
  86. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +8 -0
  87. package/src/lib/Property/ViewPropertiesList/{index.ts → index.d.ts} +1 -1
  88. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +9 -0
  89. package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +8 -0
  90. package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +7 -0
  91. package/src/lib/Property/ViewProperty/PropertyItem.d.ts +9 -0
  92. package/src/lib/Property/ViewProperty/ViewProperty.d.ts +9 -0
  93. package/src/lib/Property/ViewProperty/{index.ts → index.d.ts} +1 -1
  94. package/src/lib/Property/{index.ts → index.d.ts} +4 -4
  95. package/src/lib/Status/Status.d.ts +7 -0
  96. package/src/lib/Status/{index.ts → index.d.ts} +1 -1
  97. package/src/lib/Status/styles.d.ts +2 -0
  98. package/src/lib/StepperView/StepperView.d.ts +10 -0
  99. package/src/lib/StepperView/index.d.ts +1 -0
  100. package/src/lib/Table/Table.d.ts +49 -0
  101. package/src/lib/Table/TableColumnMenu.d.ts +3 -0
  102. package/src/lib/Table/TablePagination.d.ts +3 -0
  103. package/src/lib/Table/index.d.ts +1 -0
  104. package/src/lib/Table/styles.d.ts +2 -0
  105. package/src/lib/Table/usePagination.d.ts +5 -0
  106. package/src/lib/Table/useTableQueryPagination.d.ts +11 -0
  107. package/src/lib/Table/useTableQuerySorting.d.ts +6 -0
  108. package/src/lib/Tabs/RouteTabs.d.ts +11 -0
  109. package/src/lib/Tabs/TabPanel.d.ts +25 -0
  110. package/src/lib/Tabs/{index.ts → index.d.ts} +2 -2
  111. package/src/lib/TemplateContent/ExpressionDecorator.d.ts +5 -0
  112. package/src/lib/TemplateContent/TemplateContentEditor.d.ts +9 -0
  113. package/src/lib/TemplateContent/{index.ts → index.d.ts} +1 -1
  114. package/src/lib/{index.ts → index.d.ts} +15 -14
  115. package/src/utils/common.d.ts +7 -0
  116. package/src/utils/dem.d.ts +7 -0
  117. package/src/utils/hooks.d.ts +7 -0
  118. package/src/utils/{index.ts → index.d.ts} +5 -5
  119. package/src/utils/ui-utils.d.ts +7 -0
  120. package/src/utils/validators.d.ts +12 -0
  121. package/.babelrc +0 -12
  122. package/.eslintrc.json +0 -22
  123. package/jest.config.js +0 -9
  124. package/project.json +0 -69
  125. package/rollup.config.js +0 -135
  126. package/src/interfaces/common.ts +0 -12
  127. package/src/interfaces/definition.ts +0 -143
  128. package/src/interfaces/ui.ts +0 -35
  129. package/src/lib/Alert/Alert.tsx +0 -108
  130. package/src/lib/Alert/index.ts +0 -1
  131. package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +0 -74
  132. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +0 -85
  133. package/src/lib/Definition/DefinitionFiller/WidgetDefinitionFiller.tsx +0 -96
  134. package/src/lib/DemPropertyField/DemPropertyField.tsx +0 -93
  135. package/src/lib/DemPropertyField/DemPropertyView/DemPropertyView.tsx +0 -44
  136. package/src/lib/DemPropertyField/MultipleDemField/MultipleDemField.tsx +0 -293
  137. package/src/lib/DemPropertyField/RestrictedValuesEditor.tsx +0 -63
  138. package/src/lib/DemPropertyField/SingleDemField/SingleDemField.tsx +0 -156
  139. package/src/lib/DemPropertyField/styles.ts +0 -50
  140. package/src/lib/DemPropertyField/widgets/DemBooleanWidget.tsx +0 -26
  141. package/src/lib/DemPropertyField/widgets/DemDateTimeWidget.tsx +0 -34
  142. package/src/lib/DemPropertyField/widgets/DemDateWidget.tsx +0 -33
  143. package/src/lib/DemPropertyField/widgets/DemFieldWidget.tsx +0 -67
  144. package/src/lib/DemPropertyField/widgets/DemFloatWidget.tsx +0 -49
  145. package/src/lib/DemPropertyField/widgets/DemIntegerWidget.tsx +0 -63
  146. package/src/lib/DemPropertyField/widgets/DemJsonWidget.tsx +0 -33
  147. package/src/lib/DemPropertyField/widgets/DemStringWidget.tsx +0 -35
  148. package/src/lib/DemPropertyField/widgets/DemTimeWidget.tsx +0 -46
  149. package/src/lib/Forms/BackButton.tsx +0 -45
  150. package/src/lib/Forms/ControlAceEditor.tsx +0 -103
  151. package/src/lib/Forms/ControlAutocomplete.tsx +0 -134
  152. package/src/lib/Forms/ControlCheckbox.tsx +0 -57
  153. package/src/lib/Forms/ControlDebouncedInput.tsx +0 -69
  154. package/src/lib/Forms/ControlInput.tsx +0 -102
  155. package/src/lib/Forms/ControlNumberInput.tsx +0 -144
  156. package/src/lib/Forms/ControlRadioBtn.tsx +0 -46
  157. package/src/lib/Forms/ControlSelect.tsx +0 -135
  158. package/src/lib/Forms/CopyButton.tsx +0 -49
  159. package/src/lib/InfoItem/InfoItem.tsx +0 -39
  160. package/src/lib/InfoItem/styles.ts +0 -17
  161. package/src/lib/JsonPathPicker/JsonPathPicker.tsx +0 -71
  162. package/src/lib/JsonPathPicker/PropertyStep.tsx +0 -74
  163. package/src/lib/JsonView/JsonView.tsx +0 -43
  164. package/src/lib/Loader/Loader.tsx +0 -41
  165. package/src/lib/Modals/JsonModalView.tsx +0 -52
  166. package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +0 -41
  167. package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +0 -59
  168. package/src/lib/Property/PropertyValueField/DateValueField.tsx +0 -59
  169. package/src/lib/Property/PropertyValueField/EntityValueField.tsx +0 -33
  170. package/src/lib/Property/PropertyValueField/JsonValueField.tsx +0 -64
  171. package/src/lib/Property/PropertyValueField/PropertyValue.tsx +0 -97
  172. package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +0 -86
  173. package/src/lib/Property/PropertyValueField/StringValueField.tsx +0 -21
  174. package/src/lib/Property/PropertyValueField/TimeValueField.tsx +0 -68
  175. package/src/lib/Property/PropertyValueField/ValueComponent.tsx +0 -63
  176. package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +0 -167
  177. package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +0 -131
  178. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +0 -147
  179. package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +0 -40
  180. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +0 -41
  181. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +0 -27
  182. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +0 -133
  183. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +0 -46
  184. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +0 -52
  185. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +0 -98
  186. package/src/lib/Property/UpsertProperty/useCustomFields.ts +0 -22
  187. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +0 -50
  188. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +0 -41
  189. package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +0 -48
  190. package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +0 -139
  191. package/src/lib/Property/ViewProperty/PropertyItem.tsx +0 -46
  192. package/src/lib/Property/ViewProperty/ViewProperty.tsx +0 -52
  193. package/src/lib/Status/Status.tsx +0 -15
  194. package/src/lib/Status/styles.ts +0 -14
  195. package/src/lib/Table/Table.tsx +0 -116
  196. package/src/lib/Table/TableColumnMenu.tsx +0 -12
  197. package/src/lib/Table/TablePagination.tsx +0 -42
  198. package/src/lib/Table/index.ts +0 -1
  199. package/src/lib/Table/styles.ts +0 -59
  200. package/src/lib/Table/usePagination.ts +0 -15
  201. package/src/lib/Table/useTableQueryPagination.ts +0 -49
  202. package/src/lib/Table/useTableQuerySorting.ts +0 -52
  203. package/src/lib/Tabs/RouteTabs.tsx +0 -54
  204. package/src/lib/Tabs/TabPanel.tsx +0 -42
  205. package/src/lib/TemplateContent/ExpressionDecorator.tsx +0 -7
  206. package/src/lib/TemplateContent/TemplateContentEditor.tsx +0 -144
  207. package/src/utils/common.ts +0 -68
  208. package/src/utils/dem.ts +0 -78
  209. package/src/utils/hooks.ts +0 -41
  210. package/src/utils/ui-utils.tsx +0 -71
  211. package/src/utils/validators.ts +0 -130
  212. package/tsconfig.json +0 -24
  213. package/tsconfig.lib.json +0 -22
  214. package/tsconfig.spec.json +0 -19
@@ -1,133 +0,0 @@
1
- import Grid from '@material-ui/core/Grid';
2
- import Button from '@material-ui/core/Button';
3
- import Typography from '@material-ui/core/Typography';
4
- import Dialog from '@material-ui/core/Dialog';
5
- import DialogTitle from '@material-ui/core/DialogTitle';
6
- import DialogContent from '@material-ui/core/DialogContent';
7
- import DialogActions from '@material-ui/core/DialogActions';
8
- import Stepper from '@material-ui/core/Stepper';
9
- import Step from '@material-ui/core/Step';
10
- import StepLabel from '@material-ui/core/StepLabel';
11
- import StepContent from '@material-ui/core/StepContent';
12
- import CreatePropertiesList from '../CreatePropertiesList';
13
- import EntityPropertiesShortView from '../../ViewProperty/EntityPropertiesShortView';
14
-
15
- import { useCallback, useState } from 'react';
16
- import { useFormContext, useWatch } from 'react-hook-form';
17
- import { useToggle } from '../../../../utils';
18
-
19
- type Props = {
20
- parentPropertyFieldName: string;
21
- entityDefinition?: boolean;
22
- globalParameter?: boolean;
23
- };
24
-
25
- const defaultPropertyValues = {
26
- key: '',
27
- propertyType: '',
28
- name: '',
29
- defaultValue: '',
30
- isRequired: true,
31
- isMultiple: false,
32
- sortOrder: 0,
33
- isEnabled: true,
34
- };
35
-
36
- const EntityAdditionalFields = ({
37
- parentPropertyFieldName,
38
- entityDefinition = false,
39
- globalParameter = false,
40
- }: Props) => {
41
- const { control, setValue, getValues, trigger } = useFormContext();
42
- const properties = useWatch({
43
- control,
44
- name: `${parentPropertyFieldName}.properties`,
45
- defaultValue: getValues(`${parentPropertyFieldName}.properties`) || [],
46
- });
47
-
48
- const parentPropertyName = useWatch({ control, name: `${parentPropertyFieldName}.name` });
49
-
50
- const { open: parametersModalOpen, onClose: onParametersModalClose, onOpen: onParametersModalOpen } = useToggle();
51
-
52
- const [focusedProperty, setFocusedProperty] = useState(0);
53
-
54
- const handleAddParameter = useCallback(() => {
55
- if (properties) {
56
- setValue(`${parentPropertyFieldName}.properties.${properties.length}`, defaultPropertyValues);
57
- } else {
58
- setValue(`${parentPropertyFieldName}.properties`, [defaultPropertyValues]);
59
- }
60
- }, [properties, parentPropertyFieldName, setValue]);
61
-
62
- const handleStepperClick = (index) => setFocusedProperty(index);
63
-
64
- const handleSubmitClick = async () => {
65
- const isValid = await trigger(`${parentPropertyFieldName}.properties`);
66
- if (isValid) {
67
- onParametersModalClose();
68
- }
69
- };
70
-
71
- return (
72
- <>
73
- <Grid item>
74
- <Typography variant="h6">Properties</Typography>
75
- </Grid>
76
- <Grid item>
77
- <EntityPropertiesShortView properties={properties} showName showType />
78
- </Grid>
79
- <Grid item>
80
- <Button variant="contained" color="primary" onClick={onParametersModalOpen}>
81
- Edit properties
82
- </Button>
83
- </Grid>
84
-
85
- <Dialog disableEscapeKeyDown open={parametersModalOpen} onClose={handleSubmitClick} fullWidth maxWidth="md">
86
- <DialogTitle>{parentPropertyName || 'Entity'} Properties</DialogTitle>
87
- <DialogContent style={{ height: '500px', overflow: 'hidden' }}>
88
- <Grid container direction="row" spacing={2} style={{ height: '100%' }}>
89
- <Grid item xs={3} style={{ backgroundColor: '#f9f9f9' }}>
90
- <Stepper nonLinear activeStep={focusedProperty} orientation="vertical" style={{ paddingLeft: '4px' }}>
91
- {properties.map((property, index) => (
92
- <Step key={index} onClick={() => handleStepperClick(index)} style={{ cursor: 'pointer' }}>
93
- <StepLabel StepIconProps={{ icon: '' }} style={{ wordBreak: 'break-word' }}>
94
- {property.name || '(no name)'}
95
- </StepLabel>
96
- <StepContent></StepContent>
97
- </Step>
98
- ))}
99
- </Stepper>
100
- <Button variant="contained" size="small" color="primary" onClick={handleAddParameter}>
101
- Add property
102
- </Button>
103
- </Grid>
104
- <Grid
105
- item
106
- container
107
- wrap="nowrap"
108
- direction="column"
109
- xs={9}
110
- spacing={2}
111
- style={{ height: '100%', overflowY: 'auto' }}
112
- >
113
- <CreatePropertiesList
114
- hideAddButton
115
- parentFieldName={parentPropertyFieldName}
116
- focusOnIndex={focusedProperty}
117
- entityDefinition={entityDefinition}
118
- globalParameter={globalParameter}
119
- />
120
- </Grid>
121
- </Grid>
122
- </DialogContent>
123
- <DialogActions>
124
- <Button variant="contained" color="primary" onClick={handleSubmitClick}>
125
- Ok
126
- </Button>
127
- </DialogActions>
128
- </Dialog>
129
- </>
130
- );
131
- };
132
-
133
- export default EntityAdditionalFields;
@@ -1,46 +0,0 @@
1
- import Grid from '@material-ui/core/Grid';
2
- import { ControlInput } from '../../../Forms';
3
-
4
- import { useFormContext } from 'react-hook-form';
5
-
6
- type Props = {
7
- propertyFieldName: string;
8
- };
9
-
10
- const EntityReferencePropertyFields = ({ propertyFieldName }: Props) => {
11
- const { control } = useFormContext();
12
-
13
- return (
14
- <>
15
- <Grid item>
16
- <ControlInput required control={control} name={`${propertyFieldName}.definitionCode`} label="Definition Code" />
17
- </Grid>
18
- <Grid item>
19
- <ControlInput
20
- required
21
- control={control}
22
- name={`${propertyFieldName}.definitionVersion`}
23
- label="Definition Version"
24
- />
25
- </Grid>
26
- <Grid item>
27
- <ControlInput
28
- required
29
- control={control}
30
- name={`${propertyFieldName}.labelPropertyCode`}
31
- label="Label Property Code"
32
- />
33
- </Grid>
34
- <Grid item>
35
- <ControlInput
36
- required
37
- control={control}
38
- name={`${propertyFieldName}.valuePropertyCode`}
39
- label="Value Property Code"
40
- />
41
- </Grid>
42
- </>
43
- );
44
- };
45
-
46
- export default EntityReferencePropertyFields;
@@ -1,52 +0,0 @@
1
- import {
2
- PropertyType,
3
- DATE_DEFAULT_FORMAT,
4
- DATE_TIME_DEFAULT_FORMAT,
5
- TIME_DEFAULT_FORMAT,
6
- } from '../../../../interfaces';
7
- import BigDecimalPropertyFields from './BigDecimalPropertyFields';
8
- import DateAdditionalFields from './DateAdditionalFields';
9
- import EntityAdditionalFields from './EntityAdditionalFields';
10
- import EntityReferencePropertyFields from './EntityReferencePropertyFields';
11
- import StringPropertyFields from './StringPropertyFields';
12
-
13
- type Props = {
14
- propertyType: PropertyType;
15
- propertyFieldName: string;
16
- entityDefinition?: boolean;
17
- globalParameter?: boolean;
18
- };
19
-
20
- export const PropertyAdditionalFields = ({
21
- propertyType,
22
- propertyFieldName,
23
- entityDefinition = false,
24
- globalParameter = false,
25
- }: Props) => {
26
- switch (propertyType) {
27
- case PropertyType.STRING:
28
- return <StringPropertyFields propertyFieldName={propertyFieldName} />;
29
- case PropertyType.BIG_DECIMAL:
30
- return <BigDecimalPropertyFields propertyFieldName={propertyFieldName} />;
31
- case PropertyType.DATE:
32
- return <DateAdditionalFields propertyFieldName={propertyFieldName} defaultValue={DATE_DEFAULT_FORMAT} />;
33
- case PropertyType.TIME:
34
- return <DateAdditionalFields propertyFieldName={propertyFieldName} defaultValue={TIME_DEFAULT_FORMAT} />;
35
- case PropertyType.DATE_TIME:
36
- return <DateAdditionalFields propertyFieldName={propertyFieldName} defaultValue={DATE_TIME_DEFAULT_FORMAT} />;
37
- case PropertyType.ENTITY_REFERENCE:
38
- return <EntityReferencePropertyFields propertyFieldName={propertyFieldName} />;
39
- case PropertyType.ENTITY:
40
- return (
41
- <EntityAdditionalFields
42
- parentPropertyFieldName={propertyFieldName}
43
- globalParameter={globalParameter}
44
- entityDefinition={entityDefinition}
45
- />
46
- );
47
- default:
48
- return null;
49
- }
50
- };
51
-
52
- export default PropertyAdditionalFields;
@@ -1,98 +0,0 @@
1
- import Grid from '@material-ui/core/Grid';
2
- import Chip from '@material-ui/core/Chip';
3
- import Box from '@material-ui/core/Box';
4
- import Typography from '@material-ui/core/Typography';
5
- import TextField from '@material-ui/core/TextField';
6
- import IconButton from '@material-ui/core/IconButton';
7
- import AddIcon from '@material-ui/icons/Add';
8
-
9
- import { useFormContext, useWatch } from 'react-hook-form';
10
- import { removeArrayItem } from '../../../../utils';
11
- import { useCallback, useMemo, useState } from 'react';
12
-
13
- type Props = {
14
- propertyFieldName: string;
15
- };
16
-
17
- const StringPropertyFields = ({ propertyFieldName }: Props) => {
18
- const fieldName = useMemo(() => `${propertyFieldName}.restrictedValues`, [propertyFieldName]);
19
-
20
- const { control, setValue, getValues } = useFormContext();
21
- const restrictedValues = useWatch({
22
- control,
23
- name: fieldName,
24
- defaultValue: getValues(`${propertyFieldName}.restrictedValues`) || [],
25
- });
26
-
27
- const [inputValue, setInputValue] = useState('');
28
- const [error, setError] = useState('');
29
-
30
- const handleDelete = useCallback(
31
- (index) => {
32
- setValue(fieldName, removeArrayItem(restrictedValues, index));
33
- },
34
- [restrictedValues, fieldName, setValue]
35
- );
36
-
37
- const handleAddValue = () => {
38
- if (inputValue) {
39
- setValue(fieldName, [...restrictedValues, inputValue]);
40
- setInputValue('');
41
- }
42
- };
43
-
44
- const handleInputChange = (e) => {
45
- const { value } = e.target;
46
- setInputValue(value);
47
-
48
- if (restrictedValues.includes(value)) {
49
- setError('This value already exists');
50
- } else {
51
- setError('');
52
- }
53
- };
54
-
55
- const handleKeyDown = (e) => {
56
- if (e.key === 'Enter') {
57
- handleAddValue();
58
- }
59
- };
60
-
61
- return (
62
- <>
63
- <Grid item>
64
- <Typography variant="h6">Restricted Values</Typography>
65
- </Grid>
66
- <Grid item>
67
- <Box display="flex" gridGap={8} flexWrap="wrap">
68
- {restrictedValues?.map((value, index) => (
69
- <Chip key={index} variant="outlined" label={value} onDelete={() => handleDelete(index)} />
70
- ))}
71
- </Box>
72
- </Grid>
73
- <Grid item>
74
- <TextField
75
- fullWidth
76
- variant="outlined"
77
- size="small"
78
- label="Add restricted value"
79
- value={inputValue}
80
- onChange={handleInputChange}
81
- error={!!error}
82
- helperText={error}
83
- name="restrictedValues"
84
- inputProps={{ onKeyDown: handleKeyDown }}
85
- InputProps={{
86
- endAdornment: (
87
- <IconButton size="small" onClick={handleAddValue} disabled={!!error}>
88
- <AddIcon />
89
- </IconButton>
90
- ),
91
- }}
92
- />
93
- </Grid>
94
- </>
95
- );
96
- };
97
-
98
- export default StringPropertyFields;
@@ -1,22 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { CustomPropertyFieldProps } from '../../../interfaces';
3
-
4
- const useCustomFields = (customPropertyFields: CustomPropertyFieldProps[]) => {
5
- const customCheckboxes = useMemo(() => {
6
- if (customPropertyFields.length) {
7
- return customPropertyFields.filter((field) => field.type === 'checkbox');
8
- }
9
- return [];
10
- }, [customPropertyFields]);
11
-
12
- const customFields = useMemo(() => {
13
- if (customPropertyFields.length) {
14
- return customPropertyFields.filter((field) => field.type !== 'checkbox');
15
- }
16
- return [];
17
- }, [customPropertyFields]);
18
-
19
- return { customCheckboxes, customFields };
20
- };
21
-
22
- export default useCustomFields;
@@ -1,50 +0,0 @@
1
- import Box from '@material-ui/core/Box';
2
- import Typography from '@material-ui/core/Typography';
3
- import { ViewProperty } from '../ViewProperty';
4
-
5
- import { useMemo } from 'react';
6
- import { propertiesObjectToArray } from '../../../utils';
7
- import {
8
- EntityDefinitionPropertyArrayType,
9
- EntityDefinitionPropertyObjectType,
10
- GPBPropertiesArrayType,
11
- GPBPropertiesObjectType,
12
- PropertiesArrayType,
13
- PropertiesObjectType,
14
- } from '../../../interfaces';
15
-
16
- type Props = {
17
- properties:
18
- | PropertiesObjectType
19
- | PropertiesArrayType
20
- | GPBPropertiesArrayType
21
- | GPBPropertiesObjectType
22
- | EntityDefinitionPropertyArrayType
23
- | EntityDefinitionPropertyObjectType;
24
- expandAll?: boolean;
25
- };
26
-
27
- export const ViewPropertiesList = ({ properties, expandAll = true }: Props) => {
28
- const propertiesList = useMemo(() => {
29
- if (Array.isArray(properties)) {
30
- return properties;
31
- } else if (properties) {
32
- return propertiesObjectToArray(properties);
33
- }
34
- return [];
35
- }, [properties]);
36
-
37
- return (
38
- <Box display="flex" flexDirection="column" gridGap={8}>
39
- {propertiesList.length ? (
40
- propertiesList.map((property) => (
41
- <ViewProperty key={property.key} property={property} defaultExpanded={expandAll} />
42
- ))
43
- ) : (
44
- <Typography>No properties</Typography>
45
- )}
46
- </Box>
47
- );
48
- };
49
-
50
- export default ViewPropertiesList;
@@ -1,41 +0,0 @@
1
- import TreeView from '@material-ui/lab/TreeView';
2
- import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
3
- import ChevronRightIcon from '@material-ui/icons/ChevronRight';
4
- import PropertyItem from './PropertyItem';
5
-
6
- import { PropertiesArrayType, PropertyType } from '../../../interfaces';
7
- import { useMemo } from 'react';
8
-
9
- type Props = {
10
- properties: PropertiesArrayType;
11
- showName?: boolean;
12
- showType?: boolean;
13
- };
14
-
15
- const EntityPropertiesShortView = ({ properties = [], showName = false, showType = false }: Props) => {
16
- const defaultExpanded = useMemo(() => {
17
- const findExpandKeys = (props: PropertiesArrayType) => {
18
- return props.reduce((acc, property) => {
19
- if (property.propertyType === PropertyType.ENTITY) {
20
- return [...acc, property.key, ...findExpandKeys(property.properties as PropertiesArrayType)];
21
- }
22
- return acc;
23
- }, []);
24
- };
25
- return findExpandKeys(properties);
26
- }, [properties]);
27
-
28
- return (
29
- <TreeView
30
- defaultCollapseIcon={<ExpandMoreIcon />}
31
- defaultExpandIcon={<ChevronRightIcon />}
32
- defaultExpanded={defaultExpanded}
33
- >
34
- {properties.map((property) => (
35
- <PropertyItem key={property.key} property={property} showName={showName} showType={showType} />
36
- ))}
37
- </TreeView>
38
- );
39
- };
40
-
41
- export default EntityPropertiesShortView;
@@ -1,48 +0,0 @@
1
- import Box from '@material-ui/core/Box';
2
- import Stepper from '@material-ui/core/Stepper';
3
- import Step from '@material-ui/core/Step';
4
- import StepLabel from '@material-ui/core/StepLabel';
5
- import StepContent from '@material-ui/core/StepContent';
6
- import Typography from '@material-ui/core/Typography';
7
- import ViewProperty from './ViewProperty';
8
-
9
- import { memo, useMemo } from 'react';
10
- import { PropertiesArrayType, PropertyType } from '../../../interfaces';
11
-
12
- type Props = {
13
- properties: PropertiesArrayType;
14
- parentNames?: string[];
15
- };
16
-
17
- const EntityPropertiesView = ({ properties, parentNames = [] }: Props) => {
18
- const hasProperties = useMemo(() => {
19
- let hasProps = false;
20
- properties.every((property) => {
21
- if (property.propertyType === PropertyType.ENTITY) {
22
- hasProps = true;
23
- return false;
24
- }
25
- return true;
26
- });
27
- return hasProps;
28
- }, [properties]);
29
-
30
- return (
31
- <Box mt={4}>
32
- <Typography variant="h6">Properties</Typography>
33
- <Stepper orientation="vertical" style={{ paddingLeft: '4px' }}>
34
- {properties.map((property) => (
35
- <Step expanded key={property.key}>
36
- <StepLabel StepIconProps={{ icon: '', completed: false, active: true }} />
37
- <StepContent>
38
- <ViewProperty property={property} parentNames={[...parentNames]} defaultExpanded={false} />
39
- </StepContent>
40
- </Step>
41
- ))}
42
- {hasProperties && <Step />}
43
- </Stepper>
44
- </Box>
45
- );
46
- };
47
-
48
- export default memo(EntityPropertiesView);
@@ -1,139 +0,0 @@
1
- import Box from '@material-ui/core/Box';
2
- import Table from '@material-ui/core/Table';
3
- import TableBody from '@material-ui/core/TableBody';
4
- import TableRow from '@material-ui/core/TableRow';
5
- import TableCell from '@material-ui/core/TableCell';
6
- import Typography from '@material-ui/core/Typography';
7
- import Chip from '@material-ui/core/Chip';
8
- import CheckCircleIcon from '@material-ui/icons/CheckCircle';
9
-
10
- import { useMemo } from 'react';
11
- import { PropertyType, PropertyUnion } from '../../../interfaces';
12
- import { JsonView } from '../../JsonView';
13
-
14
- type Props = {
15
- property: PropertyUnion;
16
- };
17
-
18
- type ValueDisplayProps = {
19
- value: unknown;
20
- type: PropertyType;
21
- };
22
-
23
- const labels = {
24
- name: 'Name',
25
- key: 'Key',
26
- propertyType: 'Property Type',
27
- defaultValue: 'Default Value',
28
- defaultValues: 'Default Values',
29
- sortOrder: 'Sort Order',
30
- isRequired: 'Required',
31
- isMultiple: 'Multiple',
32
- isEnabled: 'Enabled',
33
- isViewableInList: 'Is Viewable In List',
34
- precisionScale: 'Precision Scale',
35
- roundingMode: 'Rounding Mode',
36
- format: 'Format',
37
- definitionCode: 'Definition Code',
38
- definitionVersion: 'Definition Version',
39
- labelPropertyCode: 'Label Property Code',
40
- valuePropertyCode: 'Value Property Code',
41
- restrictedValues: 'Restricted Values',
42
- value: 'Value',
43
- values: 'Values',
44
- uiSettings: 'UI Settings',
45
- };
46
-
47
- const ValueDisplay = ({ value, type }: ValueDisplayProps) => {
48
- if ((type === PropertyType.JSON || type === PropertyType.ENTITY) && value) {
49
- return <JsonView value={value} />;
50
- } else {
51
- return (
52
- <Typography variant="subtitle1" display="inline" style={{ wordBreak: 'break-word' }}>
53
- {value === null ? 'null' : value.toString()}
54
- </Typography>
55
- );
56
- }
57
- };
58
-
59
- const formatDiplayValue = (value: unknown, key: string, type: PropertyType) => {
60
- switch (key) {
61
- case 'isRequired':
62
- case 'isMultiple':
63
- case 'isEnabled':
64
- case 'isViewableInList':
65
- return value ? <CheckCircleIcon color="primary" fontSize="small" /> : null;
66
- case 'restrictedValues':
67
- return value ? (
68
- <Box display="flex" flexWrap="wrap" gridGap={4}>
69
- {(value as string[]).map((restrictedValue) => (
70
- <Chip
71
- key={restrictedValue}
72
- label={restrictedValue}
73
- style={{ wordBreak: 'break-word', maxWidth: '500px' }}
74
- />
75
- ))}
76
- </Box>
77
- ) : null;
78
- case 'defaultValue':
79
- case 'value':
80
- return <ValueDisplay value={value} type={type} />;
81
- case 'values':
82
- case 'defaultValues':
83
- if (type === PropertyType.ENTITY || type === PropertyType.JSON) {
84
- return <JsonView value={value} />;
85
- } else {
86
- return (
87
- <div>
88
- {(value as unknown[]).map((v, index) => (
89
- <div key={index}>
90
- <ValueDisplay value={v} type={type} />
91
- </div>
92
- ))}
93
- </div>
94
- );
95
- }
96
- case 'uiSettings':
97
- return value ? <JsonView value={value} /> : null;
98
- default:
99
- return (
100
- <Typography variant="subtitle1" display="inline" style={{ wordBreak: 'break-word' }}>
101
- {value}
102
- </Typography>
103
- );
104
- }
105
- };
106
-
107
- const PropertyDataTable = ({ property }: Props) => {
108
- const propertyData = useMemo(() => {
109
- if (property) {
110
- if (property.isMultiple) {
111
- delete property.defaultValue;
112
- delete property['value'];
113
- } else {
114
- delete property.defaultValues;
115
- delete property['values'];
116
- }
117
- }
118
- return property;
119
- }, [property]);
120
-
121
- return (
122
- <Table size="small">
123
- <TableBody>
124
- {Object.keys(labels).map((key) =>
125
- key in propertyData ? (
126
- <TableRow key={key}>
127
- <TableCell width="30%">
128
- <Typography>{labels[key]}</Typography>
129
- </TableCell>
130
- <TableCell>{formatDiplayValue(propertyData[key], key, propertyData.propertyType)}</TableCell>
131
- </TableRow>
132
- ) : null
133
- )}
134
- </TableBody>
135
- </Table>
136
- );
137
- };
138
-
139
- export default PropertyDataTable;
@@ -1,46 +0,0 @@
1
- import TreeItem from '@material-ui/lab/TreeItem';
2
-
3
- import { useMemo } from 'react';
4
- import { PropertiesArrayType, PropertyType, PropertyUnion } from '../../../interfaces';
5
-
6
- type PropertyItemProps = {
7
- property: PropertyUnion;
8
- showName: boolean;
9
- showType: boolean;
10
- };
11
-
12
- const PropertyItem = ({ property, showName, showType }: PropertyItemProps) => {
13
- const label = useMemo(() => {
14
- let labelText = '';
15
-
16
- if (property) {
17
- labelText += `<b>${property.key}</b>`;
18
- }
19
-
20
- if (showName) {
21
- labelText += ` - ${property.name}`;
22
- }
23
-
24
- if (showType) {
25
- const type =
26
- typeof property.propertyType === 'string'
27
- ? property.propertyType
28
- : (property.propertyType as { value: string }).value;
29
- labelText += ` - ${type}${property.isMultiple ? '[]' : ''}`;
30
- }
31
-
32
- return labelText;
33
- }, [property.key, property.name, property.propertyType, property.isMultiple, showName, showType]);
34
-
35
- return (
36
- <TreeItem nodeId={property.key} label={<div dangerouslySetInnerHTML={{ __html: label }} />}>
37
- {property.propertyType === PropertyType.ENTITY
38
- ? (property.properties as PropertiesArrayType).map((prop) => (
39
- <PropertyItem key={prop.key} property={prop} showName={showName} showType={showType} />
40
- ))
41
- : null}
42
- </TreeItem>
43
- );
44
- };
45
-
46
- export default PropertyItem;