@geneui/components 3.0.0-next-9ffcb93-16102024 → 3.0.0-next-48d0ef7-31102024
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/Avatar.js +63 -0
- package/CHANGELOG.md +7 -0
- package/Divider.js +23 -0
- package/{GeneUIProvider/index.js → GeneUIProvider.js} +52 -65
- package/HelperText.js +69 -0
- package/Info.js +64 -0
- package/Label.js +38 -0
- package/Loader.js +21 -0
- package/Pill.js +64 -0
- package/TextLink.js +20 -0
- package/{index-65217440.js → Tooltip.js} +104 -80
- package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
- package/components/atoms/Avatar/index.d.ts +1 -0
- package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
- package/components/atoms/Divider/index.d.ts +1 -0
- package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
- package/components/atoms/HelperText/index.d.ts +1 -0
- package/{lib → components}/atoms/Info/Info.d.ts +5 -5
- package/components/atoms/Info/index.d.ts +1 -0
- package/{lib → components}/atoms/Label/Label.d.ts +3 -3
- package/components/atoms/Label/index.d.ts +1 -0
- package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
- package/components/atoms/Loader/index.d.ts +1 -0
- package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
- package/components/atoms/Pill/index.d.ts +1 -0
- package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
- package/components/atoms/TextLink/index.d.ts +1 -0
- package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
- package/components/molecules/Tooltip/index.d.ts +1 -0
- package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
- package/components/providers/GeneUIProvider/index.d.ts +1 -0
- package/hooks/index.d.ts +2 -20
- package/hooks/useDebounceCallback/index.d.ts +1 -0
- package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
- package/hooks/useEllipsisDetection/index.d.ts +1 -1
- package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
- package/{index-031ff73c.js → index-ce02421b.js} +4 -4
- package/index.d.ts +11 -121
- package/index.js +12 -159
- package/package.json +24 -43
- package/tokens-0abb4e1b.js +6 -0
- package/types/index.d.ts +0 -3
- package/useEllipsisDetection-46d712b6.js +34 -0
- package/ActionableList/index.js +0 -1694
- package/AdvancedSearch/index.js +0 -892
- package/Alert/index.js +0 -98
- package/Avatar/index.js +0 -58
- package/Badge/index.js +0 -29
- package/Breadcrumb/index.js +0 -130
- package/BusyLoader/index.js +0 -31
- package/Button/index.js +0 -30
- package/Card/index.js +0 -502
- package/CardList/index.js +0 -662
- package/CellMeasurerCache-80be385d.js +0 -229
- package/Charts/index.js +0 -17662
- package/Checkbox/index.js +0 -229
- package/CheckboxGroup/index.js +0 -203
- package/CheckboxGroupWithSearch/index.js +0 -280
- package/Collapse/index.js +0 -195
- package/ColorPicker/index.js +0 -210
- package/ComboBox/index.js +0 -524
- package/Copy/index.js +0 -56
- package/Counter/index.js +0 -312
- package/DateFilter/index.js +0 -183
- package/DatePicker/index.js +0 -1229
- package/DatePickerInput/index.js +0 -883
- package/Divider/index.js +0 -23
- package/Drawer/index.js +0 -261
- package/Dropdown/index.js +0 -43
- package/Editor/index.js +0 -22975
- package/Empty/index.js +0 -76
- package/ExtendedInput/index.js +0 -590
- package/Form/index.js +0 -85
- package/FormContainer/index.js +0 -189
- package/FormableCheckbox/index.js +0 -24
- package/FormableDatePicker/index.js +0 -43
- package/FormableDropdown/index.js +0 -50
- package/FormableEditor/index.js +0 -26
- package/FormableHOC-85f89a81.js +0 -83
- package/FormableMultiSelectDropdown/index.js +0 -50
- package/FormableNumberInput/index.js +0 -34
- package/FormableRadio/index.js +0 -22
- package/FormableSwitcher/index.js +0 -22
- package/FormableTextInput/index.js +0 -34
- package/FormableUploader/index.js +0 -44
- package/Grid/index.js +0 -167
- package/HelperText/index.js +0 -86
- package/Holder/index.js +0 -261
- package/Icon/index.js +0 -62
- package/Image/index.js +0 -45
- package/ImagePreview/index.js +0 -217
- package/Info/index.js +0 -41
- package/InfoOutline-dd2e89d9.js +0 -29
- package/InteractiveWidget/index.js +0 -78
- package/KeyValue/index.js +0 -22
- package/Label/index.js +0 -48
- package/LinkButton/index.js +0 -34
- package/Loader/index.js +0 -23
- package/Menu/index.js +0 -281
- package/MobileNavigation/index.js +0 -94
- package/MobilePopup/index.js +0 -182
- package/Modal/index.js +0 -251
- package/ModuleTitle/index.js +0 -141
- package/NavigationMenu/index.js +0 -222
- package/Notification/index.js +0 -120
- package/Option/index.js +0 -184
- package/Overlay/index.js +0 -187
- package/Overspread/index.js +0 -291
- package/Pagination/index.js +0 -261
- package/Paper/index.js +0 -96
- package/Pill/index.js +0 -67
- package/Popover/index.js +0 -725
- package/PopoverV2/index.js +0 -19
- package/Portal/index.js +0 -58
- package/Products/index.js +0 -115
- package/Profile/index.js +0 -589
- package/Progress/index.js +0 -200
- package/QRCode/index.js +0 -814
- package/Radio/index.js +0 -151
- package/RadioGroup/index.js +0 -104
- package/Range/index.js +0 -191
- package/Rating/index.js +0 -174
- package/RichEditor/index.js +0 -13
- package/RichEditor-78c2617e.js +0 -228
- package/Scrollbar/index.js +0 -1585
- package/Search/index.js +0 -75
- package/SearchWithDropdown/index.js +0 -140
- package/Section/index.js +0 -61
- package/SkeletonLoader/index.js +0 -81
- package/Slider/index.js +0 -261
- package/Status/index.js +0 -97
- package/Steps/index.js +0 -314
- package/SuggestionList/index.js +0 -385
- package/Switcher/index.js +0 -193
- package/Table/index.js +0 -57
- package/TableCompositions/index.js +0 -16995
- package/Tabs/index.js +0 -235
- package/Tag/index.js +0 -102
- package/TextLink/index.js +0 -20
- package/Textarea/index.js +0 -242
- package/Time/index.js +0 -62
- package/TimePicker/index.js +0 -575
- package/Timeline/index.js +0 -113
- package/Title/index.js +0 -65
- package/Toaster/index.js +0 -116
- package/Tooltip/index.js +0 -6
- package/TransferList/index.js +0 -493
- package/Uploader/index.js +0 -992
- package/ValidatableCheckbox/index.js +0 -123
- package/ValidatableDatePicker/index.js +0 -316
- package/ValidatableDropdown/index.js +0 -141
- package/ValidatableElements/index.js +0 -67
- package/ValidatableMultiSelectDropdown/index.js +0 -152
- package/ValidatableNumberInput/index.js +0 -204
- package/ValidatableRadio/index.js +0 -116
- package/ValidatableSwitcher/index.js +0 -93
- package/ValidatableTextInput/index.js +0 -167
- package/ValidatableTimeInput/index.js +0 -174
- package/ValidatableUploader/index.js +0 -98
- package/Widget/index.js +0 -225
- package/_commonjsHelpers-24198af3.js +0 -35
- package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
- package/callAfterDelay-7272faca.js +0 -12
- package/checkTimeValidation-e56771be.js +0 -16
- package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
- package/clsx.m-2bb6df4b.js +0 -3
- package/config-1053d64d.js +0 -20
- package/configs-00612ce0.js +0 -103
- package/configs.js +0 -111
- package/dateValidation-67caec66.js +0 -225
- package/debounce-4419bc2f.js +0 -17
- package/guid-8ddf77b3.js +0 -16
- package/hooks/useBodyScroll.js +0 -16
- package/hooks/useClick.js +0 -18
- package/hooks/useClickOutside.js +0 -25
- package/hooks/useDebounce.js +0 -28
- package/hooks/useDeviceType.js +0 -17
- package/hooks/useDidMount.js +0 -15
- package/hooks/useForceUpdate.js +0 -8
- package/hooks/useHover.js +0 -20
- package/hooks/useImgDownload.js +0 -18
- package/hooks/useKeyDown.js +0 -21
- package/hooks/useMount.js +0 -13
- package/hooks/useMutationObserver.js +0 -21
- package/hooks/usePrevious.js +0 -10
- package/hooks/useThrottle.js +0 -16
- package/hooks/useToggle.js +0 -11
- package/hooks/useUpdatableRef.js +0 -14
- package/hooks/useUpdate.js +0 -10
- package/hooks/useWidth.js +0 -16
- package/hooks/useWindowSize.js +0 -40
- package/index-122432cd.js +0 -270
- package/index-262edd7a.js +0 -77
- package/index-2f5aa51e.js +0 -6483
- package/index-370f9acd.js +0 -4
- package/index-45eafea6.js +0 -90
- package/index-480fd7d9.js +0 -10032
- package/index-5f37f281.js +0 -168
- package/index-73aaa093.js +0 -1940
- package/index.mobile.d.ts +0 -14
- package/lib/atoms/Avatar/index.d.ts +0 -1
- package/lib/atoms/Badge/Badge.d.ts +0 -36
- package/lib/atoms/Badge/index.d.ts +0 -1
- package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
- package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
- package/lib/atoms/BusyLoader/index.d.ts +0 -1
- package/lib/atoms/Button/Button.d.ts +0 -70
- package/lib/atoms/Button/index.d.ts +0 -1
- package/lib/atoms/Divider/index.d.ts +0 -1
- package/lib/atoms/Empty/Empty.d.ts +0 -39
- package/lib/atoms/Empty/index.d.ts +0 -1
- package/lib/atoms/Empty/utils.d.ts +0 -9
- package/lib/atoms/HelperText/index.d.ts +0 -1
- package/lib/atoms/Image/Image.d.ts +0 -51
- package/lib/atoms/Image/index.d.ts +0 -1
- package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
- package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
- package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
- package/lib/atoms/ImagePreview/index.d.ts +0 -1
- package/lib/atoms/Info/index.d.ts +0 -1
- package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
- package/lib/atoms/KeyValue/index.d.ts +0 -1
- package/lib/atoms/Label/index.d.ts +0 -1
- package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
- package/lib/atoms/LinkButton/index.d.ts +0 -1
- package/lib/atoms/Loader/index.d.ts +0 -1
- package/lib/atoms/Pill/index.d.ts +0 -1
- package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
- package/lib/atoms/Rating/Rating.d.ts +0 -49
- package/lib/atoms/Rating/index.d.ts +0 -1
- package/lib/atoms/TextLink/index.d.ts +0 -1
- package/lib/molecules/Copy/Copy.d.ts +0 -38
- package/lib/molecules/Copy/index.d.ts +0 -1
- package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
- package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
- package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
- package/lib/molecules/Tooltip/index.d.ts +0 -1
- package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
- package/lib/providers/GeneUIProvider/index.d.ts +0 -1
- package/localization-4ba17032.js +0 -46
- package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
- package/rangeAndSlider-693a3d41.js +0 -8684
- package/react-beautiful-dnd.esm-b637016a.js +0 -10116
- package/react-lifecycles-compat.es-6e1f3768.js +0 -158
- package/redux-e591c1b8.js +0 -536
- package/tokens-8ab1179c.js +0 -6
- package/tslib.es6-f211516f.js +0 -35
- package/useEllipsisDetection-c1c9ad94.js +0 -38
package/Card/index.js
DELETED
|
@@ -1,502 +0,0 @@
|
|
|
1
|
-
import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
|
|
2
|
-
import React__default, { useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { c as classnames } from '../index-031ff73c.js';
|
|
5
|
-
import { o as oneIsRequired, s as stopEvent, n as noop } from '../index-5f37f281.js';
|
|
6
|
-
import '../configs-00612ce0.js';
|
|
7
|
-
import useBodyScroll from '../hooks/useBodyScroll.js';
|
|
8
|
-
import Button from '../Button/index.js';
|
|
9
|
-
import MobilePopUp from '../MobilePopup/index.js';
|
|
10
|
-
import '../dateValidation-67caec66.js';
|
|
11
|
-
import 'react-dom';
|
|
12
|
-
import useClickOutside from '../hooks/useClickOutside.js';
|
|
13
|
-
import Popover from '../Popover/index.js';
|
|
14
|
-
import Menu from '../Menu/index.js';
|
|
15
|
-
import SkeletonLoader from '../SkeletonLoader/index.js';
|
|
16
|
-
import KeyValue from '../KeyValue/index.js';
|
|
17
|
-
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
18
|
-
import { g as guid } from '../guid-8ddf77b3.js';
|
|
19
|
-
import '../tslib.es6-f211516f.js';
|
|
20
|
-
import '../Icon/index.js';
|
|
21
|
-
import '../Portal/index.js';
|
|
22
|
-
import '../GeneUIProvider/index.js';
|
|
23
|
-
import '../_commonjsHelpers-24198af3.js';
|
|
24
|
-
import '../index-122432cd.js';
|
|
25
|
-
import '../hooks/useDeviceType.js';
|
|
26
|
-
import '../hooks/useWindowSize.js';
|
|
27
|
-
import '../hooks/useDebounce.js';
|
|
28
|
-
import '../hooks/useUpdatableRef.js';
|
|
29
|
-
import '../hooks/useForceUpdate.js';
|
|
30
|
-
import '../Scrollbar/index.js';
|
|
31
|
-
import '../Option/index.js';
|
|
32
|
-
import '../useEllipsisDetection-c1c9ad94.js';
|
|
33
|
-
import '../index-65217440.js';
|
|
34
|
-
|
|
35
|
-
function CardMenu(_ref) {
|
|
36
|
-
let {
|
|
37
|
-
menuOptions = []
|
|
38
|
-
} = _ref;
|
|
39
|
-
const bodyScroll = useBodyScroll();
|
|
40
|
-
const [isOpened, setIsOpened] = useState(false);
|
|
41
|
-
const handleOpen = useCallback(() => {
|
|
42
|
-
setIsOpened(true);
|
|
43
|
-
bodyScroll.lock();
|
|
44
|
-
}, []);
|
|
45
|
-
useEffect(() => () => bodyScroll.unlock(), []);
|
|
46
|
-
const handleClose = useCallback(() => {
|
|
47
|
-
setIsOpened(false);
|
|
48
|
-
bodyScroll.unlock();
|
|
49
|
-
}, []);
|
|
50
|
-
const handleOutsideClick = useClickOutside(handleClose);
|
|
51
|
-
const handleItemClick = useCallback(_ref2 => {
|
|
52
|
-
let {
|
|
53
|
-
onClick,
|
|
54
|
-
disabled,
|
|
55
|
-
...item
|
|
56
|
-
} = _ref2;
|
|
57
|
-
if (!disabled) {
|
|
58
|
-
onClick && onClick(event);
|
|
59
|
-
handleClose(item);
|
|
60
|
-
}
|
|
61
|
-
}, [handleClose]);
|
|
62
|
-
const options = useMemo(() => menuOptions.filter(Boolean).map(item => {
|
|
63
|
-
if ( /*#__PURE__*/React__default.isValidElement(item)) {
|
|
64
|
-
return {
|
|
65
|
-
component: /*#__PURE__*/React__default.cloneElement(item, {
|
|
66
|
-
onClick: () => handleItemClick(item.props)
|
|
67
|
-
})
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
...item,
|
|
72
|
-
onClick: () => handleItemClick(item)
|
|
73
|
-
};
|
|
74
|
-
}), [menuOptions, handleItemClick]);
|
|
75
|
-
return /*#__PURE__*/React__default.createElement(Popover, {
|
|
76
|
-
swipeable: true,
|
|
77
|
-
screenType: "mobile",
|
|
78
|
-
isOpen: isOpened,
|
|
79
|
-
onSwipedDown: handleClose,
|
|
80
|
-
contentRef: handleOutsideClick,
|
|
81
|
-
Content: /*#__PURE__*/React__default.createElement(Menu, {
|
|
82
|
-
screenType: "mobile",
|
|
83
|
-
data: [...options, {
|
|
84
|
-
title: 'Cancel',
|
|
85
|
-
onClick: handleClose,
|
|
86
|
-
icon: 'bc-icon-clear',
|
|
87
|
-
border: 'top'
|
|
88
|
-
}]
|
|
89
|
-
})
|
|
90
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
91
|
-
onClick: handleOpen,
|
|
92
|
-
icon: "bc-icon-more-horizontal",
|
|
93
|
-
appearance: "minimal",
|
|
94
|
-
withShadow: true
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
var css_248z = "[data-gene-ui-version=\"2.16.3\"] .card-holder{position:relative;width:100%}[data-gene-ui-version=\"2.16.3\"] .card-holder.with-button{padding-inline-end:1.2rem}[data-gene-ui-version=\"2.16.3\"] .card-holder+.card-holder{padding-top:1rem}[data-gene-ui-version=\"2.16.3\"] .ReactVirtualized__Grid .card-holder{left:0;position:absolute;width:100%}[data-gene-ui-version=\"2.16.3\"] .card-container{position:relative;width:100%}[data-gene-ui-version=\"2.16.3\"] .card-more-button-holder{background:var(--background);border-radius:100%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:1}html[dir=rtl] .card-more-button-holder{transform:translate(50%,-50%)}html:not([dir=rtl]) .card-more-button-holder{left:100%}html[dir=rtl] .card-more-button-holder{right:100%}[data-gene-ui-version=\"2.16.3\"] .card-c-holder{grid-column-gap:1rem;grid-row-gap:1.2rem;background:var(--background);border-radius:1rem;display:grid;font:600 1.6rem/2.2rem var(--font-family);grid-template-columns:1fr 1fr;padding:1.4rem 1rem;position:relative;width:100%}[data-gene-ui-version=\"2.16.3\"] .card-c-holder.border:after{border:1px solid var(--background-sc);border-radius:inherit;content:\"\";display:block;height:100%;left:0;opacity:.1;pointer-events:none;position:absolute;top:0;width:100%}[data-gene-ui-version=\"2.16.3\"] .card-c-holder.shadow{box-shadow:0 1px .3rem 0 #0000001a}[data-gene-ui-version=\"2.16.3\"] .card-c-holder .card-list-col{overflow:hidden}[data-gene-ui-version=\"2.16.3\"] .card-c-holder .card-list-col .kv-label{font:600 1.2rem/1.6rem var(--font-family);margin:0 0 .4rem;opacity:.5}[data-gene-ui-version=\"2.16.3\"] .card-c-holder a{color:var(--hero)}[data-gene-ui-version=\"2.16.3\"] .expand-card-holder{background:var(--background);bottom:0;padding:0 0 1.6rem;position:-webkit-sticky;position:sticky;width:100%;z-index:10}";
|
|
99
|
-
styleInject(css_248z);
|
|
100
|
-
|
|
101
|
-
function Col(_ref) {
|
|
102
|
-
let {
|
|
103
|
-
col,
|
|
104
|
-
row,
|
|
105
|
-
index,
|
|
106
|
-
...restProps
|
|
107
|
-
} = _ref;
|
|
108
|
-
const guidRef = useRef(null);
|
|
109
|
-
const mounted = useRef(null);
|
|
110
|
-
const {
|
|
111
|
-
getter,
|
|
112
|
-
formatter,
|
|
113
|
-
colRenderer,
|
|
114
|
-
dataKey,
|
|
115
|
-
text
|
|
116
|
-
} = col;
|
|
117
|
-
const getterValue = getter ? getter(row, index) : row.data[dataKey];
|
|
118
|
-
const formattedValue = formatter ? formatter(getterValue, row, index) : getterValue;
|
|
119
|
-
const isValuePromise = formattedValue instanceof Promise;
|
|
120
|
-
const [promiseValue, setPromiseValue] = useState(() => {
|
|
121
|
-
if (isValuePromise) {
|
|
122
|
-
guidRef.current = guid();
|
|
123
|
-
return guidRef.current;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
mounted.current = true;
|
|
128
|
-
isValuePromise && formattedValue.then(result => mounted.current && setPromiseValue(result));
|
|
129
|
-
return () => {
|
|
130
|
-
mounted.current = false;
|
|
131
|
-
};
|
|
132
|
-
}, [formattedValue, isValuePromise, mounted.current]);
|
|
133
|
-
const value = isValuePromise ? promiseValue : formattedValue;
|
|
134
|
-
const colNode = colRenderer ? colRenderer(value, index, row) : value;
|
|
135
|
-
return /*#__PURE__*/React__default.createElement(KeyValue, _extends({}, restProps, {
|
|
136
|
-
key: dataKey,
|
|
137
|
-
label: text,
|
|
138
|
-
appearance: "vertical",
|
|
139
|
-
value: /*#__PURE__*/React__default.createElement(SkeletonLoader, {
|
|
140
|
-
height: 20,
|
|
141
|
-
isBusy: guidRef.current && promiseValue === guidRef.current
|
|
142
|
-
}, colNode || null),
|
|
143
|
-
className: "card-list-col"
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
146
|
-
Col.propTypes = {
|
|
147
|
-
/**
|
|
148
|
-
* sortFn: Custom sort function for columns.((prev: PropTypes.rows[item], next: PropTypes.rows[item], rows: PropTypes.rows, dataKey: string) => {
|
|
149
|
-
* if (prev is less than next by some ordering criterion) {
|
|
150
|
-
* return -1;
|
|
151
|
-
* }
|
|
152
|
-
* if (prev is greater than next by the ordering criterion) {
|
|
153
|
-
* return 1;
|
|
154
|
-
* }
|
|
155
|
-
* prev is equal to next
|
|
156
|
-
* return 0;
|
|
157
|
-
* }
|
|
158
|
-
* })
|
|
159
|
-
*
|
|
160
|
-
* text: Text value for columns
|
|
161
|
-
*
|
|
162
|
-
* render: Function to render custom text.((column: PropTypes.columns[item], index: number, isEditActive: boolean) => return any)
|
|
163
|
-
*
|
|
164
|
-
* current column's data key
|
|
165
|
-
*
|
|
166
|
-
* colRenderer: Render custom component on certain column of each row. ((value: string || number, index: number, row: PropTypes.rows[item], isEditActive: boolean) => {
|
|
167
|
-
* return <div>Hello World</div>})
|
|
168
|
-
*
|
|
169
|
-
* getter: Function to define custom text. ((row: PropTypes.rows[item], index: number, isEditActive: boolean)) => {
|
|
170
|
-
* return some string
|
|
171
|
-
* })
|
|
172
|
-
*
|
|
173
|
-
* formatter: Function tp format displaying text. ((middleText: string, row: PropTypes.rows[item], index: number, isEditActive: boolean) => {
|
|
174
|
-
* return some string
|
|
175
|
-
* })
|
|
176
|
-
*
|
|
177
|
-
*/
|
|
178
|
-
col: PropTypes.shape({
|
|
179
|
-
sortFn: PropTypes.func,
|
|
180
|
-
...oneIsRequired({
|
|
181
|
-
text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
182
|
-
render: PropTypes.func
|
|
183
|
-
}),
|
|
184
|
-
dataKey: PropTypes.string,
|
|
185
|
-
colRenderer: PropTypes.func,
|
|
186
|
-
getter: PropTypes.func,
|
|
187
|
-
formatter: PropTypes.func
|
|
188
|
-
}).isRequired,
|
|
189
|
-
/**
|
|
190
|
-
* data: rows column's data
|
|
191
|
-
* className: additional className for row element
|
|
192
|
-
* render: Render custom component on (row: PropTypes.rows[item] index: number) => {
|
|
193
|
-
* return <div>Hello World</div>})
|
|
194
|
-
*/
|
|
195
|
-
row: PropTypes.shape({
|
|
196
|
-
data: PropTypes.object,
|
|
197
|
-
className: PropTypes.string,
|
|
198
|
-
render: PropTypes.func
|
|
199
|
-
}),
|
|
200
|
-
/**
|
|
201
|
-
* Index of row
|
|
202
|
-
*/
|
|
203
|
-
index: PropTypes.number
|
|
204
|
-
};
|
|
205
|
-
var Col$1 = /*#__PURE__*/React__default.memo(Col);
|
|
206
|
-
|
|
207
|
-
function Card(_ref) {
|
|
208
|
-
let {
|
|
209
|
-
renderRowNestedChildren,
|
|
210
|
-
isCustomScrollElement,
|
|
211
|
-
viewCardText,
|
|
212
|
-
expandText,
|
|
213
|
-
cancelText,
|
|
214
|
-
expandedCloseText,
|
|
215
|
-
hideMore,
|
|
216
|
-
expandedText,
|
|
217
|
-
rowActionBar,
|
|
218
|
-
columnLimit,
|
|
219
|
-
columnKey,
|
|
220
|
-
getPopupProps,
|
|
221
|
-
virtualizedList,
|
|
222
|
-
isEditMode,
|
|
223
|
-
rowHeightCache,
|
|
224
|
-
expandDisabled,
|
|
225
|
-
rowExtraClick,
|
|
226
|
-
rowExtraClickNeeded,
|
|
227
|
-
rowExtraClickMenuTitle,
|
|
228
|
-
getExpandIconDisableState,
|
|
229
|
-
onRowClick,
|
|
230
|
-
className,
|
|
231
|
-
columns,
|
|
232
|
-
shadow,
|
|
233
|
-
border,
|
|
234
|
-
index,
|
|
235
|
-
row,
|
|
236
|
-
closeWithOutsideClick,
|
|
237
|
-
...restProps
|
|
238
|
-
} = _ref;
|
|
239
|
-
const bodyScroll = useBodyScroll();
|
|
240
|
-
const nestedElementPopupRef = useRef(null);
|
|
241
|
-
const [openDetailed, setOpenDetailed] = useState(false);
|
|
242
|
-
const [expanded, setExpanded] = useState(false);
|
|
243
|
-
const goToDetailed = useCallback(() => setOpenDetailed(true), []);
|
|
244
|
-
const handleExpand = useCallback(() => setExpanded(true), []);
|
|
245
|
-
const handleCardClick = useCallback(e => onRowClick(e, index), [index, onRowClick]);
|
|
246
|
-
const menuOptions = rowActionBar(row, index) || [];
|
|
247
|
-
const propsForPopup = getPopupProps(row, index) || {};
|
|
248
|
-
const customNestedElement = renderRowNestedChildren && renderRowNestedChildren(row, index, nestedElementPopupRef);
|
|
249
|
-
const extraClickNeeded = typeof rowExtraClickNeeded === 'function' ? rowExtraClickNeeded(row, index) : rowExtraClickNeeded;
|
|
250
|
-
const onExtraClick = useCallback(e => {
|
|
251
|
-
stopEvent(e);
|
|
252
|
-
extraClickNeeded && rowExtraClick && rowExtraClick(e, row.data, index, row);
|
|
253
|
-
}, [index, row, rowExtraClick, extraClickNeeded]);
|
|
254
|
-
const isExpandIconDisabled = useMemo(() => getExpandIconDisableState ? getExpandIconDisableState(row, index) : expandDisabled, [getExpandIconDisableState, expandDisabled, index, row]);
|
|
255
|
-
useEffect(() => {
|
|
256
|
-
if (virtualizedList) {
|
|
257
|
-
rowHeightCache.clear(index);
|
|
258
|
-
virtualizedList.recomputeRowHeights(index);
|
|
259
|
-
}
|
|
260
|
-
}, [virtualizedList, columns.length, isEditMode]);
|
|
261
|
-
useEffect(() => {
|
|
262
|
-
openDetailed || isCustomScrollElement && !expanded ? bodyScroll.lock() : bodyScroll.unlock();
|
|
263
|
-
return () => bodyScroll.unlock();
|
|
264
|
-
}, [openDetailed, isCustomScrollElement, expanded]);
|
|
265
|
-
const handleCloseDetails = useCallback((_, isBackdrop) => {
|
|
266
|
-
isBackdrop ? closeWithOutsideClick && setOpenDetailed(false) : setOpenDetailed(false);
|
|
267
|
-
}, [closeWithOutsideClick]);
|
|
268
|
-
const handleCloseExpand = useCallback((_, isBackdrop) => {
|
|
269
|
-
isBackdrop ? closeWithOutsideClick && setExpanded(false) : setExpanded(false);
|
|
270
|
-
}, [closeWithOutsideClick]);
|
|
271
|
-
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
272
|
-
className: classnames('card-holder with-button', className),
|
|
273
|
-
onClick: handleCardClick
|
|
274
|
-
}, restProps), /*#__PURE__*/React__default.createElement("div", {
|
|
275
|
-
className: "card-container"
|
|
276
|
-
}, !hideMore && /*#__PURE__*/React__default.createElement("div", {
|
|
277
|
-
className: "card-more-button-holder"
|
|
278
|
-
}, /*#__PURE__*/React__default.createElement(CardMenu, {
|
|
279
|
-
menuOptions: [{
|
|
280
|
-
title: viewCardText,
|
|
281
|
-
onClick: goToDetailed,
|
|
282
|
-
icon: 'bc-icon-report',
|
|
283
|
-
color: 'hero',
|
|
284
|
-
border: menuOptions && !customNestedElement ? 'bottom' : 'none'
|
|
285
|
-
}, customNestedElement && {
|
|
286
|
-
title: expandText,
|
|
287
|
-
disabled: isExpandIconDisabled,
|
|
288
|
-
onClick: handleExpand,
|
|
289
|
-
icon: 'bc-icon-expand',
|
|
290
|
-
color: 'hero',
|
|
291
|
-
border: menuOptions.length && !extraClickNeeded ? 'bottom' : 'none'
|
|
292
|
-
}, extraClickNeeded && {
|
|
293
|
-
title: rowExtraClickMenuTitle,
|
|
294
|
-
onClick: onExtraClick,
|
|
295
|
-
icon: 'bc-icon-expand',
|
|
296
|
-
color: 'hero',
|
|
297
|
-
border: menuOptions.length ? 'bottom' : 'none'
|
|
298
|
-
}, ...menuOptions]
|
|
299
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
300
|
-
className: classnames('card-c-holder', {
|
|
301
|
-
shadow,
|
|
302
|
-
border
|
|
303
|
-
})
|
|
304
|
-
}, columns.slice(0, columnLimit).map(col => /*#__PURE__*/React__default.createElement(Col$1, {
|
|
305
|
-
key: col[columnKey],
|
|
306
|
-
col: col,
|
|
307
|
-
index: index,
|
|
308
|
-
row: row
|
|
309
|
-
})))), /*#__PURE__*/React__default.createElement(MobilePopUp, _extends({
|
|
310
|
-
isOpened: openDetailed,
|
|
311
|
-
leftActionClick: handleCloseDetails,
|
|
312
|
-
onBackdropClick: handleCloseDetails
|
|
313
|
-
}, propsForPopup), /*#__PURE__*/React__default.createElement("div", {
|
|
314
|
-
className: "quick-view-holder"
|
|
315
|
-
}, columns.map(col => /*#__PURE__*/React__default.createElement(Col$1, {
|
|
316
|
-
key: col[columnKey],
|
|
317
|
-
col: col,
|
|
318
|
-
index: index,
|
|
319
|
-
row: row
|
|
320
|
-
}))), customNestedElement && /*#__PURE__*/React__default.createElement("div", {
|
|
321
|
-
className: "expand-card-holder"
|
|
322
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
323
|
-
icon: "bc-icon-expand",
|
|
324
|
-
flexibility: "full-width",
|
|
325
|
-
onClick: () => setExpanded(true),
|
|
326
|
-
disabled: isExpandIconDisabled
|
|
327
|
-
}, expandText))), customNestedElement && /*#__PURE__*/React__default.createElement(MobilePopUp, {
|
|
328
|
-
isOpened: expanded,
|
|
329
|
-
title: expandedText,
|
|
330
|
-
ref: nestedElementPopupRef,
|
|
331
|
-
leftAction: {
|
|
332
|
-
text: expandedCloseText
|
|
333
|
-
},
|
|
334
|
-
onBackdropClick: handleCloseExpand,
|
|
335
|
-
leftActionClick: handleCloseExpand
|
|
336
|
-
}, customNestedElement(row, index, nestedElementPopupRef)));
|
|
337
|
-
}
|
|
338
|
-
Card.propTypes = {
|
|
339
|
-
/**
|
|
340
|
-
* Close card details and expanded popups with outside click
|
|
341
|
-
*/
|
|
342
|
-
closeWithOutsideClick: PropTypes.bool,
|
|
343
|
-
/**
|
|
344
|
-
* Has component shadow or no
|
|
345
|
-
*/
|
|
346
|
-
shadow: PropTypes.bool,
|
|
347
|
-
/**
|
|
348
|
-
* Has component border or no
|
|
349
|
-
*/
|
|
350
|
-
border: PropTypes.bool,
|
|
351
|
-
/**
|
|
352
|
-
* Index of row
|
|
353
|
-
*/
|
|
354
|
-
index: PropTypes.number,
|
|
355
|
-
/**
|
|
356
|
-
* Additional classname
|
|
357
|
-
*/
|
|
358
|
-
className: PropTypes.string,
|
|
359
|
-
/**
|
|
360
|
-
* data: rows column's data
|
|
361
|
-
* className: additional className for row element
|
|
362
|
-
* render: Render custom component on (row: PropTypes.rows[item] index: number) => {
|
|
363
|
-
* return <div>Hello World</div>})
|
|
364
|
-
*/
|
|
365
|
-
row: PropTypes.shape({
|
|
366
|
-
data: PropTypes.object,
|
|
367
|
-
className: PropTypes.string,
|
|
368
|
-
render: PropTypes.func
|
|
369
|
-
}),
|
|
370
|
-
/**
|
|
371
|
-
* sortFn: Custom sort function for columns.((prev: PropTypes.rows[item], next: PropTypes.rows[item], rows: PropTypes.rows, dataKey: string) => {
|
|
372
|
-
* if (prev is less than next by some ordering criterion) {
|
|
373
|
-
* return -1;
|
|
374
|
-
* }
|
|
375
|
-
* if (prev is greater than next by the ordering criterion) {
|
|
376
|
-
* return 1;
|
|
377
|
-
* }
|
|
378
|
-
* prev is equal to next
|
|
379
|
-
* return 0;
|
|
380
|
-
* }
|
|
381
|
-
* })
|
|
382
|
-
*
|
|
383
|
-
* text: Text value for columns
|
|
384
|
-
*
|
|
385
|
-
* render: Function to render custom text.((column: PropTypes.columns[item], index: number, isEditActive: boolean) => return any)
|
|
386
|
-
*
|
|
387
|
-
* sortable: Allows sorting if true
|
|
388
|
-
*
|
|
389
|
-
* resizable: Allows resizing if true
|
|
390
|
-
*
|
|
391
|
-
* current column's data key
|
|
392
|
-
*
|
|
393
|
-
* draggable: Allows dragging if true
|
|
394
|
-
*
|
|
395
|
-
* colRenderer: Render custom component on certain column of each row. ((value: string || number, index: number, row: PropTypes.rows[item], isEditActive: boolean) => {
|
|
396
|
-
* return <div>Hello World</div>})
|
|
397
|
-
*
|
|
398
|
-
* getter: Function to define custom text. ((row: PropTypes.rows[item], index: number, isEditActive: boolean)) => {
|
|
399
|
-
* return some string
|
|
400
|
-
* })
|
|
401
|
-
*
|
|
402
|
-
* formatter: Function tp format displaying text. ((middleText: string, row: PropTypes.rows[item], index: number, isEditActive: boolean) => {
|
|
403
|
-
* return some string
|
|
404
|
-
* })
|
|
405
|
-
*
|
|
406
|
-
*/
|
|
407
|
-
columns: PropTypes.arrayOf(PropTypes.shape({
|
|
408
|
-
sortFn: PropTypes.func,
|
|
409
|
-
...oneIsRequired({
|
|
410
|
-
text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
411
|
-
render: PropTypes.func
|
|
412
|
-
}),
|
|
413
|
-
sortable: PropTypes.bool,
|
|
414
|
-
resizable: PropTypes.bool,
|
|
415
|
-
dataKey: PropTypes.string,
|
|
416
|
-
draggable: PropTypes.bool,
|
|
417
|
-
colRenderer: PropTypes.func,
|
|
418
|
-
getter: PropTypes.func,
|
|
419
|
-
formatter: PropTypes.func,
|
|
420
|
-
hide: PropTypes.bool
|
|
421
|
-
})).isRequired,
|
|
422
|
-
/**
|
|
423
|
-
* Number of columns that will be shown
|
|
424
|
-
*/
|
|
425
|
-
columnLimit: PropTypes.number,
|
|
426
|
-
/**
|
|
427
|
-
* Function which will return Array of objects as row's action bar on the right corner of the row. ((row: PropTypes.rows[item] ,index: number) => [])
|
|
428
|
-
*/
|
|
429
|
-
rowActionBar: PropTypes.func,
|
|
430
|
-
/**
|
|
431
|
-
* Function which will return props for mobile popup. ((row: PropTypes.rows[item] ,index: number) => {})
|
|
432
|
-
*/
|
|
433
|
-
getPopupProps: PropTypes.func,
|
|
434
|
-
/**
|
|
435
|
-
* Fires event when clicked on row
|
|
436
|
-
* (event: SyntheticEvent, index: number) => void
|
|
437
|
-
*/
|
|
438
|
-
onRowClick: PropTypes.func,
|
|
439
|
-
/**
|
|
440
|
-
* Text for View Card
|
|
441
|
-
*/
|
|
442
|
-
viewCardText: PropTypes.string,
|
|
443
|
-
/**
|
|
444
|
-
* Text for Expand
|
|
445
|
-
*/
|
|
446
|
-
expandText: PropTypes.string,
|
|
447
|
-
/**
|
|
448
|
-
* Text for Cancel
|
|
449
|
-
*/
|
|
450
|
-
cancelText: PropTypes.string,
|
|
451
|
-
/**
|
|
452
|
-
* Text for Expanded popup close button
|
|
453
|
-
*/
|
|
454
|
-
expandedCloseText: PropTypes.string,
|
|
455
|
-
/**
|
|
456
|
-
* Text for Expanded popup title
|
|
457
|
-
*/
|
|
458
|
-
expandedText: PropTypes.string,
|
|
459
|
-
/**
|
|
460
|
-
* Function which should return null or another
|
|
461
|
-
* Function which will return valid node
|
|
462
|
-
*/
|
|
463
|
-
renderRowNestedChildren: PropTypes.func,
|
|
464
|
-
/**
|
|
465
|
-
* Extra click function for rows. ((e: event object, data: object, index: number, row: PropTypes.rows[item]) => custom logic)
|
|
466
|
-
*/
|
|
467
|
-
rowExtraClick: PropTypes.func,
|
|
468
|
-
/**
|
|
469
|
-
* Expand button disabled state
|
|
470
|
-
*/
|
|
471
|
-
expandDisabled: PropTypes.bool,
|
|
472
|
-
/**
|
|
473
|
-
* Is card in edit mode
|
|
474
|
-
*/
|
|
475
|
-
isEditMode: PropTypes.bool,
|
|
476
|
-
/**
|
|
477
|
-
* Hide show more button
|
|
478
|
-
*/
|
|
479
|
-
hideMore: PropTypes.bool,
|
|
480
|
-
/**
|
|
481
|
-
* Function for determining which rows should have extra click. ((e: event object, data: object, index: number, row: PropTypes.rows[item]) => return true or false)
|
|
482
|
-
*/
|
|
483
|
-
rowExtraClickNeeded: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
484
|
-
/**
|
|
485
|
-
* Title for rowExtraClick menu item
|
|
486
|
-
*/
|
|
487
|
-
rowExtraClickMenuTitle: PropTypes.string
|
|
488
|
-
};
|
|
489
|
-
Card.defaultProps = {
|
|
490
|
-
rowActionBar: noop,
|
|
491
|
-
getPopupProps: noop,
|
|
492
|
-
onRowClick: noop,
|
|
493
|
-
rowExtraClickNeeded: noop,
|
|
494
|
-
viewCardText: 'View Card',
|
|
495
|
-
expandText: 'Expand',
|
|
496
|
-
cancelText: 'Cancel',
|
|
497
|
-
expandedText: 'Expanded',
|
|
498
|
-
expandedCloseText: 'Close'
|
|
499
|
-
};
|
|
500
|
-
var Card$1 = /*#__PURE__*/React__default.memo(Card);
|
|
501
|
-
|
|
502
|
-
export { Card$1 as default };
|