react-asc 25.0.1 → 25.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MaxValidator: (
|
|
1
|
+
export declare const MaxValidator: (val: string, valueB: number) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MinValidator: (
|
|
1
|
+
export declare const MinValidator: (val: string, minLength: number) => boolean;
|
package/index.es.js
CHANGED
|
@@ -1233,9 +1233,9 @@ const EmailValidator = (value) => {
|
|
|
1233
1233
|
|
|
1234
1234
|
const IsEqualValidator = (valueA, valueB) => valueA === valueB;
|
|
1235
1235
|
|
|
1236
|
-
const MaxValidator = (
|
|
1236
|
+
const MaxValidator = (val, valueB) => val.length <= valueB;
|
|
1237
1237
|
|
|
1238
|
-
const MinValidator = (
|
|
1238
|
+
const MinValidator = (val, minLength) => val.length >= minLength;
|
|
1239
1239
|
|
|
1240
1240
|
// values, isSubmitting, handleChange, handleBlur, handleSubmit
|
|
1241
1241
|
class Form extends Component {
|
|
@@ -1288,12 +1288,12 @@ class Form extends Component {
|
|
|
1288
1288
|
break;
|
|
1289
1289
|
case 'min':
|
|
1290
1290
|
if (!MinValidator(fieldValue, parseInt(validatorParam))) {
|
|
1291
|
-
errors.push({ validator: validatorName, message: `
|
|
1291
|
+
errors.push({ validator: validatorName, message: `Minimum number of ${validatorParam} characters not met` });
|
|
1292
1292
|
}
|
|
1293
1293
|
break;
|
|
1294
1294
|
case 'max':
|
|
1295
1295
|
if (!MaxValidator(fieldValue, parseInt(validatorParam))) {
|
|
1296
|
-
errors.push({ validator: validatorName, message: `
|
|
1296
|
+
errors.push({ validator: validatorName, message: `Maximum number of ${validatorParam} characters exceeded` });
|
|
1297
1297
|
}
|
|
1298
1298
|
break;
|
|
1299
1299
|
case 'match':
|
|
@@ -1968,10 +1968,10 @@ const GlobalModal = ({ title, description, formControls, onOk, onChange, onCance
|
|
|
1968
1968
|
}
|
|
1969
1969
|
button.handler && button.handler();
|
|
1970
1970
|
};
|
|
1971
|
-
return (React.createElement(Modal, { size: size, fullScreen: fullScreen, header: title, onHeaderCloseClick: onCancel, onBackdropClick: onBackdropClick, isDismissable: isDismissable, footer: React.createElement(Fragment, null, buttons.map((button, index) => (React.createElement(Button, { key: index, variant: button.variant, color: button.color, autoFocus: button.autoFocus, shadow: button.shadow, onClick: () => handleClickButton(button) }, button.label)))) },
|
|
1971
|
+
return (React.createElement(Modal, { size: size, fullScreen: fullScreen, header: title, onHeaderCloseClick: onCancel, onBackdropClick: onBackdropClick, isDismissable: isDismissable, footer: React.createElement(React.Fragment, null, buttons.map((button, index) => (React.createElement(Button, { key: index, variant: button.variant, color: button.color, autoFocus: button.autoFocus, shadow: button.shadow, onClick: () => handleClickButton(button) }, button.label)))) },
|
|
1972
1972
|
description && React.createElement("div", null, description),
|
|
1973
1973
|
modalType === MODALTYPE.FORM &&
|
|
1974
|
-
React.createElement(Fragment, null,
|
|
1974
|
+
React.createElement(React.Fragment, null,
|
|
1975
1975
|
React.createElement(Form, { ref: myForm, controls: myControls, validateOnBlur: true, onSubmit: onSubmit, onChange: onChange }))));
|
|
1976
1976
|
};
|
|
1977
1977
|
|
|
@@ -1998,7 +1998,7 @@ class ModalService {
|
|
|
1998
1998
|
return new Promise((resolve, reject) => {
|
|
1999
1999
|
if (!this.container) {
|
|
2000
2000
|
this.container = document.createElement('div');
|
|
2001
|
-
|
|
2001
|
+
this.container.classList.add('modal-container');
|
|
2002
2002
|
const handleOk = (values) => {
|
|
2003
2003
|
resolve(values);
|
|
2004
2004
|
this.hide();
|
|
@@ -2020,7 +2020,7 @@ class ModalService {
|
|
|
2020
2020
|
var _a;
|
|
2021
2021
|
if (this.container) {
|
|
2022
2022
|
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
2023
|
-
document.body.removeChild(this.container);
|
|
2023
|
+
// document.body.removeChild(this.container);
|
|
2024
2024
|
this.container = undefined;
|
|
2025
2025
|
}
|
|
2026
2026
|
}
|
|
@@ -2704,6 +2704,7 @@ const Tabs = (props) => {
|
|
|
2704
2704
|
});
|
|
2705
2705
|
const prevSelectedValueRef = useRef();
|
|
2706
2706
|
useEffect(() => {
|
|
2707
|
+
// TODO - check if prev needs to be set
|
|
2707
2708
|
if (value !== undefined && value !== prevSelectedValueRef.current) {
|
|
2708
2709
|
setSelectedValue(value);
|
|
2709
2710
|
}
|
package/index.js
CHANGED
|
@@ -1242,9 +1242,9 @@ const EmailValidator = (value) => {
|
|
|
1242
1242
|
|
|
1243
1243
|
const IsEqualValidator = (valueA, valueB) => valueA === valueB;
|
|
1244
1244
|
|
|
1245
|
-
const MaxValidator = (
|
|
1245
|
+
const MaxValidator = (val, valueB) => val.length <= valueB;
|
|
1246
1246
|
|
|
1247
|
-
const MinValidator = (
|
|
1247
|
+
const MinValidator = (val, minLength) => val.length >= minLength;
|
|
1248
1248
|
|
|
1249
1249
|
// values, isSubmitting, handleChange, handleBlur, handleSubmit
|
|
1250
1250
|
class Form extends React.Component {
|
|
@@ -1297,12 +1297,12 @@ class Form extends React.Component {
|
|
|
1297
1297
|
break;
|
|
1298
1298
|
case 'min':
|
|
1299
1299
|
if (!MinValidator(fieldValue, parseInt(validatorParam))) {
|
|
1300
|
-
errors.push({ validator: validatorName, message: `
|
|
1300
|
+
errors.push({ validator: validatorName, message: `Minimum number of ${validatorParam} characters not met` });
|
|
1301
1301
|
}
|
|
1302
1302
|
break;
|
|
1303
1303
|
case 'max':
|
|
1304
1304
|
if (!MaxValidator(fieldValue, parseInt(validatorParam))) {
|
|
1305
|
-
errors.push({ validator: validatorName, message: `
|
|
1305
|
+
errors.push({ validator: validatorName, message: `Maximum number of ${validatorParam} characters exceeded` });
|
|
1306
1306
|
}
|
|
1307
1307
|
break;
|
|
1308
1308
|
case 'match':
|
|
@@ -1977,10 +1977,10 @@ const GlobalModal = ({ title, description, formControls, onOk, onChange, onCance
|
|
|
1977
1977
|
}
|
|
1978
1978
|
button.handler && button.handler();
|
|
1979
1979
|
};
|
|
1980
|
-
return (React__default["default"].createElement(Modal, { size: size, fullScreen: fullScreen, header: title, onHeaderCloseClick: onCancel, onBackdropClick: onBackdropClick, isDismissable: isDismissable, footer: React__default["default"].createElement(
|
|
1980
|
+
return (React__default["default"].createElement(Modal, { size: size, fullScreen: fullScreen, header: title, onHeaderCloseClick: onCancel, onBackdropClick: onBackdropClick, isDismissable: isDismissable, footer: React__default["default"].createElement(React__default["default"].Fragment, null, buttons.map((button, index) => (React__default["default"].createElement(Button, { key: index, variant: button.variant, color: button.color, autoFocus: button.autoFocus, shadow: button.shadow, onClick: () => handleClickButton(button) }, button.label)))) },
|
|
1981
1981
|
description && React__default["default"].createElement("div", null, description),
|
|
1982
1982
|
modalType === exports.MODALTYPE.FORM &&
|
|
1983
|
-
React__default["default"].createElement(
|
|
1983
|
+
React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1984
1984
|
React__default["default"].createElement(Form, { ref: myForm, controls: myControls, validateOnBlur: true, onSubmit: onSubmit, onChange: onChange }))));
|
|
1985
1985
|
};
|
|
1986
1986
|
|
|
@@ -2007,7 +2007,7 @@ class ModalService {
|
|
|
2007
2007
|
return new Promise((resolve, reject) => {
|
|
2008
2008
|
if (!this.container) {
|
|
2009
2009
|
this.container = document.createElement('div');
|
|
2010
|
-
|
|
2010
|
+
this.container.classList.add('modal-container');
|
|
2011
2011
|
const handleOk = (values) => {
|
|
2012
2012
|
resolve(values);
|
|
2013
2013
|
this.hide();
|
|
@@ -2029,7 +2029,7 @@ class ModalService {
|
|
|
2029
2029
|
var _a;
|
|
2030
2030
|
if (this.container) {
|
|
2031
2031
|
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
2032
|
-
document.body.removeChild(this.container);
|
|
2032
|
+
// document.body.removeChild(this.container);
|
|
2033
2033
|
this.container = undefined;
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
@@ -2713,6 +2713,7 @@ const Tabs = (props) => {
|
|
|
2713
2713
|
});
|
|
2714
2714
|
const prevSelectedValueRef = React.useRef();
|
|
2715
2715
|
React.useEffect(() => {
|
|
2716
|
+
// TODO - check if prev needs to be set
|
|
2716
2717
|
if (value !== undefined && value !== prevSelectedValueRef.current) {
|
|
2717
2718
|
setSelectedValue(value);
|
|
2718
2719
|
}
|