@budibase/frontend-core 2.6.16-alpha.1 → 2.6.16
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 +4 -4
- package/src/api/groups.js +0 -17
- package/src/components/grid/cells/DataCell.svelte +0 -1
- package/src/components/grid/cells/DateCell.svelte +0 -29
- package/src/components/grid/overlays/MenuOverlay.svelte +4 -34
- package/src/components/grid/stores/rows.js +6 -2
- package/src/fetch/DataFetch.js +1 -23
- package/src/fetch/fetchData.js +0 -2
- package/src/fetch/GroupUserFetch.js +0 -51
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "2.6.16
|
|
3
|
+
"version": "2.6.16",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
7
7
|
"svelte": "src/index.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@budibase/bbui": "2.6.16
|
|
10
|
-
"@budibase/shared-core": "2.6.16
|
|
9
|
+
"@budibase/bbui": "^2.6.16",
|
|
10
|
+
"@budibase/shared-core": "^2.6.16",
|
|
11
11
|
"dayjs": "^1.11.7",
|
|
12
12
|
"lodash": "^4.17.21",
|
|
13
13
|
"socket.io-client": "^4.6.1",
|
|
14
14
|
"svelte": "^3.46.2"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "d43a6a44bd074e077ea131303c0f7a2b0e0ddb75"
|
|
17
17
|
}
|
package/src/api/groups.js
CHANGED
|
@@ -52,23 +52,6 @@ export const buildGroupsEndpoints = API => {
|
|
|
52
52
|
})
|
|
53
53
|
},
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* Gets a group users by the group id
|
|
57
|
-
*/
|
|
58
|
-
getGroupUsers: async ({ id, bookmark, emailSearch }) => {
|
|
59
|
-
let url = `/api/global/groups/${id}/users?`
|
|
60
|
-
if (bookmark) {
|
|
61
|
-
url += `bookmark=${bookmark}&`
|
|
62
|
-
}
|
|
63
|
-
if (emailSearch) {
|
|
64
|
-
url += `emailSearch=${emailSearch}&`
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return await API.get({
|
|
68
|
-
url,
|
|
69
|
-
})
|
|
70
|
-
},
|
|
71
|
-
|
|
72
55
|
/**
|
|
73
56
|
* Adds users to a group
|
|
74
57
|
* @param groupId The group to update
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import dayjs from "dayjs"
|
|
3
3
|
import { CoreDatePicker, Icon } from "@budibase/bbui"
|
|
4
|
-
import { onMount } from "svelte"
|
|
5
4
|
|
|
6
5
|
export let value
|
|
7
6
|
export let schema
|
|
8
7
|
export let onChange
|
|
9
8
|
export let focused = false
|
|
10
9
|
export let readonly = false
|
|
11
|
-
export let api
|
|
12
|
-
|
|
13
|
-
let flatpickr
|
|
14
|
-
let isOpen
|
|
15
10
|
|
|
16
11
|
// adding the 0- will turn a string like 00:00:00 into a valid ISO
|
|
17
12
|
// date, but will make actual ISO dates invalid
|
|
@@ -24,26 +19,6 @@
|
|
|
24
19
|
? "MMM D YYYY"
|
|
25
20
|
: "MMM D YYYY, HH:mm"
|
|
26
21
|
$: editable = focused && !readonly
|
|
27
|
-
|
|
28
|
-
// Ensure we close flatpickr when unselected
|
|
29
|
-
$: {
|
|
30
|
-
if (!focused) {
|
|
31
|
-
flatpickr?.close()
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const onKeyDown = () => {
|
|
36
|
-
return isOpen
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
onMount(() => {
|
|
40
|
-
api = {
|
|
41
|
-
onKeyDown,
|
|
42
|
-
focus: () => flatpickr?.open(),
|
|
43
|
-
blur: () => flatpickr?.close(),
|
|
44
|
-
isActive: () => isOpen,
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
22
|
</script>
|
|
48
23
|
|
|
49
24
|
<div class="container">
|
|
@@ -67,10 +42,6 @@
|
|
|
67
42
|
{timeOnly}
|
|
68
43
|
time24hr
|
|
69
44
|
ignoreTimezones={schema.ignoreTimezones}
|
|
70
|
-
bind:flatpickr
|
|
71
|
-
on:open={() => (isOpen = true)}
|
|
72
|
-
on:close={() => (isOpen = false)}
|
|
73
|
-
useKeyboardShortcuts={false}
|
|
74
45
|
/>
|
|
75
46
|
</div>
|
|
76
47
|
{/if}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
3
|
-
clickOutside,
|
|
4
|
-
Menu,
|
|
5
|
-
MenuItem,
|
|
6
|
-
Helpers,
|
|
7
|
-
notifications,
|
|
8
|
-
} from "@budibase/bbui"
|
|
2
|
+
import { clickOutside, Menu, MenuItem, notifications } from "@budibase/bbui"
|
|
9
3
|
import { getContext } from "svelte"
|
|
10
|
-
import { NewRowID } from "../lib/constants"
|
|
11
4
|
|
|
12
5
|
const {
|
|
13
6
|
focusedRow,
|
|
@@ -21,11 +14,9 @@
|
|
|
21
14
|
clipboard,
|
|
22
15
|
dispatch,
|
|
23
16
|
focusedCellAPI,
|
|
24
|
-
focusedRowId,
|
|
25
17
|
} = getContext("grid")
|
|
26
18
|
|
|
27
19
|
$: style = makeStyle($menu)
|
|
28
|
-
$: isNewRow = $focusedRowId === NewRowID
|
|
29
20
|
|
|
30
21
|
const makeStyle = menu => {
|
|
31
22
|
return `left:${menu.left}px; top:${menu.top}px;`
|
|
@@ -45,11 +36,6 @@
|
|
|
45
36
|
$focusedCellId = `${newRow._id}-${column}`
|
|
46
37
|
}
|
|
47
38
|
}
|
|
48
|
-
|
|
49
|
-
const copyToClipboard = async value => {
|
|
50
|
-
await Helpers.copyToClipboard(value)
|
|
51
|
-
notifications.success("Copied to clipboard")
|
|
52
|
-
}
|
|
53
39
|
</script>
|
|
54
40
|
|
|
55
41
|
{#if $menu.visible}
|
|
@@ -72,38 +58,22 @@
|
|
|
72
58
|
</MenuItem>
|
|
73
59
|
<MenuItem
|
|
74
60
|
icon="Maximize"
|
|
75
|
-
disabled={
|
|
61
|
+
disabled={!$config.allowEditRows}
|
|
76
62
|
on:click={() => dispatch("edit-row", $focusedRow)}
|
|
77
63
|
on:click={menu.actions.close}
|
|
78
64
|
>
|
|
79
65
|
Edit row in modal
|
|
80
66
|
</MenuItem>
|
|
81
|
-
<MenuItem
|
|
82
|
-
icon="Copy"
|
|
83
|
-
disabled={isNewRow || !$focusedRow?._id}
|
|
84
|
-
on:click={() => copyToClipboard($focusedRow?._id)}
|
|
85
|
-
on:click={menu.actions.close}
|
|
86
|
-
>
|
|
87
|
-
Copy row _id
|
|
88
|
-
</MenuItem>
|
|
89
|
-
<MenuItem
|
|
90
|
-
icon="Copy"
|
|
91
|
-
disabled={isNewRow || !$focusedRow?._rev}
|
|
92
|
-
on:click={() => copyToClipboard($focusedRow?._rev)}
|
|
93
|
-
on:click={menu.actions.close}
|
|
94
|
-
>
|
|
95
|
-
Copy row _rev
|
|
96
|
-
</MenuItem>
|
|
97
67
|
<MenuItem
|
|
98
68
|
icon="Duplicate"
|
|
99
|
-
disabled={
|
|
69
|
+
disabled={!$config.allowAddRows}
|
|
100
70
|
on:click={duplicate}
|
|
101
71
|
>
|
|
102
72
|
Duplicate row
|
|
103
73
|
</MenuItem>
|
|
104
74
|
<MenuItem
|
|
105
75
|
icon="Delete"
|
|
106
|
-
disabled={
|
|
76
|
+
disabled={!$config.allowDeleteRows}
|
|
107
77
|
on:click={deleteRow}
|
|
108
78
|
>
|
|
109
79
|
Delete row
|
|
@@ -338,11 +338,15 @@ export const deriveStores = context => {
|
|
|
338
338
|
...state,
|
|
339
339
|
[rowId]: true,
|
|
340
340
|
}))
|
|
341
|
-
const
|
|
341
|
+
const newRow = { ...row, ...get(rowChangeCache)[rowId] }
|
|
342
|
+
const saved = await API.saveRow(newRow)
|
|
342
343
|
|
|
343
344
|
// Update state after a successful change
|
|
344
345
|
rows.update(state => {
|
|
345
|
-
state[index] =
|
|
346
|
+
state[index] = {
|
|
347
|
+
...newRow,
|
|
348
|
+
_rev: saved._rev,
|
|
349
|
+
}
|
|
346
350
|
return state.slice()
|
|
347
351
|
})
|
|
348
352
|
rowChangeCache.update(state => {
|
package/src/fetch/DataFetch.js
CHANGED
|
@@ -362,35 +362,13 @@ export default class DataFetch {
|
|
|
362
362
|
return
|
|
363
363
|
}
|
|
364
364
|
this.store.update($store => ({ ...$store, loading: true }))
|
|
365
|
-
const { rows, info, error
|
|
366
|
-
|
|
367
|
-
let { cursors } = get(this.store)
|
|
368
|
-
const { pageNumber } = get(this.store)
|
|
369
|
-
|
|
370
|
-
if (!rows.length && pageNumber > 0) {
|
|
371
|
-
// If the full page is gone but we have previous pages, navigate to the previous page
|
|
372
|
-
this.store.update($store => ({
|
|
373
|
-
...$store,
|
|
374
|
-
loading: false,
|
|
375
|
-
cursors: cursors.slice(0, pageNumber),
|
|
376
|
-
}))
|
|
377
|
-
return await this.prevPage()
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
const currentNextCursor = cursors[pageNumber + 1]
|
|
381
|
-
if (currentNextCursor != cursor) {
|
|
382
|
-
// If the current cursor changed, all the next pages need to be updated, so we mark them as stale
|
|
383
|
-
cursors = cursors.slice(0, pageNumber + 1)
|
|
384
|
-
cursors[pageNumber + 1] = cursor
|
|
385
|
-
}
|
|
386
|
-
|
|
365
|
+
const { rows, info, error } = await this.getPage()
|
|
387
366
|
this.store.update($store => ({
|
|
388
367
|
...$store,
|
|
389
368
|
rows,
|
|
390
369
|
info,
|
|
391
370
|
loading: false,
|
|
392
371
|
error,
|
|
393
|
-
cursors,
|
|
394
372
|
}))
|
|
395
373
|
}
|
|
396
374
|
|
package/src/fetch/fetchData.js
CHANGED
|
@@ -6,7 +6,6 @@ import NestedProviderFetch from "./NestedProviderFetch.js"
|
|
|
6
6
|
import FieldFetch from "./FieldFetch.js"
|
|
7
7
|
import JSONArrayFetch from "./JSONArrayFetch.js"
|
|
8
8
|
import UserFetch from "./UserFetch.js"
|
|
9
|
-
import GroupUserFetch from "./GroupUserFetch.js"
|
|
10
9
|
|
|
11
10
|
const DataFetchMap = {
|
|
12
11
|
table: TableFetch,
|
|
@@ -14,7 +13,6 @@ const DataFetchMap = {
|
|
|
14
13
|
query: QueryFetch,
|
|
15
14
|
link: RelationshipFetch,
|
|
16
15
|
user: UserFetch,
|
|
17
|
-
groupUser: GroupUserFetch,
|
|
18
16
|
|
|
19
17
|
// Client specific datasource types
|
|
20
18
|
provider: NestedProviderFetch,
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { get } from "svelte/store"
|
|
2
|
-
import DataFetch from "./DataFetch.js"
|
|
3
|
-
import { TableNames } from "../constants"
|
|
4
|
-
|
|
5
|
-
export default class GroupUserFetch extends DataFetch {
|
|
6
|
-
constructor(opts) {
|
|
7
|
-
super({
|
|
8
|
-
...opts,
|
|
9
|
-
datasource: {
|
|
10
|
-
tableId: TableNames.USERS,
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
determineFeatureFlags() {
|
|
16
|
-
return {
|
|
17
|
-
supportsSearch: true,
|
|
18
|
-
supportsSort: false,
|
|
19
|
-
supportsPagination: true,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async getDefinition() {
|
|
24
|
-
return {
|
|
25
|
-
schema: {},
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async getData() {
|
|
30
|
-
const { query, cursor } = get(this.store)
|
|
31
|
-
try {
|
|
32
|
-
const res = await this.API.getGroupUsers({
|
|
33
|
-
id: query.groupId,
|
|
34
|
-
emailSearch: query.emailSearch,
|
|
35
|
-
bookmark: cursor,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
rows: res?.users || [],
|
|
40
|
-
hasNextPage: res?.hasNextPage || false,
|
|
41
|
-
cursor: res?.bookmark || null,
|
|
42
|
-
}
|
|
43
|
-
} catch (error) {
|
|
44
|
-
return {
|
|
45
|
-
rows: [],
|
|
46
|
-
hasNextPage: false,
|
|
47
|
-
error,
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|