@budibase/bbui 2.15.3 → 2.15.6

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": "2.15.3",
4
+ "version": "2.15.6",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -36,8 +36,8 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@adobe/spectrum-css-workflow-icons": "1.2.1",
39
- "@budibase/shared-core": "2.15.3",
40
- "@budibase/string-templates": "2.15.3",
39
+ "@budibase/shared-core": "2.15.6",
40
+ "@budibase/string-templates": "2.15.6",
41
41
  "@spectrum-css/accordion": "3.0.24",
42
42
  "@spectrum-css/actionbutton": "1.0.1",
43
43
  "@spectrum-css/actiongroup": "1.0.1",
@@ -104,5 +104,5 @@
104
104
  }
105
105
  }
106
106
  },
107
- "gitHead": "e52a4ce7fe4dbe0f7bbd5df7eaeef059fbc62111"
107
+ "gitHead": "307969d67826806a587a318f36266c9f3a33391e"
108
108
  }
@@ -18,7 +18,6 @@ export default function positionDropdown(element, opts) {
18
18
  useAnchorWidth,
19
19
  offset = 5,
20
20
  customUpdate,
21
- offsetBelow,
22
21
  } = opts
23
22
  if (!anchor) {
24
23
  return
@@ -48,7 +47,7 @@ export default function positionDropdown(element, opts) {
48
47
  styles.top = anchorBounds.top - elementBounds.height - offset
49
48
  styles.maxHeight = maxHeight || 240
50
49
  } else {
51
- styles.top = anchorBounds.bottom + (offsetBelow || offset)
50
+ styles.top = anchorBounds.bottom + offset
52
51
  styles.maxHeight =
53
52
  maxHeight || window.innerHeight - anchorBounds.bottom - 20
54
53
  }
@@ -15,8 +15,6 @@
15
15
  export let autoWidth = false
16
16
  export let searchTerm = null
17
17
  export let customPopoverHeight
18
- export let customPopoverOffsetBelow
19
- export let customPopoverMaxHeight
20
18
  export let open = false
21
19
  export let loading
22
20
 
@@ -98,7 +96,5 @@
98
96
  {sort}
99
97
  {autoWidth}
100
98
  {customPopoverHeight}
101
- {customPopoverOffsetBelow}
102
- {customPopoverMaxHeight}
103
99
  {loading}
104
100
  />
@@ -37,8 +37,6 @@
37
37
  export let sort = false
38
38
  export let searchTerm = null
39
39
  export let customPopoverHeight
40
- export let customPopoverOffsetBelow
41
- export let customPopoverMaxHeight
42
40
  export let align = "left"
43
41
  export let footer = null
44
42
  export let customAnchor = null
@@ -156,9 +154,7 @@
156
154
  on:close={() => (open = false)}
157
155
  useAnchorWidth={!autoWidth}
158
156
  maxWidth={autoWidth ? 400 : null}
159
- maxHeight={customPopoverMaxHeight}
160
157
  customHeight={customPopoverHeight}
161
- offsetBelow={customPopoverOffsetBelow}
162
158
  >
163
159
  <div
164
160
  class="popover-content"
@@ -12,6 +12,7 @@
12
12
  export let getOptionIcon = () => null
13
13
  export let getOptionColour = () => null
14
14
  export let getOptionSubtitle = () => null
15
+ export let compare = null
15
16
  export let useOptionIconImage = false
16
17
  export let isOptionEnabled
17
18
  export let readonly = false
@@ -23,8 +24,6 @@
23
24
  export let footer = null
24
25
  export let open = false
25
26
  export let tag = null
26
- export let customPopoverOffsetBelow
27
- export let customPopoverMaxHeight
28
27
  export let searchTerm = null
29
28
  export let loading
30
29
 
@@ -34,13 +33,19 @@
34
33
  $: fieldIcon = getFieldAttribute(getOptionIcon, value, options)
35
34
  $: fieldColour = getFieldAttribute(getOptionColour, value, options)
36
35
 
36
+ function compareOptionAndValue(option, value) {
37
+ return typeof compare === "function"
38
+ ? compare(option, value)
39
+ : option === value
40
+ }
41
+
37
42
  const getFieldAttribute = (getAttribute, value, options) => {
38
43
  // Wait for options to load if there is a value but no options
39
44
  if (!options?.length) {
40
45
  return ""
41
46
  }
42
- const index = options.findIndex(
43
- (option, idx) => getOptionValue(option, idx) === value
47
+ const index = options.findIndex((option, idx) =>
48
+ compareOptionAndValue(getOptionValue(option, idx), value)
44
49
  )
45
50
  return index !== -1 ? getAttribute(options[index], index) : null
46
51
  }
@@ -90,11 +95,9 @@
90
95
  {autocomplete}
91
96
  {sort}
92
97
  {tag}
93
- {customPopoverOffsetBelow}
94
- {customPopoverMaxHeight}
95
98
  isPlaceholder={value == null || value === ""}
96
99
  placeholderOption={placeholder === false ? null : placeholder}
97
- isOptionSelected={option => option === value}
100
+ isOptionSelected={option => compareOptionAndValue(option, value)}
98
101
  onSelectOption={selectOption}
99
102
  {loading}
100
103
  />
@@ -28,6 +28,7 @@
28
28
  export let footer = null
29
29
  export let tag = null
30
30
  export let helpText = null
31
+ export let compare
31
32
  const dispatch = createEventDispatcher()
32
33
  const onChange = e => {
33
34
  value = e.detail
@@ -65,6 +66,7 @@
65
66
  {autocomplete}
66
67
  {customPopoverHeight}
67
68
  {tag}
69
+ {compare}
68
70
  on:change={onChange}
69
71
  on:click
70
72
  />
@@ -18,7 +18,6 @@
18
18
  export let useAnchorWidth = false
19
19
  export let dismissible = true
20
20
  export let offset = 5
21
- export let offsetBelow
22
21
  export let customHeight
23
22
  export let animate = true
24
23
  export let customZindex
@@ -89,7 +88,6 @@
89
88
  maxWidth,
90
89
  useAnchorWidth,
91
90
  offset,
92
- offsetBelow,
93
91
  customUpdate: handlePostionUpdate,
94
92
  }}
95
93
  use:clickOutside={{