@onehat/ui 0.4.69 → 0.4.71
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/package.json +2 -1
- package/src/Components/Accordion/Accordion.js +1 -0
- package/src/Components/Blank.js +1 -0
- package/src/Components/Buttons/BackButton.js +1 -0
- package/src/Components/Buttons/Button.js +5 -4
- package/src/Components/Buttons/CartButtonWithBadge.js +1 -0
- package/src/Components/Buttons/IconButton.js +9 -8
- package/src/Components/Buttons/PlusMinusButton.js +5 -4
- package/src/Components/Buttons/SquareButton.js +19 -18
- package/src/Components/Container/Container.js +1 -0
- package/src/Components/Container/ContainerColumn.js +4 -3
- package/src/Components/Container/ScreenContainer.js +13 -13
- package/src/Components/Container/Splitter.js +33 -28
- package/src/Components/Editor/InlineEditor.js +32 -30
- package/src/Components/Fab/DynamicFab.js +14 -13
- package/src/Components/Fab/FabWithTooltip.js +1 -0
- package/src/Components/Filter/DateRange.js +8 -7
- package/src/Components/Filter/NumberRange.js +8 -7
- package/src/Components/Form/Field/CKEditor/CKEditor.js +1 -0
- package/src/Components/Form/Field/Checkbox/CheckboxGroup.js +1 -0
- package/src/Components/Form/Field/Color.js +41 -40
- package/src/Components/Form/Field/Combo/Combo.js +173 -172
- package/src/Components/Form/Field/Combo/PageSizeCombo.js +1 -0
- package/src/Components/Form/Field/Date.js +117 -116
- package/src/Components/Form/Field/DisplayField.js +6 -5
- package/src/Components/Form/Field/File.js +1 -0
- package/src/Components/Form/Field/FormikForm.js +1 -0
- package/src/Components/Form/Field/Input.js +15 -14
- package/src/Components/Form/Field/Json.js +8 -6
- package/src/Components/Form/Field/Number.js +31 -30
- package/src/Components/Form/Field/RadioGroup/RadioGroup.js +1 -0
- package/src/Components/Form/Field/Select/PageSizeSelect.js +1 -0
- package/src/Components/Form/Field/Select/Select.js +9 -8
- package/src/Components/Form/Field/Slider.js +15 -14
- package/src/Components/Form/Field/Tag/Tag.js +25 -24
- package/src/Components/Form/Field/Tag/ValueBox.js +32 -31
- package/src/Components/Form/Field/Text.js +9 -8
- package/src/Components/Form/Field/TextArea.js +9 -8
- package/src/Components/Form/Field/Toggle.js +16 -15
- package/src/Components/Form/FieldSet.js +27 -26
- package/src/Components/Form/Form.js +105 -104
- package/src/Components/Form/Label.js +15 -14
- package/src/Components/Grid/Grid.js +48 -46
- package/src/Components/Grid/GridHeaderRow.js +42 -40
- package/src/Components/Grid/GridRow.js +119 -80
- package/src/Components/Grid/HeaderColumnSelectorHandle.js +9 -8
- package/src/Components/Grid/HeaderReorderHandle.js +9 -8
- package/src/Components/Grid/HeaderResizeHandle.js +9 -8
- package/src/Components/Grid/NoRecordsFound.js +4 -3
- package/src/Components/Grid/RowDragHandle.js +1 -0
- package/src/Components/Grid/RowSelectHandle.js +1 -0
- package/src/Components/Hoc/Secondary/withSecondaryEditor.js +1 -1
- package/src/Components/Hoc/Secondary/withSecondaryWindowedEditor.js +6 -5
- package/src/Components/Hoc/withAlert.js +35 -34
- package/src/Components/Hoc/withContextMenu.js +27 -26
- package/src/Components/Hoc/withDnd.js +1 -0
- package/src/Components/Hoc/withEditor.js +1 -1
- package/src/Components/Hoc/withFilters.js +19 -18
- package/src/Components/Hoc/withModal.js +7 -6
- package/src/Components/Hoc/withToast.js +1 -0
- package/src/Components/Hoc/withWindowedEditor.js +6 -5
- package/src/Components/Layout/AsyncOperation.js +1 -0
- package/src/Components/Layout/CenterBox.js +9 -8
- package/src/Components/Layout/Footer.js +11 -10
- package/src/Components/Layout/ScreenHeader.js +5 -4
- package/src/Components/Layout/TextWithTooltip.js +1 -0
- package/src/Components/Messages/ConfirmationMessage.js +6 -5
- package/src/Components/Messages/ErrorMessage.js +40 -39
- package/src/Components/Messages/Loading.js +1 -0
- package/src/Components/Messages/OkMessage.js +11 -10
- package/src/Components/Messages/Unauthorized.js +1 -0
- package/src/Components/Messages/WaitMessage.js +16 -15
- package/src/Components/Panel/AccordionGridPanel.js +1 -0
- package/src/Components/Panel/FormPanel.js +1 -0
- package/src/Components/Panel/Header.js +59 -58
- package/src/Components/Panel/Mask.js +1 -0
- package/src/Components/Panel/Panel.js +7 -6
- package/src/Components/Picker/Picker.js +1 -0
- package/src/Components/Report/Report.js +35 -34
- package/src/Components/Screens/Manager.js +1 -0
- package/src/Components/Screens/ReportsManager.js +1 -0
- package/src/Components/Tab/Tab.js +1 -0
- package/src/Components/Tab/TabBar.js +67 -66
- package/src/Components/Toolbar/FilterToolbar.js +14 -11
- package/src/Components/Toolbar/Pagination.js +26 -25
- package/src/Components/Toolbar/PaginationToolbar.js +13 -12
- package/src/Components/Toolbar/Toolbar.js +13 -12
- package/src/Components/Tooltip/Tooltip.js +1 -0
- package/src/Components/Tree/Tree.js +12 -11
- package/src/Components/Tree/TreeNode.js +20 -19
- package/src/Components/Tree/TreeNodeDragHandle.js +11 -10
- package/src/Components/Viewer/MeterTypeText.js +8 -7
- package/src/Components/Viewer/TextWithLinks.js +16 -15
- package/src/Components/Viewer/Viewer.js +23 -22
- package/src/Components/Window/UploadsDownloadsWindow.js +6 -5
- package/src/Components/index.js +1 -0
- package/src/Hooks/useAsyncRenderers.js +53 -0
|
@@ -2,26 +2,27 @@ import {
|
|
|
2
2
|
HStack,
|
|
3
3
|
TextNative,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import styles from '../../Constants/Styles.js';
|
|
6
7
|
|
|
7
8
|
export default function Label(props) {
|
|
8
|
-
let className =
|
|
9
|
-
Label
|
|
10
|
-
items-center
|
|
11
|
-
min-w-[120px]
|
|
12
|
-
pl-2
|
|
13
|
-
|
|
9
|
+
let className = clsx(
|
|
10
|
+
'Label',
|
|
11
|
+
'items-center',
|
|
12
|
+
'min-w-[120px]',
|
|
13
|
+
'pl-2',
|
|
14
|
+
);
|
|
14
15
|
if (props.className) {
|
|
15
16
|
className += ' ' + props.className;
|
|
16
17
|
}
|
|
17
|
-
let textClassName =
|
|
18
|
-
Label-TextNative
|
|
19
|
-
inline-block
|
|
20
|
-
text-ellipsis
|
|
21
|
-
text-base
|
|
22
|
-
w-full
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
let textClassName = clsx(
|
|
19
|
+
'Label-TextNative',
|
|
20
|
+
'inline-block',
|
|
21
|
+
'text-ellipsis',
|
|
22
|
+
'text-base',
|
|
23
|
+
'w-full',
|
|
24
|
+
styles.FORM_LABEL_CLASSNAME,
|
|
25
|
+
);
|
|
25
26
|
if (props._text?.className) {
|
|
26
27
|
textClassName += ' ' + props._text.className;
|
|
27
28
|
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
VStack,
|
|
9
9
|
VStackNative,
|
|
10
10
|
} from '@project-components/Gluestack';
|
|
11
|
+
import clsx from 'clsx';
|
|
11
12
|
import {
|
|
12
13
|
ScrollView,
|
|
13
14
|
} from 'react-native';
|
|
@@ -113,10 +114,10 @@ function GridComponent(props) {
|
|
|
113
114
|
defaultHiddenColumns = [],
|
|
114
115
|
getRowProps = (item) => {
|
|
115
116
|
return {
|
|
116
|
-
className:
|
|
117
|
-
border-bottom-1
|
|
118
|
-
border-bottom-grey-500
|
|
119
|
-
|
|
117
|
+
className: clsx(
|
|
118
|
+
'border-bottom-1',
|
|
119
|
+
'border-bottom-grey-500',
|
|
120
|
+
),
|
|
120
121
|
};
|
|
121
122
|
},
|
|
122
123
|
flatListProps = {},
|
|
@@ -194,6 +195,7 @@ function GridComponent(props) {
|
|
|
194
195
|
onView,
|
|
195
196
|
onContextMenu,
|
|
196
197
|
isAdding,
|
|
198
|
+
isEditorViewOnly,
|
|
197
199
|
|
|
198
200
|
// withData
|
|
199
201
|
Repository,
|
|
@@ -432,7 +434,7 @@ function GridComponent(props) {
|
|
|
432
434
|
} else {
|
|
433
435
|
let canDoEdit = false,
|
|
434
436
|
canDoView = false;
|
|
435
|
-
if (onEdit && canUser && canUser(EDIT) && (!canRecordBeEdited || canRecordBeEdited(selection)) && !props.disableEdit) {
|
|
437
|
+
if (onEdit && canUser && canUser(EDIT) && (!canRecordBeEdited || canRecordBeEdited(selection)) && !props.disableEdit && !isEditorViewOnly) {
|
|
436
438
|
canDoEdit = true;
|
|
437
439
|
} else
|
|
438
440
|
if (onView && canUser && canUser(VIEW) && !props.disableView) {
|
|
@@ -480,12 +482,12 @@ function GridComponent(props) {
|
|
|
480
482
|
onContextMenu(item, e, newSelection);
|
|
481
483
|
}
|
|
482
484
|
}}
|
|
483
|
-
className={
|
|
484
|
-
Pressable
|
|
485
|
-
Row
|
|
486
|
-
flex-row
|
|
487
|
-
grow
|
|
488
|
-
|
|
485
|
+
className={clsx(
|
|
486
|
+
'Pressable',
|
|
487
|
+
'Row',
|
|
488
|
+
'flex-row',
|
|
489
|
+
'grow',
|
|
490
|
+
)}
|
|
489
491
|
>
|
|
490
492
|
{({
|
|
491
493
|
hovered,
|
|
@@ -622,21 +624,21 @@ function GridComponent(props) {
|
|
|
622
624
|
|
|
623
625
|
if (showRowExpander && !isHeaderRow) {
|
|
624
626
|
const isExpanded = getIsExpanded(index);
|
|
625
|
-
let className =
|
|
626
|
-
Grid-rowExpander
|
|
627
|
-
w-full
|
|
628
|
-
flex-none
|
|
629
|
-
|
|
627
|
+
let className = clsx(
|
|
628
|
+
'Grid-rowExpander',
|
|
629
|
+
'w-full',
|
|
630
|
+
'flex-none',
|
|
631
|
+
);
|
|
630
632
|
if (rowProps?.className) {
|
|
631
633
|
className += ' ' + rowProps.className;
|
|
632
634
|
}
|
|
633
635
|
rowComponent = <VStack className={className}>
|
|
634
636
|
<HStack
|
|
635
|
-
className={
|
|
636
|
-
Grid-rowExpander-HStack
|
|
637
|
-
w-full
|
|
638
|
-
grow
|
|
639
|
-
|
|
637
|
+
className={clsx(
|
|
638
|
+
'Grid-rowExpander-HStack',
|
|
639
|
+
'w-full',
|
|
640
|
+
'grow',
|
|
641
|
+
)}
|
|
640
642
|
>
|
|
641
643
|
<ExpandButton
|
|
642
644
|
{...testProps((Repository ? Repository.schema.name : 'GridRow') + '-expandBtn-' + item?.id)}
|
|
@@ -645,10 +647,10 @@ function GridComponent(props) {
|
|
|
645
647
|
_icon={{
|
|
646
648
|
size: 'sm',
|
|
647
649
|
}}
|
|
648
|
-
className={
|
|
649
|
-
Grid-rowExpander-expandBtn
|
|
650
|
-
|
|
651
|
-
|
|
650
|
+
className={clsx(
|
|
651
|
+
'Grid-rowExpander-expandBtn',
|
|
652
|
+
styles.GRID_EXPAND_BTN_CLASSNAME,
|
|
653
|
+
)}
|
|
652
654
|
tooltip="Expand/Contract Row"
|
|
653
655
|
/>
|
|
654
656
|
{rowComponent}
|
|
@@ -1275,12 +1277,12 @@ function GridComponent(props) {
|
|
|
1275
1277
|
if (!hasHeight(props) && !hasWidth(props) && !hasFlex(props)) {
|
|
1276
1278
|
style.flex = 1;
|
|
1277
1279
|
}
|
|
1278
|
-
let className =
|
|
1279
|
-
Grid-VStackNative
|
|
1280
|
-
w-full
|
|
1281
|
-
border
|
|
1282
|
-
border-grey-300
|
|
1283
|
-
|
|
1280
|
+
let className = clsx(
|
|
1281
|
+
'Grid-VStackNative',
|
|
1282
|
+
'w-full',
|
|
1283
|
+
'border',
|
|
1284
|
+
'border-grey-300',
|
|
1285
|
+
);
|
|
1284
1286
|
if (props.className) {
|
|
1285
1287
|
className += props.className;
|
|
1286
1288
|
}
|
|
@@ -1303,14 +1305,14 @@ function GridComponent(props) {
|
|
|
1303
1305
|
deselectAll();
|
|
1304
1306
|
}
|
|
1305
1307
|
}}
|
|
1306
|
-
className={
|
|
1307
|
-
gridContainer
|
|
1308
|
-
w-full
|
|
1309
|
-
h-full
|
|
1310
|
-
flex-1
|
|
1311
|
-
min-h-[40px]
|
|
1312
|
-
|
|
1313
|
-
|
|
1308
|
+
className={clsx(
|
|
1309
|
+
'gridContainer',
|
|
1310
|
+
'w-full',
|
|
1311
|
+
'h-full',
|
|
1312
|
+
'flex-1',
|
|
1313
|
+
'min-h-[40px]',
|
|
1314
|
+
gridContainerBorderClassName,
|
|
1315
|
+
)}
|
|
1314
1316
|
>
|
|
1315
1317
|
{grid}
|
|
1316
1318
|
</VStack>
|
|
@@ -1323,13 +1325,13 @@ function GridComponent(props) {
|
|
|
1323
1325
|
grid = <VStackNative
|
|
1324
1326
|
{...testProps(self, '-dropTarget')}
|
|
1325
1327
|
ref={dropTargetRef}
|
|
1326
|
-
className={
|
|
1327
|
-
Grid-dropTarget
|
|
1328
|
-
h-full
|
|
1329
|
-
w-full
|
|
1330
|
-
border-[#0ff]
|
|
1331
|
-
|
|
1332
|
-
|
|
1328
|
+
className={clsx(
|
|
1329
|
+
'Grid-dropTarget',
|
|
1330
|
+
'h-full',
|
|
1331
|
+
'w-full',
|
|
1332
|
+
'border-[#0ff]',
|
|
1333
|
+
canDrop && isOver ? 'border-[4px]' : 'border-[0px]',
|
|
1334
|
+
)}
|
|
1333
1335
|
>{grid}</VStackNative>
|
|
1334
1336
|
}
|
|
1335
1337
|
return grid;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Pressable,
|
|
7
7
|
TextNative,
|
|
8
8
|
} from '@project-components/Gluestack';
|
|
9
|
+
import clsx from 'clsx';
|
|
9
10
|
import {
|
|
10
11
|
SORT_ASCENDING,
|
|
11
12
|
SORT_DESCENDING,
|
|
@@ -309,10 +310,10 @@ export default function GridHeaderRow(props) {
|
|
|
309
310
|
isSorter = isSortable && canColumnsSort && sortField === fieldName,
|
|
310
311
|
isReorderable = canColumnsReorder && configIsReorderable,
|
|
311
312
|
isResizable = canColumnsResize && configIsResizable,
|
|
312
|
-
rowClassName =
|
|
313
|
-
border-r-2
|
|
314
|
-
border-r-white
|
|
315
|
-
|
|
313
|
+
rowClassName = clsx(
|
|
314
|
+
'border-r-2',
|
|
315
|
+
'border-r-white',
|
|
316
|
+
);
|
|
316
317
|
if (isHidden) {
|
|
317
318
|
return null;
|
|
318
319
|
}
|
|
@@ -357,16 +358,16 @@ export default function GridHeaderRow(props) {
|
|
|
357
358
|
}}
|
|
358
359
|
onMouseEnter={(e) => onHeaderMouseEnter(e, ix)}
|
|
359
360
|
onMouseLeave={(e) => onHeaderMouseLeave(e, ix)}
|
|
360
|
-
className={
|
|
361
|
-
GridHeaderRow-Pressable
|
|
362
|
-
h-full
|
|
363
|
-
flex-row
|
|
364
|
-
p-0
|
|
365
|
-
items-center
|
|
366
|
-
justify-center
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
361
|
+
className={clsx(
|
|
362
|
+
'GridHeaderRow-Pressable',
|
|
363
|
+
'h-full',
|
|
364
|
+
'flex-row',
|
|
365
|
+
'p-0',
|
|
366
|
+
'items-center',
|
|
367
|
+
'justify-center',
|
|
368
|
+
rowClassName,
|
|
369
|
+
styles.GRID_HEADER_PRESSABLE_CLASSNAME,
|
|
370
|
+
)}
|
|
370
371
|
style={rowStyle}
|
|
371
372
|
>
|
|
372
373
|
{isReorderable && isOver &&
|
|
@@ -395,20 +396,20 @@ export default function GridHeaderRow(props) {
|
|
|
395
396
|
<TextNative
|
|
396
397
|
key="Text"
|
|
397
398
|
numberOfLines={1}
|
|
398
|
-
className={
|
|
399
|
-
GridHeaderRow-TextNative
|
|
400
|
-
h-auto
|
|
401
|
-
flex-1
|
|
402
|
-
items-center
|
|
403
|
-
justify-center
|
|
404
|
-
leading-tight
|
|
405
|
-
text-center
|
|
406
|
-
overflow-hidden
|
|
407
|
-
text-ellipsis
|
|
408
|
-
px-2
|
|
409
|
-
py-3
|
|
410
|
-
|
|
411
|
-
|
|
399
|
+
className={clsx(
|
|
400
|
+
'GridHeaderRow-TextNative',
|
|
401
|
+
'h-auto',
|
|
402
|
+
'flex-1',
|
|
403
|
+
'items-center',
|
|
404
|
+
'justify-center',
|
|
405
|
+
'leading-tight',
|
|
406
|
+
'text-center',
|
|
407
|
+
'overflow-hidden',
|
|
408
|
+
'text-ellipsis',
|
|
409
|
+
'px-2',
|
|
410
|
+
py-3,
|
|
411
|
+
styles.GRID_HEADER_CLASSNAME,
|
|
412
|
+
)}
|
|
412
413
|
>{header}</TextNative>
|
|
413
414
|
|
|
414
415
|
{isSorter &&
|
|
@@ -416,12 +417,13 @@ export default function GridHeaderRow(props) {
|
|
|
416
417
|
key="Icon"
|
|
417
418
|
as={isSortDirectionAsc ? SortUp : SortDown}
|
|
418
419
|
size={styles.GRID_HEADER_ICON_SIZE}
|
|
419
|
-
className={
|
|
420
|
-
GridHeaderRow-Icon
|
|
421
|
-
text-center
|
|
422
|
-
text-grey-500
|
|
423
|
-
|
|
424
|
-
|
|
420
|
+
className={clsx(
|
|
421
|
+
'GridHeaderRow-Icon',
|
|
422
|
+
'text-center',
|
|
423
|
+
'text-grey-500',
|
|
424
|
+
styles.GRID_HEADER_ICON_CLASSNAME,
|
|
425
|
+
)}
|
|
426
|
+
/>}
|
|
425
427
|
|
|
426
428
|
{isOver && UiGlobals.mode === UI_MODE_WEB && // only works for web for now
|
|
427
429
|
<HeaderColumnSelectorHandle
|
|
@@ -488,12 +490,12 @@ export default function GridHeaderRow(props) {
|
|
|
488
490
|
style={{
|
|
489
491
|
scrollbarWidth: 'none',
|
|
490
492
|
}}
|
|
491
|
-
className={
|
|
492
|
-
GridHeaderRow-HStack
|
|
493
|
-
w-full
|
|
494
|
-
h-[40px]
|
|
495
|
-
bg-grey-200
|
|
496
|
-
|
|
493
|
+
className={clsx(
|
|
494
|
+
'GridHeaderRow-HStack',
|
|
495
|
+
'w-full',
|
|
496
|
+
'h-[40px]',
|
|
497
|
+
'bg-grey-200',
|
|
498
|
+
)}
|
|
497
499
|
>
|
|
498
500
|
{renderHeaders()}
|
|
499
501
|
</HStack>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { useMemo, useEffect, } from 'react';
|
|
1
|
+
import { useMemo, useState, useEffect, } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Box,
|
|
4
4
|
HStack,
|
|
5
5
|
HStackNative,
|
|
6
6
|
Icon,
|
|
7
|
+
Text,
|
|
7
8
|
TextNative,
|
|
8
9
|
} from '@project-components/Gluestack';
|
|
10
|
+
import clsx from 'clsx';
|
|
9
11
|
import {
|
|
10
12
|
UI_MODE_WEB,
|
|
11
13
|
UI_MODE_NATIVE,
|
|
@@ -16,9 +18,11 @@ import getComponentFromType from '../../Functions/getComponentFromType.js';
|
|
|
16
18
|
import UiGlobals from '../../UiGlobals.js';
|
|
17
19
|
import { withDragSource, withDropTarget } from '../Hoc/withDnd.js';
|
|
18
20
|
import testProps from '../../Functions/testProps.js';
|
|
21
|
+
import Loading from '../Messages/Loading.js';
|
|
19
22
|
import AngleRight from '../Icons/AngleRight.js';
|
|
20
23
|
import RowDragHandle from './RowDragHandle.js';
|
|
21
24
|
import RowSelectHandle from './RowSelectHandle.js';
|
|
25
|
+
import useAsyncRenderers from '../../Hooks/useAsyncRenderers.js';
|
|
22
26
|
import _ from 'lodash';
|
|
23
27
|
|
|
24
28
|
// Conditional import for web only
|
|
@@ -64,7 +68,11 @@ function GridRow(props) {
|
|
|
64
68
|
dropTargetRef,
|
|
65
69
|
...propsToPass
|
|
66
70
|
} = props,
|
|
67
|
-
styles = UiGlobals.styles
|
|
71
|
+
styles = UiGlobals.styles,
|
|
72
|
+
{
|
|
73
|
+
results: asyncResults,
|
|
74
|
+
loading: asyncLoading,
|
|
75
|
+
} = useAsyncRenderers(columnsConfig, item);
|
|
68
76
|
|
|
69
77
|
if (item.isDestroyed) {
|
|
70
78
|
return null;
|
|
@@ -126,16 +134,16 @@ function GridRow(props) {
|
|
|
126
134
|
propsToPass = columnProps[key] || {},
|
|
127
135
|
colStyle = {},
|
|
128
136
|
whichCursor = showSelectHandle ? 'cursor-text' : 'cursor-pointer'; // when using rowSelectHandle, indicate that the row text is selectable, otherwise indicate that the row itself is selectable
|
|
129
|
-
let colClassName =
|
|
130
|
-
GridRow-column
|
|
131
|
-
p-1
|
|
132
|
-
justify-center
|
|
133
|
-
border-r-black-100
|
|
134
|
-
block
|
|
135
|
-
overflow-auto
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
let colClassName = clsx(
|
|
138
|
+
'GridRow-column',
|
|
139
|
+
'p-1',
|
|
140
|
+
'justify-center',
|
|
141
|
+
'border-r-black-100',
|
|
142
|
+
'block',
|
|
143
|
+
'overflow-auto',
|
|
144
|
+
whichCursor,
|
|
145
|
+
styles.GRID_ROW_MAX_HEIGHT_EXTRA,
|
|
146
|
+
);
|
|
139
147
|
if (isOnlyOneVisibleColumn) {
|
|
140
148
|
colClassName = ' w-full';
|
|
141
149
|
} else {
|
|
@@ -159,21 +167,25 @@ function GridRow(props) {
|
|
|
159
167
|
}
|
|
160
168
|
if (_.isPlainObject(config)) {
|
|
161
169
|
if (config.renderer) {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
170
|
+
const
|
|
171
|
+
asyncResult = asyncResults.get(key),
|
|
172
|
+
isLoading = asyncLoading.has(key),
|
|
173
|
+
extraProps = _.omit(config, [
|
|
174
|
+
'header',
|
|
175
|
+
'fieldName',
|
|
176
|
+
'type',
|
|
177
|
+
'isEditable',
|
|
178
|
+
'editor',
|
|
179
|
+
'format',
|
|
180
|
+
'renderer',
|
|
181
|
+
'isAsync',
|
|
182
|
+
'isReorderable',
|
|
183
|
+
'isResizable',
|
|
184
|
+
'isSortable',
|
|
185
|
+
'w',
|
|
186
|
+
'flex',
|
|
187
|
+
'isOver',
|
|
188
|
+
]);
|
|
177
189
|
|
|
178
190
|
if (!extraProps._web) {
|
|
179
191
|
extraProps._web = {};
|
|
@@ -185,6 +197,31 @@ function GridRow(props) {
|
|
|
185
197
|
// userSelect: 'none',
|
|
186
198
|
};
|
|
187
199
|
|
|
200
|
+
let content = null;
|
|
201
|
+
if (config.isAsync) {
|
|
202
|
+
// Async renderer
|
|
203
|
+
if (isLoading) {
|
|
204
|
+
content = <Loading />;
|
|
205
|
+
} else if (asyncResult) {
|
|
206
|
+
if (asyncResult.error) {
|
|
207
|
+
content = <Text>Render Error: {asyncResult.error.message || String(asyncResult.error)}</Text>;
|
|
208
|
+
} else {
|
|
209
|
+
content = asyncResult.result;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
// Synchronous renderer
|
|
214
|
+
try {
|
|
215
|
+
const result = config.renderer(item);
|
|
216
|
+
if (result && typeof result.then === 'function') {
|
|
217
|
+
content = <Text>Error: Async renderer not properly configured</Text>;
|
|
218
|
+
} else {
|
|
219
|
+
content = result;
|
|
220
|
+
}
|
|
221
|
+
} catch (error) {
|
|
222
|
+
content = <Text>Render Error: {error}</Text>;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
188
225
|
return <HStackNative
|
|
189
226
|
key={key}
|
|
190
227
|
{...testProps('rendererCol-' + key)}
|
|
@@ -192,7 +229,7 @@ function GridRow(props) {
|
|
|
192
229
|
{...propsToPass}
|
|
193
230
|
{...extraProps}
|
|
194
231
|
style={colStyle}
|
|
195
|
-
>{
|
|
232
|
+
>{content}</HStackNative>;
|
|
196
233
|
}
|
|
197
234
|
if (config.fieldName) {
|
|
198
235
|
|
|
@@ -212,18 +249,18 @@ function GridRow(props) {
|
|
|
212
249
|
if (config.getCellProps) {
|
|
213
250
|
_.assign(cellProps, config.getCellProps(item));
|
|
214
251
|
}
|
|
215
|
-
let elementClassName =
|
|
216
|
-
GridRow-Element
|
|
217
|
-
self-center
|
|
218
|
-
text-ellipsis
|
|
219
|
-
px-2
|
|
220
|
-
py-3
|
|
221
|
-
block
|
|
222
|
-
overflow-scroll
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
252
|
+
let elementClassName = clsx(
|
|
253
|
+
'GridRow-Element',
|
|
254
|
+
'self-center',
|
|
255
|
+
'text-ellipsis',
|
|
256
|
+
'px-2',
|
|
257
|
+
'py-3',
|
|
258
|
+
'block',
|
|
259
|
+
'overflow-scroll',
|
|
260
|
+
colClassName,
|
|
261
|
+
styles.GRID_CELL_CLASSNAME,
|
|
262
|
+
styles.GRID_ROW_MAX_HEIGHT_NORMAL,
|
|
263
|
+
);
|
|
227
264
|
if (config.className) {
|
|
228
265
|
elementClassName += ' ' + config.className;
|
|
229
266
|
}
|
|
@@ -273,14 +310,14 @@ function GridRow(props) {
|
|
|
273
310
|
if (config.getCellProps) {
|
|
274
311
|
_.assign(elementProps, config.getCellProps(item));
|
|
275
312
|
}
|
|
276
|
-
let textClassName =
|
|
277
|
-
GridRow-TextNative
|
|
278
|
-
self-center
|
|
279
|
-
overflow-hidden
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
313
|
+
let textClassName = clsx(
|
|
314
|
+
'GridRow-TextNative',
|
|
315
|
+
'self-center',
|
|
316
|
+
'overflow-hidden',
|
|
317
|
+
colClassName,
|
|
318
|
+
styles.GRID_CELL_CLASSNAME,
|
|
319
|
+
styles.GRID_ROW_MAX_HEIGHT_EXTRA,
|
|
320
|
+
);
|
|
284
321
|
if (config.className) {
|
|
285
322
|
textClassName += ' ' + config.className;
|
|
286
323
|
}
|
|
@@ -310,15 +347,15 @@ function GridRow(props) {
|
|
|
310
347
|
|
|
311
348
|
{isPhantom &&
|
|
312
349
|
<Box
|
|
313
|
-
className={
|
|
314
|
-
GridRow-phantom
|
|
315
|
-
absolute
|
|
316
|
-
h-2
|
|
317
|
-
w-2
|
|
318
|
-
top-0
|
|
319
|
-
left-0
|
|
320
|
-
bg-[#f00]
|
|
321
|
-
|
|
350
|
+
className={clsx(
|
|
351
|
+
'GridRow-phantom',
|
|
352
|
+
'absolute',
|
|
353
|
+
'h-2',
|
|
354
|
+
'w-2',
|
|
355
|
+
'top-0',
|
|
356
|
+
'left-0',
|
|
357
|
+
'bg-[#f00]',
|
|
358
|
+
)}
|
|
322
359
|
/>}
|
|
323
360
|
|
|
324
361
|
{renderColumns(item)}
|
|
@@ -327,25 +364,25 @@ function GridRow(props) {
|
|
|
327
364
|
<Icon
|
|
328
365
|
as={AngleRight}
|
|
329
366
|
variant="outline"
|
|
330
|
-
className={
|
|
331
|
-
GridRow-Icon
|
|
332
|
-
w-30
|
|
333
|
-
self-center
|
|
334
|
-
mx-3
|
|
335
|
-
|
|
336
|
-
|
|
367
|
+
className={clsx(
|
|
368
|
+
'GridRow-Icon',
|
|
369
|
+
'w-30',
|
|
370
|
+
'self-center',
|
|
371
|
+
'mx-3',
|
|
372
|
+
styles.GRID_NAV_COLUMN_COLOR,
|
|
373
|
+
)}
|
|
337
374
|
/>}
|
|
338
375
|
</>;
|
|
339
376
|
|
|
340
377
|
if (dragSourceRef) {
|
|
341
378
|
rowContents = <HStack
|
|
342
379
|
ref={dragSourceRef}
|
|
343
|
-
className={
|
|
344
|
-
GridRow-dragSourceRef
|
|
345
|
-
w-full
|
|
346
|
-
flex-1
|
|
347
|
-
grow-1
|
|
348
|
-
|
|
380
|
+
className={clsx(
|
|
381
|
+
'GridRow-dragSourceRef',
|
|
382
|
+
'w-full',
|
|
383
|
+
'flex-1',
|
|
384
|
+
'grow-1',
|
|
385
|
+
)}
|
|
349
386
|
style={{
|
|
350
387
|
backgroundColor: bg,
|
|
351
388
|
}}
|
|
@@ -354,22 +391,22 @@ function GridRow(props) {
|
|
|
354
391
|
if (dropTargetRef) {
|
|
355
392
|
rowContents = <HStack
|
|
356
393
|
ref={dropTargetRef}
|
|
357
|
-
className={
|
|
358
|
-
GridRow-dropTargetRef
|
|
359
|
-
w-full
|
|
360
|
-
flex-1
|
|
361
|
-
grow-1
|
|
362
|
-
|
|
394
|
+
className={clsx(
|
|
395
|
+
'GridRow-dropTargetRef',
|
|
396
|
+
'w-full',
|
|
397
|
+
'flex-1',
|
|
398
|
+
'grow-1',
|
|
399
|
+
)}
|
|
363
400
|
style={{
|
|
364
401
|
backgroundColor: bg,
|
|
365
402
|
}}
|
|
366
403
|
>{rowContents}</HStack>;
|
|
367
404
|
}
|
|
368
405
|
|
|
369
|
-
let rowClassName =
|
|
370
|
-
GridRow-HStackNative
|
|
371
|
-
items-center
|
|
372
|
-
|
|
406
|
+
let rowClassName = clsx(
|
|
407
|
+
'GridRow-HStackNative',
|
|
408
|
+
'items-center',
|
|
409
|
+
);
|
|
373
410
|
if (isOnlyOneVisibleColumn) {
|
|
374
411
|
rowClassName += ' w-full';
|
|
375
412
|
}
|
|
@@ -390,6 +427,8 @@ function GridRow(props) {
|
|
|
390
427
|
>{rowContents}</HStackNative>;
|
|
391
428
|
}, [
|
|
392
429
|
columnsConfig,
|
|
430
|
+
asyncResults,
|
|
431
|
+
asyncLoading,
|
|
393
432
|
columnProps,
|
|
394
433
|
fields,
|
|
395
434
|
rowProps,
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
Pressable,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import Gear from '../Icons/Gear.js';
|
|
6
7
|
import _ from 'lodash';
|
|
7
8
|
|
|
@@ -13,14 +14,14 @@ export default function HeaderColumnSelectorHandle(props) {
|
|
|
13
14
|
_hover={{ bg: 'grey-200' }}
|
|
14
15
|
_pressed={{ bg: 'grey-300' }}
|
|
15
16
|
onPress={showColumnsSelector}
|
|
16
|
-
className={
|
|
17
|
-
HeaderColumnSelectorHandle
|
|
18
|
-
bg-grey-100
|
|
19
|
-
h-full
|
|
20
|
-
w-3
|
|
21
|
-
items-center
|
|
22
|
-
justify-center
|
|
23
|
-
|
|
17
|
+
className={clsx(
|
|
18
|
+
'HeaderColumnSelectorHandle',
|
|
19
|
+
'bg-grey-100',
|
|
20
|
+
'h-full',
|
|
21
|
+
'w-3',
|
|
22
|
+
'items-center',
|
|
23
|
+
'justify-center',
|
|
24
|
+
)}
|
|
24
25
|
>
|
|
25
26
|
<Icon
|
|
26
27
|
as={Gear}
|