flipper-ui 0.25.17 → 0.26.0
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/.babelrc.js +119 -0
- package/.eslintignore +1 -0
- package/.eslintrc.json +209 -0
- package/.github/workflows/build.yml +25 -0
- package/.github/workflows/publish-s3.yml +27 -0
- package/.github/workflows/release.yml +24 -0
- package/.prettierrc +8 -0
- package/.storybook/main.js +10 -0
- package/.storybook/preview-head.html +1 -0
- package/.storybook/preview.js +9 -0
- package/.tool-versions +1 -0
- package/.vscode/settings.json +21 -0
- package/.vscode/snippets/typescriptreact.json +89 -0
- package/.wakatime-project +1 -0
- package/{colors.d.ts → dist/colors.d.ts} +0 -0
- package/{colors.js → dist/colors.js} +3 -2
- package/{core → dist/core}/Advertise.d.ts +0 -0
- package/{core → dist/core}/Advertise.js +13 -36
- package/{core → dist/core}/AutoComplete.d.ts +0 -0
- package/{core → dist/core}/AutoComplete.js +12 -53
- package/{core → dist/core}/Avatar.d.ts +0 -0
- package/{core → dist/core}/Avatar.js +4 -12
- package/{core → dist/core}/Badge.d.ts +0 -0
- package/{core → dist/core}/Badge.js +10 -21
- package/{core → dist/core}/Box.d.ts +0 -0
- package/dist/core/Box.js +35 -0
- package/{core → dist/core}/Breadcrumb.d.ts +0 -0
- package/{core → dist/core}/Breadcrumb.js +0 -3
- package/{core → dist/core}/Button.d.ts +0 -0
- package/{core → dist/core}/Button.js +11 -32
- package/{core → dist/core}/Card.d.ts +0 -0
- package/{core → dist/core}/Card.js +27 -46
- package/{core → dist/core}/Chapter.d.ts +0 -0
- package/{core → dist/core}/Chapter.js +12 -47
- package/{core → dist/core}/Checkbox.d.ts +0 -0
- package/{core → dist/core}/Checkbox.js +8 -27
- package/{core → dist/core}/Chip.d.ts +0 -0
- package/{core → dist/core}/Chip.js +8 -19
- package/{core → dist/core}/ChipField.d.ts +0 -0
- package/dist/core/ChipField.js +30 -0
- package/{core → dist/core}/Collapse.d.ts +0 -0
- package/{core → dist/core}/Collapse.js +8 -17
- package/{core → dist/core}/Container.d.ts +0 -0
- package/{core → dist/core}/Container.js +10 -30
- package/{core → dist/core}/Content.d.ts +0 -0
- package/{core → dist/core}/Content.js +10 -30
- package/{core → dist/core}/DataTable/DataTable.d.ts +0 -0
- package/{core → dist/core}/DataTable/DataTable.js +35 -72
- package/{core → dist/core}/DataTable/DataTableAction.d.ts +0 -0
- package/{core → dist/core}/DataTable/DataTableAction.js +4 -9
- package/{core → dist/core}/DataTable/DataTablePaginationActions.d.ts +0 -0
- package/{core → dist/core}/DataTable/DataTablePaginationActions.js +6 -20
- package/{core → dist/core}/DataTable/DataTableQueryPaginated.d.ts +0 -0
- package/{core → dist/core}/DataTable/DataTableQueryPaginated.js +32 -65
- package/{core → dist/core}/DataTable/Rows.d.ts +0 -0
- package/{core → dist/core}/DataTable/Rows.js +23 -56
- package/{core → dist/core}/DataTable/index.d.ts +0 -0
- package/{core → dist/core}/DataTable/index.js +4 -9
- package/{core → dist/core}/DataTable/types.d.ts +0 -0
- package/{core → dist/core}/DataTable/types.js +0 -2
- package/{core → dist/core}/DataTable/usePaginated.d.ts +0 -0
- package/{core → dist/core}/DataTable/usePaginated.js +10 -30
- package/{core → dist/core}/DataTable/useRowsState.d.ts +0 -0
- package/{core → dist/core}/DataTable/useRowsState.js +12 -37
- package/{core → dist/core}/DateTime.d.ts +0 -0
- package/{core → dist/core}/DateTime.js +22 -38
- package/{core → dist/core}/Dialog.d.ts +0 -0
- package/{core → dist/core}/Dialog.js +30 -97
- package/{core → dist/core}/Divider.d.ts +0 -0
- package/{core → dist/core}/Divider.js +7 -16
- package/{core → dist/core}/Drawer.d.ts +0 -0
- package/{core → dist/core}/Drawer.js +9 -20
- package/{core → dist/core}/EditableTable.d.ts +0 -0
- package/{core → dist/core}/EditableTable.js +26 -140
- package/{core → dist/core}/ExpansionPanel.d.ts +0 -0
- package/{core → dist/core}/ExpansionPanel.js +19 -47
- package/{core → dist/core}/Fab.d.ts +0 -0
- package/{core → dist/core}/Fab.js +9 -18
- package/{core → dist/core}/Fade.d.ts +0 -0
- package/{core → dist/core}/Fade.js +8 -17
- package/{core → dist/core}/Grow.d.ts +0 -0
- package/{core → dist/core}/Grow.js +8 -17
- package/{core → dist/core}/Header.d.ts +0 -0
- package/{core → dist/core}/Header.js +10 -20
- package/{core → dist/core}/IconButton.d.ts +0 -0
- package/{core → dist/core}/IconButton.js +7 -16
- package/{core → dist/core}/InputAdornment.d.ts +0 -0
- package/{core → dist/core}/InputAdornment.js +2 -7
- package/{core → dist/core}/InputBase.d.ts +0 -0
- package/{core → dist/core}/InputBase.js +9 -18
- package/{core → dist/core}/Line.d.ts +0 -0
- package/{core → dist/core}/Line.js +8 -29
- package/{core → dist/core}/Link.d.ts +0 -0
- package/{core → dist/core}/Link.js +0 -3
- package/{core → dist/core}/List.d.ts +0 -0
- package/{core → dist/core}/List.js +12 -24
- package/{core → dist/core}/ListItem.d.ts +0 -0
- package/{core → dist/core}/ListItem.js +7 -24
- package/{core → dist/core}/MaskField.d.ts +0 -0
- package/{core → dist/core}/MaskField.js +7 -23
- package/{core → dist/core}/Menu.d.ts +0 -0
- package/{core → dist/core}/Menu.js +9 -18
- package/{core → dist/core}/Node.d.ts +0 -0
- package/{core → dist/core}/Node.js +13 -56
- package/{core → dist/core}/Pagination.d.ts +0 -0
- package/{core → dist/core}/Pagination.js +15 -49
- package/{core → dist/core}/Paper.d.ts +0 -0
- package/{core → dist/core}/Paper.js +8 -17
- package/{core → dist/core}/PinInput.d.ts +0 -0
- package/{core → dist/core}/PinInput.js +18 -66
- package/{core → dist/core}/Progress.d.ts +0 -0
- package/{core → dist/core}/Progress.js +8 -18
- package/{core → dist/core}/Radio.d.ts +0 -0
- package/{core → dist/core}/Radio.js +6 -15
- package/{core → dist/core}/RadioGroup.d.ts +0 -0
- package/{core → dist/core}/RadioGroup.js +16 -29
- package/{core → dist/core}/Select.d.ts +0 -0
- package/{core → dist/core}/Select.js +12 -27
- package/{core → dist/core}/Sidebar.d.ts +0 -0
- package/{core → dist/core}/Sidebar.js +32 -60
- package/{core → dist/core}/Slide.d.ts +0 -0
- package/{core → dist/core}/Slide.js +10 -19
- package/{core → dist/core}/Slider.d.ts +0 -0
- package/{core → dist/core}/Slider.js +8 -17
- package/{core → dist/core}/Snackbar.d.ts +0 -0
- package/{core → dist/core}/Snackbar.js +21 -43
- package/{core → dist/core}/Stepper.d.ts +0 -0
- package/{core → dist/core}/Stepper.js +16 -38
- package/{core → dist/core}/StylesProvider.d.ts +0 -0
- package/{core → dist/core}/StylesProvider.js +0 -2
- package/{core → dist/core}/Tab.d.ts +0 -0
- package/{core → dist/core}/Tab.js +12 -30
- package/{core → dist/core}/Table.d.ts +0 -0
- package/{core → dist/core}/Table.js +8 -18
- package/{core → dist/core}/TableBody.d.ts +0 -0
- package/{core → dist/core}/TableBody.js +7 -16
- package/{core → dist/core}/TableCell.d.ts +0 -0
- package/dist/core/TableCell.js +50 -0
- package/{core → dist/core}/TableHead.d.ts +0 -0
- package/dist/core/TableHead.js +75 -0
- package/{core → dist/core}/TableRow.d.ts +0 -0
- package/{core → dist/core}/TableRow.js +8 -18
- package/{core → dist/core}/Tabs.d.ts +0 -0
- package/dist/core/Tabs.js +41 -0
- package/{core → dist/core}/TextField.d.ts +0 -0
- package/{core → dist/core}/TextField.js +28 -84
- package/{core → dist/core}/ThemeProvider.d.ts +0 -0
- package/{core → dist/core}/ThemeProvider.js +2 -7
- package/{core → dist/core}/Tooltip.d.ts +0 -0
- package/{core → dist/core}/Tooltip.js +9 -18
- package/{core → dist/core}/Tree.d.ts +0 -0
- package/{core → dist/core}/Tree.js +6 -21
- package/{core → dist/core}/Typography.d.ts +0 -0
- package/{core → dist/core}/Typography.js +10 -19
- package/{core → dist/core}/Zoom.d.ts +0 -0
- package/{core → dist/core}/Zoom.js +8 -17
- package/{core → dist/core}/types.d.ts +0 -0
- package/dist/core/types.js +5 -0
- package/{icons → dist/icons}/index.d.ts +0 -0
- package/{icons → dist/icons}/index.js +0 -2
- package/{index.d.ts → dist/index.d.ts} +0 -0
- package/{index.js → dist/index.js} +30 -92
- package/{lab → dist/lab}/Autocomplete.d.ts +0 -0
- package/{lab → dist/lab}/Autocomplete.js +17 -27
- package/{lab → dist/lab}/index.d.ts +0 -0
- package/{lab → dist/lab}/index.js +0 -2
- package/{lib → dist/lib}/localization.d.ts +0 -0
- package/{lib → dist/lib}/localization.js +0 -4
- package/{stories → dist/stories}/Advertise.stories.js +1 -7
- package/{stories → dist/stories}/AutoComplete.stories.js +1 -15
- package/{stories → dist/stories}/AutoCompleteLab.stories.js +1 -10
- package/{stories → dist/stories}/Avatar.stories.js +1 -7
- package/{stories → dist/stories}/Badge.stories.js +1 -8
- package/{stories → dist/stories}/Box.stories.js +1 -7
- package/{stories → dist/stories}/Breadcrumb.stories.js +1 -8
- package/{stories → dist/stories}/Button.stories.js +3 -13
- package/{stories → dist/stories}/Card.stories.js +4 -10
- package/{stories → dist/stories}/Chapter.stories.js +1 -7
- package/{stories → dist/stories}/Checkbox.stories.js +1 -8
- package/{stories → dist/stories}/Chip.stories.js +3 -14
- package/dist/stories/ChipField.stories.js +49 -0
- package/{stories → dist/stories}/Collapse.stories.js +10 -21
- package/{stories → dist/stories}/Container.stories.js +1 -7
- package/{stories → dist/stories}/Content.stories.js +1 -7
- package/{stories → dist/stories}/DataTable.stories.js +67 -124
- package/{stories → dist/stories}/DataTableQueryPaginated.stories.js +43 -108
- package/{stories → dist/stories}/Dialog.stories.js +13 -29
- package/{stories → dist/stories}/Divider.stories.js +1 -13
- package/{stories → dist/stories}/Drawer.stories.js +7 -19
- package/{stories → dist/stories}/EditTable.stories.js +1 -10
- package/{stories → dist/stories}/ExpansionPanel.stories.js +1 -10
- package/{stories → dist/stories}/Fab.stories.js +1 -7
- package/dist/stories/Fade.stories.js +44 -0
- package/dist/stories/Grow.stories.js +53 -0
- package/{stories → dist/stories}/Header.stories.js +1 -7
- package/{stories → dist/stories}/IconButton.stories.js +1 -8
- package/{stories → dist/stories}/InputAdornment.stories.js +1 -7
- package/{stories → dist/stories}/InputBase.stories.js +1 -7
- package/{stories → dist/stories}/Line.stories.js +1 -7
- package/{stories → dist/stories}/List.stories.js +1 -10
- package/{stories → dist/stories}/MaskField.stories.js +1 -9
- package/{stories → dist/stories}/Menu.stories.js +7 -19
- package/{stories → dist/stories}/Node.stories.js +1 -7
- package/{stories → dist/stories}/Pagination.stories.js +1 -7
- package/{stories → dist/stories}/Paper.stories.js +3 -15
- package/{stories → dist/stories}/PinInput.stories.js +25 -73
- package/{stories → dist/stories}/Progress.stories.js +3 -12
- package/{stories → dist/stories}/Radio.stories.js +3 -12
- package/dist/stories/RadioGroup.stories.js +40 -0
- package/{stories → dist/stories}/Select.stories.js +10 -24
- package/{stories → dist/stories}/Sidebar.stories.js +1 -10
- package/{stories → dist/stories}/Slide.stories.js +10 -21
- package/{stories → dist/stories}/Slider.stories.js +1 -8
- package/{stories → dist/stories}/Snackbar.stories.js +11 -22
- package/{stories → dist/stories}/Stepper.stories.js +1 -8
- package/{stories → dist/stories}/Table.stories.js +1 -11
- package/{stories → dist/stories}/Tabs.stories.js +1 -8
- package/{stories → dist/stories}/TextField.stories.js +10 -26
- package/{stories → dist/stories}/Tooltip.stories.js +1 -10
- package/{stories → dist/stories}/Tree.stories.js +1 -7
- package/{stories → dist/stories}/Typography.stories.js +1 -7
- package/dist/stories/Zooms.stories.js +44 -0
- package/dist/tests/CheckBox.test.js +33 -0
- package/logo.png +0 -0
- package/package.json +18 -13
- package/pre-publish.js +14 -0
- package/tsconfig.json +23 -0
- package/core/Box.js +0 -44
- package/core/ChipField.js +0 -47
- package/core/TableCell.js +0 -63
- package/core/TableHead.js +0 -89
- package/core/Tabs.js +0 -50
- package/core/types.js +0 -1
- package/stories/ChipField.stories.js +0 -60
- package/stories/Fade.stories.js +0 -54
- package/stories/Grow.stories.js +0 -63
- package/stories/RadioGroup.stories.js +0 -47
- package/stories/Zooms.stories.js +0 -54
- package/tests/CheckBox.test.js +0 -42
|
@@ -1,61 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
exports
|
|
11
|
-
|
|
8
|
+
exports["default"] = exports.NoPagination = exports.NoHeader = exports.Empty = exports.Default = exports.Crud = void 0;
|
|
12
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _format = _interopRequireDefault(require("date-fns/format"));
|
|
21
|
-
|
|
22
14
|
var _DataTable = _interopRequireDefault(require("../core/DataTable/DataTable"));
|
|
23
|
-
|
|
24
15
|
var _Button = _interopRequireDefault(require("../core/Button"));
|
|
25
|
-
|
|
26
16
|
var _Typography = _interopRequireDefault(require("../core/Typography"));
|
|
27
|
-
|
|
28
17
|
var _DataTableAction = require("../core/DataTable/DataTableAction");
|
|
29
|
-
|
|
30
18
|
var _types = require("../core/DataTable/types");
|
|
31
|
-
|
|
32
19
|
var _Delete = _interopRequireDefault(require("@material-ui/icons/Delete"));
|
|
33
|
-
|
|
34
20
|
var _Edit = _interopRequireDefault(require("@material-ui/icons/Edit"));
|
|
35
|
-
|
|
36
21
|
var _Save = _interopRequireDefault(require("@material-ui/icons/Save"));
|
|
37
|
-
|
|
38
22
|
var _Cancel = _interopRequireDefault(require("@material-ui/icons/Cancel"));
|
|
39
|
-
|
|
40
23
|
var _Check = _interopRequireDefault(require("@material-ui/icons/Check"));
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
45
|
-
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
46
28
|
var _default = {
|
|
47
29
|
title: 'DataTable',
|
|
48
30
|
component: _DataTable["default"]
|
|
49
31
|
};
|
|
50
32
|
exports["default"] = _default;
|
|
51
|
-
|
|
52
33
|
// const Template: ComponentStory<typeof DataTable> = args =>
|
|
53
34
|
// <DataTable { ...args } />
|
|
35
|
+
|
|
54
36
|
var Default = function Default() {
|
|
55
37
|
var date = function date() {
|
|
56
38
|
return new Date();
|
|
57
39
|
};
|
|
58
|
-
|
|
59
40
|
var data = [{
|
|
60
41
|
id: 1,
|
|
61
42
|
product: 'Magazine Magazine Magazine',
|
|
@@ -153,9 +134,7 @@ var Default = function Default() {
|
|
|
153
134
|
columns: columns
|
|
154
135
|
});
|
|
155
136
|
};
|
|
156
|
-
|
|
157
137
|
exports.Default = Default;
|
|
158
|
-
|
|
159
138
|
var Empty = function Empty() {
|
|
160
139
|
var columns = [{
|
|
161
140
|
title: 'Product',
|
|
@@ -177,7 +156,6 @@ var Empty = function Empty() {
|
|
|
177
156
|
return value.toFixed(2).replace('.', ',');
|
|
178
157
|
}
|
|
179
158
|
}];
|
|
180
|
-
|
|
181
159
|
var componentForEmpty = /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", {
|
|
182
160
|
style: {
|
|
183
161
|
display: 'flex',
|
|
@@ -189,7 +167,6 @@ var Empty = function Empty() {
|
|
|
189
167
|
boxSizing: 'border-box'
|
|
190
168
|
}
|
|
191
169
|
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, "Empty DataTable"))));
|
|
192
|
-
|
|
193
170
|
return /*#__PURE__*/_react["default"].createElement(_DataTable["default"], {
|
|
194
171
|
data: [],
|
|
195
172
|
bodyStyle: {
|
|
@@ -204,14 +181,11 @@ var Empty = function Empty() {
|
|
|
204
181
|
columns: columns
|
|
205
182
|
});
|
|
206
183
|
};
|
|
207
|
-
|
|
208
184
|
exports.Empty = Empty;
|
|
209
|
-
|
|
210
185
|
var NoHeader = function NoHeader() {
|
|
211
186
|
var date = function date() {
|
|
212
187
|
return new Date();
|
|
213
188
|
};
|
|
214
|
-
|
|
215
189
|
var data = [{
|
|
216
190
|
id: 1,
|
|
217
191
|
product: 'Magazine Magazine Magazine',
|
|
@@ -311,14 +285,11 @@ var NoHeader = function NoHeader() {
|
|
|
311
285
|
columns: columns
|
|
312
286
|
});
|
|
313
287
|
};
|
|
314
|
-
|
|
315
288
|
exports.NoHeader = NoHeader;
|
|
316
|
-
|
|
317
289
|
var NoPagination = function NoPagination() {
|
|
318
290
|
var date = function date() {
|
|
319
291
|
return new Date();
|
|
320
292
|
};
|
|
321
|
-
|
|
322
293
|
var data = [{
|
|
323
294
|
id: 1,
|
|
324
295
|
product: 'Magazine Magazine Magazine',
|
|
@@ -416,119 +387,104 @@ var NoPagination = function NoPagination() {
|
|
|
416
387
|
columns: columns
|
|
417
388
|
});
|
|
418
389
|
};
|
|
419
|
-
|
|
420
390
|
exports.NoPagination = NoPagination;
|
|
421
|
-
|
|
422
391
|
var Crud = function Crud() {
|
|
423
392
|
var date = function date() {
|
|
424
393
|
return new Date();
|
|
425
394
|
};
|
|
426
|
-
|
|
427
395
|
var controllerRef = (0, _react.useRef)();
|
|
428
|
-
|
|
429
396
|
var _useState = (0, _react.useState)({}),
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
397
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
398
|
+
errors = _useState2[0],
|
|
399
|
+
setErrors = _useState2[1];
|
|
434
400
|
var randomId = function randomId() {
|
|
435
401
|
return Math.random().toString(36).substr(0, 12);
|
|
436
402
|
};
|
|
437
|
-
|
|
438
403
|
var _useState3 = (0, _react.useState)([{
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
404
|
+
id: 1,
|
|
405
|
+
product: 'Magazine',
|
|
406
|
+
price: 13.5,
|
|
407
|
+
quantity: 12,
|
|
408
|
+
date: date()
|
|
409
|
+
}, {
|
|
410
|
+
id: 2,
|
|
411
|
+
product: 'Table',
|
|
412
|
+
price: 200.49,
|
|
413
|
+
quantity: 3,
|
|
414
|
+
date: date()
|
|
415
|
+
}, {
|
|
416
|
+
id: 3,
|
|
417
|
+
product: 'Chair',
|
|
418
|
+
price: 53.5,
|
|
419
|
+
quantity: 9,
|
|
420
|
+
date: date()
|
|
421
|
+
}, {
|
|
422
|
+
id: 4,
|
|
423
|
+
product: 'Keyboard',
|
|
424
|
+
price: 53.29,
|
|
425
|
+
quantity: 4,
|
|
426
|
+
date: date()
|
|
427
|
+
}, {
|
|
428
|
+
id: 5,
|
|
429
|
+
product: 'Mouse',
|
|
430
|
+
price: 27.13,
|
|
431
|
+
quantity: 16,
|
|
432
|
+
date: date()
|
|
433
|
+
}, {
|
|
434
|
+
id: 6,
|
|
435
|
+
product: 'Microphone',
|
|
436
|
+
price: 89.14,
|
|
437
|
+
quantity: 2,
|
|
438
|
+
date: date()
|
|
439
|
+
}, {
|
|
440
|
+
id: 7,
|
|
441
|
+
product: 'Headset',
|
|
442
|
+
price: 117.85,
|
|
443
|
+
quantity: 6,
|
|
444
|
+
date: date()
|
|
445
|
+
}, {
|
|
446
|
+
id: 8,
|
|
447
|
+
product: 'Pencil',
|
|
448
|
+
price: 1.5,
|
|
449
|
+
quantity: 11,
|
|
450
|
+
date: date()
|
|
451
|
+
}]),
|
|
452
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
453
|
+
data = _useState4[0],
|
|
454
|
+
setData = _useState4[1];
|
|
491
455
|
var handleAdd = function handleAdd() {
|
|
492
456
|
controllerRef.current.addRow({
|
|
493
457
|
id: randomId(),
|
|
494
458
|
date: date()
|
|
495
459
|
});
|
|
496
460
|
};
|
|
497
|
-
|
|
498
461
|
var handleEdit = function handleEdit(id) {
|
|
499
462
|
return function () {
|
|
500
463
|
controllerRef.current.editRow(id);
|
|
501
464
|
};
|
|
502
465
|
};
|
|
503
|
-
|
|
504
466
|
var handleDelete = function handleDelete(id) {
|
|
505
467
|
return function () {
|
|
506
468
|
controllerRef.current.pushRowView(id, 'confirmDelete');
|
|
507
469
|
};
|
|
508
470
|
};
|
|
509
|
-
|
|
510
471
|
var handleView = function handleView(id) {
|
|
511
472
|
return function () {
|
|
512
473
|
controllerRef.current.viewRow(id);
|
|
513
474
|
};
|
|
514
475
|
};
|
|
515
|
-
|
|
516
476
|
var isNullable = function isNullable(x) {
|
|
517
477
|
return x == null;
|
|
518
478
|
};
|
|
519
|
-
|
|
520
479
|
var isNotPositive = function isNotPositive(x) {
|
|
521
480
|
return x <= 0;
|
|
522
481
|
};
|
|
523
|
-
|
|
524
482
|
var isAfterNow = function isAfterNow(x) {
|
|
525
483
|
return +x > +new Date();
|
|
526
484
|
};
|
|
527
|
-
|
|
528
485
|
var isEmpty = function isEmpty(x) {
|
|
529
486
|
return x.trim().length === 0;
|
|
530
487
|
};
|
|
531
|
-
|
|
532
488
|
var handleErrors = function handleErrors(id) {
|
|
533
489
|
var nextItem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
534
490
|
var isPartial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
@@ -546,17 +502,14 @@ var Crud = function Crud() {
|
|
|
546
502
|
isErrorIf: [isNaN, isNotPositive]
|
|
547
503
|
}].filter(function (_ref) {
|
|
548
504
|
var field = _ref.field,
|
|
549
|
-
|
|
505
|
+
isErrorIf = _ref.isErrorIf;
|
|
550
506
|
var value = nextItem[field];
|
|
551
|
-
|
|
552
507
|
if (isNullable(value)) {
|
|
553
508
|
if (isPartial) {
|
|
554
509
|
return false;
|
|
555
510
|
}
|
|
556
|
-
|
|
557
511
|
return true;
|
|
558
512
|
}
|
|
559
|
-
|
|
560
513
|
return isErrorIf.some(function (cond) {
|
|
561
514
|
return cond(value);
|
|
562
515
|
});
|
|
@@ -569,20 +522,16 @@ var Crud = function Crud() {
|
|
|
569
522
|
});
|
|
570
523
|
return errorFields.length > 0;
|
|
571
524
|
};
|
|
572
|
-
|
|
573
525
|
var handleSave = function handleSave(id) {
|
|
574
526
|
var isNew = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
575
527
|
return function () {
|
|
576
528
|
var nextItem = controllerRef.current.getEditedRowData(id);
|
|
577
|
-
|
|
578
529
|
if (!nextItem) {
|
|
579
530
|
return;
|
|
580
531
|
}
|
|
581
|
-
|
|
582
532
|
if (handleErrors(id, nextItem, !isNew)) {
|
|
583
533
|
return;
|
|
584
534
|
}
|
|
585
|
-
|
|
586
535
|
if (isNew) {
|
|
587
536
|
setData(function (data) {
|
|
588
537
|
return [nextItem].concat((0, _toConsumableArray2["default"])(data));
|
|
@@ -593,16 +542,13 @@ var Crud = function Crud() {
|
|
|
593
542
|
if (item.id === id) {
|
|
594
543
|
return _objectSpread(_objectSpread({}, item), nextItem);
|
|
595
544
|
}
|
|
596
|
-
|
|
597
545
|
return item;
|
|
598
546
|
});
|
|
599
547
|
});
|
|
600
548
|
}
|
|
601
|
-
|
|
602
549
|
controllerRef.current.viewRow(id);
|
|
603
550
|
};
|
|
604
551
|
};
|
|
605
|
-
|
|
606
552
|
var columns = [{
|
|
607
553
|
title: 'Product',
|
|
608
554
|
field: 'product',
|
|
@@ -647,10 +593,9 @@ var Crud = function Crud() {
|
|
|
647
593
|
},
|
|
648
594
|
renderCell: function renderCell(_ref3) {
|
|
649
595
|
var id = _ref3.data.id,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
596
|
+
rowMode = _ref3.rowMode,
|
|
597
|
+
_ref3$isNew = _ref3.isNew,
|
|
598
|
+
isNew = _ref3$isNew === void 0 ? false : _ref3$isNew;
|
|
654
599
|
if (rowMode === _types.RowMode.View) {
|
|
655
600
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
656
601
|
style: {
|
|
@@ -664,7 +609,6 @@ var Crud = function Crud() {
|
|
|
664
609
|
onClick: handleDelete(id)
|
|
665
610
|
}, /*#__PURE__*/_react["default"].createElement(_Delete["default"], null)));
|
|
666
611
|
}
|
|
667
|
-
|
|
668
612
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
669
613
|
style: {
|
|
670
614
|
display: 'flex'
|
|
@@ -724,8 +668,8 @@ var Crud = function Crud() {
|
|
|
724
668
|
labelRowsPerPage: 'Rows per page:',
|
|
725
669
|
labelDisplayedRows: function labelDisplayedRows(_ref5) {
|
|
726
670
|
var from = _ref5.from,
|
|
727
|
-
|
|
728
|
-
|
|
671
|
+
to = _ref5.to,
|
|
672
|
+
count = _ref5.count;
|
|
729
673
|
return "".concat(from, "-").concat(to, " of ").concat(count !== -1 ? count : "more than ".concat(to));
|
|
730
674
|
}
|
|
731
675
|
},
|
|
@@ -733,5 +677,4 @@ var Crud = function Crud() {
|
|
|
733
677
|
columns: columns
|
|
734
678
|
}));
|
|
735
679
|
};
|
|
736
|
-
|
|
737
680
|
exports.Crud = Crud;
|