(core) Update UI for formula and column label/id in the right-side panel.

Summary:
- Update styling of label, id, and "derived ID from label" checkbox.
- Implement a label which shows 'Data Column' vs 'Formula Column' vs 'Empty Column',
  and a dropdown with column actions (such as Clear/Convert)
- Implement new formula display in the side-panel, and open the standard
  FormulaEditor when clicked.
- Remove old FieldConfigTab, of which now very little would be used.
- Fix up remaining code that relied on it (RefSelect)

Test Plan: Fixed old tests, added new browser cases, and a case for a new helper function.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2757
This commit is contained in:
Dmitry S
2021-03-16 23:45:44 -04:00
parent e2d3b70509
commit b4c34cedad
18 changed files with 554 additions and 292 deletions

View File

@@ -46,6 +46,22 @@ export class AsyncCreate<T> {
}
}
/**
* A simpler version of AsyncCreate: given an async function f, returns another function that will
* call f once, and cache and return its value. On failure the result is cleared, so that
* subsequent calls will attempt calling f again.
*/
export function asyncOnce<T>(createFunc: () => Promise<T>): () => Promise<T> {
let value: Promise<T>|undefined;
function clearOnError(p: Promise<T>): Promise<T> {
p.catch(() => { value = undefined; });
return p;
}
return () => (value || (value = clearOnError(createFunc.call(null))));
}
/**
* Supports a usage similar to AsyncCreate in a Map. Returns map.get(key) if it is set to a
* resolved or pending promise. Otherwise, calls creator(key) to create and return a new promise,