@lapis-notes/bases 0.1.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.
Files changed (155) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE.md +8 -0
  3. package/README.md +20 -0
  4. package/dist/bases-plugin.d.ts +10 -0
  5. package/dist/bases-plugin.js +118 -0
  6. package/dist/bases-view/app-database-query-source.d.ts +30 -0
  7. package/dist/bases-view/app-database-query-source.js +248 -0
  8. package/dist/bases-view/bases.svelte.d.ts +569 -0
  9. package/dist/bases-view/bases.svelte.js +910 -0
  10. package/dist/bases-view/card-view/components/card-placeholder.svelte +68 -0
  11. package/dist/bases-view/card-view/components/card-placeholder.svelte.d.ts +7 -0
  12. package/dist/bases-view/card-view/components/card.svelte +289 -0
  13. package/dist/bases-view/card-view/components/card.svelte.d.ts +7 -0
  14. package/dist/bases-view/card-view/index.d.ts +11 -0
  15. package/dist/bases-view/card-view/index.js +55 -0
  16. package/dist/bases-view/cell-editor-options.d.ts +2 -0
  17. package/dist/bases-view/cell-editor-options.js +26 -0
  18. package/dist/bases-view/cell-editor.svelte +206 -0
  19. package/dist/bases-view/cell-editor.svelte.d.ts +12 -0
  20. package/dist/bases-view/cell.svelte +132 -0
  21. package/dist/bases-view/cell.svelte.d.ts +16 -0
  22. package/dist/bases-view/column-definition.d.ts +22 -0
  23. package/dist/bases-view/column-definition.js +149 -0
  24. package/dist/bases-view/columns.d.ts +15 -0
  25. package/dist/bases-view/columns.js +103 -0
  26. package/dist/bases-view/components/Tag.svelte +14 -0
  27. package/dist/bases-view/components/Tag.svelte.d.ts +8 -0
  28. package/dist/bases-view/components/autocomplete.svelte +45 -0
  29. package/dist/bases-view/components/autocomplete.svelte.d.ts +17 -0
  30. package/dist/bases-view/components/card-image.svelte +121 -0
  31. package/dist/bases-view/components/card-image.svelte.d.ts +11 -0
  32. package/dist/bases-view/components/column-visibility.svelte +388 -0
  33. package/dist/bases-view/components/column-visibility.svelte.d.ts +13 -0
  34. package/dist/bases-view/components/datetime.svelte +35 -0
  35. package/dist/bases-view/components/datetime.svelte.d.ts +7 -0
  36. package/dist/bases-view/components/file.svelte +31 -0
  37. package/dist/bases-view/components/file.svelte.d.ts +8 -0
  38. package/dist/bases-view/components/filters/filter-editor.svelte +102 -0
  39. package/dist/bases-view/components/filters/filter-editor.svelte.d.ts +10 -0
  40. package/dist/bases-view/components/filters/filter-group.svelte +142 -0
  41. package/dist/bases-view/components/filters/filter-group.svelte.d.ts +11 -0
  42. package/dist/bases-view/components/filters/filter-properties.svelte +77 -0
  43. package/dist/bases-view/components/filters/filter-properties.svelte.d.ts +8 -0
  44. package/dist/bases-view/components/filters/filter-root.svelte +112 -0
  45. package/dist/bases-view/components/filters/filter-root.svelte.d.ts +12 -0
  46. package/dist/bases-view/components/filters/filter-row.svelte +351 -0
  47. package/dist/bases-view/components/filters/filter-row.svelte.d.ts +11 -0
  48. package/dist/bases-view/components/group/group-root.svelte +120 -0
  49. package/dist/bases-view/components/group/group-root.svelte.d.ts +8 -0
  50. package/dist/bases-view/components/limit.svelte +100 -0
  51. package/dist/bases-view/components/limit.svelte.d.ts +12 -0
  52. package/dist/bases-view/components/query-editor.svelte +230 -0
  53. package/dist/bases-view/components/query-editor.svelte.d.ts +15 -0
  54. package/dist/bases-view/components/sort/sort-direction-labels.d.ts +9 -0
  55. package/dist/bases-view/components/sort/sort-direction-labels.js +25 -0
  56. package/dist/bases-view/components/sort/sort-root.svelte +239 -0
  57. package/dist/bases-view/components/sort/sort-root.svelte.d.ts +11 -0
  58. package/dist/bases-view/components/sort/sort-row.svelte +190 -0
  59. package/dist/bases-view/components/sort/sort-row.svelte.d.ts +15 -0
  60. package/dist/bases-view/components/summary-strip.svelte +56 -0
  61. package/dist/bases-view/components/summary-strip.svelte.d.ts +8 -0
  62. package/dist/bases-view/components/tag-chip.svelte +47 -0
  63. package/dist/bases-view/components/tag-chip.svelte.d.ts +12 -0
  64. package/dist/bases-view/components/views.svelte +178 -0
  65. package/dist/bases-view/components/views.svelte.d.ts +12 -0
  66. package/dist/bases-view/data-table-adapter/data-table.svelte.d.ts +45 -0
  67. package/dist/bases-view/data-table-adapter/data-table.svelte.js +112 -0
  68. package/dist/bases-view/data-table-adapter/flex-render.svelte +43 -0
  69. package/dist/bases-view/data-table-adapter/flex-render.svelte.d.ts +30 -0
  70. package/dist/bases-view/data-table-adapter/index.d.ts +3 -0
  71. package/dist/bases-view/data-table-adapter/index.js +3 -0
  72. package/dist/bases-view/data-table-adapter/render-helpers.d.ts +101 -0
  73. package/dist/bases-view/data-table-adapter/render-helpers.js +110 -0
  74. package/dist/bases-view/db.d.ts +31 -0
  75. package/dist/bases-view/db.js +174 -0
  76. package/dist/bases-view/document-core.d.ts +2 -0
  77. package/dist/bases-view/document-core.js +166 -0
  78. package/dist/bases-view/export-core.d.ts +4 -0
  79. package/dist/bases-view/export-core.js +31 -0
  80. package/dist/bases-view/file-fields-core.d.ts +31 -0
  81. package/dist/bases-view/file-fields-core.js +114 -0
  82. package/dist/bases-view/filter-parser.d.ts +27 -0
  83. package/dist/bases-view/filter-parser.js +315 -0
  84. package/dist/bases-view/functions-core.d.ts +66 -0
  85. package/dist/bases-view/functions-core.js +265 -0
  86. package/dist/bases-view/functions.d.ts +5 -0
  87. package/dist/bases-view/functions.js +107 -0
  88. package/dist/bases-view/fuzzy-search.d.ts +6 -0
  89. package/dist/bases-view/fuzzy-search.js +15 -0
  90. package/dist/bases-view/hooks/useResizeObserver.svelte.d.ts +7 -0
  91. package/dist/bases-view/hooks/useResizeObserver.svelte.js +26 -0
  92. package/dist/bases-view/index.d.ts +66 -0
  93. package/dist/bases-view/index.js +231 -0
  94. package/dist/bases-view/list-view/index.d.ts +10 -0
  95. package/dist/bases-view/list-view/index.js +17 -0
  96. package/dist/bases-view/list-view/list.svelte +156 -0
  97. package/dist/bases-view/list-view/list.svelte.d.ts +7 -0
  98. package/dist/bases-view/map-view/index.d.ts +10 -0
  99. package/dist/bases-view/map-view/index.js +17 -0
  100. package/dist/bases-view/map-view/view.svelte +28 -0
  101. package/dist/bases-view/map-view/view.svelte.d.ts +7 -0
  102. package/dist/bases-view/metadata-invalidation-core.d.ts +34 -0
  103. package/dist/bases-view/metadata-invalidation-core.js +162 -0
  104. package/dist/bases-view/metadata-type-info.d.ts +7 -0
  105. package/dist/bases-view/metadata-type-info.js +10 -0
  106. package/dist/bases-view/models.d.ts +90 -0
  107. package/dist/bases-view/models.js +133 -0
  108. package/dist/bases-view/query-result-core.d.ts +8 -0
  109. package/dist/bases-view/query-result-core.js +16 -0
  110. package/dist/bases-view/resource-url.d.ts +2 -0
  111. package/dist/bases-view/resource-url.js +21 -0
  112. package/dist/bases-view/search-core.d.ts +9 -0
  113. package/dist/bases-view/search-core.js +20 -0
  114. package/dist/bases-view/summary-core.d.ts +7 -0
  115. package/dist/bases-view/summary-core.js +17 -0
  116. package/dist/bases-view/table-view/components/div-table.svelte +464 -0
  117. package/dist/bases-view/table-view/components/div-table.svelte.d.ts +32 -0
  118. package/dist/bases-view/table-view/components/dnd-style.d.ts +3 -0
  119. package/dist/bases-view/table-view/components/dnd-style.js +6 -0
  120. package/dist/bases-view/table-view/components/sort-header.svelte +48 -0
  121. package/dist/bases-view/table-view/components/sort-header.svelte.d.ts +11 -0
  122. package/dist/bases-view/table-view/components/table-column-tracks.d.ts +14 -0
  123. package/dist/bases-view/table-view/components/table-column-tracks.js +27 -0
  124. package/dist/bases-view/table-view/components/table-header.svelte +146 -0
  125. package/dist/bases-view/table-view/components/table-header.svelte.d.ts +10 -0
  126. package/dist/bases-view/table-view/components/table-placeholder.svelte +46 -0
  127. package/dist/bases-view/table-view/components/table-placeholder.svelte.d.ts +30 -0
  128. package/dist/bases-view/table-view/components/table-virtualizer-core.d.ts +13 -0
  129. package/dist/bases-view/table-view/components/table-virtualizer-core.js +12 -0
  130. package/dist/bases-view/table-view/components/table.svelte +997 -0
  131. package/dist/bases-view/table-view/components/table.svelte.d.ts +32 -0
  132. package/dist/bases-view/table-view/index.svelte.d.ts +10 -0
  133. package/dist/bases-view/table-view/index.svelte.js +30 -0
  134. package/dist/bases-view/unknown-view/index.d.ts +10 -0
  135. package/dist/bases-view/unknown-view/index.js +19 -0
  136. package/dist/bases-view/unknown-view/view.svelte +11 -0
  137. package/dist/bases-view/unknown-view/view.svelte.d.ts +6 -0
  138. package/dist/bases-view/view-header.svelte +142 -0
  139. package/dist/bases-view/view-header.svelte.d.ts +28 -0
  140. package/dist/bases-view/view-registration-inventory.d.ts +22 -0
  141. package/dist/bases-view/view-registration-inventory.js +7 -0
  142. package/dist/bases-view/view-settings.svelte +350 -0
  143. package/dist/bases-view/view-settings.svelte.d.ts +9 -0
  144. package/dist/bases-view/view.svelte +192 -0
  145. package/dist/bases-view/view.svelte.d.ts +15 -0
  146. package/dist/bases-view-surface.svelte +31 -0
  147. package/dist/bases-view-surface.svelte.d.ts +14 -0
  148. package/dist/index.d.ts +10 -0
  149. package/dist/index.js +8 -0
  150. package/dist/serialized-write-queue.d.ts +10 -0
  151. package/dist/serialized-write-queue.js +36 -0
  152. package/dist/styles.css +2164 -0
  153. package/manifest.json +33 -0
  154. package/package.json +90 -0
  155. package/styles.css +1 -0
@@ -0,0 +1,569 @@
1
+ import { BasesViewConfig as SharedBasesViewConfig, Component, TFile, type App, type BasesAllOptions } from "@lapis-notes/api";
2
+ import { DateTime, Duration } from "luxon";
3
+ import { Context, Decimal, type DType } from "peaql";
4
+ import { type BasesDocument, type BasesViewBase } from "./models";
5
+ import { type ColumnDefinition } from "./columns";
6
+ import type { VaultRecord } from ".";
7
+ export { BasesViewConfig } from "@lapis-notes/api";
8
+ /**
9
+ * The three valid "sources" of a property in a Base.
10
+ *
11
+ * - `note`: Properties from the frontmatter of markdown files in the vault.
12
+ * - `formula`: Properties calculated by evaluating a formula from the base config
13
+ * file.
14
+ * - `file`: Properties inherent to a file, such as the name, extension, size,
15
+ * etc.
16
+ *
17
+ * @since 1.10.0
18
+ * @public
19
+ */
20
+ export type BasesPropertyType = "note" | "formula" | "file";
21
+ /**
22
+ * The full ID of a property, used in the bases config file. The prefixed
23
+ * {@link BasesPropertyType} disambiguates properties of the same name but from
24
+ * different sources.
25
+ *
26
+ * @since 1.10.0
27
+ * @public
28
+ */
29
+ export type BasesPropertyId = string | `${BasesPropertyType}.${string}`;
30
+ /**
31
+ * A parsed version of the {@link BasesPropertyId}.
32
+ *
33
+ * @since 1.10.0
34
+ * @public
35
+ */
36
+ export interface BasesProperty {
37
+ /**
38
+ * @since 1.10.0
39
+ * @public
40
+ */
41
+ type: BasesPropertyType;
42
+ /**
43
+ * @since 1.10.0
44
+ * @public
45
+ */
46
+ name: string;
47
+ }
48
+ /**
49
+ * @since 1.10.0
50
+ * @public
51
+ */
52
+ export interface BaseOption {
53
+ /**
54
+ * @since 1.10.0
55
+ * @public
56
+ */
57
+ key: string;
58
+ /**
59
+ * @since 1.10.0
60
+ * @public
61
+ */
62
+ type: string;
63
+ /**
64
+ * @since 1.10.0
65
+ * @public
66
+ */
67
+ displayName: string;
68
+ }
69
+ /**
70
+ * @since 1.10.0
71
+ * @public
72
+ */
73
+ export type BasesSortConfig = {
74
+ /**
75
+ * @since 1.10.0
76
+ * @public
77
+ */
78
+ property: BasesPropertyId;
79
+ /**
80
+ * @since 1.10.0
81
+ * @public
82
+ */
83
+ direction: "ASC" | "DESC";
84
+ };
85
+ /**
86
+ * The context in which a formula is evaluated. In most cases, {@link BasesEntry}
87
+ * is the specific type to use.
88
+ *
89
+ * @since 1.10.0
90
+ * @public
91
+ */
92
+ export interface FormulaContext {
93
+ }
94
+ /**
95
+ * Represent a single "row" or file in a base.
96
+ *
97
+ * @since 1.10.0
98
+ * @public
99
+ */
100
+ export declare class BasesEntry implements FormulaContext {
101
+ readonly id: string;
102
+ readonly file: TFile;
103
+ readonly context: Partial<Record<BasesPropertyId, Value>>;
104
+ constructor(id: string, file: TFile, context?: Partial<Record<BasesPropertyId, Value>>);
105
+ /**
106
+ * Get the value of the property.
107
+ *
108
+ * @since 1.10.0
109
+ * @throws Error if the property is a formula and cannot be evaluated.
110
+ * @public
111
+ */
112
+ getValue(propertyId: BasesPropertyId): Value | null;
113
+ }
114
+ /**
115
+ * Container type for data which can expose functions for retrieving, comparing,
116
+ * and rendering the data. Most commonly used in conjunction with formulas for
117
+ * Bases. Values can be used as formula parameters, intermediate values, and the
118
+ * result of evaluation.
119
+ *
120
+ * @since 1.10.0
121
+ * @public
122
+ */
123
+ export declare abstract class Value {
124
+ abstract get value(): any;
125
+ /**
126
+ * @since 1.10.0
127
+ * @public
128
+ */
129
+ static equals(a: Value | null, b: Value | null): boolean;
130
+ /**
131
+ * @since 1.10.0
132
+ * @public
133
+ */
134
+ static looseEquals(a: Value | null, b: Value | null): boolean;
135
+ /**
136
+ * @since 1.10.0
137
+ * @public
138
+ */
139
+ abstract toString(): string;
140
+ /**
141
+ * @since 1.10.0
142
+ * @public
143
+ */
144
+ abstract isTruthy(): boolean;
145
+ /**
146
+ * @since 1.10.0
147
+ * @public
148
+ */
149
+ equals(other: this): boolean;
150
+ /**
151
+ * @since 1.10.0
152
+ * @public
153
+ */
154
+ looseEquals(other: Value): boolean;
155
+ /**
156
+ * Render this value into the provided HTMLElement.
157
+ *
158
+ * @since 1.10.0
159
+ * @public
160
+ */
161
+ renderTo(el: HTMLElement, ctx: any): void;
162
+ }
163
+ /**
164
+ * Base type for all non-null {@link Values}.
165
+ *
166
+ * @since 1.10.0
167
+ * @public
168
+ */
169
+ export declare abstract class NotNullValue extends Value {
170
+ }
171
+ /**
172
+ * {@link Value} which represents null. NullValue is a singleton and
173
+ * `NullValue.value` should be used instead of calling the constructor.
174
+ *
175
+ * @since 1.10.0
176
+ * @public
177
+ */
178
+ export declare class NullValue extends Value {
179
+ /**
180
+ * @since 1.10.0
181
+ * @public
182
+ */
183
+ static value: NullValue;
184
+ get value(): null;
185
+ /**
186
+ * @since 1.10.0
187
+ * @public
188
+ */
189
+ toString(): string;
190
+ isTruthy(): boolean;
191
+ equals(other: this): boolean;
192
+ looseEquals(other: Value): boolean;
193
+ }
194
+ /**
195
+ * Base type for {@link Values} which wrap a single primitive.
196
+ *
197
+ * @since 1.10.0
198
+ * @public
199
+ */
200
+ export declare abstract class PrimitiveValue<T> extends NotNullValue {
201
+ readonly value: T;
202
+ /**
203
+ * @since 1.10.0
204
+ * @public
205
+ */
206
+ constructor(value: T);
207
+ /**
208
+ * @since 1.10.0
209
+ * @public
210
+ */
211
+ toString(): string;
212
+ /**
213
+ * @since 1.10.0
214
+ * @public
215
+ */
216
+ isTruthy(): boolean;
217
+ equals(other: this): boolean;
218
+ looseEquals(other: Value): boolean;
219
+ }
220
+ /**
221
+ * {@link Value} wrapping a boolean.
222
+ *
223
+ * @since 1.10.0
224
+ * @public
225
+ */
226
+ export declare class BooleanValue extends PrimitiveValue<boolean> {
227
+ /**
228
+ * @since 1.10.0
229
+ * @public
230
+ */
231
+ static type: string;
232
+ looseEquals(other: Value): boolean;
233
+ }
234
+ /**
235
+ * {@link Value} wrapping a number.
236
+ *
237
+ * @since 1.10.0
238
+ * @public
239
+ */
240
+ export declare class NumberValue extends PrimitiveValue<number | Decimal> {
241
+ /**
242
+ * @since 1.10.0
243
+ * @public
244
+ */
245
+ static type: string;
246
+ equals(other: this): boolean;
247
+ looseEquals(other: Value): boolean;
248
+ toString(): string;
249
+ get number(): number;
250
+ }
251
+ /**
252
+ * {@link Value} wrapping a string.
253
+ *
254
+ * @since 1.10.0
255
+ * @public
256
+ */
257
+ export declare class StringValue extends PrimitiveValue<string> {
258
+ /**
259
+ * @since 1.10.0
260
+ * @public
261
+ */
262
+ static type: string;
263
+ }
264
+ export declare class DateValue extends NotNullValue {
265
+ readonly value: DateTime;
266
+ constructor(value: DateTime | Date | number | string);
267
+ /**
268
+ * @since 1.10.0
269
+ * @public
270
+ */
271
+ toString(): string;
272
+ /**
273
+ * @since 1.10.0
274
+ * @returns A new DateValue with any time portion in this DateValue removed.
275
+ * @public
276
+ */
277
+ dateOnly(): DateValue;
278
+ /**
279
+ * @since 1.10.0
280
+ * @returns A new {@link RelativeDateValue} based on this DateValue.
281
+ * @public
282
+ */
283
+ relative(): string;
284
+ /**
285
+ * @since 1.10.0
286
+ * @public
287
+ */
288
+ isTruthy(): boolean;
289
+ equals(other: this): boolean;
290
+ looseEquals(other: Value): boolean;
291
+ /**
292
+ * Create new DateValue from an input string.
293
+ *
294
+ * @since 1.10.0
295
+ * @example
296
+ * parseFromString("2025-12-31");
297
+ * parseFromString("2025-12-31T23:59");
298
+ * parseFromString("2025-12-31T23:59:59");
299
+ * parseFromString("2025-12-31T23:59:59Z-07");
300
+ *
301
+ * @param input - An ISO 8601 date or datetime string.
302
+ * @public
303
+ */
304
+ static parseFromString(input: string): DateValue | null;
305
+ }
306
+ export declare class DurationValue extends NotNullValue {
307
+ readonly value: Duration;
308
+ constructor(value: Duration);
309
+ /**
310
+ * @since 1.10.0
311
+ * @public
312
+ */
313
+ toString(): string;
314
+ /**
315
+ * @since 1.10.0
316
+ * @public
317
+ */
318
+ isTruthy(): boolean;
319
+ /**
320
+ * Modifies the provided {@DateValue} by this duration.
321
+ *
322
+ * @since 1.10.0
323
+ * @public
324
+ */
325
+ addToDate(value: DateValue, subtract?: boolean): DateValue;
326
+ /**
327
+ * Convert this duration into milliseconds.
328
+ *
329
+ * @since 1.10.0
330
+ * @public
331
+ */
332
+ getMilliseconds(): number;
333
+ equals(other: this): boolean;
334
+ looseEquals(other: Value): boolean;
335
+ /**
336
+ * Create a new DurationValue using an ISO 8601 duration. See
337
+ * {@link https://en.wikipedia.org/wiki/ISO_8601#Durations} for duration format
338
+ * details.
339
+ *
340
+ * @since 1.10.0
341
+ * @public
342
+ */
343
+ static parseFromString(input: string): DurationValue | null;
344
+ /**
345
+ * Create a new DurationValue from milliseconds.
346
+ *
347
+ * @since 1.10.0
348
+ * @public
349
+ */
350
+ static fromMilliseconds(milliseconds: number): DurationValue;
351
+ }
352
+ export declare class FileValue extends NotNullValue {
353
+ readonly file: TFile;
354
+ constructor(file: TFile);
355
+ get value(): TFile;
356
+ /**
357
+ * @since 1.10.0
358
+ * @public
359
+ */
360
+ toString(): string;
361
+ /**
362
+ * @since 1.10.0
363
+ * @public
364
+ */
365
+ isTruthy(): boolean;
366
+ equals(other: this): boolean;
367
+ looseEquals(other: Value): boolean;
368
+ }
369
+ export declare class ObjectValue extends NotNullValue {
370
+ readonly value: any;
371
+ constructor(value: any);
372
+ equals(other: this): boolean;
373
+ looseEquals(other: Value): boolean;
374
+ toString(): string;
375
+ isTruthy(): boolean;
376
+ }
377
+ /**
378
+ * @since 1.10.0
379
+ * @public
380
+ */
381
+ export interface BaseOption {
382
+ /**
383
+ * @since 1.10.0
384
+ * @public
385
+ */
386
+ key: string;
387
+ /**
388
+ * @since 1.10.0
389
+ * @public
390
+ */
391
+ type: string;
392
+ /**
393
+ * @since 1.10.0
394
+ * @public
395
+ */
396
+ displayName: string;
397
+ }
398
+ export declare class QueryController extends Component {
399
+ #private;
400
+ readonly views: Map<string, BasesViewRegistration>;
401
+ readonly readOnly: boolean;
402
+ readonly app: App;
403
+ data: Array<VaultRecord>;
404
+ loadError: string | null;
405
+ doc: BasesDocument;
406
+ properties: Record<string, {
407
+ displayName: string;
408
+ }>;
409
+ formulas: Record<string, string>;
410
+ searchQuery: string;
411
+ searchPanelOpen: boolean;
412
+ columns: Record<string, ColumnDefinition>;
413
+ frontMatterTypes: Record<string, DType>;
414
+ db: Context;
415
+ selectedView: BasesViewBase;
416
+ private prevDoc;
417
+ private lastViewResults;
418
+ query: string;
419
+ metadataDependencies: import("./metadata-invalidation-core").MetadataDependencySet;
420
+ reloadSignature: string;
421
+ dataset: [Array<Record<string, unknown>>, Record<string, DType>];
422
+ queryResult: BasesQueryResult;
423
+ constructor(app: App, document: BasesDocument, views: Map<string, BasesViewRegistration>, onChange: (doc: BasesDocument) => void, readOnly?: boolean);
424
+ get view(): BasesView;
425
+ set view(view: BasesView);
426
+ private syncViewData;
427
+ get viewConfig(): BasesViewRegistration;
428
+ getRecords(qs: string): [Array<Record<string, unknown>>, Record<string, DType>];
429
+ getAllColumns(): ColumnDefinition[];
430
+ isVisible(id: BasesPropertyId): boolean;
431
+ toggleVisibility(id: BasesPropertyId): void;
432
+ getColumn(id: BasesPropertyId): ColumnDefinition;
433
+ get count(): number;
434
+ get searchCount(): number;
435
+ toggleSearchPanel(): void;
436
+ reload(): Promise<void>;
437
+ }
438
+ export declare abstract class BasesView extends Component {
439
+ readonly controller: QueryController;
440
+ private mountedView;
441
+ private mountedViewContainer;
442
+ /**
443
+ * @since 1.10.0
444
+ * @public
445
+ */
446
+ app: App;
447
+ /**
448
+ * The type ID of this view
449
+ *
450
+ * @since 1.10.0
451
+ * @public
452
+ */
453
+ abstract type: string;
454
+ /**
455
+ * The config object for this view.
456
+ *
457
+ * @since 1.10.0
458
+ * @public
459
+ */
460
+ config: SharedBasesViewConfig;
461
+ /**
462
+ * The most recent output from executing the bases query, applying filters,
463
+ * and evaluating formulas. This object will be replaced with a new result set
464
+ * when changes to the vault or Bases config occur, so views should not keep a
465
+ * reference to it. Also note the contained BasesEntry objects will be
466
+ * recreated.
467
+ *
468
+ * @since 1.10.0
469
+ * @public
470
+ */
471
+ data: BasesQueryResult;
472
+ protected constructor(controller: QueryController);
473
+ protected mountViewComponent(component: any, props: Record<string, unknown>, containerEl: HTMLElement): void;
474
+ protected unmountViewComponent(): void;
475
+ onunload(): void;
476
+ /**
477
+ * All available properties from the dataset.
478
+ *
479
+ * @since 1.10.0
480
+ * @public
481
+ */
482
+ get allProperties(): BasesPropertyId[];
483
+ createFileForView(baseFileName?: string, frontmatterProcessor?: (frontmatter: any) => void): Promise<void>;
484
+ /**
485
+ * Called when there is new data for the query. This view should rerender with
486
+ * the updated data.
487
+ *
488
+ * @since 1.10.0
489
+ * @public
490
+ */
491
+ abstract onDataUpdated(): void;
492
+ }
493
+ /**
494
+ * Implement this factory function in a {@link BasesViewRegistration} to create a
495
+ * new instance of a custom Bases view.
496
+ *
497
+ * @since 1.10.0
498
+ * @param containerEl - The container below the Bases toolbar where the view
499
+ * will be displayed.
500
+ * @public
501
+ */
502
+ export type BasesViewFactory = (controller: QueryController, containerEl: HTMLElement) => BasesView;
503
+ /**
504
+ * Container for options when registering a new Bases view type.
505
+ *
506
+ * @since 1.10.0
507
+ * @public
508
+ */
509
+ export interface BasesViewRegistration {
510
+ /**
511
+ * @since 1.10.0
512
+ * @public
513
+ */
514
+ name: string;
515
+ /**
516
+ * Icon ID to be used in the Bases view selector. See
517
+ * {@link https://docs.obsidian.md/Plugins/User+interface/Icons} for available
518
+ * icons and how to add your own.
519
+ *
520
+ * @since 1.10.0
521
+ * @public
522
+ */
523
+ icon: string;
524
+ /**
525
+ * @since 1.10.0
526
+ * @public
527
+ */
528
+ factory: BasesViewFactory;
529
+ /**
530
+ * @since 1.10.0
531
+ * @public
532
+ */
533
+ options?: (config: SharedBasesViewConfig) => BasesAllOptions[];
534
+ }
535
+ /**
536
+ * A group of BasesEntry objects for a given value of the groupBy key. If there
537
+ * are entries in the results which do not have a value for the groupBy key, the
538
+ * key will be the {@link NullValue}.
539
+ *
540
+ * @since 1.10.0
541
+ * @public
542
+ */
543
+ export declare class BasesEntryGroup {
544
+ readonly entries: BasesEntry[];
545
+ readonly key?: Value | undefined;
546
+ constructor(entries: BasesEntry[], key?: Value | undefined);
547
+ /**
548
+ * @since 1.10.0
549
+ * @returns True iff this entry group has a non-null key.
550
+ * @public
551
+ */
552
+ hasKey(): boolean;
553
+ }
554
+ /**
555
+ * The BasesQueryResult contains all of the available information from executing
556
+ * the bases query, applying filters, and evaluating formulas. The `data` or
557
+ * `groupedData` should be displayed by your view.
558
+ *
559
+ * @since 1.10.0
560
+ * @public
561
+ */
562
+ export declare class BasesQueryResult {
563
+ readonly data: BasesEntry[];
564
+ readonly properties: BasesPropertyId[];
565
+ readonly groupBy?: BasesPropertyId | undefined;
566
+ constructor(data: BasesEntry[], properties: BasesPropertyId[], groupBy?: BasesPropertyId | undefined);
567
+ get groupedData(): BasesEntryGroup[];
568
+ getSummaryValue(queryController: QueryController, entries: BasesEntry[], prop: BasesPropertyId, summaryKey: string): Value;
569
+ }