@budibase/frontend-core 3.5.0 → 3.5.2

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": "@budibase/frontend-core",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -17,8 +17,5 @@
17
17
  "shortid": "2.2.15",
18
18
  "socket.io-client": "^4.7.5"
19
19
  },
20
- "devDependencies": {
21
- "svelte-check": "^4.1.0"
22
- },
23
- "gitHead": "fe6e04cd92a531e0a9b2c4c3b1915c84c5a74ac3"
20
+ "gitHead": "2d3a130fceeb689d3013606dde57bab8db41c586"
24
21
  }
@@ -8,7 +8,6 @@ import {
8
8
  Row,
9
9
  SearchFilters,
10
10
  SortOrder,
11
- SortType,
12
11
  TableSchema,
13
12
  } from "@budibase/types"
14
13
  import { APIClient } from "../api/types"
@@ -72,8 +71,6 @@ export default abstract class BaseDataFetch<
72
71
  options: DataFetchOptions<TQuery> & {
73
72
  datasource: TDatasource
74
73
 
75
- sortType: SortType | null
76
-
77
74
  // Client side feature customisation
78
75
  clientSideSearching: boolean
79
76
  clientSideSorting: boolean
@@ -106,7 +103,6 @@ export default abstract class BaseDataFetch<
106
103
  // Sorting config
107
104
  sortColumn: null,
108
105
  sortOrder: SortOrder.ASCENDING,
109
- sortType: null,
110
106
 
111
107
  // Pagination config
112
108
  paginate: true,
@@ -227,31 +223,12 @@ export default abstract class BaseDataFetch<
227
223
  this.options.sortColumn = this.getDefaultSortColumn(definition, schema)
228
224
  }
229
225
 
230
- // If we don't have a sort column specified then just ensure we don't set
231
- // any sorting params
232
- if (!this.options.sortColumn) {
226
+ // If no sort order, default to ascending
227
+ if (!this.options.sortOrder) {
233
228
  this.options.sortOrder = SortOrder.ASCENDING
234
- this.options.sortType = null
235
229
  } else {
236
- // Otherwise determine what sort type to use base on sort column
237
- this.options.sortType = SortType.STRING
238
- const fieldSchema = schema?.[this.options.sortColumn]
239
- if (
240
- fieldSchema?.type === FieldType.NUMBER ||
241
- fieldSchema?.type === FieldType.BIGINT ||
242
- ("calculationType" in fieldSchema && fieldSchema?.calculationType)
243
- ) {
244
- this.options.sortType = SortType.NUMBER
245
- }
246
-
247
- // If no sort order, default to ascending
248
- if (!this.options.sortOrder) {
249
- this.options.sortOrder = SortOrder.ASCENDING
250
- } else {
251
- // Ensure sortOrder matches the enum
252
- this.options.sortOrder =
253
- this.options.sortOrder.toLowerCase() as SortOrder
254
- }
230
+ // Ensure sortOrder matches the enum
231
+ this.options.sortOrder = this.options.sortOrder.toLowerCase() as SortOrder
255
232
  }
256
233
 
257
234
  // Build the query
@@ -294,7 +271,6 @@ export default abstract class BaseDataFetch<
294
271
  const {
295
272
  sortColumn,
296
273
  sortOrder,
297
- sortType,
298
274
  limit,
299
275
  clientSideSearching,
300
276
  clientSideSorting,
@@ -311,8 +287,8 @@ export default abstract class BaseDataFetch<
311
287
  }
312
288
 
313
289
  // If we don't support sorting, do a client-side sort
314
- if (!this.features.supportsSort && clientSideSorting && sortType) {
315
- rows = sort(rows, sortColumn as any, sortOrder, sortType)
290
+ if (!this.features.supportsSort && clientSideSorting && sortColumn) {
291
+ rows = sort(rows, sortColumn, sortOrder)
316
292
  }
317
293
 
318
294
  // If we don't support pagination, do a client-side limit
@@ -29,8 +29,7 @@ export default class TableFetch extends BaseDataFetch<TableDatasource, Table> {
29
29
  }
30
30
 
31
31
  async getData() {
32
- const { datasource, limit, sortColumn, sortOrder, sortType, paginate } =
33
- this.options
32
+ const { datasource, limit, sortColumn, sortOrder, paginate } = this.options
34
33
  const { tableId } = datasource
35
34
  const { cursor, query } = get(this.store)
36
35
 
@@ -41,7 +40,6 @@ export default class TableFetch extends BaseDataFetch<TableDatasource, Table> {
41
40
  limit,
42
41
  sort: sortColumn,
43
42
  sortOrder: sortOrder ?? SortOrder.ASCENDING,
44
- sortType,
45
43
  paginate,
46
44
  bookmark: cursor,
47
45
  })
@@ -1,4 +1,5 @@
1
1
  import {
2
+ SearchViewRowRequest,
2
3
  SortOrder,
3
4
  ViewDatasource,
4
5
  ViewV2Enriched,
@@ -40,8 +41,7 @@ export default class ViewV2Fetch extends BaseDataFetch<
40
41
  }
41
42
 
42
43
  async getData() {
43
- const { datasource, limit, sortColumn, sortOrder, sortType, paginate } =
44
- this.options
44
+ const { datasource, limit, sortColumn, sortOrder, paginate } = this.options
45
45
  const { cursor, query, definition } = get(this.store)
46
46
 
47
47
  // If this is a calculation view and we have no calculations, return nothing
@@ -68,14 +68,13 @@ export default class ViewV2Fetch extends BaseDataFetch<
68
68
  }
69
69
 
70
70
  try {
71
- const request = {
71
+ const request: SearchViewRowRequest = {
72
72
  query,
73
73
  paginate,
74
74
  limit,
75
75
  bookmark: cursor,
76
76
  sort: sortColumn,
77
77
  sortOrder: sortOrder,
78
- sortType,
79
78
  }
80
79
  if (paginate) {
81
80
  const res = await this.API.viewV2.fetch(datasource.id, {
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createAPIClient } from "./api"
2
2
  export type { APIClient } from "./api"
3
- export { fetchData, DataFetchMap } from "./fetch"
3
+ export { fetchData, DataFetchMap, type DataFetchType } from "./fetch"
4
4
  export * as Constants from "./constants"
5
5
  export * from "./stores"
6
6
  export * from "./utils"
@@ -0,0 +1,7 @@
1
+ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
2
+
3
+ const config = {
4
+ preprocess: vitePreprocess(),
5
+ }
6
+
7
+ export default config