@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,159 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export let focused = false
|
|
3
|
-
export let selected = false
|
|
4
|
-
export let highlighted = false
|
|
5
|
-
export let width = ""
|
|
6
|
-
export let selectedUser = null
|
|
7
|
-
export let error = null
|
|
8
|
-
export let rowIdx
|
|
9
|
-
export let defaultHeight = false
|
|
10
|
-
export let center = false
|
|
11
|
-
|
|
12
|
-
$: style = getStyle(width, selectedUser)
|
|
13
|
-
|
|
14
|
-
const getStyle = (width, selectedUser) => {
|
|
15
|
-
let style = `flex: 0 0 ${width}px;`
|
|
16
|
-
if (selectedUser) {
|
|
17
|
-
style += `--cell-color:${selectedUser.color};`
|
|
18
|
-
}
|
|
19
|
-
return style
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<div
|
|
24
|
-
class="cell"
|
|
25
|
-
class:selected
|
|
26
|
-
class:highlighted
|
|
27
|
-
class:focused
|
|
28
|
-
class:error
|
|
29
|
-
class:center
|
|
30
|
-
class:default-height={defaultHeight}
|
|
31
|
-
class:selected-other={selectedUser != null}
|
|
32
|
-
on:focus
|
|
33
|
-
on:mousedown
|
|
34
|
-
on:mouseup
|
|
35
|
-
on:click
|
|
36
|
-
on:contextmenu
|
|
37
|
-
{style}
|
|
38
|
-
data-row={rowIdx}
|
|
39
|
-
>
|
|
40
|
-
{#if error}
|
|
41
|
-
<div class="label">
|
|
42
|
-
{error}
|
|
43
|
-
</div>
|
|
44
|
-
{/if}
|
|
45
|
-
<slot />
|
|
46
|
-
{#if selectedUser && !focused}
|
|
47
|
-
<div class="label">
|
|
48
|
-
{selectedUser.label}
|
|
49
|
-
</div>
|
|
50
|
-
{/if}
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<style>
|
|
54
|
-
/* Cells */
|
|
55
|
-
.cell {
|
|
56
|
-
height: var(--row-height);
|
|
57
|
-
border-bottom: var(--cell-border);
|
|
58
|
-
border-right: var(--cell-border);
|
|
59
|
-
display: flex;
|
|
60
|
-
flex-direction: row;
|
|
61
|
-
justify-content: flex-start;
|
|
62
|
-
align-items: flex-start;
|
|
63
|
-
color: var(--spectrum-global-color-gray-800);
|
|
64
|
-
font-size: var(--cell-font-size);
|
|
65
|
-
gap: var(--cell-spacing);
|
|
66
|
-
background: var(--cell-background);
|
|
67
|
-
position: relative;
|
|
68
|
-
width: 0;
|
|
69
|
-
--cell-color: transparent;
|
|
70
|
-
}
|
|
71
|
-
.cell.default-height {
|
|
72
|
-
height: var(--default-row-height);
|
|
73
|
-
}
|
|
74
|
-
.cell.center {
|
|
75
|
-
align-items: center;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/* Cell border */
|
|
79
|
-
.cell.focused:after,
|
|
80
|
-
.cell.error:after,
|
|
81
|
-
.cell.selected-other:not(.focused):after {
|
|
82
|
-
content: " ";
|
|
83
|
-
position: absolute;
|
|
84
|
-
top: 0;
|
|
85
|
-
left: 0;
|
|
86
|
-
height: 100%;
|
|
87
|
-
width: 100%;
|
|
88
|
-
border: 2px solid var(--cell-color);
|
|
89
|
-
pointer-events: none;
|
|
90
|
-
border-radius: 2px;
|
|
91
|
-
box-sizing: border-box;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/* Cell border for cells with labels */
|
|
95
|
-
.cell.error:after,
|
|
96
|
-
.cell.selected-other:not(.focused):after {
|
|
97
|
-
border-radius: 0 2px 2px 2px;
|
|
98
|
-
}
|
|
99
|
-
.cell[data-row="0"].error:after,
|
|
100
|
-
.cell[data-row="0"].selected-other:not(.focused):after {
|
|
101
|
-
border-radius: 2px 2px 2px 0;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* Cell z-index */
|
|
105
|
-
.cell.error,
|
|
106
|
-
.cell.selected-other:not(.focused) {
|
|
107
|
-
z-index: 1;
|
|
108
|
-
}
|
|
109
|
-
.cell.focused {
|
|
110
|
-
z-index: 2;
|
|
111
|
-
}
|
|
112
|
-
.cell.focused {
|
|
113
|
-
--cell-color: var(--spectrum-global-color-blue-400);
|
|
114
|
-
}
|
|
115
|
-
.cell.error {
|
|
116
|
-
--cell-color: var(--spectrum-global-color-red-500);
|
|
117
|
-
}
|
|
118
|
-
.cell:not(.focused) {
|
|
119
|
-
user-select: none;
|
|
120
|
-
}
|
|
121
|
-
.cell:hover {
|
|
122
|
-
cursor: default;
|
|
123
|
-
}
|
|
124
|
-
.cell.highlighted:not(.focused) {
|
|
125
|
-
--cell-background: var(--cell-background-hover);
|
|
126
|
-
}
|
|
127
|
-
.cell.selected:not(.focused) {
|
|
128
|
-
--cell-background: var(--spectrum-global-color-blue-100);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* Label for additional text */
|
|
132
|
-
.label {
|
|
133
|
-
position: absolute;
|
|
134
|
-
bottom: 100%;
|
|
135
|
-
left: 0;
|
|
136
|
-
padding: 1px 4px 3px 4px;
|
|
137
|
-
margin: 0 0 -2px 0;
|
|
138
|
-
background: var(--user-color);
|
|
139
|
-
border-radius: 2px;
|
|
140
|
-
display: block;
|
|
141
|
-
color: white;
|
|
142
|
-
font-size: 12px;
|
|
143
|
-
font-weight: 600;
|
|
144
|
-
white-space: nowrap;
|
|
145
|
-
text-overflow: ellipsis;
|
|
146
|
-
overflow: hidden;
|
|
147
|
-
user-select: none;
|
|
148
|
-
}
|
|
149
|
-
.cell[data-row="0"] .label {
|
|
150
|
-
bottom: auto;
|
|
151
|
-
top: 100%;
|
|
152
|
-
border-radius: 0 2px 2px 2px;
|
|
153
|
-
padding: 2px 4px 2px 4px;
|
|
154
|
-
margin: -2px 0 0 0;
|
|
155
|
-
}
|
|
156
|
-
.error .label {
|
|
157
|
-
background: var(--spectrum-global-color-red-500);
|
|
158
|
-
}
|
|
159
|
-
</style>
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { getContext } from "svelte"
|
|
3
|
-
import GridCell from "./GridCell.svelte"
|
|
4
|
-
import { Icon, Popover, Menu, MenuItem } from "@budibase/bbui"
|
|
5
|
-
import { getColumnIcon } from "../lib/utils"
|
|
6
|
-
|
|
7
|
-
export let column
|
|
8
|
-
export let idx
|
|
9
|
-
export let orderable = true
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
reorder,
|
|
13
|
-
isReordering,
|
|
14
|
-
isResizing,
|
|
15
|
-
rand,
|
|
16
|
-
sort,
|
|
17
|
-
renderedColumns,
|
|
18
|
-
dispatch,
|
|
19
|
-
config,
|
|
20
|
-
ui,
|
|
21
|
-
columns,
|
|
22
|
-
} = getContext("grid")
|
|
23
|
-
const bannedDisplayColumnTypes = [
|
|
24
|
-
"link",
|
|
25
|
-
"array",
|
|
26
|
-
"attachment",
|
|
27
|
-
"boolean",
|
|
28
|
-
"formula",
|
|
29
|
-
"json",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
let anchor
|
|
33
|
-
let open = false
|
|
34
|
-
let timeout
|
|
35
|
-
|
|
36
|
-
$: sortedBy = column.name === $sort.column
|
|
37
|
-
$: canMoveLeft = orderable && idx > 0
|
|
38
|
-
$: canMoveRight = orderable && idx < $renderedColumns.length - 1
|
|
39
|
-
|
|
40
|
-
const editColumn = () => {
|
|
41
|
-
dispatch("edit-column", column.schema)
|
|
42
|
-
open = false
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const onMouseDown = e => {
|
|
46
|
-
if (e.button === 0 && orderable) {
|
|
47
|
-
timeout = setTimeout(() => {
|
|
48
|
-
reorder.actions.startReordering(column.name, e)
|
|
49
|
-
}, 200)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const onMouseUp = e => {
|
|
54
|
-
if (e.button === 0 && orderable) {
|
|
55
|
-
clearTimeout(timeout)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const onContextMenu = e => {
|
|
60
|
-
e.preventDefault()
|
|
61
|
-
ui.actions.blur()
|
|
62
|
-
open = !open
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const sortAscending = () => {
|
|
66
|
-
sort.set({
|
|
67
|
-
column: column.name,
|
|
68
|
-
order: "ascending",
|
|
69
|
-
})
|
|
70
|
-
open = false
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const sortDescending = () => {
|
|
74
|
-
sort.set({
|
|
75
|
-
column: column.name,
|
|
76
|
-
order: "descending",
|
|
77
|
-
})
|
|
78
|
-
open = false
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const moveLeft = () => {
|
|
82
|
-
reorder.actions.moveColumnLeft(column.name)
|
|
83
|
-
open = false
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const moveRight = () => {
|
|
87
|
-
reorder.actions.moveColumnRight(column.name)
|
|
88
|
-
open = false
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const makeDisplayColumn = () => {
|
|
92
|
-
columns.actions.changePrimaryDisplay(column.name)
|
|
93
|
-
open = false
|
|
94
|
-
}
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<div
|
|
98
|
-
class="header-cell"
|
|
99
|
-
class:open
|
|
100
|
-
style="flex: 0 0 {column.width}px;"
|
|
101
|
-
bind:this={anchor}
|
|
102
|
-
class:disabled={$isReordering || $isResizing}
|
|
103
|
-
class:sorted={sortedBy}
|
|
104
|
-
>
|
|
105
|
-
<GridCell
|
|
106
|
-
on:mousedown={onMouseDown}
|
|
107
|
-
on:mouseup={onMouseUp}
|
|
108
|
-
on:contextmenu={onContextMenu}
|
|
109
|
-
width={column.width}
|
|
110
|
-
left={column.left}
|
|
111
|
-
defaultHeight
|
|
112
|
-
center
|
|
113
|
-
>
|
|
114
|
-
<Icon
|
|
115
|
-
size="S"
|
|
116
|
-
name={getColumnIcon(column)}
|
|
117
|
-
color={`var(--spectrum-global-color-gray-600)`}
|
|
118
|
-
/>
|
|
119
|
-
<div class="name">
|
|
120
|
-
{column.label}
|
|
121
|
-
</div>
|
|
122
|
-
{#if sortedBy}
|
|
123
|
-
<div class="sort-indicator">
|
|
124
|
-
<Icon
|
|
125
|
-
size="S"
|
|
126
|
-
name={$sort.order === "descending" ? "SortOrderDown" : "SortOrderUp"}
|
|
127
|
-
color="var(--spectrum-global-color-gray-600)"
|
|
128
|
-
/>
|
|
129
|
-
</div>
|
|
130
|
-
{/if}
|
|
131
|
-
<div
|
|
132
|
-
class="more"
|
|
133
|
-
on:mousedown|stopPropagation
|
|
134
|
-
on:click={() => (open = true)}
|
|
135
|
-
>
|
|
136
|
-
<Icon
|
|
137
|
-
size="S"
|
|
138
|
-
name="MoreVertical"
|
|
139
|
-
color="var(--spectrum-global-color-gray-600)"
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
</GridCell>
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
<Popover
|
|
146
|
-
bind:open
|
|
147
|
-
{anchor}
|
|
148
|
-
align="right"
|
|
149
|
-
offset={0}
|
|
150
|
-
popoverTarget={document.getElementById(`grid-${rand}`)}
|
|
151
|
-
animate={false}
|
|
152
|
-
>
|
|
153
|
-
<Menu>
|
|
154
|
-
<MenuItem
|
|
155
|
-
icon="Edit"
|
|
156
|
-
on:click={editColumn}
|
|
157
|
-
disabled={!$config.allowEditColumns || column.schema.disabled}
|
|
158
|
-
>
|
|
159
|
-
Edit column
|
|
160
|
-
</MenuItem>
|
|
161
|
-
<MenuItem
|
|
162
|
-
icon="Label"
|
|
163
|
-
on:click={makeDisplayColumn}
|
|
164
|
-
disabled={idx === "sticky" ||
|
|
165
|
-
!$config.allowEditColumns ||
|
|
166
|
-
bannedDisplayColumnTypes.includes(column.schema.type)}
|
|
167
|
-
>
|
|
168
|
-
Use as display column
|
|
169
|
-
</MenuItem>
|
|
170
|
-
<MenuItem
|
|
171
|
-
icon="SortOrderUp"
|
|
172
|
-
on:click={sortAscending}
|
|
173
|
-
disabled={column.name === $sort.column && $sort.order === "ascending"}
|
|
174
|
-
>
|
|
175
|
-
Sort A-Z
|
|
176
|
-
</MenuItem>
|
|
177
|
-
<MenuItem
|
|
178
|
-
icon="SortOrderDown"
|
|
179
|
-
on:click={sortDescending}
|
|
180
|
-
disabled={column.name === $sort.column && $sort.order === "descending"}
|
|
181
|
-
>
|
|
182
|
-
Sort Z-A
|
|
183
|
-
</MenuItem>
|
|
184
|
-
<MenuItem disabled={!canMoveLeft} icon="ChevronLeft" on:click={moveLeft}>
|
|
185
|
-
Move left
|
|
186
|
-
</MenuItem>
|
|
187
|
-
<MenuItem disabled={!canMoveRight} icon="ChevronRight" on:click={moveRight}>
|
|
188
|
-
Move right
|
|
189
|
-
</MenuItem>
|
|
190
|
-
</Menu>
|
|
191
|
-
</Popover>
|
|
192
|
-
|
|
193
|
-
<style>
|
|
194
|
-
.header-cell {
|
|
195
|
-
display: flex;
|
|
196
|
-
}
|
|
197
|
-
.header-cell.disabled {
|
|
198
|
-
pointer-events: none;
|
|
199
|
-
}
|
|
200
|
-
.header-cell :global(.cell) {
|
|
201
|
-
padding: 0 var(--cell-padding);
|
|
202
|
-
gap: calc(2 * var(--cell-spacing));
|
|
203
|
-
background: var(--spectrum-global-color-gray-100);
|
|
204
|
-
}
|
|
205
|
-
.header-cell.sorted :global(.cell) {
|
|
206
|
-
background: var(--spectrum-global-color-gray-200);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.name {
|
|
210
|
-
flex: 1 1 auto;
|
|
211
|
-
width: 0;
|
|
212
|
-
white-space: nowrap;
|
|
213
|
-
text-overflow: ellipsis;
|
|
214
|
-
overflow: hidden;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.more {
|
|
218
|
-
display: none;
|
|
219
|
-
padding: 4px;
|
|
220
|
-
margin: 0 -4px;
|
|
221
|
-
}
|
|
222
|
-
.header-cell.open .more,
|
|
223
|
-
.header-cell:hover .more {
|
|
224
|
-
display: block;
|
|
225
|
-
}
|
|
226
|
-
.more:hover {
|
|
227
|
-
cursor: pointer;
|
|
228
|
-
}
|
|
229
|
-
.more:hover :global(.spectrum-Icon) {
|
|
230
|
-
color: var(--spectrum-global-color-gray-800) !important;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.header-cell.open .sort-indicator,
|
|
234
|
-
.header-cell:hover .sort-indicator {
|
|
235
|
-
display: none;
|
|
236
|
-
}
|
|
237
|
-
</style>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import LongFormCell from "./LongFormCell.svelte"
|
|
3
|
-
|
|
4
|
-
export let onChange
|
|
5
|
-
export let value
|
|
6
|
-
export let api
|
|
7
|
-
|
|
8
|
-
$: stringified = getStringifiedValue(value)
|
|
9
|
-
|
|
10
|
-
const getStringifiedValue = value => {
|
|
11
|
-
if (!value) {
|
|
12
|
-
return value
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
return JSON.stringify(value, null, 2)
|
|
16
|
-
} catch (error) {
|
|
17
|
-
return null
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const parse = value => {
|
|
22
|
-
const trimmed = value?.trim()
|
|
23
|
-
if (!trimmed) {
|
|
24
|
-
onChange(null)
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const parsed = JSON.parse(trimmed)
|
|
29
|
-
onChange(parsed)
|
|
30
|
-
} catch (error) {
|
|
31
|
-
// Swallow
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<LongFormCell {...$$props} bind:api value={stringified} onChange={parse} />
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { onMount, tick } from "svelte"
|
|
3
|
-
|
|
4
|
-
export let value
|
|
5
|
-
export let focused = false
|
|
6
|
-
export let onChange
|
|
7
|
-
export let readonly = false
|
|
8
|
-
export let api
|
|
9
|
-
export let invertX = false
|
|
10
|
-
export let invertY = false
|
|
11
|
-
|
|
12
|
-
let textarea
|
|
13
|
-
let isOpen = false
|
|
14
|
-
|
|
15
|
-
$: editable = focused && !readonly
|
|
16
|
-
$: {
|
|
17
|
-
if (!focused) {
|
|
18
|
-
isOpen = false
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const handleChange = e => {
|
|
23
|
-
onChange(e.target.value)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const onKeyDown = () => {
|
|
27
|
-
return isOpen
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const open = async () => {
|
|
31
|
-
isOpen = true
|
|
32
|
-
await tick()
|
|
33
|
-
textarea.focus()
|
|
34
|
-
textarea.setSelectionRange(0, 0)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const close = () => {
|
|
38
|
-
textarea?.blur()
|
|
39
|
-
isOpen = false
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
onMount(() => {
|
|
43
|
-
api = {
|
|
44
|
-
focus: () => open(),
|
|
45
|
-
blur: () => close(),
|
|
46
|
-
onKeyDown,
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
{#if isOpen}
|
|
52
|
-
<textarea
|
|
53
|
-
class:invertX
|
|
54
|
-
class:invertY
|
|
55
|
-
bind:this={textarea}
|
|
56
|
-
value={value || ""}
|
|
57
|
-
on:change={handleChange}
|
|
58
|
-
on:wheel|stopPropagation
|
|
59
|
-
spellcheck="false"
|
|
60
|
-
/>
|
|
61
|
-
{:else}
|
|
62
|
-
<div class="long-form-cell" on:click={editable ? open : null} class:editable>
|
|
63
|
-
<div class="value">
|
|
64
|
-
{value || ""}
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
{/if}
|
|
68
|
-
|
|
69
|
-
<style>
|
|
70
|
-
.long-form-cell {
|
|
71
|
-
flex: 1 1 auto;
|
|
72
|
-
padding: var(--cell-padding);
|
|
73
|
-
align-self: stretch;
|
|
74
|
-
display: flex;
|
|
75
|
-
align-items: flex-start;
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
}
|
|
78
|
-
.long-form-cell.editable:hover {
|
|
79
|
-
cursor: text;
|
|
80
|
-
}
|
|
81
|
-
.value {
|
|
82
|
-
display: -webkit-box;
|
|
83
|
-
-webkit-line-clamp: var(--content-lines);
|
|
84
|
-
-webkit-box-orient: vertical;
|
|
85
|
-
overflow: hidden;
|
|
86
|
-
line-height: 20px;
|
|
87
|
-
}
|
|
88
|
-
textarea {
|
|
89
|
-
padding: var(--cell-padding);
|
|
90
|
-
margin: 0;
|
|
91
|
-
border: 2px solid var(--cell-color);
|
|
92
|
-
background: var(--cell-background);
|
|
93
|
-
font-size: var(--cell-font-size);
|
|
94
|
-
font-family: var(--font-sans);
|
|
95
|
-
color: inherit;
|
|
96
|
-
position: absolute;
|
|
97
|
-
top: 0;
|
|
98
|
-
left: 0;
|
|
99
|
-
width: calc(100% + var(--max-cell-render-width-overflow));
|
|
100
|
-
height: var(--max-cell-render-height);
|
|
101
|
-
z-index: 1;
|
|
102
|
-
border-radius: 2px;
|
|
103
|
-
resize: none;
|
|
104
|
-
line-height: 20px;
|
|
105
|
-
}
|
|
106
|
-
textarea.invertX {
|
|
107
|
-
left: auto;
|
|
108
|
-
right: 0;
|
|
109
|
-
}
|
|
110
|
-
textarea.invertY {
|
|
111
|
-
transform: translateY(-100%);
|
|
112
|
-
top: calc(100% + 1px);
|
|
113
|
-
}
|
|
114
|
-
textarea:focus {
|
|
115
|
-
outline: none;
|
|
116
|
-
}
|
|
117
|
-
</style>
|