MCPcopy Index your code
hub / github.com/microsoft/SandDance / SearchTerm

Function SearchTerm

packages/sanddance-explorer/src/controls/searchTerm.tsx:146–233  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

144}
145
146export function SearchTerm(props: Props) {
147 const ex = props.searchExpression;
148 const possibleValues = getValues(ex, props.column, props.data, props.autoCompleteDistinctValues);
149
150 //TODO better date handling with calendar picker
151
152 return (
153 <div>
154 {props.index > 0 && (
155 <Dropdown
156 collapseLabel={props.collapseLabels}
157 className="search-field"
158 label={strings.labelSearchClause}
159 dropdownWidth={120}
160 disabled={!ex.unlocked || props.disableOR}
161 options={getExpressionClauses(ex.clause, props.disableOR)}
162 onChange={(e, o) => props.onUpdateExpression({ clause: (o.data as SearchExpressionClause) }, props.index)}
163 />
164 )}
165 <Dropdown
166 componentRef={props.dropdownRef}
167 collapseLabel={props.collapseLabels}
168 className="search-field"
169 label={strings.labelSearchColumn}
170 options={[
171 {
172 key: '',
173 text: strings.selectAny,
174 data: null,
175 selected: ex.name === null,
176 },
177 ].concat(props.columns.map((c, i) => ({
178 key: c.name,
179 text: c.name,
180 data: c,
181 selected: c.name === ex.name,
182 })))}
183 onChange={(e, o) => props.onUpdateExpression({ name: (o.data && (o.data as SandDance.types.Column).name) || null }, props.index)}
184 />
185 <Dropdown
186 collapseLabel={props.collapseLabels}
187 className="search-field"
188 label={strings.labelSearchOperator}
189 dropdownWidth={120}
190 options={getOperators(ex, props.column)}
191 onChange={(e, o) => props.onUpdateExpression({ operator: (o.data) as SearchExpressionOperators }, props.index)}
192 />
193 {possibleValues.length > 0 && (
194 <base.fluentUI.ComboBox
195 className="search-field"
196 label={props.collapseLabels ? null : strings.labelSearchValue}
197 placeholder={strings.labelSearchValuePlaceholder}
198 disabled={ex.operator === 'isnullorEmpty'}
199 dropdownWidth={dropdownWidth}
200 allowFreeform={true}
201 autoComplete="on"
202 errorMessage={ex.errorMessage}
203 text={getText(ex)}

Callers

nothing calls this directly

Calls 4

getValuesFunction · 0.70
getExpressionClausesFunction · 0.70
getOperatorsFunction · 0.70
getTextFunction · 0.70

Tested by

no test coverage detected