@budibase/frontend-core 3.11.2 → 3.12.0

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.11.2",
3
+ "version": "3.12.0",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -17,5 +17,5 @@
17
17
  "shortid": "2.2.15",
18
18
  "socket.io-client": "^4.7.5"
19
19
  },
20
- "gitHead": "4c2f13e1b36fa559124df22462d83d2b4d1e7e9d"
20
+ "gitHead": "4d3f7719ab1ae02d3d01908b8a14a31a0c81445d"
21
21
  }
package/src/api/index.ts CHANGED
@@ -48,6 +48,7 @@ import { buildRowActionEndpoints } from "./rowActions"
48
48
  import { buildOAuth2Endpoints } from "./oauth2"
49
49
  import { buildAgentEndpoints } from "./agents"
50
50
  import { buildFeatureFlagEndpoints } from "./features"
51
+ import { buildNavigationEndpoints } from "./navigation"
51
52
 
52
53
  export type { APIClient } from "./types"
53
54
 
@@ -296,5 +297,6 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
296
297
  viewV2: buildViewV2Endpoints(API),
297
298
  rowActions: buildRowActionEndpoints(API),
298
299
  oauth2: buildOAuth2Endpoints(API),
300
+ navigation: buildNavigationEndpoints(API),
299
301
  }
300
302
  }
@@ -0,0 +1,17 @@
1
+ import { BaseAPIClient } from "./types"
2
+ import { AppNavigation, UpdateNavigationRequest } from "@budibase/types"
3
+
4
+ export interface NavigationEndpoints {
5
+ updateNavigation: (appId: string, navigation: AppNavigation) => Promise<void>
6
+ }
7
+
8
+ export const buildNavigationEndpoints = (
9
+ API: BaseAPIClient
10
+ ): NavigationEndpoints => ({
11
+ updateNavigation: async (appId: string, navigation: AppNavigation) => {
12
+ return await API.put<UpdateNavigationRequest>({
13
+ url: `/api/navigation/${appId}`,
14
+ body: { navigation },
15
+ })
16
+ },
17
+ })
package/src/api/types.ts CHANGED
@@ -35,6 +35,7 @@ import { UserEndpoints } from "./user"
35
35
  import { ViewEndpoints } from "./views"
36
36
  import { ViewV2Endpoints } from "./viewsV2"
37
37
  import { AgentEndpoints } from "./agents"
38
+ import { NavigationEndpoints } from "./navigation"
38
39
 
39
40
  export enum HTTPMethod {
40
41
  POST = "POST",
@@ -66,7 +67,7 @@ export type APICallConfig<RequestT, ResponseT> = {
66
67
 
67
68
  export type APICallParams<
68
69
  RequestT = null,
69
- ResponseT = void
70
+ ResponseT = void,
70
71
  > = RequestT extends null
71
72
  ? Pick<APICallConfig<RequestT, ResponseT>, "url"> &
72
73
  Partial<APICallConfig<RequestT, ResponseT>>
@@ -141,4 +142,5 @@ export type APIClient = BaseAPIClient &
141
142
  rowActions: RowActionEndpoints
142
143
  viewV2: ViewV2Endpoints
143
144
  oauth2: OAuth2Endpoints
145
+ navigation: NavigationEndpoints
144
146
  }
@@ -155,8 +155,8 @@
155
155
  width: 31px;
156
156
  color: var(--spectrum-alias-text-color);
157
157
  background-color: var(--spectrum-global-color-gray-75);
158
- transition: background-color
159
- var(--spectrum-global-animation-duration-100, 130ms),
158
+ transition:
159
+ background-color var(--spectrum-global-animation-duration-100, 130ms),
160
160
  box-shadow var(--spectrum-global-animation-duration-100, 130ms),
161
161
  border-color var(--spectrum-global-animation-duration-100, 130ms);
162
162
  height: calc(var(--spectrum-alias-item-height-m));
@@ -298,8 +298,8 @@
298
298
  width: 31px;
299
299
  color: var(--spectrum-alias-text-color);
300
300
  background-color: var(--spectrum-global-color-gray-75);
301
- transition: background-color
302
- var(--spectrum-global-animation-duration-100, 130ms),
301
+ transition:
302
+ background-color var(--spectrum-global-animation-duration-100, 130ms),
303
303
  box-shadow var(--spectrum-global-animation-duration-100, 130ms),
304
304
  border-color var(--spectrum-global-animation-duration-100, 130ms);
305
305
  height: calc(var(--spectrum-alias-item-height-m));
@@ -7,7 +7,7 @@ import {
7
7
  } from "@budibase/types"
8
8
 
9
9
  interface DatasourceBaseActions<
10
- TSaveDefinitionRequest = UpdateViewRequest | SaveTableRequest
10
+ TSaveDefinitionRequest = UpdateViewRequest | SaveTableRequest,
11
11
  > {
12
12
  saveDefinition: (newDefinition: TSaveDefinitionRequest) => Promise<void>
13
13
  addRow: (row: SaveRowRequest) => Promise<UIRow | undefined>
@@ -27,5 +27,6 @@ export interface DatasourceViewActions
27
27
  export interface DatasourceNonPlusActions
28
28
  extends DatasourceBaseActions<never> {}
29
29
 
30
- export type DatasourceActions =
31
- | DatasourceTableActions & DatasourceViewActions & DatasourceNonPlusActions
30
+ export type DatasourceActions = DatasourceTableActions &
31
+ DatasourceViewActions &
32
+ DatasourceNonPlusActions
@@ -61,7 +61,7 @@ export default abstract class BaseDataFetch<
61
61
  schema?: Record<string, any> | null
62
62
  primaryDisplay?: string
63
63
  },
64
- TQuery extends {} = SearchFilters
64
+ TQuery extends {} = SearchFilters,
65
65
  > {
66
66
  API: APIClient
67
67
  features: {
@@ -18,7 +18,7 @@ export default class FieldFetch<
18
18
  TDatasource extends
19
19
  | FieldDatasource
20
20
  | QueryArrayFieldDatasource
21
- | JSONArrayFieldDatasource = FieldDatasource
21
+ | JSONArrayFieldDatasource = FieldDatasource,
22
22
  > extends BaseDataFetch<TDatasource, FieldDefinition> {
23
23
  async getDefinition(): Promise<FieldDefinition | null> {
24
24
  const { datasource } = this.options
@@ -78,7 +78,7 @@ export type DataFetchDefinition =
78
78
  // Constructs a new fetch model for a certain datasource
79
79
  export const fetchData = <
80
80
  T extends DataFetchDatasource,
81
- Type extends T["type"] = T["type"]
81
+ Type extends T["type"] = T["type"],
82
82
  >({
83
83
  API,
84
84
  datasource,
@@ -60,10 +60,10 @@ export function format(json: JSONValue, colorOptions: ColorsOptions = {}) {
60
60
  color = /true/.test(match)
61
61
  ? colors.trueColor
62
62
  : /false/.test(match)
63
- ? colors.falseColor
64
- : /null/.test(match)
65
- ? colors.nullColor
66
- : color
63
+ ? colors.falseColor
64
+ : /null/.test(match)
65
+ ? colors.nullColor
66
+ : color
67
67
  }
68
68
  return `<span style="${style}color:${color}">${match}</span>`
69
69
  }
@@ -19,7 +19,7 @@ export const sleep = (ms: number) =>
19
19
  */
20
20
  export const sequential = <
21
21
  TReturn,
22
- TFunction extends (...args: any[]) => Promise<TReturn>
22
+ TFunction extends (...args: any[]) => Promise<TReturn>,
23
23
  >(
24
24
  fn: TFunction
25
25
  ): TFunction => {