Assorted builder fixes and a fix for Google sheets filtering
This commit is contained in:
parent
f7d47945ba
commit
2b9298963f
|
@ -102,7 +102,9 @@
|
|||
{onOptionMouseenter}
|
||||
{onOptionMouseleave}
|
||||
isPlaceholder={value == null || value === ""}
|
||||
placeholderOption={placeholder === false ? null : placeholder}
|
||||
placeholderOption={placeholder === false
|
||||
? null
|
||||
: placeholder || "Choose an option"}
|
||||
isOptionSelected={option => compareOptionAndValue(option, value)}
|
||||
onSelectOption={selectOption}
|
||||
{loading}
|
||||
|
|
|
@ -80,6 +80,7 @@ const componentMap = {
|
|||
"field/barcodeqr": FormFieldSelect,
|
||||
"field/signature_single": FormFieldSelect,
|
||||
"field/bb_reference": FormFieldSelect,
|
||||
"field/bb_reference_single": FormFieldSelect,
|
||||
// Some validation types are the same as others, so not all types are
|
||||
// explicitly listed here. e.g. options uses string validation
|
||||
"validation/string": ValidationEditor,
|
||||
|
|
|
@ -129,6 +129,11 @@
|
|||
width: 100%;
|
||||
min-width: unset;
|
||||
}
|
||||
.signature-cell img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.signature-cell.light img {
|
||||
-webkit-filter: invert(100%);
|
||||
filter: invert(100%);
|
||||
|
|
|
@ -566,7 +566,13 @@ class GoogleSheetsIntegration implements DatasourcePlus {
|
|||
query.filters.equal[`_${GOOGLE_SHEETS_PRIMARY_KEY}`] = id
|
||||
}
|
||||
}
|
||||
let filtered = dataFilters.runQuery(rows, query.filters || {})
|
||||
let filtered = dataFilters.runQuery(
|
||||
rows,
|
||||
query.filters || {},
|
||||
(row: GoogleSpreadsheetRow, headerKey: string) => {
|
||||
return row.get(headerKey)
|
||||
}
|
||||
)
|
||||
if (hasFilters && query.paginate) {
|
||||
filtered = filtered.slice(offset, offset + limit)
|
||||
}
|
||||
|
|
|
@ -393,8 +393,15 @@ export const search = (
|
|||
* Performs a client-side search on an array of data
|
||||
* @param docs the data
|
||||
* @param query the JSON query
|
||||
* @param findInDoc optional fn when trying to extract a value
|
||||
* from custom doc type e.g. Google Sheets
|
||||
*
|
||||
*/
|
||||
export const runQuery = (docs: Record<string, any>[], query: SearchFilters) => {
|
||||
export const runQuery = (
|
||||
docs: Record<string, any>[],
|
||||
query: SearchFilters,
|
||||
findInDoc: Function = deepGet
|
||||
) => {
|
||||
if (!docs || !Array.isArray(docs)) {
|
||||
return []
|
||||
}
|
||||
|
@ -419,7 +426,7 @@ export const runQuery = (docs: Record<string, any>[], query: SearchFilters) => {
|
|||
) =>
|
||||
(doc: Record<string, any>) => {
|
||||
for (const [key, testValue] of Object.entries(query[type] || {})) {
|
||||
const result = test(deepGet(doc, removeKeyNumbering(key)), testValue)
|
||||
const result = test(findInDoc(doc, removeKeyNumbering(key)), testValue)
|
||||
if (query.allOr && result) {
|
||||
return true
|
||||
} else if (!query.allOr && !result) {
|
||||
|
|
Loading…
Reference in New Issue