@budibase/bbui 1.58.13 → 2.0.0
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/LICENSE +375 -0
- package/dist/bbui.es.js +14 -0
- package/dist/bbui.es.js.map +1 -0
- package/package.json +68 -32
- package/src/ActionButton/ActionButton.svelte +102 -0
- package/src/ActionGroup/ActionGroup.svelte +26 -0
- package/src/ActionMenu/ActionMenu.svelte +44 -0
- package/src/Actions/autoresize_textarea.js +9 -9
- package/src/Actions/click_outside.js +5 -5
- package/src/Actions/position_dropdown.js +46 -37
- package/src/Avatar/Avatar.svelte +62 -0
- package/src/Badge/Badge.svelte +29 -0
- package/src/Banner/Banner.svelte +72 -0
- package/src/Banner/BannerDisplay.svelte +41 -0
- package/src/Button/Button.svelte +102 -200
- package/src/ButtonGroup/ButtonGroup.svelte +30 -0
- package/src/ClearButton/ClearButton.svelte +19 -0
- package/src/ColorPicker/ColorPicker.svelte +297 -0
- package/src/DetailSummary/DetailSummary.svelte +83 -0
- package/src/Divider/Divider.svelte +28 -0
- package/src/Drawer/Drawer.svelte +76 -51
- package/src/Drawer/DrawerContent.svelte +46 -0
- package/src/Form/Checkbox.svelte +21 -132
- package/src/Form/Combobox.svelte +45 -0
- package/src/Form/Core/Checkbox.svelte +69 -0
- package/src/Form/Core/CheckboxGroup.svelte +68 -0
- package/src/Form/Core/Combobox.svelte +142 -0
- package/src/Form/Core/DatePicker.svelte +257 -0
- package/src/Form/Core/Dropzone.svelte +453 -0
- package/src/Form/Core/InputDropdown.svelte +228 -0
- package/src/Form/Core/Multiselect.svelte +90 -0
- package/src/Form/Core/Picker.svelte +259 -0
- package/src/Form/Core/PickerDropdown.svelte +415 -0
- package/src/Form/Core/RadioGroup.svelte +48 -0
- package/src/Form/Core/RichTextField.svelte +42 -0
- package/src/Form/Core/Search.svelte +105 -0
- package/src/Form/Core/Select.svelte +75 -0
- package/src/Form/Core/Slider.svelte +86 -0
- package/src/Form/Core/Stepper.svelte +172 -0
- package/src/Form/Core/Switch.svelte +37 -0
- package/src/Form/Core/TextArea.svelte +78 -0
- package/src/Form/Core/TextField.svelte +119 -0
- package/src/Form/Core/index.js +15 -0
- package/src/Form/DatePicker.svelte +39 -0
- package/src/Form/Dropzone.svelte +42 -0
- package/src/Form/Field.svelte +42 -0
- package/src/Form/FieldLabel.svelte +32 -0
- package/src/Form/Input.svelte +41 -187
- package/src/Form/InputDropdown.svelte +55 -0
- package/src/Form/Multiselect.svelte +36 -320
- package/src/Form/PickerDropdown.svelte +132 -0
- package/src/Form/RadioGroup.svelte +42 -0
- package/src/Form/RichTextField.svelte +36 -0
- package/src/Form/Search.svelte +36 -0
- package/src/Form/Select.svelte +48 -88
- package/src/Form/Slider.svelte +16 -91
- package/src/Form/Stepper.svelte +45 -0
- package/src/Form/TextArea.svelte +30 -128
- package/src/Form/Toggle.svelte +20 -110
- package/src/Icon/Icon.svelte +91 -0
- package/src/Icon/IconAvatar.svelte +58 -0
- package/src/IconPicker/IconPicker.svelte +177 -0
- package/src/IconSideNav/IconSideNav.svelte +14 -0
- package/src/IconSideNav/IconSideNavItem.svelte +56 -0
- package/src/InlineAlert/InlineAlert.svelte +60 -0
- package/src/Label/Label.svelte +29 -0
- package/src/Layout/Layout.svelte +94 -0
- package/src/Layout/Page.svelte +32 -0
- package/src/Link/Link.svelte +24 -0
- package/src/List/List.svelte +28 -0
- package/src/List/ListItem.svelte +90 -0
- package/src/Markdown/MarkdownEditor.svelte +60 -0
- package/src/Markdown/MarkdownViewer.svelte +70 -0
- package/src/Markdown/SpectrumMDE.svelte +184 -0
- package/src/Menu/Item.svelte +96 -0
- package/src/Menu/Menu.svelte +7 -0
- package/src/Menu/Menu.svench +19 -0
- package/src/Menu/Section.svelte +10 -0
- package/src/Menu/Separator.svelte +1 -0
- package/src/Modal/Content.svelte +0 -11
- package/src/Modal/CustomContent.svelte +9 -6
- package/src/Modal/Modal.svelte +104 -51
- package/src/Modal/ModalContent.svelte +131 -73
- package/src/Modal/QuizModal.svelte +16 -17
- package/src/Notification/Notification.svelte +70 -0
- package/src/Notification/NotificationDisplay.svelte +43 -0
- package/src/Pagination/Pagination.svelte +57 -0
- package/src/Popover/Popover.svelte +43 -33
- package/src/ProgressBar/ProgressBar.svelte +67 -0
- package/src/ProgressCircle/ProgressCircle.svelte +62 -0
- package/src/SideNavigation/Item.svelte +61 -0
- package/src/SideNavigation/Navigation.svelte +12 -0
- package/src/StatusLight/StatusLight.svelte +80 -0
- package/src/Stores/Notifications.svench.svx +1 -1
- package/src/Stores/banner.js +65 -0
- package/src/Stores/notifications.js +75 -38
- package/src/Table/ArrayRenderer.svelte +17 -0
- package/src/Table/AttachmentRenderer.svelte +73 -0
- package/src/Table/BoldRenderer.svelte +15 -0
- package/src/Table/BooleanRenderer.svelte +42 -0
- package/src/Table/CellRenderer.svelte +69 -0
- package/src/Table/CodeRenderer.svelte +14 -0
- package/src/Table/DateTimeRenderer.svelte +29 -0
- package/src/Table/InternalRenderer.svelte +24 -0
- package/src/Table/RelationshipRenderer.svelte +40 -0
- package/src/Table/SelectEditRenderer.svelte +28 -0
- package/src/Table/StringRenderer.svelte +14 -0
- package/src/Table/Table.svelte +635 -0
- package/src/Table/index.js +1 -0
- package/src/Tabs/Tab.svelte +88 -0
- package/src/Tabs/Tabs.svelte +130 -0
- package/src/Tags/Tag.svelte +43 -0
- package/src/Tags/Tags.svelte +7 -0
- package/src/Tooltip/Tooltip.svelte +34 -0
- package/src/Tooltip/TooltipWrapper.svelte +60 -0
- package/src/TreeView/Item.svelte +41 -0
- package/src/TreeView/Tree.svelte +16 -0
- package/src/Typography/Body.svelte +21 -0
- package/src/Typography/Code.svelte +10 -0
- package/src/Typography/Detail.svelte +19 -0
- package/src/Typography/Heading.svelte +17 -0
- package/{dist → src}/bbui.css +2 -99
- package/src/context.js +1 -1
- package/src/helpers.js +134 -0
- package/src/index.js +95 -40
- package/src/spectrum-icons-rollup.js +31 -0
- package/src/spectrum-icons-vite.js +31 -0
- package/dist/dist/bundle.css +0 -42
- package/dist/dist/bundle.css.map +0 -64
- package/dist/index.js +0 -36193
- package/dist/index.mjs +0 -36147
- package/src/Button/Close.svelte +0 -59
- package/src/Button/Close.svench +0 -36
- package/src/Button/TextButton.svelte +0 -128
- package/src/Button/TextButton.svench +0 -69
- package/src/DatePicker/DatePicker.svelte +0 -45
- package/src/DatePicker/DatePicker.svench +0 -17
- package/src/DropdownMenu/DropdownMenu.svelte +0 -77
- package/src/DropdownMenu/DropdownMenu.svench +0 -161
- package/src/Dropzone/Dropzone.svelte +0 -294
- package/src/Dropzone/Dropzone.svench +0 -17
- package/src/Dropzone/fileTypes.js +0 -5
- package/src/Form/Checkbox.svench.svx +0 -67
- package/src/Form/DataList.svelte +0 -158
- package/src/Form/DataList.svench +0 -57
- package/src/Form/Input.svench +0 -62
- package/src/Form/Multiselect.svench +0 -63
- package/src/Form/Radio.svelte +0 -133
- package/src/Form/Radio.svench.svx +0 -64
- package/src/Form/RichText.svelte +0 -61
- package/src/Form/RichText.svench.svx +0 -40
- package/src/Form/Select.svench +0 -62
- package/src/Form/Slider.svench +0 -26
- package/src/Form/TextArea.svench +0 -30
- package/src/Form/Toggle.svench +0 -21
- package/src/Icons/Contribution.svelte +0 -14
- package/src/Icons/Icon.svelte +0 -36
- package/src/Icons/Icon.svench +0 -109
- package/src/Icons/icon-paths.js +0 -136
- package/src/Links/Home.svelte +0 -51
- package/src/Links/Home.svench +0 -19
- package/src/List/Items/DetailSummary.svelte +0 -85
- package/src/List/Items/DetailSummary.svench +0 -53
- package/src/List/Search.svelte +0 -34
- package/src/List/Search.svench +0 -8
- package/src/Spacer/Spacer.svelte +0 -50
- package/src/Spacer/Spacer.svench +0 -51
- package/src/Styleguide/Body.svelte +0 -72
- package/src/Styleguide/Borders.svench +0 -175
- package/src/Styleguide/Budibase-logo.svelte +0 -68
- package/src/Styleguide/Color.svench +0 -201
- package/src/Styleguide/Heading.svelte +0 -74
- package/src/Styleguide/Label.svelte +0 -70
- package/src/Styleguide/Logo.svelte +0 -16
- package/src/Styleguide/Logo.svench +0 -8
- package/src/Styleguide/Spacing.svench +0 -191
- package/src/Styleguide/Typography.svench +0 -227
- package/src/Switcher/Switcher.svelte +0 -47
- package/src/Switcher/Switcher.svench +0 -27
- package/src/index.svench.svx +0 -35
- package/src/utils/buildStyle.js +0 -14
|
@@ -1,47 +1,84 @@
|
|
|
1
|
-
import { writable
|
|
2
|
-
|
|
3
|
-
const NOTIFICATION_TIMEOUT = 3000
|
|
4
|
-
|
|
5
|
-
const createNotificationStore = () => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { writable } from "svelte/store"
|
|
2
|
+
|
|
3
|
+
const NOTIFICATION_TIMEOUT = 3000
|
|
4
|
+
|
|
5
|
+
export const createNotificationStore = () => {
|
|
6
|
+
const timeoutIds = new Set()
|
|
7
|
+
const _notifications = writable([], () => {
|
|
8
|
+
return () => {
|
|
9
|
+
// clear all the timers
|
|
10
|
+
timeoutIds.forEach(timeoutId => {
|
|
11
|
+
clearTimeout(timeoutId)
|
|
12
|
+
})
|
|
13
|
+
_notifications.set([])
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
let block = false
|
|
17
|
+
|
|
18
|
+
const blockNotifications = (timeout = 1000) => {
|
|
19
|
+
block = true
|
|
20
|
+
setTimeout(() => (block = false), timeout)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const send = (
|
|
24
|
+
message,
|
|
25
|
+
{
|
|
26
|
+
type = "default",
|
|
27
|
+
icon = "",
|
|
28
|
+
autoDismiss = true,
|
|
29
|
+
action = null,
|
|
30
|
+
wide = false,
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
) => {
|
|
33
|
+
if (block) {
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
let _id = id()
|
|
37
|
+
_notifications.update(state => {
|
|
38
|
+
return [
|
|
39
|
+
...state,
|
|
40
|
+
{
|
|
41
|
+
id: _id,
|
|
42
|
+
type,
|
|
43
|
+
message,
|
|
44
|
+
icon,
|
|
45
|
+
dismissable: !autoDismiss,
|
|
46
|
+
action,
|
|
47
|
+
wide,
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
if (autoDismiss) {
|
|
52
|
+
const timeoutId = setTimeout(() => {
|
|
53
|
+
dismissNotification(_id)
|
|
54
|
+
}, NOTIFICATION_TIMEOUT)
|
|
55
|
+
timeoutIds.add(timeoutId)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const dismissNotification = id => {
|
|
60
|
+
_notifications.update(state => {
|
|
61
|
+
return state.filter(n => n.id !== id)
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const { subscribe } = _notifications
|
|
32
66
|
|
|
33
67
|
return {
|
|
34
68
|
subscribe,
|
|
35
69
|
send,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
70
|
+
info: msg => send(msg, { type: "info", icon: "Info" }),
|
|
71
|
+
error: msg =>
|
|
72
|
+
send(msg, { type: "error", icon: "Alert", autoDismiss: false }),
|
|
73
|
+
warning: msg => send(msg, { type: "warning", icon: "Alert" }),
|
|
74
|
+
success: msg => send(msg, { type: "success", icon: "CheckmarkCircle" }),
|
|
75
|
+
blockNotifications,
|
|
76
|
+
dismiss: dismissNotification,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
42
79
|
|
|
43
80
|
function id() {
|
|
44
|
-
return "_" + Math.random().toString(36).
|
|
81
|
+
return "_" + Math.random().toString(36).slice(2, 9)
|
|
45
82
|
}
|
|
46
83
|
|
|
47
|
-
export const notifications = createNotificationStore()
|
|
84
|
+
export const notifications = createNotificationStore()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/label/dist/index-vars.css"
|
|
3
|
+
import Badge from "../Badge/Badge.svelte"
|
|
4
|
+
export let value
|
|
5
|
+
|
|
6
|
+
const displayLimit = 5
|
|
7
|
+
|
|
8
|
+
$: badges = Array.isArray(value) ? value.slice(0, displayLimit) : []
|
|
9
|
+
$: leftover = (value?.length ?? 0) - badges.length
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#each badges as badge}
|
|
13
|
+
<Badge size="S" grey>{badge}</Badge>
|
|
14
|
+
{/each}
|
|
15
|
+
{#if leftover}
|
|
16
|
+
<div>+{leftover} more</div>
|
|
17
|
+
{/if}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Link from "../Link/Link.svelte"
|
|
3
|
+
|
|
4
|
+
export let value
|
|
5
|
+
|
|
6
|
+
const displayLimit = 5
|
|
7
|
+
$: attachments = value?.slice(0, displayLimit) ?? []
|
|
8
|
+
$: leftover = (value?.length ?? 0) - attachments.length
|
|
9
|
+
|
|
10
|
+
const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
|
|
11
|
+
const isImage = extension => {
|
|
12
|
+
return imageExtensions.includes(extension?.toLowerCase())
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#each attachments as attachment}
|
|
17
|
+
{#if isImage(attachment.extension)}
|
|
18
|
+
<Link
|
|
19
|
+
quiet
|
|
20
|
+
target="_blank"
|
|
21
|
+
download={attachment.name}
|
|
22
|
+
href={attachment.url}
|
|
23
|
+
on:click={e => {
|
|
24
|
+
e.stopPropagation()
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<div class="center" title={attachment.name}>
|
|
28
|
+
<img src={attachment.url} alt={attachment.extension} />
|
|
29
|
+
</div>
|
|
30
|
+
</Link>
|
|
31
|
+
{:else}
|
|
32
|
+
<div class="file" title={attachment.name}>
|
|
33
|
+
<Link
|
|
34
|
+
quiet
|
|
35
|
+
target="_blank"
|
|
36
|
+
download={attachment.name}
|
|
37
|
+
href={attachment.url}
|
|
38
|
+
on:click={e => {
|
|
39
|
+
e.stopPropagation()
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{attachment.extension}
|
|
43
|
+
</Link>
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
{/each}
|
|
47
|
+
{#if leftover}
|
|
48
|
+
<div>+{leftover} more</div>
|
|
49
|
+
{/if}
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
img {
|
|
53
|
+
height: 32px;
|
|
54
|
+
max-width: 64px;
|
|
55
|
+
}
|
|
56
|
+
.center,
|
|
57
|
+
.file {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
justify-content: flex-start;
|
|
61
|
+
align-items: center;
|
|
62
|
+
}
|
|
63
|
+
.file {
|
|
64
|
+
height: 32px;
|
|
65
|
+
padding: 0 8px;
|
|
66
|
+
color: var(--spectrum-global-color-gray-800);
|
|
67
|
+
border: 1px solid var(--spectrum-global-color-gray-300);
|
|
68
|
+
border-radius: 4px;
|
|
69
|
+
text-transform: uppercase;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
font-size: 11px;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/checkbox/dist/index-vars.css"
|
|
3
|
+
|
|
4
|
+
export let value
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<label
|
|
8
|
+
class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-Checkbox--emphasized"
|
|
9
|
+
>
|
|
10
|
+
<input
|
|
11
|
+
type="checkbox"
|
|
12
|
+
class="spectrum-Checkbox-input"
|
|
13
|
+
id="checkbox-1"
|
|
14
|
+
disabled
|
|
15
|
+
checked={!!value}
|
|
16
|
+
/>
|
|
17
|
+
<span class="spectrum-Checkbox-box">
|
|
18
|
+
<svg
|
|
19
|
+
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Checkbox-checkmark"
|
|
20
|
+
focusable="false"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
>
|
|
23
|
+
<use xlink:href="#spectrum-css-icon-Checkmark100" />
|
|
24
|
+
</svg>
|
|
25
|
+
<svg
|
|
26
|
+
class="spectrum-Icon spectrum-UIIcon-Dash100 spectrum-Checkbox-partialCheckmark"
|
|
27
|
+
focusable="false"
|
|
28
|
+
aria-hidden="true"
|
|
29
|
+
>
|
|
30
|
+
<use xlink:href="#spectrum-css-icon-Dash100" />
|
|
31
|
+
</svg>
|
|
32
|
+
</span>
|
|
33
|
+
</label>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.spectrum-Checkbox {
|
|
37
|
+
min-height: 0;
|
|
38
|
+
}
|
|
39
|
+
.spectrum-Checkbox-box {
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import StringRenderer from "./StringRenderer.svelte"
|
|
3
|
+
import BooleanRenderer from "./BooleanRenderer.svelte"
|
|
4
|
+
import DateTimeRenderer from "./DateTimeRenderer.svelte"
|
|
5
|
+
import RelationshipRenderer from "./RelationshipRenderer.svelte"
|
|
6
|
+
import AttachmentRenderer from "./AttachmentRenderer.svelte"
|
|
7
|
+
import ArrayRenderer from "./ArrayRenderer.svelte"
|
|
8
|
+
import InternalRenderer from "./InternalRenderer.svelte"
|
|
9
|
+
import { processStringSync } from "@budibase/string-templates"
|
|
10
|
+
|
|
11
|
+
export let row
|
|
12
|
+
export let schema
|
|
13
|
+
export let value
|
|
14
|
+
export let customRenderers = []
|
|
15
|
+
|
|
16
|
+
let renderer
|
|
17
|
+
const typeMap = {
|
|
18
|
+
boolean: BooleanRenderer,
|
|
19
|
+
datetime: DateTimeRenderer,
|
|
20
|
+
link: RelationshipRenderer,
|
|
21
|
+
attachment: AttachmentRenderer,
|
|
22
|
+
string: StringRenderer,
|
|
23
|
+
options: StringRenderer,
|
|
24
|
+
number: StringRenderer,
|
|
25
|
+
longform: StringRenderer,
|
|
26
|
+
array: ArrayRenderer,
|
|
27
|
+
internal: InternalRenderer,
|
|
28
|
+
}
|
|
29
|
+
$: type = getType(schema)
|
|
30
|
+
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)
|
|
31
|
+
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
|
|
32
|
+
$: width = schema?.width || "150px"
|
|
33
|
+
$: cellValue = getCellValue(value, schema.template)
|
|
34
|
+
|
|
35
|
+
const getType = schema => {
|
|
36
|
+
// Use a string renderer for dates if we use a custom template
|
|
37
|
+
if (schema?.type === "datetime" && schema?.template) {
|
|
38
|
+
return "string"
|
|
39
|
+
}
|
|
40
|
+
return schema?.type || "string"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const getCellValue = (value, template) => {
|
|
44
|
+
if (!template) {
|
|
45
|
+
return value
|
|
46
|
+
}
|
|
47
|
+
return processStringSync(template, { value })
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#if renderer && (customRenderer || (cellValue != null && cellValue !== ""))}
|
|
52
|
+
<div style="--max-cell-width: {schema.width ? 'none' : '200px'};">
|
|
53
|
+
<svelte:component
|
|
54
|
+
this={renderer}
|
|
55
|
+
{row}
|
|
56
|
+
{schema}
|
|
57
|
+
value={cellValue}
|
|
58
|
+
on:clickrelationship
|
|
59
|
+
>
|
|
60
|
+
<slot />
|
|
61
|
+
</svelte:component>
|
|
62
|
+
</div>
|
|
63
|
+
{/if}
|
|
64
|
+
|
|
65
|
+
<style>
|
|
66
|
+
div {
|
|
67
|
+
display: contents;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import dayjs from "dayjs"
|
|
3
|
+
|
|
4
|
+
export let value
|
|
5
|
+
export let schema
|
|
6
|
+
|
|
7
|
+
// adding the 0- will turn a string like 00:00:00 into a valid ISO
|
|
8
|
+
// date, but will make actual ISO dates invalid
|
|
9
|
+
$: time = new Date(`0-${value}`)
|
|
10
|
+
$: isTimeOnly = !isNaN(time) || schema?.timeOnly
|
|
11
|
+
$: isDateOnly = schema?.dateOnly
|
|
12
|
+
$: format = isTimeOnly
|
|
13
|
+
? "HH:mm:ss"
|
|
14
|
+
: isDateOnly
|
|
15
|
+
? "MMMM D YYYY"
|
|
16
|
+
: "MMMM D YYYY, HH:mm"
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div>
|
|
20
|
+
{dayjs(isTimeOnly ? time : value).format(format)}
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
div {
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Icon from "../Icon/Icon.svelte"
|
|
3
|
+
import { copyToClipboard } from "../helpers"
|
|
4
|
+
import { notifications } from "../Stores/notifications"
|
|
5
|
+
|
|
6
|
+
export let value
|
|
7
|
+
|
|
8
|
+
const onClick = async e => {
|
|
9
|
+
e.stopPropagation()
|
|
10
|
+
try {
|
|
11
|
+
await copyToClipboard(value)
|
|
12
|
+
notifications.success("Copied to clipboard")
|
|
13
|
+
} catch (error) {
|
|
14
|
+
notifications.error(
|
|
15
|
+
"Failed to copy to clipboard. Check the dev console for the value."
|
|
16
|
+
)
|
|
17
|
+
console.warn("Failed to copy the value", value)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div on:click|stopPropagation={onClick}>
|
|
23
|
+
<Icon size="S" name="Copy" />
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/label/dist/index-vars.css"
|
|
3
|
+
import { createEventDispatcher } from "svelte"
|
|
4
|
+
|
|
5
|
+
export let row
|
|
6
|
+
export let value
|
|
7
|
+
export let schema
|
|
8
|
+
|
|
9
|
+
const dispatch = createEventDispatcher()
|
|
10
|
+
const displayLimit = 5
|
|
11
|
+
|
|
12
|
+
$: relationships = value?.slice(0, displayLimit) ?? []
|
|
13
|
+
$: leftover = (value?.length ?? 0) - relationships.length
|
|
14
|
+
|
|
15
|
+
const onClick = e => {
|
|
16
|
+
e.stopPropagation()
|
|
17
|
+
dispatch("clickrelationship", {
|
|
18
|
+
tableId: row.tableId,
|
|
19
|
+
rowId: row._id,
|
|
20
|
+
fieldName: schema?.name,
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#each relationships as relationship}
|
|
26
|
+
{#if relationship?.primaryDisplay}
|
|
27
|
+
<span class="spectrum-Label spectrum-Label--grey" on:click={onClick}>
|
|
28
|
+
{relationship.primaryDisplay}
|
|
29
|
+
</span>
|
|
30
|
+
{/if}
|
|
31
|
+
{/each}
|
|
32
|
+
{#if leftover}
|
|
33
|
+
<div>+{leftover} more</div>
|
|
34
|
+
{/if}
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
span:hover {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Checkbox from "../Form/Checkbox.svelte"
|
|
3
|
+
import ActionButton from "../ActionButton/ActionButton.svelte"
|
|
4
|
+
|
|
5
|
+
export let selected
|
|
6
|
+
export let onEdit
|
|
7
|
+
export let allowSelectRows = false
|
|
8
|
+
export let allowEditRows = false
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div>
|
|
12
|
+
{#if allowSelectRows}
|
|
13
|
+
<Checkbox value={selected} />
|
|
14
|
+
{/if}
|
|
15
|
+
{#if allowEditRows}
|
|
16
|
+
<ActionButton size="S" on:click={onEdit}>Edit</ActionButton>
|
|
17
|
+
{/if}
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
div {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: var(--spacing-m);
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export let value
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div>{typeof value === "object" ? JSON.stringify(value) : value}</div>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
div {
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
max-width: var(--max-cell-width);
|
|
13
|
+
}
|
|
14
|
+
</style>
|