@budibase/bbui 3.28.1 → 3.28.3

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": "3.28.1",
4
+ "version": "3.28.3",
5
5
  "license": "MPL-2.0",
6
6
  "module": "dist/bbui.mjs",
7
7
  "exports": {
@@ -107,5 +107,5 @@
107
107
  }
108
108
  }
109
109
  },
110
- "gitHead": "e034f570c9fbb13b51fa2178e74764b1c3182761"
110
+ "gitHead": "40bc76dc62aa2c1876e442d464c17aa388630975"
111
111
  }
@@ -39,6 +39,8 @@
39
39
  {#if parsedOptions && Array.isArray(parsedOptions)}
40
40
  {#each parsedOptions as option}
41
41
  {@const isOptionDisabled = disabled || getOptionDisabled(option)}
42
+ {@const optionLabel = getOptionLabel(option)}
43
+ {@const optionSubtitle = getOptionSubtitle(option)}
42
44
  <div
43
45
  title={getOptionTitle(option)}
44
46
  class="spectrum-Radio spectrum-FieldGroup-item spectrum-Radio--emphasized"
@@ -54,10 +56,10 @@
54
56
  />
55
57
  <span class="spectrum-Radio-button"></span>
56
58
  <label for="" class="spectrum-Radio-label radio-label">
57
- <span class="radio-label-text">{getOptionLabel(option)}</span>
58
- {#if getOptionSubtitle(option)}
59
+ <span class="radio-label-text">{optionLabel}</span>
60
+ {#if optionSubtitle && optionSubtitle !== optionLabel}
59
61
  <span class="radio-label-subtitle">
60
- {getOptionSubtitle(option)}
62
+ {optionSubtitle}
61
63
  </span>
62
64
  {/if}
63
65
  </label>
@@ -13,8 +13,10 @@
13
13
  export let getOptionLabel = option => extractProperty(option, "label")
14
14
  export let getOptionValue = option => extractProperty(option, "value")
15
15
  export let getOptionTitle = option => extractProperty(option, "label")
16
- export let getOptionSubtitle = option => extractProperty(option, "subtitle")
17
- export let getOptionDisabled = option => extractProperty(option, "disabled")
16
+ export let getOptionSubtitle = option =>
17
+ extractProperty(option, "subtitle", undefined)
18
+ export let getOptionDisabled = option =>
19
+ extractProperty(option, "disabled", false)
18
20
  export let helpText = undefined
19
21
 
20
22
  const dispatch = createEventDispatcher()
@@ -22,11 +24,11 @@
22
24
  value = e.detail
23
25
  dispatch("change", e.detail)
24
26
  }
25
- const extractProperty = (value, property) => {
27
+ const extractProperty = (value, property, primitiveFallback = value) => {
26
28
  if (value && typeof value === "object") {
27
29
  return value[property]
28
30
  }
29
- return value
31
+ return primitiveFallback
30
32
  }
31
33
  </script>
32
34
 
@@ -5,6 +5,7 @@
5
5
 
6
6
  export let label: string | undefined = undefined
7
7
  export let value: string | undefined = undefined
8
+ export let disabled: boolean = false
8
9
 
9
10
  const copyToClipboard = (val: string | undefined) => {
10
11
  if (val) {
@@ -22,7 +23,7 @@
22
23
  <!-- svelte-ignore a11y-no-static-element-interactions -->
23
24
  <!-- svelte-ignore a11y-click-events-have-key-events -->
24
25
  <div>
25
- <Input readonly {value} {label} />
26
+ <Input readonly {disabled} {value} {label} />
26
27
  <div class="icon" on:click={() => copyToClipboard(value)}>
27
28
  <Icon size="S" name="copy" />
28
29
  </div>
@@ -43,10 +43,12 @@
43
43
  export let compact: boolean = false
44
44
  export let customPlaceholder: boolean = false
45
45
  export let showHeaderBorder: boolean = true
46
+ export let hideHeader: boolean = false
46
47
  export let placeholderText: string = "No rows found"
47
48
  export let snippets: any[] = []
48
49
  export let defaultSortColumn: string | undefined = undefined
49
50
  export let defaultSortOrder: "Ascending" | "Descending" = "Ascending"
51
+ export let rounded: boolean = false
50
52
  export let stickyHeader: boolean = true
51
53
 
52
54
  const dispatch = createEventDispatcher()
@@ -78,12 +80,14 @@
78
80
  rowCount,
79
81
  rowHeight
80
82
  )
83
+ $: effectiveHeaderHeight = hideHeader ? 0 : headerHeight
81
84
  $: heightStyle = getHeightStyle(
82
85
  visibleRowCount,
83
86
  rowCount,
84
87
  totalRowCount,
85
88
  rowHeight,
86
- loading
89
+ loading,
90
+ effectiveHeaderHeight
87
91
  )
88
92
  $: sortedRows = sortRows(rows, sortColumn, sortOrder)
89
93
  $: gridStyle = getGridStyle(fields, schema, showEditColumn)
@@ -146,15 +150,16 @@
146
150
  rowCount: number,
147
151
  totalRowCount: number,
148
152
  rowHeight: number,
149
- loading: boolean
153
+ loading: boolean,
154
+ effectiveHeaderHeight: number
150
155
  ): string => {
151
156
  if (loading) {
152
- return `height: ${headerHeight + visibleRowCount * rowHeight}px;`
157
+ return `height: ${effectiveHeaderHeight + visibleRowCount * rowHeight}px;`
153
158
  }
154
159
  if (!rowCount || !visibleRowCount || totalRowCount <= rowCount) {
155
160
  return ""
156
161
  }
157
- return `height: ${headerHeight + visibleRowCount * rowHeight}px;`
162
+ return `height: ${effectiveHeaderHeight + visibleRowCount * rowHeight}px;`
158
163
  }
159
164
 
160
165
  const getGridStyle = (
@@ -370,7 +375,7 @@
370
375
  class:wrapper--quiet={quiet}
371
376
  class:wrapper--compact={compact}
372
377
  class:wrapper--sticky-header={stickyHeader}
373
- style={`--row-height: ${rowHeight}px; --header-height: ${headerHeight}px;`}
378
+ style={`--row-height: ${rowHeight}px; --header-height: ${hideHeader ? 0 : headerHeight}px;`}
374
379
  >
375
380
  {#if loading}
376
381
  <div class="loading" style={heightStyle}>
@@ -382,9 +387,11 @@
382
387
  <div
383
388
  class="spectrum-Table"
384
389
  class:no-scroll={!rowCount}
390
+ class:rounded
385
391
  style={`${heightStyle}${gridStyle}`}
392
+ class:show-header={!hideHeader}
386
393
  >
387
- {#if fields.length}
394
+ {#if fields.length && !hideHeader}
388
395
  <div class="spectrum-Table-head">
389
396
  {#if showEditColumn}
390
397
  <div
@@ -710,11 +717,17 @@
710
717
  justify-content: center;
711
718
  align-items: center;
712
719
  border: var(--table-border);
713
- border-top: none;
714
720
  grid-column: 1 / -1;
715
721
  background-color: var(--table-bg);
716
722
  padding: 40px;
717
723
  }
724
+ .spectrum-Table.show-header .placeholder {
725
+ border-top: none;
726
+ }
727
+ .spectrum-Table:not(.show-header) {
728
+ border-top: var(--table-border);
729
+ }
730
+
718
731
  .placeholder--no-fields {
719
732
  border-top: var(--table-border);
720
733
  }
@@ -743,4 +756,23 @@
743
756
  );
744
757
  text-align: center;
745
758
  }
759
+
760
+ /* Rounded corners */
761
+ .spectrum-Table.rounded {
762
+ border-radius: 6px;
763
+ }
764
+ .rounded.show-header .spectrum-Table-head > :first-child,
765
+ .rounded:not(.show-header) .spectrum-Table-row:first-child > :first-child {
766
+ border-top-left-radius: 6px;
767
+ }
768
+ .rounded.show-header .spectrum-Table-head > :last-child,
769
+ .rounded:not(.show-header) .spectrum-Table-row:first-child > :last-child {
770
+ border-top-right-radius: 6px;
771
+ }
772
+ .rounded .spectrum-Table-row:last-child > :first-child {
773
+ border-bottom-left-radius: 6px;
774
+ }
775
+ .rounded .spectrum-Table-row:last-child > :last-child {
776
+ border-bottom-right-radius: 6px;
777
+ }
746
778
  </style>