@cashub/ui 0.47.0 → 0.48.0
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/Tab/TabList.js +38 -26
- package/Tab/TabPanel.js +13 -20
- package/Tab/TabTab.js +36 -24
- package/Tab/index.js +15 -1
- package/Tab/subComponent/TabListV2.js +25 -0
- package/Tab/subComponent/TabPanelV2.js +52 -0
- package/Tab/subComponent/TabTabV2.js +63 -0
- package/VerticalTab/TabList.js +13 -18
- package/VerticalTab/TabPanel.js +16 -20
- package/VerticalTab/TabTab.js +40 -21
- package/VerticalTab/VerticalTab.js +8 -4
- package/alert/Alert.js +12 -5
- package/animate/Collapse.js +5 -7
- package/animate/Loader.js +18 -7
- package/animate/PulseRing.js +18 -5
- package/animate/Spinner.js +8 -3
- package/backdrop/BaseBackdrop.js +9 -3
- package/backdrop/LoadingBackdrop.js +7 -3
- package/backdrop/ModalBackdrop.js +5 -3
- package/badge/Badge.js +15 -3
- package/badge/BadgeDot.js +8 -3
- package/badge/BadgeFill.js +24 -6
- package/badge/BadgeWithText.js +13 -3
- package/billing/BarChart.js +1 -1
- package/breadcrumb/Breadcrumb.js +42 -3
- package/button/Button.js +88 -20
- package/button/ButtonGroup.js +33 -9
- package/button/IconButton.js +37 -10
- package/button/ScrollToTopButton.js +12 -4
- package/callout/Callout.js +37 -8
- package/chart/BarChart.js +10 -17
- package/chart/DoughnutChart.js +34 -20
- package/chart/LineChart.js +11 -18
- package/chart/SingleBarChart.js +22 -5
- package/chart/utils/centerTextPlugin.js +2 -2
- package/chart/utils/customTooltip.js +7 -7
- package/chart/utils/htmlLegendPlugin.js +1 -1
- package/container/FlexContainer.js +15 -7
- package/cropper/Cropper.js +1 -2
- package/datetimePicker/DatePicker.js +80 -26
- package/datetimePicker/DatePickerV2.js +95 -36
- package/datetimePicker/DatetimePicker.js +174 -11
- package/datetimePicker/DatetimePickerV2.js +87 -33
- package/datetimePicker/DatetimePickerV3.js +174 -11
- package/datetimePicker/TimeInput.js +35 -10
- package/datetimePicker/TimePicker.js +77 -22
- package/datetimePicker/TimePickerStyle.js +53 -3
- package/datetimePicker/TimePickerV2.js +54 -21
- package/datetimePicker/accordion/Month.js +93 -16
- package/datetimePicker/accordion/Year.js +96 -18
- package/datetimePicker/hooks/useChangeNumber.js +3 -6
- package/datetimePicker/hooks/useDecrease.js +3 -6
- package/datetimePicker/hooks/useIncrease.js +3 -6
- package/datetimePicker/subComponent/Accordion.js +101 -20
- package/descriptionList/DescriptionDetail.js +15 -4
- package/descriptionList/DescriptionList.js +12 -4
- package/descriptionList/DescriptionTerm.js +5 -3
- package/divider/Divider.js +15 -6
- package/dropdown/DropdownButtonOption.js +22 -6
- package/dropdown/DropdownContent.js +29 -15
- package/dropdown/DropdownDivOption.js +17 -3
- package/dropdown/DropdownLinkOption.js +14 -3
- package/dropdown/DropdownToggle.js +7 -15
- package/dropzone/FileDropzone.js +121 -22
- package/dropzone/ImageDropzone.js +83 -14
- package/dropzone/subComponent/Message.js +11 -4
- package/figure/IconFigure.js +16 -7
- package/figure/ImageFigure.js +19 -6
- package/file/HiddenFileInput.js +3 -3
- package/form/Checkbox.js +74 -13
- package/form/Fieldset.js +9 -3
- package/form/FormItem.js +10 -5
- package/form/Input.js +40 -7
- package/form/Label.js +34 -10
- package/form/MutedText.js +8 -4
- package/form/PasswordInput.js +20 -13
- package/form/RadioButton.js +55 -8
- package/form/SearchSelect.js +64 -12
- package/form/Searchbox.js +45 -19
- package/form/Slider.js +28 -10
- package/form/SwitchButton.js +48 -14
- package/form/Textarea.js +30 -3
- package/form/TreeView.js +13 -6
- package/grid/Column.js +23 -10
- package/grid/Grid.js +14 -6
- package/heading/Heading1.js +8 -4
- package/heading/Heading2.js +11 -5
- package/heading/Heading3.js +20 -8
- package/iconbox/ApplicationIconBox.js +48 -12
- package/iconbox/IconBox.js +31 -7
- package/iconbox/IconBoxV2.js +33 -8
- package/iconbox/subComponent/IconBoxFigure.js +17 -9
- package/iconbox/subComponent/IconBoxImage.js +21 -8
- package/image/ImageFluid.js +7 -3
- package/image/UploadImage.js +66 -18
- package/index.js +8 -1
- package/jsoneditor/JsonEditor.js +121 -15
- package/keyframe/Pulse.js +13 -3
- package/keyframe/Spin.js +5 -3
- package/layout/Aside.js +30 -5
- package/layout/Backdrop.js +8 -4
- package/layout/Container.js +21 -5
- package/layout/Footer.js +26 -7
- package/link/LinkSpan.js +37 -19
- package/map/GoogleMap.js +3 -7
- package/map/GoogleReverseGeolocation.js +6 -3
- package/map/LeafletMap.js +2 -2
- package/map/subComponent/GoogleMapContainer.js +16 -4
- package/map/subComponent/GoogleMapPopup.js +7 -10
- package/map/subComponent/GoogleMapWrapper.js +8 -15
- package/map/subComponent/LeafletDrawControl.js +9 -7
- package/map/subComponent/LeafletMapContainer.js +159 -4
- package/modal/StateModal.js +49 -28
- package/modal/TitleModal.js +70 -29
- package/package.json +1 -1
- package/page/Disclaimer.js +119 -3
- package/paginate/Paginate.js +54 -12
- package/popover/Popover.js +30 -25
- package/qrcode/QRCode.js +20 -6
- package/qrcode/QRCodeContainter.js +12 -4
- package/ribbon/Ribbon.js +29 -4
- package/section/Section.js +68 -20
- package/section/SectionBody.js +29 -8
- package/section/SectionHeader.js +36 -11
- package/section/SectionToolbar.js +9 -3
- package/section/SectionToolbarItem.js +8 -3
- package/select/InputSelect.js +16 -23
- package/select/Select.js +112 -43
- package/select/subComponent/Checkbox.js +24 -5
- package/select/subComponent/Footer.js +4 -3
- package/select/subComponent/ListBox.js +12 -5
- package/select/subComponent/Option.js +27 -7
- package/select/subComponent/OptionGroup.js +13 -3
- package/select/subComponent/Options.js +18 -5
- package/select/subComponent/SearchBox.js +34 -12
- package/select/subComponent/SelectedMultipleTags.js +21 -3
- package/select/subComponent/SelectedMultipleText.js +19 -4
- package/select/subComponent/SelectedSingle.js +7 -3
- package/styles/GlobalStyle.js +156 -45
- package/styles/mixin/backgroundColor.js +16 -8
- package/styles/mixin/borderColor.js +13 -7
- package/styles/mixin/color.js +13 -7
- package/styles/mixin/colorOnBackground.js +13 -7
- package/styles/mixin/inputPlaceholder.js +20 -3
- package/styles/mixin/media.js +5 -3
- package/styles/mixin/rounded.js +10 -6
- package/styles/mixin/scrollbar.js +13 -3
- package/styles/theme/dark.theme.js +15 -14
- package/styles/theme/light.theme.js +15 -14
- package/styles/theme/white.theme.js +15 -14
- package/table/GridTable.js +71 -33
- package/table/ImageBox.js +15 -5
- package/table/InfiniteGridTable.js +92 -46
- package/table/PermissionTable.js +32 -10
- package/table/SimpleGridTable.js +143 -0
- package/table/Table.js +198 -48
- package/table/__mock__/columns.js +1 -1
- package/table/index.js +7 -0
- package/table/subComponent/BaseTableHeadCell.js +37 -8
- package/table/subComponent/GridTableFooter.js +10 -4
- package/table/subComponent/GridTableHeadCell.js +6 -4
- package/table/subComponent/Resizer.js +19 -4
- package/table/subComponent/TableFooter.js +15 -6
- package/table/subComponent/TableFooterInfo.js +4 -3
- package/table/subComponent/TableFooterPager.js +19 -6
- package/table/subComponent/TableHeadCell.js +9 -3
- package/table/subComponent/TableSort.js +17 -7
- package/tagify/TagifyStyle.js +49 -3
- package/tagify/Tags.js +37 -21
- package/tagify/templates/getCreateButtonTemplate.js +5 -2
- package/text/Paragraph.js +50 -12
- package/timeline/Timeline.js +94 -17
- package/toast/CustomToastContainer.js +35 -3
- package/toast/MessageContainer.js +22 -4
- package/tooltip/Tooltip.js +47 -19
- package/treeView/TreeViewV2.js +1 -1
- package/treeView/TreeflexStyle.js +38 -3
- package/wizard/Wizard.js +115 -6
|
@@ -12,17 +12,7 @@ var _GridTableHeadCell = _interopRequireDefault(require("./subComponent/GridTabl
|
|
|
12
12
|
var _Resizer = _interopRequireDefault(require("./subComponent/Resizer"));
|
|
13
13
|
var _Popover = _interopRequireDefault(require("../popover/Popover"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
16
|
-
const _excluded = ["title", "fieldName", "render", "custom", "width"];
|
|
17
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
19
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
20
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
21
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
16
|
const ROW_HEIGHT = 48;
|
|
27
17
|
const OVER_SCAN_COUNT = 5;
|
|
28
18
|
const InfiniteGridTable = _ref => {
|
|
@@ -50,7 +40,10 @@ const InfiniteGridTable = _ref => {
|
|
|
50
40
|
info: 'Showing _START_ to _END_ of _TOTAL_ entries',
|
|
51
41
|
empty: 'No data available in table'
|
|
52
42
|
};
|
|
53
|
-
return
|
|
43
|
+
return {
|
|
44
|
+
...defaultTexts,
|
|
45
|
+
...translation
|
|
46
|
+
};
|
|
54
47
|
}, [translation]);
|
|
55
48
|
const tableHeight = (0, _react.useMemo)(() => {
|
|
56
49
|
// when data is empty, table will generate a row to show a message
|
|
@@ -100,11 +93,14 @@ const InfiniteGridTable = _ref => {
|
|
|
100
93
|
setTableColumns(previous => {
|
|
101
94
|
return previous.map((column, index) => {
|
|
102
95
|
if (index === targetIndex) {
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
return {
|
|
97
|
+
...column,
|
|
98
|
+
width: `${width}px`
|
|
99
|
+
};
|
|
106
100
|
}
|
|
107
|
-
return
|
|
101
|
+
return {
|
|
102
|
+
...column
|
|
103
|
+
};
|
|
108
104
|
});
|
|
109
105
|
});
|
|
110
106
|
}, []);
|
|
@@ -153,11 +149,11 @@ const InfiniteGridTable = _ref => {
|
|
|
153
149
|
} = column;
|
|
154
150
|
let key = 'TH';
|
|
155
151
|
if (title) {
|
|
156
|
-
key +=
|
|
152
|
+
key += `${key}${title}`;
|
|
157
153
|
} else if (fieldName) {
|
|
158
|
-
key +=
|
|
154
|
+
key += `${key}${fieldName}`;
|
|
159
155
|
} else {
|
|
160
|
-
key +=
|
|
156
|
+
key += `${key}${index}`;
|
|
161
157
|
}
|
|
162
158
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridTableHeadCell.default, {
|
|
163
159
|
width: width,
|
|
@@ -193,13 +189,13 @@ const InfiniteGridTable = _ref => {
|
|
|
193
189
|
return visibleData.map((row, rowIndex) => {
|
|
194
190
|
const tds = tableColumns.map((column, columnIndex) => {
|
|
195
191
|
const {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
192
|
+
title,
|
|
193
|
+
fieldName,
|
|
194
|
+
render,
|
|
195
|
+
custom,
|
|
196
|
+
width,
|
|
197
|
+
...props
|
|
198
|
+
} = column;
|
|
203
199
|
const key = rowIndex + columnIndex.toString();
|
|
204
200
|
let renderedData = null;
|
|
205
201
|
if (custom && render) {
|
|
@@ -213,13 +209,13 @@ const InfiniteGridTable = _ref => {
|
|
|
213
209
|
children: render ? render(row[fieldName], row) : String(row[fieldName])
|
|
214
210
|
});
|
|
215
211
|
}
|
|
216
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TD,
|
|
212
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
|
|
217
213
|
"data-label": title,
|
|
218
214
|
backgroundReverse: backgroundReverse,
|
|
219
|
-
$width: width
|
|
220
|
-
|
|
215
|
+
$width: width,
|
|
216
|
+
...props,
|
|
221
217
|
children: renderedData
|
|
222
|
-
}
|
|
218
|
+
}, columnIndex);
|
|
223
219
|
});
|
|
224
220
|
tds.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
|
|
225
221
|
role: "presentation",
|
|
@@ -234,7 +230,7 @@ const InfiniteGridTable = _ref => {
|
|
|
234
230
|
position: 'absolute',
|
|
235
231
|
display: 'flex',
|
|
236
232
|
left: 0,
|
|
237
|
-
top:
|
|
233
|
+
top: `${top}px`
|
|
238
234
|
},
|
|
239
235
|
children: tds
|
|
240
236
|
}, index);
|
|
@@ -266,10 +262,11 @@ const InfiniteGridTable = _ref => {
|
|
|
266
262
|
} = column;
|
|
267
263
|
return title === previousTitle && fieldName === previousFieldName;
|
|
268
264
|
});
|
|
269
|
-
const width =
|
|
270
|
-
return
|
|
265
|
+
const width = previousColumn?.width || column.width;
|
|
266
|
+
return {
|
|
267
|
+
...column,
|
|
271
268
|
width
|
|
272
|
-
}
|
|
269
|
+
};
|
|
273
270
|
});
|
|
274
271
|
});
|
|
275
272
|
}, [columns]);
|
|
@@ -296,7 +293,7 @@ const InfiniteGridTable = _ref => {
|
|
|
296
293
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
297
294
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TableWrapper, {
|
|
298
295
|
style: {
|
|
299
|
-
height:
|
|
296
|
+
height: `${tableHeight}px`
|
|
300
297
|
},
|
|
301
298
|
ref: wrapperRef,
|
|
302
299
|
backgroundReverse: backgroundReverse,
|
|
@@ -318,40 +315,89 @@ const InfiniteGridTable = _ref => {
|
|
|
318
315
|
})]
|
|
319
316
|
});
|
|
320
317
|
};
|
|
321
|
-
const TableWrapper = _styledComponents.default.div
|
|
318
|
+
const TableWrapper = _styledComponents.default.div`
|
|
319
|
+
overflow: hidden;
|
|
320
|
+
background: ${_ref2 => {
|
|
322
321
|
let {
|
|
323
322
|
backgroundReverse
|
|
324
323
|
} = _ref2;
|
|
325
324
|
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const
|
|
325
|
+
}};
|
|
326
|
+
`;
|
|
327
|
+
const ResponsiveTable = _styledComponents.default.table`
|
|
328
|
+
/* make fixed width work */
|
|
329
|
+
position: relative;
|
|
330
|
+
width: 0px;
|
|
331
|
+
color: var(--font-on-background);
|
|
332
|
+
table-layout: fixed;
|
|
333
|
+
border-collapse: collapse;
|
|
334
|
+
`;
|
|
335
|
+
const TD = _styledComponents.default.td`
|
|
336
|
+
align-content: center;
|
|
337
|
+
width: ${_ref3 => {
|
|
329
338
|
let {
|
|
330
339
|
$width
|
|
331
340
|
} = _ref3;
|
|
332
341
|
return $width;
|
|
333
|
-
}
|
|
342
|
+
}};
|
|
343
|
+
height: 48px;
|
|
344
|
+
padding: 0 var(--spacing-xs);
|
|
345
|
+
border-top: 1px solid var(--border-color);
|
|
346
|
+
border-right: 1px solid var(--border-color);
|
|
347
|
+
border-bottom: 1px solid var(--border-color);
|
|
348
|
+
text-align: ${_ref4 => {
|
|
334
349
|
let {
|
|
335
350
|
center
|
|
336
351
|
} = _ref4;
|
|
337
352
|
return center ? 'center' : 'left';
|
|
338
|
-
}
|
|
353
|
+
}};
|
|
354
|
+
background: ${_ref5 => {
|
|
339
355
|
let {
|
|
340
356
|
backgroundReverse
|
|
341
357
|
} = _ref5;
|
|
342
358
|
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
343
|
-
}
|
|
344
|
-
|
|
359
|
+
}};
|
|
360
|
+
|
|
361
|
+
&:last-child {
|
|
362
|
+
border-right: none;
|
|
363
|
+
padding: 0;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
> span {
|
|
367
|
+
display: inline-block;
|
|
368
|
+
width: 100%;
|
|
369
|
+
padding: 0 2px;
|
|
370
|
+
overflow: hidden;
|
|
371
|
+
white-space: pre;
|
|
372
|
+
text-overflow: ellipsis;
|
|
373
|
+
}
|
|
374
|
+
`;
|
|
375
|
+
const Scrollbar = _styledComponents.default.div`
|
|
376
|
+
position: sticky;
|
|
377
|
+
bottom: 0;
|
|
378
|
+
width: 100%;
|
|
379
|
+
overflow: auto;
|
|
380
|
+
background: ${_ref6 => {
|
|
345
381
|
let {
|
|
346
382
|
backgroundReverse
|
|
347
383
|
} = _ref6;
|
|
348
384
|
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
349
|
-
}
|
|
385
|
+
}};
|
|
386
|
+
|
|
387
|
+
::before {
|
|
388
|
+
display: block;
|
|
389
|
+
content: '';
|
|
390
|
+
width: ${_ref7 => {
|
|
350
391
|
let {
|
|
351
392
|
width
|
|
352
393
|
} = _ref7;
|
|
353
|
-
return
|
|
354
|
-
}
|
|
394
|
+
return `${width}px`;
|
|
395
|
+
}};
|
|
396
|
+
height: 1px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
${(0, _scrollbar.default)({
|
|
355
400
|
size: 'large'
|
|
356
|
-
})
|
|
401
|
+
})}
|
|
402
|
+
`;
|
|
357
403
|
var _default = exports.default = InfiniteGridTable;
|
package/table/PermissionTable.js
CHANGED
|
@@ -5,37 +5,59 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
9
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const PermissionTable = _styledComponents.default.table`
|
|
10
|
+
width: 100%;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
table-layout: fixed;
|
|
13
|
+
border: 0;
|
|
14
|
+
color: var(--font-on-background);
|
|
15
|
+
`;
|
|
16
|
+
const TH = _styledComponents.default.th`
|
|
17
|
+
padding: var(--spacing) 0;
|
|
18
|
+
border-bottom: 1px solid var(--border-color);
|
|
19
|
+
font-weight: var(--font-bold);
|
|
20
|
+
|
|
21
|
+
${_ref => {
|
|
13
22
|
let {
|
|
14
23
|
clickable
|
|
15
24
|
} = _ref;
|
|
16
25
|
return clickable && 'cursor: pointer;';
|
|
17
|
-
}
|
|
26
|
+
}}
|
|
27
|
+
${_ref2 => {
|
|
18
28
|
let {
|
|
19
29
|
alignCenter
|
|
20
30
|
} = _ref2;
|
|
21
31
|
return alignCenter && 'text-align: center;';
|
|
22
|
-
}
|
|
23
|
-
|
|
32
|
+
}}
|
|
33
|
+
`;
|
|
34
|
+
const TD = _styledComponents.default.td`
|
|
35
|
+
padding: var(--spacing) 0;
|
|
36
|
+
border-bottom: 1px solid var(--border-color);
|
|
37
|
+
|
|
38
|
+
&:nth-child(even) {
|
|
39
|
+
background: var(--color-background1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
${_ref3 => {
|
|
24
43
|
let {
|
|
25
44
|
clickable
|
|
26
45
|
} = _ref3;
|
|
27
46
|
return clickable && 'cursor: pointer;';
|
|
28
|
-
}
|
|
47
|
+
}}
|
|
48
|
+
${_ref4 => {
|
|
29
49
|
let {
|
|
30
50
|
alignCenter
|
|
31
51
|
} = _ref4;
|
|
32
52
|
return alignCenter && 'text-align: center;';
|
|
33
|
-
}
|
|
53
|
+
}}
|
|
54
|
+
${_ref5 => {
|
|
34
55
|
let {
|
|
35
56
|
bold
|
|
36
57
|
} = _ref5;
|
|
37
58
|
return bold && 'font-weight: var(--font-bold);';
|
|
38
|
-
}
|
|
59
|
+
}}
|
|
60
|
+
`;
|
|
39
61
|
var _default = exports.default = Object.assign(PermissionTable, {
|
|
40
62
|
TH,
|
|
41
63
|
TD
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _GridTableHeadCell = _interopRequireDefault(require("./subComponent/GridTableHeadCell"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const SimpleGridTable = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
columns,
|
|
15
|
+
data,
|
|
16
|
+
backgroundReverse,
|
|
17
|
+
translation
|
|
18
|
+
} = _ref;
|
|
19
|
+
const texts = (0, _react.useMemo)(() => {
|
|
20
|
+
const defaultTexts = {
|
|
21
|
+
empty: 'No data available in table'
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
...defaultTexts,
|
|
25
|
+
...translation
|
|
26
|
+
};
|
|
27
|
+
}, [translation]);
|
|
28
|
+
const tableHeads = (0, _react.useMemo)(() => {
|
|
29
|
+
const tableHeads = columns.map((column, index) => {
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TH, {
|
|
31
|
+
backgroundReverse: !backgroundReverse,
|
|
32
|
+
children: column.title
|
|
33
|
+
}, `TH${index}`);
|
|
34
|
+
});
|
|
35
|
+
return tableHeads;
|
|
36
|
+
}, [backgroundReverse, columns]);
|
|
37
|
+
const tableRows = (0, _react.useMemo)(() => {
|
|
38
|
+
if (data.length === 0) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return data.map((row, rowIndex) => {
|
|
42
|
+
const tds = columns.map((column, columnIndex) => {
|
|
43
|
+
const {
|
|
44
|
+
title,
|
|
45
|
+
fieldName,
|
|
46
|
+
render
|
|
47
|
+
} = column;
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
|
|
49
|
+
"data-label": title,
|
|
50
|
+
backgroundReverse: backgroundReverse,
|
|
51
|
+
children: render ? render(row[fieldName], row) : String(row[fieldName])
|
|
52
|
+
}, columnIndex);
|
|
53
|
+
});
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TR, {
|
|
55
|
+
children: tds
|
|
56
|
+
}, rowIndex);
|
|
57
|
+
});
|
|
58
|
+
}, [backgroundReverse, columns, data]);
|
|
59
|
+
const generateEmptyMessage = (0, _react.useCallback)(() => {
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TR, {
|
|
61
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
|
|
62
|
+
center: true,
|
|
63
|
+
colSpan: columns.length,
|
|
64
|
+
backgroundReverse: backgroundReverse,
|
|
65
|
+
children: texts.empty
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}, [backgroundReverse, columns, texts]);
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
70
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TableWrapper, {
|
|
71
|
+
backgroundReverse: backgroundReverse,
|
|
72
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(ResponsiveTable, {
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
|
|
74
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
|
|
75
|
+
children: tableHeads
|
|
76
|
+
})
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
78
|
+
children: tableRows || generateEmptyMessage()
|
|
79
|
+
})]
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const TableWrapper = _styledComponents.default.div`
|
|
85
|
+
background: ${_ref2 => {
|
|
86
|
+
let {
|
|
87
|
+
backgroundReverse
|
|
88
|
+
} = _ref2;
|
|
89
|
+
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
90
|
+
}};
|
|
91
|
+
`;
|
|
92
|
+
const ResponsiveTable = _styledComponents.default.table`
|
|
93
|
+
width: 100%;
|
|
94
|
+
color: var(--font-on-background);
|
|
95
|
+
table-layout: fixed;
|
|
96
|
+
border-collapse: separate;
|
|
97
|
+
border-spacing: 0;
|
|
98
|
+
border: 1px solid var(--border-color);
|
|
99
|
+
border-radius: 8px;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
`;
|
|
102
|
+
const TH = (0, _styledComponents.default)(_GridTableHeadCell.default)`
|
|
103
|
+
text-align: left;
|
|
104
|
+
border-top: none;
|
|
105
|
+
border-right: 1px solid var(--border-color);
|
|
106
|
+
|
|
107
|
+
&:last-child {
|
|
108
|
+
border-right: none;
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
const TD = _styledComponents.default.td`
|
|
112
|
+
height: 48px;
|
|
113
|
+
padding: 0 var(--spacing-xs);
|
|
114
|
+
border-bottom: 1px solid var(--border-color);
|
|
115
|
+
border-right: 1px solid var(--border-color);
|
|
116
|
+
text-align: ${_ref3 => {
|
|
117
|
+
let {
|
|
118
|
+
center
|
|
119
|
+
} = _ref3;
|
|
120
|
+
return center ? 'center' : 'left';
|
|
121
|
+
}};
|
|
122
|
+
background: ${_ref4 => {
|
|
123
|
+
let {
|
|
124
|
+
backgroundReverse
|
|
125
|
+
} = _ref4;
|
|
126
|
+
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
127
|
+
}};
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
text-overflow: ellipsis;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
|
|
132
|
+
&:last-child {
|
|
133
|
+
border-right: none;
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
const TR = _styledComponents.default.tr`
|
|
137
|
+
&:last-child {
|
|
138
|
+
${TD} {
|
|
139
|
+
border-bottom: none;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
var _default = exports.default = SimpleGridTable;
|