MCPcopy Index your code
hub / github.com/plotly/dash / Dropdowns

Class Dropdowns

components/dash-table/src/dash-table/derived/cell/dropdowns.ts:26–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24export default () => new Dropdowns().get;
25
26class Dropdowns {
27 /**
28 * Return the dropdown for each cell in the table.
29 */
30 get = memoizeOne(
31 (
32 columns: Columns,
33 data: Data,
34 indices: Indices,
35 conditionalDropdowns: ConditionalDropdowns,
36 staticDropdowns: StaticDropdowns,
37 dataDropdowns: DataDropdowns
38 ) =>
39 mapData(
40 (datum, rowIndex) =>
41 R.map(column => {
42 const realIndex = indices[rowIndex];
43
44 const appliedStaticDropdown =
45 (dataDropdowns &&
46 dataDropdowns.length > realIndex &&
47 dataDropdowns[realIndex] &&
48 dataDropdowns[realIndex][column.id]) ||
49 staticDropdowns[column.id];
50
51 return this.dropdown.get(column.id, rowIndex)(
52 appliedStaticDropdown,
53 conditionalDropdowns,
54 column,
55 datum
56 );
57 }, columns),
58 data
59 )
60 );
61
62 /**
63 * Returns the highest priority dropdown from the
64 * applicable dropdowns.
65 */
66 private readonly dropdown = memoizerCache<[ColumnId, number]>()(
67 (
68 base: IDropdown | undefined,
69 conditionals: ConditionalDropdowns,
70 column: IColumn,
71 datum: Datum
72 ) => {
73 const conditional = R.findLast(
74 ([cd, i]) =>
75 ifColumnId(cd.if, column.id) &&
76 (R.isNil(cd.if) ||
77 R.isNil(cd.if.filter_query) ||
78 this.evaluation.get(column.id, i)(
79 this.ast.get(column.id, i)(cd.if.filter_query),
80 datum
81 )),
82 R.addIndex<
83 IConditionalDropdown,

Callers

nothing calls this directly

Calls 3

memoizeOneFunction · 0.90
ifColumnIdFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…