(core) Extending widget

Summary:
- Adding new option 'strictType' to widget mapping
- Refreshing mappings when widget options are changed

Test Plan: Updated

Reviewers: JakubSerafin

Reviewed By: JakubSerafin

Differential Revision: https://phab.getgrist.com/D4061
This commit is contained in:
Jarosław Sadziński
2023-10-09 11:00:40 +02:00
parent 572279916e
commit a8e0f96813
7 changed files with 146 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ export const ColumnToMap = t.iface([], {
"type": t.opt("string"),
"optional": t.opt("boolean"),
"allowMultiple": t.opt("boolean"),
"strictType": t.opt("boolean"),
});
export const ColumnsToMap = t.array(t.union("string", "ColumnToMap"));

View File

@@ -16,7 +16,8 @@ export interface ColumnToMap {
*/
description?: string|null,
/**
* Column type, by default ANY.
* Column types (as comma separated list), by default "Any", what means that any type is
* allowed (unless strictType is true).
*/
type?: string, // GristType, TODO: ts-interface-checker doesn't know how to parse this
/**
@@ -27,6 +28,10 @@ export interface ColumnToMap {
* Allow multiple column assignment, the result will be list of mapped table column names.
*/
allowMultiple?: boolean,
/**
* Match column type strictly, so "Any" will require "Any" and not any other type.
*/
strictType?: boolean,
}
export type ColumnsToMap = (string|ColumnToMap)[];