@object-ui/plugin-list 17.7.0 → 18.0.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/CHANGELOG.md +1012 -0
- package/README.md +305 -35
- package/dist/ListEmptyState.d.ts +72 -0
- package/dist/ListEmptyState.d.ts.map +1 -0
- package/dist/ListView.d.ts +127 -18
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListViewBlock.d.ts.map +1 -1
- package/dist/ListViewCompact.d.ts +77 -0
- package/dist/ListViewCompact.d.ts.map +1 -0
- package/dist/ObjectGallery.d.ts.map +1 -1
- package/dist/UserFilters.d.ts +14 -1
- package/dist/UserFilters.d.ts.map +1 -1
- package/dist/ViewSwitcher.d.ts +28 -20
- package/dist/ViewSwitcher.d.ts.map +1 -1
- package/dist/calendarWindow.d.ts +102 -0
- package/dist/calendarWindow.d.ts.map +1 -0
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/ViewSettingsPopover.d.ts +53 -16
- package/dist/components/ViewSettingsPopover.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2404 -1521
- package/dist/index.umd.cjs +2 -2
- package/package.json +19 -19
package/dist/ListView.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SortItem,
|
|
2
|
-
import { ViewType } from './ViewSwitcher.js';
|
|
1
|
+
import { SortItem, FilterBuilderRowGroup } from '@object-ui/components';
|
|
3
2
|
import { ListViewSchema } from '@object-ui/types';
|
|
3
|
+
import { ListViewVisualization } from '@object-ui/core';
|
|
4
|
+
import { GroupingConfig } from '@objectstack/spec/ui';
|
|
4
5
|
/**
|
|
5
6
|
* ObjectUI
|
|
6
7
|
* Copyright (c) 2024-present ObjectStack Inc.
|
|
@@ -107,19 +108,19 @@ export interface ListViewProps {
|
|
|
107
108
|
* is a separate change with its own consumer sweep.
|
|
108
109
|
*/
|
|
109
110
|
dataSource?: any;
|
|
110
|
-
onViewChange?: (view:
|
|
111
|
+
onViewChange?: (view: ListViewVisualization) => void;
|
|
111
112
|
/**
|
|
112
113
|
* Fires with the advanced-filter group the toolbar's `FilterBuilder` emitted.
|
|
113
114
|
*
|
|
114
|
-
* `
|
|
115
|
+
* `FilterBuilderRowGroup` because that is what the one call site actually passes: the
|
|
115
116
|
* builder's own `onChange` value, handed straight through beside
|
|
116
|
-
* `setCurrentFilters` — itself `React.useState<
|
|
117
|
+
* `setCurrentFilters` — itself `React.useState<FilterBuilderRowGroup>`. Deliberately NOT
|
|
117
118
|
* the filter AST `normalizeFilters` / `buildEffectiveFilter` speak: those run
|
|
118
119
|
* later, on the query-building path, and nothing they produce reaches this
|
|
119
120
|
* callback. A host receives the BUILDER's group verbatim, which is what lets
|
|
120
121
|
* it round-trip back in through `initialFilters`.
|
|
121
122
|
*/
|
|
122
|
-
onFilterChange?: (filters:
|
|
123
|
+
onFilterChange?: (filters: FilterBuilderRowGroup) => void;
|
|
123
124
|
/**
|
|
124
125
|
* Fires with the view's sort after a builder edit, a header click or a
|
|
125
126
|
* "reset to the view's default".
|
|
@@ -132,10 +133,28 @@ export interface ListViewProps {
|
|
|
132
133
|
* decides whether platform-unsortable entries are still present (#6455).
|
|
133
134
|
*/
|
|
134
135
|
onSortChange?: (sort: SortItem[]) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Fires with the grouping after a user edit in either grouping editor: the
|
|
138
|
+
* toolbar's Group panel (a level added, changed or removed, or Clear) and the
|
|
139
|
+
* compact toolbar's settings popover. `undefined` when the grouping is
|
|
140
|
+
* cleared.
|
|
141
|
+
*
|
|
142
|
+
* The value is the spec's `GroupingConfig`, the shape `schema.grouping`
|
|
143
|
+
* takes, so a host hands it back through `schema.grouping` unchanged
|
|
144
|
+
* (objectui#11860). Not fired when the list re-reads a changed
|
|
145
|
+
* `schema.grouping` or `groupBy`: that value came from the host.
|
|
146
|
+
*/
|
|
147
|
+
onGroupingChange?: (grouping: GroupingConfig | undefined) => void;
|
|
135
148
|
onSearchChange?: (search: string) => void;
|
|
136
149
|
/** Called when the user toggles fields via the Hide Fields popover. */
|
|
137
150
|
onHiddenFieldsChange?: (hidden: string[]) => void;
|
|
138
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Called when the user toggles inline record editing. Wiring it is also what
|
|
153
|
+
* offers the wide toolbar's toggle. The toggle switches the grid's edit MODE,
|
|
154
|
+
* which `ListView` keeps in its own state. A host should not persist it into
|
|
155
|
+
* the view's `inlineEdit`: that key is the author's permission, and it folds
|
|
156
|
+
* into `userActions.editInline` (objectui#5144).
|
|
157
|
+
*/
|
|
139
158
|
onInlineEditChange?: (next: boolean) => void;
|
|
140
159
|
/** Called when the user resizes/reorders columns in the underlying grid. */
|
|
141
160
|
onColumnStateChange?: (state: {
|
|
@@ -171,7 +190,7 @@ export interface ListViewProps {
|
|
|
171
190
|
* later prop changes don't override in-flight user edits, so hosts remount
|
|
172
191
|
* (via `key`) when they need to swap the restored value (view switch).
|
|
173
192
|
*/
|
|
174
|
-
initialFilters?:
|
|
193
|
+
initialFilters?: FilterBuilderRowGroup;
|
|
175
194
|
/** Initial search term to restore at mount (same one-shot semantics as `initialFilters`). */
|
|
176
195
|
initialSearchTerm?: string;
|
|
177
196
|
/** Called when the user asks for a new record (toolbar "+ New" and the empty-state CTA). */
|
|
@@ -189,6 +208,65 @@ export interface ListViewProps {
|
|
|
189
208
|
onEdit?: (record: any) => void;
|
|
190
209
|
onDelete?: (record: any) => void;
|
|
191
210
|
onBulkDelete?: (records: any[]) => void;
|
|
211
|
+
/**
|
|
212
|
+
* A host-drawn node rendered FIRST in the toolbar row's left group, before
|
|
213
|
+
* the user filters, in a `min-w-0 flex-1` wrapper: it takes the width the
|
|
214
|
+
* right-hand tool cluster leaves (objectui#12440). The console passes its
|
|
215
|
+
* saved-view `ViewTabBar` here, so the view tabs and Filter · Sort ·
|
|
216
|
+
* Display · Search share one row.
|
|
217
|
+
*
|
|
218
|
+
* A HOST prop on the React component, never a schema key: it is a React
|
|
219
|
+
* node a host composes, nothing an author writes, and the list view's own
|
|
220
|
+
* `tabs` key is retired from the protocol (objectui#11073). It is
|
|
221
|
+
* destructured by name so it never rides the `{...props}` forward into the
|
|
222
|
+
* active view component. Absent ⇒ the toolbar row is exactly what it was.
|
|
223
|
+
*
|
|
224
|
+
* A host that passes it carries the view's DESCRIPTION too (objectui#12528):
|
|
225
|
+
* the console's `ViewTabBar` draws it as the active tab's tooltip and ▾ menu
|
|
226
|
+
* header, so the list draws none. Without it the list draws the description
|
|
227
|
+
* itself, as an info control at the start of the toolbar row — never as a
|
|
228
|
+
* row of its own, so the toolbar sits at one height with or without one.
|
|
229
|
+
*/
|
|
230
|
+
toolbarLeading?: React.ReactNode;
|
|
231
|
+
/**
|
|
232
|
+
* Whether the grid opens with row numbers in its leading cell — the opening
|
|
233
|
+
* state of the Display control's session-only switch, and what its "Reset to
|
|
234
|
+
* view default" returns to. Default `true`. A HOST prop, never a schema key:
|
|
235
|
+
* the console's Setup app opens its lists without them (objectui#12606), a
|
|
236
|
+
* posture of the console, not of the view.
|
|
237
|
+
*/
|
|
238
|
+
defaultRowNumbers?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* The VIEW'S OWN hidden fields and row height, for a host that lays the
|
|
241
|
+
* user's own preference over them in `schema` (objectui#12949). The Display
|
|
242
|
+
* control's trigger count and its "Reset to view default" compare these two
|
|
243
|
+
* settings against this value rather than against `schema`, and the reset
|
|
244
|
+
* hands it back through the same doors the controls write through
|
|
245
|
+
* (`onHiddenFieldsChange`, `schema.onDensityChange`), so the user's
|
|
246
|
+
* preference follows.
|
|
247
|
+
*
|
|
248
|
+
* When it is passed, its members are the whole baseline: an absent
|
|
249
|
+
* `hiddenFields` means the view hides nothing, an absent `rowHeight` means
|
|
250
|
+
* the view's default density. Absent ⇒ `schema` is the view's own, exactly
|
|
251
|
+
* as before. A HOST prop, never a schema key: it is the host's split of one
|
|
252
|
+
* composed value into its two sources, nothing an author writes.
|
|
253
|
+
*/
|
|
254
|
+
viewDefaults?: Pick<ListViewSchema, 'hiddenFields' | 'rowHeight'>;
|
|
255
|
+
/**
|
|
256
|
+
* Draw the COMPACT posture (objectui#12703): a header with the list's title
|
|
257
|
+
* and record count over two-line rows (the view's first visible column, its
|
|
258
|
+
* second muted below), and none of the toolbar, view tabs, row-number column,
|
|
259
|
+
* pager or record-count bar. The `list-view` page block passes it when the
|
|
260
|
+
* page region it sits in is narrower than half the page
|
|
261
|
+
* (`usePageRegionPosture` from `@object-ui/components`).
|
|
262
|
+
*
|
|
263
|
+
* A HOST prop, never a schema key: the posture is measured by the page
|
|
264
|
+
* renderer, never authored, and `@objectstack/spec` declares no key for it.
|
|
265
|
+
* It applies to a paged grid, the view that draws the rows this component
|
|
266
|
+
* fetches a page of; any other kind (a board, a calendar, a grouped grid)
|
|
267
|
+
* keeps its full rendering. Absent ⇒ the full list, exactly as before.
|
|
268
|
+
*/
|
|
269
|
+
compact?: boolean;
|
|
192
270
|
}
|
|
193
271
|
/**
|
|
194
272
|
* Filter-builder / view operator → filter-AST operator.
|
|
@@ -275,10 +353,13 @@ export declare function resolveAddRecordPlacement(position: unknown): {
|
|
|
275
353
|
* `defaultCalendarFromObject` helper it uses for calendars. What was missing is
|
|
276
354
|
* that one of the two read-sites never honoured the promise the other made.
|
|
277
355
|
*
|
|
278
|
-
* Both nestings are read at each level
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
356
|
+
* Both nestings are read at each level: the spec-authored `schema.timeline` /
|
|
357
|
+
* `schema.calendar` and the legacy `schema.options.*` twin that app-shell's
|
|
358
|
+
* object pages still emit. Each by its spec key only. The pre-#2231 `dateField`
|
|
359
|
+
* alias for `startDateField` had a rung here until objectui#6152 round 14
|
|
360
|
+
* retired it: every list-view door refuses it by name on all four blocks, and
|
|
361
|
+
* the calendar branch already ignored it (objectui#8355), so one stored row
|
|
362
|
+
* could draw a Timeline on a key its Calendar dropped.
|
|
282
363
|
*
|
|
283
364
|
* Exported for the regression suite, which pins each authoring shape.
|
|
284
365
|
*/
|
|
@@ -311,11 +392,12 @@ export declare function normalizeFilters(filters: any[]): any[];
|
|
|
311
392
|
* record. An earlier version of this comment called that unreachable, on the
|
|
312
393
|
* grounds that nothing in the repo hands a list view an object filter. That was
|
|
313
394
|
* wrong: `ObjectView` passes `mergedFilters` straight into this schema's
|
|
314
|
-
* `filter`, and its last fallback
|
|
315
|
-
* `Record<string, any
|
|
395
|
+
* `filter`, and its last fallback was `table.defaultFilters`, declared
|
|
396
|
+
* `Record<string, any>` (retired since objectui#12030; `table.filter` takes
|
|
397
|
+
* the same object). `toFilterNode` now converts it instead.
|
|
316
398
|
*/
|
|
317
|
-
export declare function buildEffectiveFilter(baseFilter: unknown, currentFilters:
|
|
318
|
-
export declare function convertFilterGroupToAST(group:
|
|
399
|
+
export declare function buildEffectiveFilter(baseFilter: unknown, currentFilters: FilterBuilderRowGroup, userFilterConditions: any[]): any[] | Record<string, any> | undefined;
|
|
400
|
+
export declare function convertFilterGroupToAST(group: FilterBuilderRowGroup): any[];
|
|
319
401
|
/**
|
|
320
402
|
* Evaluate conditional formatting rules against a record.
|
|
321
403
|
* Returns a CSSProperties object for the first matching rule, or empty object.
|
|
@@ -337,6 +419,25 @@ export declare function convertFilterGroupToAST(group: FilterGroup): any[];
|
|
|
337
419
|
*/
|
|
338
420
|
export declare function evaluateConditionalFormatting(record: Record<string, unknown>, rules?: ListViewSchema['conditionalFormatting'], scope?: Record<string, unknown>, fields?: unknown): React.CSSProperties;
|
|
339
421
|
export declare const LIST_DEFAULT_TRANSLATIONS: Record<string, string>;
|
|
422
|
+
/**
|
|
423
|
+
* Safe wrapper for useObjectTranslation that falls back to English defaults
|
|
424
|
+
* when I18nProvider is not available (e.g., standalone usage outside console).
|
|
425
|
+
*
|
|
426
|
+
* Delegates to `@object-ui/i18n`'s `createSafeTranslation`. The local copy
|
|
427
|
+
* this replaced wrapped the hook in try/catch — the very thing the comment on
|
|
428
|
+
* `useListViewObjectLabel` below warns against (objectui#2879).
|
|
429
|
+
*
|
|
430
|
+
* Exported for this package's `ObjectGallery` only (objectui#12217), which
|
|
431
|
+
* draws `ListEmptyState`'s `list.*` copy when no `ListView` is around it; the
|
|
432
|
+
* package barrel does not re-export it.
|
|
433
|
+
*/
|
|
434
|
+
export declare const useListViewTranslation: () => {
|
|
435
|
+
t: (key: string, options?: Record<string, unknown>) => string;
|
|
436
|
+
language: string;
|
|
437
|
+
} | {
|
|
438
|
+
t: import('i18next').TFunction<string, undefined>;
|
|
439
|
+
language: string;
|
|
440
|
+
};
|
|
340
441
|
/**
|
|
341
442
|
* The `$top` of the ONE unpaged fetch a list view makes when no usable page
|
|
342
443
|
* size is declared: every view this component does not page on the server
|
|
@@ -347,14 +448,22 @@ export declare const LIST_DEFAULT_TRANSLATIONS: Record<string, string>;
|
|
|
347
448
|
* A fetch batch, ⛔ not a page size (objectui#9853, ruling 5824040487,
|
|
348
449
|
* structure B): its value is kept, and it does not follow the display default,
|
|
349
450
|
* so no view silently loses reachable records when the protocol's page size
|
|
350
|
-
* moves. A DECLARED `pagination.pageSize` still sizes this fetch
|
|
351
|
-
*
|
|
451
|
+
* moves. A DECLARED `pagination.pageSize` still sizes this fetch on every
|
|
452
|
+
* view but a windowed calendar; only the undeclared fallback is split by kind.
|
|
453
|
+
* A calendar with a start date bound walks its visible days in steps of this
|
|
454
|
+
* batch whatever page size is declared, so a declared size no longer sizes its
|
|
455
|
+
* fetch (`calendarWindowed`, objectui#12081).
|
|
352
456
|
*
|
|
353
457
|
* Exported for pins that assert "the fetch batch" rather than its value
|
|
354
458
|
* (objectui#9853, ruling record 5909000462); the package index does not
|
|
355
459
|
* re-export it.
|
|
356
460
|
*/
|
|
357
461
|
export declare const DEFAULT_LIST_FETCH_BATCH_SIZE = 100;
|
|
462
|
+
/**
|
|
463
|
+
* How many of the view's columns a card carries when the kanban block names
|
|
464
|
+
* no card fields of its own (objectui#12619).
|
|
465
|
+
*/
|
|
466
|
+
export declare const KANBAN_VIEW_CARD_FIELD_COUNT = 2;
|
|
358
467
|
/**
|
|
359
468
|
* Imperative handle exposed by ListView via React.forwardRef.
|
|
360
469
|
* Allows parent components to trigger a data refresh programmatically.
|
package/dist/ListView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../src/ListView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../src/ListView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAmBnE,OAAO,KAAK,EAAkB,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AAGxF,OAAO,EAAE,KAAK,qBAAqB,EAAylB,MAAM,iBAAiB,CAAC;AAWppB,OAAO,KAAK,EAAE,cAAc,EAA4B,MAAM,sBAAsB,CAAC;AAKrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;CAWqB,CAAC;AA8K3D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACrD;;;;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AAO,MAAM,6BAA6B,MAAM,CAAC;AAoBjD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAgR9C;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,eAAO,MAAM,QAAQ,sFAs9JnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListViewBlock.d.ts","sourceRoot":"","sources":["../src/ListViewBlock.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ListViewBlock.d.ts","sourceRoot":"","sources":["../src/ListViewBlock.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAc1C,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAyN/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,QAAA,MAAM,aAAa,sFA0GhB,CAAC;AAGJ,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The compact posture of a list block (objectui#12703): what `ListView` draws
|
|
10
|
+
* in place of its toolbar, its grid and its record-count bar when the page
|
|
11
|
+
* region it sits in is narrower than half the page.
|
|
12
|
+
*
|
|
13
|
+
* A short list, not a small grid: a header with the list's title and its
|
|
14
|
+
* record count, then one row per record whose first line is the view's first
|
|
15
|
+
* visible column and whose muted second line is its second. No toolbar, no
|
|
16
|
+
* view tabs, no row-number column, no pager — those belong to the object
|
|
17
|
+
* list, and a rail beside `main` has no room for them.
|
|
18
|
+
*
|
|
19
|
+
* Values render through the shared cell renderers (`getCellRenderer`), so a
|
|
20
|
+
* date, a picklist label or a related record reads the way the grid and the
|
|
21
|
+
* gallery draw it. ⛔ No second formatter lives here.
|
|
22
|
+
*
|
|
23
|
+
* Under the rows, a "View all" link to the rest (objectui#12703 part 2): drawn
|
|
24
|
+
* only when the block hands a destination through
|
|
25
|
+
* {@link CompactListDestinationContext}, which it builds from the host's
|
|
26
|
+
* `listHref` / `openList`. A host without that seam draws no link.
|
|
27
|
+
*/
|
|
28
|
+
import * as React from 'react';
|
|
29
|
+
/**
|
|
30
|
+
* Where the compact list's "View all" link goes: a document href and the SPA
|
|
31
|
+
* open that reaches the same place. The page block builds it from the host's
|
|
32
|
+
* `listHref` / `openList` (`RelatedRecordActionsValue`) and the object and saved
|
|
33
|
+
* view it is bound to; `null` (the default) draws no link.
|
|
34
|
+
*
|
|
35
|
+
* A context rather than a `ListView` prop because the destination is the
|
|
36
|
+
* block's, not the list's: only the page block knows its binding, and the
|
|
37
|
+
* object list page, which never draws the compact posture, has none.
|
|
38
|
+
* Package-internal, like this module.
|
|
39
|
+
*/
|
|
40
|
+
export interface CompactListDestination {
|
|
41
|
+
href: string;
|
|
42
|
+
/** SPA navigation to `href`; absent, the anchor navigates on its own. */
|
|
43
|
+
open?: () => void;
|
|
44
|
+
}
|
|
45
|
+
export declare const CompactListDestinationContext: React.Context<CompactListDestination | null>;
|
|
46
|
+
/** The compact list's footer: a real link to the rest of the list. */
|
|
47
|
+
export declare function ListViewCompactFooter({ destination }: {
|
|
48
|
+
destination: CompactListDestination;
|
|
49
|
+
}): React.JSX.Element;
|
|
50
|
+
/** The two columns a compact row draws: the view's first two visible ones. */
|
|
51
|
+
export declare function compactRowColumns(fields: readonly unknown[]): {
|
|
52
|
+
primary?: string;
|
|
53
|
+
secondary?: string;
|
|
54
|
+
};
|
|
55
|
+
export interface ListViewCompactHeaderProps {
|
|
56
|
+
title?: string;
|
|
57
|
+
/** The record count to show, or `null` while it is not known. */
|
|
58
|
+
count: number | null;
|
|
59
|
+
/** The count as a sentence, the badge's accessible name (`list.recordCount`). */
|
|
60
|
+
countLabel?: string;
|
|
61
|
+
}
|
|
62
|
+
/** The compact list's header: its title and its record count. */
|
|
63
|
+
export declare function ListViewCompactHeader({ title, count, countLabel }: ListViewCompactHeaderProps): React.JSX.Element | null;
|
|
64
|
+
export interface ListViewCompactRowsProps {
|
|
65
|
+
rows: readonly Record<string, unknown>[];
|
|
66
|
+
/** The view's visible columns, in order (`ListView`'s `effectiveFields`). */
|
|
67
|
+
fields: readonly unknown[];
|
|
68
|
+
objectName?: string;
|
|
69
|
+
/** The object's metadata, for the field types the cells format by. */
|
|
70
|
+
objectDef?: {
|
|
71
|
+
fields?: Record<string, Record<string, unknown>>;
|
|
72
|
+
} | null;
|
|
73
|
+
onRowClick?: (record: Record<string, unknown>) => void;
|
|
74
|
+
}
|
|
75
|
+
/** The compact list's rows: the first visible column over the second, muted. */
|
|
76
|
+
export declare function ListViewCompactRows({ rows, fields, objectName, objectDef, onRowClick }: ListViewCompactRowsProps): React.JSX.Element;
|
|
77
|
+
//# sourceMappingURL=ListViewCompact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListViewCompact.d.ts","sourceRoot":"","sources":["../src/ListViewCompact.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,6BAA6B,8CAA2D,CAAC;AAEtG,sEAAsE;AACtE,wBAAgB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AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;AAKrF,OAAO,KAAK,EAAE,UAAU,EAAiB,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectGallery.d.ts","sourceRoot":"","sources":["../src/ObjectGallery.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;AAKrF,OAAO,KAAK,EAAE,UAAU,EAAiB,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAOpG,MAAM,WAAW,kBAAkB;IAC/B;;;;OAIG;IACH,MAAM,EAAE,mBAAmB,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mGAAmG;IACnG,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACrE;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CACvE;AA2LD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkpBtD,CAAC"}
|
package/dist/UserFilters.d.ts
CHANGED
|
@@ -28,6 +28,19 @@ export interface UserFiltersProps {
|
|
|
28
28
|
config: NonNullable<ListViewSchema['userFilters']>;
|
|
29
29
|
/** Object definition for auto-deriving field options */
|
|
30
30
|
objectDef?: any;
|
|
31
|
+
/**
|
|
32
|
+
* True while the host is still fetching `objectDef` (objectui#12890).
|
|
33
|
+
*
|
|
34
|
+
* An unlabelled chip takes its label from the definition, so until it
|
|
35
|
+
* arrives the only name the chip has is the machine key (`category`), which
|
|
36
|
+
* a viewer reads as the field's name and then sees replaced by the real one
|
|
37
|
+
* (`分类`). While pending, such a chip draws a skeleton instead of the key.
|
|
38
|
+
* An authored `label` is drawn either way. Once the host settles the fetch
|
|
39
|
+
* this is false, and a field the settled definition does not name falls back
|
|
40
|
+
* to the key exactly as before. Omitted means settled: a host that passes no
|
|
41
|
+
* definition at all keeps drawing the key.
|
|
42
|
+
*/
|
|
43
|
+
objectDefPending?: boolean;
|
|
31
44
|
/** Current data for computing counts */
|
|
32
45
|
data?: any[];
|
|
33
46
|
/** Callback when filter state changes */
|
|
@@ -56,5 +69,5 @@ export interface UserFiltersProps {
|
|
|
56
69
|
* - **tabs**: named filter preset tab bar
|
|
57
70
|
* - **toggle**: on/off toggle buttons per field
|
|
58
71
|
*/
|
|
59
|
-
export declare function UserFilters({ config, objectDef, data, onFilterChange, maxVisible, className, initialSelections, onSelectionsChange, }: UserFiltersProps): React.JSX.Element | null;
|
|
72
|
+
export declare function UserFilters({ config, objectDef, objectDefPending, data, onFilterChange, maxVisible, className, initialSelections, onSelectionsChange, }: UserFiltersProps): React.JSX.Element | null;
|
|
60
73
|
//# sourceMappingURL=UserFilters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserFilters.d.ts","sourceRoot":"","sources":["../src/UserFilters.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"UserFilters.d.ts","sourceRoot":"","sources":["../src/UserFilters.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAmIvD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,cAAc,GAAG,OAAO,GAAG,MAAM,CAMpG,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IACnD,wDAAwD;IACxD,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wCAAwC;IACxC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,yCAAyC;IACzC,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACzC,gGAAgG;IAChG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IACrE;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAC7F;AA6ED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,SAAS,EACT,gBAAwB,EACxB,IAAS,EACT,cAAc,EACd,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,kBAAkB,GACnB,EAAE,gBAAgB,4BAiDlB"}
|
package/dist/ViewSwitcher.d.ts
CHANGED
|
@@ -8,31 +8,39 @@ import { ListViewVisualization } from '@object-ui/core';
|
|
|
8
8
|
*/
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
/**
|
|
11
|
-
* The visualizations this switcher offers
|
|
11
|
+
* The visualizations this switcher offers are `@object-ui/core`'s
|
|
12
|
+
* {@link ListViewVisualization} (`ca3942729`), which derives from
|
|
13
|
+
* `@objectstack/spec/ui` through `@object-ui/types`' `ViewType`.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
* which derives from `@objectstack/spec/ui` through `@object-ui/types`' `ViewType`.
|
|
15
|
-
*
|
|
16
|
-
* This nine-arm union was written out by hand here, and that is a THIRD
|
|
15
|
+
* A nine-arm union was once written out by hand here, and that was a THIRD
|
|
17
16
|
* re-declaration of one vocabulary — the card behind `ca3942729` was filed against the two in
|
|
18
17
|
* `@object-ui/types`, and the maps below were described there as total over the
|
|
19
18
|
* shared union when they were in fact total over this private copy. A map that
|
|
20
19
|
* is total over a copy is exactly as incomplete as the copy, so the two
|
|
21
|
-
* `Record<
|
|
22
|
-
*
|
|
23
|
-
* in both of them.
|
|
20
|
+
* `Record<ListViewVisualization, …>` below are honest guards only because they
|
|
21
|
+
* key on the derived union: the next visualization the spec adds fails the
|
|
22
|
+
* build in both of them.
|
|
23
|
+
*
|
|
24
|
+
* Spelled by that name, not re-exported as `ViewType`. This module used to
|
|
25
|
+
* publish an alias `ViewType = ListViewVisualization`, a second meaning behind
|
|
26
|
+
* the name `@object-ui/types` gives the whole view-type vocabulary — the alias
|
|
27
|
+
* lacked its `list` and `detail` arms (objectui#6349, batch 7). `page` is
|
|
28
|
+
* deliberately NOT a visualization: the spec models it as a list view that
|
|
29
|
+
* mounts a published page rather than one a user switches into, and
|
|
30
|
+
* `AppearanceConfig.allowedVisualizations` excludes it for the same reason.
|
|
24
31
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
32
|
+
* The props are named `ListViewSwitcherProps`, not `ViewSwitcherProps`, for the
|
|
33
|
+
* same reason. `@object-ui/plugin-view` publishes `ViewSwitcherProps` for a
|
|
34
|
+
* different switcher: the `view-switcher` renderer, which takes a
|
|
35
|
+
* `ViewSwitcherSchema` and the host callbacks and is keyed on the whole
|
|
36
|
+
* `ViewType`. Neither package depends on the other, so the two could not share
|
|
37
|
+
* one declaration. The general name stays with the schema-driven renderer, and
|
|
38
|
+
* this list view's switcher has the specific one (objectui#6349, batch 8).
|
|
30
39
|
*/
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
onViewChange: (view: ViewType) => void;
|
|
40
|
+
export interface ListViewSwitcherProps {
|
|
41
|
+
currentView: ListViewVisualization;
|
|
42
|
+
availableViews?: ListViewVisualization[];
|
|
43
|
+
onViewChange: (view: ListViewVisualization) => void;
|
|
36
44
|
className?: string;
|
|
37
45
|
/** Enable animated transitions between views (default: true) */
|
|
38
46
|
animated?: boolean;
|
|
@@ -43,6 +51,6 @@ export interface ViewSwitcherProps {
|
|
|
43
51
|
* menu of the available visualizations. Replaces the full button row so
|
|
44
52
|
* the toolbar stays one line tall.
|
|
45
53
|
*/
|
|
46
|
-
export declare const ViewSwitcherDropdown: React.FC<
|
|
47
|
-
export declare const ViewSwitcher: React.FC<
|
|
54
|
+
export declare const ViewSwitcherDropdown: React.FC<ListViewSwitcherProps>;
|
|
55
|
+
export declare const ViewSwitcher: React.FC<ListViewSwitcherProps>;
|
|
48
56
|
//# sourceMappingURL=ViewSwitcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewSwitcher.d.ts","sourceRoot":"","sources":["../src/ViewSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAe7D
|
|
1
|
+
{"version":3,"file":"ViewSwitcher.d.ts","sourceRoot":"","sources":["../src/ViewSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAe7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,qBAAqB,CAAC;IACnC,cAAc,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACzC,YAAY,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA0GD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA0GhE,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAwDxD,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A fetch window over local calendar days, spelled `YYYY-MM-DD`: `from` is the
|
|
10
|
+
* first day asked for and `to` the day after the last, so the window is
|
|
11
|
+
* half-open. Held as two strings so it is compared, stored and keyed by VALUE.
|
|
12
|
+
*/
|
|
13
|
+
export interface CalendarWindow {
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
}
|
|
17
|
+
/** The range a calendar reports: local midnights, `end` exclusive. */
|
|
18
|
+
export interface CalendarVisibleRange {
|
|
19
|
+
start: Date;
|
|
20
|
+
end: Date;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The window to fetch for a reported range: the drawn days, widened by ONE day
|
|
24
|
+
* on each side.
|
|
25
|
+
*
|
|
26
|
+
* The widening is what makes a day-bounded comparison safe on every stored
|
|
27
|
+
* shape. A date-time is stored as a UTC instant, and the calendar places it on
|
|
28
|
+
* the LOCAL day it falls on; the two differ by up to fourteen hours, so an event
|
|
29
|
+
* at 01:00 on the first visible day in UTC+8 is stored on the previous UTC day
|
|
30
|
+
* and would fall outside an unwidened `from`. One day covers every offset, and a
|
|
31
|
+
* date-only value (`YYYY-MM-DD`, compared as written) is covered either way. The
|
|
32
|
+
* extra day on each side is fetched and not drawn: the grids place an event by
|
|
33
|
+
* its day, so a row outside the drawn days costs a row of the batch and nothing
|
|
34
|
+
* on screen.
|
|
35
|
+
*/
|
|
36
|
+
export declare function calendarWindowFor(range: CalendarVisibleRange): CalendarWindow;
|
|
37
|
+
/**
|
|
38
|
+
* The window to fetch before the calendar has reported any range: one that
|
|
39
|
+
* covers whatever month grid it can open on today.
|
|
40
|
+
*
|
|
41
|
+
* The hosted calendar opens on today, in the month view (`ListView` hands it no
|
|
42
|
+
* date and no `defaultView`). Its month grid is six weeks that open on the
|
|
43
|
+
* locale's first day of the week, so it starts at most six days before the 1st
|
|
44
|
+
* and ends at most fourteen days after the last day of the month (a 28-day
|
|
45
|
+
* month that opens on the week's first day). Covering that bound means this
|
|
46
|
+
* window holds every day of the grid whatever the locale, so the calendar's
|
|
47
|
+
* first report, which is the exact grid, falls inside it and asks for nothing
|
|
48
|
+
* more. It also means a list view always has a window to fetch: one whose
|
|
49
|
+
* calendar never reports a range (a host's own `object-calendar` renderer)
|
|
50
|
+
* still draws today's month instead of nothing.
|
|
51
|
+
*/
|
|
52
|
+
export declare function initialCalendarWindow(now?: Date): CalendarWindow;
|
|
53
|
+
/** Does `outer` hold every day of `inner`? (`YYYY-MM-DD` compares as written.) */
|
|
54
|
+
export declare function calendarWindowCovers(outer: CalendarWindow, inner: CalendarWindow): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The filter node that selects a window's records on the calendar's date
|
|
57
|
+
* field(s), plus the records that have no start date at all.
|
|
58
|
+
*
|
|
59
|
+
* - Without an end field, an event is a day: its start falls in the window.
|
|
60
|
+
* - With one, an event is a span, and it is drawn on every day it touches, so
|
|
61
|
+
* it is selected when it starts before the window ends AND either starts or
|
|
62
|
+
* ends inside the window or after it opens. A span with no end is a day
|
|
63
|
+
* again, which the `start >= from` arm covers.
|
|
64
|
+
* - ⛔ The records with NO start date are selected too. They are not on the
|
|
65
|
+
* grid: `ObjectCalendar` counts them under the grid in its "Unscheduled"
|
|
66
|
+
* area, which exists so that their absence from the grid is said rather
|
|
67
|
+
* than silent (`bc5870c9f`). A window on the start field alone would drop
|
|
68
|
+
* every one of them, and the area with them.
|
|
69
|
+
*
|
|
70
|
+
* Built in the filter AST the rest of this package sends (`mergeFilterNodes`
|
|
71
|
+
* joins it to the view's own filter under one `and`): `and` / `or` heads and
|
|
72
|
+
* `[field, operator, value]` triples, `is_null` as a 2-tuple. The bounds are
|
|
73
|
+
* `YYYY-MM-DD` strings, the spelling the date macros resolve to.
|
|
74
|
+
*/
|
|
75
|
+
export declare function calendarWindowFilter(window: CalendarWindow, startField: string, endField?: string): unknown[];
|
|
76
|
+
/** What {@link fetchCalendarWindow} brings back. */
|
|
77
|
+
export interface CalendarWindowRows {
|
|
78
|
+
/**
|
|
79
|
+
* The window's records, at most {@link NON_GRID_ROW_CEILING} + 1: the walk
|
|
80
|
+
* stops one row past the ceiling, the probe row `applyNonGridRowCeiling`
|
|
81
|
+
* reads truncation from.
|
|
82
|
+
*/
|
|
83
|
+
data: any[];
|
|
84
|
+
/** The window's size when the adapter reported one (`QueryResult.total`). */
|
|
85
|
+
total?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Walk a window in fetch-batch steps: `$top` is the batch (or the rows still
|
|
89
|
+
* wanted, at the end), `$skip` moves by what came back, and the walk stops at
|
|
90
|
+
* the first short batch or one row past the ceiling.
|
|
91
|
+
*
|
|
92
|
+
* ⛔ The step is the batch, never a bigger `$top`: the batch is the unit the
|
|
93
|
+
* protocol is asked in (objectui#9853), and the ceiling is a stop condition,
|
|
94
|
+
* not a request size.
|
|
95
|
+
*
|
|
96
|
+
* `extract` reads the rows out of one answer: the caller's own reader, so the
|
|
97
|
+
* walk accepts exactly the envelopes the caller's single fetch accepts.
|
|
98
|
+
* `isCurrent` is asked after every answer: when it says no, a newer request
|
|
99
|
+
* owns the screen and the walk returns `null` without asking for more.
|
|
100
|
+
*/
|
|
101
|
+
export declare function fetchCalendarWindow(find: (params: Record<string, unknown>) => Promise<unknown>, params: Record<string, unknown>, batch: number, extract: (result: unknown) => any[], isCurrent: () => boolean): Promise<CalendarWindowRows | null>;
|
|
102
|
+
//# sourceMappingURL=calendarWindow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarWindow.d.ts","sourceRoot":"","sources":["../src/calendarWindow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwBH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACX;AAiBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,oBAAoB,GAAG,cAAc,CAE7E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,IAAiB,GAAG,cAAc,CAI5E;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAE1F;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,EAAE,CAKX;AAED,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,EAC3D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,GAAG,EAAE,EACnC,SAAS,EAAE,MAAM,OAAO,GACvB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAepC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/components/TabBar.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAqDD;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6DxC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/components/TabBar.tsx"],"names":[],"mappings":"AAAA;;;;;;GAM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