@budibase/frontend-core 2.5.6-alpha.9 → 2.5.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 +4 -6
- package/src/components/index.js +0 -1
- package/src/constants.js +0 -1
- package/src/fetch/DataFetch.js +21 -27
- package/src/fetch/QueryFetch.js +1 -1
- package/src/themes/midnight.css +0 -3
- package/src/themes/nord.css +0 -3
- package/src/utils/utils.js +0 -20
- package/src/components/grid/cells/AttachmentCell.svelte +0 -153
- package/src/components/grid/cells/BooleanCell.svelte +0 -44
- package/src/components/grid/cells/DataCell.svelte +0 -86
- package/src/components/grid/cells/DateCell.svelte +0 -77
- package/src/components/grid/cells/FormulaCell.svelte +0 -5
- package/src/components/grid/cells/GridCell.svelte +0 -159
- package/src/components/grid/cells/HeaderCell.svelte +0 -237
- package/src/components/grid/cells/JSONCell.svelte +0 -36
- package/src/components/grid/cells/LongFormCell.svelte +0 -117
- package/src/components/grid/cells/MultiSelectCell.svelte +0 -7
- package/src/components/grid/cells/NumberCell.svelte +0 -7
- package/src/components/grid/cells/OptionsCell.svelte +0 -239
- package/src/components/grid/cells/RelationshipCell.svelte +0 -503
- package/src/components/grid/cells/TextCell.svelte +0 -110
- package/src/components/grid/controls/AddColumnButton.svelte +0 -16
- package/src/components/grid/controls/AddRowButton.svelte +0 -18
- package/src/components/grid/controls/BetaButton.svelte +0 -46
- package/src/components/grid/controls/DeleteButton.svelte +0 -72
- package/src/components/grid/controls/HideColumnsButton.svelte +0 -91
- package/src/components/grid/controls/RowHeightButton.svelte +0 -70
- package/src/components/grid/controls/SortButton.svelte +0 -107
- package/src/components/grid/index.js +0 -1
- package/src/components/grid/layout/Avatar.svelte +0 -24
- package/src/components/grid/layout/Grid.svelte +0 -250
- package/src/components/grid/layout/GridBody.svelte +0 -38
- package/src/components/grid/layout/GridRow.svelte +0 -57
- package/src/components/grid/layout/GridScrollWrapper.svelte +0 -84
- package/src/components/grid/layout/HeaderRow.svelte +0 -30
- package/src/components/grid/layout/NewRowTop.svelte +0 -247
- package/src/components/grid/layout/RowCount.svelte +0 -9
- package/src/components/grid/layout/StickyColumn.svelte +0 -245
- package/src/components/grid/layout/UserAvatars.svelte +0 -20
- package/src/components/grid/lib/constants.js +0 -11
- package/src/components/grid/lib/events.js +0 -29
- package/src/components/grid/lib/renderers.js +0 -29
- package/src/components/grid/lib/utils.js +0 -26
- package/src/components/grid/lib/websocket.js +0 -63
- package/src/components/grid/overlays/KeyboardManager.svelte +0 -180
- package/src/components/grid/overlays/MenuOverlay.svelte +0 -95
- package/src/components/grid/overlays/ReorderOverlay.svelte +0 -63
- package/src/components/grid/overlays/ResizeOverlay.svelte +0 -70
- package/src/components/grid/overlays/ScrollOverlay.svelte +0 -121
- package/src/components/grid/stores/bounds.js +0 -16
- package/src/components/grid/stores/clipboard.js +0 -34
- package/src/components/grid/stores/columns.js +0 -206
- package/src/components/grid/stores/index.js +0 -48
- package/src/components/grid/stores/menu.js +0 -49
- package/src/components/grid/stores/pagination.js +0 -24
- package/src/components/grid/stores/reorder.js +0 -155
- package/src/components/grid/stores/resize.js +0 -124
- package/src/components/grid/stores/rows.js +0 -462
- package/src/components/grid/stores/scroll.js +0 -201
- package/src/components/grid/stores/ui.js +0 -168
- package/src/components/grid/stores/users.js +0 -115
- package/src/components/grid/stores/validation.js +0 -45
- package/src/components/grid/stores/viewport.js +0 -141
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { Icon } from "@budibase/bbui"
|
|
3
|
-
import { getColor } from "../lib/utils"
|
|
4
|
-
import { onMount } from "svelte"
|
|
5
|
-
|
|
6
|
-
export let value
|
|
7
|
-
export let schema
|
|
8
|
-
export let onChange
|
|
9
|
-
export let focused = false
|
|
10
|
-
export let multi = false
|
|
11
|
-
export let readonly = false
|
|
12
|
-
export let api
|
|
13
|
-
export let invertX = false
|
|
14
|
-
export let invertY = false
|
|
15
|
-
|
|
16
|
-
let isOpen = false
|
|
17
|
-
let focusedOptionIdx = null
|
|
18
|
-
|
|
19
|
-
$: options = schema?.constraints?.inclusion || []
|
|
20
|
-
$: editable = focused && !readonly
|
|
21
|
-
$: values = Array.isArray(value) ? value : [value].filter(x => x != null)
|
|
22
|
-
$: {
|
|
23
|
-
// Close when deselected
|
|
24
|
-
if (!focused) {
|
|
25
|
-
close()
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const open = () => {
|
|
30
|
-
isOpen = true
|
|
31
|
-
focusedOptionIdx = 0
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const close = () => {
|
|
35
|
-
isOpen = false
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const getOptionColor = value => {
|
|
39
|
-
const index = value ? options.indexOf(value) : null
|
|
40
|
-
return getColor(index)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const toggleOption = option => {
|
|
44
|
-
if (!multi) {
|
|
45
|
-
onChange(option === value ? null : option)
|
|
46
|
-
close()
|
|
47
|
-
} else {
|
|
48
|
-
const sanitizedValues = values.filter(x => options.includes(x))
|
|
49
|
-
if (sanitizedValues.includes(option)) {
|
|
50
|
-
onChange(sanitizedValues.filter(x => x !== option))
|
|
51
|
-
} else {
|
|
52
|
-
onChange([...sanitizedValues, option])
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const onKeyDown = e => {
|
|
58
|
-
if (!isOpen) {
|
|
59
|
-
return false
|
|
60
|
-
}
|
|
61
|
-
e.preventDefault()
|
|
62
|
-
if (e.key === "ArrowDown") {
|
|
63
|
-
focusedOptionIdx = Math.min(focusedOptionIdx + 1, options.length - 1)
|
|
64
|
-
} else if (e.key === "ArrowUp") {
|
|
65
|
-
focusedOptionIdx = Math.max(focusedOptionIdx - 1, 0)
|
|
66
|
-
} else if (e.key === "Enter") {
|
|
67
|
-
toggleOption(options[focusedOptionIdx])
|
|
68
|
-
}
|
|
69
|
-
return true
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
onMount(() => {
|
|
73
|
-
api = {
|
|
74
|
-
focus: open,
|
|
75
|
-
blur: close,
|
|
76
|
-
onKeyDown,
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
</script>
|
|
80
|
-
|
|
81
|
-
<div
|
|
82
|
-
class="container"
|
|
83
|
-
class:multi
|
|
84
|
-
class:editable
|
|
85
|
-
class:open
|
|
86
|
-
on:click|self={editable ? open : null}
|
|
87
|
-
>
|
|
88
|
-
<div class="values" on:click={editable ? open : null}>
|
|
89
|
-
{#each values as val}
|
|
90
|
-
{@const color = getOptionColor(val)}
|
|
91
|
-
{#if color}
|
|
92
|
-
<div class="badge text" style="--color: {color}">
|
|
93
|
-
<span>
|
|
94
|
-
{val}
|
|
95
|
-
</span>
|
|
96
|
-
</div>
|
|
97
|
-
{:else}
|
|
98
|
-
<div class="text">
|
|
99
|
-
{val || ""}
|
|
100
|
-
</div>
|
|
101
|
-
{/if}
|
|
102
|
-
{/each}
|
|
103
|
-
</div>
|
|
104
|
-
{#if editable}
|
|
105
|
-
<div class="arrow" on:click={open}>
|
|
106
|
-
<Icon name="ChevronDown" />
|
|
107
|
-
</div>
|
|
108
|
-
{/if}
|
|
109
|
-
{#if isOpen}
|
|
110
|
-
<div
|
|
111
|
-
class="options"
|
|
112
|
-
class:invertX
|
|
113
|
-
class:invertY
|
|
114
|
-
on:wheel={e => e.stopPropagation()}
|
|
115
|
-
>
|
|
116
|
-
{#each options as option, idx}
|
|
117
|
-
{@const color = getOptionColor(option)}
|
|
118
|
-
<div
|
|
119
|
-
class="option"
|
|
120
|
-
on:click={() => toggleOption(option)}
|
|
121
|
-
class:focused={focusedOptionIdx === idx}
|
|
122
|
-
on:mouseenter={() => (focusedOptionIdx = idx)}
|
|
123
|
-
>
|
|
124
|
-
<div class="badge text" style="--color: {color}">
|
|
125
|
-
{option}
|
|
126
|
-
</div>
|
|
127
|
-
{#if values.includes(option)}
|
|
128
|
-
<Icon
|
|
129
|
-
name="Checkmark"
|
|
130
|
-
color="var(--spectrum-global-color-blue-400)"
|
|
131
|
-
/>
|
|
132
|
-
{/if}
|
|
133
|
-
</div>
|
|
134
|
-
{/each}
|
|
135
|
-
</div>
|
|
136
|
-
{/if}
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
<style>
|
|
140
|
-
.container {
|
|
141
|
-
display: flex;
|
|
142
|
-
flex-direction: row;
|
|
143
|
-
justify-content: space-between;
|
|
144
|
-
align-items: flex-start;
|
|
145
|
-
align-self: stretch;
|
|
146
|
-
flex: 1 1 auto;
|
|
147
|
-
overflow: hidden;
|
|
148
|
-
}
|
|
149
|
-
.container.editable:hover {
|
|
150
|
-
cursor: pointer;
|
|
151
|
-
}
|
|
152
|
-
.values {
|
|
153
|
-
display: flex;
|
|
154
|
-
flex-direction: row;
|
|
155
|
-
justify-content: flex-start;
|
|
156
|
-
align-items: flex-start;
|
|
157
|
-
flex: 1 1 auto;
|
|
158
|
-
grid-column-gap: var(--cell-spacing);
|
|
159
|
-
grid-row-gap: var(--cell-padding);
|
|
160
|
-
overflow: hidden;
|
|
161
|
-
padding: var(--cell-padding);
|
|
162
|
-
flex-wrap: wrap;
|
|
163
|
-
}
|
|
164
|
-
.text {
|
|
165
|
-
overflow: hidden;
|
|
166
|
-
text-overflow: ellipsis;
|
|
167
|
-
white-space: nowrap;
|
|
168
|
-
}
|
|
169
|
-
.multi .text {
|
|
170
|
-
flex: 0 0 auto;
|
|
171
|
-
}
|
|
172
|
-
.badge {
|
|
173
|
-
padding: 0 var(--cell-padding);
|
|
174
|
-
background: var(--color);
|
|
175
|
-
border-radius: var(--cell-padding);
|
|
176
|
-
user-select: none;
|
|
177
|
-
display: flex;
|
|
178
|
-
align-items: center;
|
|
179
|
-
gap: var(--cell-spacing);
|
|
180
|
-
height: 20px;
|
|
181
|
-
max-width: 100%;
|
|
182
|
-
}
|
|
183
|
-
.badge span {
|
|
184
|
-
text-overflow: ellipsis;
|
|
185
|
-
overflow: hidden;
|
|
186
|
-
white-space: nowrap;
|
|
187
|
-
}
|
|
188
|
-
.arrow {
|
|
189
|
-
position: absolute;
|
|
190
|
-
right: 0;
|
|
191
|
-
top: 0;
|
|
192
|
-
height: 100%;
|
|
193
|
-
bottom: 2px;
|
|
194
|
-
padding: 0 6px 0 16px;
|
|
195
|
-
display: grid;
|
|
196
|
-
place-items: center;
|
|
197
|
-
background: linear-gradient(
|
|
198
|
-
to right,
|
|
199
|
-
transparent 0%,
|
|
200
|
-
var(--cell-background) 40%
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
.options {
|
|
204
|
-
min-width: calc(100% + 2px);
|
|
205
|
-
position: absolute;
|
|
206
|
-
top: 100%;
|
|
207
|
-
left: -1px;
|
|
208
|
-
display: flex;
|
|
209
|
-
flex-direction: column;
|
|
210
|
-
justify-content: flex-start;
|
|
211
|
-
align-items: stretch;
|
|
212
|
-
max-height: var(--max-cell-render-height);
|
|
213
|
-
overflow-y: auto;
|
|
214
|
-
border: var(--cell-border);
|
|
215
|
-
box-shadow: 0 0 20px -4px rgba(0, 0, 0, 0.15);
|
|
216
|
-
}
|
|
217
|
-
.options.invertX {
|
|
218
|
-
left: auto;
|
|
219
|
-
right: 0;
|
|
220
|
-
}
|
|
221
|
-
.options.invertY {
|
|
222
|
-
transform: translateY(-100%);
|
|
223
|
-
top: 0;
|
|
224
|
-
}
|
|
225
|
-
.option {
|
|
226
|
-
flex: 0 0 var(--default-row-height);
|
|
227
|
-
padding: 0 var(--cell-padding);
|
|
228
|
-
display: flex;
|
|
229
|
-
flex-direction: row;
|
|
230
|
-
justify-content: space-between;
|
|
231
|
-
align-items: center;
|
|
232
|
-
gap: var(--cell-spacing);
|
|
233
|
-
background-color: var(--background);
|
|
234
|
-
}
|
|
235
|
-
.option:hover,
|
|
236
|
-
.option.focused {
|
|
237
|
-
background-color: var(--spectrum-global-color-gray-200);
|
|
238
|
-
}
|
|
239
|
-
</style>
|