@symply.io/basic-components 1.6.3 → 1.6.4-alpha.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/Autocomplete/index.d.ts +1 -1
- package/Autocomplete/index.js +2 -1
- package/Autocomplete/types.d.ts +4 -5
- package/AutocompleteWithFilter/index.d.ts +1 -1
- package/AutocompleteWithFilter/index.js +3 -2
- package/AutocompleteWithFilter/types.d.ts +3 -2
- package/DataTable/TableBodyRow.js +7 -2
- package/DataTable/index.js +2 -2
- package/DataTable/types.d.ts +2 -1
- package/package.json +1 -1
package/Autocomplete/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { AutocompleteProps, AutocompleteValueType, AutocompleteOptionType } from "./types";
|
2
2
|
declare function CustomAutocomplete<T, multiple extends boolean | undefined = false>(props: AutocompleteProps<T, multiple>): import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default CustomAutocomplete;
|
4
|
-
export type { AutocompleteProps, AutocompleteValueType, AutocompleteOptionType };
|
4
|
+
export type { AutocompleteProps, AutocompleteValueType, AutocompleteOptionType, };
|
package/Autocomplete/index.js
CHANGED
@@ -46,6 +46,7 @@ function CustomAutocomplete(props) {
|
|
46
46
|
return opt.label === val.label;
|
47
47
|
}, value: value, inputValue: inputValue, onInputChange: function (event, val) {
|
48
48
|
onInputChange(val);
|
49
|
-
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { required: required, size: size, inputProps: __assign(__assign({}, params.inputProps), { required: required &&
|
49
|
+
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { required: required, size: size, inputProps: __assign(__assign({}, params.inputProps), { required: required &&
|
50
|
+
(Array.isArray(value) ? value.length === 0 : !value) }) }))); } }) })));
|
50
51
|
}
|
51
52
|
export default CustomAutocomplete;
|
package/Autocomplete/types.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import type { CSSProperties } from "react";
|
2
2
|
import type { TextFieldProps } from "@mui/material/TextField";
|
3
|
-
|
4
|
-
|
5
|
-
}> = T & {
|
3
|
+
import type { AutocompleteValue } from "@mui/base/AutocompleteUnstyled";
|
4
|
+
export declare type AutocompleteOptionType<T = Record<string, any>> = T & {
|
6
5
|
label: string;
|
7
6
|
value?: string | number;
|
8
7
|
};
|
@@ -13,8 +12,8 @@ export interface AutocompleteProps<T, multiple extends boolean | undefined> exte
|
|
13
12
|
disabled?: boolean;
|
14
13
|
loading?: boolean;
|
15
14
|
options: Array<AutocompleteOptionType<T>>;
|
16
|
-
value:
|
15
|
+
value: AutocompleteValue<AutocompleteOptionType<T>, multiple, undefined, undefined>;
|
17
16
|
primaryColor?: CSSProperties["color"];
|
18
17
|
secondaryColor?: CSSProperties["color"];
|
19
|
-
onChange: (value:
|
18
|
+
onChange: (value: AutocompleteValue<AutocompleteOptionType<T>, multiple, undefined, undefined>) => void;
|
20
19
|
}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { AutocompleteWithFilterProps, AutocompleteWithFilterValueType, AutocompleteWithFilterOptionType } from "./types";
|
2
2
|
declare function AutocompleteWithFilter<T, multiple extends boolean | undefined = false>(props: AutocompleteWithFilterProps<T, multiple>): import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default AutocompleteWithFilter;
|
4
|
-
export type { AutocompleteWithFilterProps, AutocompleteWithFilterValueType, AutocompleteWithFilterOptionType };
|
4
|
+
export type { AutocompleteWithFilterProps, AutocompleteWithFilterValueType, AutocompleteWithFilterOptionType, };
|
@@ -36,7 +36,7 @@ function AutocompleteWithFilter(props) {
|
|
36
36
|
ignoreCase: true,
|
37
37
|
ignoreAccents: true,
|
38
38
|
trim: true,
|
39
|
-
stringify: function (option) { return option.label; }
|
39
|
+
stringify: function (option) { return option.label; },
|
40
40
|
});
|
41
41
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
42
42
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, loading: loading, limitTags: limitTags !== null && limitTags !== void 0 ? limitTags : -1, options: options, disabled: disabled, multiple: multiple, filterOptions: filter, onChange: function (event, val) {
|
@@ -54,6 +54,7 @@ function AutocompleteWithFilter(props) {
|
|
54
54
|
var _b, _c;
|
55
55
|
var selected = _a.selected;
|
56
56
|
return (_jsxs("li", __assign({}, __assign(__assign({}, props), { key: (_c = (_b = option.value) !== null && _b !== void 0 ? _b : option.label) !== null && _c !== void 0 ? _c : option }), { children: [_jsx(Checkbox, { icon: icon, color: "primary", checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), option.label || ""] })));
|
57
|
-
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { variant: "outlined", required: required, inputProps: __assign(__assign({}, params.inputProps), { required: required &&
|
57
|
+
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { variant: "outlined", required: required, inputProps: __assign(__assign({}, params.inputProps), { required: required &&
|
58
|
+
(Array.isArray(value) ? value.length === 0 : !value) }) }))); } }) })));
|
58
59
|
}
|
59
60
|
export default AutocompleteWithFilter;
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { CSSProperties } from "react";
|
2
2
|
import type { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
import type { AutocompleteValue } from "@mui/base/AutocompleteUnstyled";
|
3
4
|
export declare type AutocompleteWithFilterOptionType<T> = T & {
|
4
5
|
label: string;
|
5
6
|
value?: string | number;
|
6
7
|
};
|
7
8
|
export declare type AutocompleteWithFilterValueType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteWithFilterOptionType<T> | null : Array<AutocompleteWithFilterOptionType<T>>;
|
8
9
|
export interface AutocompleteWithFilterProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange" | "value" | "disabled"> {
|
9
|
-
value:
|
10
|
+
value: AutocompleteValue<AutocompleteWithFilterOptionType<T>, multiple, undefined, undefined>;
|
10
11
|
options: Array<AutocompleteWithFilterOptionType<T>>;
|
11
12
|
disableCloseOnSelect?: boolean;
|
12
13
|
limitTags?: number;
|
@@ -15,5 +16,5 @@ export interface AutocompleteWithFilterProps<T, multiple extends boolean | undef
|
|
15
16
|
loading?: boolean;
|
16
17
|
primaryColor?: CSSProperties["color"];
|
17
18
|
secondaryColor?: CSSProperties["color"];
|
18
|
-
onChange: (value:
|
19
|
+
onChange: (value: AutocompleteValue<AutocompleteWithFilterOptionType<T>, multiple, undefined, undefined>) => void;
|
19
20
|
}
|
@@ -16,7 +16,7 @@ import TableCell from "@mui/material/TableCell";
|
|
16
16
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
17
17
|
import useTheme from "@mui/material/styles/useTheme";
|
18
18
|
function TableBodyRow(props) {
|
19
|
-
var row = props.row, rows = props.rows, columns = props.columns, rowIndex = props.rowIndex, leftShadowVisible = props.leftShadowVisible, rightShadowVisible = props.rightShadowVisible, onRowClick = props.onRowClick, onCustomizeRowBgColor = props.onCustomizeRowBgColor;
|
19
|
+
var row = props.row, rows = props.rows, columns = props.columns, rowIndex = props.rowIndex, leftShadowVisible = props.leftShadowVisible, rightShadowVisible = props.rightShadowVisible, onRowClick = props.onRowClick, onContextMenu = props.onContextMenu, onCustomizeRowBgColor = props.onCustomizeRowBgColor;
|
20
20
|
var _a = useState(), rowEl = _a[0], setRowEl = _a[1];
|
21
21
|
var theme = useTheme();
|
22
22
|
var isUpMd = useMediaQuery(theme.breakpoints.up("md"));
|
@@ -56,7 +56,12 @@ function TableBodyRow(props) {
|
|
56
56
|
? function () {
|
57
57
|
onRowClick(row);
|
58
58
|
}
|
59
|
-
: undefined
|
59
|
+
: undefined, onContextMenu: function (event) {
|
60
|
+
event.preventDefault();
|
61
|
+
if (onContextMenu) {
|
62
|
+
onContextMenu(event, row);
|
63
|
+
}
|
64
|
+
} }, { children: [fixedLeftCols.map(function (col, index) {
|
60
65
|
var accessor = col.accessor, Cell = col.Cell, width = col.width, _a = col.align, align = _a === void 0 ? "center" : _a;
|
61
66
|
var left = fixedLeftCols
|
62
67
|
.slice(0, index)
|
package/DataTable/index.js
CHANGED
@@ -20,7 +20,7 @@ import TableBody from "./TableBody";
|
|
20
20
|
import TableHeader from "./TableHeader";
|
21
21
|
import TableFooter from "./TableFooter";
|
22
22
|
function DataTable(props) {
|
23
|
-
var _a = props.columns, columns = _a === void 0 ? [] : _a, _b = props.rows, rows = _b === void 0 ? [] : _b, _c = props.headers, headers = _c === void 0 ? [] : _c, _d = props.footers, footers = _d === void 0 ? [] : _d, _e = props.noDataText, noDataText = _e === void 0 ? "No Data!" : _e, dense = props.dense, stickyHeader = props.stickyHeader, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onRowClick = props.onRowClick, onCustomizeRowBgColor = props.onCustomizeRowBgColor;
|
23
|
+
var _a = props.columns, columns = _a === void 0 ? [] : _a, _b = props.rows, rows = _b === void 0 ? [] : _b, _c = props.headers, headers = _c === void 0 ? [] : _c, _d = props.footers, footers = _d === void 0 ? [] : _d, _e = props.noDataText, noDataText = _e === void 0 ? "No Data!" : _e, dense = props.dense, stickyHeader = props.stickyHeader, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onRowClick = props.onRowClick, onContextMenu = props.onContextMenu, onCustomizeRowBgColor = props.onCustomizeRowBgColor;
|
24
24
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
25
25
|
var tableRef = useRef(null);
|
26
26
|
var _f = useState(false), leftShadowVisible = _f[0], setLeftShadowVisible = _f[1];
|
@@ -55,7 +55,7 @@ function DataTable(props) {
|
|
55
55
|
borderRadius: "4px",
|
56
56
|
borderCollapse: "unset !important",
|
57
57
|
transition: "all 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"
|
58
|
-
} }, { children: _jsxs(Table, __assign({ sx: { minWidth: 600, tableLayout: "fixed" }, stickyHeader: stickyHeader, size: dense ? "small" : "medium" }, { children: [_jsx(TableHeader, { headers: headers, noData: rows.length === 0, leftShadowVisible: leftShadowVisible, rightShadowVisible: rightShadowVisible }), _jsx(TableBody, { rows: rows, columns: columns, noDataText: noDataText, onRowClick: onRowClick, onCustomizeRowBgColor: onCustomizeRowBgColor, leftShadowVisible: leftShadowVisible, rightShadowVisible: rightShadowVisible }), footers.length > 0 ? (_jsx(TableFooter, { footers: footers, noData: rows.length === 0, leftShadowVisible: leftShadowVisible, rightShadowVisible: rightShadowVisible })) : (_jsx(_Fragment, {}))] })) })) })));
|
58
|
+
} }, { children: _jsxs(Table, __assign({ sx: { minWidth: 600, tableLayout: "fixed" }, stickyHeader: stickyHeader, size: dense ? "small" : "medium" }, { children: [_jsx(TableHeader, { headers: headers, noData: rows.length === 0, leftShadowVisible: leftShadowVisible, rightShadowVisible: rightShadowVisible }), _jsx(TableBody, { rows: rows, columns: columns, noDataText: noDataText, onRowClick: onRowClick, onContextMenu: onContextMenu, onCustomizeRowBgColor: onCustomizeRowBgColor, leftShadowVisible: leftShadowVisible, rightShadowVisible: rightShadowVisible }), footers.length > 0 ? (_jsx(TableFooter, { footers: footers, noData: rows.length === 0, leftShadowVisible: leftShadowVisible, rightShadowVisible: rightShadowVisible })) : (_jsx(_Fragment, {}))] })) })) })));
|
59
59
|
}
|
60
60
|
export default DataTable;
|
61
61
|
export * from "./types";
|
package/DataTable/types.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ReactElement, CSSProperties } from "react";
|
1
|
+
import { ReactElement, CSSProperties, MouseEvent } from "react";
|
2
2
|
declare type HexColor = `#${string}`;
|
3
3
|
export declare type CustomRowBgColor = {
|
4
4
|
normal?: HexColor;
|
@@ -63,6 +63,7 @@ export declare type TableBodyProps<RowProps extends KvProps, ExtendedProps exten
|
|
63
63
|
rightShadowVisible?: boolean;
|
64
64
|
noDataText?: string;
|
65
65
|
onRowClick?: (row: RowProps) => unknown;
|
66
|
+
onContextMenu?: (event: MouseEvent<HTMLTableRowElement>, row: RowProps) => unknown;
|
66
67
|
onCustomizeRowBgColor?: ({ row, columns }: {
|
67
68
|
row: RowProps;
|
68
69
|
columns: Array<TableBodyCellProps<RowProps, ExtendedProps>>;
|