Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9e6417d
feat: show infinite scroll only when serverSidePagination is enabled
jacquesikot Mar 26, 2025
86bd4b0
feat: Add disabled state and disabled help text for property sections…
jacquesikot Mar 26, 2025
52dfadf
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/a…
jacquesikot Mar 26, 2025
6132745
Revert "feat: show infinite scroll only when serverSidePagination is …
jacquesikot Mar 26, 2025
19c3620
refactor: Simplify PropertyControl component structure
jacquesikot Mar 26, 2025
7a3e6cc
test: add tests for disabled and disabledHelpText implementation
jacquesikot Mar 26, 2025
845406a
fix: disabled prop type mismatch between PropertyPaneControlConfig an…
jacquesikot Mar 26, 2025
5a57c17
refactor: Update imports and context usage in property controls to fi…
jacquesikot Mar 26, 2025
b1adca0
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/a…
jacquesikot Mar 27, 2025
d8cba00
refactor: Clean up formatting and improve readability in property con…
jacquesikot Mar 27, 2025
14db8bb
refactor: Update imports in PropertySection component
jacquesikot Mar 27, 2025
3536352
fix: lint error
jacquesikot Mar 27, 2025
2a75ea6
fix: lint error
jacquesikot Mar 27, 2025
864f329
refactor: Rename isReadOnly to isControlDisabled and update type defi…
jacquesikot Mar 31, 2025
007a525
refactor: Update type definitions for hidden and disabled properties …
jacquesikot Mar 31, 2025
5a68737
refactor: Update type definitions for hidden and disabled properties …
jacquesikot Mar 31, 2025
f79ccfd
refactor: Update type definitions for hidden and disabled properties …
jacquesikot Mar 31, 2025
d4f7b64
refactor: Update type definitions for hidden and disabled properties …
jacquesikot Mar 31, 2025
aa2b8fc
refactor: Update hidden and disabled property type definitions in Pro…
jacquesikot Mar 31, 2025
2164882
refactor: Reorganize imports in PropertyControl component
jacquesikot Mar 31, 2025
17a09a3
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/a…
jacquesikot Apr 1, 2025
7b5cd76
refactor: rename disabled property to shouldDisableSection in propert…
jacquesikot Apr 1, 2025
efa3347
refactor: remove disabled properties from pagination section in Table…
jacquesikot Apr 1, 2025
1e656cf
refactor: sort props alphabetically
jacquesikot Apr 1, 2025
08429fe
refactor: reorder props in CodeEditorControl component
jacquesikot Apr 1, 2025
285d46d
refactor: remove unused marking prop from CodeEditorControl component
jacquesikot Apr 1, 2025
65dd825
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/d…
jacquesikot Apr 1, 2025
84928e2
feat: hide add new row
jacquesikot Apr 1, 2025
302e330
feat: disable table edit mode
jacquesikot Apr 1, 2025
18c1a49
feat: add search, sort, and filter management for infinite scroll
jacquesikot Apr 1, 2025
83f1e5e
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/d…
jacquesikot Apr 1, 2025
f7bbdbc
test: add tests for changes
jacquesikot Apr 1, 2025
90fabf9
refactor: fix lint errors
jacquesikot Apr 1, 2025
ad050e9
refactor: fix lint errors
jacquesikot Apr 2, 2025
f9f43ea
fix: missing propertyUtil tests
jacquesikot Apr 2, 2025
da4395b
fix: correct logic for disabling sort functionality in HeaderCell com…
jacquesikot Apr 2, 2025
89df4d6
fix: update logic for disabling sort functionality in HeaderCell comp…
jacquesikot Apr 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ const HeaderCellComponent = (props: HeaderProps) => {
canFreezeColumn,
editMode,
handleColumnFreeze,
isInfiniteScrollEnabled,
isResizingColumn,
isSortable,
multiRowSelection,
Expand Down Expand Up @@ -193,7 +194,8 @@ const HeaderCellComponent = (props: HeaderProps) => {
sortTableColumn(columnIndex, sortOrder);
};

const disableSort = editMode === false && isSortable === false;
const disableSort =
isInfiniteScrollEnabled || (editMode === false && isSortable === false);

const isColumnEditable =
props.column.columnProperties.isCellEditable &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { updateAllowAddNewRowOnInfiniteScrollChange } from "../propertyUtils";
import {
totalRecordsCountValidation,
uniqueColumnNameValidation,
Expand All @@ -9,6 +10,8 @@ import {
updateCustomColumnAliasOnLabelChange,
selectColumnOptionsValidation,
allowedFirstDayOfWeekRange,
updateCellEditabilityOnInfiniteScrollChange,
updateSearchSortFilterOnInfiniteScrollChange,
} from "../propertyUtils";
import _ from "lodash";
import type { ColumnTypes, TableWidgetProps } from "../../constants";
Expand Down Expand Up @@ -1049,3 +1052,195 @@ describe("allowedFirstDayOfWeekRange", () => {
});
});
});

describe("Infinite Scroll Update Hooks - ", () => {
it("updateAllowAddNewRowOnInfiniteScrollChange - should disable/enable add new row when infinite scroll is toggled", () => {
const props = {} as TableWidgetProps;

// When infinite scroll is enabled
expect(
updateAllowAddNewRowOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
true,
),
).toEqual([
{
propertyPath: "allowAddNewRow",
propertyValue: false,
},
]);

// When infinite scroll is disabled
expect(
updateAllowAddNewRowOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
false,
),
).toEqual([
{
propertyPath: "allowAddNewRow",
propertyValue: true,
},
]);

// When some other value is passed
expect(
updateAllowAddNewRowOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
"some-other-value",
),
).toBeUndefined();
});

it("updateSearchSortFilterOnInfiniteScrollChange - should disable/enable search, filter, sort when infinite scroll is toggled", () => {
const props = {} as TableWidgetProps;

// When infinite scroll is enabled
expect(
updateSearchSortFilterOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
true,
),
).toEqual([
{
propertyPath: "isVisibleSearch",
propertyValue: false,
},
{
propertyPath: "isVisibleFilters",
propertyValue: false,
},
{
propertyPath: "isSortable",
propertyValue: false,
},
]);

// When infinite scroll is disabled
expect(
updateSearchSortFilterOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
false,
),
).toEqual([
{
propertyPath: "isVisibleFilters",
propertyValue: true,
},
{
propertyPath: "isVisibleSearch",
propertyValue: true,
},
{
propertyPath: "isSortable",
propertyValue: true,
},
]);

// When some other value is passed
expect(
updateSearchSortFilterOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
"some-other-value",
),
).toBeUndefined();
});

it("updateCellEditabilityOnInfiniteScrollChange - should disable cell editability when infinite scroll is enabled", () => {
// Setup mock primary columns
const props = {
primaryColumns: {
column1: {
id: "column1",
alias: "column1",
isEditable: true,
isCellEditable: true,
},
column2: {
id: "column2",
alias: "column2",
isEditable: true,
isCellEditable: true,
},
},
} as unknown as TableWidgetProps;

// When infinite scroll is enabled
expect(
updateCellEditabilityOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
true,
),
).toEqual([
{
propertyPath: "primaryColumns.column1.isCellEditable",
propertyValue: false,
},
{
propertyPath: "primaryColumns.column1.isEditable",
propertyValue: false,
},
{
propertyPath: "primaryColumns.column2.isCellEditable",
propertyValue: false,
},
{
propertyPath: "primaryColumns.column2.isEditable",
propertyValue: false,
},
]);

// When infinite scroll is disabled
expect(
updateCellEditabilityOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
false,
),
).toEqual([
{
propertyPath: "primaryColumns.column1.isCellEditable",
propertyValue: true,
},
{
propertyPath: "primaryColumns.column1.isEditable",
propertyValue: true,
},
{
propertyPath: "primaryColumns.column2.isCellEditable",
propertyValue: true,
},
{
propertyPath: "primaryColumns.column2.isEditable",
propertyValue: true,
},
]);

// Test with no primary columns
const propsWithoutColumns = {} as TableWidgetProps;

expect(
updateCellEditabilityOnInfiniteScrollChange(
propsWithoutColumns,
"infiniteScrollEnabled",
true,
),
).toBeUndefined();

// When some other value is passed
expect(
updateCellEditabilityOnInfiniteScrollChange(
props,
"infiniteScrollEnabled",
"some-other-value",
),
).toBeUndefined();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import contentConfig from "../contentConfig";
import type { TableWidgetProps } from "../../../constants";
import type { PropertyPaneSectionConfig } from "constants/PropertyControlConstants";

describe("TableWidgetV2 contentConfig tests", () => {
it("should disable relevant sections when infinite scroll is enabled", () => {
const sectionsToCheck = ["Search & filters", "Sorting", "Adding a row"];

const disabledHelpText =
"This feature is disabled because infinite scroll is enabled";

sectionsToCheck.forEach((sectionName) => {
const section = contentConfig.find(
(section) =>
(section as PropertyPaneSectionConfig).sectionName === sectionName,
) as PropertyPaneSectionConfig & { dependencies: string[] };

expect(section).toBeDefined();

if (section) {
expect(typeof section.shouldDisableSection).toBe("function");
expect(section.disabledHelpText).toBe(disabledHelpText);
expect(section.dependencies).toContain("infiniteScrollEnabled");

const enabledProps = {
infiniteScrollEnabled: true,
} as TableWidgetProps;
const disabledProps = {
infiniteScrollEnabled: false,
} as TableWidgetProps;

expect(section.shouldDisableSection!(enabledProps, "")).toBe(true);
expect(section.shouldDisableSection!(disabledProps, "")).toBe(false);
}
});

const paginationSection = contentConfig.find(
(section) =>
(section as PropertyPaneSectionConfig).sectionName === "Pagination",
) as PropertyPaneSectionConfig;

expect(paginationSection).toBeDefined();

if (paginationSection && paginationSection.children) {
const serverSidePagination = paginationSection.children.find(
(child) =>
(child as PropertyPaneSectionConfig & { propertyName: string })
.propertyName === "serverSidePaginationEnabled",
) as PropertyPaneSectionConfig & {
propertyName: string;
shouldDisableSection: (
props: TableWidgetProps,
propertyPath: string,
) => boolean;
disabledHelpText: string;
dependencies: string[];
};

expect(serverSidePagination).toBeDefined();

if (serverSidePagination) {
expect(typeof serverSidePagination.shouldDisableSection).toBe(
"function",
);
expect(serverSidePagination.disabledHelpText).toBe(disabledHelpText);
expect(serverSidePagination.dependencies).toContain(
"infiniteScrollEnabled",
);

const enabledProps = {
infiniteScrollEnabled: true,
} as TableWidgetProps;
const disabledProps = {
infiniteScrollEnabled: false,
} as TableWidgetProps;

expect(
serverSidePagination.shouldDisableSection(enabledProps, ""),
).toBe(true);
expect(
serverSidePagination.shouldDisableSection(disabledProps, ""),
).toBe(false);
}
}
});

it("should have proper update hooks for infiniteScrollEnabled property", () => {
const paginationSection = contentConfig.find(
(section) =>
(section as PropertyPaneSectionConfig).sectionName === "Pagination",
) as PropertyPaneSectionConfig;

expect(paginationSection).toBeDefined();

if (paginationSection && paginationSection.children) {
const infiniteScrollProperty = paginationSection.children.find(
(child) =>
(child as PropertyPaneSectionConfig & { propertyName: string })
.propertyName === "infiniteScrollEnabled",
) as PropertyPaneSectionConfig & {
propertyName: string;
updateHook: unknown;
dependencies: string[];
};

expect(infiniteScrollProperty).toBeDefined();

if (infiniteScrollProperty) {
expect(infiniteScrollProperty.updateHook).toBeDefined();
expect(infiniteScrollProperty.dependencies).toContain("primaryColumns");
}
}
});
});
Loading
Loading