(core) Multiple types in columns mapping

Summary: Mapping for a single column in custom widgets accepts now multiple types as comma separeted list.

Test Plan: Added new

Reviewers: JakubSerafin

Reviewed By: JakubSerafin

Differential Revision: https://phab.getgrist.com/D4042
This commit is contained in:
Jarosław Sadziński
2023-09-13 12:29:36 +02:00
parent 40c5f7b738
commit 2b11000457
2 changed files with 66 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ export class ColumnToMapImpl implements Required<ColumnToMap> {
public description: string;
// If column is optional (used only on the UI).
public optional: boolean;
// Type of the column that widget expects.
// Type of the column that widget expects. Might be a single or a comma separated list of types.
public type: string;
// Description of the type (used to show a placeholder).
public typeDesc: string;
@@ -33,7 +33,7 @@ export class ColumnToMapImpl implements Required<ColumnToMap> {
* Does the column type matches this definition.
*/
public canByMapped(pureType: string) {
return pureType === this.type
return this.type.split(',').includes(pureType)
|| pureType === "Any"
|| this.type === "Any";
}