react-asc 25.0.1 → 25.0.4
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/components/Button/ButtonContext.d.ts +1 -1
- package/components/Form/validators/MaxValidator.d.ts +1 -1
- package/components/Form/validators/MinValidator.d.ts +1 -1
- package/components/Menu/MenuContext.d.ts +2 -2
- package/components/Menu/MenuToggle.d.ts +1 -1
- package/components/Table/TableContext.d.ts +2 -2
- package/components/Tabs/TabContext.d.ts +5 -5
- package/components/component.enums.d.ts +4 -4
- package/index.d.ts +1 -0
- package/index.es.js +52 -44
- package/index.js +55 -48
- package/interfaces/index.d.ts +1 -0
- package/interfaces/interfaces.d.ts +3 -0
- package/package.json +1 -1
|
@@ -3,5 +3,5 @@ import { COLOR } from '../component.enums';
|
|
|
3
3
|
export interface IButtonContext {
|
|
4
4
|
color: COLOR | null;
|
|
5
5
|
}
|
|
6
|
-
export declare const ButtonContext:
|
|
6
|
+
export declare const ButtonContext: React.Context<IButtonContext>;
|
|
7
7
|
export declare const useButtonContext: () => IButtonContext;
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
1
|
+
import { Context, Dispatch } from 'react';
|
|
2
2
|
export interface IMenuContext {
|
|
3
3
|
isShow: boolean;
|
|
4
4
|
setIsShow: Dispatch<boolean>;
|
|
5
5
|
}
|
|
6
|
-
export declare const MenuContext:
|
|
6
|
+
export declare const MenuContext: Context<IMenuContext>;
|
|
@@ -2,5 +2,5 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
interface IMenuToggleProps {
|
|
3
3
|
children?: ReactNode;
|
|
4
4
|
}
|
|
5
|
-
export declare const MenuToggle: ({ children }: IMenuToggleProps) =>
|
|
5
|
+
export declare const MenuToggle: ({ children }: IMenuToggleProps) => ReactNode;
|
|
6
6
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Context } from 'react';
|
|
2
2
|
export interface ITableContext {
|
|
3
3
|
variant: 'head' | 'body';
|
|
4
4
|
}
|
|
5
|
-
export declare const TableContext:
|
|
5
|
+
export declare const TableContext: Context<ITableContext>;
|
|
6
6
|
export declare const useTableContext: () => ITableContext;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
1
|
+
import { Context, Dispatch } from 'react';
|
|
2
2
|
export interface ITabsContext {
|
|
3
|
-
fixed
|
|
4
|
-
selectedValue
|
|
5
|
-
setSelectedValue
|
|
3
|
+
fixed?: boolean;
|
|
4
|
+
selectedValue?: string;
|
|
5
|
+
setSelectedValue?: Dispatch<string>;
|
|
6
6
|
}
|
|
7
|
-
export declare const TabContext:
|
|
7
|
+
export declare const TabContext: Context<ITabsContext>;
|
|
8
8
|
export declare const useTabContext: () => ITabsContext;
|
package/index.d.ts
CHANGED
package/index.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useMemo, createContext, useContext,
|
|
|
2
2
|
import reactDom, { createPortal } from 'react-dom';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
|
7
7
|
|
|
8
8
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -55,10 +55,11 @@ var POSITION;
|
|
|
55
55
|
POSITION["right"] = "right";
|
|
56
56
|
POSITION["left"] = "left";
|
|
57
57
|
})(POSITION || (POSITION = {}));
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
var STATUS;
|
|
59
|
+
(function (STATUS) {
|
|
60
|
+
STATUS["HOVERED"] = "hovered";
|
|
61
|
+
STATUS["NORMAL"] = "normal";
|
|
62
|
+
})(STATUS || (STATUS = {}));
|
|
62
63
|
|
|
63
64
|
function styleInject(css, ref) {
|
|
64
65
|
if ( ref === void 0 ) ref = {};
|
|
@@ -235,8 +236,9 @@ function useDebounce(callback, timeout, deps) {
|
|
|
235
236
|
|
|
236
237
|
const useConstructor = (callBack) => {
|
|
237
238
|
const [hasBeenCalled, setHasBeenCalled] = useState(false);
|
|
238
|
-
if (hasBeenCalled)
|
|
239
|
+
if (hasBeenCalled) {
|
|
239
240
|
return;
|
|
241
|
+
}
|
|
240
242
|
callBack();
|
|
241
243
|
setHasBeenCalled(true);
|
|
242
244
|
};
|
|
@@ -1115,8 +1117,9 @@ const Select = (props) => {
|
|
|
1115
1117
|
case 'Enter':
|
|
1116
1118
|
if (hoverIndex) {
|
|
1117
1119
|
const option = options[hoverIndex];
|
|
1118
|
-
if (option)
|
|
1120
|
+
if (option) {
|
|
1119
1121
|
handleOnClick(option);
|
|
1122
|
+
}
|
|
1120
1123
|
}
|
|
1121
1124
|
break;
|
|
1122
1125
|
}
|
|
@@ -1124,11 +1127,12 @@ const Select = (props) => {
|
|
|
1124
1127
|
};
|
|
1125
1128
|
return (React.createElement("div", { ref: selectConainter, className: styles$B.selectContainer },
|
|
1126
1129
|
React.createElement("div", { id: id, className: getCssClass(), onClick: () => show(), tabIndex: 0, onKeyDown: e => handleOnKeyDown(e) },
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
React.createElement(
|
|
1130
|
+
React.createElement(React.Fragment, null,
|
|
1131
|
+
!multiple && renderSingleViewModel(),
|
|
1132
|
+
multiple &&
|
|
1133
|
+
React.createElement("div", { className: styles$B.chipContainer }, renderMultipleViewModel()),
|
|
1134
|
+
React.createElement(Icon, { className: "ml-auto" },
|
|
1135
|
+
React.createElement(ChevronDownSolidIcon, null)))),
|
|
1132
1136
|
isShow &&
|
|
1133
1137
|
React.createElement(Portal, { className: 'backdrop-root' },
|
|
1134
1138
|
React.createElement("div", { className: styles$B.selectMenu, style: { left: (_a = selectConainter.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().x, top: (_b = selectConainter.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().y, width: (_c = selectConainter.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().width } },
|
|
@@ -1233,9 +1237,9 @@ const EmailValidator = (value) => {
|
|
|
1233
1237
|
|
|
1234
1238
|
const IsEqualValidator = (valueA, valueB) => valueA === valueB;
|
|
1235
1239
|
|
|
1236
|
-
const MaxValidator = (
|
|
1240
|
+
const MaxValidator = (val, valueB) => val.length <= valueB;
|
|
1237
1241
|
|
|
1238
|
-
const MinValidator = (
|
|
1242
|
+
const MinValidator = (val, minLength) => val.length >= minLength;
|
|
1239
1243
|
|
|
1240
1244
|
// values, isSubmitting, handleChange, handleBlur, handleSubmit
|
|
1241
1245
|
class Form extends Component {
|
|
@@ -1256,8 +1260,10 @@ class Form extends Component {
|
|
|
1256
1260
|
const keys = Object.keys(this.state.controls);
|
|
1257
1261
|
const values = keys.reduce((obj, f) => {
|
|
1258
1262
|
const control = this.getControl(f);
|
|
1259
|
-
//
|
|
1260
|
-
const newValue = ((control.type === 'date' || control.type === 'datetime-local') &&
|
|
1263
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1264
|
+
const newValue = ((control.type === 'date' || control.type === 'datetime-local') &&
|
|
1265
|
+
control.value &&
|
|
1266
|
+
isValidDate((control.value))) ? new Date((control.value)).toISOString() : control.value;
|
|
1261
1267
|
return (Object.assign(Object.assign({}, obj), { [f]: newValue }));
|
|
1262
1268
|
}, {});
|
|
1263
1269
|
if (this.state.isValid && this.state.isSubmitted) {
|
|
@@ -1288,12 +1294,12 @@ class Form extends Component {
|
|
|
1288
1294
|
break;
|
|
1289
1295
|
case 'min':
|
|
1290
1296
|
if (!MinValidator(fieldValue, parseInt(validatorParam))) {
|
|
1291
|
-
errors.push({ validator: validatorName, message: `
|
|
1297
|
+
errors.push({ validator: validatorName, message: `Minimum number of ${validatorParam} characters not met` });
|
|
1292
1298
|
}
|
|
1293
1299
|
break;
|
|
1294
1300
|
case 'max':
|
|
1295
1301
|
if (!MaxValidator(fieldValue, parseInt(validatorParam))) {
|
|
1296
|
-
errors.push({ validator: validatorName, message: `
|
|
1302
|
+
errors.push({ validator: validatorName, message: `Maximum number of ${validatorParam} characters exceeded` });
|
|
1297
1303
|
}
|
|
1298
1304
|
break;
|
|
1299
1305
|
case 'match':
|
|
@@ -1398,8 +1404,7 @@ class Form extends Component {
|
|
|
1398
1404
|
this.setState({ controls: {}, isValid: false, isChanged: false, isSubmitted: false });
|
|
1399
1405
|
}
|
|
1400
1406
|
getFormGroupCssClass(fieldKey) {
|
|
1401
|
-
|
|
1402
|
-
return result;
|
|
1407
|
+
return this.getControl(fieldKey).config.formGroupClassName;
|
|
1403
1408
|
}
|
|
1404
1409
|
render() {
|
|
1405
1410
|
return (React.createElement("form", { ref: this.myForm }, this.state && this.state.controls && Object.keys(this.state.controls).map((fieldKey) => {
|
|
@@ -1581,7 +1586,7 @@ const DrawerContent = (props) => {
|
|
|
1581
1586
|
};
|
|
1582
1587
|
const positionStyles = {
|
|
1583
1588
|
left: { left: '0px' },
|
|
1584
|
-
right: { right: '0px' }
|
|
1589
|
+
right: { right: '0px' }
|
|
1585
1590
|
};
|
|
1586
1591
|
const getStyles = () => {
|
|
1587
1592
|
return !permanent ? positionStyles[position] : undefined;
|
|
@@ -1668,7 +1673,7 @@ const MenuItem = (props) => {
|
|
|
1668
1673
|
};
|
|
1669
1674
|
|
|
1670
1675
|
const MenuToggle = ({ children }) => {
|
|
1671
|
-
return
|
|
1676
|
+
return children;
|
|
1672
1677
|
};
|
|
1673
1678
|
|
|
1674
1679
|
var css_248z$v = ".MenuDivider-module_menuItemDivider__oRP-j {\n height: 0;\n margin: 0.5rem 0;\n overflow: hidden;\n border-top: 1px solid #e9ecef;\n}";
|
|
@@ -1911,7 +1916,7 @@ const Modal = (props) => {
|
|
|
1911
1916
|
React.createElement(ModalBody, null, children),
|
|
1912
1917
|
footer &&
|
|
1913
1918
|
React.createElement(ModalFooter, null, footer))))),
|
|
1914
|
-
React.createElement(Backdrop, { onClick: handleClickBackdrop })));
|
|
1919
|
+
React.createElement(Backdrop, { onClick: handleClickBackdrop, style: { zIndex: 1040 } })));
|
|
1915
1920
|
};
|
|
1916
1921
|
|
|
1917
1922
|
var MODALTYPE;
|
|
@@ -1968,10 +1973,10 @@ const GlobalModal = ({ title, description, formControls, onOk, onChange, onCance
|
|
|
1968
1973
|
}
|
|
1969
1974
|
button.handler && button.handler();
|
|
1970
1975
|
};
|
|
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)))) },
|
|
1976
|
+
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
1977
|
description && React.createElement("div", null, description),
|
|
1973
1978
|
modalType === MODALTYPE.FORM &&
|
|
1974
|
-
React.createElement(Fragment, null,
|
|
1979
|
+
React.createElement(React.Fragment, null,
|
|
1975
1980
|
React.createElement(Form, { ref: myForm, controls: myControls, validateOnBlur: true, onSubmit: onSubmit, onChange: onChange }))));
|
|
1976
1981
|
};
|
|
1977
1982
|
|
|
@@ -1998,7 +2003,7 @@ class ModalService {
|
|
|
1998
2003
|
return new Promise((resolve, reject) => {
|
|
1999
2004
|
if (!this.container) {
|
|
2000
2005
|
this.container = document.createElement('div');
|
|
2001
|
-
|
|
2006
|
+
this.container.classList.add('modal-container');
|
|
2002
2007
|
const handleOk = (values) => {
|
|
2003
2008
|
resolve(values);
|
|
2004
2009
|
this.hide();
|
|
@@ -2020,7 +2025,7 @@ class ModalService {
|
|
|
2020
2025
|
var _a;
|
|
2021
2026
|
if (this.container) {
|
|
2022
2027
|
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
2023
|
-
document.body.removeChild(this.container);
|
|
2028
|
+
// document.body.removeChild(this.container);
|
|
2024
2029
|
this.container = undefined;
|
|
2025
2030
|
}
|
|
2026
2031
|
}
|
|
@@ -2299,10 +2304,12 @@ const SpeedDial = (props) => {
|
|
|
2299
2304
|
return cssClasses.filter(css => css).join(' ');
|
|
2300
2305
|
};
|
|
2301
2306
|
const handleClick = (e) => {
|
|
2302
|
-
if (open)
|
|
2307
|
+
if (open) {
|
|
2303
2308
|
onClose && onClose(e);
|
|
2304
|
-
|
|
2309
|
+
}
|
|
2310
|
+
else {
|
|
2305
2311
|
onOpen && onOpen(e);
|
|
2312
|
+
}
|
|
2306
2313
|
};
|
|
2307
2314
|
return (React.createElement("div", Object.assign({ className: getCssClasses() }, rest),
|
|
2308
2315
|
React.createElement("div", { style: { 'transform': open ? 'rotate(45deg)' : undefined } },
|
|
@@ -2664,11 +2671,7 @@ const TableCell = (props) => {
|
|
|
2664
2671
|
React.createElement("td", Object.assign({}, rest), children)) }, children));
|
|
2665
2672
|
};
|
|
2666
2673
|
|
|
2667
|
-
const TabContext = createContext({
|
|
2668
|
-
fixed: false,
|
|
2669
|
-
selectedValue: '',
|
|
2670
|
-
setSelectedValue: () => { }
|
|
2671
|
-
});
|
|
2674
|
+
const TabContext = createContext({});
|
|
2672
2675
|
const useTabContext = () => useContext(TabContext);
|
|
2673
2676
|
|
|
2674
2677
|
var css_248z$4 = ".TabIndicator-module_tabIndicator__jSJhH {\n bottom: 0;\n height: 2px;\n position: absolute;\n transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_primary__Q5jEo {\n background-color: var(--primary);\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_accent__qbgIG {\n background-color: var(--accent);\n}";
|
|
@@ -2705,17 +2708,20 @@ const Tabs = (props) => {
|
|
|
2705
2708
|
const prevSelectedValueRef = useRef();
|
|
2706
2709
|
useEffect(() => {
|
|
2707
2710
|
if (value !== undefined && value !== prevSelectedValueRef.current) {
|
|
2711
|
+
prevSelectedValueRef.current = value;
|
|
2708
2712
|
setSelectedValue(value);
|
|
2709
2713
|
}
|
|
2710
2714
|
}, [value]);
|
|
2711
2715
|
useEffect(() => {
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2716
|
+
if (selectedValue && children) {
|
|
2717
|
+
React.Children.toArray(children).forEach((child, index) => {
|
|
2718
|
+
if (child.props.value === selectedValue) {
|
|
2719
|
+
setSelectedIndex(index);
|
|
2720
|
+
onChange && onChange(selectedValue);
|
|
2721
|
+
}
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
}, [selectedValue]);
|
|
2719
2725
|
const getCssClasses = () => {
|
|
2720
2726
|
const cssClasses = [];
|
|
2721
2727
|
cssClasses.push(styles$3.tabs);
|
|
@@ -2745,7 +2751,7 @@ const Tab = (props) => {
|
|
|
2745
2751
|
};
|
|
2746
2752
|
const handleClick = (event) => {
|
|
2747
2753
|
onClick && onClick({ event, value });
|
|
2748
|
-
setSelectedValue(value);
|
|
2754
|
+
setSelectedValue && setSelectedValue(value);
|
|
2749
2755
|
};
|
|
2750
2756
|
return (React.createElement(Button, { className: getCssClasses(), onClick: handleClick, isActive: selectedValue === value, disabled: disabled }, label));
|
|
2751
2757
|
};
|
|
@@ -2924,12 +2930,14 @@ const TreeItem = (props) => {
|
|
|
2924
2930
|
return cssClasses.filter(css => css).join(' ');
|
|
2925
2931
|
};
|
|
2926
2932
|
useEffect(() => {
|
|
2927
|
-
if (isExpanded !== undefined)
|
|
2933
|
+
if (isExpanded !== undefined) {
|
|
2928
2934
|
setIsExpanded(isExpanded);
|
|
2935
|
+
}
|
|
2929
2936
|
}, [isExpanded]);
|
|
2930
2937
|
useEffect(() => {
|
|
2931
|
-
if (isSelected !== undefined)
|
|
2938
|
+
if (isSelected !== undefined) {
|
|
2932
2939
|
setIsSelected(isSelected);
|
|
2940
|
+
}
|
|
2933
2941
|
}, [isSelected]);
|
|
2934
2942
|
const handleOnToggleExpand = (nodeId) => {
|
|
2935
2943
|
setIsExpanded(!_isExpanded);
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
12
|
var reactDom__default = /*#__PURE__*/_interopDefaultLegacy(reactDom);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/*! *****************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -64,10 +64,11 @@ exports.POSITION = void 0;
|
|
|
64
64
|
POSITION["right"] = "right";
|
|
65
65
|
POSITION["left"] = "left";
|
|
66
66
|
})(exports.POSITION || (exports.POSITION = {}));
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
exports.STATUS = void 0;
|
|
68
|
+
(function (STATUS) {
|
|
69
|
+
STATUS["HOVERED"] = "hovered";
|
|
70
|
+
STATUS["NORMAL"] = "normal";
|
|
71
|
+
})(exports.STATUS || (exports.STATUS = {}));
|
|
71
72
|
|
|
72
73
|
function styleInject(css, ref) {
|
|
73
74
|
if ( ref === void 0 ) ref = {};
|
|
@@ -244,8 +245,9 @@ function useDebounce(callback, timeout, deps) {
|
|
|
244
245
|
|
|
245
246
|
const useConstructor = (callBack) => {
|
|
246
247
|
const [hasBeenCalled, setHasBeenCalled] = React.useState(false);
|
|
247
|
-
if (hasBeenCalled)
|
|
248
|
+
if (hasBeenCalled) {
|
|
248
249
|
return;
|
|
250
|
+
}
|
|
249
251
|
callBack();
|
|
250
252
|
setHasBeenCalled(true);
|
|
251
253
|
};
|
|
@@ -1124,8 +1126,9 @@ const Select = (props) => {
|
|
|
1124
1126
|
case 'Enter':
|
|
1125
1127
|
if (hoverIndex) {
|
|
1126
1128
|
const option = options[hoverIndex];
|
|
1127
|
-
if (option)
|
|
1129
|
+
if (option) {
|
|
1128
1130
|
handleOnClick(option);
|
|
1131
|
+
}
|
|
1129
1132
|
}
|
|
1130
1133
|
break;
|
|
1131
1134
|
}
|
|
@@ -1133,11 +1136,12 @@ const Select = (props) => {
|
|
|
1133
1136
|
};
|
|
1134
1137
|
return (React__default["default"].createElement("div", { ref: selectConainter, className: styles$B.selectContainer },
|
|
1135
1138
|
React__default["default"].createElement("div", { id: id, className: getCssClass(), onClick: () => show(), tabIndex: 0, onKeyDown: e => handleOnKeyDown(e) },
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
React__default["default"].createElement(
|
|
1139
|
+
React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1140
|
+
!multiple && renderSingleViewModel(),
|
|
1141
|
+
multiple &&
|
|
1142
|
+
React__default["default"].createElement("div", { className: styles$B.chipContainer }, renderMultipleViewModel()),
|
|
1143
|
+
React__default["default"].createElement(Icon, { className: "ml-auto" },
|
|
1144
|
+
React__default["default"].createElement(ChevronDownSolidIcon, null)))),
|
|
1141
1145
|
isShow &&
|
|
1142
1146
|
React__default["default"].createElement(Portal, { className: 'backdrop-root' },
|
|
1143
1147
|
React__default["default"].createElement("div", { className: styles$B.selectMenu, style: { left: (_a = selectConainter.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().x, top: (_b = selectConainter.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().y, width: (_c = selectConainter.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().width } },
|
|
@@ -1242,9 +1246,9 @@ const EmailValidator = (value) => {
|
|
|
1242
1246
|
|
|
1243
1247
|
const IsEqualValidator = (valueA, valueB) => valueA === valueB;
|
|
1244
1248
|
|
|
1245
|
-
const MaxValidator = (
|
|
1249
|
+
const MaxValidator = (val, valueB) => val.length <= valueB;
|
|
1246
1250
|
|
|
1247
|
-
const MinValidator = (
|
|
1251
|
+
const MinValidator = (val, minLength) => val.length >= minLength;
|
|
1248
1252
|
|
|
1249
1253
|
// values, isSubmitting, handleChange, handleBlur, handleSubmit
|
|
1250
1254
|
class Form extends React.Component {
|
|
@@ -1265,8 +1269,10 @@ class Form extends React.Component {
|
|
|
1265
1269
|
const keys = Object.keys(this.state.controls);
|
|
1266
1270
|
const values = keys.reduce((obj, f) => {
|
|
1267
1271
|
const control = this.getControl(f);
|
|
1268
|
-
//
|
|
1269
|
-
const newValue = ((control.type === 'date' || control.type === 'datetime-local') &&
|
|
1272
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1273
|
+
const newValue = ((control.type === 'date' || control.type === 'datetime-local') &&
|
|
1274
|
+
control.value &&
|
|
1275
|
+
isValidDate((control.value))) ? new Date((control.value)).toISOString() : control.value;
|
|
1270
1276
|
return (Object.assign(Object.assign({}, obj), { [f]: newValue }));
|
|
1271
1277
|
}, {});
|
|
1272
1278
|
if (this.state.isValid && this.state.isSubmitted) {
|
|
@@ -1297,12 +1303,12 @@ class Form extends React.Component {
|
|
|
1297
1303
|
break;
|
|
1298
1304
|
case 'min':
|
|
1299
1305
|
if (!MinValidator(fieldValue, parseInt(validatorParam))) {
|
|
1300
|
-
errors.push({ validator: validatorName, message: `
|
|
1306
|
+
errors.push({ validator: validatorName, message: `Minimum number of ${validatorParam} characters not met` });
|
|
1301
1307
|
}
|
|
1302
1308
|
break;
|
|
1303
1309
|
case 'max':
|
|
1304
1310
|
if (!MaxValidator(fieldValue, parseInt(validatorParam))) {
|
|
1305
|
-
errors.push({ validator: validatorName, message: `
|
|
1311
|
+
errors.push({ validator: validatorName, message: `Maximum number of ${validatorParam} characters exceeded` });
|
|
1306
1312
|
}
|
|
1307
1313
|
break;
|
|
1308
1314
|
case 'match':
|
|
@@ -1407,8 +1413,7 @@ class Form extends React.Component {
|
|
|
1407
1413
|
this.setState({ controls: {}, isValid: false, isChanged: false, isSubmitted: false });
|
|
1408
1414
|
}
|
|
1409
1415
|
getFormGroupCssClass(fieldKey) {
|
|
1410
|
-
|
|
1411
|
-
return result;
|
|
1416
|
+
return this.getControl(fieldKey).config.formGroupClassName;
|
|
1412
1417
|
}
|
|
1413
1418
|
render() {
|
|
1414
1419
|
return (React__default["default"].createElement("form", { ref: this.myForm }, this.state && this.state.controls && Object.keys(this.state.controls).map((fieldKey) => {
|
|
@@ -1590,7 +1595,7 @@ const DrawerContent = (props) => {
|
|
|
1590
1595
|
};
|
|
1591
1596
|
const positionStyles = {
|
|
1592
1597
|
left: { left: '0px' },
|
|
1593
|
-
right: { right: '0px' }
|
|
1598
|
+
right: { right: '0px' }
|
|
1594
1599
|
};
|
|
1595
1600
|
const getStyles = () => {
|
|
1596
1601
|
return !permanent ? positionStyles[position] : undefined;
|
|
@@ -1677,7 +1682,7 @@ const MenuItem = (props) => {
|
|
|
1677
1682
|
};
|
|
1678
1683
|
|
|
1679
1684
|
const MenuToggle = ({ children }) => {
|
|
1680
|
-
return
|
|
1685
|
+
return children;
|
|
1681
1686
|
};
|
|
1682
1687
|
|
|
1683
1688
|
var css_248z$v = ".MenuDivider-module_menuItemDivider__oRP-j {\n height: 0;\n margin: 0.5rem 0;\n overflow: hidden;\n border-top: 1px solid #e9ecef;\n}";
|
|
@@ -1766,13 +1771,13 @@ styleInject(css_248z$q);
|
|
|
1766
1771
|
|
|
1767
1772
|
const Link = (props) => {
|
|
1768
1773
|
const { href = '#', className, target, children } = props, rest = __rest(props, ["href", "className", "target", "children"]);
|
|
1769
|
-
const [status, setStatus] = React.useState(STATUS.NORMAL);
|
|
1774
|
+
const [status, setStatus] = React.useState(exports.STATUS.NORMAL);
|
|
1770
1775
|
const [cssClassName] = useCssClasses([styles$q.link, className, status]);
|
|
1771
1776
|
const onMouseEnter = () => {
|
|
1772
|
-
setStatus(STATUS.HOVERED);
|
|
1777
|
+
setStatus(exports.STATUS.HOVERED);
|
|
1773
1778
|
};
|
|
1774
1779
|
const onMouseLeave = () => {
|
|
1775
|
-
setStatus(STATUS.NORMAL);
|
|
1780
|
+
setStatus(exports.STATUS.NORMAL);
|
|
1776
1781
|
};
|
|
1777
1782
|
return (React__default["default"].createElement("a", Object.assign({ className: cssClassName, href: href, target: target, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, rest), children));
|
|
1778
1783
|
};
|
|
@@ -1920,7 +1925,7 @@ const Modal = (props) => {
|
|
|
1920
1925
|
React__default["default"].createElement(ModalBody, null, children),
|
|
1921
1926
|
footer &&
|
|
1922
1927
|
React__default["default"].createElement(ModalFooter, null, footer))))),
|
|
1923
|
-
React__default["default"].createElement(Backdrop, { onClick: handleClickBackdrop })));
|
|
1928
|
+
React__default["default"].createElement(Backdrop, { onClick: handleClickBackdrop, style: { zIndex: 1040 } })));
|
|
1924
1929
|
};
|
|
1925
1930
|
|
|
1926
1931
|
exports.MODALTYPE = void 0;
|
|
@@ -1977,10 +1982,10 @@ const GlobalModal = ({ title, description, formControls, onOk, onChange, onCance
|
|
|
1977
1982
|
}
|
|
1978
1983
|
button.handler && button.handler();
|
|
1979
1984
|
};
|
|
1980
|
-
return (React__default["default"].createElement(Modal, { size: size, fullScreen: fullScreen, header: title, onHeaderCloseClick: onCancel, onBackdropClick: onBackdropClick, isDismissable: isDismissable, footer: React__default["default"].createElement(
|
|
1985
|
+
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
1986
|
description && React__default["default"].createElement("div", null, description),
|
|
1982
1987
|
modalType === exports.MODALTYPE.FORM &&
|
|
1983
|
-
React__default["default"].createElement(
|
|
1988
|
+
React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1984
1989
|
React__default["default"].createElement(Form, { ref: myForm, controls: myControls, validateOnBlur: true, onSubmit: onSubmit, onChange: onChange }))));
|
|
1985
1990
|
};
|
|
1986
1991
|
|
|
@@ -2007,7 +2012,7 @@ class ModalService {
|
|
|
2007
2012
|
return new Promise((resolve, reject) => {
|
|
2008
2013
|
if (!this.container) {
|
|
2009
2014
|
this.container = document.createElement('div');
|
|
2010
|
-
|
|
2015
|
+
this.container.classList.add('modal-container');
|
|
2011
2016
|
const handleOk = (values) => {
|
|
2012
2017
|
resolve(values);
|
|
2013
2018
|
this.hide();
|
|
@@ -2029,7 +2034,7 @@ class ModalService {
|
|
|
2029
2034
|
var _a;
|
|
2030
2035
|
if (this.container) {
|
|
2031
2036
|
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
2032
|
-
document.body.removeChild(this.container);
|
|
2037
|
+
// document.body.removeChild(this.container);
|
|
2033
2038
|
this.container = undefined;
|
|
2034
2039
|
}
|
|
2035
2040
|
}
|
|
@@ -2308,10 +2313,12 @@ const SpeedDial = (props) => {
|
|
|
2308
2313
|
return cssClasses.filter(css => css).join(' ');
|
|
2309
2314
|
};
|
|
2310
2315
|
const handleClick = (e) => {
|
|
2311
|
-
if (open)
|
|
2316
|
+
if (open) {
|
|
2312
2317
|
onClose && onClose(e);
|
|
2313
|
-
|
|
2318
|
+
}
|
|
2319
|
+
else {
|
|
2314
2320
|
onOpen && onOpen(e);
|
|
2321
|
+
}
|
|
2315
2322
|
};
|
|
2316
2323
|
return (React__default["default"].createElement("div", Object.assign({ className: getCssClasses() }, rest),
|
|
2317
2324
|
React__default["default"].createElement("div", { style: { 'transform': open ? 'rotate(45deg)' : undefined } },
|
|
@@ -2673,11 +2680,7 @@ const TableCell = (props) => {
|
|
|
2673
2680
|
React__default["default"].createElement("td", Object.assign({}, rest), children)) }, children));
|
|
2674
2681
|
};
|
|
2675
2682
|
|
|
2676
|
-
const TabContext = React.createContext({
|
|
2677
|
-
fixed: false,
|
|
2678
|
-
selectedValue: '',
|
|
2679
|
-
setSelectedValue: () => { }
|
|
2680
|
-
});
|
|
2683
|
+
const TabContext = React.createContext({});
|
|
2681
2684
|
const useTabContext = () => React.useContext(TabContext);
|
|
2682
2685
|
|
|
2683
2686
|
var css_248z$4 = ".TabIndicator-module_tabIndicator__jSJhH {\n bottom: 0;\n height: 2px;\n position: absolute;\n transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_primary__Q5jEo {\n background-color: var(--primary);\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_accent__qbgIG {\n background-color: var(--accent);\n}";
|
|
@@ -2714,17 +2717,20 @@ const Tabs = (props) => {
|
|
|
2714
2717
|
const prevSelectedValueRef = React.useRef();
|
|
2715
2718
|
React.useEffect(() => {
|
|
2716
2719
|
if (value !== undefined && value !== prevSelectedValueRef.current) {
|
|
2720
|
+
prevSelectedValueRef.current = value;
|
|
2717
2721
|
setSelectedValue(value);
|
|
2718
2722
|
}
|
|
2719
2723
|
}, [value]);
|
|
2720
2724
|
React.useEffect(() => {
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2725
|
+
if (selectedValue && children) {
|
|
2726
|
+
React__default["default"].Children.toArray(children).forEach((child, index) => {
|
|
2727
|
+
if (child.props.value === selectedValue) {
|
|
2728
|
+
setSelectedIndex(index);
|
|
2729
|
+
onChange && onChange(selectedValue);
|
|
2730
|
+
}
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
}, [selectedValue]);
|
|
2728
2734
|
const getCssClasses = () => {
|
|
2729
2735
|
const cssClasses = [];
|
|
2730
2736
|
cssClasses.push(styles$3.tabs);
|
|
@@ -2754,7 +2760,7 @@ const Tab = (props) => {
|
|
|
2754
2760
|
};
|
|
2755
2761
|
const handleClick = (event) => {
|
|
2756
2762
|
onClick && onClick({ event, value });
|
|
2757
|
-
setSelectedValue(value);
|
|
2763
|
+
setSelectedValue && setSelectedValue(value);
|
|
2758
2764
|
};
|
|
2759
2765
|
return (React__default["default"].createElement(Button, { className: getCssClasses(), onClick: handleClick, isActive: selectedValue === value, disabled: disabled }, label));
|
|
2760
2766
|
};
|
|
@@ -2933,12 +2939,14 @@ const TreeItem = (props) => {
|
|
|
2933
2939
|
return cssClasses.filter(css => css).join(' ');
|
|
2934
2940
|
};
|
|
2935
2941
|
React.useEffect(() => {
|
|
2936
|
-
if (isExpanded !== undefined)
|
|
2942
|
+
if (isExpanded !== undefined) {
|
|
2937
2943
|
setIsExpanded(isExpanded);
|
|
2944
|
+
}
|
|
2938
2945
|
}, [isExpanded]);
|
|
2939
2946
|
React.useEffect(() => {
|
|
2940
|
-
if (isSelected !== undefined)
|
|
2947
|
+
if (isSelected !== undefined) {
|
|
2941
2948
|
setIsSelected(isSelected);
|
|
2949
|
+
}
|
|
2942
2950
|
}, [isSelected]);
|
|
2943
2951
|
const handleOnToggleExpand = (nodeId) => {
|
|
2944
2952
|
setIsExpanded(!_isExpanded);
|
|
@@ -3040,7 +3048,6 @@ exports.PlusSolidIcon = PlusSolidIcon;
|
|
|
3040
3048
|
exports.Portal = Portal;
|
|
3041
3049
|
exports.ProgressBar = ProgressBar;
|
|
3042
3050
|
exports.Row = Row;
|
|
3043
|
-
exports.STATUS = STATUS;
|
|
3044
3051
|
exports.SecondSelect = SecondSelect;
|
|
3045
3052
|
exports.Select = Select;
|
|
3046
3053
|
exports.Sidebar = Sidebar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './interfaces';
|