(core) Add dropdown conditions

Summary:
Dropdown conditions let you specify a predicate formula that's used to filter
choices and references in their respective autocomplete dropdown menus.

Test Plan: Python and browser tests (WIP).

Reviewers: jarek, paulfitz

Reviewed By: jarek

Subscribers: dsagal, paulfitz

Differential Revision: https://phab.getgrist.com/D4235
This commit is contained in:
George Gevoian
2024-04-26 16:34:16 -04:00
parent 34c85757f1
commit 3112433a58
86 changed files with 4221 additions and 1060 deletions

View File

@@ -1,7 +1,7 @@
import {CellValue} from 'app/common/DocActions';
import {AclMatchFunc, InfoView} from 'app/common/GranularAccessClause';
import {InfoView} from 'app/common/GranularAccessClause';
import {GristObjCode} from 'app/plugin/GristData';
import {compileAclFormula} from 'app/server/lib/ACLFormula';
import {CompiledPredicateFormula, compilePredicateFormula} from 'app/common/PredicateFormula';
import {makeExceptionalDocSession} from 'app/server/lib/DocSession';
import {User} from 'app/server/lib/GranularAccess';
import {assert} from 'chai';
@@ -26,7 +26,7 @@ describe('ACLFormula', function() {
const V = getInfoView; // A shortcut.
type SetAndCompile = (aclFormula: string) => Promise<AclMatchFunc>;
type SetAndCompile = (aclFormula: string) => Promise<CompiledPredicateFormula>;
let setAndCompile: SetAndCompile;
before(async function () {
@@ -44,7 +44,7 @@ describe('ACLFormula', function() {
fakeSession, {tableId: '_grist_ACLRules', filters: {id: [ruleRef]}});
assert(tableData[3].aclFormulaParsed, "Expected aclFormulaParsed to be populated");
const parsedFormula = String(tableData[3].aclFormulaParsed[0]);
return compileAclFormula(JSON.parse(parsedFormula));
return compilePredicateFormula(JSON.parse(parsedFormula));
};
});