@globalbrain/sefirot 4.61.0 → 4.61.1

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.
@@ -49,6 +49,14 @@ const avatarCellComponent = markRaw(LensTableAvatarCell)
49
49
 
50
50
  const records = computed(() => props.result?.data ?? [])
51
51
 
52
+ function createBaseColumns(): TableColumns<any, any, any> {
53
+ return {
54
+ __last_empty__: {
55
+ cell: { type: 'empty' }
56
+ }
57
+ }
58
+ }
59
+
52
60
  // Resolve the list of columns to render. We intersect the caller's
53
61
  // requested `select` with what the latest response actually fetched so
54
62
  // that toggling a column on through "Manage table view" doesn't surface
@@ -70,11 +78,17 @@ const columnKeys = computed(() => {
70
78
  return visible.map((k) => (k === '__empty__' ? `__empty__::${emptyIndex++}` : k))
71
79
  })
72
80
 
73
- const columns = computedAsync(async () => {
81
+ interface ColumnBuild {
82
+ result?: LensResult
83
+ columns: TableColumns<any, any, any>
84
+ }
85
+
86
+ const columnBuild = computedAsync<ColumnBuild>(async () => {
74
87
  const r = props.result
88
+ const columns = createBaseColumns()
75
89
 
76
90
  if (!r) {
77
- return {}
91
+ return { result: r, columns }
78
92
  }
79
93
 
80
94
  // Snapshot the column keys at the start of the run. `columnKeys` is a
@@ -85,13 +99,6 @@ const columns = computedAsync(async () => {
85
99
  // `Object.assign(_fieldData, ...)` below.
86
100
  const keys = [...columnKeys.value]
87
101
 
88
- // Prepare base columns that has `__last_empty__` to fill the end space.
89
- const columns: TableColumns<any, any, any> = {
90
- __last_empty__: {
91
- cell: { type: 'empty' }
92
- }
93
- }
94
-
95
102
  // Build the list of columns based on the resolved column key list.
96
103
  for (const key of keys) {
97
104
  // Render `__empty__` spacer keys (uniquified to `__empty__::N`) as
@@ -216,8 +223,11 @@ const columns = computedAsync(async () => {
216
223
  }
217
224
  }
218
225
 
219
- return columns
220
- }, {})
226
+ return { result: r, columns }
227
+ }, { result: undefined, columns: createBaseColumns() })
228
+
229
+ const columns = computed(() => columnBuild.value.columns)
230
+ const columnsLoading = computed(() => columnBuild.value.result !== props.result)
221
231
 
222
232
  // Render a column only once its definition exists. `columns` resolves
223
233
  // asynchronously (computedAsync), so when a column is toggled back on its key
@@ -241,6 +251,7 @@ const table = useTable({
241
251
  // settling re-keys it. STable reads this inside a computed, so the getter
242
252
  // establishes the dependency and selection re-keys correctly.
243
253
  get indexField() { return props.indexField },
254
+ get loading() { return props.loading || columnsLoading.value },
244
255
  borderless: true
245
256
  })
246
257
 
@@ -299,7 +310,6 @@ function makeEditableField(r: LensResult, key?: string | null): Field<FieldData>
299
310
  :class="{ 'is-loading': loading, 'is-empty': (result?.data.length ?? 0) === 0 }"
300
311
  >
301
312
  <STable
302
- v-if="Object.keys(columns).length > 0"
303
313
  class="table"
304
314
  :options="table"
305
315
  :selected
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "4.61.0",
3
+ "version": "4.61.1",
4
4
  "description": "Vue Components for Global Brain Design System.",
5
5
  "keywords": [
6
6
  "components",