Locks, read-only and limits

Settings that decide what people can change, and how the UI reflects them.

Settings live on the store, change at runtime, and every binding's UI follows: controls disable, buttons hide or grey out, and the store refuses edits the settings forbid.

const store = createQueryStore({
  fields,
  settings: { maxRules: 20, maxDepth: 2, canRegroup: false },
});

store.setSettings({ readOnly: true });

Locks

Any rule or group can be locked; a locked group locks everything inside it. Locks are part of the query JSON (locked: true), so they persist.

store.setLocked(groupId, true);
store.isLocked(childId); // true

Show lock toggles in the default builders with showLock. Locked nodes get the qn-locked class.

Asking the store

store.can(action, id) answers for addRule, addGroup, remove, clone, move (with a target group), editField, editOperator, editValue, editGroup and lock. The hooks expose these as can and update them through store.subscribePermissions, which fires only when settings, locks or (under limits) the tree's shape change, never on value edits.