Skip to content

Commit a5b4316

Browse files
authored
Merge pull request #1541 from rowyio/rc
Rc
2 parents f8e6aa8 + 147a7fa commit a5b4316

File tree

33 files changed

+280
-103
lines changed

33 files changed

+280
-103
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ https://user-images.githubusercontent.com/307298/157185793-f67511cd-7b7b-4229-95
101101

102102
Set up Rowy on your Google Cloud Platform project with this easy deploy button.
103103
Your data and cloud functions stay on your own Firestore/GCP and is managed via
104-
a cloud run instance that operates exclusively on your GCP project. So we do do
104+
a cloud run instance that operates exclusively on your GCP project. So we do
105105
not access or store any of your data on Rowy.
106106

107107
[<img width="200" alt="Guided quick start button" src="https://user-images.githubusercontent.com/307298/185548050-e9208fb6-fe53-4c84-bbfa-53c08e03c15f.png">](https://rowy.app/)

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"file-saver": "^2.0.5",
3535
"firebase": "^9.12.1",
3636
"firebaseui": "^6.0.1",
37+
"fuse.js": "^7.0.0",
3738
"jotai": "^1.8.4",
3839
"json-stable-stringify-without-jsonify": "^1.0.1",
3940
"jszip": "^3.10.0",

src/atoms/tableScope/rowActions.ts

+1-11
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,7 @@ export const updateFieldAtom = atom(
386386
);
387387

388388
if (!row) throw new Error("Could not find row");
389-
const isLocalRow =
390-
fieldName.startsWith("_rowy_formulaValue_") ||
391-
Boolean(find(tableRowsLocal, ["_rowy_ref.path", path]));
389+
const isLocalRow = Boolean(find(tableRowsLocal, ["_rowy_ref.path", path]));
392390

393391
const update: Partial<TableRow> = {};
394392

@@ -469,14 +467,6 @@ export const updateFieldAtom = atom(
469467
deleteFields: deleteField ? [fieldName] : [],
470468
});
471469

472-
// TODO(han): Formula field persistence
473-
// const config = find(tableColumnsOrdered, (c) => {
474-
// const [, key] = fieldName.split("_rowy_formulaValue_");
475-
// return c.key === key;
476-
// });
477-
// if(!config.persist) return;
478-
if (fieldName.startsWith("_rowy_formulaValue")) return;
479-
480470
// If it has no missingRequiredFields, also write to db
481471
// And write entire row to handle the case where it doesn’t exist in db yet
482472
if (missingRequiredFields.length === 0) {

src/components/ColumnModals/FieldsDropdown.tsx

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import MultiSelect from "@rowy/multiselect";
22
import { Box, ListItemIcon, Typography } from "@mui/material";
3+
import Fuse from 'fuse.js';
34

45
import { FIELDS } from "@src/components/fields";
56
import { FieldType } from "@src/constants/fields";
@@ -23,6 +24,15 @@ export interface IFieldsDropdownProps {
2324
[key: string]: any;
2425
}
2526

27+
export interface OptionsType {
28+
label: string;
29+
value: string;
30+
disabled: boolean;
31+
requireCloudFunctionSetup: boolean;
32+
requireCollectionTable: boolean;
33+
keywords: string[];
34+
}
35+
2636
/**
2737
* Returns dropdown component of all available types
2838
*/
@@ -52,9 +62,21 @@ export default function FieldsDropdown({
5262
disabled: requireCloudFunctionSetup || requireCollectionTable,
5363
requireCloudFunctionSetup,
5464
requireCollectionTable,
65+
keywords: fieldConfig.keywords || []
5566
};
5667
});
5768

69+
const filterOptions = (options: OptionsType[], inputConfig: any) => {
70+
const fuse = new Fuse(options, {
71+
keys: [{name:'label', weight: 2}, 'keywords'],
72+
includeScore: true,
73+
threshold: 0.4,
74+
});
75+
76+
const results = fuse.search(inputConfig?.inputValue);
77+
return results.length > 0 ? results.map((result) => result.item) : options;
78+
}
79+
5880
return (
5981
<MultiSelect
6082
multiple={false}
@@ -80,6 +102,7 @@ export default function FieldsDropdown({
80102
},
81103
},
82104
},
105+
filterOptions
83106
},
84107
} as any)}
85108
itemRenderer={(option) => (

src/components/Table/Table.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export default function Table({
121121
const [tablePage, setTablePage] = useAtom(tablePageAtom, tableScope);
122122
const setReactTable = useSetAtom(reactTableAtom, tableScope);
123123

124+
const setSelectedCell = useSetAtom(selectedCellAtom, tableScope);
124125
const updateColumn = useSetAtom(updateColumnAtom, tableScope);
125126

126127
// Get user settings and tableId for applying sort sorting
@@ -313,6 +314,8 @@ export default function Table({
313314

314315
const { scrollHeight, scrollTop, clientHeight } = containerElement;
315316
if (scrollHeight - scrollTop - clientHeight < 300) {
317+
// deselect cell on next page load
318+
setSelectedCell(null);
316319
setTablePage((p) => p + 1);
317320
}
318321
},

0 commit comments

Comments
 (0)