You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by en...@apache.org on 2026/08/27 13:13:16 UTC
(superset) 25/46: fix(dashboard-v2): stop flattening a bounded number's slider onto two lines
This is an automated email from the ASF dual-hosted git repository.
EnxDev pushed a commit to branch enxdev/poc/dashboard-v2-editing-ui-flow
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 9a1200efebf66c5365ce7c3ae3a008080e4d05ea
Author: Enzo Martellucci <en...@gmail.com>
AuthorDate: Wed Aug 26 15:47:42 2026 +0200
fix(dashboard-v2): stop flattening a bounded number's slider onto two lines
FormShell's one-column rule was meant for an array entry's own fields (a
grid built for a page, wrong axis for a rail) but matched every Row/Col
pair inside any Form.Item's control — including a bounded number's own
Slider-beside-its-figure layout, forcing "Decimal places" and friends
onto two full-width lines instead of one compact one. Scoped the rule to
`.ant-list-item` (an actual array entry) so a lone bounded field keeps its
intended layout.
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
.../pages/DashboardBuilderV2/PropsForm.test.tsx | 51 ++++++++++++++++++++++
.../src/pages/DashboardBuilderV2/PropsForm.tsx | 27 +++++++-----
2 files changed, 67 insertions(+), 11 deletions(-)
diff --git a/superset-frontend/src/pages/DashboardBuilderV2/PropsForm.test.tsx b/superset-frontend/src/pages/DashboardBuilderV2/PropsForm.test.tsx
new file mode 100644
index 00000000000..a8713e4ddd7
--- /dev/null
+++ b/superset-frontend/src/pages/DashboardBuilderV2/PropsForm.test.tsx
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { render } from 'spec/helpers/testing-library';
+import { JsonForms } from '@jsonforms/react';
+import { cellRegistryEntries } from '@great-expectations/jsonforms-antd-renderers';
+import { renderers } from 'src/features/semanticLayers/jsonFormsHelpers';
+import { FormShell } from './PropsForm';
+
+test('a bounded number keeps its slider and figure on one line', () => {
+ render(
+ <FormShell className="ant-form ant-form-vertical">
+ <JsonForms
+ schema={{
+ type: 'object',
+ properties: {
+ decimalPlaces: { type: 'number', minimum: 0, maximum: 5 },
+ },
+ }}
+ data={{ decimalPlaces: 0 }}
+ renderers={renderers}
+ cells={cellRegistryEntries}
+ validationMode="NoValidation"
+ onChange={() => {}}
+ />
+ </FormShell>,
+ );
+
+ // The one-column rule is aimed at an array entry's own fields (see
+ // `FormShell`'s doc comment) — a lone bounded number's Slider/figure pair
+ // must not be caught by it and forced onto two full-width lines.
+ const row = document.querySelector(
+ '.ant-row:not(.ant-form-item-row)',
+ ) as HTMLElement;
+ expect(row).not.toHaveStyle({ flexDirection: 'column' });
+});
diff --git a/superset-frontend/src/pages/DashboardBuilderV2/PropsForm.tsx b/superset-frontend/src/pages/DashboardBuilderV2/PropsForm.tsx
index be6dce46192..787645b6265 100644
--- a/superset-frontend/src/pages/DashboardBuilderV2/PropsForm.tsx
+++ b/superset-frontend/src/pages/DashboardBuilderV2/PropsForm.tsx
@@ -72,23 +72,28 @@ export const FormShell = styled.div`
color: ${theme.colorText};
}
- /* One column, one width.
+ /* One column, one width — but only for an array entry's own fields.
- An array's entries are handed to a grid meant for a page — two to a
- line, so a dimension came out half the width of the field above it. In a
- rail there is no second column to put anything in, so the grid is turned
- down its own axis and every cell given the width. The form item's own
- label/control row is left alone: it is already a column in this layout,
- and it is not a grid of entries. */
- .ant-form-item-control-input-content .ant-row:not(.ant-form-item-row) {
+ An array entry's fields are handed to a grid meant for a page — two to
+ a line, so a dimension came out half the width of the field above it.
+ In a rail there is no second column to put anything in, so the grid is
+ turned down its own axis and every cell given the width.
+
+ Scoped to \`.ant-list-item\` (an entry) rather than to every Form.Item's
+ control, because a scalar field can carry the identical Row/Col pair
+ for a reason that has nothing to do with a page-width grid — a bounded
+ number renders as a slider beside the figure it reads, and forcing
+ that onto two full-width lines was this rule catching a control it was
+ never aimed at. The form item's own label/control row is left alone
+ either way: it is already a column in this layout, not a grid of
+ entries. */
+ .ant-list-item .ant-row:not(.ant-form-item-row) {
flex-direction: column;
align-items: stretch;
}
.ant-form-item-control-input-content > .ant-col,
- .ant-form-item-control-input-content
- .ant-row:not(.ant-form-item-row)
- > .ant-col {
+ .ant-list-item .ant-row:not(.ant-form-item-row) > .ant-col {
flex: 1 1 auto;
min-width: 0;
width: 100%;