dynamic-mui 1.1.5 → 2.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.
- package/LICENSE +21 -0
- package/README.md +57 -22
- package/dist/components/DynamicComponent.d.ts +12 -0
- package/dist/components/FormGenerator.d.ts +37 -0
- package/dist/components/charts/Bar/bar.d.ts +2 -0
- package/dist/components/charts/Line/line.d.ts +2 -0
- package/dist/components/charts/Mixchart/mixChart.d.ts +2 -0
- package/dist/components/charts/Pie/pie.d.ts +2 -0
- package/dist/components/controls/Accordion/accordion.d.ts +2 -0
- package/dist/components/controls/Autocomplete/autocomplete.d.ts +2 -0
- package/dist/components/controls/CheckBox/checkbox.d.ts +3 -0
- package/dist/components/controls/Chip/chip.d.ts +2 -0
- package/dist/components/controls/DataTable/datatable.d.ts +2 -0
- package/dist/components/controls/DateTime/datetime.d.ts +2 -0
- package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +2 -0
- package/dist/components/controls/Divider/divider.d.ts +2 -0
- package/dist/components/controls/Group/group.d.ts +2 -0
- package/dist/components/controls/Hyperlink/hyperlink.d.ts +2 -0
- package/dist/components/controls/ImageList/imagelist.d.ts +2 -0
- package/dist/components/controls/List/list.d.ts +2 -0
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +2 -0
- package/dist/components/controls/NumberField/numberfield.d.ts +2 -0
- package/dist/components/controls/Radio/radio.d.ts +3 -0
- package/dist/components/controls/Select/select.d.ts +2 -0
- package/dist/components/controls/Signature/signature.d.ts +2 -0
- package/dist/components/controls/Stepper/stepper.d.ts +8 -0
- package/dist/components/controls/Switch/switch.d.ts +3 -0
- package/dist/components/controls/Tabs/tabs.d.ts +2 -0
- package/dist/components/controls/TextField/textfield.d.ts +2 -0
- package/dist/components/controls/TimePicker/timepicker.d.ts +2 -0
- package/dist/components/controls/Typography/typography.d.ts +3 -0
- package/dist/components/controls/index.d.ts +57 -0
- package/dist/config/mui.d.ts +8 -0
- package/dist/dynamic-mui.cjs.js +1 -0
- package/dist/dynamic-mui.es.js +9 -0
- package/dist/index-BFycuK80.js +465 -0
- package/dist/index-CJMUh0I6.js +1 -0
- package/dist/index-DvtivzW0.mjs +101901 -0
- package/dist/index-ipsOTYQY.mjs +153 -0
- package/dist/index.d.ts +5 -0
- package/dist/loadCognitoIdentity-BwoR11En.js +1 -0
- package/dist/loadCognitoIdentity-Cqci1Eff.mjs +935 -0
- package/dist/main.d.ts +1 -0
- package/dist/playground/Builder.d.ts +1 -0
- package/dist/playground/Canvas.d.ts +9 -0
- package/dist/playground/PropertiesEditor.d.ts +10 -0
- package/dist/playground/Sidebar.d.ts +1 -0
- package/dist/playground/documentation.d.ts +6 -0
- package/dist/playground/templates.d.ts +7 -0
- package/dist/playground/testData.d.ts +2 -0
- package/dist/test/setup.d.ts +0 -0
- package/dist/theme/theme.d.ts +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/util/helper.d.ts +64 -0
- package/dist/util/s3Upload.d.ts +13 -0
- package/dist/util/stepperComponents.d.ts +6 -0
- package/dist/util/useIsFirstRender.d.ts +1 -0
- package/dist/util/useUpdateEffect.d.ts +2 -0
- package/dist/util/validation.d.ts +6 -0
- package/package.json +65 -54
- package/build/asset-manifest.json +0 -10
- package/build/favicon.ico +0 -0
- package/build/index.html +0 -1
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/build/static/js/main.11a67c51.js +0 -3
- package/build/static/js/main.11a67c51.js.LICENSE.txt +0 -85
- package/build/static/js/main.11a67c51.js.map +0 -1
- package/craco.config.js +0 -34
- package/dist-modules/components/DynamicComponent.js +0 -22
- package/dist-modules/components/FormGenerator.js +0 -200
- package/dist-modules/components/charts/Bar/bar.js +0 -31
- package/dist-modules/components/charts/Line/line.js +0 -31
- package/dist-modules/components/charts/Mixchart/mixChart.js +0 -59
- package/dist-modules/components/charts/Pie/pie.js +0 -31
- package/dist-modules/components/controls/CheckBox/checkbox.js +0 -56
- package/dist-modules/components/controls/DataTable/datatable.js +0 -28
- package/dist-modules/components/controls/DateTime/datetime.js +0 -53
- package/dist-modules/components/controls/DateTimePicker/datetimepicker.js +0 -53
- package/dist-modules/components/controls/Radio/radio.js +0 -88
- package/dist-modules/components/controls/Select/select.js +0 -173
- package/dist-modules/components/controls/Stepper/stepper.js +0 -192
- package/dist-modules/components/controls/Switch/switch.js +0 -85
- package/dist-modules/components/controls/TextField/textfield.js +0 -148
- package/dist-modules/components/controls/TimePicker/timepicker.js +0 -53
- package/dist-modules/components/controls/Typography/typography.js +0 -43
- package/dist-modules/components/controls/index.js +0 -42
- package/dist-modules/config/mui.js +0 -73
- package/dist-modules/data/checkbox.js +0 -143
- package/dist-modules/data/dataTable.js +0 -90
- package/dist-modules/data/dateTime.js +0 -136
- package/dist-modules/data/radio.js +0 -36
- package/dist-modules/data/select.js +0 -126
- package/dist-modules/data/stepper.js +0 -237
- package/dist-modules/data/switch.js +0 -123
- package/dist-modules/data/textfield.js +0 -240
- package/dist-modules/index.js +0 -16
- package/dist-modules/util/helper.js +0 -226
- package/dist-modules/util/stepperComponents.js +0 -40
- package/dist-modules/util/useIsFirstRender.js +0 -15
- package/dist-modules/util/useUpdateEffect.js +0 -19
- package/dist-modules/util/validation.js +0 -102
- package/docs/asset-manifest.json +0 -9
- package/docs/build/bundle.1eab2706.js +0 -2
- package/docs/build/bundle.1eab2706.js.LICENSE.txt +0 -153
- package/docs/index.html +0 -16
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/styleguide.config.js +0 -108
- package/themes/default.js +0 -114
- package/themes/index.js +0 -29
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validation = exports.sizesAndLayout = exports.mui = exports.inputAdornment = void 0;
|
|
7
|
-
const mui = exports.mui = [{
|
|
8
|
-
type: 'textfield',
|
|
9
|
-
props: {
|
|
10
|
-
MuiAttributes: {
|
|
11
|
-
placeholder: 'Standard',
|
|
12
|
-
fullWidth: true,
|
|
13
|
-
variant: 'standard'
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
layout: {
|
|
17
|
-
row: 1,
|
|
18
|
-
xs: 4,
|
|
19
|
-
sm: 4
|
|
20
|
-
}
|
|
21
|
-
}, {
|
|
22
|
-
type: 'textfield',
|
|
23
|
-
props: {
|
|
24
|
-
MuiAttributes: {
|
|
25
|
-
placeholder: 'Filled',
|
|
26
|
-
fullWidth: true,
|
|
27
|
-
variant: 'filled'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
layout: {
|
|
31
|
-
row: 1,
|
|
32
|
-
xs: 4,
|
|
33
|
-
sm: 4
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
type: 'textfield',
|
|
37
|
-
props: {
|
|
38
|
-
MuiAttributes: {
|
|
39
|
-
placeholder: 'Outlined',
|
|
40
|
-
fullWidth: true,
|
|
41
|
-
variant: 'outlined'
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
layout: {
|
|
45
|
-
row: 1,
|
|
46
|
-
xs: 4,
|
|
47
|
-
sm: 4
|
|
48
|
-
}
|
|
49
|
-
}];
|
|
50
|
-
const validation = exports.validation = [{
|
|
51
|
-
type: 'textfield',
|
|
52
|
-
props: {
|
|
53
|
-
MuiAttributes: {
|
|
54
|
-
label: 'Mandatory',
|
|
55
|
-
fullWidth: true,
|
|
56
|
-
variant: 'outlined'
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
layout: {
|
|
60
|
-
row: 1,
|
|
61
|
-
xs: 3,
|
|
62
|
-
sm: 3
|
|
63
|
-
},
|
|
64
|
-
rules: {
|
|
65
|
-
validation: [{
|
|
66
|
-
rule: 'mandatory',
|
|
67
|
-
message: 'Please enter your first name.'
|
|
68
|
-
}]
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
id: 'password',
|
|
72
|
-
type: 'textfield',
|
|
73
|
-
layout: {
|
|
74
|
-
row: 1,
|
|
75
|
-
xs: 3,
|
|
76
|
-
sm: 3
|
|
77
|
-
},
|
|
78
|
-
props: {
|
|
79
|
-
id: 'password',
|
|
80
|
-
MuiAttributes: {
|
|
81
|
-
type: 'password',
|
|
82
|
-
fullWidth: true,
|
|
83
|
-
label: 'Password'
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
id: 'number',
|
|
88
|
-
type: 'textfield',
|
|
89
|
-
layout: {
|
|
90
|
-
row: 1,
|
|
91
|
-
xs: 3,
|
|
92
|
-
sm: 3
|
|
93
|
-
},
|
|
94
|
-
props: {
|
|
95
|
-
id: 'number',
|
|
96
|
-
MuiAttributes: {
|
|
97
|
-
type: 'number',
|
|
98
|
-
fullWidth: true,
|
|
99
|
-
label: 'Number'
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}, {
|
|
103
|
-
id: 'currency',
|
|
104
|
-
type: 'textfield',
|
|
105
|
-
layout: {
|
|
106
|
-
row: 1,
|
|
107
|
-
xs: 3,
|
|
108
|
-
sm: 3
|
|
109
|
-
},
|
|
110
|
-
props: {
|
|
111
|
-
id: 'currency',
|
|
112
|
-
MuiAttributes: {
|
|
113
|
-
fullWidth: true,
|
|
114
|
-
label: 'Currency',
|
|
115
|
-
name: 'Currency'
|
|
116
|
-
},
|
|
117
|
-
format: '$0,0.00'
|
|
118
|
-
}
|
|
119
|
-
}];
|
|
120
|
-
const inputAdornment = exports.inputAdornment = [{
|
|
121
|
-
id: 'firstname',
|
|
122
|
-
type: 'textfield',
|
|
123
|
-
props: {
|
|
124
|
-
id: 'firstname',
|
|
125
|
-
MuiAttributes: {
|
|
126
|
-
fullWidth: true,
|
|
127
|
-
InputLabelProps: {
|
|
128
|
-
shrink: true
|
|
129
|
-
},
|
|
130
|
-
margin: 'normal',
|
|
131
|
-
label: 'First Name'
|
|
132
|
-
},
|
|
133
|
-
InputProps: {
|
|
134
|
-
MuiInputAdornment: {},
|
|
135
|
-
position: 'start',
|
|
136
|
-
icon: 'account_circle'
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
rules: {
|
|
140
|
-
validation: [{
|
|
141
|
-
rule: 'mandatory',
|
|
142
|
-
message: 'Please enter your first name.'
|
|
143
|
-
}]
|
|
144
|
-
},
|
|
145
|
-
layout: {
|
|
146
|
-
row: 1,
|
|
147
|
-
xs: 6,
|
|
148
|
-
sm: 6
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
id: 'textfieldoutlined',
|
|
152
|
-
type: 'textfield',
|
|
153
|
-
props: {
|
|
154
|
-
id: 'textfieldoutlined',
|
|
155
|
-
MuiAttributes: {
|
|
156
|
-
fullWidth: true,
|
|
157
|
-
InputLabelProps: {
|
|
158
|
-
shrink: true
|
|
159
|
-
},
|
|
160
|
-
margin: 'normal',
|
|
161
|
-
helperText: 'Weight',
|
|
162
|
-
label: 'First Name'
|
|
163
|
-
},
|
|
164
|
-
InputProps: {
|
|
165
|
-
MuiInputAdornment: {
|
|
166
|
-
position: 'end'
|
|
167
|
-
},
|
|
168
|
-
position: 'end',
|
|
169
|
-
text: 'KG'
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
layout: {
|
|
173
|
-
row: 1,
|
|
174
|
-
xs: 6,
|
|
175
|
-
sm: 6
|
|
176
|
-
}
|
|
177
|
-
}];
|
|
178
|
-
const sizesAndLayout = exports.sizesAndLayout = [{
|
|
179
|
-
id: 'textfieldoutlined',
|
|
180
|
-
type: 'textfield',
|
|
181
|
-
props: {
|
|
182
|
-
id: 'textfieldoutlined',
|
|
183
|
-
MuiAttributes: {
|
|
184
|
-
fullWidth: true,
|
|
185
|
-
size: 'small',
|
|
186
|
-
label: 'Small'
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
layout: {
|
|
190
|
-
row: 1,
|
|
191
|
-
xs: 4,
|
|
192
|
-
sm: 4
|
|
193
|
-
}
|
|
194
|
-
}, {
|
|
195
|
-
id: 'textfieldoutlined',
|
|
196
|
-
type: 'textfield',
|
|
197
|
-
props: {
|
|
198
|
-
id: 'textfieldoutlined',
|
|
199
|
-
MuiAttributes: {
|
|
200
|
-
fullWidth: true,
|
|
201
|
-
label: 'Normal'
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
layout: {
|
|
205
|
-
row: 1,
|
|
206
|
-
xs: 4,
|
|
207
|
-
sm: 4
|
|
208
|
-
}
|
|
209
|
-
}, {
|
|
210
|
-
id: 'textfieldoutlined',
|
|
211
|
-
type: 'textfield',
|
|
212
|
-
props: {
|
|
213
|
-
id: 'textfieldoutlined',
|
|
214
|
-
MuiAttributes: {
|
|
215
|
-
fullWidth: true,
|
|
216
|
-
label: 'Disabled',
|
|
217
|
-
disabled: true
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
layout: {
|
|
221
|
-
row: 1,
|
|
222
|
-
xs: 4,
|
|
223
|
-
sm: 4
|
|
224
|
-
}
|
|
225
|
-
}, {
|
|
226
|
-
id: 'textfieldoutlined',
|
|
227
|
-
type: 'textfield',
|
|
228
|
-
props: {
|
|
229
|
-
id: 'textfieldoutlined',
|
|
230
|
-
MuiAttributes: {
|
|
231
|
-
fullWidth: true,
|
|
232
|
-
label: 'Fullwidth'
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
layout: {
|
|
236
|
-
row: 1,
|
|
237
|
-
xs: 12,
|
|
238
|
-
sm: 12
|
|
239
|
-
}
|
|
240
|
-
}];
|
package/dist-modules/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _FormGenerator = require("./components/FormGenerator");
|
|
7
|
-
Object.keys(_FormGenerator).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _FormGenerator[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _FormGenerator[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateKey = exports.default = exports.checkboxSX = exports.DateComponent = void 0;
|
|
7
|
-
exports.generateLayout = generateLayout;
|
|
8
|
-
exports.getInputProps = getInputProps;
|
|
9
|
-
exports.updatePatchData = void 0;
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
12
|
-
var _material = require("@mui/material");
|
|
13
|
-
var _xDatePickers = require("@mui/x-date-pickers");
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
const _excluded = ["xs", "sm", "md", "lg", "xl", "size"];
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
25
|
-
function generateLayout(data) {
|
|
26
|
-
const layout = {
|
|
27
|
-
wrows: [],
|
|
28
|
-
worows: []
|
|
29
|
-
};
|
|
30
|
-
const wrows = (0, _lodash.clone)(data);
|
|
31
|
-
|
|
32
|
-
// Items without a row -> worows
|
|
33
|
-
const removed = (0, _lodash.remove)(wrows, item => {
|
|
34
|
-
const isLayout = item.layout ? item.layout.row : item.layout;
|
|
35
|
-
return isLayout === undefined;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Create a new item with MUI v7-friendly layout.size (no param reassign)
|
|
39
|
-
const normalizeItem = it => {
|
|
40
|
-
var _it$layout;
|
|
41
|
-
const l = (_it$layout = it.layout) !== null && _it$layout !== void 0 ? _it$layout : {};
|
|
42
|
-
const computedSize = (() => {
|
|
43
|
-
if (l.size && typeof l.size === 'object') return l.size;
|
|
44
|
-
const s = {};
|
|
45
|
-
if (l.xs != null) s.xs = l.xs;
|
|
46
|
-
if (l.sm != null) s.sm = l.sm;
|
|
47
|
-
if (l.md != null) s.md = l.md;
|
|
48
|
-
if (l.lg != null) s.lg = l.lg;
|
|
49
|
-
if (l.xl != null) s.xl = l.xl;
|
|
50
|
-
return Object.keys(s).length ? s : {
|
|
51
|
-
xs: 12
|
|
52
|
-
};
|
|
53
|
-
})();
|
|
54
|
-
|
|
55
|
-
// strip legacy breakpoint keys; keep everything else on layout
|
|
56
|
-
const {
|
|
57
|
-
xs,
|
|
58
|
-
sm,
|
|
59
|
-
md,
|
|
60
|
-
lg,
|
|
61
|
-
xl,
|
|
62
|
-
size
|
|
63
|
-
} = l,
|
|
64
|
-
restLayout = _objectWithoutProperties(l, _excluded);
|
|
65
|
-
const normalizedLayout = _objectSpread(_objectSpread({}, restLayout), {}, {
|
|
66
|
-
size: size !== null && size !== void 0 ? size : computedSize
|
|
67
|
-
});
|
|
68
|
-
return _objectSpread(_objectSpread({}, it), {}, {
|
|
69
|
-
layout: normalizedLayout
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
layout.worows = removed.map(normalizeItem);
|
|
73
|
-
|
|
74
|
-
// Group remaining items by row
|
|
75
|
-
const rowIndex = (0, _lodash.map)(wrows, 'layout.row');
|
|
76
|
-
const uniqIndex = (0, _lodash.uniq)(rowIndex);
|
|
77
|
-
const sortedIndex = (0, _lodash.sortBy)(uniqIndex);
|
|
78
|
-
(0, _lodash.each)(sortedIndex, value => {
|
|
79
|
-
const rows = [];
|
|
80
|
-
(0, _lodash.each)(wrows, it => {
|
|
81
|
-
if (it.layout && it.layout.row === value) {
|
|
82
|
-
rows.push(normalizeItem(it));
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
layout.wrows.push(rows);
|
|
86
|
-
});
|
|
87
|
-
return layout;
|
|
88
|
-
}
|
|
89
|
-
function getInputProps(InputProps) {
|
|
90
|
-
if (!(0, _isEmpty.default)(InputProps)) {
|
|
91
|
-
const {
|
|
92
|
-
MuiInputAdornment = {},
|
|
93
|
-
position = 'start',
|
|
94
|
-
icon,
|
|
95
|
-
text,
|
|
96
|
-
textstyle = {}
|
|
97
|
-
} = InputProps;
|
|
98
|
-
return {
|
|
99
|
-
["".concat(position, "Adornment")]: /*#__PURE__*/_react.default.createElement(_material.InputAdornment, _extends({}, MuiInputAdornment, {
|
|
100
|
-
key: "custom-icon-Adornment-".concat(position)
|
|
101
|
-
}), icon && /*#__PURE__*/_react.default.createElement(_material.Icon, null, icon), !(0, _isEmpty.default)(textstyle) ? /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
-
style: textstyle
|
|
103
|
-
}, text || '') : text || '')
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {};
|
|
107
|
-
}
|
|
108
|
-
const generateKey = function () {
|
|
109
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
110
|
-
let index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
111
|
-
const random = Math.random().toString(36).substr(2, 9);
|
|
112
|
-
const currentTime = new Date().toLocaleTimeString('en').trim();
|
|
113
|
-
return "".concat(prefix, "_").concat(index, "_").concat(random, "_").concat(currentTime);
|
|
114
|
-
};
|
|
115
|
-
exports.generateKey = generateKey;
|
|
116
|
-
function isEmptyCustom(value) {
|
|
117
|
-
return (
|
|
118
|
-
// null or undefined
|
|
119
|
-
value == null ||
|
|
120
|
-
// has length and it's zero
|
|
121
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
122
|
-
value.hasOwnProperty('length') && value.length === 0 ||
|
|
123
|
-
// is an Object and has no keys
|
|
124
|
-
value.constructor === Object && Object.keys(value).length === 0
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
const updatePatchData = function (fields, patch, guid) {
|
|
128
|
-
let response = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
129
|
-
let enableDisableIds = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
130
|
-
try {
|
|
131
|
-
// Update response with the patch for the provided GUID
|
|
132
|
-
response[guid] = patch;
|
|
133
|
-
|
|
134
|
-
// Map and update fields with response data
|
|
135
|
-
const updatedFields = (0, _lodash.map)(fields, field => {
|
|
136
|
-
var _newField$props;
|
|
137
|
-
const newField = (0, _lodash.cloneDeep)(field);
|
|
138
|
-
const id = (newField === null || newField === void 0 ? void 0 : newField.id) || (newField === null || newField === void 0 || (_newField$props = newField.props) === null || _newField$props === void 0 ? void 0 : _newField$props.id);
|
|
139
|
-
if (id && response[guid] && !isEmptyCustom(response[guid][id])) {
|
|
140
|
-
const defaultValue = ['switch', 'checkbox'].includes(newField === null || newField === void 0 ? void 0 : newField.type) ? false : '';
|
|
141
|
-
newField.props = _objectSpread(_objectSpread({}, newField.props), {}, {
|
|
142
|
-
value: response[guid][id] === undefined ? defaultValue : response[guid][id]
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return newField;
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// Handle enable/disable logic
|
|
149
|
-
if (enableDisableIds.length > 0) {
|
|
150
|
-
enableDisableIds.forEach(_ref => {
|
|
151
|
-
let {
|
|
152
|
-
key,
|
|
153
|
-
disableIds,
|
|
154
|
-
compareValues = {}
|
|
155
|
-
} = _ref;
|
|
156
|
-
const controllingField = updatedFields.find(field => {
|
|
157
|
-
var _field$props;
|
|
158
|
-
return (field === null || field === void 0 ? void 0 : field.id) === key || (field === null || field === void 0 || (_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.id) === key;
|
|
159
|
-
});
|
|
160
|
-
if (controllingField) {
|
|
161
|
-
var _controllingField$pro;
|
|
162
|
-
const disabled = compareValues[controllingField === null || controllingField === void 0 || (_controllingField$pro = controllingField.props) === null || _controllingField$pro === void 0 ? void 0 : _controllingField$pro.value];
|
|
163
|
-
disableIds.forEach(patchId => {
|
|
164
|
-
const targetFieldIndex = updatedFields.findIndex(field => {
|
|
165
|
-
var _field$props2;
|
|
166
|
-
return (field === null || field === void 0 ? void 0 : field.id) === patchId || (field === null || field === void 0 || (_field$props2 = field.props) === null || _field$props2 === void 0 ? void 0 : _field$props2.id) === patchId;
|
|
167
|
-
});
|
|
168
|
-
if (targetFieldIndex !== -1) {
|
|
169
|
-
var _tElement$props, _updatedFields$target, _updatedFields$target2;
|
|
170
|
-
const tElement = updatedFields[targetFieldIndex];
|
|
171
|
-
const id = (tElement === null || tElement === void 0 ? void 0 : tElement.id) || (tElement === null || tElement === void 0 || (_tElement$props = tElement.props) === null || _tElement$props === void 0 ? void 0 : _tElement$props.id);
|
|
172
|
-
response[guid][id] = disabled ? '' : response[guid][id];
|
|
173
|
-
updatedFields[targetFieldIndex] = _objectSpread(_objectSpread({}, updatedFields[targetFieldIndex]), {}, {
|
|
174
|
-
props: _objectSpread(_objectSpread({}, updatedFields[targetFieldIndex].props), {}, {
|
|
175
|
-
value: disabled ? '' : (_updatedFields$target = updatedFields[targetFieldIndex]) === null || _updatedFields$target === void 0 || (_updatedFields$target = _updatedFields$target.props) === null || _updatedFields$target === void 0 ? void 0 : _updatedFields$target.value,
|
|
176
|
-
MuiAttributes: _objectSpread(_objectSpread({}, (_updatedFields$target2 = updatedFields[targetFieldIndex].props) === null || _updatedFields$target2 === void 0 ? void 0 : _updatedFields$target2.MuiAttributes), {}, {
|
|
177
|
-
disabled
|
|
178
|
-
})
|
|
179
|
-
})
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
return updatedFields;
|
|
187
|
-
} catch (error) {
|
|
188
|
-
// eslint-disable-next-line no-console
|
|
189
|
-
console.error('Error updating patch data:', error);
|
|
190
|
-
return fields; // Return original fields on error
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
exports.updatePatchData = updatePatchData;
|
|
194
|
-
const DateComponent = name => {
|
|
195
|
-
if (name === 'MobileDatePicker') return _xDatePickers.MobileDatePicker;
|
|
196
|
-
if (name === 'DesktopDatePicker') return _xDatePickers.DesktopDatePicker;
|
|
197
|
-
// if (name === 'DateRangePicker') return DateRangePicker;
|
|
198
|
-
// if (name === 'MobileDateRangePicker') return MobileDateRangePicker;
|
|
199
|
-
// if (name === 'DesktopDateRangePicker') return DesktopDateRangePicker;
|
|
200
|
-
if (name === 'DateTimePicker') return _xDatePickers.DateTimePicker;
|
|
201
|
-
if (name === 'MobileDateTimePicker') return _xDatePickers.MobileDateTimePicker;
|
|
202
|
-
if (name === 'DesktopDateTimePicker') return _xDatePickers.DesktopDateTimePicker;
|
|
203
|
-
if (name === 'TimePicker') return _xDatePickers.TimePicker;
|
|
204
|
-
if (name === 'MobileTimePicker') return _xDatePickers.MobileTimePicker;
|
|
205
|
-
if (name === 'DesktopTimePicker') return _xDatePickers.DesktopTimePicker;
|
|
206
|
-
return _xDatePickers.DatePicker;
|
|
207
|
-
};
|
|
208
|
-
exports.DateComponent = DateComponent;
|
|
209
|
-
const checkboxSX = color => {
|
|
210
|
-
if (color) return {
|
|
211
|
-
color,
|
|
212
|
-
'&.Mui-checked': {
|
|
213
|
-
color
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
return {};
|
|
217
|
-
};
|
|
218
|
-
exports.checkboxSX = checkboxSX;
|
|
219
|
-
var _default = exports.default = {
|
|
220
|
-
generateLayout,
|
|
221
|
-
getInputProps,
|
|
222
|
-
generateKey,
|
|
223
|
-
updatePatchData,
|
|
224
|
-
DateComponent,
|
|
225
|
-
checkboxSX
|
|
226
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = StepperComponents;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var Controls = _interopRequireWildcard(require("../components/controls"));
|
|
10
|
-
var _mui = _interopRequireDefault(require("../config/mui"));
|
|
11
|
-
var _helper = require("./helper");
|
|
12
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
// eslint-disable-next-line import/no-cycle
|
|
15
|
-
|
|
16
|
-
function StepperComponents(_ref) {
|
|
17
|
-
let {
|
|
18
|
-
components,
|
|
19
|
-
onUpdate
|
|
20
|
-
} = _ref;
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, [...components].map((component, index) => {
|
|
22
|
-
const CustomComponent = Controls.default[_mui.default[component.type].map];
|
|
23
|
-
return /*#__PURE__*/_react.default.createElement(CustomComponent, {
|
|
24
|
-
key: (0, _helper.generateKey)('dynamic-stepper-comp', index),
|
|
25
|
-
attributes: component.props,
|
|
26
|
-
onChange: onUpdate
|
|
27
|
-
});
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
StepperComponents.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
31
|
-
/** Attributes for StepperComponent */
|
|
32
|
-
components: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
33
|
-
/** Function */
|
|
34
|
-
onUpdate: _propTypes.default.func
|
|
35
|
-
} : {};
|
|
36
|
-
StepperComponents.defaultProps = {
|
|
37
|
-
components: [],
|
|
38
|
-
// rules: {},
|
|
39
|
-
onUpdate: null
|
|
40
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useIsFirstRender;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
function useIsFirstRender() {
|
|
9
|
-
const isFirst = (0, _react.useRef)(true);
|
|
10
|
-
if (isFirst.current) {
|
|
11
|
-
isFirst.current = false;
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return isFirst.current;
|
|
15
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useUpdateEffect;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _useIsFirstRender = _interopRequireDefault(require("./useIsFirstRender"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function useUpdateEffect(effect, deps) {
|
|
11
|
-
const isFirst = (0, _useIsFirstRender.default)();
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line consistent-return
|
|
14
|
-
(0, _react.useEffect)(() => {
|
|
15
|
-
if (!isFirst) {
|
|
16
|
-
return effect();
|
|
17
|
-
}
|
|
18
|
-
}, deps);
|
|
19
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _validator = _interopRequireDefault(require("validator"));
|
|
8
|
-
var _numeral = _interopRequireDefault(require("numeral"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
const Validation = {
|
|
11
|
-
email(value, options) {
|
|
12
|
-
return _validator.default.isEmail(value, options);
|
|
13
|
-
},
|
|
14
|
-
equals(value, comparison) {
|
|
15
|
-
return _validator.default.equals(value, comparison);
|
|
16
|
-
},
|
|
17
|
-
mandatory(value) {
|
|
18
|
-
return !_validator.default.isEmpty(value);
|
|
19
|
-
},
|
|
20
|
-
mandatoryselect(value) {
|
|
21
|
-
return value.length > 0;
|
|
22
|
-
},
|
|
23
|
-
mobile(value, locale) {
|
|
24
|
-
return _validator.default.isMobilePhone(value, locale);
|
|
25
|
-
},
|
|
26
|
-
lowercase(value) {
|
|
27
|
-
return _validator.default.isLowercase(value);
|
|
28
|
-
},
|
|
29
|
-
uppercase(value) {
|
|
30
|
-
return _validator.default.isUppercase(value);
|
|
31
|
-
},
|
|
32
|
-
length(value, options) {
|
|
33
|
-
return _validator.default.isLength(value, options);
|
|
34
|
-
},
|
|
35
|
-
url(value, options) {
|
|
36
|
-
return _validator.default.isURL(value, options);
|
|
37
|
-
},
|
|
38
|
-
creditcard(value) {
|
|
39
|
-
return _validator.default.isCreditCard(value);
|
|
40
|
-
},
|
|
41
|
-
currency(value, options) {
|
|
42
|
-
return _validator.default.isCurrency(value, options);
|
|
43
|
-
},
|
|
44
|
-
date(value) {
|
|
45
|
-
return _validator.default.isDate(value);
|
|
46
|
-
},
|
|
47
|
-
boolean(value) {
|
|
48
|
-
return _validator.default.isBoolean(value);
|
|
49
|
-
},
|
|
50
|
-
alphanumeric(value, locale) {
|
|
51
|
-
_validator.default.isAlphanumeric(value, locale);
|
|
52
|
-
},
|
|
53
|
-
contains(value, seed) {
|
|
54
|
-
return _validator.default.contains(value, seed);
|
|
55
|
-
},
|
|
56
|
-
FQDN(value, options) {
|
|
57
|
-
return _validator.default.isFQDN(value, options);
|
|
58
|
-
},
|
|
59
|
-
float(value, options) {
|
|
60
|
-
return _validator.default.isFloat(value, options);
|
|
61
|
-
},
|
|
62
|
-
ip(value, version) {
|
|
63
|
-
return _validator.default.isIP(value, version);
|
|
64
|
-
},
|
|
65
|
-
ISBN(value, version) {
|
|
66
|
-
return _validator.default.isISBN(value, version);
|
|
67
|
-
},
|
|
68
|
-
MACAddress(value) {
|
|
69
|
-
return _validator.default.isMACAddress(value);
|
|
70
|
-
},
|
|
71
|
-
MD5(value) {
|
|
72
|
-
return _validator.default.isMD5(value);
|
|
73
|
-
},
|
|
74
|
-
numeric(value) {
|
|
75
|
-
return _validator.default.isNumeric(value);
|
|
76
|
-
},
|
|
77
|
-
UUID(value, version) {
|
|
78
|
-
return _validator.default.isUUID(value, version);
|
|
79
|
-
},
|
|
80
|
-
matches(value, pattern) {
|
|
81
|
-
return _validator.default.matches(value, pattern);
|
|
82
|
-
},
|
|
83
|
-
int(value, options) {
|
|
84
|
-
return _validator.default.isInt(value, options);
|
|
85
|
-
},
|
|
86
|
-
hexcolor(value) {
|
|
87
|
-
return _validator.default.isHexColor(value);
|
|
88
|
-
},
|
|
89
|
-
dataURI(value) {
|
|
90
|
-
return _validator.default.isDataURI(value);
|
|
91
|
-
},
|
|
92
|
-
decimal(value) {
|
|
93
|
-
return _validator.default.isDecimal(value);
|
|
94
|
-
},
|
|
95
|
-
alpha(value, locale) {
|
|
96
|
-
return _validator.default.isAlpha(value, locale);
|
|
97
|
-
},
|
|
98
|
-
negative(value) {
|
|
99
|
-
return (0, _numeral.default)(value).value() > -1;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
var _default = exports.default = Validation;
|