@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,108 +0,0 @@
1
- import React from 'react';
2
- import Button from '@material-ui/core/Button';
3
- import Dialog, { DialogProps } from '@material-ui/core/Dialog';
4
- import DialogActions from '@material-ui/core/DialogActions';
5
- import DialogContent from '@material-ui/core/DialogContent';
6
- import DialogContentText from '@material-ui/core/DialogContentText';
7
- import DialogTitle from '@material-ui/core/DialogTitle';
8
- import Box from '@material-ui/core/Box';
9
- import { Loader } from '../Loader';
10
-
11
- /**
12
- * This interface is referencing the [[AlertDialog]] component props.
13
- * @category Common UI components
14
- */
15
- export interface AlertDialogProps {
16
- /**
17
- * Is dialog open flag
18
- */
19
- open: boolean;
20
- /**
21
- * Dialog title
22
- */
23
- title: string;
24
- /**
25
- * Dialog description
26
- */
27
- description?: string;
28
- /**
29
- * Close button text
30
- */
31
- closeButtonTitle?: string;
32
- /**
33
- * Confirm button text
34
- */
35
- confirmButtonTitle?: string;
36
- /**
37
- * onClose event handle function
38
- */
39
- onClose: () => void;
40
- /**
41
- * onConfirm event handle function
42
- */
43
-
44
- onConfirm?: (values?: any) => void;
45
- /**
46
- * children components
47
- */
48
- children?: React.ReactNode;
49
- /**
50
- * Material UI Dialog component props
51
- */
52
- dialogProps?: Partial<DialogProps>;
53
- loading?: boolean;
54
- confirmButtonDisabled?: boolean;
55
- maxWidth?: false | "xs" | "sm" | "md" | "lg" | "xl";
56
- };
57
-
58
- /**
59
- * Alert dialog component. Used for popup information
60
- * @category Common UI components
61
- */
62
- export const AlertDialog = ({
63
- open,
64
- title,
65
- description,
66
- closeButtonTitle="Close",
67
- onClose,
68
- confirmButtonTitle = "Confirm",
69
- confirmButtonDisabled = false,
70
- onConfirm,
71
- children,
72
- dialogProps,
73
- loading,
74
- maxWidth="xs"
75
- }: AlertDialogProps) => {
76
- return (
77
- <div>
78
- <Dialog
79
- open={open}
80
- onClose={onClose}
81
- aria-labelledby="alert-dialog-title"
82
- aria-describedby="alert-dialog-description"
83
- fullWidth
84
- maxWidth={maxWidth}
85
- {...dialogProps}
86
- >
87
- {loading && <Loader />}
88
- <DialogTitle id="alert-dialog-title">{title}</DialogTitle>
89
- <DialogContent>
90
- { description && <DialogContentText id="alert-dialog-description">{description}</DialogContentText>}
91
- <Box maxWidth="100%" overflow="hidden">{children}</Box>
92
- </DialogContent>
93
- <DialogActions>
94
- <Button onClick={onClose} color="primary" variant="contained">
95
- {closeButtonTitle}
96
- </Button>
97
- {confirmButtonTitle && onConfirm ? (
98
- <Button onClick={onConfirm} color="secondary" variant="contained" autoFocus disabled={confirmButtonDisabled}>
99
- {confirmButtonTitle}
100
- </Button>
101
- ) : null}
102
- </DialogActions>
103
- </Dialog>
104
- </div>
105
- );
106
- };
107
-
108
- export default AlertDialog;
@@ -1 +0,0 @@
1
- export * from './Alert';
@@ -1,74 +0,0 @@
1
- import Box from '@material-ui/core/Box';
2
- import Grid from '@material-ui/core/Grid';
3
- import Typography from '@material-ui/core/Typography';
4
- import { ControlInput, ControlNumberInput } from '../../Forms';
5
- import CreatePropertiesList from '../../Property/UpsertProperty/CreatePropertiesList';
6
-
7
- import { useFormContext } from 'react-hook-form';
8
-
9
- type Props = {
10
- definitionFieldName?: string;
11
- title?: string;
12
- hideCodeField?: boolean;
13
- hideVersionField?: boolean;
14
- hideNameField?: boolean;
15
- required?: boolean;
16
- };
17
-
18
- export const CreateDefinition = ({
19
- definitionFieldName,
20
- title,
21
- hideCodeField,
22
- hideVersionField,
23
- hideNameField,
24
- required = false,
25
- }: Props) => {
26
- const { control } = useFormContext();
27
-
28
- return (
29
- <Grid container direction="column" spacing={2}>
30
- {title && (
31
- <Grid item sm={12} md={8} lg={6}>
32
- <Box my={2}>
33
- <Typography variant="h4">{title}</Typography>
34
- </Box>
35
- </Grid>
36
- )}
37
- {!hideNameField && (
38
- <Grid item sm={12} md={8} lg={6}>
39
- <ControlInput
40
- required
41
- control={control}
42
- name={definitionFieldName ? `${definitionFieldName}.name` : `name`}
43
- label="Name"
44
- />
45
- </Grid>
46
- )}
47
- {!hideCodeField && (
48
- <Grid item sm={12} md={8} lg={6}>
49
- <ControlInput
50
- required
51
- control={control}
52
- name={definitionFieldName ? `${definitionFieldName}.code` : `code`}
53
- label="Code"
54
- />
55
- </Grid>
56
- )}
57
- {!hideVersionField && (
58
- <Grid item sm={12} md={8} lg={6}>
59
- <ControlNumberInput
60
- required
61
- control={control}
62
- decimal={false}
63
- name={definitionFieldName ? `${definitionFieldName}.version` : `version`}
64
- label="Version"
65
- />
66
- </Grid>
67
- )}
68
-
69
- <CreatePropertiesList required={required} parentFieldName={definitionFieldName} />
70
- </Grid>
71
- );
72
- };
73
-
74
- export default CreateDefinition;
@@ -1,85 +0,0 @@
1
- import Box from '@material-ui/core/Box';
2
- import Grid from '@material-ui/core/Grid';
3
- import Stepper from '@material-ui/core/Stepper';
4
- import Step from '@material-ui/core/Step';
5
- import StepLabel from '@material-ui/core/StepLabel';
6
- import StepContent from '@material-ui/core/StepContent';
7
- import StepConnector from '@material-ui/core/StepConnector';
8
-
9
- import PropertyValue from '../../Property/PropertyValueField/PropertyValue';
10
- import { PropertiesArrayType } from '../../../interfaces';
11
- import { makeStyles } from '@material-ui/core';
12
-
13
- type Props = {
14
- properties: PropertiesArrayType;
15
- dataFieldName: string;
16
- };
17
-
18
- const useStyles = makeStyles(() => ({
19
- content: {
20
- marginLeft: '4px',
21
- },
22
- connector: {
23
- marginLeft: '4px',
24
- },
25
- stepper: {
26
- padding: '12px',
27
- },
28
- label: {
29
- display: 'flex',
30
- alignItems: 'flex-start',
31
- },
32
- }));
33
-
34
- const StepIcon = () => (
35
- <div
36
- style={{
37
- display: 'inline-block',
38
- width: '10px',
39
- height: '10px',
40
- borderRadius: '50%',
41
- backgroundColor: '#536DFE',
42
- marginTop: '5px',
43
- }}
44
- />
45
- );
46
-
47
- export const DefinitionFiller = ({ properties, dataFieldName }: Props) => {
48
- const classes = useStyles();
49
-
50
- return (
51
- <Grid container item direction="column" spacing={2}>
52
- {properties?.length ? (
53
- <Stepper
54
- nonLinear
55
- orientation="vertical"
56
- className={classes.stepper}
57
- connector={<StepConnector className={classes.connector} />}
58
- >
59
- {properties.map((property, index) => (
60
- <Step expanded key={index}>
61
- <StepLabel
62
- className={classes.label}
63
- StepIconComponent={StepIcon}
64
- StepIconProps={{ icon: '', completed: false, active: true }}
65
- >
66
- <Box display="flex" flexDirection="column">
67
- <b>{property.name}</b>
68
- <span>
69
- {property.propertyType} | Key: {property.key}
70
- </span>
71
- </Box>
72
- </StepLabel>
73
- <StepContent className={classes.content}>
74
- <PropertyValue name={`${dataFieldName}.${property.key}`} property={property} label={property.name} />
75
- </StepContent>
76
- </Step>
77
- ))}
78
- <Step />
79
- </Stepper>
80
- ) : null}
81
- </Grid>
82
- );
83
- };
84
-
85
- export default DefinitionFiller;
@@ -1,96 +0,0 @@
1
- import Box from '@material-ui/core/Box';
2
- import Grid from '@material-ui/core/Grid';
3
- import Stepper from '@material-ui/core/Stepper';
4
- import Step from '@material-ui/core/Step';
5
- import StepLabel from '@material-ui/core/StepLabel';
6
- import StepContent from '@material-ui/core/StepContent';
7
- import StepConnector from '@material-ui/core/StepConnector';
8
-
9
- import { useMemo } from 'react';
10
- import { makeStyles } from '@material-ui/core';
11
- import { PropertiesArrayType, PropertiesObjectType } from '../../../interfaces';
12
- import { PropertyWidget } from '../../Property/PropertyWidget';
13
- import { propertiesObjectToArray } from '../../../utils';
14
-
15
- type Props = {
16
- properties: PropertiesArrayType | PropertiesObjectType;
17
- dataFieldName: string;
18
- nullable?: boolean;
19
- };
20
-
21
- const useStyles = makeStyles(() => ({
22
- content: {
23
- marginLeft: '4px',
24
- paddingLeft: '14px',
25
- },
26
- connector: {
27
- marginLeft: '4px',
28
- },
29
- stepper: {
30
- padding: '12px',
31
- },
32
- label: {
33
- display: 'flex',
34
- alignItems: 'flex-start',
35
- },
36
- }));
37
-
38
- const StepIcon = () => (
39
- <div
40
- style={{
41
- display: 'inline-block',
42
- width: '10px',
43
- height: '10px',
44
- borderRadius: '50%',
45
- backgroundColor: '#536DFE',
46
- marginTop: '5px',
47
- }}
48
- />
49
- );
50
-
51
- export const WidgetDefinitionFiller = ({ properties, dataFieldName, nullable = false }: Props) => {
52
- const classes = useStyles();
53
-
54
- const propertiesList = useMemo(() => {
55
- if (Array.isArray(properties)) {
56
- return propertiesObjectToArray(properties);
57
- }
58
- return properties;
59
- }, [properties]);
60
-
61
- return (
62
- <Grid container item direction="column" spacing={2}>
63
- {propertiesList?.length ? (
64
- <Stepper
65
- nonLinear
66
- orientation="vertical"
67
- className={classes.stepper}
68
- connector={<StepConnector className={classes.connector} />}
69
- >
70
- {(propertiesList as PropertiesArrayType).map((property, index) => (
71
- <Step expanded key={index}>
72
- <StepLabel
73
- className={classes.label}
74
- StepIconComponent={StepIcon}
75
- StepIconProps={{ icon: '', completed: false, active: true }}
76
- >
77
- <Box display="flex" flexDirection="column">
78
- <b>{property.name}</b>
79
- <span>
80
- {property.propertyType} | Key: {property.key}
81
- </span>
82
- </Box>
83
- </StepLabel>
84
- <StepContent className={classes.content}>
85
- <PropertyWidget property={property} nullable={nullable} name={`${dataFieldName}.${property.key}`} />
86
- </StepContent>
87
- </Step>
88
- ))}
89
- <Step />
90
- </Stepper>
91
- ) : null}
92
- </Grid>
93
- );
94
- };
95
-
96
- export default WidgetDefinitionFiller;
@@ -1,93 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { Control } from 'react-hook-form';
3
- import { PropertyUnion } from '../../interfaces';
4
- import { MultipleDemField } from './MultipleDemField';
5
- import { SingleDemField } from './SingleDemField';
6
-
7
- /**
8
- * This interface is referencing the [[DemPropertyField]] component props.
9
- * @category DEM Property Field
10
- */
11
- export interface DemPropertyFieldProps {
12
- /**
13
- * Material-UI TextField `variant` prop
14
- */
15
- variant?: 'standard' | 'outlined' | 'filled';
16
- /**
17
- * Parent field name for nest field
18
- */
19
- parentKey?: string;
20
- /**
21
- * propKey for React Hook Form control name propery
22
- */
23
- propKey: string;
24
- /**
25
- * React Hook Form `control`
26
- */
27
- control: Control<any>;
28
- /**
29
- * React Hook Form `errors` object
30
- */
31
- errors: Record<string, any>;
32
- /**
33
- * Is readOnly field flag
34
- */
35
- readOnly?: boolean;
36
- /**
37
- * Is nullable value flag
38
- */
39
- isNullable?: boolean;
40
- /**
41
- * DEM property
42
- */
43
- property: PropertyUnion;
44
- /**
45
- * @ignore Validation function for JSON type field
46
- */
47
- jsonValidator?: (attrs: { name: string; errors: any[] }) => void;
48
- hasBooleanProperties?: boolean;
49
- /**
50
- * React Hook Form `watch` function
51
- */
52
- watch?: any;
53
- hideCopy?: boolean;
54
- }
55
- /**
56
- * Main DEM property field component
57
- * @category DEM Property Field
58
- */
59
- export const DemPropertyField = ({ propKey, property, parentKey }: DemPropertyFieldProps) => {
60
- const name = useMemo(() => (parentKey ? `${parentKey}.${propKey}` : propKey), [propKey, parentKey]);
61
- const label = useMemo(() => `${property?.name || propKey} ${property?.isRequired ? '*' : ''}`, [propKey, property]);
62
-
63
- // const propsKeys = useMemo(() => {
64
- // if (property?.properties) {
65
- // const { properties } = property;
66
- // return Object.keys(properties).sort((keyA, keyB) => properties[keyA].sortOrder - properties[keyB].sortOrder);
67
- // }
68
- // return [];
69
- // }, [property]);
70
-
71
- if (property.isMultiple) {
72
- return <MultipleDemField property={property} name={name} label={label} />;
73
- } else {
74
- return <SingleDemField property={property} name={name} label={label} />;
75
- }
76
-
77
- // case EntityPropertyTypes.ENTITY: {
78
- // return (
79
- // <Box marginLeft={parentKey ? 2 : 0} paddingY={parentKey ? 4 : 0}>
80
- // <Typography variant="subtitle1">{property.name}</Typography>
81
- // {propsKeys.map((key) => (
82
- // <DemPropertyField
83
- // propKey={key}
84
- // control={control}
85
- // property={property.properties[key]}
86
- // errors={errors}
87
- // parentKey={name}
88
- // />
89
- // ))}
90
- // </Box>
91
- // );
92
- // }
93
- };
@@ -1,44 +0,0 @@
1
- import Grid from '@material-ui/core/Grid';
2
- import { InfoItem } from '../../InfoItem';
3
-
4
- import { PropertyUnion } from '../../../interfaces';
5
- import { useMemo } from 'react';
6
-
7
- type Props = {
8
- property: PropertyUnion;
9
- value: any;
10
- };
11
-
12
- export const DemPropertyView = ({ property, value }: Props) => {
13
- const infoProps = useMemo(() => {
14
- const res: { title: string; text?: string; json?: any } = {
15
- title: '',
16
- };
17
-
18
- if (property && value) {
19
- res.title = property.name;
20
-
21
- switch (property.propertyType) {
22
- case 'JSON':
23
- res.json = JSON.stringify(value, null, 2);
24
- break;
25
- case 'BOOLEAN':
26
- res.json = value.toString();
27
- break;
28
- default:
29
- res.text = value;
30
- break;
31
- }
32
- }
33
-
34
- return res;
35
- }, [property, value]);
36
-
37
- return (
38
- <Grid item xs={12}>
39
- <InfoItem {...infoProps} />
40
- </Grid>
41
- );
42
- };
43
-
44
- export default DemPropertyView;