(core) Adding UI for reverse columns

Summary:
- Adding an UI for two-way reference column.
- Reusing table name as label for the reverse column

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4344
This commit is contained in:
Jarosław Sadziński
2024-09-13 15:20:18 +02:00
parent da6c39aa50
commit e97a45143f
25 changed files with 1356 additions and 137 deletions

View File

@@ -1069,3 +1069,19 @@ export function computedOwned<T>(
}
export type Constructor<T> = new (...args: any[]) => T;
/**
* Simple memoization function that caches the result of a function call based on its arguments.
* Unlike lodash's memoize, it uses all arguments to generate the key.
*/
export function cached<T>(fn: T): T {
const dict = new Map();
const impl = (...args: any[]) => {
const key = JSON.stringify(args);
if (!dict.has(key)) {
dict.set(key, (fn as any)(...args));
}
return dict.get(key);
};
return impl as any as T;
}