Merge branch 'release-frozen' into release
This commit is contained in:
commit
a42e89a8a2
|
|
@ -11,10 +11,7 @@ describe("Test Create Api and Bind to Table widget", function() {
|
|||
|
||||
it("Test_Add Paginate with Table Page No and Execute the Api", function() {
|
||||
/**Create an Api1 of Paginate with Table Page No */
|
||||
cy.createAndFillApi(
|
||||
this.data.paginationUrl,
|
||||
"users?page={{Table1.pageNo}}&pageSize={{Table1.defaultPageSize||10}}",
|
||||
);
|
||||
cy.createAndFillApi(this.data.paginationUrl, this.data.paginationParam);
|
||||
cy.RunAPI();
|
||||
});
|
||||
|
||||
|
|
@ -89,46 +86,5 @@ describe("Test Create Api and Bind to Table widget", function() {
|
|||
cy.ValidatePaginationInputData();
|
||||
cy.get(publishPage.backToEditor).click({ force: true });
|
||||
cy.ValidatePaginateResponseUrlData(apiPage.apiPaginationNextTest);
|
||||
cy.wait(5000);
|
||||
});
|
||||
|
||||
it("Table-Text, Validate Server Side Pagination of Paginate with Table Default Page Size and Total Record Count", function() {
|
||||
cy.SearchEntityandOpen("Table1");
|
||||
cy.callApi("Api1");
|
||||
cy.wait(300);
|
||||
cy.testJsontext("tabledata", "{{Api1.data.users}}");
|
||||
cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox);
|
||||
cy.wait(300);
|
||||
//Add on page size change action
|
||||
cy.get(commonlocators.tablePageSizeChangeAction).click({
|
||||
force: true,
|
||||
});
|
||||
cy.wait(300);
|
||||
cy.get(commonlocators.chooseAction)
|
||||
.children()
|
||||
.contains("Call An API")
|
||||
.click();
|
||||
cy.wait(300);
|
||||
cy.get(commonlocators.chooseAction)
|
||||
.children()
|
||||
.contains("Api1")
|
||||
.click();
|
||||
// cy.get(".t--table-widget-next-page").should("have.attr", "disabled");
|
||||
|
||||
// Add value of default page count and total page count
|
||||
cy.testJsontext("totalrecordcount", 20);
|
||||
cy.testJsontext("defaultpagesize", 5);
|
||||
|
||||
cy.wait("@postExecute");
|
||||
cy.wait(500);
|
||||
|
||||
cy.get(".t--table-widget-next-page").should("not.have.attr", "disabled");
|
||||
cy.ValidateTableData("1");
|
||||
|
||||
cy.get(commonlocators.tableNextPage).click({ force: true });
|
||||
cy.wait("@postExecute");
|
||||
cy.wait(500);
|
||||
|
||||
cy.ValidateTableData("6");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe("Test Suite to validate copy/paste table Widget", function() {
|
|||
.last()
|
||||
.click();
|
||||
cy.get(apiwidget.propertyList).then(function($lis) {
|
||||
expect($lis).to.have.length(10);
|
||||
expect($lis).to.have.length(8);
|
||||
expect($lis.eq(0)).to.contain("{{Table1Copy.selectedRow}}");
|
||||
expect($lis.eq(1)).to.contain("{{Table1Copy.selectedRows}}");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ describe("Entity explorer tests related to widgets and validation", function() {
|
|||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.propertyList).then(function($lis) {
|
||||
expect($lis).to.have.length(10);
|
||||
expect($lis).to.have.length(8);
|
||||
expect($lis.eq(0)).to.contain("{{Table1.selectedRow}}");
|
||||
expect($lis.eq(1)).to.contain("{{Table1.selectedRows}}");
|
||||
expect($lis.eq(2)).to.contain("{{Table1.selectedRowIndex}}");
|
||||
|
|
@ -47,8 +47,6 @@ describe("Entity explorer tests related to widgets and validation", function() {
|
|||
expect($lis.eq(5)).to.contain("{{Table1.pageSize}}");
|
||||
expect($lis.eq(6)).to.contain("{{Table1.isVisible}}");
|
||||
expect($lis.eq(7)).to.contain("{{Table1.searchText}}");
|
||||
expect($lis.eq(8)).to.contain("{{Table1.defaultPageSize}}");
|
||||
expect($lis.eq(9)).to.contain("{{Table1.totalRecordsCount}}");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,5 @@
|
|||
"paginationButton": ".rc-pagination-item",
|
||||
"switchWidgetActive": ".t--switch-widget-active",
|
||||
"switchWidgetInActive": ".t--switch-widget-inactive",
|
||||
"switchWidgetLoading": ".t--switch-widget-loading",
|
||||
"tablePageSizeChangeAction": ".t--property-control-onpagesizechange .t--open-dropdown-Select-Action"
|
||||
"switchWidgetLoading": ".t--switch-widget-loading"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ interface TableProps {
|
|||
width: number;
|
||||
height: number;
|
||||
pageSize: number;
|
||||
tablePageSize: number;
|
||||
widgetId: string;
|
||||
widgetName: string;
|
||||
searchKey: string;
|
||||
|
|
@ -39,8 +38,6 @@ interface TableProps {
|
|||
columnSizeMap?: { [key: string]: number };
|
||||
columns: ReactTableColumnProps[];
|
||||
data: Array<Record<string, unknown>>;
|
||||
defaultPageSize?: number;
|
||||
totalRecordsCount?: number;
|
||||
editMode: boolean;
|
||||
sortTableColumn: (columnIndex: number, asc: boolean) => void;
|
||||
handleResizeColumn: (columnSizeMap: { [key: string]: number }) => void;
|
||||
|
|
@ -116,10 +113,7 @@ export function Table(props: TableProps) {
|
|||
}),
|
||||
[columnString],
|
||||
);
|
||||
const pageCount =
|
||||
props.defaultPageSize && props.totalRecordsCount
|
||||
? Math.ceil(props.totalRecordsCount / props.defaultPageSize)
|
||||
: Math.ceil(props.data.length / props.pageSize);
|
||||
const pageCount = Math.ceil(props.data.length / props.pageSize);
|
||||
const currentPageIndex = props.pageNo < pageCount ? props.pageNo : 0;
|
||||
const {
|
||||
getTableBodyProps,
|
||||
|
|
@ -161,10 +155,7 @@ export function Table(props: TableProps) {
|
|||
}
|
||||
let startIndex = currentPageIndex * props.pageSize;
|
||||
let endIndex = startIndex + props.pageSize;
|
||||
if (
|
||||
props.serverSidePaginationEnabled ||
|
||||
(props.defaultPageSize && props.totalRecordsCount)
|
||||
) {
|
||||
if (props.serverSidePaginationEnabled) {
|
||||
startIndex = 0;
|
||||
endIndex = props.data.length;
|
||||
}
|
||||
|
|
@ -216,7 +207,6 @@ export function Table(props: TableProps) {
|
|||
columns={tableHeadercolumns}
|
||||
compactMode={props.compactMode}
|
||||
currentPageIndex={currentPageIndex}
|
||||
defaultPageSize={props.defaultPageSize}
|
||||
editMode={props.editMode}
|
||||
filters={props.filters}
|
||||
isVisibleCompactMode={props.isVisibleCompactMode}
|
||||
|
|
@ -235,7 +225,6 @@ export function Table(props: TableProps) {
|
|||
tableColumns={columns}
|
||||
tableData={props.data}
|
||||
tableSizes={tableSizes}
|
||||
totalRecordsCount={props.totalRecordsCount}
|
||||
updateCompactMode={props.updateCompactMode}
|
||||
updatePageNo={props.updatePageNo}
|
||||
widgetName={props.widgetName}
|
||||
|
|
@ -297,7 +286,7 @@ export function Table(props: TableProps) {
|
|||
<div
|
||||
{...getTableBodyProps()}
|
||||
className={`tbody ${
|
||||
props.tablePageSize > subPage.length ? "no-scroll" : ""
|
||||
props.pageSize > subPage.length ? "no-scroll" : ""
|
||||
}`}
|
||||
ref={tableBodyRef}
|
||||
>
|
||||
|
|
@ -338,9 +327,9 @@ export function Table(props: TableProps) {
|
|||
</div>
|
||||
);
|
||||
})}
|
||||
{props.tablePageSize > subPage.length &&
|
||||
{props.pageSize > subPage.length &&
|
||||
renderEmptyRows(
|
||||
props.tablePageSize - subPage.length,
|
||||
props.pageSize - subPage.length,
|
||||
props.columns,
|
||||
props.width,
|
||||
subPage,
|
||||
|
|
|
|||
|
|
@ -93,8 +93,6 @@ interface TableHeaderProps {
|
|||
nextPageClick: () => void;
|
||||
prevPageClick: () => void;
|
||||
pageNo: number;
|
||||
defaultPageSize?: number;
|
||||
totalRecordsCount?: number;
|
||||
tableData: Array<Record<string, unknown>>;
|
||||
tableColumns: ReactTableColumnProps[];
|
||||
pageCount: number;
|
||||
|
|
@ -163,7 +161,7 @@ function TableHeader(props: TableHeaderProps) {
|
|||
<PaginationWrapper>
|
||||
<PaginationItemWrapper
|
||||
className="t--table-widget-prev-page"
|
||||
disabled={props.pageNo === 0}
|
||||
disabled={false}
|
||||
onClick={() => {
|
||||
props.prevPageClick();
|
||||
}}
|
||||
|
|
@ -175,7 +173,7 @@ function TableHeader(props: TableHeaderProps) {
|
|||
</PaginationItemWrapper>
|
||||
<PaginationItemWrapper
|
||||
className="t--table-widget-next-page"
|
||||
disabled={props.pageNo === props.pageCount - 1}
|
||||
disabled={false}
|
||||
onClick={() => {
|
||||
props.nextPageClick();
|
||||
}}
|
||||
|
|
@ -187,10 +185,7 @@ function TableHeader(props: TableHeaderProps) {
|
|||
{props.isVisiblePagination && !props.serverSidePaginationEnabled && (
|
||||
<PaginationWrapper>
|
||||
<RowWrapper className="show-page-items">
|
||||
{props.totalRecordsCount
|
||||
? props.totalRecordsCount
|
||||
: props.tableData?.length}{" "}
|
||||
Records
|
||||
{props.tableData?.length} Records
|
||||
</RowWrapper>
|
||||
<PaginationItemWrapper
|
||||
className="t--table-widget-prev-page"
|
||||
|
|
|
|||
|
|
@ -42,9 +42,6 @@ interface ReactTableComponentProps {
|
|||
width: number;
|
||||
height: number;
|
||||
pageSize: number;
|
||||
tablePageSize: number;
|
||||
defaultPageSize?: number;
|
||||
totalRecordsCount?: number;
|
||||
tableData: Array<Record<string, unknown>>;
|
||||
disableDrag: (disable: boolean) => void;
|
||||
onRowClick: (rowData: Record<string, unknown>, rowIndex: number) => void;
|
||||
|
|
@ -82,7 +79,6 @@ function ReactTableComponent(props: ReactTableComponentProps) {
|
|||
columns,
|
||||
columnSizeMap,
|
||||
compactMode,
|
||||
defaultPageSize,
|
||||
disableDrag,
|
||||
editMode,
|
||||
filters,
|
||||
|
|
@ -107,8 +103,6 @@ function ReactTableComponent(props: ReactTableComponentProps) {
|
|||
serverSidePaginationEnabled,
|
||||
sortTableColumn: _sortTableColumn,
|
||||
tableData,
|
||||
tablePageSize,
|
||||
totalRecordsCount,
|
||||
triggerRowSelection,
|
||||
updateCompactMode,
|
||||
updatePageNo,
|
||||
|
|
@ -235,7 +229,6 @@ function ReactTableComponent(props: ReactTableComponentProps) {
|
|||
columns={columns}
|
||||
compactMode={compactMode}
|
||||
data={tableData}
|
||||
defaultPageSize={defaultPageSize}
|
||||
disableDrag={() => {
|
||||
disableDrag(true);
|
||||
}}
|
||||
|
|
@ -263,8 +256,6 @@ function ReactTableComponent(props: ReactTableComponentProps) {
|
|||
selectedRowIndices={selectedRowIndices}
|
||||
serverSidePaginationEnabled={serverSidePaginationEnabled}
|
||||
sortTableColumn={sortTableColumn}
|
||||
tablePageSize={tablePageSize}
|
||||
totalRecordsCount={totalRecordsCount}
|
||||
triggerRowSelection={triggerRowSelection}
|
||||
updateCompactMode={updateCompactMode}
|
||||
updatePageNo={updatePageNo}
|
||||
|
|
@ -279,7 +270,6 @@ export default React.memo(ReactTableComponent, (prev, next) => {
|
|||
return (
|
||||
prev.applyFilter === next.applyFilter &&
|
||||
prev.compactMode === next.compactMode &&
|
||||
prev.defaultPageSize === next.defaultPageSize &&
|
||||
prev.disableDrag === next.disableDrag &&
|
||||
prev.editMode === next.editMode &&
|
||||
prev.filters === next.filters &&
|
||||
|
|
@ -296,7 +286,6 @@ export default React.memo(ReactTableComponent, (prev, next) => {
|
|||
prev.onRowClick === next.onRowClick &&
|
||||
prev.pageNo === next.pageNo &&
|
||||
prev.pageSize === next.pageSize &&
|
||||
prev.tablePageSize === next.tablePageSize &&
|
||||
prev.prevPageClick === next.prevPageClick &&
|
||||
prev.searchKey === next.searchKey &&
|
||||
prev.searchTableData === next.searchTableData &&
|
||||
|
|
@ -304,7 +293,6 @@ export default React.memo(ReactTableComponent, (prev, next) => {
|
|||
prev.selectedRowIndices === next.selectedRowIndices &&
|
||||
prev.serverSidePaginationEnabled === next.serverSidePaginationEnabled &&
|
||||
prev.sortTableColumn === next.sortTableColumn &&
|
||||
prev.totalRecordsCount === next.totalRecordsCount &&
|
||||
prev.triggerRowSelection === next.triggerRowSelection &&
|
||||
prev.updateCompactMode === next.updateCompactMode &&
|
||||
prev.updatePageNo === next.updatePageNo &&
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ describe("getAllPathsFromPropertyConfig", () => {
|
|||
selectedRow: EvaluationSubstitutionType.TEMPLATE,
|
||||
selectedRows: EvaluationSubstitutionType.TEMPLATE,
|
||||
tableData: EvaluationSubstitutionType.SMART_SUBSTITUTE,
|
||||
defaultPageSize: EvaluationSubstitutionType.TEMPLATE,
|
||||
defaultSearchText: EvaluationSubstitutionType.TEMPLATE,
|
||||
defaultSelectedRow: EvaluationSubstitutionType.TEMPLATE,
|
||||
isVisible: EvaluationSubstitutionType.TEMPLATE,
|
||||
|
|
@ -155,7 +154,6 @@ describe("getAllPathsFromPropertyConfig", () => {
|
|||
EvaluationSubstitutionType.TEMPLATE,
|
||||
"primaryColumns.status.buttonLabelColor":
|
||||
EvaluationSubstitutionType.TEMPLATE,
|
||||
totalRecordsCount: EvaluationSubstitutionType.TEMPLATE,
|
||||
},
|
||||
triggerPaths: {
|
||||
onRowSelected: true,
|
||||
|
|
@ -165,12 +163,10 @@ describe("getAllPathsFromPropertyConfig", () => {
|
|||
"primaryColumns.status.onClick": true,
|
||||
},
|
||||
validationPaths: {
|
||||
defaultPageSize: "NUMBER",
|
||||
defaultSearchText: "TEXT",
|
||||
defaultSelectedRow: "DEFAULT_SELECTED_ROW",
|
||||
isVisible: "BOOLEAN",
|
||||
tableData: "TABLE_DATA",
|
||||
totalRecordsCount: "NUMBER",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ export const entityDefinitions = {
|
|||
pageSize: "number",
|
||||
isVisible: isVisible,
|
||||
searchText: "string",
|
||||
defaultPageSize: "number",
|
||||
totalRecordsCount: "number",
|
||||
}),
|
||||
VIDEO_WIDGET: {
|
||||
"!doc":
|
||||
|
|
|
|||
|
|
@ -663,24 +663,6 @@ export default [
|
|||
isTriggerProperty: false,
|
||||
validation: VALIDATION_TYPES.TEXT,
|
||||
},
|
||||
{
|
||||
propertyName: "totalRecordsCount",
|
||||
label: "Total Record Count",
|
||||
controlType: "INPUT_TEXT",
|
||||
placeholderText: "Enter total record count",
|
||||
isBindProperty: true,
|
||||
isTriggerProperty: false,
|
||||
validation: VALIDATION_TYPES.NUMBER,
|
||||
},
|
||||
{
|
||||
propertyName: "defaultPageSize",
|
||||
label: "Default Page Size",
|
||||
controlType: "INPUT_TEXT",
|
||||
placeholderText: "Enter default page size",
|
||||
isBindProperty: true,
|
||||
isTriggerProperty: false,
|
||||
validation: VALIDATION_TYPES.NUMBER,
|
||||
},
|
||||
{
|
||||
helpText: "Selects the default selected row",
|
||||
propertyName: "defaultSelectedRow",
|
||||
|
|
|
|||
|
|
@ -38,6 +38,4 @@ export interface TableWidgetProps extends WidgetProps, WithMeta, TableStyles {
|
|||
column: string;
|
||||
asc: boolean;
|
||||
};
|
||||
totalRecordCount?: number;
|
||||
defaultPageSize?: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,20 +538,6 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
|
||||
if (!this.props.pageNo) this.props.updateWidgetMetaProperty("pageNo", 1);
|
||||
|
||||
//update pageNo when defaultPageSize or totalRecordsCount is changed
|
||||
if (
|
||||
this.props.defaultPageSize &&
|
||||
this.props.totalRecordCount &&
|
||||
this.props.pageNo
|
||||
) {
|
||||
const maxAllowedPageNumber = Math.ceil(
|
||||
this.props.totalRecordCount / this.props.defaultPageSize,
|
||||
);
|
||||
if (this.props.pageNo > maxAllowedPageNumber) {
|
||||
this.props.updateWidgetMetaProperty("pageNo", maxAllowedPageNumber);
|
||||
}
|
||||
}
|
||||
|
||||
// If the user has switched the mutiple row selection feature
|
||||
if (this.props.multiRowSelection !== prevProps.multiRowSelection) {
|
||||
// It is switched ON:
|
||||
|
|
@ -576,10 +562,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
this.updateSelectedRowIndex();
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.pageSize !== prevProps.pageSize ||
|
||||
this.props.defaultPageSize !== prevProps.defaultPageSize
|
||||
) {
|
||||
if (this.props.pageSize !== prevProps.pageSize) {
|
||||
if (this.props.onPageSizeChange) {
|
||||
super.executeAction({
|
||||
triggerPropertyName: "onPageSizeChange",
|
||||
|
|
@ -634,8 +617,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
|
||||
getPageView() {
|
||||
const {
|
||||
totalRecordsCount,
|
||||
defaultPageSize,
|
||||
pageSize,
|
||||
filteredTableData = [],
|
||||
isVisibleCompactMode,
|
||||
isVisibleDownload,
|
||||
|
|
@ -643,28 +625,8 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
isVisiblePagination,
|
||||
isVisibleSearch,
|
||||
} = this.props;
|
||||
const pageSize = defaultPageSize ? defaultPageSize : this.props.pageSize;
|
||||
const tableColumns = this.getTableColumns() || [];
|
||||
const paginatedFilteredData = [...filteredTableData];
|
||||
if (defaultPageSize && totalRecordsCount) {
|
||||
//if total records count configured is more than tableData
|
||||
if (this.props.pageNo * defaultPageSize > totalRecordsCount) {
|
||||
const count =
|
||||
totalRecordsCount - (this.props.pageNo - 1) * defaultPageSize;
|
||||
paginatedFilteredData.splice(count, paginatedFilteredData.length);
|
||||
}
|
||||
// Manage defaultPageSize data
|
||||
if (paginatedFilteredData.length > defaultPageSize) {
|
||||
paginatedFilteredData.splice(
|
||||
defaultPageSize,
|
||||
paginatedFilteredData.length,
|
||||
);
|
||||
}
|
||||
}
|
||||
const transformedData = this.transformData(
|
||||
paginatedFilteredData,
|
||||
tableColumns,
|
||||
);
|
||||
const transformedData = this.transformData(filteredTableData, tableColumns);
|
||||
const { componentHeight, componentWidth } = this.getComponentDimensions();
|
||||
const isVisibleHeaderOptions =
|
||||
isVisibleCompactMode ||
|
||||
|
|
@ -680,7 +642,6 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
columnSizeMap={this.props.columnSizeMap}
|
||||
columns={tableColumns}
|
||||
compactMode={this.props.compactMode || CompactModeTypes.DEFAULT}
|
||||
defaultPageSize={defaultPageSize}
|
||||
disableDrag={this.toggleDrag}
|
||||
editMode={this.props.renderMode === RenderModes.CANVAS}
|
||||
filters={this.props.filters}
|
||||
|
|
@ -713,8 +674,6 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
serverSidePaginationEnabled={!!this.props.serverSidePaginationEnabled}
|
||||
sortTableColumn={this.handleColumnSorting}
|
||||
tableData={transformedData}
|
||||
tablePageSize={Math.max(1, this.props.pageSize)}
|
||||
totalRecordsCount={totalRecordsCount}
|
||||
triggerRowSelection={this.props.triggerRowSelection}
|
||||
updateCompactMode={this.handleCompactModeChange}
|
||||
updatePageNo={this.updatePageNumber}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user