@vendorflow/components 2.0.54 → 2.0.58
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/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +3 -1
- package/lib/components/material-ui/DataTable/DataTable.d.ts +2 -1
- package/lib/components/material-ui/DataTable/DataTable.js +2 -2
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.d.ts +7 -0
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.js +20 -0
- package/lib/components/material-ui/ErrorBoundary/index.d.ts +1 -0
- package/lib/components/material-ui/ErrorBoundary/index.js +8 -0
- package/lib/components/material-ui/InputDate/InputDate.js +14 -3
- package/package.json +2 -1
|
@@ -3,6 +3,7 @@ export { default as Button } from './material-ui/Button';
|
|
|
3
3
|
export { default as ButtonMenu } from './material-ui/ButtonMenu';
|
|
4
4
|
export { default as ColorPicker } from './material-ui/ColorPicker';
|
|
5
5
|
export { default as DataTable } from './material-ui/DataTable';
|
|
6
|
+
export { default as ErrorBoundary } from './material-ui/ErrorBoundary';
|
|
6
7
|
export { default as InputDate } from './material-ui/InputDate';
|
|
7
8
|
export { default as InputDateTime } from './material-ui/InputDateTime';
|
|
8
9
|
export { default as InputGroup } from './material-ui/InputGroup';
|
package/lib/components/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Modal = exports.InputTime = exports.InputSearchDropdown = exports.InputRadioGroup = exports.InputCheckboxGroup = exports.InputGroup = exports.InputDateTime = exports.InputDate = exports.DataTable = exports.ColorPicker = exports.ButtonMenu = exports.Button = exports.AudioPlayer = void 0;
|
|
6
|
+
exports.Modal = exports.InputTime = exports.InputSearchDropdown = exports.InputRadioGroup = exports.InputCheckboxGroup = exports.InputGroup = exports.InputDateTime = exports.InputDate = exports.ErrorBoundary = exports.DataTable = exports.ColorPicker = exports.ButtonMenu = exports.Button = exports.AudioPlayer = void 0;
|
|
7
7
|
var AudioPlayer_1 = require("./material-ui/AudioPlayer");
|
|
8
8
|
Object.defineProperty(exports, "AudioPlayer", { enumerable: true, get: function () { return __importDefault(AudioPlayer_1).default; } });
|
|
9
9
|
var Button_1 = require("./material-ui/Button");
|
|
@@ -14,6 +14,8 @@ var ColorPicker_1 = require("./material-ui/ColorPicker");
|
|
|
14
14
|
Object.defineProperty(exports, "ColorPicker", { enumerable: true, get: function () { return __importDefault(ColorPicker_1).default; } });
|
|
15
15
|
var DataTable_1 = require("./material-ui/DataTable");
|
|
16
16
|
Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return __importDefault(DataTable_1).default; } });
|
|
17
|
+
var ErrorBoundary_1 = require("./material-ui/ErrorBoundary");
|
|
18
|
+
Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return __importDefault(ErrorBoundary_1).default; } });
|
|
17
19
|
var InputDate_1 = require("./material-ui/InputDate");
|
|
18
20
|
Object.defineProperty(exports, "InputDate", { enumerable: true, get: function () { return __importDefault(InputDate_1).default; } });
|
|
19
21
|
var InputDateTime_1 = require("./material-ui/InputDateTime");
|
|
@@ -48,6 +48,7 @@ export interface TableFeatureOptions<D extends object> {
|
|
|
48
48
|
}
|
|
49
49
|
interface Props<D extends object> {
|
|
50
50
|
title?: string;
|
|
51
|
+
'data-testid'?: string;
|
|
51
52
|
labels?: {
|
|
52
53
|
noMatchLabel?: string;
|
|
53
54
|
noMatchColSpan?: number;
|
|
@@ -58,7 +59,7 @@ interface Props<D extends object> {
|
|
|
58
59
|
renderActions?: () => ReactNode;
|
|
59
60
|
renderRowSelectActions?: () => ReactNode;
|
|
60
61
|
}
|
|
61
|
-
export default function DataTable<D extends object>({ title, labels, columns, instance, options, renderActions, renderRowSelectActions, }: Props<D>): JSX.Element;
|
|
62
|
+
export default function DataTable<D extends object>({ title, labels, columns, instance, options, renderActions, renderRowSelectActions, ...restOfProps }: Props<D>): JSX.Element;
|
|
62
63
|
export declare function usePluginConfig<D extends object>(options: TableFeatureOptions<D>): PluginHook<D>[];
|
|
63
64
|
export interface UseDefaultTableInstanceProps<D extends object> {
|
|
64
65
|
columns: EnhancedColumn<D>[];
|
|
@@ -97,7 +97,7 @@ var EXPAND_BTN_WIDTH = 24;
|
|
|
97
97
|
var NO_MATCH_TEXT = 'Sorry, no matching records found';
|
|
98
98
|
function DataTable(_a) {
|
|
99
99
|
var _b;
|
|
100
|
-
var title = _a.title, labels = _a.labels, columns = _a.columns, instance = _a.instance, options = _a.options, renderActions = _a.renderActions, renderRowSelectActions = _a.renderRowSelectActions;
|
|
100
|
+
var title = _a.title, labels = _a.labels, columns = _a.columns, instance = _a.instance, options = _a.options, renderActions = _a.renderActions, renderRowSelectActions = _a.renderRowSelectActions, restOfProps = __rest(_a, ["title", "labels", "columns", "instance", "options", "renderActions", "renderRowSelectActions"]);
|
|
101
101
|
var _c = labels || { noMatchLabel: NO_MATCH_TEXT }, _d = _c.noMatchLabel, noMatchLabel = _d === void 0 ? NO_MATCH_TEXT : _d, noMatchColSpan = _c.noMatchColSpan;
|
|
102
102
|
var _e = options || {}, rowExpandingConfig = _e.rowExpanding, filtersConfig = _e.filters, globalSearchConfig = _e.globalSearch, columnHidingConfig = _e.columnHiding, paginationConfig = _e.pagination, rowSelectConfig = _e.rowSelect, sortingConfig = _e.sorting;
|
|
103
103
|
var ExpandedComponent = (rowExpandingConfig || {}).Component;
|
|
@@ -139,7 +139,7 @@ function DataTable(_a) {
|
|
|
139
139
|
var tableRows = (paginationConfig === null || paginationConfig === void 0 ? void 0 : paginationConfig.enabled) ? page : rows;
|
|
140
140
|
return ((0, react_1.jsx)(react_1.ClassNames, null, function (_a) {
|
|
141
141
|
var css = _a.css, cx = _a.cx;
|
|
142
|
-
return ((0, react_1.jsx)(material_1.Paper, { css: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n position: relative;\n "], ["\n width: 100%;\n position: relative;\n "]))) },
|
|
142
|
+
return ((0, react_1.jsx)(material_1.Paper, __assign({ css: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n position: relative;\n "], ["\n width: 100%;\n position: relative;\n "]))), className: "vendorflow-table" }, restOfProps),
|
|
143
143
|
(0, react_1.jsx)("div", null,
|
|
144
144
|
(0, react_1.jsx)(Toolbar_1.default, { title: title, allColumns: allColumns, columnNameById: columnNameById, globalFilter: globalFilter, enableFilters: filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.enabled, enableGlobalSearch: globalSearchConfig === null || globalSearchConfig === void 0 ? void 0 : globalSearchConfig.enabled, enableHideColumns: columnHidingConfig === null || columnHidingConfig === void 0 ? void 0 : columnHidingConfig.enabled, hasRowsSelected: hasRowsSelected, numRowsSelected: numRowsSelected, setAllFilters: setAllFilters, setGlobalFilter: (globalSearchConfig === null || globalSearchConfig === void 0 ? void 0 : globalSearchConfig.setGlobalFilter) ? globalSearchConfig === null || globalSearchConfig === void 0 ? void 0 : globalSearchConfig.setGlobalFilter : setGlobalFilter, renderActions: renderActions, renderRowSelectActions: renderRowSelectActions }),
|
|
145
145
|
(filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.enabled) && ((0, react_1.jsx)(AppliedFilters_1.default, { columnNameById: columnNameById, filters: filters, setFilter: setFilter }))),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
/** @jsx jsx */
|
|
8
|
+
var react_1 = require("@emotion/react");
|
|
9
|
+
var material_1 = require("@mui/material");
|
|
10
|
+
var react_error_boundary_1 = require("react-error-boundary");
|
|
11
|
+
function ErrorFallback(_a) {
|
|
12
|
+
var resetErrorBoundary = _a.resetErrorBoundary;
|
|
13
|
+
return ((0, react_1.jsx)(material_1.Alert, { css: (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "]))), severity: "error", action: (0, react_1.jsx)(material_1.Button, { color: "inherit", size: "small", onClick: resetErrorBoundary }, "Reload") }, "Something went wrong when trying to load this view's data. Please try to reload the data again."));
|
|
14
|
+
}
|
|
15
|
+
function ErrorBoundary(_a) {
|
|
16
|
+
var children = _a.children, onReset = _a.onReset;
|
|
17
|
+
return ((0, react_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: onReset }, children));
|
|
18
|
+
}
|
|
19
|
+
exports.default = ErrorBoundary;
|
|
20
|
+
var templateObject_1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ErrorBoundary';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ErrorBoundary_1 = require("./ErrorBoundary");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ErrorBoundary_1).default; } });
|
|
@@ -61,20 +61,31 @@ var react_1 = __importStar(require("react"));
|
|
|
61
61
|
var date_fns_1 = require("date-fns");
|
|
62
62
|
var lab_1 = require("@mui/lab");
|
|
63
63
|
var material_1 = require("@mui/material");
|
|
64
|
+
var lodash_1 = require("lodash");
|
|
64
65
|
function InputDate(props) {
|
|
65
66
|
var _a = props.clearable, clearable = _a === void 0 ? true : _a, label = props.label, name = props.name, onChange = props.onChange, _b = props.inputFormat, inputFormat = _b === void 0 ? 'MM/dd/yyyy' : _b, _c = props.InputProps, InputProps = _c === void 0 ? {} : _c, restOfProps = __rest(props, ["clearable", "label", "name", "onChange", "inputFormat", "InputProps"]);
|
|
66
67
|
var _d = __read((0, react_1.useState)(null), 2), value = _d[0], setValue = _d[1];
|
|
67
68
|
(0, react_1.useEffect)(function () {
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
var datetime = convertToDateTime(props.value);
|
|
70
|
+
if (((0, lodash_1.isNull)(value) && !(0, lodash_1.isNull)(datetime)) ||
|
|
71
|
+
(!(0, lodash_1.isNull)(value) && (0, lodash_1.isNull)(datetime)) ||
|
|
72
|
+
(value && !(0, date_fns_1.isSameDay)(datetime, value))) {
|
|
73
|
+
setValue(datetime);
|
|
70
74
|
}
|
|
71
75
|
}, [props.value]);
|
|
72
76
|
function handleOnChange(date) {
|
|
73
77
|
setValue(date);
|
|
74
78
|
if (date === null || (0, date_fns_1.isValid)(date)) {
|
|
75
|
-
|
|
79
|
+
var localDate = convertToLocalDate(date);
|
|
80
|
+
onChange({ target: { name: name, value: localDate } });
|
|
76
81
|
}
|
|
77
82
|
}
|
|
83
|
+
function convertToLocalDate(date) {
|
|
84
|
+
return date && (0, date_fns_1.isValid)(date) ? (0, date_fns_1.formatISO)(date, { representation: 'date' }) : null;
|
|
85
|
+
}
|
|
86
|
+
function convertToDateTime(date) {
|
|
87
|
+
return date ? (0, date_fns_1.parseISO)(date) : null;
|
|
88
|
+
}
|
|
78
89
|
return (react_1.default.createElement(lab_1.DatePicker, __assign({}, restOfProps, { clearable: clearable, inputFormat: inputFormat, renderInput: function (params) { return react_1.default.createElement(material_1.TextField, __assign({}, params, InputProps, { size: (InputProps === null || InputProps === void 0 ? void 0 : InputProps.size) || 'small' })); }, label: label, onChange: handleOnChange, value: value })));
|
|
79
90
|
}
|
|
80
91
|
exports.default = InputDate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendorflow/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.58",
|
|
4
4
|
"description": "React components for vendorflow",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -112,6 +112,7 @@
|
|
|
112
112
|
"react-color-palette": "^6.1.0",
|
|
113
113
|
"react-dev-utils": "^10.2.1",
|
|
114
114
|
"react-dom": "^17.0.2",
|
|
115
|
+
"react-error-boundary": "^3.1.4",
|
|
115
116
|
"react-h5-audio-player": "^3.8.1",
|
|
116
117
|
"react-measure": "^2.5.2",
|
|
117
118
|
"react-scripts": "^4.0.3",
|