@stoker-platform/web-app 0.5.146 → 0.5.148
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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/Filters.tsx +5 -2
- package/src/Form.tsx +11 -5
- package/src/PermissionPicker.tsx +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.148
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: add isMobile to data retrieval function dependency arrays
|
|
8
|
+
|
|
9
|
+
## 0.5.147
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- feat: increase relation picker item size
|
|
14
|
+
|
|
3
15
|
## 0.5.146
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
package/src/Filters.tsx
CHANGED
|
@@ -314,9 +314,10 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
314
314
|
if (isCollectionPreloadCacheEnabled && query) {
|
|
315
315
|
const searchResults = localFullTextSearch(collectionSchema, query, data.records)
|
|
316
316
|
const objectIds = searchResults.map((result) => result.id)
|
|
317
|
+
const numberOfResults = isMobile ? 20 : 10
|
|
317
318
|
setData((prev) => ({
|
|
318
319
|
...prev,
|
|
319
|
-
[field]: data.records.filter((doc) => objectIds.includes(doc.id)).slice(0,
|
|
320
|
+
[field]: data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults),
|
|
320
321
|
}))
|
|
321
322
|
} else {
|
|
322
323
|
setData((prev) => ({
|
|
@@ -334,7 +335,7 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
334
335
|
}))
|
|
335
336
|
})
|
|
336
337
|
},
|
|
337
|
-
[],
|
|
338
|
+
[isMobile],
|
|
338
339
|
)
|
|
339
340
|
|
|
340
341
|
const debounceTimeout = useRef<NodeJS.Timeout>()
|
|
@@ -613,6 +614,7 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
613
614
|
<CommandGroup>
|
|
614
615
|
{data[filter.field] && (
|
|
615
616
|
<CommandItem
|
|
617
|
+
className={cn(isMobile ? "p-3" : undefined)}
|
|
616
618
|
key="no_selection"
|
|
617
619
|
value="no_selection"
|
|
618
620
|
onSelect={(currentValue) => {
|
|
@@ -646,6 +648,7 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
646
648
|
)}
|
|
647
649
|
{data[filter.field]?.map((record: StokerRecord) => (
|
|
648
650
|
<CommandItem
|
|
651
|
+
className={cn(isMobile ? "p-3" : undefined)}
|
|
649
652
|
key={record.id}
|
|
650
653
|
value={record.id}
|
|
651
654
|
onSelect={(currentValue) => {
|
package/src/Form.tsx
CHANGED
|
@@ -1926,6 +1926,8 @@ function RelationField({
|
|
|
1926
1926
|
initialize()
|
|
1927
1927
|
}, [])
|
|
1928
1928
|
|
|
1929
|
+
const isMobile = useIsMobile()
|
|
1930
|
+
|
|
1929
1931
|
const getData = useCallback(
|
|
1930
1932
|
async (query: string | undefined, constraints: [string, "==" | "in", unknown][] = []) => {
|
|
1931
1933
|
setIsLoadingImmediate(true)
|
|
@@ -2025,9 +2027,12 @@ function RelationField({
|
|
|
2025
2027
|
return !!fieldCustomization.admin?.filterResults?.(result, collection, record)
|
|
2026
2028
|
})
|
|
2027
2029
|
const objectIds = searchResults.map((result) => result.id)
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2030
|
+
const numberOfResults = isMobile ? 20 : 10
|
|
2031
|
+
orderData(data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults)).then(
|
|
2032
|
+
(data) => {
|
|
2033
|
+
setData(data)
|
|
2034
|
+
},
|
|
2035
|
+
)
|
|
2031
2036
|
} else {
|
|
2032
2037
|
orderData(
|
|
2033
2038
|
data.records
|
|
@@ -2049,7 +2054,7 @@ function RelationField({
|
|
|
2049
2054
|
setIsLoading(false)
|
|
2050
2055
|
})
|
|
2051
2056
|
},
|
|
2052
|
-
[record, form],
|
|
2057
|
+
[record, form, isMobile],
|
|
2053
2058
|
)
|
|
2054
2059
|
|
|
2055
2060
|
const handleOneToChange = useCallback(
|
|
@@ -2111,7 +2116,6 @@ function RelationField({
|
|
|
2111
2116
|
popoverHeight = "h-48"
|
|
2112
2117
|
}
|
|
2113
2118
|
|
|
2114
|
-
const isMobile = useIsMobile()
|
|
2115
2119
|
const { offset: keyboardOffset, viewportHeight } = useKeyboardOffset(isMobile && isOpen)
|
|
2116
2120
|
const sheetHeight = Math.max(240, Math.min(viewportHeight - 16, viewportHeight * 0.9))
|
|
2117
2121
|
|
|
@@ -2165,6 +2169,7 @@ function RelationField({
|
|
|
2165
2169
|
<CommandGroup>
|
|
2166
2170
|
{data && ["OneToOne", "OneToMany"].includes(field.type) && (
|
|
2167
2171
|
<CommandItem
|
|
2172
|
+
className={cn(isMobile ? "p-3" : undefined)}
|
|
2168
2173
|
key="no_selection"
|
|
2169
2174
|
value="no_selection"
|
|
2170
2175
|
onSelect={(currentValue: string) => {
|
|
@@ -2183,6 +2188,7 @@ function RelationField({
|
|
|
2183
2188
|
)}
|
|
2184
2189
|
{data?.map((relationRecord: StokerRecord) => (
|
|
2185
2190
|
<CommandItem
|
|
2191
|
+
className={cn(isMobile ? "p-3" : undefined)}
|
|
2186
2192
|
key={relationRecord.id}
|
|
2187
2193
|
value={relationRecord.id}
|
|
2188
2194
|
onSelect={(currentValue) => {
|
package/src/PermissionPicker.tsx
CHANGED
|
@@ -74,6 +74,8 @@ export const PermissionPicker = ({
|
|
|
74
74
|
|
|
75
75
|
const pickerDebounceTimeout = useRef<NodeJS.Timeout>()
|
|
76
76
|
|
|
77
|
+
const isMobile = useIsMobile()
|
|
78
|
+
|
|
77
79
|
const getData = useCallback(
|
|
78
80
|
async (query: string | undefined, constraints: [string, "==" | "in", unknown][] = []) => {
|
|
79
81
|
setIsLoadingImmediate(true)
|
|
@@ -140,7 +142,8 @@ export const PermissionPicker = ({
|
|
|
140
142
|
if (isCollectionPreloadCacheEnabled && query) {
|
|
141
143
|
const searchResults = localFullTextSearch(collection, query, data.records)
|
|
142
144
|
const objectIds = searchResults.map((result) => result.id)
|
|
143
|
-
|
|
145
|
+
const numberOfResults = isMobile ? 20 : 10
|
|
146
|
+
setData(data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults))
|
|
144
147
|
} else {
|
|
145
148
|
setData(data.records.slice(0, 10))
|
|
146
149
|
}
|
|
@@ -148,7 +151,7 @@ export const PermissionPicker = ({
|
|
|
148
151
|
setIsLoading(false)
|
|
149
152
|
})
|
|
150
153
|
},
|
|
151
|
-
[],
|
|
154
|
+
[isMobile],
|
|
152
155
|
)
|
|
153
156
|
|
|
154
157
|
const debounceTimeout = useRef<NodeJS.Timeout>()
|
|
@@ -333,7 +336,6 @@ export const PermissionPicker = ({
|
|
|
333
336
|
popoverHeight = "h-48"
|
|
334
337
|
}
|
|
335
338
|
|
|
336
|
-
const isMobile = useIsMobile()
|
|
337
339
|
const { offset: keyboardOffset, viewportHeight } = useKeyboardOffset(isMobile && isOpen)
|
|
338
340
|
const sheetHeight = Math.max(240, Math.min(viewportHeight - 16, viewportHeight * 0.9))
|
|
339
341
|
|
|
@@ -387,6 +389,7 @@ export const PermissionPicker = ({
|
|
|
387
389
|
<CommandGroup>
|
|
388
390
|
{data && (
|
|
389
391
|
<CommandItem
|
|
392
|
+
className={cn(isMobile ? "p-3" : undefined)}
|
|
390
393
|
key="no_selection"
|
|
391
394
|
value="no_selection"
|
|
392
395
|
onSelect={(currentValue) => {
|
|
@@ -402,6 +405,7 @@ export const PermissionPicker = ({
|
|
|
402
405
|
)}
|
|
403
406
|
{data?.map((record: StokerRecord) => (
|
|
404
407
|
<CommandItem
|
|
408
|
+
className={cn(isMobile ? "p-3" : undefined)}
|
|
405
409
|
key={record.id}
|
|
406
410
|
value={record.id}
|
|
407
411
|
onSelect={(currentValue) => {
|