gristlabs_grist-core/app/plugin/GristData-ti.ts
Alex Hall ecb30eebb8 (core) Parsing multiple values in reflists, parsing refs without table data in client
Summary:
Added a new object type code `l` (for lookup) which can be used in user actions as a temporary cell value in ref[list] columns and is immediately converted to a row ID in the data engine. The value contains the original raw string (to be used as alt text), the column ID to lookup (typically the visible column) and one or more values to lookup.

For reflists, valueParser now tries parsing the string first as JSON, then as a CSV row, and applies the visible column parsed to each item.

Both ref and reflists columns no longer format the parsed value when there's no matching reference, the original unparsed string is used as alttext instead.

Test Plan: Added another table "Multi-References" to CopyPaste test. Made that table and the References table test with and without table data loaded in the browser.

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D3118
2021-11-09 14:41:04 +02:00

36 lines
791 B
TypeScript

/**
* This module was automatically generated by `ts-interface-builder`
*/
import * as t from "ts-interface-checker";
// tslint:disable:object-literal-key-quotes
export const GristObjCode = t.enumtype({
"List": "L",
"LookUp": "l",
"Dict": "O",
"DateTime": "D",
"Date": "d",
"Skip": "S",
"Censored": "C",
"Reference": "R",
"ReferenceList": "r",
"Exception": "E",
"Pending": "P",
"Unmarshallable": "U",
"Versions": "V",
});
export const CellValue = t.union("number", "string", "boolean", "null", t.tuple("GristObjCode", t.rest(t.array("unknown"))));
export const RowRecord = t.iface([], {
"id": "number",
[t.indexKey]: "CellValue",
});
const exportedTypeSuite: t.ITypeSuite = {
GristObjCode,
CellValue,
RowRecord,
};
export default exportedTypeSuite;