@bluemarble/bm-components 1.9.4 → 1.10.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/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +41 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -327,6 +327,10 @@ declare class HttpError extends Error {
|
|
|
327
327
|
constructor(status: number, message: any);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
declare class DomainError extends Error {
|
|
331
|
+
constructor(message: any);
|
|
332
|
+
}
|
|
333
|
+
|
|
330
334
|
type PossibleMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'ALL';
|
|
331
335
|
type HandlerProps<UserKeyType> = (req: NextApiRequest & {
|
|
332
336
|
user?: UserKeyType;
|
|
@@ -540,4 +544,4 @@ declare function CreateAuthProvider<T>({ api, children, sessionTokenName, Provid
|
|
|
540
544
|
sessionTokenName: string;
|
|
541
545
|
}): React__default.JSX.Element;
|
|
542
546
|
|
|
543
|
-
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
|
547
|
+
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, DomainError, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
package/dist/index.d.ts
CHANGED
|
@@ -327,6 +327,10 @@ declare class HttpError extends Error {
|
|
|
327
327
|
constructor(status: number, message: any);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
declare class DomainError extends Error {
|
|
331
|
+
constructor(message: any);
|
|
332
|
+
}
|
|
333
|
+
|
|
330
334
|
type PossibleMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'ALL';
|
|
331
335
|
type HandlerProps<UserKeyType> = (req: NextApiRequest & {
|
|
332
336
|
user?: UserKeyType;
|
|
@@ -540,4 +544,4 @@ declare function CreateAuthProvider<T>({ api, children, sessionTokenName, Provid
|
|
|
540
544
|
sessionTokenName: string;
|
|
541
545
|
}): React__default.JSX.Element;
|
|
542
546
|
|
|
543
|
-
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
|
547
|
+
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, DomainError, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
package/dist/index.js
CHANGED
|
@@ -2919,7 +2919,7 @@ var _moment = require('moment'); var _moment2 = _interopRequireDefault(_moment);
|
|
|
2919
2919
|
var DefaultInput = (allProps) => {
|
|
2920
2920
|
var _a;
|
|
2921
2921
|
const {
|
|
2922
|
-
TextFieldProps:
|
|
2922
|
+
TextFieldProps: TextFieldProps3,
|
|
2923
2923
|
onSave,
|
|
2924
2924
|
name,
|
|
2925
2925
|
onUpdateValue,
|
|
@@ -2973,7 +2973,7 @@ var DefaultInput = (allProps) => {
|
|
|
2973
2973
|
defaultValue: formatDefaultValue(rowData == null ? void 0 : rowData[name]),
|
|
2974
2974
|
sx: __spreadValues({
|
|
2975
2975
|
width: fullWidth ? "100%" : "intial"
|
|
2976
|
-
},
|
|
2976
|
+
}, TextFieldProps3 == null ? void 0 : TextFieldProps3.sx),
|
|
2977
2977
|
inputProps: {
|
|
2978
2978
|
style: {
|
|
2979
2979
|
paddingBottom: 6,
|
|
@@ -2981,13 +2981,13 @@ var DefaultInput = (allProps) => {
|
|
|
2981
2981
|
},
|
|
2982
2982
|
onKeyDown
|
|
2983
2983
|
},
|
|
2984
|
-
InputProps: __spreadProps(__spreadValues({},
|
|
2984
|
+
InputProps: __spreadProps(__spreadValues({}, TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps), {
|
|
2985
2985
|
sx: __spreadValues({
|
|
2986
2986
|
fontSize: 14,
|
|
2987
2987
|
pl: 0.2
|
|
2988
|
-
}, (_a =
|
|
2988
|
+
}, (_a = TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps) == null ? void 0 : _a.sx)
|
|
2989
2989
|
})
|
|
2990
|
-
},
|
|
2990
|
+
}, TextFieldProps3)
|
|
2991
2991
|
);
|
|
2992
2992
|
};
|
|
2993
2993
|
|
|
@@ -2998,7 +2998,7 @@ var _reactimask = require('react-imask');
|
|
|
2998
2998
|
var InputMask = (allProps) => {
|
|
2999
2999
|
var _a;
|
|
3000
3000
|
const {
|
|
3001
|
-
TextFieldProps:
|
|
3001
|
+
TextFieldProps: TextFieldProps3,
|
|
3002
3002
|
onSave,
|
|
3003
3003
|
name,
|
|
3004
3004
|
rowData,
|
|
@@ -3045,7 +3045,7 @@ var InputMask = (allProps) => {
|
|
|
3045
3045
|
size: "small",
|
|
3046
3046
|
sx: __spreadValues({
|
|
3047
3047
|
width: fullWidth ? "100%" : "intial"
|
|
3048
|
-
},
|
|
3048
|
+
}, TextFieldProps3 == null ? void 0 : TextFieldProps3.sx),
|
|
3049
3049
|
inputProps: {
|
|
3050
3050
|
style: {
|
|
3051
3051
|
paddingBottom: 6,
|
|
@@ -3053,20 +3053,20 @@ var InputMask = (allProps) => {
|
|
|
3053
3053
|
},
|
|
3054
3054
|
onKeyDown
|
|
3055
3055
|
},
|
|
3056
|
-
InputProps: __spreadProps(__spreadValues({},
|
|
3056
|
+
InputProps: __spreadProps(__spreadValues({}, TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps), {
|
|
3057
3057
|
sx: __spreadValues({
|
|
3058
3058
|
fontSize: 14,
|
|
3059
3059
|
pl: 0.2
|
|
3060
|
-
}, (_a =
|
|
3060
|
+
}, (_a = TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps) == null ? void 0 : _a.sx)
|
|
3061
3061
|
})
|
|
3062
|
-
},
|
|
3062
|
+
}, TextFieldProps3)
|
|
3063
3063
|
);
|
|
3064
3064
|
};
|
|
3065
3065
|
|
|
3066
3066
|
// src/components/Grid/EditableTableCell/index.tsx
|
|
3067
3067
|
var EditableTableCell = (allProps) => {
|
|
3068
3068
|
const _a = allProps, {
|
|
3069
|
-
TextFieldProps:
|
|
3069
|
+
TextFieldProps: TextFieldProps3,
|
|
3070
3070
|
onSave = () => {
|
|
3071
3071
|
},
|
|
3072
3072
|
onCancel,
|
|
@@ -3356,6 +3356,7 @@ function FormikSelect(_a) {
|
|
|
3356
3356
|
|
|
3357
3357
|
|
|
3358
3358
|
|
|
3359
|
+
var _styles = require('@mui/material/styles');
|
|
3359
3360
|
function Autocomplete2(_a) {
|
|
3360
3361
|
var _b = _a, {
|
|
3361
3362
|
withFormik = true,
|
|
@@ -3396,23 +3397,29 @@ function FormikAutocomplete(_a) {
|
|
|
3396
3397
|
]);
|
|
3397
3398
|
const [_a2, ..._b2] = _formik.useField.call(void 0, {
|
|
3398
3399
|
name: props.name
|
|
3399
|
-
}), _c = _a2, { value
|
|
3400
|
+
}), _c = _a2, { value } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
|
|
3401
|
+
const theme = _styles.useTheme.call(void 0, );
|
|
3402
|
+
const isLegacyBehaviorDisabledTheme = _react.useMemo.call(void 0, () => {
|
|
3403
|
+
var _a3, _b3, _c2;
|
|
3404
|
+
return ((_c2 = (_b3 = (_a3 = theme.components) == null ? void 0 : _a3.MuiAutocomplete) == null ? void 0 : _b3.defaultProps) == null ? void 0 : _c2["data-legacy-behavior"]) === "disabled";
|
|
3405
|
+
}, [theme]);
|
|
3406
|
+
const isLegacyBehaviorDisabled = typeof (props == null ? void 0 : props["data-legacy-behavior"]) !== "undefined" ? props["data-legacy-behavior"] === "disabled" : isLegacyBehaviorDisabledTheme;
|
|
3400
3407
|
const defaultOption = _react.useMemo.call(void 0, () => {
|
|
3401
|
-
if (!option)
|
|
3402
|
-
return
|
|
3408
|
+
if (!option && isLegacyBehaviorDisabled)
|
|
3409
|
+
return value;
|
|
3403
3410
|
const key = option == null ? void 0 : option.key;
|
|
3404
3411
|
if (key)
|
|
3405
|
-
return props.options.find((option2) => option2[key] ===
|
|
3412
|
+
return props.options.find((option2) => option2[key] === value);
|
|
3406
3413
|
return props.options.find(
|
|
3407
|
-
(option2) => Object.values(option2)[0] ===
|
|
3414
|
+
(option2) => Object.values(option2)[0] === value
|
|
3408
3415
|
);
|
|
3409
|
-
}, [
|
|
3416
|
+
}, [value, option, props.options.find, isLegacyBehaviorDisabled]);
|
|
3410
3417
|
const onChange = (_, newValue) => {
|
|
3411
|
-
const
|
|
3418
|
+
const value2 = option == null ? void 0 : option.value;
|
|
3412
3419
|
if (getOptionValue) {
|
|
3413
3420
|
setValue(getOptionValue(newValue));
|
|
3414
|
-
} else if (
|
|
3415
|
-
setValue(newValue[
|
|
3421
|
+
} else if (value2) {
|
|
3422
|
+
setValue(newValue[value2]);
|
|
3416
3423
|
} else
|
|
3417
3424
|
setValue(newValue);
|
|
3418
3425
|
};
|
|
@@ -3449,7 +3456,7 @@ function FormikAutocomplete(_a) {
|
|
|
3449
3456
|
autoFocus: props.autoFocus
|
|
3450
3457
|
}), props.textFieldProps)
|
|
3451
3458
|
),
|
|
3452
|
-
|
|
3459
|
+
value: defaultOption || null,
|
|
3453
3460
|
onChange,
|
|
3454
3461
|
isOptionEqualToValue
|
|
3455
3462
|
}, props)
|
|
@@ -4010,6 +4017,15 @@ var HttpError = class extends Error {
|
|
|
4010
4017
|
}
|
|
4011
4018
|
};
|
|
4012
4019
|
|
|
4020
|
+
// src/errors/DomainError.ts
|
|
4021
|
+
var DomainError = class extends Error {
|
|
4022
|
+
constructor(message) {
|
|
4023
|
+
super(message);
|
|
4024
|
+
this.message = message;
|
|
4025
|
+
this.stack = `DomainError: ${message}`;
|
|
4026
|
+
}
|
|
4027
|
+
};
|
|
4028
|
+
|
|
4013
4029
|
// src/helpers/apiHelper/index.ts
|
|
4014
4030
|
var VALID_METHODS = [
|
|
4015
4031
|
"GET",
|
|
@@ -4058,6 +4074,8 @@ var ApiHelper = class _ApiHelper {
|
|
|
4058
4074
|
);
|
|
4059
4075
|
yield methodWithMiddlewares(req, res);
|
|
4060
4076
|
} catch (error) {
|
|
4077
|
+
if (error instanceof DomainError)
|
|
4078
|
+
return res.status(400).json(error.message);
|
|
4061
4079
|
if (error instanceof HttpError)
|
|
4062
4080
|
return res.status(error.status).json(error.message);
|
|
4063
4081
|
if (process.env.NODE_ENV === "production") {
|
|
@@ -5153,7 +5171,8 @@ function CreateAuthProvider({
|
|
|
5153
5171
|
|
|
5154
5172
|
|
|
5155
5173
|
|
|
5156
|
-
|
|
5174
|
+
|
|
5175
|
+
exports.AlertContext = AlertContext; exports.AlertProvider = AlertProvider; exports.ApiHelper = ApiHelper; exports.AuthHelper = AuthHelper; exports.Autocomplete = Autocomplete2; exports.BaseGrid = BaseGrid; exports.BaseGridAutoRows = BaseGridAutoRows; exports.Checkbox = Checkbox; exports.CreateAuthProvider = CreateAuthProvider; exports.Dialog = Dialog; exports.DomainError = DomainError; exports.EditableTableCell = EditableTableCell; exports.FormHelperContext = FormHelperContext; exports.FormHelperProvider = FormHelperProvider; exports.GetInputLabel = GetInputLabel; exports.Grid = Grid_default; exports.HttpError = HttpError; exports.Input = Input; exports.InputMask = InputMask2; exports.LargeButton = LargeButton; exports.Modal = Modal; exports.Radio = Radio; exports.Select = Select; exports.Switch = Switch; exports.TabPanel = TabPanel; exports.Td = Td; exports.Tr = Tr; exports.createAuthContext = createAuthContext; exports.createFilter = createFilter; exports.filterData = filterData; exports.getTabProps = getTabProps; exports.useAlert = useAlert; exports.useAsyncGrid = useAsyncGrid; exports.useEvent = useEvent; exports.useFilter = useFilter; exports.useFormHelper = useFormHelper; exports.useGrid = useGrid; exports.useLoading = useLoading;
|
|
5157
5176
|
/*! Bundled license information:
|
|
5158
5177
|
|
|
5159
5178
|
react-is/cjs/react-is.production.min.js:
|