@stoker-platform/web-app 0.5.163 → 0.5.165
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 +15 -0
- package/package.json +4 -4
- package/src/Collection.tsx +18 -0
- package/src/Form.tsx +5 -2
- package/src/List.tsx +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.165
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add secondary sort feature
|
|
8
|
+
- @stoker-platform/node-client@0.5.66
|
|
9
|
+
- @stoker-platform/utils@0.5.57
|
|
10
|
+
- @stoker-platform/web-client@0.5.67
|
|
11
|
+
|
|
12
|
+
## 0.5.164
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- feat: provide previous to onChange
|
|
17
|
+
|
|
3
18
|
## 0.5.163
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.165",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"scripts": {
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
52
52
|
"@react-google-maps/api": "^2.20.8",
|
|
53
53
|
"@sentry/react": "^10.56.0",
|
|
54
|
-
"@stoker-platform/node-client": "0.5.
|
|
55
|
-
"@stoker-platform/utils": "0.5.
|
|
56
|
-
"@stoker-platform/web-client": "0.5.
|
|
54
|
+
"@stoker-platform/node-client": "0.5.66",
|
|
55
|
+
"@stoker-platform/utils": "0.5.57",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.67",
|
|
57
57
|
"@tanstack/react-table": "^8.21.3",
|
|
58
58
|
"@types/react": "18.3.13",
|
|
59
59
|
"@types/react-dom": "18.3.1",
|
package/src/Collection.tsx
CHANGED
|
@@ -183,6 +183,13 @@ function Collection({
|
|
|
183
183
|
}
|
|
184
184
|
| undefined
|
|
185
185
|
>(undefined)
|
|
186
|
+
const [secondarySort, setSecondarySort] = useState<
|
|
187
|
+
| {
|
|
188
|
+
field: string
|
|
189
|
+
direction?: "asc" | "desc"
|
|
190
|
+
}
|
|
191
|
+
| undefined
|
|
192
|
+
>(undefined)
|
|
186
193
|
|
|
187
194
|
const [state, setStokerState] = useStokerState()
|
|
188
195
|
const setState = useCallback(
|
|
@@ -1194,6 +1201,16 @@ function Collection({
|
|
|
1194
1201
|
}
|
|
1195
1202
|
| undefined
|
|
1196
1203
|
setDefaultSort(defaultSortOverride || defaultSort)
|
|
1204
|
+
const secondarySort = (await getCachedConfigValue(customization, [
|
|
1205
|
+
...collectionAdminPath,
|
|
1206
|
+
"secondarySort",
|
|
1207
|
+
])) as
|
|
1208
|
+
| {
|
|
1209
|
+
field: string
|
|
1210
|
+
direction?: "asc" | "desc"
|
|
1211
|
+
}
|
|
1212
|
+
| undefined
|
|
1213
|
+
setSecondarySort(secondarySort)
|
|
1197
1214
|
const sortState = state[`collection-sort-${labels.collection.toLowerCase()}`]
|
|
1198
1215
|
if (sortState && !relationList) {
|
|
1199
1216
|
const newSorting = JSON.parse(sortState)
|
|
@@ -2513,6 +2530,7 @@ function Collection({
|
|
|
2513
2530
|
setBackToStartKey={setBackToStartKey}
|
|
2514
2531
|
search={search}
|
|
2515
2532
|
defaultSort={defaultSort}
|
|
2533
|
+
secondarySort={secondarySort}
|
|
2516
2534
|
setOptimisticList={setOptimisticList}
|
|
2517
2535
|
relationList={relationList}
|
|
2518
2536
|
relationCollection={relationCollection}
|
package/src/Form.tsx
CHANGED
|
@@ -3733,6 +3733,8 @@ function RecordForm({
|
|
|
3733
3733
|
|
|
3734
3734
|
const suppressDraftSaveRef = useRef(false)
|
|
3735
3735
|
|
|
3736
|
+
const previous = useRef<StokerRecord | undefined>(undefined)
|
|
3737
|
+
|
|
3736
3738
|
useEffect(() => {
|
|
3737
3739
|
if (!(suppressDraftSaveRef?.current || !isDirty)) {
|
|
3738
3740
|
if (
|
|
@@ -3764,7 +3766,7 @@ function RecordForm({
|
|
|
3764
3766
|
tryPromise(customization.admin.onChange, [
|
|
3765
3767
|
operation,
|
|
3766
3768
|
cloneDeep(form.getValues()) as StokerRecord,
|
|
3767
|
-
|
|
3769
|
+
previous.current as StokerRecord,
|
|
3768
3770
|
]).then((updatedRecord: StokerRecord) => {
|
|
3769
3771
|
if (updatedRecord && !isEqual(updatedRecord, formValues)) {
|
|
3770
3772
|
Object.entries(updatedRecord).forEach(([key, value]) => {
|
|
@@ -3773,6 +3775,7 @@ function RecordForm({
|
|
|
3773
3775
|
}
|
|
3774
3776
|
})
|
|
3775
3777
|
}
|
|
3778
|
+
previous.current = cloneDeep(form.getValues()) as StokerRecord
|
|
3776
3779
|
}, 0)
|
|
3777
3780
|
}, [form.watch()])
|
|
3778
3781
|
|
|
@@ -5226,7 +5229,7 @@ function RecordForm({
|
|
|
5226
5229
|
Are you absolutely sure?
|
|
5227
5230
|
</AlertDialogTitle>
|
|
5228
5231
|
<AlertDialogDescription>
|
|
5229
|
-
{`This will remove system access for this ${
|
|
5232
|
+
{`This will remove system access for this ${recordTitle}.`}
|
|
5230
5233
|
</AlertDialogDescription>
|
|
5231
5234
|
</AlertDialogHeader>
|
|
5232
5235
|
<AlertDialogFooter>
|
package/src/List.tsx
CHANGED
|
@@ -212,6 +212,12 @@ interface ListProps {
|
|
|
212
212
|
direction?: "asc" | "desc"
|
|
213
213
|
}
|
|
214
214
|
| undefined
|
|
215
|
+
secondarySort:
|
|
216
|
+
| {
|
|
217
|
+
field: string
|
|
218
|
+
direction?: "asc" | "desc"
|
|
219
|
+
}
|
|
220
|
+
| undefined
|
|
215
221
|
setOptimisticList: () => void
|
|
216
222
|
relationList?: RelationList
|
|
217
223
|
relationCollection?: CollectionSchema
|
|
@@ -237,6 +243,7 @@ export function List({
|
|
|
237
243
|
setBackToStartKey,
|
|
238
244
|
search,
|
|
239
245
|
defaultSort,
|
|
246
|
+
secondarySort,
|
|
240
247
|
setOptimisticList,
|
|
241
248
|
relationList,
|
|
242
249
|
relationCollection,
|
|
@@ -838,7 +845,10 @@ export function List({
|
|
|
838
845
|
} else if (recordTitleField) {
|
|
839
846
|
setSorting([{ id: recordTitleField, desc: false }])
|
|
840
847
|
}
|
|
841
|
-
|
|
848
|
+
if ((isPreloadCacheEnabled || isServerReadOnly) && secondarySort) {
|
|
849
|
+
setSorting((prev) => [...prev, { id: secondarySort.field, desc: secondarySort.direction === "desc" }])
|
|
850
|
+
}
|
|
851
|
+
}, [table, recordTitleField, secondarySort, isPreloadCacheEnabled, isServerReadOnly])
|
|
842
852
|
|
|
843
853
|
useEffect(() => {
|
|
844
854
|
if (isPreloadCacheEnabled || isServerReadOnly) {
|