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