@bluemarble/bm-components 1.8.0 → 1.9.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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +53 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -108,18 +108,22 @@ interface AutocompleteWithoutProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
|
108
108
|
withFormik: false;
|
|
109
109
|
getOptionValue?: never;
|
|
110
110
|
label?: string;
|
|
111
|
+
required?: boolean;
|
|
111
112
|
getOptionLabel: (option: T) => string;
|
|
112
113
|
renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
|
|
114
|
+
textFieldProps?: TextFieldProps;
|
|
113
115
|
}
|
|
114
116
|
interface AutocompleteWithFormikProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
115
117
|
name: string;
|
|
116
118
|
withFormik?: true;
|
|
119
|
+
required?: boolean;
|
|
117
120
|
label?: string;
|
|
118
121
|
option?: {
|
|
119
122
|
label?: keyof T;
|
|
120
123
|
value?: keyof T;
|
|
121
124
|
key?: string;
|
|
122
125
|
};
|
|
126
|
+
textFieldProps?: TextFieldProps;
|
|
123
127
|
renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
|
|
124
128
|
getOptionLabel?: (option: T) => string;
|
|
125
129
|
getOptionValue?: (option: T) => string | number;
|
package/dist/index.d.ts
CHANGED
|
@@ -108,18 +108,22 @@ interface AutocompleteWithoutProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
|
108
108
|
withFormik: false;
|
|
109
109
|
getOptionValue?: never;
|
|
110
110
|
label?: string;
|
|
111
|
+
required?: boolean;
|
|
111
112
|
getOptionLabel: (option: T) => string;
|
|
112
113
|
renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
|
|
114
|
+
textFieldProps?: TextFieldProps;
|
|
113
115
|
}
|
|
114
116
|
interface AutocompleteWithFormikProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
115
117
|
name: string;
|
|
116
118
|
withFormik?: true;
|
|
119
|
+
required?: boolean;
|
|
117
120
|
label?: string;
|
|
118
121
|
option?: {
|
|
119
122
|
label?: keyof T;
|
|
120
123
|
value?: keyof T;
|
|
121
124
|
key?: string;
|
|
122
125
|
};
|
|
126
|
+
textFieldProps?: TextFieldProps;
|
|
123
127
|
renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
|
|
124
128
|
getOptionLabel?: (option: T) => string;
|
|
125
129
|
getOptionValue?: (option: T) => string | number;
|
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: TextFieldProps4,
|
|
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
|
+
}, TextFieldProps4 == null ? void 0 : TextFieldProps4.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({}, TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps), {
|
|
2985
2985
|
sx: __spreadValues({
|
|
2986
2986
|
fontSize: 14,
|
|
2987
2987
|
pl: 0.2
|
|
2988
|
-
}, (_a =
|
|
2988
|
+
}, (_a = TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps) == null ? void 0 : _a.sx)
|
|
2989
2989
|
})
|
|
2990
|
-
},
|
|
2990
|
+
}, TextFieldProps4)
|
|
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: TextFieldProps4,
|
|
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
|
+
}, TextFieldProps4 == null ? void 0 : TextFieldProps4.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({}, TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps), {
|
|
3057
3057
|
sx: __spreadValues({
|
|
3058
3058
|
fontSize: 14,
|
|
3059
3059
|
pl: 0.2
|
|
3060
|
-
}, (_a =
|
|
3060
|
+
}, (_a = TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps) == null ? void 0 : _a.sx)
|
|
3061
3061
|
})
|
|
3062
|
-
},
|
|
3062
|
+
}, TextFieldProps4)
|
|
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: TextFieldProps4,
|
|
3070
3070
|
onSave = () => {
|
|
3071
3071
|
},
|
|
3072
3072
|
onCancel,
|
|
@@ -3437,15 +3437,17 @@ function FormikAutocomplete(_a) {
|
|
|
3437
3437
|
getOptionLabel,
|
|
3438
3438
|
renderInput: (params) => /* @__PURE__ */ React2.default.createElement(
|
|
3439
3439
|
_material.TextField,
|
|
3440
|
-
__spreadProps(__spreadValues(__spreadValues({
|
|
3440
|
+
__spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
3441
3441
|
error: Boolean(meta == null ? void 0 : meta.error),
|
|
3442
3442
|
helperText: meta == null ? void 0 : meta.error
|
|
3443
3443
|
}, params), field), {
|
|
3444
3444
|
InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
|
|
3445
3445
|
endAdornment: /* @__PURE__ */ React2.default.createElement(_react.Fragment, null, props.loading ? /* @__PURE__ */ React2.default.createElement(_material.CircularProgress, { color: "inherit", size: 20 }) : null, params.InputProps.endAdornment)
|
|
3446
3446
|
}),
|
|
3447
|
-
label: props.label
|
|
3448
|
-
|
|
3447
|
+
label: props.label,
|
|
3448
|
+
required: props.required,
|
|
3449
|
+
autoFocus: props.autoFocus
|
|
3450
|
+
}), props.textFieldProps)
|
|
3449
3451
|
),
|
|
3450
3452
|
defaultValue: defaultOption,
|
|
3451
3453
|
onChange,
|
|
@@ -4207,50 +4209,44 @@ function useFormHelper() {
|
|
|
4207
4209
|
const { createAlert } = alertProps;
|
|
4208
4210
|
const { setLoading } = loadingProps;
|
|
4209
4211
|
const sourceRef = _react.useRef.call(void 0, new AbortController());
|
|
4210
|
-
const onSubmitWrapper =
|
|
4211
|
-
(
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
api.interceptors.request.use(
|
|
4232
|
-
(config) => {
|
|
4233
|
-
if (!config.signal && sourceRef.current && config.method === "get") {
|
|
4234
|
-
config.signal = sourceRef.current.signal;
|
|
4235
|
-
}
|
|
4236
|
-
return config;
|
|
4237
|
-
},
|
|
4238
|
-
(error) => {
|
|
4239
|
-
return Promise.reject(error);
|
|
4212
|
+
const onSubmitWrapper = (fn, { name }) => {
|
|
4213
|
+
return (fields, methods) => __async(this, null, function* () {
|
|
4214
|
+
const LOADING_NAME = name;
|
|
4215
|
+
setLoading(LOADING_NAME);
|
|
4216
|
+
try {
|
|
4217
|
+
yield fn(fields, methods);
|
|
4218
|
+
} catch (error) {
|
|
4219
|
+
errorHandler(error, methods.setErrors);
|
|
4220
|
+
} finally {
|
|
4221
|
+
setLoading(LOADING_NAME, true);
|
|
4222
|
+
}
|
|
4223
|
+
});
|
|
4224
|
+
};
|
|
4225
|
+
const onRequestWrapper = (fn, { name }) => {
|
|
4226
|
+
return (...params) => __async(this, null, function* () {
|
|
4227
|
+
const LOADING_NAME = name;
|
|
4228
|
+
setLoading(LOADING_NAME);
|
|
4229
|
+
api.interceptors.request.use(
|
|
4230
|
+
(config) => {
|
|
4231
|
+
if (!config.signal && sourceRef.current && config.method === "get") {
|
|
4232
|
+
config.signal = sourceRef.current.signal;
|
|
4240
4233
|
}
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
return
|
|
4245
|
-
} catch (error) {
|
|
4246
|
-
errorHandler(error);
|
|
4247
|
-
} finally {
|
|
4248
|
-
setLoading(LOADING_NAME, true);
|
|
4234
|
+
return config;
|
|
4235
|
+
},
|
|
4236
|
+
(error) => {
|
|
4237
|
+
return Promise.reject(error);
|
|
4249
4238
|
}
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4239
|
+
);
|
|
4240
|
+
try {
|
|
4241
|
+
const response = yield fn(...params);
|
|
4242
|
+
return response;
|
|
4243
|
+
} catch (error) {
|
|
4244
|
+
errorHandler(error);
|
|
4245
|
+
} finally {
|
|
4246
|
+
setLoading(LOADING_NAME, true);
|
|
4247
|
+
}
|
|
4248
|
+
});
|
|
4249
|
+
};
|
|
4254
4250
|
const errorHandler = _react.useCallback.call(void 0,
|
|
4255
4251
|
(error, callback) => {
|
|
4256
4252
|
if ((error == null ? void 0 : error.message) === "cancel.navigation")
|
|
@@ -4607,7 +4603,7 @@ function getObjectValue(obj) {
|
|
|
4607
4603
|
return (prop) => {
|
|
4608
4604
|
try {
|
|
4609
4605
|
return prop.split(".").reduce((o, k) => o[k], obj);
|
|
4610
|
-
} catch (
|
|
4606
|
+
} catch (_) {
|
|
4611
4607
|
return void 0;
|
|
4612
4608
|
}
|
|
4613
4609
|
};
|