fix: cell background for edit actions column in Table v2 (#15233)

This commit is contained in:
balajisoundar 2022-07-20 11:42:59 +05:30 committed by GitHub
parent 6eaabc3a7b
commit 71e581d69b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 29 deletions

View File

@ -21,6 +21,7 @@
"children": [ "children": [
{ {
"widgetName": "Table1", "widgetName": "Table1",
"inlineEditingSaveOption": "ROW_LEVEL",
"columnOrder": [ "columnOrder": [
"id", "id",
"email", "email",

View File

@ -1,9 +1,12 @@
const ObjectsRegistry = require("../../../../../support/Objects/Registry")
.ObjectsRegistry;
let propPane = ObjectsRegistry.PropertyPane;
const widgetsPage = require("../../../../../locators/Widgets.json"); const widgetsPage = require("../../../../../locators/Widgets.json");
const dsl = require("../../../../../fixtures/tableV2NewDsl.json"); const dsl = require("../../../../../fixtures/tableV2NewDsl.json");
const publish = require("../../../../../locators/publishWidgetspage.json"); const publish = require("../../../../../locators/publishWidgetspage.json");
describe("Table Widget V2 property pane feature validation", function() { describe("Table Widget V2 property pane feature validation", function() {
before(() => { beforeEach(() => {
cy.addDsl(dsl); cy.addDsl(dsl);
}); });
@ -65,4 +68,18 @@ describe("Table Widget V2 property pane feature validation", function() {
); );
cy.get(publish.backToEditor).click(); cy.get(publish.backToEditor).click();
}); });
it("2. check background of the edit action column", function() {
cy.openPropertyPane("tablewidgetv2");
cy.makeColumnEditable("id");
cy.readTableV2dataValidateCSS(0, 5, "background-color", "rgba(0, 0, 0, 0)");
cy.get(".t--property-control-cellbackgroundcolor")
.find(".t--js-toggle")
.click();
propPane.UpdatePropertyFieldValue(
"Cell Background Color",
"rgb(255, 0, 0)",
);
cy.readTableV2dataValidateCSS(0, 5, "background-color", "rgb(255, 0, 0)");
});
}); });

View File

@ -102,26 +102,31 @@ function DraggableList(props: any) {
}, [items]); }, [items]);
useEffect(() => { useEffect(() => {
if (focusedIndex && listRef && listRef.current) { /*
const container = listRef.current; * we need to wait for the ui to get rendered before scrolling to the focusedColumn
*/
requestAnimationFrame(() => {
if (focusedIndex && listRef && listRef.current) {
const container = listRef.current;
if (focusedIndex * itemHeight < container.scrollTop) { if (focusedIndex * itemHeight < container.scrollTop) {
listRef.current.scrollTo({ listRef.current.scrollTo({
top: (focusedIndex - 1) * itemHeight, top: (focusedIndex - 1) * itemHeight,
left: 0, left: 0,
behavior: "smooth", behavior: "smooth",
}); });
} else if ( } else if (
(focusedIndex + 1) * itemHeight > (focusedIndex + 1) * itemHeight >
listRef.current.scrollTop + listRef.current.clientHeight listRef.current.scrollTop + listRef.current.clientHeight
) { ) {
listRef.current.scrollTo({ listRef.current.scrollTo({
top: (focusedIndex + 1) * itemHeight - listRef.current.clientHeight, top: (focusedIndex + 1) * itemHeight - listRef.current.clientHeight,
left: 0, left: 0,
behavior: "smooth", behavior: "smooth",
}); });
}
} }
} });
}, [focusedIndex]); }, [focusedIndex]);
const [springs, setSprings] = useSprings<any>( const [springs, setSprings] = useSprings<any>(

View File

@ -94,7 +94,7 @@ type State = {
hasScrollableList: boolean; hasScrollableList: boolean;
}; };
const LIST_CLASSNAME = "tablewidget-primarycolumn-list"; const LIST_CLASSNAME = "tablewidgetv2-primarycolumn-list";
class PrimaryColumnsControlV2 extends BaseControl<ControlProps, State> { class PrimaryColumnsControlV2 extends BaseControl<ControlProps, State> {
constructor(props: ControlProps) { constructor(props: ControlProps) {
super(props); super(props);

View File

@ -69,11 +69,21 @@ function* getEntityNames() {
* @returns * @returns
*/ */
function* getThemeDefaultConfig(type: string) { function* getThemeDefaultConfig(type: string) {
const fallbackStylesheet: Record<string, string> = {
TABLE_WIDGET_V2: "TABLE_WIDGET",
};
const stylesheet: Record<string, unknown> = yield select( const stylesheet: Record<string, unknown> = yield select(
getSelectedAppThemeStylesheet, getSelectedAppThemeStylesheet,
); );
return stylesheet[type] || themePropertiesDefaults; if (stylesheet[type]) {
return stylesheet[type];
} else if (fallbackStylesheet[type] && stylesheet[fallbackStylesheet[type]]) {
return stylesheet[fallbackStylesheet[type]];
} else {
return themePropertiesDefaults;
}
} }
function* getChildWidgetProps( function* getChildWidgetProps(

View File

@ -58,6 +58,8 @@ export function EditActionCell(props: RenderEditActionsProps) {
return ( return (
<CellWrapper <CellWrapper
allowCellWrapping={allowCellWrapping} allowCellWrapping={allowCellWrapping}
cellBackground={cellBackground}
className="cell-wrapper"
compactMode={compactMode} compactMode={compactMode}
horizontalAlignment={horizontalAlignment} horizontalAlignment={horizontalAlignment}
isCellVisible={isCellVisible} isCellVisible={isCellVisible}

View File

@ -8,13 +8,7 @@ export default {
return hideByColumnType( return hideByColumnType(
props, props,
propertyPath, propertyPath,
[ [ColumnTypes.TEXT, ColumnTypes.DATE, ColumnTypes.NUMBER, ColumnTypes.URL],
ColumnTypes.TEXT,
ColumnTypes.DATE,
ColumnTypes.NUMBER,
ColumnTypes.URL,
ColumnTypes.EDIT_ACTIONS,
],
true, true,
); );
}, },
@ -59,7 +53,6 @@ export default {
ColumnTypes.DATE, ColumnTypes.DATE,
ColumnTypes.NUMBER, ColumnTypes.NUMBER,
ColumnTypes.URL, ColumnTypes.URL,
ColumnTypes.EDIT_ACTIONS,
]); ]);
}, },
}, },