@budibase/bbui 0.9.172 → 0.9.173-alpha.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/bbui",
3
3
  "description": "A UI solution used in the different Budibase projects.",
4
- "version": "0.9.172",
4
+ "version": "0.9.173-alpha.0",
5
5
  "license": "AGPL-3.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -81,5 +81,5 @@
81
81
  "svelte-flatpickr": "^3.2.3",
82
82
  "svelte-portal": "^1.0.0"
83
83
  },
84
- "gitHead": "f33cc5a9cd747ffb8491af36ac7baf0bf66de290"
84
+ "gitHead": "2b38fa91be7ba9555f5a5bfb40d08b978afeeb92"
85
85
  }
@@ -31,7 +31,11 @@
31
31
 
32
32
  const handleChange = event => {
33
33
  const [dates] = event.detail
34
- dispatch("change", dates[0])
34
+ let newValue = dates[0]
35
+ if (newValue) {
36
+ newValue = newValue.toISOString()
37
+ }
38
+ dispatch("change", newValue)
35
39
  }
36
40
 
37
41
  const clearDateOnBackspace = event => {
@@ -57,11 +61,36 @@
57
61
  const els = document.querySelectorAll(`#${flatpickrId} input`)
58
62
  els.forEach(el => el.blur())
59
63
  }
64
+
65
+ const parseDate = val => {
66
+ if (!val) {
67
+ return null
68
+ }
69
+ let date
70
+ if (val instanceof Date) {
71
+ // Use real date obj if already parsed
72
+ date = val
73
+ } else if (isNaN(val)) {
74
+ // Treat as date string of some sort
75
+ date = new Date(val)
76
+ } else {
77
+ // Treat as numerical timestamp
78
+ date = new Date(parseInt(val))
79
+ }
80
+ const time = date.getTime()
81
+ if (isNaN(time)) {
82
+ return null
83
+ }
84
+ // By rounding to the nearest second we avoid locking up in an endless
85
+ // loop in the builder, caused by potentially enriching {{ now }} to every
86
+ // millisecond.
87
+ return new Date(Math.floor(time / 1000) * 1000)
88
+ }
60
89
  </script>
61
90
 
62
91
  <Flatpickr
63
92
  bind:flatpickr
64
- {value}
93
+ value={parseDate(value)}
65
94
  on:open={onOpen}
66
95
  on:close={onClose}
67
96
  options={flatpickrOptions}
@@ -115,7 +115,7 @@
115
115
  {#if open}
116
116
  <div
117
117
  use:clickOutside={() => (open = false)}
118
- transition:fly={{ y: -20, duration: 200 }}
118
+ transition:fly|local={{ y: -20, duration: 200 }}
119
119
  class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
120
120
  class:auto-width={autoWidth}
121
121
  >
@@ -13,10 +13,10 @@
13
13
  export let appendTo = undefined
14
14
 
15
15
  const dispatch = createEventDispatcher()
16
+
16
17
  const onChange = e => {
17
- const isoString = e.detail.toISOString()
18
- value = isoString
19
- dispatch("change", isoString)
18
+ value = e.detail
19
+ dispatch("change", e.detail)
20
20
  }
21
21
  </script>
22
22
 
@@ -5,6 +5,7 @@
5
5
  import RelationshipRenderer from "./RelationshipRenderer.svelte"
6
6
  import AttachmentRenderer from "./AttachmentRenderer.svelte"
7
7
  import ArrayRenderer from "./ArrayRenderer.svelte"
8
+ import InternalRenderer from "./InternalRenderer.svelte"
8
9
 
9
10
  export let row
10
11
  export let schema
@@ -22,8 +23,8 @@
22
23
  number: StringRenderer,
23
24
  longform: StringRenderer,
24
25
  array: ArrayRenderer,
26
+ internal: InternalRenderer,
25
27
  }
26
-
27
28
  $: type = schema?.type ?? "string"
28
29
  $: customRenderer = customRenderers?.find(x => x.column === schema?.name)
29
30
  $: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
@@ -8,11 +8,19 @@
8
8
  const selected = getContext("tab")
9
9
  let tab
10
10
  let tabInfo
11
+
11
12
  const setTabInfo = () => {
12
- tabInfo = tab.getBoundingClientRect()
13
- if ($selected.title === title) {
14
- $selected.info = tabInfo
15
- }
13
+ // If the tabs are being rendered inside a component which uses
14
+ // a svelte transition to enter, then this initial getBoundingClientRect
15
+ // will return an incorrect position.
16
+ // We just need to get this off the main thread to fix this, by using
17
+ // a 0ms timeout.
18
+ setTimeout(() => {
19
+ tabInfo = tab.getBoundingClientRect()
20
+ if ($selected.title === title) {
21
+ $selected.info = tabInfo
22
+ }
23
+ }, 0)
16
24
  }
17
25
 
18
26
  onMount(() => {