@marktiderman/genesis-ui-native 3.5.0 → 3.5.1
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": "@marktiderman/genesis-ui-native",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@expo/ui": ">=58.0.0",
|
|
84
84
|
"@gorhom/bottom-sheet": ">=5.0.0",
|
|
85
85
|
"@hookform/resolvers": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
|
|
86
|
-
"@marktiderman/genesis-core": "^2.
|
|
86
|
+
"@marktiderman/genesis-core": "^2.10.0",
|
|
87
87
|
"@marktiderman/genesis-design-system": "^1.7.0",
|
|
88
88
|
"@react-native-community/datetimepicker": ">=8.0.0",
|
|
89
89
|
"@shopify/flash-list": ">=2.0.0",
|
|
@@ -47,7 +47,7 @@ export function NativeLinkPicker({ field, value, onChange, values, error, testID
|
|
|
47
47
|
const filters = useMemo(() => JSON.parse(filtersKey) as ReturnType<typeof link.filters>, [filtersKey]);
|
|
48
48
|
const labelField = field.labelField ?? link.labelField;
|
|
49
49
|
const list = useLinkOptions(
|
|
50
|
-
{ resource: link.resource, field: link.field, labelField, searchFields: link.searchFields },
|
|
50
|
+
{ resource: link.resource, field: link.field, labelField, searchFields: link.searchFields, orderBy: link.orderBy },
|
|
51
51
|
{ filters, search, enabled: open, untitled: words.untitled! },
|
|
52
52
|
);
|
|
53
53
|
|
|
@@ -191,6 +191,22 @@ describe("a link's picker in the native form sheet", () => {
|
|
|
191
191
|
expect(fields.find((f) => f.key === "reviewer_id")!.link!.filters({ orgId: "o1" })).toHaveLength(2);
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
+
it('lists the rows in the linked view\'s order with orderBy: "view", held to a list filter too', async () => {
|
|
195
|
+
const ranked = defineView(people, { scope: ["org_id"], orderBy: { field: "full_name", direction: "desc" } });
|
|
196
|
+
const v = defineView(tasks, { scope: ["org_id"], form: ["title", "owner_id"], fields: { owner_id: { label: "Owner", link: { view: ranked, orderBy: "view" } } } });
|
|
197
|
+
expect(formFieldsFor(v, "edit", { within: { owner_id: ["ada"] } }).find((f) => f.key === "owner_id")!.link!.orderBy).toEqual({
|
|
198
|
+
field: "full_name",
|
|
199
|
+
direction: "desc",
|
|
200
|
+
});
|
|
201
|
+
const { Wrapper, peopleLists } = setup();
|
|
202
|
+
render(<NativeResourceView view={v} />, { wrapper: Wrapper });
|
|
203
|
+
fireEvent.click(await screen.findByTestId("native-resource-view-create"));
|
|
204
|
+
const form = await screen.findByTestId("native-resource-view-form");
|
|
205
|
+
fireEvent.click(within(form).getByTestId(`${field("owner_id")}-trigger`));
|
|
206
|
+
await waitFor(() => expect(peopleLists().length).toBeGreaterThan(0));
|
|
207
|
+
expect(peopleLists()[0]![1].sort).toEqual({ field: "full_name", order: "desc" });
|
|
208
|
+
});
|
|
209
|
+
|
|
194
210
|
it("holds the picker to a screen's list filter", async () => {
|
|
195
211
|
const { Wrapper } = setup();
|
|
196
212
|
const { result } = renderHook(() => useNativeResourceView(tasksView, { filter: { owner_id: ["ada", "grace"] } }), { wrapper: Wrapper });
|
|
@@ -266,6 +266,9 @@ function heldTo(link: ResolvedLink, keys: readonly (string | number)[] | undefin
|
|
|
266
266
|
get labelField() {
|
|
267
267
|
return link.labelField;
|
|
268
268
|
},
|
|
269
|
+
get orderBy() {
|
|
270
|
+
return link.orderBy;
|
|
271
|
+
},
|
|
269
272
|
...(link.searchFields ? { searchFields: link.searchFields } : {}),
|
|
270
273
|
filters: (scope?: Parameters<ResolvedLink["filters"]>[0], values?: Parameters<ResolvedLink["filters"]>[1]) => [...link.filters(scope, values), held],
|
|
271
274
|
});
|