From ba198c0c802519c95209e442c72b0cc1e6ea2d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Zaera=20Avell=C3=B3n?= Date: Wed, 27 Sep 2023 09:29:36 +0200 Subject: [PATCH 1/4] feat!(js-api): improve FDS filter CX interfaces See https://liferay.atlassian.net/browse/LPS-197299 This is a breaking change but we have not yet released any GA version of @liferay/js-api so there shouldn't be any problem. --- .../packages/js-api/data-set/index.ts | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/projects/js-toolkit/packages/js-api/data-set/index.ts b/projects/js-toolkit/packages/js-api/data-set/index.ts index 9138ac22d..3f90eb965 100644 --- a/projects/js-toolkit/packages/js-api/data-set/index.ts +++ b/projects/js-toolkit/packages/js-api/data-set/index.ts @@ -3,6 +3,8 @@ * SPDX-License-Identifier: LGPL-3.0-or-later */ +// Frontend data set cell renderer + export interface FDSTableCellHTMLElementBuilderArgs { value: boolean | number | string | object | []; } @@ -19,26 +21,31 @@ export interface FDSCellRenderer { (args: FDSCellRendererArgs): HTMLElement; } -export interface FDSFilterData { - id: string; - odataFilterString: string; - selectedData: string; +// Frontend data set filter + +export interface FDSFilterData { + selectedData: T; +} + +export interface FDSFilterHTMLElementBuilderArgs { + filter: FDSFilterData; + setFilter: (partialFilter: Partial>) => void; } -export interface FDSFilterArgs { - filter: FDSFilterData; - setFilter: (val: Partial) => void; +export interface FDSFilterHTMLElementBuilder { + (args: FDSFilterHTMLElementBuilderArgs): HTMLElement; } -export interface FDSFilter { - (args: FDSFilterArgs): HTMLElement; +export interface FDSFilterODataQueryBuilder { + (selectedData: T): string; } -export interface FDSFilterHTMLElementBuilderArgs { - filter: FDSFilterData; - setFilter: (val: Partial) => void; +export interface FDSFilterDescriptionBuilder { + (selectedData: T): string; } -export interface FDSFilterHTMLElementBuilder { - (args: FDSFilterHTMLElementBuilderArgs): HTMLElement; +export interface FDSFilter { + buildFilterDescription: FDSFilterDescriptionBuilder, + buildHTMLElement: FDSFilterHTMLElementBuilder, + buildODataQuery: FDSFilterODataQueryBuilder, } From 73712e0941d8cedbd714b6ce823e575511881471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Zaera=20Avell=C3=B3n?= Date: Wed, 27 Sep 2023 09:43:37 +0200 Subject: [PATCH 2/4] style(js-api): SF --- projects/js-toolkit/packages/js-api/data-set/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/js-toolkit/packages/js-api/data-set/index.ts b/projects/js-toolkit/packages/js-api/data-set/index.ts index 3f90eb965..921bc4bf0 100644 --- a/projects/js-toolkit/packages/js-api/data-set/index.ts +++ b/projects/js-toolkit/packages/js-api/data-set/index.ts @@ -45,7 +45,7 @@ export interface FDSFilterDescriptionBuilder { } export interface FDSFilter { - buildFilterDescription: FDSFilterDescriptionBuilder, - buildHTMLElement: FDSFilterHTMLElementBuilder, - buildODataQuery: FDSFilterODataQueryBuilder, + buildFilterDescription: FDSFilterDescriptionBuilder; + buildHTMLElement: FDSFilterHTMLElementBuilder; + buildODataQuery: FDSFilterODataQueryBuilder; } From 3e2f0863498737fbff31010546298351098c7e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Zaera=20Avell=C3=B3n?= Date: Wed, 27 Sep 2023 12:14:02 +0200 Subject: [PATCH 3/4] feat(js-api)!: remove obsolete interfaces See https://github.com/liferay/liferay-frontend-projects/pull/1172#discussion_r1338332409 --- projects/js-toolkit/packages/js-api/data-set/index.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/projects/js-toolkit/packages/js-api/data-set/index.ts b/projects/js-toolkit/packages/js-api/data-set/index.ts index 921bc4bf0..b70f3ad15 100644 --- a/projects/js-toolkit/packages/js-api/data-set/index.ts +++ b/projects/js-toolkit/packages/js-api/data-set/index.ts @@ -13,14 +13,6 @@ export interface FDSTableCellHTMLElementBuilder { (args: FDSTableCellHTMLElementBuilderArgs): HTMLElement; } -export interface FDSCellRendererArgs { - value: boolean | number | string | object | []; -} - -export interface FDSCellRenderer { - (args: FDSCellRendererArgs): HTMLElement; -} - // Frontend data set filter export interface FDSFilterData { From f9e7f8192683329d997ed9d39a49c22dcb01b7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Zaera=20Avell=C3=B3n?= Date: Wed, 27 Sep 2023 16:01:04 +0200 Subject: [PATCH 4/4] feat(js-api)!: use better naming See https://github.com/liferay/liferay-frontend-projects/pull/1172#discussion_r1338467460 --- projects/js-toolkit/packages/js-api/data-set/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/js-toolkit/packages/js-api/data-set/index.ts b/projects/js-toolkit/packages/js-api/data-set/index.ts index b70f3ad15..6da05734a 100644 --- a/projects/js-toolkit/packages/js-api/data-set/index.ts +++ b/projects/js-toolkit/packages/js-api/data-set/index.ts @@ -37,7 +37,7 @@ export interface FDSFilterDescriptionBuilder { } export interface FDSFilter { - buildFilterDescription: FDSFilterDescriptionBuilder; - buildHTMLElement: FDSFilterHTMLElementBuilder; - buildODataQuery: FDSFilterODataQueryBuilder; + descriptionBuilder: FDSFilterDescriptionBuilder; + htmlElementBuilder: FDSFilterHTMLElementBuilder; + oDataQueryBuilder: FDSFilterODataQueryBuilder; }