(core) Implement UI for trigger formulas.

Summary:
- Implement UI with "Apply to new records" and "Apply on record changes"
  checkboxes, and options for selecting which changes to recalculate on.
- For consistency, always represent empty RefList as None
- Fix up generated SchemaTypes to remember that values are encoded.

Included test cases for the main planned use cases:
- Auto-filled UUID column
- Data cleaning
- NOW() formula for record's last-updated timestamp.
- Updates that depend on other columns.

Test Plan: Added a browser test.

Reviewers: jarek

Reviewed By: jarek

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D2885
This commit is contained in:
Dmitry S
2021-06-29 00:47:59 -04:00
parent e180641c7d
commit b537539b73
12 changed files with 372 additions and 53 deletions

View File

@@ -16,7 +16,7 @@ _ts_types = {
"Int": "number",
"PositionNumber": "number",
"Ref": "number",
"RefList": "number[]",
"RefList": "['L', ...number[]]|null", # Non-primitive values are encoded
"Text": "string",
}
@@ -25,7 +25,7 @@ def get_ts_type(col_type):
return _ts_types.get(col_type, "CellValue")
def main():
print("""
print("""\
/*** THIS FILE IS AUTO-GENERATED BY %s ***/
// tslint:disable:object-literal-key-quotes

View File

@@ -457,7 +457,8 @@ class ReferenceList(BaseColumnType):
assert value._table.table_id == self.table_id
return objtypes.RecordList(value._row_ids, group_by=value._group_by, sort_by=value._sort_by)
elif not value:
return []
# Represent an empty ReferenceList as None (also its default value). Formulas will see [].
return None
return [Reference.do_convert(val) for val in value]
@classmethod