@aglyn/shared-ui-jsx 1.0.0-beta.202 → 1.0.0-beta.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-jsx",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.203",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.203",
|
|
29
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.203",
|
|
30
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.203",
|
|
31
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.203",
|
|
32
32
|
"@mdi/js": "^7.4.47",
|
|
33
33
|
"@swc/helpers": "0.5.23",
|
|
34
34
|
"change-case": "^5.4.4",
|
|
@@ -185,9 +185,28 @@ const SELECT_FROM_GRID = {
|
|
|
185
185
|
return _extends({}, column, listFilterColumn(fields, field.column));
|
|
186
186
|
});
|
|
187
187
|
const present = columns.map((column)=>column.field);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
/*
|
|
189
|
+
* A field with choices is judged filterable by its choices, not by the
|
|
190
|
+
* grid's operators for its kind: a Yes/No `boolean` field allows `equals`,
|
|
191
|
+
* which the grid's boolean pool names `is`, so judged the plain way it has
|
|
192
|
+
* no operator and was dropped before its choices could make it a select —
|
|
193
|
+
* leaving a served filter nobody could reach (AGL-3332's Clicked). A field
|
|
194
|
+
* with choices stays a column even while they are empty (products not yet
|
|
195
|
+
* loaded): the list still reads a clause on it back through that column.
|
|
196
|
+
*/ const hidden = fields.filter((field)=>!present.includes(field.column)).flatMap((field)=>{
|
|
197
|
+
var _headers_field_column;
|
|
198
|
+
const base = {
|
|
199
|
+
field: field.column,
|
|
200
|
+
headerName: (_headers_field_column = headers[field.column]) != null ? _headers_field_column : field.column,
|
|
201
|
+
hideable: false
|
|
202
|
+
};
|
|
203
|
+
if (options[field.column]) return [
|
|
204
|
+
_extends({}, base, selectProps(field))
|
|
205
|
+
];
|
|
206
|
+
const plain = listFilterColumn(fields, field.column);
|
|
207
|
+
return plain.filterable ? [
|
|
208
|
+
_extends({}, base, plain)
|
|
209
|
+
] : [];
|
|
191
210
|
});
|
|
192
211
|
return [
|
|
193
212
|
...shown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/const/list-grid-filter.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n getGridBooleanOperators,\n getGridDateOperators,\n getGridNumericOperators,\n getGridSingleSelectOperators,\n getGridStringOperators,\n type GridColDef,\n type GridFilterItem,\n type GridFilterOperator,\n} from '@mui/x-data-grid'\nimport {\n gridFilterRequests,\n type ListFilterField,\n type ListFilterKind,\n type ListFilterRequest,\n listFilterOperators,\n} from './list-filter'\n\n/*\n * ONE path from a list's filter clauses to the data grid's own Filters panel\n * and quick search, and back (AGL-3313, shared by every list since AGL-3317).\n *\n * A list stores what it is narrowed by as clauses — `{ field, op, value }`,\n * the shape saved views hold — and edits them through the grid's toolbar\n * rather than controls of its own. What a list declares is its fields, as\n * the `ListFilterField` grammar (`./list-filter`), plus the choices of the\n * fields whose values are picked rather than typed. The grid then offers\n * each as a typed column: a `singleSelect` with its choices where there are\n * choices, the operators the grammar allows otherwise.\n *\n * The clauses keep their stored shape, so a view saved before the panel\n * reads unchanged: the panel shows `equals` as the select's `is` and writes\n * `is` back as `equals`, and a list whose clauses were stored in some other\n * shape says so with a codec.\n */\n\n/** One clause a list is narrowed by; `label` names a picked value on a chip. */\nexport interface ListFilterClause extends ListFilterRequest {\n label?: string\n}\n\n/** A choice for a field whose value is picked rather than typed. */\nexport interface ListFilterOption {\n value: string\n label: string\n}\n\nconst operatorPool = (kind: ListFilterKind): GridFilterOperator[] => {\n switch (kind) {\n case 'boolean':\n return getGridBooleanOperators()\n case 'number':\n return getGridNumericOperators()\n case 'date':\n return getGridDateOperators()\n default:\n return getGridStringOperators()\n }\n}\n\n/**\n * The MUI operators for a field — the same list `listFilterOperators` names,\n * resolved to the grid's own operator objects so the panel keeps its native\n * inputs (a date picker for a date, a number field for a number).\n */\nexport function gridFilterOperators(\n field: ListFilterField,\n): GridFilterOperator[] {\n const allowed = listFilterOperators(field)\n return operatorPool(field.kind).filter((operator) =>\n allowed.includes(operator.value),\n )\n}\n\n/**\n * Spread onto a `GridColDef` to make a column filterable exactly as far as the\n * query can serve it. A column with NO declared field is turned off entirely —\n * deliberately, because the alternative is a funnel icon that opens a panel\n * nothing honours.\n */\nexport function listFilterColumn(\n fields: readonly ListFilterField[],\n column: string,\n): { filterable: boolean; filterOperators?: GridFilterOperator[] } {\n const field = fields.find((entry) => entry.column === column)\n if (!field) return { filterable: false }\n const operators = gridFilterOperators(field)\n return operators.length\n ? { filterable: true, filterOperators: operators }\n : { filterable: false }\n}\n\n/**\n * Fields a reader can filter by that are NOT columns on the table.\n *\n * MUI's filter panel lists COLUMNS — `gridFilterableColumnDefinitionsSelector`\n * reads every column definition, hidden ones included — so a filterable field\n * with no column is a field nobody can reach however well the route answers it.\n * Declaring it as a permanently hidden column keeps one source of truth, the\n * field list, instead of a second list of \"extra filters\" that drifts from it.\n *\n * `hideable: false` keeps them out of Manage columns as well: a column with no\n * `renderCell` and no width has nothing to show, and a reader who unhid one\n * would get a strip of blank cells for their trouble.\n *\n * Pair with {@link hiddenFilterVisibility}, which is what actually hides them.\n */\nexport function hiddenFilterColumns(\n fields: readonly ListFilterField[],\n visible: readonly string[],\n headers: Readonly<Record<string, string>> = {},\n): Array<{\n field: string\n headerName: string\n hideable: boolean\n filterable: boolean\n filterOperators?: GridFilterOperator[]\n}> {\n return fields\n .filter((field) => !visible.includes(field.column))\n .map((field) => ({\n field: field.column,\n headerName: headers[field.column] ?? field.column,\n hideable: false,\n ...listFilterColumn(fields, field.column),\n }))\n .filter((column) => column.filterable)\n}\n\n/** The grid operator each stored select operator shows as. */\nconst SELECT_TO_GRID: Readonly<Record<string, string>> = {\n equals: 'is',\n doesNotEqual: 'not',\n isAnyOf: 'isAnyOf',\n}\nconst SELECT_FROM_GRID: Readonly<Record<string, string>> = {\n is: 'equals',\n not: 'doesNotEqual',\n isAnyOf: 'isAnyOf',\n}\n\n/**\n * How one field's stored clause and the panel's item translate. A field\n * with choices uses {@link listSelectCodec}; a typed one,\n * {@link listPlainCodec}. A list whose clauses predate the panel supplies\n * its own.\n */\nexport interface ListGridFilterCodec {\n toItem: (clause: ListFilterClause) => Pick<GridFilterItem, 'operator' | 'value'> | null\n toClause: (item: GridFilterItem) => ListFilterClause | null\n}\n\n/** The panel's item as a clause, through the grammar's one notion of \"usable\". */\nconst plainClause = (item: GridFilterItem): ListFilterClause | null =>\n gridFilterRequests({ items: [item] })[0] ?? null\n\n/** A typed field: the stored operator IS the grid's. */\nexport const listPlainCodec: ListGridFilterCodec = {\n toItem: (clause) => ({\n operator: clause.op,\n value: clause.value === '' ? undefined : clause.value,\n }),\n toClause: plainClause,\n}\n\n/** A picked field: `equals` shows as `is`, and `isAnyOf` holds a comma list. */\nexport const listSelectCodec: ListGridFilterCodec = {\n toItem: (clause) => {\n const operator = SELECT_TO_GRID[clause.op]\n if (!operator) return null\n return {\n operator,\n value:\n operator === 'isAnyOf'\n ? clause.value.split(',').map((entry) => entry.trim()).filter(Boolean)\n : clause.value,\n }\n },\n toClause: (item) => {\n const op = SELECT_FROM_GRID[String(item.operator)]\n const request = op ? plainClause(item) : null\n return request && op ? { ...request, op } : null\n },\n}\n\n/** The select operators a field's allowed clause operators map to. */\nexport function listSelectOperators(allowed: readonly string[]) {\n const shown = allowed.map((op) => SELECT_TO_GRID[op]).filter(Boolean)\n return getGridSingleSelectOperators().filter((operator) =>\n shown.includes(operator.value),\n )\n}\n\n/**\n * The list's columns, each made filterable exactly as far as its field is\n * declared, and every declared field that is not a column added as a\n * permanently hidden one — the panel lists columns, so a field with none\n * could not be reached (`hiddenFilterColumns`).\n *\n * A field with choices becomes a `singleSelect` over them, whatever the\n * column rendered before; one without keeps the grammar's operators; a\n * column no field declares offers no filter, because the list, not the\n * grid, answers every filter and would have nothing to answer it with.\n */\nexport function listFilterGridColumns(\n columns: readonly GridColDef[],\n fields: readonly ListFilterField[],\n options: Readonly<Record<string, readonly ListFilterOption[]>> = {},\n headers: Readonly<Record<string, string>> = {},\n): GridColDef[] {\n const selectProps = (field: ListFilterField) => {\n const choices = options[field.column] ?? []\n const operators = listSelectOperators(listFilterOperators(field))\n return {\n type: 'singleSelect' as const,\n valueOptions: choices.map((choice) => ({ value: choice.value, label: choice.label })),\n filterable: choices.length > 0 && operators.length > 0,\n filterOperators: operators,\n }\n }\n /*\n * A column made a select keeps what it DREW. The grid formats a\n * `singleSelect` cell as the label of the option its value matches, and as\n * nothing when none does — so a column whose `valueGetter` hands back a\n * label (an address for an actor id, a site name for a scope id) went\n * blank the moment it gained a filter (AGL-3321). A column with its own\n * `renderCell` is left alone; any other draws the matching option's label\n * when there is one, and its own value when there is not.\n */\n const keepsItsCell = (column: GridColDef, field: ListFilterField) => {\n if (column.renderCell) return {}\n const labels = new Map(\n (options[field.column] ?? []).map((choice) => [choice.value, choice.label]),\n )\n return {\n renderCell: (params: { value?: unknown }) => {\n const value = params.value\n if (value === undefined || value === null) return ''\n return labels.get(String(value)) ?? String(value)\n },\n }\n }\n const shown = columns.map((column): GridColDef => {\n if (column.filterable === false && column.hideable === false) return column\n const field = fields.find((entry) => entry.column === column.field)\n if (!field) return { ...column, filterable: false }\n if (options[field.column]) {\n return { ...column, ...selectProps(field), ...keepsItsCell(column, field) } as GridColDef\n }\n return { ...column, ...listFilterColumn(fields, field.column) }\n })\n const present = columns.map((column) => column.field)\n const hidden = hiddenFilterColumns(fields, present, headers).map(\n (column): GridColDef => {\n const field = fields.find((entry) => entry.column === column.field)\n return field && options[field.column]\n ? ({ ...column, ...selectProps(field) } as GridColDef)\n : column\n },\n )\n return [...shown, ...hidden]\n}\n\n/**\n * Whether a row answers a quick search: every whitespace-separated word\n * appears, case-insensitively, in SOME of the row's searched values. A\n * blank search matches every row, so an emptied box is the list unfiltered.\n * An array value (tags) is searched member by member.\n */\nexport function listRowMatchesSearch(\n row: object,\n paths: readonly string[],\n words: readonly string[],\n): boolean {\n const asked = words.map((word) => word.trim().toLowerCase()).filter(Boolean)\n if (!asked.length) return true\n const values = paths\n .flatMap((path) => {\n const value = path\n .split('.')\n .reduce<unknown>(\n (at, key) => (at == null ? undefined : (at as Record<string, unknown>)[key]),\n row,\n )\n return Array.isArray(value) ? value : [value]\n })\n .filter((value): value is string | number => typeof value === 'string' || typeof value === 'number')\n .map((value) => String(value).toLowerCase())\n .filter(Boolean)\n return asked.every((word) => values.some((value) => value.includes(word)))\n}\n\n/**\n * The clauses with one field's clause set: replaced in place where the field\n * already had one, appended where it did not, removed when `next` is null.\n * A field holds ONE clause, which is what the panel edits.\n */\nexport function upsertListFilterClause<Clause extends ListFilterClause>(\n clauses: readonly Clause[],\n field: string,\n next: Clause | null,\n): Clause[] {\n const at = clauses.findIndex((clause) => clause.field === field)\n const rest = clauses.filter((clause) => clause.field !== field)\n if (!next) return rest\n if (at === -1) return [...rest, next]\n return [...rest.slice(0, at), next, ...rest.slice(at)]\n}\n\nexport { listFilterClauseSentence } from './list-filter-sentence'\n"],"names":["getGridBooleanOperators","getGridDateOperators","getGridNumericOperators","getGridSingleSelectOperators","getGridStringOperators","gridFilterRequests","listFilterOperators","operatorPool","kind","gridFilterOperators","field","allowed","filter","operator","includes","value","listFilterColumn","fields","column","find","entry","filterable","operators","length","filterOperators","hiddenFilterColumns","visible","headers","map","headerName","hideable","SELECT_TO_GRID","equals","doesNotEqual","isAnyOf","SELECT_FROM_GRID","is","not","plainClause","item","items","listPlainCodec","toItem","clause","op","undefined","toClause","listSelectCodec","split","trim","Boolean","String","request","listSelectOperators","shown","listFilterGridColumns","columns","options","selectProps","choices","type","valueOptions","choice","label","keepsItsCell","renderCell","labels","Map","params","get","present","hidden","listRowMatchesSearch","row","paths","words","asked","word","toLowerCase","values","flatMap","path","reduce","at","key","Array","isArray","every","some","upsertListFilterClause","clauses","next","findIndex","rest","slice","listFilterClauseSentence"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,uBAAuB,EACvBC,oBAAoB,EACpBC,uBAAuB,EACvBC,4BAA4B,EAC5BC,sBAAsB,QAIjB,mBAAkB;AACzB,SACEC,kBAAkB,EAIlBC,mBAAmB,QACd,mBAAe;AA+BtB,MAAMC,eAAe,CAACC;IACpB,OAAQA;QACN,KAAK;YACH,OAAOR;QACT,KAAK;YACH,OAAOE;QACT,KAAK;YACH,OAAOD;QACT;YACE,OAAOG;IACX;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASK,oBACdC,KAAsB;IAEtB,MAAMC,UAAUL,oBAAoBI;IACpC,OAAOH,aAAaG,MAAMF,IAAI,EAAEI,MAAM,CAAC,CAACC,WACtCF,QAAQG,QAAQ,C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F,MAAM,OAAOE;IAClB,IAAIV,OAAO,CAAC,GAAG,OAAO;WAAIU;QAAMF;KAAK;IACrC,OAAO;WAAIE,KAAKC,KAAK,CAAC,GAAGX;QAAKQ;WAASE,KAAKC,KAAK,CAACX;KAAI;AACxD;AAEA,SAASY,wBAAwB,QAAQ,4BAAwB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/const/list-grid-filter.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n getGridBooleanOperators,\n getGridDateOperators,\n getGridNumericOperators,\n getGridSingleSelectOperators,\n getGridStringOperators,\n type GridColDef,\n type GridFilterItem,\n type GridFilterOperator,\n} from '@mui/x-data-grid'\nimport {\n gridFilterRequests,\n type ListFilterField,\n type ListFilterKind,\n type ListFilterRequest,\n listFilterOperators,\n} from './list-filter'\n\n/*\n * ONE path from a list's filter clauses to the data grid's own Filters panel\n * and quick search, and back (AGL-3313, shared by every list since AGL-3317).\n *\n * A list stores what it is narrowed by as clauses — `{ field, op, value }`,\n * the shape saved views hold — and edits them through the grid's toolbar\n * rather than controls of its own. What a list declares is its fields, as\n * the `ListFilterField` grammar (`./list-filter`), plus the choices of the\n * fields whose values are picked rather than typed. The grid then offers\n * each as a typed column: a `singleSelect` with its choices where there are\n * choices, the operators the grammar allows otherwise.\n *\n * The clauses keep their stored shape, so a view saved before the panel\n * reads unchanged: the panel shows `equals` as the select's `is` and writes\n * `is` back as `equals`, and a list whose clauses were stored in some other\n * shape says so with a codec.\n */\n\n/** One clause a list is narrowed by; `label` names a picked value on a chip. */\nexport interface ListFilterClause extends ListFilterRequest {\n label?: string\n}\n\n/** A choice for a field whose value is picked rather than typed. */\nexport interface ListFilterOption {\n value: string\n label: string\n}\n\nconst operatorPool = (kind: ListFilterKind): GridFilterOperator[] => {\n switch (kind) {\n case 'boolean':\n return getGridBooleanOperators()\n case 'number':\n return getGridNumericOperators()\n case 'date':\n return getGridDateOperators()\n default:\n return getGridStringOperators()\n }\n}\n\n/**\n * The MUI operators for a field — the same list `listFilterOperators` names,\n * resolved to the grid's own operator objects so the panel keeps its native\n * inputs (a date picker for a date, a number field for a number).\n */\nexport function gridFilterOperators(\n field: ListFilterField,\n): GridFilterOperator[] {\n const allowed = listFilterOperators(field)\n return operatorPool(field.kind).filter((operator) =>\n allowed.includes(operator.value),\n )\n}\n\n/**\n * Spread onto a `GridColDef` to make a column filterable exactly as far as the\n * query can serve it. A column with NO declared field is turned off entirely —\n * deliberately, because the alternative is a funnel icon that opens a panel\n * nothing honours.\n */\nexport function listFilterColumn(\n fields: readonly ListFilterField[],\n column: string,\n): { filterable: boolean; filterOperators?: GridFilterOperator[] } {\n const field = fields.find((entry) => entry.column === column)\n if (!field) return { filterable: false }\n const operators = gridFilterOperators(field)\n return operators.length\n ? { filterable: true, filterOperators: operators }\n : { filterable: false }\n}\n\n/**\n * Fields a reader can filter by that are NOT columns on the table.\n *\n * MUI's filter panel lists COLUMNS — `gridFilterableColumnDefinitionsSelector`\n * reads every column definition, hidden ones included — so a filterable field\n * with no column is a field nobody can reach however well the route answers it.\n * Declaring it as a permanently hidden column keeps one source of truth, the\n * field list, instead of a second list of \"extra filters\" that drifts from it.\n *\n * `hideable: false` keeps them out of Manage columns as well: a column with no\n * `renderCell` and no width has nothing to show, and a reader who unhid one\n * would get a strip of blank cells for their trouble.\n *\n * Pair with {@link hiddenFilterVisibility}, which is what actually hides them.\n */\nexport function hiddenFilterColumns(\n fields: readonly ListFilterField[],\n visible: readonly string[],\n headers: Readonly<Record<string, string>> = {},\n): Array<{\n field: string\n headerName: string\n hideable: boolean\n filterable: boolean\n filterOperators?: GridFilterOperator[]\n}> {\n return fields\n .filter((field) => !visible.includes(field.column))\n .map((field) => ({\n field: field.column,\n headerName: headers[field.column] ?? field.column,\n hideable: false,\n ...listFilterColumn(fields, field.column),\n }))\n .filter((column) => column.filterable)\n}\n\n/** The grid operator each stored select operator shows as. */\nconst SELECT_TO_GRID: Readonly<Record<string, string>> = {\n equals: 'is',\n doesNotEqual: 'not',\n isAnyOf: 'isAnyOf',\n}\nconst SELECT_FROM_GRID: Readonly<Record<string, string>> = {\n is: 'equals',\n not: 'doesNotEqual',\n isAnyOf: 'isAnyOf',\n}\n\n/**\n * How one field's stored clause and the panel's item translate. A field\n * with choices uses {@link listSelectCodec}; a typed one,\n * {@link listPlainCodec}. A list whose clauses predate the panel supplies\n * its own.\n */\nexport interface ListGridFilterCodec {\n toItem: (clause: ListFilterClause) => Pick<GridFilterItem, 'operator' | 'value'> | null\n toClause: (item: GridFilterItem) => ListFilterClause | null\n}\n\n/** The panel's item as a clause, through the grammar's one notion of \"usable\". */\nconst plainClause = (item: GridFilterItem): ListFilterClause | null =>\n gridFilterRequests({ items: [item] })[0] ?? null\n\n/** A typed field: the stored operator IS the grid's. */\nexport const listPlainCodec: ListGridFilterCodec = {\n toItem: (clause) => ({\n operator: clause.op,\n value: clause.value === '' ? undefined : clause.value,\n }),\n toClause: plainClause,\n}\n\n/** A picked field: `equals` shows as `is`, and `isAnyOf` holds a comma list. */\nexport const listSelectCodec: ListGridFilterCodec = {\n toItem: (clause) => {\n const operator = SELECT_TO_GRID[clause.op]\n if (!operator) return null\n return {\n operator,\n value:\n operator === 'isAnyOf'\n ? clause.value.split(',').map((entry) => entry.trim()).filter(Boolean)\n : clause.value,\n }\n },\n toClause: (item) => {\n const op = SELECT_FROM_GRID[String(item.operator)]\n const request = op ? plainClause(item) : null\n return request && op ? { ...request, op } : null\n },\n}\n\n/** The select operators a field's allowed clause operators map to. */\nexport function listSelectOperators(allowed: readonly string[]) {\n const shown = allowed.map((op) => SELECT_TO_GRID[op]).filter(Boolean)\n return getGridSingleSelectOperators().filter((operator) =>\n shown.includes(operator.value),\n )\n}\n\n/**\n * The list's columns, each made filterable exactly as far as its field is\n * declared, and every declared field that is not a column added as a\n * permanently hidden one — the panel lists columns, so a field with none\n * could not be reached (`hiddenFilterColumns`).\n *\n * A field with choices becomes a `singleSelect` over them, whatever the\n * column rendered before; one without keeps the grammar's operators; a\n * column no field declares offers no filter, because the list, not the\n * grid, answers every filter and would have nothing to answer it with.\n */\nexport function listFilterGridColumns(\n columns: readonly GridColDef[],\n fields: readonly ListFilterField[],\n options: Readonly<Record<string, readonly ListFilterOption[]>> = {},\n headers: Readonly<Record<string, string>> = {},\n): GridColDef[] {\n const selectProps = (field: ListFilterField) => {\n const choices = options[field.column] ?? []\n const operators = listSelectOperators(listFilterOperators(field))\n return {\n type: 'singleSelect' as const,\n valueOptions: choices.map((choice) => ({ value: choice.value, label: choice.label })),\n filterable: choices.length > 0 && operators.length > 0,\n filterOperators: operators,\n }\n }\n /*\n * A column made a select keeps what it DREW. The grid formats a\n * `singleSelect` cell as the label of the option its value matches, and as\n * nothing when none does — so a column whose `valueGetter` hands back a\n * label (an address for an actor id, a site name for a scope id) went\n * blank the moment it gained a filter (AGL-3321). A column with its own\n * `renderCell` is left alone; any other draws the matching option's label\n * when there is one, and its own value when there is not.\n */\n const keepsItsCell = (column: GridColDef, field: ListFilterField) => {\n if (column.renderCell) return {}\n const labels = new Map(\n (options[field.column] ?? []).map((choice) => [choice.value, choice.label]),\n )\n return {\n renderCell: (params: { value?: unknown }) => {\n const value = params.value\n if (value === undefined || value === null) return ''\n return labels.get(String(value)) ?? String(value)\n },\n }\n }\n const shown = columns.map((column): GridColDef => {\n if (column.filterable === false && column.hideable === false) return column\n const field = fields.find((entry) => entry.column === column.field)\n if (!field) return { ...column, filterable: false }\n if (options[field.column]) {\n return { ...column, ...selectProps(field), ...keepsItsCell(column, field) } as GridColDef\n }\n return { ...column, ...listFilterColumn(fields, field.column) }\n })\n const present = columns.map((column) => column.field)\n /*\n * A field with choices is judged filterable by its choices, not by the\n * grid's operators for its kind: a Yes/No `boolean` field allows `equals`,\n * which the grid's boolean pool names `is`, so judged the plain way it has\n * no operator and was dropped before its choices could make it a select —\n * leaving a served filter nobody could reach (AGL-3332's Clicked). A field\n * with choices stays a column even while they are empty (products not yet\n * loaded): the list still reads a clause on it back through that column.\n */\n const hidden = fields\n .filter((field) => !present.includes(field.column))\n .flatMap((field): GridColDef[] => {\n const base = {\n field: field.column,\n headerName: headers[field.column] ?? field.column,\n hideable: false,\n }\n if (options[field.column]) return [{ ...base, ...selectProps(field) } as GridColDef]\n const plain = listFilterColumn(fields, field.column)\n return plain.filterable ? [{ ...base, ...plain } as GridColDef] : []\n })\n return [...shown, ...hidden]\n}\n\n/**\n * Whether a row answers a quick search: every whitespace-separated word\n * appears, case-insensitively, in SOME of the row's searched values. A\n * blank search matches every row, so an emptied box is the list unfiltered.\n * An array value (tags) is searched member by member.\n */\nexport function listRowMatchesSearch(\n row: object,\n paths: readonly string[],\n words: readonly string[],\n): boolean {\n const asked = words.map((word) => word.trim().toLowerCase()).filter(Boolean)\n if (!asked.length) return true\n const values = paths\n .flatMap((path) => {\n const value = path\n .split('.')\n .reduce<unknown>(\n (at, key) => (at == null ? undefined : (at as Record<string, unknown>)[key]),\n row,\n )\n return Array.isArray(value) ? value : [value]\n })\n .filter((value): value is string | number => typeof value === 'string' || typeof value === 'number')\n .map((value) => String(value).toLowerCase())\n .filter(Boolean)\n return asked.every((word) => values.some((value) => value.includes(word)))\n}\n\n/**\n * The clauses with one field's clause set: replaced in place where the field\n * already had one, appended where it did not, removed when `next` is null.\n * A field holds ONE clause, which is what the panel edits.\n */\nexport function upsertListFilterClause<Clause extends ListFilterClause>(\n clauses: readonly Clause[],\n field: string,\n next: Clause | null,\n): Clause[] {\n const at = clauses.findIndex((clause) => clause.field === field)\n const rest = clauses.filter((clause) => clause.field !== field)\n if (!next) return rest\n if (at === -1) return [...rest, next]\n return [...rest.slice(0, at), next, ...rest.slice(at)]\n}\n\nexport { listFilterClauseSentence } from './list-filter-sentence'\n"],"names":["getGridBooleanOperators","getGridDateOperators","getGridNumericOperators","getGridSingleSelectOperators","getGridStringOperators","gridFilterRequests","listFilterOperators","operatorPool","kind","gridFilterOperators","field","allowed","filter","operator","includes","value","listFilterColumn","fields","column","find","entry","filterable","operators","length","filterOperators","hiddenFilterColumns","visible","headers","map","headerName","hideable","SELECT_TO_GRID","equals","doesNotEqual","isAnyOf","SELECT_FROM_GRID","is","not","plainClause","item","items","listPlainCodec","toItem","clause","op","undefined","toClause","listSelectCodec","split","trim","Boolean","String","request","listSelectOperators","shown","listFilterGridColumns","columns","options","selectProps","choices","type","valueOptions","choice","label","keepsItsCell","renderCell","labels","Map","params","get","present","hidden","flatMap","base","plain","listRowMatchesSearch","row","paths","words","asked","word","toLowerCase","values","path","reduce","at","key","Array","isArray","every","some","upsertListFilterClause","clauses","next","findIndex","rest","slice","listFilterClauseSentence"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,uBAAuB,EACvBC,oBAAoB,EACpBC,uBAAuB,EACvBC,4BAA4B,EAC5BC,sBAAsB,QAIjB,mBAAkB;AACzB,SACEC,kBAAkB,EAIlBC,mBAAmB,QACd,mBAAe;AA+BtB,MAAMC,eAAe,CAACC;IACpB,OAAQA;QACN,KAAK;YACH,OAAOR;QACT,KAAK;YACH,OAAOE;QACT,KAAK;YACH,OAAOD;QACT;YACE,OAAOG;IACX;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASK,oBACdC,KAAsB;IAEtB,MAAMC,UAAUL,oBAAoBI;IACpC,OAAOH,aAAaG,MAAMF,IAAI,EAAEI,MAAM,CAAC,CAACC,WACtCF,QAAQG,QAAQ,CAACD,SAASE,KAAK;AAEnC;AAEA;;;;;CAKC,GACD,OAAO,SAASC,iBACdC,MAAkC,EAClCC,MAAc;IAEd,MAA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