@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HStack,
|
|
3
3
|
} from '@project-components/Gluestack';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import Toolbar from './Toolbar.js'
|
|
5
6
|
import _ from 'lodash';
|
|
6
7
|
|
|
@@ -8,17 +9,19 @@ export default function FilterToolbar(props) {
|
|
|
8
9
|
const {
|
|
9
10
|
toolbarItems = [],
|
|
10
11
|
} = props;
|
|
11
|
-
return <Toolbar
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
return <Toolbar
|
|
13
|
+
className={clsx(
|
|
14
|
+
'bg-grey-200',
|
|
15
|
+
'border-t',
|
|
16
|
+
'border-t-grey-400',
|
|
17
|
+
'w-full',
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
17
20
|
{toolbarItems.length &&
|
|
18
|
-
<HStack className={
|
|
19
|
-
flex-1
|
|
20
|
-
border
|
|
21
|
-
border-l-grey-100
|
|
22
|
-
|
|
21
|
+
<HStack className={clsx(
|
|
22
|
+
'flex-1',
|
|
23
|
+
'border',
|
|
24
|
+
'border-l-grey-100',
|
|
25
|
+
)}>{toolbarItems}</HStack>}
|
|
23
26
|
</Toolbar>;
|
|
24
27
|
};
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
HStackNative,
|
|
5
5
|
Text,
|
|
6
6
|
} from '@project-components/Gluestack';
|
|
7
|
+
import clsx from 'clsx';
|
|
7
8
|
import useForceUpdate from '../../Hooks/useForceUpdate.js';
|
|
8
9
|
import testProps from '../../Functions/testProps.js';
|
|
9
10
|
import Button from '../Buttons/Button.js';
|
|
@@ -154,25 +155,25 @@ export default function Pagination(props) {
|
|
|
154
155
|
onChangeValue={(value) => Repository.setPage(value)}
|
|
155
156
|
maxValue={totalPages}
|
|
156
157
|
isDisabled={totalPages === 1}
|
|
157
|
-
className={
|
|
158
|
-
Pagination-pageInput
|
|
159
|
-
min-w-[40px]
|
|
160
|
-
w-[40px]
|
|
161
|
-
text-center
|
|
162
|
-
bg-grey-100
|
|
163
|
-
|
|
158
|
+
className={clsx(
|
|
159
|
+
'Pagination-pageInput',
|
|
160
|
+
'min-w-[40px]',
|
|
161
|
+
'w-[40px]',
|
|
162
|
+
'text-center',
|
|
163
|
+
'bg-grey-100',
|
|
164
|
+
)}
|
|
164
165
|
textAlignIsCenter={true}
|
|
165
166
|
tooltip="Set Page"
|
|
166
167
|
tooltipClassName="w-[40px]"
|
|
167
168
|
/>);
|
|
168
169
|
items.push(<Text
|
|
169
170
|
key="totalPages"
|
|
170
|
-
className={
|
|
171
|
-
Pagination-totalPages
|
|
172
|
-
whitespace-nowrap
|
|
173
|
-
inline-flex
|
|
174
|
-
mx-1
|
|
175
|
-
|
|
171
|
+
className={clsx(
|
|
172
|
+
'Pagination-totalPages',
|
|
173
|
+
'whitespace-nowrap',
|
|
174
|
+
'inline-flex',
|
|
175
|
+
'mx-1',
|
|
176
|
+
)}
|
|
176
177
|
>{`of ${totalPages}`}</Text>);
|
|
177
178
|
}
|
|
178
179
|
}
|
|
@@ -194,12 +195,12 @@ export default function Pagination(props) {
|
|
|
194
195
|
}
|
|
195
196
|
items.push(<Text
|
|
196
197
|
key="pageDisplay"
|
|
197
|
-
className={
|
|
198
|
-
Pagination-pageDisplay
|
|
199
|
-
whitespace-nowrap
|
|
200
|
-
inline-flex
|
|
201
|
-
mx-1
|
|
202
|
-
|
|
198
|
+
className={clsx(
|
|
199
|
+
'Pagination-pageDisplay',
|
|
200
|
+
'whitespace-nowrap',
|
|
201
|
+
'inline-flex',
|
|
202
|
+
'mx-1',
|
|
203
|
+
)}
|
|
203
204
|
>{`Displaying ${pageSpan} of ${total}`}</Text>);
|
|
204
205
|
}
|
|
205
206
|
}
|
|
@@ -207,12 +208,12 @@ export default function Pagination(props) {
|
|
|
207
208
|
style={{
|
|
208
209
|
userSelect: 'none',
|
|
209
210
|
}}
|
|
210
|
-
className={
|
|
211
|
-
Pagination
|
|
212
|
-
items-center
|
|
213
|
-
shrink-0
|
|
214
|
-
gap-2
|
|
215
|
-
|
|
211
|
+
className={clsx(
|
|
212
|
+
'Pagination',
|
|
213
|
+
'items-center',
|
|
214
|
+
'shrink-0',
|
|
215
|
+
'gap-2',
|
|
216
|
+
)}
|
|
216
217
|
>
|
|
217
218
|
{items}
|
|
218
219
|
</HStack>;
|
|
@@ -2,6 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
HStack,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import Pagination from './Pagination.js'
|
|
6
7
|
import Toolbar from './Toolbar.js'
|
|
7
8
|
import _ from 'lodash';
|
|
@@ -37,22 +38,22 @@ export default function PaginationToolbar(props) {
|
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
return <Toolbar
|
|
40
|
-
className={
|
|
41
|
-
border-t
|
|
42
|
-
border-t-grey-400
|
|
43
|
-
|
|
41
|
+
className={clsx(
|
|
42
|
+
'border-t',
|
|
43
|
+
'border-t-grey-400',
|
|
44
|
+
)}
|
|
44
45
|
onLayout={(e) => onLayout(e)}
|
|
45
46
|
>
|
|
46
47
|
{toolbarItems.length ?
|
|
47
48
|
<HStack
|
|
48
|
-
className={
|
|
49
|
-
PaginationToolbar-HStack
|
|
50
|
-
shrink-0
|
|
51
|
-
border-r
|
|
52
|
-
border-r-grey-400
|
|
53
|
-
mr-3
|
|
54
|
-
pr-3
|
|
55
|
-
|
|
49
|
+
className={clsx(
|
|
50
|
+
'PaginationToolbar-HStack',
|
|
51
|
+
'shrink-0',
|
|
52
|
+
'border-r',
|
|
53
|
+
'border-r-grey-400',
|
|
54
|
+
'mr-3',
|
|
55
|
+
'pr-3',
|
|
56
|
+
)}
|
|
56
57
|
>{toolbarItems}</HStack> : null}
|
|
57
58
|
<Pagination
|
|
58
59
|
{...propsToPass}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HStackNative,
|
|
3
3
|
} from '@project-components/Gluestack';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import UiGlobals from '../../UiGlobals.js';
|
|
5
6
|
|
|
6
7
|
export default function Toolbar(props) {
|
|
7
8
|
|
|
8
9
|
const styles = UiGlobals.styles;
|
|
9
10
|
|
|
10
|
-
let className =
|
|
11
|
-
Toolbar
|
|
12
|
-
overflow-auto
|
|
13
|
-
items-center
|
|
14
|
-
justify-start
|
|
15
|
-
gap-2
|
|
16
|
-
p-2
|
|
17
|
-
border-b
|
|
18
|
-
border-solid
|
|
19
|
-
border-b-grey-400
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
let className = clsx(
|
|
12
|
+
'Toolbar',
|
|
13
|
+
'overflow-auto',
|
|
14
|
+
'items-center',
|
|
15
|
+
'justify-start',
|
|
16
|
+
'gap-2',
|
|
17
|
+
'p-2',
|
|
18
|
+
'border-b',
|
|
19
|
+
'border-solid',
|
|
20
|
+
'border-b-grey-400',
|
|
21
|
+
styles.TOOLBAR_CLASSNAME,
|
|
22
|
+
);
|
|
22
23
|
if (props.className) {
|
|
23
24
|
className += ' ' + props.className
|
|
24
25
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
VStack,
|
|
7
7
|
VStackNative,
|
|
8
8
|
} from '@project-components/Gluestack';
|
|
9
|
+
import clsx from 'clsx';
|
|
9
10
|
import {
|
|
10
11
|
SELECTION_MODE_SINGLE,
|
|
11
12
|
SELECTION_MODE_MULTI,
|
|
@@ -1051,11 +1052,11 @@ function TreeComponent(props) {
|
|
|
1051
1052
|
onContextMenu(item, e, selection);
|
|
1052
1053
|
}
|
|
1053
1054
|
}}
|
|
1054
|
-
className={
|
|
1055
|
-
Pressable
|
|
1056
|
-
Node
|
|
1057
|
-
flex-row
|
|
1058
|
-
|
|
1055
|
+
className={clsx(
|
|
1056
|
+
'Pressable',
|
|
1057
|
+
'Node',
|
|
1058
|
+
'flex-row',
|
|
1059
|
+
)}
|
|
1059
1060
|
style={{
|
|
1060
1061
|
paddingLeft: (areRootsVisible ? depth : depth -1) * DEPTH_INDENT_PX,
|
|
1061
1062
|
}}
|
|
@@ -1400,12 +1401,12 @@ function TreeComponent(props) {
|
|
|
1400
1401
|
}
|
|
1401
1402
|
}
|
|
1402
1403
|
|
|
1403
|
-
let className =
|
|
1404
|
-
Tree-VStack
|
|
1405
|
-
flex-1
|
|
1406
|
-
w-full
|
|
1407
|
-
min-w-[300px]
|
|
1408
|
-
|
|
1404
|
+
let className = clsx(
|
|
1405
|
+
'Tree-VStack',
|
|
1406
|
+
'flex-1',
|
|
1407
|
+
'w-full',
|
|
1408
|
+
'min-w-[300px]',
|
|
1409
|
+
);
|
|
1409
1410
|
if (isLoading) {
|
|
1410
1411
|
className += ' border-t-2 border-[#f00]';
|
|
1411
1412
|
} else {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Spinner,
|
|
7
7
|
TextNative,
|
|
8
8
|
} from '@project-components/Gluestack';
|
|
9
|
+
import clsx from 'clsx';
|
|
9
10
|
import * as colourMixer from '@k-renwick/colour-mixer';
|
|
10
11
|
import {
|
|
11
12
|
UI_MODE_WEB,
|
|
@@ -114,15 +115,15 @@ export default function TreeNode(props) {
|
|
|
114
115
|
bg = colourMixer.blend(bg, 0.5, mixWith);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
let className =
|
|
118
|
-
TreeNode
|
|
119
|
-
items-center
|
|
120
|
-
flex-1
|
|
121
|
-
grow-1
|
|
122
|
-
select-none
|
|
123
|
-
cursor-pointer
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
let className = clsx(
|
|
119
|
+
'TreeNode',
|
|
120
|
+
'items-center',
|
|
121
|
+
'flex-1',
|
|
122
|
+
'grow-1',
|
|
123
|
+
'select-none',
|
|
124
|
+
'cursor-pointer',
|
|
125
|
+
);
|
|
126
|
+
|
|
126
127
|
// Add drop state classes for additional styling
|
|
127
128
|
if (isOver && actualCanDrop) {
|
|
128
129
|
className += ' TreeNode--dropValid border-2 border-green-400';
|
|
@@ -172,16 +173,16 @@ export default function TreeNode(props) {
|
|
|
172
173
|
numberOfLines={1}
|
|
173
174
|
ellipsizeMode="head"
|
|
174
175
|
// {...propsToPass}
|
|
175
|
-
className={
|
|
176
|
-
TreeNode-TextNative
|
|
177
|
-
self-center
|
|
178
|
-
overflow-hidden
|
|
179
|
-
flex
|
|
180
|
-
flex-1
|
|
181
|
-
text-ellipsis
|
|
182
|
-
select-none
|
|
183
|
-
|
|
184
|
-
|
|
176
|
+
className={clsx(
|
|
177
|
+
'TreeNode-TextNative',
|
|
178
|
+
'self-center',
|
|
179
|
+
'overflow-hidden',
|
|
180
|
+
'flex',
|
|
181
|
+
'flex-1',
|
|
182
|
+
'text-ellipsis',
|
|
183
|
+
'select-none',
|
|
184
|
+
styles.TREE_NODE_CLASSNAME,
|
|
185
|
+
)}
|
|
185
186
|
style={{
|
|
186
187
|
userSelect: 'none',
|
|
187
188
|
}}
|
|
@@ -2,20 +2,21 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
VStack,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import styles from '../../Styles/StyleSheets.js';
|
|
6
7
|
import GripVertical from '../Icons/GripVertical.js';
|
|
7
8
|
|
|
8
9
|
function TreeNodeDragHandle(props) {
|
|
9
|
-
let className =
|
|
10
|
-
TreeNodeDragHandle
|
|
11
|
-
h-full
|
|
12
|
-
w-[14px]
|
|
13
|
-
px-[2px]
|
|
14
|
-
border-l-2
|
|
15
|
-
items-center
|
|
16
|
-
justify-center
|
|
17
|
-
select-none
|
|
18
|
-
|
|
10
|
+
let className = clsx(
|
|
11
|
+
'TreeNodeDragHandle',
|
|
12
|
+
'h-full',
|
|
13
|
+
'w-[14px]',
|
|
14
|
+
'px-[2px]',
|
|
15
|
+
'border-l-2',
|
|
16
|
+
'items-center',
|
|
17
|
+
'justify-center',
|
|
18
|
+
'select-none',
|
|
19
|
+
);
|
|
19
20
|
if (props.className) {
|
|
20
21
|
className += ' ' + props.className;
|
|
21
22
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TextNative,
|
|
3
3
|
} from '@project-components/Gluestack';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import UiGlobals from '../../UiGlobals';
|
|
5
6
|
|
|
6
7
|
export default function MeterTypeText(props) {
|
|
7
8
|
const styles = UiGlobals.styles;
|
|
8
9
|
|
|
9
|
-
let className =
|
|
10
|
-
Text
|
|
11
|
-
flex-1
|
|
12
|
-
px-3
|
|
13
|
-
py-2
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
let className = clsx(
|
|
11
|
+
'Text',
|
|
12
|
+
'flex-1',
|
|
13
|
+
'px-3',
|
|
14
|
+
'py-2',
|
|
15
|
+
styles.FORM_TEXT_CLASSNAME,
|
|
16
|
+
);
|
|
16
17
|
if (props.className) {
|
|
17
18
|
className += ' ' + props.className;
|
|
18
19
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Text,
|
|
7
7
|
TextNative,
|
|
8
8
|
} from '@project-components/Gluestack';
|
|
9
|
+
import clsx from 'clsx';
|
|
9
10
|
import {
|
|
10
11
|
UI_MODE_WEB,
|
|
11
12
|
} from '../../Constants/UiModes.js';
|
|
@@ -48,11 +49,11 @@ function TextWithLinksElement(props) {
|
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
const
|
|
51
|
-
textClassName =
|
|
52
|
-
TextWithLinks-Text
|
|
53
|
-
text-base
|
|
54
|
-
overflow-hidden
|
|
55
|
-
|
|
52
|
+
textClassName = clsx(
|
|
53
|
+
'TextWithLinks-Text',
|
|
54
|
+
'text-base',
|
|
55
|
+
'overflow-hidden',
|
|
56
|
+
),
|
|
56
57
|
textSegments = modifiedText.split(/(link_\d+)/);
|
|
57
58
|
if (textSegments.length === 1) {
|
|
58
59
|
return <Text className={textClassName}>{modifiedText}</Text>;
|
|
@@ -65,10 +66,10 @@ function TextWithLinksElement(props) {
|
|
|
65
66
|
if (foundLink) {
|
|
66
67
|
ret = <TextNative
|
|
67
68
|
key={foundLink.key}
|
|
68
|
-
className={
|
|
69
|
-
text-blue-600
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
className={clsx(
|
|
70
|
+
'text-blue-600',
|
|
71
|
+
textClassName,
|
|
72
|
+
)}
|
|
72
73
|
onPress={() => openLink(foundLink.link)}
|
|
73
74
|
>{foundLink.link}</TextNative>;
|
|
74
75
|
}
|
|
@@ -80,12 +81,12 @@ function TextWithLinksElement(props) {
|
|
|
80
81
|
if (UiGlobals.mode === UI_MODE_WEB) {
|
|
81
82
|
elementProps.textOverflow = 'ellipsis';
|
|
82
83
|
}
|
|
83
|
-
let className =
|
|
84
|
-
overflow-auto
|
|
85
|
-
min-h-[40px]
|
|
86
|
-
px-3
|
|
87
|
-
py-2
|
|
88
|
-
|
|
84
|
+
let className = clsx(
|
|
85
|
+
'overflow-auto',
|
|
86
|
+
'min-h-[40px]',
|
|
87
|
+
'px-3',
|
|
88
|
+
'py-2',
|
|
89
|
+
);
|
|
89
90
|
if (props.className) {
|
|
90
91
|
className += ` ${props.className}`;
|
|
91
92
|
}
|
|
@@ -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 Animated, {
|
|
12
13
|
useSharedValue,
|
|
13
14
|
useAnimatedStyle,
|
|
@@ -264,12 +265,12 @@ function Viewer(props) {
|
|
|
264
265
|
}
|
|
265
266
|
}
|
|
266
267
|
|
|
267
|
-
let elementClassName =
|
|
268
|
-
Viewer-field
|
|
269
|
-
basis-auto
|
|
270
|
-
grow
|
|
271
|
-
shrink
|
|
272
|
-
|
|
268
|
+
let elementClassName = clsx(
|
|
269
|
+
'Viewer-field',
|
|
270
|
+
'basis-auto',
|
|
271
|
+
'grow',
|
|
272
|
+
'shrink',
|
|
273
|
+
);
|
|
273
274
|
const defaultsClassName = defaults.className;
|
|
274
275
|
if (defaultsClassName) {
|
|
275
276
|
elementClassName += ' ' + defaultsClassName;
|
|
@@ -474,11 +475,11 @@ function Viewer(props) {
|
|
|
474
475
|
if (!hasWidth(props) && !hasFlex(props)) {
|
|
475
476
|
style.flex = 1;
|
|
476
477
|
}
|
|
477
|
-
let className =
|
|
478
|
-
Viewer-VStackNative
|
|
479
|
-
h-full
|
|
480
|
-
bg-white
|
|
481
|
-
|
|
478
|
+
let className = clsx(
|
|
479
|
+
'Viewer-VStackNative',
|
|
480
|
+
'h-full',
|
|
481
|
+
'bg-white',
|
|
482
|
+
);
|
|
482
483
|
if (props.className) {
|
|
483
484
|
className += ' ' + props.className;
|
|
484
485
|
}
|
|
@@ -491,11 +492,11 @@ function Viewer(props) {
|
|
|
491
492
|
{...testProps('deleteBtn')}
|
|
492
493
|
key="deleteBtn"
|
|
493
494
|
onPress={onDelete}
|
|
494
|
-
className={
|
|
495
|
-
text-white
|
|
496
|
-
bg-warning-500
|
|
497
|
-
hover:bg-warning-600
|
|
498
|
-
|
|
495
|
+
className={clsx(
|
|
496
|
+
'text-white',
|
|
497
|
+
'bg-warning-500',
|
|
498
|
+
'hover:bg-warning-600',
|
|
499
|
+
)}
|
|
499
500
|
text="Delete"
|
|
500
501
|
/>
|
|
501
502
|
</HStack>}
|
|
@@ -523,12 +524,12 @@ function Viewer(props) {
|
|
|
523
524
|
ref={scrollViewRef}
|
|
524
525
|
onScroll={onScroll}
|
|
525
526
|
scrollEventThrottle={16 /* ms */}
|
|
526
|
-
className={
|
|
527
|
-
Viewer-ScrollView
|
|
528
|
-
w-full
|
|
529
|
-
pb-1
|
|
530
|
-
flex-1
|
|
531
|
-
|
|
527
|
+
className={clsx(
|
|
528
|
+
'Viewer-ScrollView',
|
|
529
|
+
'w-full',
|
|
530
|
+
'pb-1',
|
|
531
|
+
'flex-1',
|
|
532
|
+
)}
|
|
532
533
|
>
|
|
533
534
|
{scrollToTopAnchor}
|
|
534
535
|
{canEdit && onEditMode &&
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* "LICENSE.txt" file, which is part of this source code package.
|
|
6
6
|
*/
|
|
7
7
|
import { useState, } from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import Excel from '../Icons/Excel';
|
|
9
10
|
import Panel from '../Panel/Panel.js';
|
|
10
11
|
import Form from '../Form/Form.js';
|
|
@@ -187,11 +188,11 @@ function UploadsDownloadsWindow(props) {
|
|
|
187
188
|
reference="UploadsDownloadsWindow"
|
|
188
189
|
isCollapsible={false}
|
|
189
190
|
title="Uploads & Downloads"
|
|
190
|
-
className={
|
|
191
|
-
flex-none
|
|
192
|
-
bg-white
|
|
193
|
-
shadow-lg
|
|
194
|
-
|
|
191
|
+
className={clsx(
|
|
192
|
+
'flex-none',
|
|
193
|
+
'bg-white',
|
|
194
|
+
'shadow-lg',
|
|
195
|
+
)}
|
|
195
196
|
style={{
|
|
196
197
|
height,
|
|
197
198
|
width,
|
package/src/Components/index.js
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useState, useEffect, } from 'react';
|
|
2
|
+
|
|
3
|
+
export default function useAsyncRenderers(columnsConfig, item) {
|
|
4
|
+
const
|
|
5
|
+
[results, setResults] = useState(new Map()),
|
|
6
|
+
[loading, setLoading] = useState(new Set());
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const asyncConfigs = columnsConfig.filter(config =>
|
|
10
|
+
config.renderer && typeof config.renderer === 'function'
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
if (asyncConfigs.length === 0) {
|
|
14
|
+
setResults(new Map());
|
|
15
|
+
setLoading(new Set());
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const newLoading = new Set();
|
|
20
|
+
asyncConfigs.forEach((config, index) => {
|
|
21
|
+
newLoading.add(index);
|
|
22
|
+
});
|
|
23
|
+
setLoading(newLoading);
|
|
24
|
+
|
|
25
|
+
const promises = asyncConfigs.map(async (config, configIndex) => {
|
|
26
|
+
try {
|
|
27
|
+
const result = await config.renderer(item);
|
|
28
|
+
return { configIndex, result, error: null };
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return { configIndex, result: null, error };
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
Promise.allSettled(promises).then(settled => {
|
|
35
|
+
const
|
|
36
|
+
newResults = new Map(),
|
|
37
|
+
newLoading = new Set();
|
|
38
|
+
|
|
39
|
+
settled.forEach((outcome, index) => {
|
|
40
|
+
if (outcome.status === 'fulfilled') {
|
|
41
|
+
const { configIndex, result, error } = outcome.value;
|
|
42
|
+
newResults.set(configIndex, { result, error });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
setResults(newResults);
|
|
47
|
+
setLoading(newLoading);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
}, [columnsConfig, item]);
|
|
51
|
+
|
|
52
|
+
return { results, loading };
|
|
53
|
+
}
|