From e698fe7e1f4b7b3f5ce5dc49f83a49734ba5bdef Mon Sep 17 00:00:00 2001 From: VargaJoe <17780970+VargaJoe@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:50:58 +0200 Subject: [PATCH] Single column mui (#1520) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * single column mui * set field full width everywhere * fix reference width * set datetime width * date field auto width * set switcher auto width * set number auto width * set dropdown auto width * set allowed child types auto width * short text label instead of placeholder * align fixes * unit test adjusts * reference picker layout * remove comments * remove comments 2 --------- Co-authored-by: Ádám Hassan --- .../src/components/view-controls/common/styles.ts | 2 +- .../src/fieldcontrols/allowed-child-types.tsx | 3 +-- .../src/fieldcontrols/date-picker.tsx | 6 ++---- .../src/fieldcontrols/dropdown-list.tsx | 5 ++++- .../sn-controls-react/src/fieldcontrols/number.tsx | 4 ++-- .../reference-grid/default-item-template.tsx | 7 ++----- .../reference-grid/reference-grid.tsx | 11 +++++++---- .../src/fieldcontrols/short-text.tsx | 2 +- .../src/fieldcontrols/switcher.tsx | 2 +- .../src/viewcontrols/browse-view.tsx | 6 +++--- .../src/viewcontrols/edit-view.tsx | 6 +++--- .../test/__snapshots__/date-picker.test.tsx.snap | 14 ++++++++++---- .../test/__snapshots__/dropdown-list.test.tsx.snap | 6 +++++- .../test/__snapshots__/number.test.tsx.snap | 8 ++++++-- .../test/__snapshots__/short-text.test.tsx.snap | 6 +++++- .../sn-controls-react/test/date-picker.test.tsx | 2 -- packages/sn-controls-react/test/number.test.tsx | 2 +- .../sn-controls-react/test/reference-grid.test.tsx | 10 +++++++--- .../sn-controls-react/test/short-text.test.tsx | 1 - 19 files changed, 61 insertions(+), 42 deletions(-) diff --git a/apps/sensenet/src/components/view-controls/common/styles.ts b/apps/sensenet/src/components/view-controls/common/styles.ts index c00915f4e..cbb9f6f46 100644 --- a/apps/sensenet/src/components/view-controls/common/styles.ts +++ b/apps/sensenet/src/components/view-controls/common/styles.ts @@ -18,7 +18,7 @@ const useStyles = makeStyles(() => { position: 'relative', }, field: { - width: '75%', + width: '88%', position: 'relative', }, fieldFullWidth: { diff --git a/packages/sn-controls-react/src/fieldcontrols/allowed-child-types.tsx b/packages/sn-controls-react/src/fieldcontrols/allowed-child-types.tsx index f130c5d95..2e879f5c6 100644 --- a/packages/sn-controls-react/src/fieldcontrols/allowed-child-types.tsx +++ b/packages/sn-controls-react/src/fieldcontrols/allowed-child-types.tsx @@ -230,7 +230,7 @@ export const AllowedChildTypes: React.FC -
+
{props.settings.DisplayName} @@ -264,7 +264,6 @@ export const AllowedChildTypes: React.FC diff --git a/packages/sn-controls-react/src/fieldcontrols/date-picker.tsx b/packages/sn-controls-react/src/fieldcontrols/date-picker.tsx index 8b8ff3924..be702fec3 100644 --- a/packages/sn-controls-react/src/fieldcontrols/date-picker.tsx +++ b/packages/sn-controls-react/src/fieldcontrols/date-picker.tsx @@ -95,9 +95,8 @@ export const DatePicker: React.FC> label={settings.DisplayName} id={settings.Name} disabled={settings.ReadOnly} - placeholder={settings.DisplayName} + InputLabelProps={{ shrink: true }} required={settings.Compulsory} - fullWidth={true} format="yyyy MMMM dd" /> ) : ( @@ -109,9 +108,8 @@ export const DatePicker: React.FC> name={settings.Name} id={settings.Name} disabled={settings.ReadOnly} - placeholder={settings.DisplayName} + InputLabelProps={{ shrink: true }} required={settings.Compulsory} - fullWidth={true} format="yyyy MMMM dd hh:mm aaaa" /> )} diff --git a/packages/sn-controls-react/src/fieldcontrols/dropdown-list.tsx b/packages/sn-controls-react/src/fieldcontrols/dropdown-list.tsx index 9b5c51e4b..abf23f442 100644 --- a/packages/sn-controls-react/src/fieldcontrols/dropdown-list.tsx +++ b/packages/sn-controls-react/src/fieldcontrols/dropdown-list.tsx @@ -56,7 +56,10 @@ export const DropDownList: React.FC> case 'edit': case 'new': return ( - + {props.settings.DisplayName}