@onehat/ui 0.3.198 → 0.3.200
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
CHANGED
|
@@ -40,7 +40,9 @@ import Footer from '../Layout/Footer.js';
|
|
|
40
40
|
import Label from '../Form/Label.js';
|
|
41
41
|
import _ from 'lodash';
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const
|
|
44
|
+
ONE_COLUMN_THRESHOLD = 900, // only allow one column in form
|
|
45
|
+
STACK_ROW_THRESHOLD = 500; // stack field-row elements
|
|
44
46
|
|
|
45
47
|
// TODO: memoize field Components
|
|
46
48
|
|
|
@@ -367,7 +369,7 @@ function Form(props) {
|
|
|
367
369
|
return null;
|
|
368
370
|
}
|
|
369
371
|
if (type === 'Column') {
|
|
370
|
-
if (containerWidth <
|
|
372
|
+
if (containerWidth < ONE_COLUMN_THRESHOLD) {
|
|
371
373
|
// everything is in one column
|
|
372
374
|
if (propsToPass.hasOwnProperty('flex')) {
|
|
373
375
|
delete propsToPass.flex;
|
|
@@ -420,7 +422,7 @@ function Form(props) {
|
|
|
420
422
|
if (defaults?.labelWidth) {
|
|
421
423
|
labelProps.w = defaults.labelWidth;
|
|
422
424
|
}
|
|
423
|
-
if (containerWidth >
|
|
425
|
+
if (containerWidth > STACK_ROW_THRESHOLD) {
|
|
424
426
|
element = <><Label {...labelProps}>{label}</Label>{element}</>;
|
|
425
427
|
} else {
|
|
426
428
|
element = <Column><Label {...labelProps}>{label}</Label>{element}</Column>;
|
|
@@ -530,7 +532,7 @@ function Form(props) {
|
|
|
530
532
|
|
|
531
533
|
if (item.additionalEditButtons) {
|
|
532
534
|
const buttons = buildAdditionalButtons(item.additionalEditButtons, self, { fieldState, formSetValue, formGetValues, formState });
|
|
533
|
-
if (containerWidth >
|
|
535
|
+
if (containerWidth > STACK_ROW_THRESHOLD) {
|
|
534
536
|
element = <Row flex={1} flexWrap="wrap">
|
|
535
537
|
{element}
|
|
536
538
|
{buttons}
|
|
@@ -566,7 +568,7 @@ function Form(props) {
|
|
|
566
568
|
if (defaults?.labelWidth) {
|
|
567
569
|
labelProps.w = defaults.labelWidth;
|
|
568
570
|
}
|
|
569
|
-
if (containerWidth >
|
|
571
|
+
if (containerWidth > STACK_ROW_THRESHOLD) {
|
|
570
572
|
element = <Row w="100%" py={1}>
|
|
571
573
|
<Label {...labelProps}>{requiredIndicator}{label}</Label>
|
|
572
574
|
{element}
|
|
@@ -784,8 +786,8 @@ function Form(props) {
|
|
|
784
786
|
formComponents = buildFromItems();
|
|
785
787
|
const formAncillaryComponents = buildAncillary();
|
|
786
788
|
editor = <>
|
|
787
|
-
{containerWidth >=
|
|
788
|
-
{containerWidth <
|
|
789
|
+
{containerWidth >= ONE_COLUMN_THRESHOLD ? <Row p={4} pl={0}>{formComponents}</Row> : null}
|
|
790
|
+
{containerWidth < ONE_COLUMN_THRESHOLD ? <Column p={4}>{formComponents}</Column> : null}
|
|
789
791
|
<Column m={2} pt={4} px={2}>{formAncillaryComponents}</Column>
|
|
790
792
|
</>;
|
|
791
793
|
|
|
@@ -865,8 +865,8 @@ function GridComponent(props) {
|
|
|
865
865
|
Repository.ons(['changePage', 'changePageSize',], deselectAll);
|
|
866
866
|
}
|
|
867
867
|
Repository.ons(['changeData', 'change'], forceUpdate);
|
|
868
|
-
|
|
869
|
-
|
|
868
|
+
Repository.on('changeFilters', onChangeFilters);
|
|
869
|
+
Repository.on('changeSorters', onChangeSorters);
|
|
870
870
|
|
|
871
871
|
|
|
872
872
|
applySelectorSelected();
|
|
@@ -883,8 +883,8 @@ function GridComponent(props) {
|
|
|
883
883
|
Repository.offs(['changePage', 'changePageSize',], deselectAll);
|
|
884
884
|
}
|
|
885
885
|
Repository.offs(['changeData', 'change'], forceUpdate);
|
|
886
|
-
|
|
887
|
-
|
|
886
|
+
Repository.off('changeFilters', onChangeFilters);
|
|
887
|
+
Repository.off('changeSorters', onChangeSorters);
|
|
888
888
|
};
|
|
889
889
|
}, [isInited]);
|
|
890
890
|
|