@budibase/frontend-core 3.20.6 → 3.20.7

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.20.6",
3
+ "version": "3.20.7",
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": "91ae7d82b9b1311754548f1447db8039b592f6b9"
20
+ "gitHead": "517230cd7ff9c137e3b121ef73c9f7726df4eeb1"
21
21
  }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ DuplicateWorkspaceAppResponse,
2
3
  FetchWorkspaceAppResponse,
3
4
  FindWorkspaceAppResponse,
4
5
  InsertWorkspaceAppRequest,
@@ -14,6 +15,7 @@ export interface WorkspaceAppEndpoints {
14
15
  create: (
15
16
  workspaceApp: InsertWorkspaceAppRequest
16
17
  ) => Promise<InsertWorkspaceAppResponse>
18
+ duplicate: (id: string) => Promise<DuplicateWorkspaceAppResponse>
17
19
  update: (
18
20
  workspaceApp: UpdateWorkspaceAppRequest
19
21
  ) => Promise<UpdateWorkspaceAppResponse>
@@ -39,6 +41,11 @@ export const buildWorkspaceAppEndpoints = (
39
41
  body: workspaceApp,
40
42
  })
41
43
  },
44
+ duplicate: async id => {
45
+ return await API.post({
46
+ url: `/api/workspaceApp/${id}/duplicate`,
47
+ })
48
+ },
42
49
  update: async workspaceApp => {
43
50
  return await API.put({
44
51
  url: `/api/workspaceApp/${workspaceApp._id}`,
@@ -48,12 +48,17 @@ export const deriveStores = (context: StoreContext): ConditionDerivedStore => {
48
48
 
49
49
  // Add button conditions
50
50
  if ($props.buttons) {
51
- for (let button of $props.buttons) {
51
+ for (
52
+ let buttonIndex = 0;
53
+ buttonIndex < $props.buttons.length;
54
+ buttonIndex++
55
+ ) {
56
+ const button = $props.buttons[buttonIndex]
52
57
  for (let condition of button.conditions || []) {
53
58
  newConditions.push({
54
59
  ...condition,
55
60
  target: "button",
56
- buttonIndex: $props.buttons.indexOf(button),
61
+ buttonIndex,
57
62
  })
58
63
  }
59
64
  }
@@ -161,14 +166,30 @@ const evaluateConditions = (
161
166
 
162
167
  // Add dynamic button conditions from getRowConditions
163
168
  if ($props.buttons) {
164
- for (let button of $props.buttons) {
165
- if (button.getRowConditions) {
166
- const dynamicConditions = button.getRowConditions(row) || []
169
+ for (
170
+ let buttonIndex = 0;
171
+ buttonIndex < $props.buttons.length;
172
+ buttonIndex++
173
+ ) {
174
+ const button = $props.buttons[buttonIndex]
175
+ if (!button.getRowConditions) {
176
+ continue
177
+ }
178
+
179
+ const dynamicConditions = button.getRowConditions(row) || []
180
+ if (dynamicConditions.length) {
181
+ allConditions = allConditions.filter(condition => {
182
+ return !(
183
+ condition.target === "button" &&
184
+ condition.buttonIndex === buttonIndex
185
+ )
186
+ })
187
+
167
188
  for (let condition of dynamicConditions) {
168
189
  allConditions.push({
169
190
  ...condition,
170
191
  target: "button",
171
- buttonIndex: $props.buttons.indexOf(button),
192
+ buttonIndex,
172
193
  })
173
194
  }
174
195
  }