@budibase/frontend-core 2.7.34-alpha.9 → 2.7.35
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/analytics.js +2 -2
- package/src/api/datasources.js +1 -15
- package/src/api/index.js +2 -16
- package/src/api/rows.js +1 -3
- package/src/components/grid/cells/AttachmentCell.svelte +1 -3
- package/src/components/grid/cells/GridCell.svelte +1 -1
- package/src/components/grid/cells/GutterCell.svelte +14 -9
- package/src/components/grid/cells/HeaderCell.svelte +5 -7
- package/src/components/grid/cells/LongFormCell.svelte +1 -1
- package/src/components/grid/cells/OptionsCell.svelte +5 -4
- package/src/components/grid/cells/RelationshipCell.svelte +11 -22
- package/src/components/grid/controls/AddColumnButton.svelte +1 -1
- package/src/components/grid/controls/BulkDeleteHandler.svelte +8 -2
- package/src/components/grid/controls/ColumnWidthButton.svelte +92 -0
- package/src/components/grid/controls/HideColumnsButton.svelte +4 -9
- package/src/components/grid/controls/RowHeightButton.svelte +71 -0
- package/src/components/grid/controls/SortButton.svelte +4 -3
- package/src/components/grid/layout/Grid.svelte +59 -66
- package/src/components/grid/layout/GridBody.svelte +2 -3
- package/src/components/grid/layout/GridRow.svelte +2 -3
- package/src/components/grid/layout/GridScrollWrapper.svelte +0 -6
- package/src/components/grid/layout/HeaderRow.svelte +3 -3
- package/src/components/grid/layout/NewRow.svelte +5 -37
- package/src/components/grid/layout/StickyColumn.svelte +8 -10
- package/src/components/grid/lib/constants.js +3 -4
- package/src/components/grid/lib/websocket.js +2 -3
- package/src/components/grid/overlays/KeyboardManager.svelte +0 -6
- package/src/components/grid/overlays/MenuOverlay.svelte +1 -3
- package/src/components/grid/overlays/ReorderOverlay.svelte +1 -1
- package/src/components/grid/overlays/ResizeOverlay.svelte +1 -1
- package/src/components/grid/overlays/ScrollOverlay.svelte +2 -25
- package/src/components/grid/stores/columns.js +6 -37
- package/src/components/grid/stores/index.js +0 -6
- package/src/components/grid/stores/menu.js +9 -15
- package/src/components/grid/stores/rows.js +16 -18
- package/src/components/grid/stores/scroll.js +7 -5
- package/src/components/grid/stores/ui.js +4 -19
- package/src/components/grid/stores/viewport.js +6 -17
- package/src/fetch/DataFetch.js +2 -4
- package/src/utils/index.js +0 -1
- package/src/components/grid/controls/SizeButton.svelte +0 -135
- package/src/components/grid/stores/config.js +0 -27
- package/src/components/grid/stores/filter.js +0 -19
- package/src/components/grid/stores/sort.js +0 -27
- package/src/utils/memo.js +0 -43
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.35",
|
|
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.7.
|
|
10
|
-
"@budibase/shared-core": "2.7.
|
|
9
|
+
"@budibase/bbui": "2.7.35",
|
|
10
|
+
"@budibase/shared-core": "2.7.35",
|
|
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": "6db1d089ee2d2df8caf513cf2cb4b22f167b91f1"
|
|
17
17
|
}
|
package/src/api/analytics.js
CHANGED
|
@@ -7,11 +7,11 @@ export const buildAnalyticsEndpoints = API => ({
|
|
|
7
7
|
url: "/api/bbtel",
|
|
8
8
|
})
|
|
9
9
|
},
|
|
10
|
-
analyticsPing: async ({ source
|
|
10
|
+
analyticsPing: async ({ source }) => {
|
|
11
11
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
12
12
|
return await API.post({
|
|
13
13
|
url: "/api/bbtel/ping",
|
|
14
|
-
body: { source, timezone
|
|
14
|
+
body: { source, timezone },
|
|
15
15
|
})
|
|
16
16
|
},
|
|
17
17
|
})
|
package/src/api/datasources.js
CHANGED
|
@@ -26,16 +26,13 @@ export const buildDatasourceEndpoints = API => ({
|
|
|
26
26
|
* Creates a datasource
|
|
27
27
|
* @param datasource the datasource to create
|
|
28
28
|
* @param fetchSchema whether to fetch the schema or not
|
|
29
|
-
* @param tablesFilter a list of tables to actually fetch rather than simply
|
|
30
|
-
* all that are accessible.
|
|
31
29
|
*/
|
|
32
|
-
createDatasource: async ({ datasource, fetchSchema
|
|
30
|
+
createDatasource: async ({ datasource, fetchSchema }) => {
|
|
33
31
|
return await API.post({
|
|
34
32
|
url: "/api/datasources",
|
|
35
33
|
body: {
|
|
36
34
|
datasource,
|
|
37
35
|
fetchSchema,
|
|
38
|
-
tablesFilter,
|
|
39
36
|
},
|
|
40
37
|
})
|
|
41
38
|
},
|
|
@@ -72,15 +69,4 @@ export const buildDatasourceEndpoints = API => ({
|
|
|
72
69
|
body: { datasource },
|
|
73
70
|
})
|
|
74
71
|
},
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Fetch table names available within the datasource, for filtering out undesired tables
|
|
78
|
-
* @param datasource the datasource configuration to use for fetching tables
|
|
79
|
-
*/
|
|
80
|
-
fetchInfoForDatasource: async datasource => {
|
|
81
|
-
return await API.post({
|
|
82
|
-
url: `/api/datasources/info`,
|
|
83
|
-
body: { datasource },
|
|
84
|
-
})
|
|
85
|
-
},
|
|
86
72
|
})
|
package/src/api/index.js
CHANGED
|
@@ -75,11 +75,7 @@ export const createAPIClient = config => {
|
|
|
75
75
|
let cache = {}
|
|
76
76
|
|
|
77
77
|
// Generates an error object from an API response
|
|
78
|
-
const makeErrorFromResponse = async (
|
|
79
|
-
response,
|
|
80
|
-
method,
|
|
81
|
-
suppressErrors = false
|
|
82
|
-
) => {
|
|
78
|
+
const makeErrorFromResponse = async (response, method) => {
|
|
83
79
|
// Try to read a message from the error
|
|
84
80
|
let message = response.statusText
|
|
85
81
|
let json = null
|
|
@@ -100,7 +96,6 @@ export const createAPIClient = config => {
|
|
|
100
96
|
url: response.url,
|
|
101
97
|
method,
|
|
102
98
|
handled: true,
|
|
103
|
-
suppressErrors,
|
|
104
99
|
}
|
|
105
100
|
}
|
|
106
101
|
|
|
@@ -124,7 +119,6 @@ export const createAPIClient = config => {
|
|
|
124
119
|
json = true,
|
|
125
120
|
external = false,
|
|
126
121
|
parseResponse,
|
|
127
|
-
suppressErrors = false,
|
|
128
122
|
}) => {
|
|
129
123
|
// Ensure we don't do JSON processing if sending a GET request
|
|
130
124
|
json = json && method !== "GET"
|
|
@@ -180,7 +174,7 @@ export const createAPIClient = config => {
|
|
|
180
174
|
}
|
|
181
175
|
} else {
|
|
182
176
|
delete cache[url]
|
|
183
|
-
throw await makeErrorFromResponse(response, method
|
|
177
|
+
throw await makeErrorFromResponse(response, method)
|
|
184
178
|
}
|
|
185
179
|
}
|
|
186
180
|
|
|
@@ -234,14 +228,6 @@ export const createAPIClient = config => {
|
|
|
234
228
|
invalidateCache: () => {
|
|
235
229
|
cache = {}
|
|
236
230
|
},
|
|
237
|
-
|
|
238
|
-
// Generic utility to extract the current app ID. Assumes that any client
|
|
239
|
-
// that exists in an app context will be attaching our app ID header.
|
|
240
|
-
getAppID: () => {
|
|
241
|
-
let headers = {}
|
|
242
|
-
config?.attachHeaders(headers)
|
|
243
|
-
return headers?.["x-budibase-app-id"]
|
|
244
|
-
},
|
|
245
231
|
}
|
|
246
232
|
|
|
247
233
|
// Attach all endpoints
|
package/src/api/rows.js
CHANGED
|
@@ -16,16 +16,14 @@ export const buildRowEndpoints = API => ({
|
|
|
16
16
|
/**
|
|
17
17
|
* Creates or updates a row in a table.
|
|
18
18
|
* @param row the row to save
|
|
19
|
-
* @param suppressErrors whether or not to suppress error notifications
|
|
20
19
|
*/
|
|
21
|
-
saveRow: async
|
|
20
|
+
saveRow: async row => {
|
|
22
21
|
if (!row?.tableId) {
|
|
23
22
|
return
|
|
24
23
|
}
|
|
25
24
|
return await API.post({
|
|
26
25
|
url: `/api/${row.tableId}/rows`,
|
|
27
26
|
body: row,
|
|
28
|
-
suppressErrors,
|
|
29
27
|
})
|
|
30
28
|
},
|
|
31
29
|
|
|
@@ -138,12 +138,10 @@
|
|
|
138
138
|
top: 100%;
|
|
139
139
|
left: 0;
|
|
140
140
|
width: 320px;
|
|
141
|
-
background: var(--
|
|
141
|
+
background: var(--background);
|
|
142
142
|
border: var(--cell-border);
|
|
143
143
|
padding: var(--cell-padding);
|
|
144
144
|
box-shadow: 0 0 20px -4px rgba(0, 0, 0, 0.15);
|
|
145
|
-
border-bottom-left-radius: 2px;
|
|
146
|
-
border-bottom-right-radius: 2px;
|
|
147
145
|
}
|
|
148
146
|
.dropzone.invertX {
|
|
149
147
|
left: auto;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export let rowFocused = false
|
|
10
10
|
export let rowHovered = false
|
|
11
11
|
export let rowSelected = false
|
|
12
|
-
export let
|
|
12
|
+
export let disableExpand = false
|
|
13
13
|
export let disableNumber = false
|
|
14
14
|
export let defaultHeight = false
|
|
15
15
|
export let disabled = false
|
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
selectedRows.actions.toggleRow(id)
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
const expand = () => {
|
|
29
|
+
svelteDispatch("expand")
|
|
30
|
+
if (row) {
|
|
31
|
+
dispatch("edit-row", row)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
27
34
|
</script>
|
|
28
35
|
|
|
29
36
|
<GridCell
|
|
@@ -63,14 +70,12 @@
|
|
|
63
70
|
color="var(--spectrum-global-color-red-400)"
|
|
64
71
|
/>
|
|
65
72
|
</div>
|
|
66
|
-
{:else}
|
|
67
|
-
<div
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
on:click={() => svelteDispatch("expand")}
|
|
73
|
-
/>
|
|
73
|
+
{:else if $config.allowExpandRows}
|
|
74
|
+
<div
|
|
75
|
+
class="expand"
|
|
76
|
+
class:visible={!disableExpand && (rowFocused || rowHovered)}
|
|
77
|
+
>
|
|
78
|
+
<Icon name="Maximize" hoverable size="S" on:click={expand} />
|
|
74
79
|
</div>
|
|
75
80
|
{/if}
|
|
76
81
|
</div>
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
<MenuItem
|
|
164
164
|
icon="Edit"
|
|
165
165
|
on:click={editColumn}
|
|
166
|
-
disabled={!$config.
|
|
166
|
+
disabled={!$config.allowEditColumns || column.schema.disabled}
|
|
167
167
|
>
|
|
168
168
|
Edit column
|
|
169
169
|
</MenuItem>
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
icon="Label"
|
|
172
172
|
on:click={makeDisplayColumn}
|
|
173
173
|
disabled={idx === "sticky" ||
|
|
174
|
-
!$config.
|
|
174
|
+
!$config.allowEditColumns ||
|
|
175
175
|
bannedDisplayColumnTypes.includes(column.schema.type)}
|
|
176
176
|
>
|
|
177
177
|
Use as display column
|
|
@@ -197,12 +197,10 @@
|
|
|
197
197
|
Move right
|
|
198
198
|
</MenuItem>
|
|
199
199
|
<MenuItem
|
|
200
|
-
disabled={idx === "sticky"
|
|
200
|
+
disabled={idx === "sticky"}
|
|
201
201
|
icon="VisibilityOff"
|
|
202
|
-
on:click={hideColumn}
|
|
202
|
+
on:click={hideColumn}>Hide column</MenuItem
|
|
203
203
|
>
|
|
204
|
-
Hide column
|
|
205
|
-
</MenuItem>
|
|
206
204
|
</Menu>
|
|
207
205
|
</Popover>
|
|
208
206
|
|
|
@@ -220,7 +218,7 @@
|
|
|
220
218
|
.header-cell :global(.cell) {
|
|
221
219
|
padding: 0 var(--cell-padding);
|
|
222
220
|
gap: calc(2 * var(--cell-spacing));
|
|
223
|
-
background: var(--
|
|
221
|
+
background: var(--spectrum-global-color-gray-100);
|
|
224
222
|
}
|
|
225
223
|
|
|
226
224
|
.name {
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
top: 0;
|
|
103
103
|
left: 0;
|
|
104
104
|
width: calc(100% + var(--max-cell-render-width-overflow));
|
|
105
|
-
height:
|
|
105
|
+
height: var(--max-cell-render-height);
|
|
106
106
|
z-index: 1;
|
|
107
107
|
border-radius: 2px;
|
|
108
108
|
resize: none;
|
|
@@ -132,7 +132,10 @@
|
|
|
132
132
|
{option}
|
|
133
133
|
</div>
|
|
134
134
|
{#if values.includes(option)}
|
|
135
|
-
<Icon
|
|
135
|
+
<Icon
|
|
136
|
+
name="Checkmark"
|
|
137
|
+
color="var(--spectrum-global-color-blue-400)"
|
|
138
|
+
/>
|
|
136
139
|
{/if}
|
|
137
140
|
</div>
|
|
138
141
|
{/each}
|
|
@@ -220,8 +223,6 @@
|
|
|
220
223
|
overflow-y: auto;
|
|
221
224
|
border: var(--cell-border);
|
|
222
225
|
box-shadow: 0 0 20px -4px rgba(0, 0, 0, 0.15);
|
|
223
|
-
border-bottom-left-radius: 2px;
|
|
224
|
-
border-bottom-right-radius: 2px;
|
|
225
226
|
}
|
|
226
227
|
.options.invertX {
|
|
227
228
|
left: auto;
|
|
@@ -239,7 +240,7 @@
|
|
|
239
240
|
justify-content: space-between;
|
|
240
241
|
align-items: center;
|
|
241
242
|
gap: var(--cell-spacing);
|
|
242
|
-
background-color: var(--
|
|
243
|
+
background-color: var(--background);
|
|
243
244
|
}
|
|
244
245
|
.option:hover,
|
|
245
246
|
.option.focused {
|
|
@@ -42,8 +42,6 @@
|
|
|
42
42
|
let candidateIndex
|
|
43
43
|
let lastSearchId
|
|
44
44
|
let searching = false
|
|
45
|
-
let valuesHeight = 0
|
|
46
|
-
let container
|
|
47
45
|
|
|
48
46
|
$: oneRowOnly = schema?.relationshipType === "one-to-many"
|
|
49
47
|
$: editable = focused && !readonly
|
|
@@ -140,7 +138,6 @@
|
|
|
140
138
|
|
|
141
139
|
const open = async () => {
|
|
142
140
|
isOpen = true
|
|
143
|
-
valuesHeight = container.getBoundingClientRect().height
|
|
144
141
|
|
|
145
142
|
// Find the primary display for the related table
|
|
146
143
|
if (!primaryDisplay) {
|
|
@@ -245,14 +242,8 @@
|
|
|
245
242
|
})
|
|
246
243
|
</script>
|
|
247
244
|
|
|
248
|
-
<div
|
|
249
|
-
class="
|
|
250
|
-
class:editable
|
|
251
|
-
class:focused
|
|
252
|
-
class:invertY
|
|
253
|
-
style="--color:{color};"
|
|
254
|
-
>
|
|
255
|
-
<div class="container" bind:this={container}>
|
|
245
|
+
<div class="wrapper" class:editable class:focused style="--color:{color};">
|
|
246
|
+
<div class="container">
|
|
256
247
|
<div
|
|
257
248
|
class="values"
|
|
258
249
|
class:wrap={editable || contentLines > 1}
|
|
@@ -299,7 +290,6 @@
|
|
|
299
290
|
class:invertY
|
|
300
291
|
on:wheel|stopPropagation
|
|
301
292
|
use:clickOutside={close}
|
|
302
|
-
style="--values-height:{valuesHeight}px;"
|
|
303
293
|
>
|
|
304
294
|
<div class="search">
|
|
305
295
|
<Input
|
|
@@ -329,7 +319,11 @@
|
|
|
329
319
|
</span>
|
|
330
320
|
</div>
|
|
331
321
|
{#if isRowSelected(row)}
|
|
332
|
-
<Icon
|
|
322
|
+
<Icon
|
|
323
|
+
size="S"
|
|
324
|
+
name="Checkmark"
|
|
325
|
+
color="var(--spectrum-global-color-blue-400)"
|
|
326
|
+
/>
|
|
333
327
|
{/if}
|
|
334
328
|
</div>
|
|
335
329
|
{/each}
|
|
@@ -346,7 +340,7 @@
|
|
|
346
340
|
min-height: var(--row-height);
|
|
347
341
|
max-height: var(--row-height);
|
|
348
342
|
overflow: hidden;
|
|
349
|
-
--max-relationship-height:
|
|
343
|
+
--max-relationship-height: 120px;
|
|
350
344
|
}
|
|
351
345
|
.wrapper.focused {
|
|
352
346
|
position: absolute;
|
|
@@ -358,10 +352,6 @@
|
|
|
358
352
|
max-height: none;
|
|
359
353
|
overflow: visible;
|
|
360
354
|
}
|
|
361
|
-
.wrapper.invertY {
|
|
362
|
-
top: auto;
|
|
363
|
-
bottom: 0;
|
|
364
|
-
}
|
|
365
355
|
|
|
366
356
|
.container {
|
|
367
357
|
min-height: var(--row-height);
|
|
@@ -460,17 +450,16 @@
|
|
|
460
450
|
left: 0;
|
|
461
451
|
width: 100%;
|
|
462
452
|
max-height: calc(
|
|
463
|
-
var(--max-cell-render-height) + var(--row-height) -
|
|
453
|
+
var(--max-cell-render-height) + var(--row-height) -
|
|
454
|
+
var(--max-relationship-height)
|
|
464
455
|
);
|
|
465
|
-
background: var(--
|
|
456
|
+
background: var(--background);
|
|
466
457
|
border: var(--cell-border);
|
|
467
458
|
box-shadow: 0 0 20px -4px rgba(0, 0, 0, 0.15);
|
|
468
459
|
display: flex;
|
|
469
460
|
flex-direction: column;
|
|
470
461
|
align-items: stretch;
|
|
471
462
|
padding: 0 0 8px 0;
|
|
472
|
-
border-bottom-left-radius: 2px;
|
|
473
|
-
border-bottom-right-radius: 2px;
|
|
474
463
|
}
|
|
475
464
|
.dropdown.invertY {
|
|
476
465
|
transform: translateY(-100%);
|
|
@@ -6,9 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
let modal
|
|
8
8
|
|
|
9
|
-
$: selectedRowCount = Object.values($selectedRows).length
|
|
9
|
+
$: selectedRowCount = Object.values($selectedRows).filter(x => !!x).length
|
|
10
10
|
$: rowsToDelete = Object.entries($selectedRows)
|
|
11
|
-
.map(entry =>
|
|
11
|
+
.map(entry => {
|
|
12
|
+
if (entry[1] === true) {
|
|
13
|
+
return $rows.find(x => x._id === entry[0])
|
|
14
|
+
} else {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
})
|
|
12
18
|
.filter(x => x != null)
|
|
13
19
|
|
|
14
20
|
// Deletion callback when confirmed
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getContext } from "svelte"
|
|
3
|
+
import { ActionButton, Popover } from "@budibase/bbui"
|
|
4
|
+
import { DefaultColumnWidth } from "../lib/constants"
|
|
5
|
+
|
|
6
|
+
const { stickyColumn, columns, compact } = getContext("grid")
|
|
7
|
+
const smallSize = 120
|
|
8
|
+
const mediumSize = DefaultColumnWidth
|
|
9
|
+
const largeSize = DefaultColumnWidth * 1.5
|
|
10
|
+
|
|
11
|
+
let open = false
|
|
12
|
+
let anchor
|
|
13
|
+
|
|
14
|
+
$: allCols = $columns.concat($stickyColumn ? [$stickyColumn] : [])
|
|
15
|
+
$: allSmall = allCols.every(col => col.width === smallSize)
|
|
16
|
+
$: allMedium = allCols.every(col => col.width === mediumSize)
|
|
17
|
+
$: allLarge = allCols.every(col => col.width === largeSize)
|
|
18
|
+
$: custom = !allSmall && !allMedium && !allLarge
|
|
19
|
+
$: sizeOptions = [
|
|
20
|
+
{
|
|
21
|
+
label: "Small",
|
|
22
|
+
size: smallSize,
|
|
23
|
+
selected: allSmall,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "Medium",
|
|
27
|
+
size: mediumSize,
|
|
28
|
+
selected: allMedium,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Large",
|
|
32
|
+
size: largeSize,
|
|
33
|
+
selected: allLarge,
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
const changeColumnWidth = async width => {
|
|
38
|
+
columns.update(state => {
|
|
39
|
+
state.forEach(column => {
|
|
40
|
+
column.width = width
|
|
41
|
+
})
|
|
42
|
+
return state
|
|
43
|
+
})
|
|
44
|
+
if ($stickyColumn) {
|
|
45
|
+
stickyColumn.update(state => ({
|
|
46
|
+
...state,
|
|
47
|
+
width,
|
|
48
|
+
}))
|
|
49
|
+
}
|
|
50
|
+
await columns.actions.saveChanges()
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<div bind:this={anchor}>
|
|
55
|
+
<ActionButton
|
|
56
|
+
icon="MoveLeftRight"
|
|
57
|
+
quiet
|
|
58
|
+
size="M"
|
|
59
|
+
on:click={() => (open = !open)}
|
|
60
|
+
selected={open}
|
|
61
|
+
disabled={!allCols.length}
|
|
62
|
+
tooltip={$compact ? "Width" : null}
|
|
63
|
+
>
|
|
64
|
+
{$compact ? "" : "Width"}
|
|
65
|
+
</ActionButton>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
|
69
|
+
<div class="content">
|
|
70
|
+
{#each sizeOptions as option}
|
|
71
|
+
<ActionButton
|
|
72
|
+
quiet
|
|
73
|
+
on:click={() => changeColumnWidth(option.size)}
|
|
74
|
+
selected={option.selected}
|
|
75
|
+
>
|
|
76
|
+
{option.label}
|
|
77
|
+
</ActionButton>
|
|
78
|
+
{/each}
|
|
79
|
+
{#if custom}
|
|
80
|
+
<ActionButton selected={custom} quiet>Custom</ActionButton>
|
|
81
|
+
{/if}
|
|
82
|
+
</div>
|
|
83
|
+
</Popover>
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
.content {
|
|
87
|
+
padding: 12px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: 8px;
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
import { ActionButton, Popover, Toggle, Icon } from "@budibase/bbui"
|
|
4
4
|
import { getColumnIcon } from "../lib/utils"
|
|
5
5
|
|
|
6
|
-
const { columns, stickyColumn } = getContext("grid")
|
|
6
|
+
const { columns, stickyColumn, compact } = getContext("grid")
|
|
7
7
|
|
|
8
8
|
let open = false
|
|
9
9
|
let anchor
|
|
10
10
|
|
|
11
11
|
$: anyHidden = $columns.some(col => !col.visible)
|
|
12
|
-
$: text = getText($columns)
|
|
13
12
|
|
|
14
13
|
const toggleVisibility = (column, visible) => {
|
|
15
14
|
columns.update(state => {
|
|
@@ -39,11 +38,6 @@
|
|
|
39
38
|
})
|
|
40
39
|
columns.actions.saveChanges()
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
const getText = columns => {
|
|
44
|
-
const hidden = columns.filter(col => !col.visible).length
|
|
45
|
-
return hidden ? `Hide columns (${hidden})` : "Hide columns"
|
|
46
|
-
}
|
|
47
41
|
</script>
|
|
48
42
|
|
|
49
43
|
<div bind:this={anchor}>
|
|
@@ -54,12 +48,13 @@
|
|
|
54
48
|
on:click={() => (open = !open)}
|
|
55
49
|
selected={open || anyHidden}
|
|
56
50
|
disabled={!$columns.length}
|
|
51
|
+
tooltip={$compact ? "Columns" : ""}
|
|
57
52
|
>
|
|
58
|
-
{
|
|
53
|
+
{$compact ? "" : "Columns"}
|
|
59
54
|
</ActionButton>
|
|
60
55
|
</div>
|
|
61
56
|
|
|
62
|
-
<Popover bind:open {anchor} align="left">
|
|
57
|
+
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
|
63
58
|
<div class="content">
|
|
64
59
|
<div class="columns">
|
|
65
60
|
{#if $stickyColumn}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getContext } from "svelte"
|
|
3
|
+
import { ActionButton, Popover } from "@budibase/bbui"
|
|
4
|
+
import {
|
|
5
|
+
LargeRowHeight,
|
|
6
|
+
MediumRowHeight,
|
|
7
|
+
SmallRowHeight,
|
|
8
|
+
} from "../lib/constants"
|
|
9
|
+
|
|
10
|
+
const { rowHeight, columns, table, compact } = getContext("grid")
|
|
11
|
+
const sizeOptions = [
|
|
12
|
+
{
|
|
13
|
+
label: "Small",
|
|
14
|
+
size: SmallRowHeight,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: "Medium",
|
|
18
|
+
size: MediumRowHeight,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Large",
|
|
22
|
+
size: LargeRowHeight,
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
let open = false
|
|
27
|
+
let anchor
|
|
28
|
+
|
|
29
|
+
const changeRowHeight = height => {
|
|
30
|
+
columns.actions.saveTable({
|
|
31
|
+
...$table,
|
|
32
|
+
rowHeight: height,
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div bind:this={anchor}>
|
|
38
|
+
<ActionButton
|
|
39
|
+
icon="MoveUpDown"
|
|
40
|
+
quiet
|
|
41
|
+
size="M"
|
|
42
|
+
on:click={() => (open = !open)}
|
|
43
|
+
selected={open}
|
|
44
|
+
tooltip={$compact ? "Height" : null}
|
|
45
|
+
>
|
|
46
|
+
{$compact ? "" : "Height"}
|
|
47
|
+
</ActionButton>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
|
51
|
+
<div class="content">
|
|
52
|
+
{#each sizeOptions as option}
|
|
53
|
+
<ActionButton
|
|
54
|
+
quiet
|
|
55
|
+
selected={$rowHeight === option.size}
|
|
56
|
+
on:click={() => changeRowHeight(option.size)}
|
|
57
|
+
>
|
|
58
|
+
{option.label}
|
|
59
|
+
</ActionButton>
|
|
60
|
+
{/each}
|
|
61
|
+
</div>
|
|
62
|
+
</Popover>
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
.content {
|
|
66
|
+
padding: 12px;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { getContext } from "svelte"
|
|
3
3
|
import { ActionButton, Popover, Select } from "@budibase/bbui"
|
|
4
4
|
|
|
5
|
-
const { sort, columns, stickyColumn } = getContext("grid")
|
|
5
|
+
const { sort, columns, stickyColumn, compact } = getContext("grid")
|
|
6
6
|
|
|
7
7
|
let open = false
|
|
8
8
|
let anchor
|
|
@@ -90,12 +90,13 @@
|
|
|
90
90
|
on:click={() => (open = !open)}
|
|
91
91
|
selected={open}
|
|
92
92
|
disabled={!columnOptions.length}
|
|
93
|
+
tooltip={$compact ? "Sort" : ""}
|
|
93
94
|
>
|
|
94
|
-
Sort
|
|
95
|
+
{$compact ? "" : "Sort"}
|
|
95
96
|
</ActionButton>
|
|
96
97
|
</div>
|
|
97
98
|
|
|
98
|
-
<Popover bind:open {anchor} align="left">
|
|
99
|
+
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
|
99
100
|
<div class="content">
|
|
100
101
|
<Select
|
|
101
102
|
placeholder={null}
|