@onehat/ui 0.4.8 → 0.4.9
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 +1 -1
- package/src/Components/Form/Field/Combo/Combo.js +1 -0
- package/src/Components/Form/Field/Tag/Tag.js +1 -1
- package/src/Components/Form/Form.js +17 -16
- package/src/Components/Grid/Grid.js +45 -22
- package/src/Components/Grid/GridRow.js +4 -0
- package/src/Components/Icons/Gauge.js +2 -2
- package/src/Components/Toolbar/Pagination.js +55 -28
package/package.json
CHANGED
|
@@ -378,7 +378,7 @@ function Form(props) {
|
|
|
378
378
|
dynamicProps = getDynamicProps({ fieldState, formSetValue, formGetValues, formState });
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
let elementClassName = 'Form-Element
|
|
381
|
+
let elementClassName = 'Form-Element';
|
|
382
382
|
if (type.match(/Tag/)) {
|
|
383
383
|
elementClassName += ' overflow-auto';
|
|
384
384
|
}
|
|
@@ -643,10 +643,10 @@ function Form(props) {
|
|
|
643
643
|
if (defaults?.labelWidth) {
|
|
644
644
|
style.width = defaults.labelWidth;
|
|
645
645
|
}
|
|
646
|
-
if (!style.width) {
|
|
647
|
-
style.width = '50px';
|
|
648
|
-
}
|
|
649
646
|
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
647
|
+
if (!style.width) {
|
|
648
|
+
style.width = '100px';
|
|
649
|
+
}
|
|
650
650
|
element = <HStack className="Form-HStack1 w-full py-1">
|
|
651
651
|
<Label style={style}>{label}</Label>
|
|
652
652
|
{element}
|
|
@@ -724,7 +724,7 @@ function Form(props) {
|
|
|
724
724
|
dynamicProps = getDynamicProps({ fieldState, formSetValue, formGetValues, formState });
|
|
725
725
|
}
|
|
726
726
|
|
|
727
|
-
let elementClassName = 'Form-Element field-' + name + '
|
|
727
|
+
let elementClassName = 'Form-Element field-' + name + ' w-full';
|
|
728
728
|
const defaultsClassName = defaults.className;
|
|
729
729
|
if (defaultsClassName) {
|
|
730
730
|
elementClassName += ' ' + defaultsClassName;
|
|
@@ -774,7 +774,7 @@ function Form(props) {
|
|
|
774
774
|
if (message) {
|
|
775
775
|
message = <Text className="text-[#f00]">{message}</Text>;
|
|
776
776
|
}
|
|
777
|
-
element = <VStack className="Form-VStack4
|
|
777
|
+
element = <VStack className="Form-VStack4 w-full pt-1">
|
|
778
778
|
{element}
|
|
779
779
|
{message}
|
|
780
780
|
</VStack>;
|
|
@@ -782,14 +782,14 @@ function Form(props) {
|
|
|
782
782
|
if (item.additionalEditButtons) {
|
|
783
783
|
const buttons = buildAdditionalButtons(item.additionalEditButtons, self, { fieldState, formSetValue, formGetValues, formState });
|
|
784
784
|
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
785
|
-
element = <HStack className="Form-HStack5
|
|
785
|
+
element = <HStack className="Form-HStack5 w-full flex-wrap">
|
|
786
786
|
{element}
|
|
787
787
|
{buttons}
|
|
788
788
|
</HStack>;
|
|
789
789
|
} else {
|
|
790
|
-
element = <VStack className="Form-VStack6
|
|
790
|
+
element = <VStack className="Form-VStack6 w-full">
|
|
791
791
|
{element}
|
|
792
|
-
<HStack className="Form-HStack7-VStack
|
|
792
|
+
<HStack className="Form-HStack7-VStack w-full mt-1 flex-wrap">
|
|
793
793
|
{buttons}
|
|
794
794
|
</HStack>
|
|
795
795
|
</VStack>;
|
|
@@ -819,22 +819,22 @@ function Form(props) {
|
|
|
819
819
|
if (defaults?.labelWidth) {
|
|
820
820
|
style.width = defaults.labelWidth;
|
|
821
821
|
}
|
|
822
|
-
if (!style.width) {
|
|
823
|
-
style.width = '50px';
|
|
824
|
-
}
|
|
825
822
|
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
826
|
-
|
|
823
|
+
if (!style.width) {
|
|
824
|
+
style.width = '100px';
|
|
825
|
+
}
|
|
826
|
+
element = <HStack className="Form-HStack8 w-full">
|
|
827
827
|
<Label style={style}>{requiredIndicator}{label}</Label>
|
|
828
828
|
{element}
|
|
829
829
|
</HStack>;
|
|
830
830
|
} else {
|
|
831
|
-
element = <VStack className="Form-VStack9
|
|
831
|
+
element = <VStack className="Form-VStack9 w-full mt-3">
|
|
832
832
|
<Label style={style}>{requiredIndicator}{label}</Label>
|
|
833
833
|
{element}
|
|
834
834
|
</VStack>;
|
|
835
835
|
}
|
|
836
836
|
} else if (disableLabels && requiredIndicator) {
|
|
837
|
-
element = <HStack className="Form-HStack10
|
|
837
|
+
element = <HStack className="Form-HStack10 w-full">
|
|
838
838
|
{requiredIndicator}
|
|
839
839
|
{element}
|
|
840
840
|
</HStack>;
|
|
@@ -855,9 +855,10 @@ function Form(props) {
|
|
|
855
855
|
key={ix}
|
|
856
856
|
className={`
|
|
857
857
|
Form-HStack11
|
|
858
|
+
min-h-[50px]
|
|
859
|
+
w-full
|
|
858
860
|
flex-none
|
|
859
861
|
pb-2
|
|
860
|
-
h-[50px]
|
|
861
862
|
${error ? 'bg-[#fdd]' : ''}
|
|
862
863
|
`}
|
|
863
864
|
>
|
|
@@ -107,7 +107,6 @@ const
|
|
|
107
107
|
|
|
108
108
|
function GridComponent(props) {
|
|
109
109
|
const {
|
|
110
|
-
|
|
111
110
|
columnsConfig = [], // json configurations for each column
|
|
112
111
|
columnProps = {},
|
|
113
112
|
defaultHiddenColumns = [],
|
|
@@ -365,7 +364,7 @@ function GridComponent(props) {
|
|
|
365
364
|
onPress={() => setIsReorderMode(!isReorderMode)}
|
|
366
365
|
icon={isReorderMode ? NoReorderRows : ReorderRows}
|
|
367
366
|
_icon={{
|
|
368
|
-
className: styles.
|
|
367
|
+
className: styles.TOOLBAR_ITEMS_COLOR,
|
|
369
368
|
}}
|
|
370
369
|
tooltip="Reorder Rows"
|
|
371
370
|
/>);
|
|
@@ -466,28 +465,36 @@ function GridComponent(props) {
|
|
|
466
465
|
onContextMenu(item, e, selection);
|
|
467
466
|
}
|
|
468
467
|
}}
|
|
469
|
-
className="flex-row grow
|
|
468
|
+
className="flex-row grow">
|
|
470
469
|
{({
|
|
471
470
|
hovered,
|
|
472
471
|
focused,
|
|
473
472
|
pressed,
|
|
474
473
|
}) => {
|
|
475
474
|
if (isHeaderRow) {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
475
|
+
let headerRow = <GridHeaderRow
|
|
476
|
+
Repository={Repository}
|
|
477
|
+
columnsConfig={localColumnsConfig}
|
|
478
|
+
setColumnsConfig={setLocalColumnsConfig}
|
|
479
|
+
hideNavColumn={hideNavColumn}
|
|
480
|
+
canColumnsSort={canColumnsSort}
|
|
481
|
+
canColumnsReorder={canColumnsReorder}
|
|
482
|
+
canColumnsResize={canColumnsResize}
|
|
483
|
+
setSelection={setSelection}
|
|
484
|
+
gridRef={gridRef}
|
|
485
|
+
isHovered={hovered}
|
|
486
|
+
isInlineEditorShown={isInlineEditorShown}
|
|
487
|
+
areRowsDragSource={areRowsDragSource}
|
|
488
|
+
showColumnsSelector={showColumnsSelector}
|
|
489
|
+
/>;
|
|
490
|
+
if (showRowExpander) {
|
|
491
|
+
// align the header row to content rows
|
|
492
|
+
headerRow = <HStack className="">
|
|
493
|
+
<Box className="w-[40px]"></Box>
|
|
494
|
+
{headerRow}
|
|
495
|
+
</HStack>;
|
|
496
|
+
}
|
|
497
|
+
return headerRow;
|
|
491
498
|
}
|
|
492
499
|
|
|
493
500
|
const
|
|
@@ -572,15 +579,29 @@ function GridComponent(props) {
|
|
|
572
579
|
|
|
573
580
|
if (showRowExpander && !isHeaderRow) {
|
|
574
581
|
const isExpanded = getIsExpanded(index);
|
|
575
|
-
|
|
576
|
-
|
|
582
|
+
let className = `
|
|
583
|
+
Grid-rowExpander
|
|
584
|
+
w-full
|
|
585
|
+
flex-none
|
|
586
|
+
`;
|
|
587
|
+
if (rowProps?.className) {
|
|
588
|
+
className += ' ' + rowProps.className;
|
|
589
|
+
}
|
|
590
|
+
rowComponent = <VStack className={className}>
|
|
591
|
+
<HStack
|
|
592
|
+
className={`
|
|
593
|
+
Grid-rowExpander-HStack
|
|
594
|
+
w-full
|
|
595
|
+
grow
|
|
596
|
+
`}
|
|
597
|
+
>
|
|
577
598
|
<ExpandButton
|
|
578
599
|
isExpanded={isExpanded}
|
|
579
600
|
onToggle={() => setIsExpanded(index, !isExpanded)}
|
|
580
601
|
_icon={{
|
|
581
602
|
size: 'sm',
|
|
582
603
|
}}
|
|
583
|
-
className="py-0"
|
|
604
|
+
className="Grid-rowExpander-expandBtn py-0"
|
|
584
605
|
tooltip="Expand/Contract Row"
|
|
585
606
|
/>
|
|
586
607
|
{rowComponent}
|
|
@@ -1228,6 +1249,7 @@ function GridComponent(props) {
|
|
|
1228
1249
|
className={`
|
|
1229
1250
|
gridContainer
|
|
1230
1251
|
w-full
|
|
1252
|
+
h-full
|
|
1231
1253
|
flex-1
|
|
1232
1254
|
min-h-[40px]
|
|
1233
1255
|
${gridContainerBorderClassName}
|
|
@@ -1244,7 +1266,8 @@ function GridComponent(props) {
|
|
|
1244
1266
|
grid = <Box
|
|
1245
1267
|
ref={dropTargetRef}
|
|
1246
1268
|
className={`
|
|
1247
|
-
dropTarget
|
|
1269
|
+
Grid-dropTarget
|
|
1270
|
+
h-full
|
|
1248
1271
|
w-full
|
|
1249
1272
|
border-[#0ff]
|
|
1250
1273
|
${canDrop && isOver ? "border-[4px]" : "border-[0px]"}
|
|
@@ -315,6 +315,9 @@ function GridRow(props) {
|
|
|
315
315
|
} else {
|
|
316
316
|
rowClassName += ' border-b border-b-grey-100';
|
|
317
317
|
}
|
|
318
|
+
if (rowProps?.className) {
|
|
319
|
+
rowClassName += ' ' + rowProps.className;
|
|
320
|
+
}
|
|
318
321
|
return <HStackNative
|
|
319
322
|
{...testProps('row' + (isSelected ? '-selected' : ''))}
|
|
320
323
|
{...rowProps}
|
|
@@ -337,6 +340,7 @@ function GridRow(props) {
|
|
|
337
340
|
isInlineEditorShown,
|
|
338
341
|
isSelected,
|
|
339
342
|
isHovered,
|
|
343
|
+
isOver,
|
|
340
344
|
index,
|
|
341
345
|
dragSourceRef,
|
|
342
346
|
dropTargetRef,
|
|
@@ -4,8 +4,8 @@ import { Path, Svg } from 'react-native-svg';
|
|
|
4
4
|
|
|
5
5
|
const SvgComponent = createIcon({
|
|
6
6
|
Root: Svg,
|
|
7
|
-
viewBox: '0 0
|
|
8
|
-
path: <Path d="M0
|
|
7
|
+
viewBox: '0 0 512 512',
|
|
8
|
+
path: <Path d="M0 256a256 256 0 11512 0 256 256 0 11-512 0zm320 96c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24 24v204.7c-23.5 9.5-40 32.5-40 59.3 0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176a32 32 0 100-64 32 32 0 100 64zm-16 80a32 32 0 10-64 0 32 32 0 1064 0zm288 32a32 32 0 100-64 32 32 0 100 64zm-16-144a32 32 0 10-64 0 32 32 0 1064 0z" />,
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
export default SvgComponent
|
|
@@ -61,6 +61,7 @@ export default function Pagination(props) {
|
|
|
61
61
|
{...testProps('showMoreBtn')}
|
|
62
62
|
key="showMoreBtn"
|
|
63
63
|
reference="showMoreBtn"
|
|
64
|
+
className="Pagination-showMoreBtn"
|
|
64
65
|
parent={self}
|
|
65
66
|
onPress={() => Repository.showMore()}
|
|
66
67
|
isDisabled={isDisabled}
|
|
@@ -70,6 +71,7 @@ export default function Pagination(props) {
|
|
|
70
71
|
if (!Repository.isLocal) {
|
|
71
72
|
items.push(<ReloadButton
|
|
72
73
|
key="reloadPageBtn"
|
|
74
|
+
className="Pagination-reloadPageBtn"
|
|
73
75
|
_icon={iconProps}
|
|
74
76
|
Repository={Repository}
|
|
75
77
|
self={self}
|
|
@@ -82,6 +84,7 @@ export default function Pagination(props) {
|
|
|
82
84
|
{...testProps('firstPageBtn')}
|
|
83
85
|
key="firstPageBtn"
|
|
84
86
|
reference="firstPageBtn"
|
|
87
|
+
className="Pagination-firstPageBtn"
|
|
85
88
|
parent={self}
|
|
86
89
|
isDisabled={isDisabled}
|
|
87
90
|
icon={AnglesLeft}
|
|
@@ -93,6 +96,7 @@ export default function Pagination(props) {
|
|
|
93
96
|
{...testProps('prevPageBtn')}
|
|
94
97
|
key="prevPageBtn"
|
|
95
98
|
reference="prevPageBtn"
|
|
99
|
+
className="Pagination-prevPageBtn"
|
|
96
100
|
parent={self}
|
|
97
101
|
isDisabled={isDisabled}
|
|
98
102
|
icon={AngleLeft}
|
|
@@ -101,31 +105,38 @@ export default function Pagination(props) {
|
|
|
101
105
|
tooltip="Previous Page"
|
|
102
106
|
/>);
|
|
103
107
|
if (!minimize) {
|
|
104
|
-
items.push(<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
108
|
+
items.push(<Text
|
|
109
|
+
key="page"
|
|
110
|
+
className="Pagination-page mx-1"
|
|
111
|
+
>Page</Text>);
|
|
112
|
+
items.push(<Input
|
|
113
|
+
{...testProps('pageInput')}
|
|
114
|
+
key="pageInput"
|
|
115
|
+
reference="pageInput"
|
|
116
|
+
parent={self}
|
|
117
|
+
keyboardType="numeric"
|
|
118
|
+
value={page?.toString()}
|
|
119
|
+
onChangeValue={(value) => Repository.setPage(value)}
|
|
120
|
+
maxValue={totalPages}
|
|
121
|
+
isDisabled={totalPages === 1}
|
|
122
|
+
className={`
|
|
123
|
+
Pagination-pageInput
|
|
124
|
+
min-w-[40px]
|
|
125
|
+
w-[40px]
|
|
126
|
+
text-center
|
|
127
|
+
bg-grey-100
|
|
128
|
+
`}
|
|
129
|
+
tooltip="Set Page"
|
|
130
|
+
/>);
|
|
131
|
+
items.push(<Text
|
|
132
|
+
key="totalPages"
|
|
133
|
+
className={`
|
|
134
|
+
Pagination-totalPages
|
|
135
|
+
whitespace-nowrap
|
|
136
|
+
inline-flex
|
|
137
|
+
mx-1
|
|
138
|
+
`}
|
|
139
|
+
>{`of ${totalPages}`}</Text>);
|
|
129
140
|
}
|
|
130
141
|
|
|
131
142
|
isDisabled = page === totalPages || totalPages <= 1;
|
|
@@ -133,6 +144,7 @@ export default function Pagination(props) {
|
|
|
133
144
|
{...testProps('nextPageBtn')}
|
|
134
145
|
key="nextPageBtn"
|
|
135
146
|
reference="nextPageBtn"
|
|
147
|
+
className="Pagination-nextPageBtn"
|
|
136
148
|
parent={self}
|
|
137
149
|
isDisabled={isDisabled}
|
|
138
150
|
icon={AngleRight}
|
|
@@ -144,6 +156,7 @@ export default function Pagination(props) {
|
|
|
144
156
|
{...testProps('lastPageBtn')}
|
|
145
157
|
key="lastPageBtn"
|
|
146
158
|
reference="lastPageBtn"
|
|
159
|
+
className="Pagination-lastPageBtn"
|
|
147
160
|
parent={self}
|
|
148
161
|
isDisabled={isDisabled}
|
|
149
162
|
icon={AnglesRight}
|
|
@@ -156,6 +169,7 @@ export default function Pagination(props) {
|
|
|
156
169
|
if (!Repository.isLocal) {
|
|
157
170
|
items.push(<ReloadButton
|
|
158
171
|
key="reloadPageBtn"
|
|
172
|
+
className="Pagination-reloadPageBtn"
|
|
159
173
|
_icon={iconProps}
|
|
160
174
|
Repository={Repository}
|
|
161
175
|
self={self}
|
|
@@ -178,13 +192,26 @@ export default function Pagination(props) {
|
|
|
178
192
|
}
|
|
179
193
|
items.push(<Text
|
|
180
194
|
key="pageDisplay"
|
|
181
|
-
className=
|
|
182
|
-
|
|
195
|
+
className={`
|
|
196
|
+
Pagination-pageDisplay
|
|
197
|
+
whitespace-nowrap
|
|
198
|
+
inline-flex
|
|
199
|
+
mx-1
|
|
200
|
+
`}
|
|
201
|
+
>{`Displaying ${pageSpan} of ${total}`}</Text>);
|
|
183
202
|
}
|
|
184
203
|
}
|
|
185
204
|
return <HStack
|
|
186
205
|
style={{ userSelect: 'none', }}
|
|
187
|
-
className=
|
|
206
|
+
className={`
|
|
207
|
+
Pagination
|
|
208
|
+
flex-none
|
|
209
|
+
gap-1
|
|
210
|
+
justify-start
|
|
211
|
+
items-center
|
|
212
|
+
px-2
|
|
213
|
+
mr-3
|
|
214
|
+
`}
|
|
188
215
|
>
|
|
189
216
|
{items}
|
|
190
217
|
</HStack>;
|