@dartech/arsenal-ui 0.0.1

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 (124) hide show
  1. package/.babelrc +12 -0
  2. package/.eslintrc.json +22 -0
  3. package/README.md +7 -0
  4. package/index.ts +3 -0
  5. package/jest.config.js +9 -0
  6. package/package.json +21 -0
  7. package/project.json +69 -0
  8. package/rollup.config.js +135 -0
  9. package/src/interfaces/common.ts +12 -0
  10. package/src/interfaces/definition.ts +143 -0
  11. package/src/interfaces/index.ts +3 -0
  12. package/src/interfaces/ui.ts +35 -0
  13. package/src/lib/Alert/Alert.tsx +108 -0
  14. package/src/lib/Alert/index.ts +1 -0
  15. package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +74 -0
  16. package/src/lib/Definition/CreateDefinition/index.ts +1 -0
  17. package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +85 -0
  18. package/src/lib/Definition/DefinitionFiller/WidgetDefinitionFiller.tsx +96 -0
  19. package/src/lib/Definition/DefinitionFiller/index.ts +2 -0
  20. package/src/lib/Definition/index.ts +2 -0
  21. package/src/lib/DemPropertyField/DemPropertyField.tsx +93 -0
  22. package/src/lib/DemPropertyField/DemPropertyView/DemPropertyView.tsx +44 -0
  23. package/src/lib/DemPropertyField/DemPropertyView/index.ts +1 -0
  24. package/src/lib/DemPropertyField/MultipleDemField/MultipleDemField.tsx +293 -0
  25. package/src/lib/DemPropertyField/MultipleDemField/index.tsx +1 -0
  26. package/src/lib/DemPropertyField/RestrictedValuesEditor.tsx +63 -0
  27. package/src/lib/DemPropertyField/SingleDemField/SingleDemField.tsx +156 -0
  28. package/src/lib/DemPropertyField/SingleDemField/index.ts +1 -0
  29. package/src/lib/DemPropertyField/index.ts +2 -0
  30. package/src/lib/DemPropertyField/styles.ts +50 -0
  31. package/src/lib/DemPropertyField/widgets/DemBooleanWidget.tsx +26 -0
  32. package/src/lib/DemPropertyField/widgets/DemDateTimeWidget.tsx +34 -0
  33. package/src/lib/DemPropertyField/widgets/DemDateWidget.tsx +33 -0
  34. package/src/lib/DemPropertyField/widgets/DemFieldWidget.tsx +67 -0
  35. package/src/lib/DemPropertyField/widgets/DemFloatWidget.tsx +49 -0
  36. package/src/lib/DemPropertyField/widgets/DemIntegerWidget.tsx +63 -0
  37. package/src/lib/DemPropertyField/widgets/DemJsonWidget.tsx +33 -0
  38. package/src/lib/DemPropertyField/widgets/DemStringWidget.tsx +35 -0
  39. package/src/lib/DemPropertyField/widgets/DemTimeWidget.tsx +46 -0
  40. package/src/lib/DemPropertyField/widgets/index.ts +1 -0
  41. package/src/lib/Forms/BackButton.tsx +45 -0
  42. package/src/lib/Forms/ControlAceEditor.tsx +103 -0
  43. package/src/lib/Forms/ControlAutocomplete.tsx +134 -0
  44. package/src/lib/Forms/ControlCheckbox.tsx +57 -0
  45. package/src/lib/Forms/ControlDebouncedInput.tsx +69 -0
  46. package/src/lib/Forms/ControlInput.tsx +102 -0
  47. package/src/lib/Forms/ControlNumberInput.tsx +144 -0
  48. package/src/lib/Forms/ControlRadioBtn.tsx +46 -0
  49. package/src/lib/Forms/ControlSelect.tsx +135 -0
  50. package/src/lib/Forms/CopyButton.tsx +49 -0
  51. package/src/lib/Forms/index.ts +10 -0
  52. package/src/lib/InfoItem/InfoItem.tsx +39 -0
  53. package/src/lib/InfoItem/index.ts +1 -0
  54. package/src/lib/InfoItem/styles.ts +17 -0
  55. package/src/lib/JsonPathPicker/JsonPathPicker.tsx +71 -0
  56. package/src/lib/JsonPathPicker/PropertyStep.tsx +74 -0
  57. package/src/lib/JsonPathPicker/index.ts +1 -0
  58. package/src/lib/JsonView/JsonView.tsx +43 -0
  59. package/src/lib/JsonView/index.ts +1 -0
  60. package/src/lib/Loader/Loader.tsx +41 -0
  61. package/src/lib/Loader/index.ts +1 -0
  62. package/src/lib/Modals/JsonModalView.tsx +52 -0
  63. package/src/lib/Modals/index.ts +1 -0
  64. package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +41 -0
  65. package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +59 -0
  66. package/src/lib/Property/PropertyValueField/DateValueField.tsx +59 -0
  67. package/src/lib/Property/PropertyValueField/EntityValueField.tsx +33 -0
  68. package/src/lib/Property/PropertyValueField/JsonValueField.tsx +64 -0
  69. package/src/lib/Property/PropertyValueField/PropertyValue.tsx +97 -0
  70. package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +86 -0
  71. package/src/lib/Property/PropertyValueField/StringValueField.tsx +21 -0
  72. package/src/lib/Property/PropertyValueField/TimeValueField.tsx +68 -0
  73. package/src/lib/Property/PropertyValueField/ValueComponent.tsx +63 -0
  74. package/src/lib/Property/PropertyValueField/index.ts +1 -0
  75. package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +167 -0
  76. package/src/lib/Property/PropertyWidget/index.ts +1 -0
  77. package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +131 -0
  78. package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +147 -0
  79. package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +40 -0
  80. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +41 -0
  81. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +27 -0
  82. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +133 -0
  83. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +46 -0
  84. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +52 -0
  85. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +98 -0
  86. package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/index.ts +1 -0
  87. package/src/lib/Property/UpsertProperty/index.ts +2 -0
  88. package/src/lib/Property/UpsertProperty/useCustomFields.ts +22 -0
  89. package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +50 -0
  90. package/src/lib/Property/ViewPropertiesList/index.ts +1 -0
  91. package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +41 -0
  92. package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +48 -0
  93. package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +139 -0
  94. package/src/lib/Property/ViewProperty/PropertyItem.tsx +46 -0
  95. package/src/lib/Property/ViewProperty/ViewProperty.tsx +52 -0
  96. package/src/lib/Property/ViewProperty/index.ts +1 -0
  97. package/src/lib/Property/index.ts +4 -0
  98. package/src/lib/Status/Status.tsx +15 -0
  99. package/src/lib/Status/index.ts +1 -0
  100. package/src/lib/Status/styles.ts +14 -0
  101. package/src/lib/Table/Table.tsx +116 -0
  102. package/src/lib/Table/TableColumnMenu.tsx +12 -0
  103. package/src/lib/Table/TablePagination.tsx +42 -0
  104. package/src/lib/Table/index.ts +1 -0
  105. package/src/lib/Table/styles.ts +59 -0
  106. package/src/lib/Table/usePagination.ts +15 -0
  107. package/src/lib/Table/useTableQueryPagination.ts +49 -0
  108. package/src/lib/Table/useTableQuerySorting.ts +52 -0
  109. package/src/lib/Tabs/RouteTabs.tsx +54 -0
  110. package/src/lib/Tabs/TabPanel.tsx +42 -0
  111. package/src/lib/Tabs/index.ts +2 -0
  112. package/src/lib/TemplateContent/ExpressionDecorator.tsx +7 -0
  113. package/src/lib/TemplateContent/TemplateContentEditor.tsx +144 -0
  114. package/src/lib/TemplateContent/index.ts +1 -0
  115. package/src/lib/index.ts +14 -0
  116. package/src/utils/common.ts +68 -0
  117. package/src/utils/dem.ts +78 -0
  118. package/src/utils/hooks.ts +41 -0
  119. package/src/utils/index.ts +5 -0
  120. package/src/utils/ui-utils.tsx +71 -0
  121. package/src/utils/validators.ts +130 -0
  122. package/tsconfig.json +24 -0
  123. package/tsconfig.lib.json +22 -0
  124. package/tsconfig.spec.json +19 -0
package/.babelrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@nrwl/react/babel",
5
+ {
6
+ "runtime": "automatic",
7
+ "useBuiltIns": "usage"
8
+ }
9
+ ]
10
+ ],
11
+ "plugins": []
12
+ }
package/.eslintrc.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "parserOptions": {
8
+ "sourceType": "module",
9
+ "allowImportExportEverywhere": true
10
+ },
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.ts", "*.tsx"],
15
+ "rules": {}
16
+ },
17
+ {
18
+ "files": ["*.js", "*.jsx"],
19
+ "rules": {}
20
+ }
21
+ ]
22
+ }
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # arsenal-ui
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running unit tests
6
+
7
+ Run `nx test arsenal-ui` to execute the unit tests via [Jest](https://jestjs.io).
package/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './src/interfaces';
2
+ export * from './src/lib';
3
+ export * from './src/utils';
package/jest.config.js ADDED
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ displayName: 'arsenal-ui',
3
+ preset: '../../jest.preset.js',
4
+ transform: {
5
+ '^.+\\.[tj]sx?$': 'babel-jest',
6
+ },
7
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
8
+ coverageDirectory: '../../coverage/libs/arsenal-ui',
9
+ };
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@dartech/arsenal-ui",
3
+ "version": "0.0.1",
4
+ "author": "DAR",
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org/"
7
+ },
8
+ "license": "ISC",
9
+ "dependencies": {
10
+ "react": "17.0.2",
11
+ "react-hook-form": "^7.5.2",
12
+ "@mui/x-date-pickers": "^5.0.0-alpha.0",
13
+ "date-fns": "^2.22.1",
14
+ "react-ace": "^10.1.0",
15
+ "ace-builds": "^1.5.3",
16
+ "react-router-dom": "5.3.0",
17
+ "react-toastify": "^8.2.0",
18
+ "classnames": "^2.3.1",
19
+ "mui-rte": "^1.29.0"
20
+ }
21
+ }
package/project.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "root": "libs/arsenal-ui",
3
+ "sourceRoot": "libs/arsenal-ui/src",
4
+ "projectType": "library",
5
+ "tags": [],
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nrwl/web:rollup",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "dist/libs/arsenal-ui",
12
+ "tsConfig": "libs/arsenal-ui/tsconfig.lib.json",
13
+ "project": "libs/arsenal-ui/package.json",
14
+ "entryFile": "libs/arsenal-ui/index.ts",
15
+ "rollupConfig": "libs/arsenal-ui/rollup.config",
16
+ "external": [
17
+ "react",
18
+ "react/jsx-runtime",
19
+ "axios",
20
+ "url-join",
21
+ "dmn-js",
22
+ "jspdf",
23
+ "canvg",
24
+ "react-toastify",
25
+ "react-router-dom",
26
+ "@material-ui/core",
27
+ "@material-ui/icons",
28
+ "@material-ui/lab",
29
+ "@material-ui/pickers",
30
+ "@material-ui/core/styles",
31
+ "@mui/material",
32
+ "@mui/x-date-pickers",
33
+ "@mui/x-data-grid",
34
+ "classnames",
35
+ "react-hook-form",
36
+ "ace-builds",
37
+ "react-ace",
38
+ "date-fns",
39
+ "uuid",
40
+ "tslib",
41
+ "mui-rte"
42
+ ],
43
+ "compiler": "babel",
44
+ "assets": [
45
+ {
46
+ "glob": "libs/arsenal-ui/README.md",
47
+ "input": ".",
48
+ "output": "."
49
+ }
50
+ ]
51
+ }
52
+ },
53
+ "lint": {
54
+ "executor": "@nrwl/linter:eslint",
55
+ "outputs": ["{options.outputFile}"],
56
+ "options": {
57
+ "lintFilePatterns": ["libs/arsenal-ui/**/*.{ts,tsx,js,jsx}"]
58
+ }
59
+ },
60
+ "test": {
61
+ "executor": "@nrwl/jest:jest",
62
+ "outputs": ["coverage/libs/arsenal-ui"],
63
+ "options": {
64
+ "jestConfig": "libs/arsenal-ui/jest.config.js",
65
+ "passWithNoTests": true
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,135 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+ // @ts-nocheck
3
+
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const builtins = require('rollup-plugin-node-builtins');
6
+ const resolve = require('@rollup/plugin-node-resolve');
7
+ const json = require('@rollup/plugin-json');
8
+ const terser = require('rollup-plugin-terser');
9
+ const path = require('path');
10
+ // const bpmnlint = require('rollup-plugin-bpmnlint');
11
+ // const minify = require('rollup-plugin-babel-minify');
12
+ const fileExtensions = ['.mjs', '.esm.js', 'cjs', '.js', '.ts', '.tsx', '.json', '.jsx'];
13
+
14
+ function getRollupOptions(options) {
15
+ const extraGlobals = {
16
+ react: 'React',
17
+ classnames: 'cn',
18
+ crypto: 'crypto',
19
+ '@mui/x-data-grid': 'xDataGrid',
20
+ 'react-dom': 'ReactDOM',
21
+ 'react-router-dom': 'ReactRouterDOM',
22
+ 'styled-components': 'styled',
23
+ '@emotion/react': 'emotionReact',
24
+ '@emotion/styled': 'emotionStyled',
25
+ 'axios': 'axios',
26
+ 'url-join': 'urlJoin',
27
+ '@material-ui/core': 'materialUiCore',
28
+ 'react-hook-form': 'reactHookForm',
29
+ '@material-ui/core/styles': 'MuiStyles',
30
+ "@material-ui/icons/DeleteForever": "DeleteForeverIcon",
31
+ '@material-ui/core/TextField': 'TextField',
32
+ '@material-ui/core/MenuItem': 'MenuItem',
33
+ '@material-ui/core/Button': 'Button',
34
+ '@material-ui/core/Dialog': 'Dialog',
35
+ '@material-ui/core/DialogActions': 'DialogActions',
36
+ '@material-ui/core/DialogContent': 'DialogContent',
37
+ '@material-ui/core/DialogContentText': 'DialogContentText',
38
+ '@material-ui/core/DialogTitle': 'DialogTitle',
39
+ '@material-ui/core/Box': 'Box',
40
+ '@material-ui/core/Grid': 'Grid',
41
+ '@material-ui/core/Checkbox': 'Checkbox',
42
+ '@material-ui/core/FormControl': 'FormControl',
43
+ '@material-ui/core/InputLabel': 'InputLabel',
44
+ '@material-ui/core/Typography': 'Typography',
45
+ '@material-ui/core/FormHelperText': 'FormHelperText',
46
+ '@material-ui/lab/Pagination': 'Pagination',
47
+ '@material-ui/lab/Autocomplete': 'Autocomplete',
48
+ '@mui/x-date-pickers/DatePicker': 'DatePicker',
49
+ '@mui/x-date-pickers/TimePicker': 'TimePicker',
50
+ '@mui/x-date-pickers/DateTimePicker': 'DateTimePicker',
51
+ '@mui/material/TextField': 'MuiTextField',
52
+ '@material-ui/core/Card': 'Card',
53
+ '@material-ui/core/CardContent': 'CardContent',
54
+ '@material-ui/core/TablePagination': 'TablePagination',
55
+ '@material-ui/icons/CheckCircle': 'CheckCircleIcon',
56
+ '@material-ui/core/FormControlLabel': 'FormControlLabel',
57
+ '@material-ui/core/IconButton': 'IconButton',
58
+ '@material-ui/core/Tooltip': 'Tooltip',
59
+ '@material-ui/icons/Add': 'AddIcon',
60
+ '@material-ui/icons/FileCopyOutlined': 'FileCopyOutlined',
61
+ '@material-ui/core/CircularProgress': 'CircularProgress',
62
+ '@material-ui/icons/ZoomInOutlined': 'ZoomInIcon',
63
+ '@material-ui/icons/ZoomOutOutlined': 'ZoomOutIcon',
64
+ '@material-ui/icons/AspectRatioOutlined': 'AspectRatioOutlinedIcon',
65
+ '@material-ui/icons/DeleteForeverOutlined': 'DeleteForeverOutlinedIcon',
66
+ '@material-ui/icons/ReplayOutlined': 'ReplayOutlinedIcon',
67
+ '@material-ui/icons/Settings': 'SettingsIcon',
68
+ '@material-ui/icons/Pause': 'PauseIcon',
69
+ '@material-ui/icons/PlayArrow': 'PlayArrowIcon',
70
+ '@material-ui/core/ButtonGroup': 'ButtonGroupIcon',
71
+ '@material-ui/core/Radio': 'Radio',
72
+ '@material-ui/core/RadioGroup': 'RadioGroup',
73
+ '@material-ui/core/List': 'List',
74
+ '@material-ui/core/ListItem': 'ListItem',
75
+ '@material-ui/core/ListItemText': 'ListItemText',
76
+ '@material-ui/core/ListItemSecondaryAction': 'ListItemSecondaryAction',
77
+ '@material-ui/core/Collapse': 'Collapse',
78
+ '@material-ui/core/Table': 'MuiTable',
79
+ '@material-ui/core/TableRow': 'TableRow',
80
+ '@material-ui/core/TableCell': 'TableCell',
81
+ '@material-ui/core/TableBody': 'TableBody',
82
+ '@material-ui/core/TableContainer': 'TableContainer',
83
+ '@material-ui/core/TableHead': 'TableHead',
84
+ '@material-ui/icons/Close': 'CloseIcon',
85
+ "@material-ui/pickers": 'pickers',
86
+ 'react-ace': 'AceEditor',
87
+ 'date-fns': 'dateFns',
88
+ 'tslib': 'tslib',
89
+ 'draft-js': 'draftJs',
90
+ 'react-toastify': 'reactToastify',
91
+ 'mui-rte': 'MUIRichTextEditor'
92
+ };
93
+ if (Array.isArray(options.output)) {
94
+ options.output.forEach((o) => {
95
+ o.globals = Object.assign(Object.assign({}, o.globals), extraGlobals);
96
+ o.output.compact = true;
97
+ // o.output.inlineDynamicImports = false;
98
+ });
99
+ }
100
+ else {
101
+ options.output = Object.assign(Object.assign({}, options.output), {
102
+ globals: Object.assign(Object.assign({}, options.output.globals), extraGlobals),
103
+ compact: true,
104
+ // inlineDynamicImports: false
105
+ });
106
+ };
107
+
108
+
109
+ options.treeshake = {
110
+ moduleSideEffects: false,
111
+ };
112
+ options.external = (id) => {
113
+ return !id.startsWith('.') && !path.isAbsolute(id);
114
+ }
115
+
116
+ options.plugins.push(
117
+ resolve.nodeResolve({
118
+ mainFields: ['module', 'browser', 'main'],
119
+ preferBuiltins: true,
120
+ extensions: fileExtensions,
121
+ moduleDirectories: ['dist/libs', 'node_modules'], // IMPORTANT
122
+ })
123
+ );
124
+ options.plugins.push(builtins());
125
+ options.plugins.push(json());
126
+ options.plugins.push(terser.terser());
127
+ // options.plugins.push(bpmnlint({
128
+ // include: '**/.bpmnlintrc',
129
+ // exclude: []
130
+ // }))
131
+
132
+ return options;
133
+ }
134
+
135
+ module.exports = getRollupOptions;
@@ -0,0 +1,12 @@
1
+ export enum RoundingMode {
2
+ UP = 'UP',
3
+ DOWN = 'DOWN',
4
+ CEILING = 'CEILING',
5
+ FLOOR = 'FLOOR',
6
+ HALF_UP = 'HALF_UP',
7
+ HALF_DOWN = 'HALF_DOWN',
8
+ HALF_EVEN = 'HALF_EVEN',
9
+ UNNECESSARY = 'UNNECESSARY',
10
+ }
11
+
12
+
@@ -0,0 +1,143 @@
1
+ import { RoundingMode } from './common';
2
+
3
+ export enum PropertyType {
4
+ STRING = 'STRING',
5
+ INTEGER = 'INTEGER',
6
+ BIG_INTEGER = 'BIG_INTEGER',
7
+ BIG_DECIMAL = 'BIG_DECIMAL',
8
+ FLOAT = 'FLOAT',
9
+ LONG = 'LONG',
10
+ DOUBLE = 'DOUBLE',
11
+ BOOLEAN = 'BOOLEAN',
12
+ ENTITY_REFERENCE = 'ENTITY_REFERENCE',
13
+ ENTITY = 'ENTITY',
14
+ JSON = 'JSON',
15
+ DATE = 'DATE',
16
+ TIME = 'TIME',
17
+ DATE_TIME = 'DATE_TIME',
18
+ }
19
+
20
+ export interface Definition {
21
+ code: string;
22
+ version: number;
23
+ name: string;
24
+ properties: PropertiesObjectType;
25
+ }
26
+
27
+ export type PropertiesObjectType<T = unknown> = Record<string, PropertyUnion & T>;
28
+ export type PropertiesArrayType<T = unknown> = Array<PropertyUnion & T>;
29
+
30
+ export interface CreateDefinitionType extends Omit<Definition, 'properties'> {
31
+ properties: PropertiesArrayType;
32
+ }
33
+ export interface UpdateDefinitionType extends Omit<Definition, 'properties'> {
34
+ properties: PropertiesArrayType;
35
+ }
36
+
37
+ export interface Property {
38
+ propertyType: keyof typeof PropertyType | { value: keyof typeof PropertyType };
39
+ name: string;
40
+ defaultValue: unknown;
41
+ defaultValues: unknown[];
42
+ isRequired: boolean;
43
+ isMultiple: boolean;
44
+ sortOrder: number;
45
+ isEnabled: boolean;
46
+ uiSettings: unknown;
47
+ validationNode: unknown;
48
+ // FRONTEND FIELDS
49
+ key?: string;
50
+ }
51
+
52
+ export interface BigDecimalProperty extends Property {
53
+ propertyType: PropertyType.BIG_DECIMAL;
54
+ precisionScale: number;
55
+ roundingMode: keyof typeof RoundingMode;
56
+ }
57
+
58
+ export interface BigIntegerProperty extends Property {
59
+ propertyType: PropertyType.BIG_INTEGER;
60
+ }
61
+
62
+ export interface BooleanProperty extends Property {
63
+ propertyType: PropertyType.BOOLEAN;
64
+ }
65
+
66
+ export interface DateProperty extends Property {
67
+ propertyType: PropertyType.DATE;
68
+ format: string;
69
+ }
70
+
71
+ export interface DateTimeProperty extends Property {
72
+ propertyType: PropertyType.DATE_TIME;
73
+ format: string;
74
+ }
75
+
76
+ export interface DoubleProperty extends Property {
77
+ propertyType: PropertyType.DOUBLE;
78
+ }
79
+
80
+ export interface EntityTypeProperty extends Property {
81
+ propertyType: PropertyType.ENTITY;
82
+ properties: PropertiesObjectType | PropertiesArrayType;
83
+ }
84
+
85
+ export interface EntityReferenceProperty extends Property {
86
+ propertyType: PropertyType.ENTITY_REFERENCE;
87
+ definitionCode: string;
88
+ definitionVersion: string;
89
+ labelPropertyCode: string;
90
+ valuePropertyCode: string;
91
+ }
92
+
93
+ export interface FloatProperty extends Property {
94
+ propertyType: PropertyType.FLOAT;
95
+ }
96
+
97
+ export interface StringProperty extends Property {
98
+ propertyType: PropertyType.STRING;
99
+ restrictedValues: string[];
100
+ }
101
+
102
+ export interface IntegerProperty extends Property {
103
+ propertyType: PropertyType.INTEGER;
104
+ }
105
+
106
+ export interface JsonProperty extends Property {
107
+ propertyType: PropertyType.JSON;
108
+ }
109
+
110
+ export interface LongProperty extends Property {
111
+ propertyType: PropertyType.LONG;
112
+ }
113
+
114
+ export interface TimeProperty extends Property {
115
+ propertyType: PropertyType.TIME;
116
+ format: string;
117
+ }
118
+
119
+ export type PropertyUnion =
120
+ | BigDecimalProperty
121
+ | BigIntegerProperty
122
+ | BooleanProperty
123
+ | DateProperty
124
+ | DateTimeProperty
125
+ | DoubleProperty
126
+ | EntityTypeProperty
127
+ | EntityReferenceProperty
128
+ | FloatProperty
129
+ | StringProperty
130
+ | IntegerProperty
131
+ | JsonProperty
132
+ | LongProperty
133
+ | TimeProperty;
134
+
135
+ export const DATE_DEFAULT_FORMAT = 'yyyy-MM-dd';
136
+ export const TIME_DEFAULT_FORMAT = 'HH:mm:ss';
137
+ export const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
138
+
139
+ export type GPBPropertiesObjectType = PropertiesObjectType<{ value: unknown; values: unknown[] }>;
140
+ export type GPBPropertiesArrayType = PropertiesArrayType<{ value: unknown; values: unknown[] }>;
141
+
142
+ export type EntityDefinitionPropertyObjectType = PropertiesObjectType<{ isViewableInList: boolean }>;
143
+ export type EntityDefinitionPropertyArrayType = PropertiesArrayType<{ isViewableInList: boolean }>;
@@ -0,0 +1,3 @@
1
+ export * from './definition';
2
+ export * from './ui';
3
+ export * from './common';
@@ -0,0 +1,35 @@
1
+ import { PropertiesArrayType } from './definition';
2
+
3
+ export interface FilterField {
4
+ name: string;
5
+ label: string;
6
+ type: 'text' | 'select' | 'autocomplete' | 'date' | 'number' | 'date_time';
7
+ value?: unknown;
8
+ multiple?: boolean;
9
+ options?: {
10
+ value: string;
11
+ label: string;
12
+ }[];
13
+ }
14
+
15
+ export interface Option {
16
+ value: string;
17
+ label: string;
18
+ }
19
+
20
+ export type TableDataType = 'JSON' | 'JSON_text' | 'JSON_copy' | 'copy' | 'boolean' | 'date' | 'status' | 'array';
21
+
22
+ export type JsonPathPickerProperties = {
23
+ properties: PropertiesArrayType;
24
+ pathPrefix: string;
25
+ title: string;
26
+ }[];
27
+
28
+ export type CustomPropertyFieldProps = {
29
+ name: string;
30
+ label?: string;
31
+ type: 'text' | 'checkbox' | 'number' | 'select' | 'autocomplete' | 'json';
32
+ decimal?: boolean;
33
+ options?: string[] | { value: unknown; label: string }[];
34
+ required?: boolean;
35
+ };
@@ -0,0 +1,108 @@
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;
@@ -0,0 +1 @@
1
+ export * from './Alert';
@@ -0,0 +1,74 @@
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;
@@ -0,0 +1 @@
1
+ export * from './CreateDefinition';