@formicoidea/labre-core 0.47.1 → 0.49.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/dist/_pkgs/affine-block-data-view/configs/slash-menu.js +3 -1
- package/dist/_pkgs/affine-block-data-view/view.d.ts +17 -1
- package/dist/_pkgs/affine-block-data-view/view.js +21 -2
- package/dist/_pkgs/affine-block-database/commands.d.ts +2 -2
- package/dist/_pkgs/affine-block-database/commands.js +3 -3
- package/dist/_pkgs/affine-block-database/components/values-banner.d.ts +28 -0
- package/dist/_pkgs/affine-block-database/components/values-banner.js +199 -0
- package/dist/_pkgs/affine-block-database/configs/slash-menu.d.ts +6 -1
- package/dist/_pkgs/affine-block-database/configs/slash-menu.js +57 -70
- package/dist/_pkgs/affine-block-database/data-source.d.ts +9 -5
- package/dist/_pkgs/affine-block-database/data-source.js +11 -7
- package/dist/_pkgs/affine-block-database/database-block-styles.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/database-block-styles.js +15 -0
- package/dist/_pkgs/affine-block-database/database-block.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/database-block.js +141 -19
- package/dist/_pkgs/affine-block-database/effects.js +2 -0
- package/dist/_pkgs/affine-block-database/external-data-source.d.ts +69 -2
- package/dist/_pkgs/affine-block-database/external-data-source.js +88 -16
- package/dist/_pkgs/affine-block-database/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/index.js +2 -0
- package/dist/_pkgs/affine-block-database/linked-view.d.ts +38 -0
- package/dist/_pkgs/affine-block-database/linked-view.js +109 -0
- package/dist/_pkgs/affine-block-database/properties/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/properties/index.js +2 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.d.ts +15 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.js +24 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.d.ts +16 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.js +42 -0
- package/dist/_pkgs/affine-block-database/service/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-database/service/index.js +3 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.d.ts +49 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.js +21 -0
- package/dist/_pkgs/affine-block-database/service/open-row.d.ts +77 -0
- package/dist/_pkgs/affine-block-database/service/open-row.js +62 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.js +33 -0
- package/dist/_pkgs/affine-block-database/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/translations.js +35 -0
- package/dist/_pkgs/affine-block-database/view-creation.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/view-creation.js +14 -0
- package/dist/_pkgs/affine-block-database/view.d.ts +31 -1
- package/dist/_pkgs/affine-block-database/view.js +48 -4
- package/dist/_pkgs/affine-block-database/views/index.d.ts +30 -3
- package/dist/_pkgs/affine-block-database/views/index.js +44 -3
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.d.ts +25 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.js +71 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/slash-menu.js +3 -11
- package/dist/_pkgs/affine-components/date-picker/date-picker.d.ts +20 -0
- package/dist/_pkgs/affine-components/date-picker/date-picker.js +60 -26
- package/dist/_pkgs/affine-components/date-picker/style.js +1 -0
- package/dist/_pkgs/affine-components/translations.d.ts +4 -0
- package/dist/_pkgs/affine-components/translations.js +26 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +18 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +41 -2
- package/dist/_pkgs/affine-fragment-doc-title/index.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-doc-title/index.js +1 -1
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.d.ts +30 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +137 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/format.d.ts +7 -19
- package/dist/_pkgs/affine-fragment-doc-title/title-band/format.js +0 -38
- package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.d.ts +19 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.js +61 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +33 -18
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +263 -205
- package/dist/_pkgs/affine-fragment-doc-title/translations.d.ts +7 -4
- package/dist/_pkgs/affine-fragment-doc-title/translations.js +12 -9
- package/dist/_pkgs/affine-model/blocks/database/types.d.ts +16 -0
- package/dist/_pkgs/affine-model/blocks/database/types.js +5 -1
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +139 -0
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.js +22 -0
- package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/linked-doc-creation-service.d.ts +15 -6
- package/dist/_pkgs/affine-shared/services/telemetry-service/database.d.ts +59 -0
- package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +34 -7
- package/dist/_pkgs/affine-shared/utils/model/doc.d.ts +10 -2
- package/dist/_pkgs/affine-shared/utils/model/doc.js +17 -7
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +2 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +16 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +10 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +23 -0
- package/dist/_pkgs/data-view/core/component/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/component/index.js +1 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.d.ts +26 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.js +48 -0
- package/dist/_pkgs/data-view/core/component/overflow/overflow.d.ts +26 -3
- package/dist/_pkgs/data-view/core/component/overflow/overflow.js +84 -31
- package/dist/_pkgs/data-view/core/component/tags/colors.d.ts +7 -0
- package/dist/_pkgs/data-view/core/component/tags/colors.js +22 -10
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +25 -2
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +81 -32
- package/dist/_pkgs/data-view/core/data-source/base.d.ts +5 -1
- package/dist/_pkgs/data-view/core/data-source/base.js +7 -1
- package/dist/_pkgs/data-view/core/data-source/hydration.d.ts +44 -0
- package/dist/_pkgs/data-view/core/data-source/hydration.js +31 -0
- package/dist/_pkgs/data-view/core/data-source/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/data-source/index.js +1 -0
- package/dist/_pkgs/data-view/core/data-view.d.ts +22 -2
- package/dist/_pkgs/data-view/core/data-view.js +14 -0
- package/dist/_pkgs/data-view/core/effect.js +4 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.d.ts +3 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.js +59 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.d.ts +21 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.js +38 -0
- package/dist/_pkgs/data-view/core/group-by/group-title.js +4 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.d.ts +40 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.js +291 -0
- package/dist/_pkgs/data-view/core/group-by/setting.d.ts +11 -3
- package/dist/_pkgs/data-view/core/group-by/setting.js +81 -8
- package/dist/_pkgs/data-view/core/group-by/trait.d.ts +22 -0
- package/dist/_pkgs/data-view/core/group-by/trait.js +62 -1
- package/dist/_pkgs/data-view/core/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/index.js +3 -0
- package/dist/_pkgs/data-view/core/property/base-cell.d.ts +15 -1
- package/dist/_pkgs/data-view/core/property/base-cell.js +28 -3
- package/dist/_pkgs/data-view/core/property/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/property/index.js +1 -0
- package/dist/_pkgs/data-view/core/property/standalone-cell.d.ts +109 -0
- package/dist/_pkgs/data-view/core/property/standalone-cell.js +324 -0
- package/dist/_pkgs/data-view/core/telemetry.d.ts +16 -0
- package/dist/_pkgs/data-view/core/telemetry.js +22 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.d.ts +2 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.js +4 -0
- package/dist/_pkgs/data-view/core/utils/wording.d.ts +11 -0
- package/dist/_pkgs/data-view/core/utils/wording.js +9 -0
- package/dist/_pkgs/data-view/core/view/data-view.d.ts +7 -0
- package/dist/_pkgs/data-view/core/view/default-name.d.ts +10 -0
- package/dist/_pkgs/data-view/core/view/default-name.js +14 -0
- package/dist/_pkgs/data-view/core/view/index.d.ts +2 -0
- package/dist/_pkgs/data-view/core/view/index.js +2 -0
- package/dist/_pkgs/data-view/core/view/open-in.d.ts +27 -0
- package/dist/_pkgs/data-view/core/view/open-in.js +39 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.d.ts +5 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.js +11 -0
- package/dist/_pkgs/data-view/core/view-manager/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/view-manager/index.js +3 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.d.ts +18 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.js +2 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.d.ts +8 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.js +9 -0
- package/dist/_pkgs/data-view/core/view-manager/property.d.ts +14 -0
- package/dist/_pkgs/data-view/core/view-manager/single-view.d.ts +28 -1
- package/dist/_pkgs/data-view/core/view-manager/single-view.js +45 -1
- package/dist/_pkgs/data-view/core/view-manager/view-creation.d.ts +49 -0
- package/dist/_pkgs/data-view/core/view-manager/view-creation.js +40 -0
- package/dist/_pkgs/data-view/core/view-manager/view-manager.d.ts +6 -2
- package/dist/_pkgs/data-view/core/view-manager/view-manager.js +2 -2
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.d.ts +2 -0
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.js +11 -2
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/text/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/translations.d.ts +55 -0
- package/dist/_pkgs/data-view/translations.js +181 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/convert.js +2 -0
- package/dist/_pkgs/data-view/view-presets/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.js +35 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.d.ts +79 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.js +194 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +56 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +266 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.d.ts +27 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +179 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/index.d.ts +5 -0
- package/dist/_pkgs/data-view/view-presets/index.js +7 -0
- package/dist/_pkgs/data-view/view-presets/kanban/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +5 -53
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +8 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +6 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.js +52 -6
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +2 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +4 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.js +51 -6
- package/dist/_pkgs/data-view/view-presets/kanban/pc/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/list/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/list/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/list/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/list/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.d.ts +24 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.js +194 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +3 -14
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +6 -30
- package/dist/_pkgs/data-view/view-presets/table/consts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/table/consts.js +2 -0
- package/dist/_pkgs/data-view/view-presets/table/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +10 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.d.ts +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +3 -2
- package/dist/_pkgs/data-view/view-presets/table/pc/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +22 -19
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/table-view-ui-logic.js +7 -2
- package/dist/_pkgs/data-view/view-presets/table/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +5 -53
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +1 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +60 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.d.ts +18 -1
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +121 -124
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +43 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +187 -0
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.d.ts +36 -3
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +187 -59
- package/dist/extensions/view.d.ts +2 -2
- package/dist/extensions/view.js +10 -3
- package/dist/flags.d.ts +8 -4
- package/dist/flags.js +8 -4
- package/dist/frameworks.d.ts +27 -0
- package/dist/frameworks.js +28 -0
- package/dist/translations.js +13 -1
- package/package.json +5 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UniComponent } from '../../../affine-shared/types/index.js';
|
|
2
2
|
import type { InsertToPosition } from '../../../affine-shared/utils/index.js';
|
|
3
3
|
import { type ReadonlySignal } from '@preact/signals-core';
|
|
4
|
+
import type { TagOptionEdits } from '../component/tags/multi-tag-select.js';
|
|
4
5
|
import type { TypeInstance } from '../logical/type.js';
|
|
5
6
|
import type { CellRenderer, PropertyMetaConfig } from '../property/index.js';
|
|
6
7
|
import type { PropertyDataUpdater } from '../types.js';
|
|
@@ -27,6 +28,19 @@ export interface Property<RawValue = unknown, JsonValue = unknown, Data extends
|
|
|
27
28
|
cellGetOrCreate(rowId: string): Cell<RawValue, JsonValue, Data>;
|
|
28
29
|
readonly data$: ReadonlySignal<Data>;
|
|
29
30
|
dataUpdate(updater: PropertyDataUpdater<Data>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Whether `dataUpdate` writes anything; absent means it does. A standalone
|
|
33
|
+
* cell whose host cannot write the config says `false`, and a select then
|
|
34
|
+
* creates, edits and reorders no option (`standalone-cell.ts`).
|
|
35
|
+
*/
|
|
36
|
+
readonly dataCanSet?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Which option edits a select's `dataUpdate` stands for when it writes
|
|
39
|
+
* (`TagOptionEdits`); absent means all of them. A standalone cell whose
|
|
40
|
+
* host writes options one create or rename at a time says
|
|
41
|
+
* `'create-rename'`, and the tag menu offers no delete, colour or reorder.
|
|
42
|
+
*/
|
|
43
|
+
readonly optionEdits?: TagOptionEdits;
|
|
30
44
|
readonly type$: ReadonlySignal<string>;
|
|
31
45
|
readonly typeSet?: (type: string) => void;
|
|
32
46
|
get typeCanSet(): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InsertToPosition } from '../../../affine-shared/utils/index.js';
|
|
2
2
|
import type { GeneralServiceIdentifier } from '../../../global/di/index.js';
|
|
3
3
|
import { type ReadonlySignal } from '@preact/signals-core';
|
|
4
|
+
import type { DataSource } from '../data-source/base.js';
|
|
4
5
|
import type { Variable } from '../expression/types.js';
|
|
5
6
|
import type { PropertyMetaConfig } from '../property/property-config.js';
|
|
6
7
|
import type { TraitKey } from '../traits/key.js';
|
|
@@ -10,6 +11,14 @@ import { type Cell } from './cell.js';
|
|
|
10
11
|
import type { Property } from './property.js';
|
|
11
12
|
import { type Row } from './row.js';
|
|
12
13
|
import type { ViewManager } from './view-manager.js';
|
|
14
|
+
/**
|
|
15
|
+
* True when a stored `mode` has no preset of its own and the source draws it
|
|
16
|
+
* through another one (ADR 0035 §6: a `timeline`, a mode from a newer
|
|
17
|
+
* client, an import). The one spelling of the rule, read by
|
|
18
|
+
* `SingleView.shownAsFallback$` and by the views bar's tabs, which must not
|
|
19
|
+
* build a view per tab to ask.
|
|
20
|
+
*/
|
|
21
|
+
export declare function modeShownAsFallback(dataSource: Pick<DataSource, 'viewMetaGet'>, mode: string): boolean;
|
|
13
22
|
export type MainProperties = {
|
|
14
23
|
titleColumn?: string;
|
|
15
24
|
iconColumn?: string;
|
|
@@ -21,6 +30,11 @@ export interface SingleView {
|
|
|
21
30
|
readonly manager: ViewManager;
|
|
22
31
|
readonly meta: ViewMeta;
|
|
23
32
|
readonly readonly$: ReadonlySignal<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* The stored mode has no preset here and `meta` is the source's fallback:
|
|
35
|
+
* the view is drawn, its settings are read-only, its data is never written.
|
|
36
|
+
*/
|
|
37
|
+
readonly shownAsFallback$: ReadonlySignal<boolean>;
|
|
24
38
|
delete(): void;
|
|
25
39
|
duplicate(): void;
|
|
26
40
|
readonly name$: ReadonlySignal<string>;
|
|
@@ -57,6 +71,19 @@ export declare abstract class SingleViewBase<ViewData extends DataViewDataType =
|
|
|
57
71
|
id: string;
|
|
58
72
|
private readonly searchString;
|
|
59
73
|
private readonly traitMap;
|
|
74
|
+
/** The view data exactly as stored, whatever its mode. */
|
|
75
|
+
private readonly storedData$;
|
|
76
|
+
/**
|
|
77
|
+
* {@link modeShownAsFallback} for this view. Read from the stored mode,
|
|
78
|
+
* never from `type`, which a preset may derive from {@link data$}.
|
|
79
|
+
*/
|
|
80
|
+
readonly shownAsFallback$: ReadonlySignal<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* A fallback view reads the preset's DEFAULT data, keeping only its id,
|
|
83
|
+
* name and stored mode: the stored keys belong to a preset this client does
|
|
84
|
+
* not have, so neither a filter nor a column list is trusted from them, and
|
|
85
|
+
* the preset draws the source's properties as a fresh view would.
|
|
86
|
+
*/
|
|
60
87
|
data$: ReadonlySignal<ViewData | undefined>;
|
|
61
88
|
abstract detailProperties$: ReadonlySignal<Property[]>;
|
|
62
89
|
protected lockRows$: import("@preact/signals-core").Signal<boolean>;
|
|
@@ -79,7 +106,7 @@ export declare abstract class SingleViewBase<ViewData extends DataViewDataType =
|
|
|
79
106
|
icon: import("../../../affine-shared/types/uni-component.js").UniComponent | undefined;
|
|
80
107
|
propertyType: string;
|
|
81
108
|
}[]>;
|
|
82
|
-
protected get dataSource():
|
|
109
|
+
protected get dataSource(): DataSource;
|
|
83
110
|
get featureFlags$(): ReadonlySignal<DatabaseFlags>;
|
|
84
111
|
get isLocked(): boolean;
|
|
85
112
|
get meta(): ViewMeta;
|
|
@@ -2,6 +2,16 @@ import { computed, signal } from '@preact/signals-core';
|
|
|
2
2
|
import { computedLock } from '../utils/lock.js';
|
|
3
3
|
import { CellBase } from './cell.js';
|
|
4
4
|
import { RowBase } from './row.js';
|
|
5
|
+
/**
|
|
6
|
+
* True when a stored `mode` has no preset of its own and the source draws it
|
|
7
|
+
* through another one (ADR 0035 §6: a `timeline`, a mode from a newer
|
|
8
|
+
* client, an import). The one spelling of the rule, read by
|
|
9
|
+
* `SingleView.shownAsFallback$` and by the views bar's tabs, which must not
|
|
10
|
+
* build a view per tab to ask.
|
|
11
|
+
*/
|
|
12
|
+
export function modeShownAsFallback(dataSource, mode) {
|
|
13
|
+
return dataSource.viewMetaGet(mode).type !== mode;
|
|
14
|
+
}
|
|
5
15
|
export class SingleViewBase {
|
|
6
16
|
rowsDelete(rows) {
|
|
7
17
|
this.lockRows(false);
|
|
@@ -27,9 +37,37 @@ export class SingleViewBase {
|
|
|
27
37
|
this.id = id;
|
|
28
38
|
this.searchString = signal('');
|
|
29
39
|
this.traitMap = new Map();
|
|
30
|
-
|
|
40
|
+
/** The view data exactly as stored, whatever its mode. */
|
|
41
|
+
this.storedData$ = computed(() => {
|
|
31
42
|
return this.dataSource.viewDataGet(this.id);
|
|
32
43
|
});
|
|
44
|
+
/**
|
|
45
|
+
* {@link modeShownAsFallback} for this view. Read from the stored mode,
|
|
46
|
+
* never from `type`, which a preset may derive from {@link data$}.
|
|
47
|
+
*/
|
|
48
|
+
this.shownAsFallback$ = computed(() => {
|
|
49
|
+
const mode = this.storedData$.value?.mode;
|
|
50
|
+
return mode != null && modeShownAsFallback(this.dataSource, mode);
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* A fallback view reads the preset's DEFAULT data, keeping only its id,
|
|
54
|
+
* name and stored mode: the stored keys belong to a preset this client does
|
|
55
|
+
* not have, so neither a filter nor a column list is trusted from them, and
|
|
56
|
+
* the preset draws the source's properties as a fresh view would.
|
|
57
|
+
*/
|
|
58
|
+
this.data$ = computed(() => {
|
|
59
|
+
const stored = this.storedData$.value;
|
|
60
|
+
if (!stored || !this.shownAsFallback$.value) {
|
|
61
|
+
return stored;
|
|
62
|
+
}
|
|
63
|
+
const meta = this.dataSource.viewMetaGet(stored.mode);
|
|
64
|
+
return {
|
|
65
|
+
...meta.model.defaultData(this.manager),
|
|
66
|
+
id: stored.id,
|
|
67
|
+
name: stored.name,
|
|
68
|
+
mode: stored.mode,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
33
71
|
this.lockRows$ = signal(false);
|
|
34
72
|
this.isLocked$ = computed(() => {
|
|
35
73
|
return this.lockRows$.value;
|
|
@@ -96,6 +134,12 @@ export class SingleViewBase {
|
|
|
96
134
|
return this.dataSource.serviceGetOrCreate(key, create);
|
|
97
135
|
}
|
|
98
136
|
dataUpdate(updater) {
|
|
137
|
+
// A fallback view's stored data is never rewritten (ADR 0035 §6): every
|
|
138
|
+
// setting it shows is the fallback preset's default, and writing one back
|
|
139
|
+
// would mix that preset's keys into another mode's data. Cells are the
|
|
140
|
+
// source's, not the view's, and stay writable.
|
|
141
|
+
if (this.shownAsFallback$.peek())
|
|
142
|
+
return;
|
|
99
143
|
this.dataSource.viewDataUpdate(this.id, updater);
|
|
100
144
|
}
|
|
101
145
|
delete() {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { MenuConfig } from '../../../affine-components/context-menu/index.js';
|
|
2
|
+
import type { BlockStdScope } from '../../../std/index.js';
|
|
3
|
+
import { type ExtensionType } from '../../../store/index.js';
|
|
4
|
+
import type { DataSource } from '../data-source/base.js';
|
|
5
|
+
import type { ViewManager } from './view-manager.js';
|
|
6
|
+
/**
|
|
7
|
+
* Set to `true` on a data source (`serviceSet`) whose host switched off the
|
|
8
|
+
* tooling that CREATES views: the views bar then offers no "+" and no
|
|
9
|
+
* "Create …" (ADR 0035 §5, ADR 0009). Absent means offered, so every source
|
|
10
|
+
* that never sets it keeps its 0.48 views bar. The stored views keep
|
|
11
|
+
* rendering, switching layout and being deleted: only creation is tooling.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ViewCreationOffKey: import("../../../global/di/types.js").ServiceIdentifier<true> & (<U extends true = true>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
|
|
14
|
+
/**
|
|
15
|
+
* "Duplicate as table": the way out of a view shown through a fallback
|
|
16
|
+
* preset (`SingleView.shownAsFallback$`). Adds a view of the preset that drew
|
|
17
|
+
* it, under the same name, with that preset's default data, and selects it;
|
|
18
|
+
* the stored view is left exactly as it was, so a client that knows its mode
|
|
19
|
+
* still reads it. Returns the new view's id, or `undefined` when there is no
|
|
20
|
+
* such view or it is not a fallback.
|
|
21
|
+
*/
|
|
22
|
+
export declare function duplicateAsShownPreset(manager: ViewManager, viewId: string): string | undefined;
|
|
23
|
+
/** What the views bar hands an {@link AddViewMenu} when "+" is clicked. */
|
|
24
|
+
export interface AddViewMenuContext {
|
|
25
|
+
/** The editor the bar is mounted in; absent outside one. */
|
|
26
|
+
std: BlockStdScope | undefined;
|
|
27
|
+
dataSource: DataSource;
|
|
28
|
+
viewManager: ViewManager;
|
|
29
|
+
/**
|
|
30
|
+
* The bar's own "add a view of this preset": adds it with the preset's
|
|
31
|
+
* default data and its name resolved at the gesture, selects it and traces
|
|
32
|
+
* `DatabaseViewAdded` once, `source` (default `existing`) saying whether the
|
|
33
|
+
* gesture created the source the view reads. Returns its id.
|
|
34
|
+
*/
|
|
35
|
+
addView: (type: string, source?: 'existing' | 'new') => string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The "+" menu of the views bar, when something above data-view knows more
|
|
39
|
+
* than the presets (ADR 0035 §1, B11): the `core-database` bundle registers
|
|
40
|
+
* one from its tooling extension to offer "on an existing source" and "with
|
|
41
|
+
* a new source". It is a registry between library packages, never filled by
|
|
42
|
+
* a host. Absent, or answering `undefined` for a data source it does not
|
|
43
|
+
* handle, the bar offers the creatable presets, as in 0.48.
|
|
44
|
+
*/
|
|
45
|
+
export interface AddViewMenu {
|
|
46
|
+
items(context: AddViewMenuContext): MenuConfig[] | undefined;
|
|
47
|
+
}
|
|
48
|
+
export declare const AddViewMenuIdentifier: import("../../../global/di/types.js").ServiceIdentifier<AddViewMenu> & (<U extends AddViewMenu = AddViewMenu>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
|
|
49
|
+
export declare function AddViewMenuExtension(menu: AddViewMenu): ExtensionType;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createIdentifier } from '../../../global/di/index.js';
|
|
2
|
+
import { nanoid } from '../../../store/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Set to `true` on a data source (`serviceSet`) whose host switched off the
|
|
5
|
+
* tooling that CREATES views: the views bar then offers no "+" and no
|
|
6
|
+
* "Create …" (ADR 0035 §5, ADR 0009). Absent means offered, so every source
|
|
7
|
+
* that never sets it keeps its 0.48 views bar. The stored views keep
|
|
8
|
+
* rendering, switching layout and being deleted: only creation is tooling.
|
|
9
|
+
*/
|
|
10
|
+
export const ViewCreationOffKey = createIdentifier('data-view-view-creation-off');
|
|
11
|
+
/**
|
|
12
|
+
* "Duplicate as table": the way out of a view shown through a fallback
|
|
13
|
+
* preset (`SingleView.shownAsFallback$`). Adds a view of the preset that drew
|
|
14
|
+
* it, under the same name, with that preset's default data, and selects it;
|
|
15
|
+
* the stored view is left exactly as it was, so a client that knows its mode
|
|
16
|
+
* still reads it. Returns the new view's id, or `undefined` when there is no
|
|
17
|
+
* such view or it is not a fallback.
|
|
18
|
+
*/
|
|
19
|
+
export function duplicateAsShownPreset(manager, viewId) {
|
|
20
|
+
const view = manager.viewGet(viewId);
|
|
21
|
+
if (!view || !view.shownAsFallback$.peek())
|
|
22
|
+
return;
|
|
23
|
+
const meta = view.meta;
|
|
24
|
+
const id = manager.dataSource.viewDataAdd({
|
|
25
|
+
...meta.model.defaultData(manager),
|
|
26
|
+
id: nanoid(),
|
|
27
|
+
name: view.name$.peek(),
|
|
28
|
+
mode: meta.type,
|
|
29
|
+
});
|
|
30
|
+
manager.setCurrentView(id);
|
|
31
|
+
return id;
|
|
32
|
+
}
|
|
33
|
+
export const AddViewMenuIdentifier = createIdentifier('DataViewAddViewMenu');
|
|
34
|
+
export function AddViewMenuExtension(menu) {
|
|
35
|
+
return {
|
|
36
|
+
setup: di => {
|
|
37
|
+
di.override(AddViewMenuIdentifier, () => menu);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -12,7 +12,11 @@ export interface ViewManager {
|
|
|
12
12
|
setCurrentView(id: string): void;
|
|
13
13
|
views$: ReadonlySignal<string[]>;
|
|
14
14
|
viewGet(id: string): SingleView | undefined;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* `name` is what the creation site resolved (`viewDefaultName`); absent,
|
|
17
|
+
* the preset's English `defaultName` is written, as in 0.48.
|
|
18
|
+
*/
|
|
19
|
+
viewAdd(type: DataViewMode, name?: string): string;
|
|
16
20
|
viewDelete(id: string): void;
|
|
17
21
|
viewDuplicate(id: string): void;
|
|
18
22
|
viewDataGet(id: string): DataViewDataType | undefined;
|
|
@@ -30,7 +34,7 @@ export declare class ViewManagerBase implements ViewManager {
|
|
|
30
34
|
constructor(dataSource: DataSource);
|
|
31
35
|
moveTo(id: string, position: InsertToPosition): void;
|
|
32
36
|
setCurrentView(id: string | undefined): void;
|
|
33
|
-
viewAdd(type: DataViewMode): string;
|
|
37
|
+
viewAdd(type: DataViewMode, name?: string): string;
|
|
34
38
|
viewChangeType(id: string, type: string): void;
|
|
35
39
|
viewDataGet(id: string): DataViewDataType | undefined;
|
|
36
40
|
viewDelete(id: string): void;
|
|
@@ -29,13 +29,13 @@ export class ViewManagerBase {
|
|
|
29
29
|
setCurrentView(id) {
|
|
30
30
|
this._currentViewId$.value = id;
|
|
31
31
|
}
|
|
32
|
-
viewAdd(type) {
|
|
32
|
+
viewAdd(type, name) {
|
|
33
33
|
const meta = this.dataSource.viewMetaGet(type);
|
|
34
34
|
const data = meta.model.defaultData(this);
|
|
35
35
|
const id = this.dataSource.viewDataAdd({
|
|
36
36
|
...data,
|
|
37
37
|
id: nanoid(),
|
|
38
|
-
name: meta.model.defaultName,
|
|
38
|
+
name: name ?? meta.model.defaultName,
|
|
39
39
|
mode: type,
|
|
40
40
|
});
|
|
41
41
|
this.setCurrentView(id);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BaseCellRenderer } from '../../core/property/index.js';
|
|
2
2
|
export declare class DateCell extends BaseCellRenderer<number, number> {
|
|
3
3
|
private _prevPortalAbortController;
|
|
4
|
+
/** The picker opens in a popup: its words and locale are resolved here. */
|
|
5
|
+
private createDatePicker;
|
|
4
6
|
private readonly openDatePicker;
|
|
5
7
|
private readonly updateValue;
|
|
6
8
|
tempValue$: import("@preact/signals-core").Signal<Date | undefined>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { popMenu, popupTargetFromElement, } from '../../../affine-components/context-menu/index.js';
|
|
2
2
|
import { DatePicker } from '../../../affine-components/date-picker/index.js';
|
|
3
|
+
import { formatLocale } from '../../../affine-shared/services/index.js';
|
|
3
4
|
import { createLitPortal } from '../../../affine-components/portal/index.js';
|
|
4
5
|
import { IS_MOBILE } from '../../../global/env/index.js';
|
|
5
6
|
import { flip, offset } from '@floating-ui/dom';
|
|
@@ -40,7 +41,7 @@ export class DateCell extends BaseCellRenderer {
|
|
|
40
41
|
${this.formattedTempValue$.value}
|
|
41
42
|
</div>`,
|
|
42
43
|
() => {
|
|
43
|
-
const datePicker =
|
|
44
|
+
const datePicker = this.createDatePicker();
|
|
44
45
|
datePicker.padding = 0;
|
|
45
46
|
datePicker.value = this.tempValue$.value?.getTime() ?? Date.now();
|
|
46
47
|
datePicker.onChange = (date) => {
|
|
@@ -71,7 +72,7 @@ export class DateCell extends BaseCellRenderer {
|
|
|
71
72
|
middleware: [offset(10), flip()],
|
|
72
73
|
},
|
|
73
74
|
template: () => {
|
|
74
|
-
const datePicker =
|
|
75
|
+
const datePicker = this.createDatePicker();
|
|
75
76
|
datePicker.value = this.tempValue$.value?.getTime() ?? Date.now();
|
|
76
77
|
datePicker.popup = true;
|
|
77
78
|
datePicker.onClear = () => {
|
|
@@ -114,6 +115,14 @@ export class DateCell extends BaseCellRenderer {
|
|
|
114
115
|
this.format(this.value ? new Date(this.value) : undefined));
|
|
115
116
|
});
|
|
116
117
|
}
|
|
118
|
+
/** The picker opens in a popup: its words and locale are resolved here. */
|
|
119
|
+
createDatePicker() {
|
|
120
|
+
const datePicker = new DatePicker();
|
|
121
|
+
datePicker.wording = this.wording;
|
|
122
|
+
if (this.chromeStd)
|
|
123
|
+
datePicker.locale = formatLocale(this.chromeStd);
|
|
124
|
+
return datePicker;
|
|
125
|
+
}
|
|
117
126
|
format(value) {
|
|
118
127
|
return value ? format(value, 'yyyy/MM/dd') : '';
|
|
119
128
|
}
|
|
@@ -16,7 +16,8 @@ export class MultiSelectCell extends BaseCellRenderer {
|
|
|
16
16
|
this.closePopup = popTagSelect(popupTargetFromElement(this), {
|
|
17
17
|
name: this.cell.property.name$.value,
|
|
18
18
|
options: this.options$,
|
|
19
|
-
onOptionsChange: this._onOptionsChange,
|
|
19
|
+
onOptionsChange: this.property.dataCanSet === false ? undefined : this._onOptionsChange,
|
|
20
|
+
optionEdits: this.property.optionEdits,
|
|
20
21
|
value: this._value$,
|
|
21
22
|
onChange: v => {
|
|
22
23
|
this.valueSetImmediate(v);
|
|
@@ -24,6 +25,7 @@ export class MultiSelectCell extends BaseCellRenderer {
|
|
|
24
25
|
onComplete: this._editComplete,
|
|
25
26
|
minWidth: 400,
|
|
26
27
|
initialDraftText,
|
|
28
|
+
wording: this.wording,
|
|
27
29
|
});
|
|
28
30
|
};
|
|
29
31
|
this._editComplete = () => {
|
|
@@ -16,7 +16,8 @@ export class SelectCell extends BaseCellRenderer {
|
|
|
16
16
|
name: this.cell.property.name$.value,
|
|
17
17
|
mode: 'single',
|
|
18
18
|
options: this.options$,
|
|
19
|
-
onOptionsChange: this._onOptionsChange,
|
|
19
|
+
onOptionsChange: this.property.dataCanSet === false ? undefined : this._onOptionsChange,
|
|
20
|
+
optionEdits: this.property.optionEdits,
|
|
20
21
|
value: this._value$,
|
|
21
22
|
onChange: v => {
|
|
22
23
|
this.valueSetImmediate(v[0]);
|
|
@@ -24,6 +25,7 @@ export class SelectCell extends BaseCellRenderer {
|
|
|
24
25
|
onComplete: this._editComplete,
|
|
25
26
|
minWidth: 400,
|
|
26
27
|
initialDraftText,
|
|
28
|
+
wording: this.wording,
|
|
27
29
|
});
|
|
28
30
|
};
|
|
29
31
|
this._editComplete = () => {
|
|
@@ -50,7 +50,9 @@ let TextCell = (() => {
|
|
|
50
50
|
this.#_inputEle_accessor_storage = __runInitializers(this, __inputEle_initializers, void 0);
|
|
51
51
|
this._keydown = (__runInitializers(this, __inputEle_extraInitializers), (e) => {
|
|
52
52
|
if (e.key === 'Enter' && !e.isComposing) {
|
|
53
|
-
|
|
53
|
+
// Leaving commits, once, through `beforeExitEditingMode`. Committing
|
|
54
|
+
// here as well reset the input to the old value, which the exit then
|
|
55
|
+
// wrote back over the new one (standalone-cell.unit.spec.ts).
|
|
54
56
|
setTimeout(() => {
|
|
55
57
|
this.selectCurrentCell(false);
|
|
56
58
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ChromeWording } from '../affine-shared/services/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The view engine's own wordings. Most of the data-view's chrome is still a
|
|
4
|
+
* deferred surface of the literal ratchet (`DEFERRED_DIRS` in
|
|
5
|
+
* `affine/all/src/__tests__/translations/literals.unit.spec.ts`); what is
|
|
6
|
+
* declared here is what was written after that decision, keyed from the start.
|
|
7
|
+
*/
|
|
8
|
+
/** Beside the view's name in its tab: the stored mode is drawn as a table. */
|
|
9
|
+
export declare const VIEW_SHOWN_AS_TABLE: ChromeWording;
|
|
10
|
+
/**
|
|
11
|
+
* The view menu's way out of such a view: a new table view, same name, the
|
|
12
|
+
* stored one left untouched.
|
|
13
|
+
*/
|
|
14
|
+
export declare const VIEW_DUPLICATE_AS_TABLE: ChromeWording;
|
|
15
|
+
/**
|
|
16
|
+
* The "New page" card of a gallery and row of a list: adds a row, opens it.
|
|
17
|
+
* Their open button says the components' "Open" (`OPEN_LABEL`), one chrome
|
|
18
|
+
* word, one key.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DATA_VIEW_NEW_PAGE: ChromeWording;
|
|
21
|
+
export declare const VIEW_NAME_TABLE: ChromeWording;
|
|
22
|
+
export declare const VIEW_NAME_KANBAN: ChromeWording;
|
|
23
|
+
export declare const VIEW_NAME_CALENDAR: ChromeWording;
|
|
24
|
+
export declare const VIEW_NAME_GALLERY: ChromeWording;
|
|
25
|
+
export declare const VIEW_NAME_LIST: ChromeWording;
|
|
26
|
+
export declare const TAG_SELECT_PLACEHOLDER: ChromeWording;
|
|
27
|
+
export declare const TAG_SELECT_TIP: ChromeWording;
|
|
28
|
+
export declare const TAG_SELECT_CREATE: ChromeWording;
|
|
29
|
+
export declare const TAG_COLOR_TEAL: ChromeWording;
|
|
30
|
+
/** The button standing for the views whose tabs do not fit; `count` of them. */
|
|
31
|
+
export declare const VIEWS_BAR_MORE: ChromeWording;
|
|
32
|
+
/** The "+" after the tabs, as its label and tooltip. */
|
|
33
|
+
export declare const VIEWS_BAR_ADD_VIEW: ChromeWording;
|
|
34
|
+
/** A tab's menu: the name field. */
|
|
35
|
+
export declare const VIEWS_BAR_VIEW_NAME: ChromeWording;
|
|
36
|
+
/** A tab's menu: opens the view's settings. */
|
|
37
|
+
export declare const VIEWS_BAR_EDIT_VIEW: ChromeWording;
|
|
38
|
+
export declare const VIEWS_BAR_MOVE_LEFT: ChromeWording;
|
|
39
|
+
export declare const VIEWS_BAR_MOVE_RIGHT: ChromeWording;
|
|
40
|
+
/** A group's menu entry: a view setting, shared by everyone (PRD REQ-DB-16). */
|
|
41
|
+
export declare const DATA_VIEW_GROUP_HIDE: ChromeWording;
|
|
42
|
+
/** A hidden group's button, in the list at the end of the view. */
|
|
43
|
+
export declare const DATA_VIEW_GROUP_SHOW: ChromeWording;
|
|
44
|
+
/** The heading of the hidden groups, listed at the end of the view. */
|
|
45
|
+
export declare const DATA_VIEW_HIDDEN_GROUPS: ChromeWording;
|
|
46
|
+
/** A group's fold toggle: personal, kept on this device only. */
|
|
47
|
+
export declare const DATA_VIEW_GROUP_COLLAPSE: ChromeWording;
|
|
48
|
+
export declare const DATA_VIEW_GROUP_EXPAND: ChromeWording;
|
|
49
|
+
/** The view setting naming where a row's page opens (`openIn`). */
|
|
50
|
+
export declare const DATA_VIEW_OPEN_IN: ChromeWording;
|
|
51
|
+
export declare const DATA_VIEW_OPEN_IN_SIDE: ChromeWording;
|
|
52
|
+
export declare const DATA_VIEW_OPEN_IN_CENTER: ChromeWording;
|
|
53
|
+
export declare const DATA_VIEW_OPEN_IN_FULL: ChromeWording;
|
|
54
|
+
/** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
|
|
55
|
+
export declare const DATA_VIEW_WORDINGS: readonly ChromeWording[];
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The view engine's own wordings. Most of the data-view's chrome is still a
|
|
3
|
+
* deferred surface of the literal ratchet (`DEFERRED_DIRS` in
|
|
4
|
+
* `affine/all/src/__tests__/translations/literals.unit.spec.ts`); what is
|
|
5
|
+
* declared here is what was written after that decision, keyed from the start.
|
|
6
|
+
*/
|
|
7
|
+
/* ── A view whose mode has no preset here (ADR 0035 §6) ───────────────── */
|
|
8
|
+
/** Beside the view's name in its tab: the stored mode is drawn as a table. */
|
|
9
|
+
export const VIEW_SHOWN_AS_TABLE = [
|
|
10
|
+
'com.labre.data-view.view.shown-as-table',
|
|
11
|
+
'Shown as a table',
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* The view menu's way out of such a view: a new table view, same name, the
|
|
15
|
+
* stored one left untouched.
|
|
16
|
+
*/
|
|
17
|
+
export const VIEW_DUPLICATE_AS_TABLE = [
|
|
18
|
+
'com.labre.data-view.view.duplicate-as-table',
|
|
19
|
+
'Duplicate as table',
|
|
20
|
+
];
|
|
21
|
+
/* ── The gallery and list presets (ADR 0035 §1, B6 and B7) ───────────── */
|
|
22
|
+
/**
|
|
23
|
+
* The "New page" card of a gallery and row of a list: adds a row, opens it.
|
|
24
|
+
* Their open button says the components' "Open" (`OPEN_LABEL`), one chrome
|
|
25
|
+
* word, one key.
|
|
26
|
+
*/
|
|
27
|
+
export const DATA_VIEW_NEW_PAGE = [
|
|
28
|
+
'com.labre.data-view.new-page',
|
|
29
|
+
'New page',
|
|
30
|
+
];
|
|
31
|
+
/* ── A view's name when it is created ─────────────────────────────────── */
|
|
32
|
+
/*
|
|
33
|
+
* The name a new view is given. Each preset's `defaultName` is the English
|
|
34
|
+
* fallback and its `defaultNameKey` the key; the creation site writes the
|
|
35
|
+
* name resolved at the gesture (`viewDefaultName`), so a document keeps the
|
|
36
|
+
* words its author saw and a stored name is never re-translated. A model
|
|
37
|
+
* default never changes to translate a seed (ADR 0023).
|
|
38
|
+
*/
|
|
39
|
+
export const VIEW_NAME_TABLE = [
|
|
40
|
+
'com.labre.data-view.view.default-name.table',
|
|
41
|
+
'Table View',
|
|
42
|
+
];
|
|
43
|
+
export const VIEW_NAME_KANBAN = [
|
|
44
|
+
'com.labre.data-view.view.default-name.kanban',
|
|
45
|
+
'Kanban View',
|
|
46
|
+
];
|
|
47
|
+
export const VIEW_NAME_CALENDAR = [
|
|
48
|
+
'com.labre.data-view.view.default-name.calendar',
|
|
49
|
+
'Calendar View',
|
|
50
|
+
];
|
|
51
|
+
export const VIEW_NAME_GALLERY = [
|
|
52
|
+
'com.labre.data-view.view.default-name.gallery',
|
|
53
|
+
'Gallery View',
|
|
54
|
+
];
|
|
55
|
+
export const VIEW_NAME_LIST = [
|
|
56
|
+
'com.labre.data-view.view.default-name.list',
|
|
57
|
+
'List View',
|
|
58
|
+
];
|
|
59
|
+
/* ── The tag menu (select and multi-select cells, the chips band) ─────── */
|
|
60
|
+
export const TAG_SELECT_PLACEHOLDER = [
|
|
61
|
+
'com.labre.data-view.tag.placeholder',
|
|
62
|
+
'Type here...',
|
|
63
|
+
];
|
|
64
|
+
export const TAG_SELECT_TIP = [
|
|
65
|
+
'com.labre.data-view.tag.tip',
|
|
66
|
+
'Select tag or create one',
|
|
67
|
+
];
|
|
68
|
+
export const TAG_SELECT_CREATE = [
|
|
69
|
+
'com.labre.data-view.tag.create',
|
|
70
|
+
'Create',
|
|
71
|
+
];
|
|
72
|
+
/*
|
|
73
|
+
* The colours an option can take, as the option menu lists them: the
|
|
74
|
+
* palette's own names (`PALETTE_NAME_*`, one word, one key), and teal, which
|
|
75
|
+
* the canvas palette does not have.
|
|
76
|
+
*/
|
|
77
|
+
export const TAG_COLOR_TEAL = [
|
|
78
|
+
'com.labre.data-view.tag.color.teal',
|
|
79
|
+
'Teal',
|
|
80
|
+
];
|
|
81
|
+
/* ── The views bar (ADR 0035 B11, labre PRD REQ-DB-7) ─────────────────── */
|
|
82
|
+
/** The button standing for the views whose tabs do not fit; `count` of them. */
|
|
83
|
+
export const VIEWS_BAR_MORE = [
|
|
84
|
+
'com.labre.data-view.views-bar.more',
|
|
85
|
+
'{{count}} more',
|
|
86
|
+
];
|
|
87
|
+
/** The "+" after the tabs, as its label and tooltip. */
|
|
88
|
+
export const VIEWS_BAR_ADD_VIEW = [
|
|
89
|
+
'com.labre.data-view.views-bar.add-view',
|
|
90
|
+
'New view',
|
|
91
|
+
];
|
|
92
|
+
/** A tab's menu: the name field. */
|
|
93
|
+
export const VIEWS_BAR_VIEW_NAME = [
|
|
94
|
+
'com.labre.data-view.views-bar.view-name',
|
|
95
|
+
'View name',
|
|
96
|
+
];
|
|
97
|
+
/** A tab's menu: opens the view's settings. */
|
|
98
|
+
export const VIEWS_BAR_EDIT_VIEW = [
|
|
99
|
+
'com.labre.data-view.views-bar.edit-view',
|
|
100
|
+
'Edit view',
|
|
101
|
+
];
|
|
102
|
+
export const VIEWS_BAR_MOVE_LEFT = [
|
|
103
|
+
'com.labre.data-view.views-bar.move-left',
|
|
104
|
+
'Move left',
|
|
105
|
+
];
|
|
106
|
+
export const VIEWS_BAR_MOVE_RIGHT = [
|
|
107
|
+
'com.labre.data-view.views-bar.move-right',
|
|
108
|
+
'Move right',
|
|
109
|
+
];
|
|
110
|
+
/* ── Grouping and row opening, per view (ADR 0035 §8, B8) ───────────── */
|
|
111
|
+
/** A group's menu entry: a view setting, shared by everyone (PRD REQ-DB-16). */
|
|
112
|
+
export const DATA_VIEW_GROUP_HIDE = [
|
|
113
|
+
'com.labre.data-view.group.hide',
|
|
114
|
+
'Hide group',
|
|
115
|
+
];
|
|
116
|
+
/** A hidden group's button, in the list at the end of the view. */
|
|
117
|
+
export const DATA_VIEW_GROUP_SHOW = [
|
|
118
|
+
'com.labre.data-view.group.show',
|
|
119
|
+
'Show group',
|
|
120
|
+
];
|
|
121
|
+
/** The heading of the hidden groups, listed at the end of the view. */
|
|
122
|
+
export const DATA_VIEW_HIDDEN_GROUPS = [
|
|
123
|
+
'com.labre.data-view.group.hidden',
|
|
124
|
+
'Hidden groups',
|
|
125
|
+
];
|
|
126
|
+
/** A group's fold toggle: personal, kept on this device only. */
|
|
127
|
+
export const DATA_VIEW_GROUP_COLLAPSE = [
|
|
128
|
+
'com.labre.data-view.group.collapse',
|
|
129
|
+
'Collapse group',
|
|
130
|
+
];
|
|
131
|
+
export const DATA_VIEW_GROUP_EXPAND = [
|
|
132
|
+
'com.labre.data-view.group.expand',
|
|
133
|
+
'Expand group',
|
|
134
|
+
];
|
|
135
|
+
/** The view setting naming where a row's page opens (`openIn`). */
|
|
136
|
+
export const DATA_VIEW_OPEN_IN = [
|
|
137
|
+
'com.labre.data-view.open-in',
|
|
138
|
+
'Open pages in',
|
|
139
|
+
];
|
|
140
|
+
export const DATA_VIEW_OPEN_IN_SIDE = [
|
|
141
|
+
'com.labre.data-view.open-in.side',
|
|
142
|
+
'Side peek',
|
|
143
|
+
];
|
|
144
|
+
export const DATA_VIEW_OPEN_IN_CENTER = [
|
|
145
|
+
'com.labre.data-view.open-in.center',
|
|
146
|
+
'Center peek',
|
|
147
|
+
];
|
|
148
|
+
export const DATA_VIEW_OPEN_IN_FULL = [
|
|
149
|
+
'com.labre.data-view.open-in.full',
|
|
150
|
+
'Full page',
|
|
151
|
+
];
|
|
152
|
+
/** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
|
|
153
|
+
export const DATA_VIEW_WORDINGS = [
|
|
154
|
+
VIEW_SHOWN_AS_TABLE,
|
|
155
|
+
VIEW_DUPLICATE_AS_TABLE,
|
|
156
|
+
DATA_VIEW_NEW_PAGE,
|
|
157
|
+
VIEW_NAME_TABLE,
|
|
158
|
+
VIEW_NAME_KANBAN,
|
|
159
|
+
VIEW_NAME_CALENDAR,
|
|
160
|
+
VIEW_NAME_GALLERY,
|
|
161
|
+
VIEW_NAME_LIST,
|
|
162
|
+
TAG_SELECT_PLACEHOLDER,
|
|
163
|
+
TAG_SELECT_TIP,
|
|
164
|
+
TAG_SELECT_CREATE,
|
|
165
|
+
TAG_COLOR_TEAL,
|
|
166
|
+
VIEWS_BAR_MORE,
|
|
167
|
+
VIEWS_BAR_ADD_VIEW,
|
|
168
|
+
VIEWS_BAR_VIEW_NAME,
|
|
169
|
+
VIEWS_BAR_EDIT_VIEW,
|
|
170
|
+
VIEWS_BAR_MOVE_LEFT,
|
|
171
|
+
VIEWS_BAR_MOVE_RIGHT,
|
|
172
|
+
DATA_VIEW_GROUP_HIDE,
|
|
173
|
+
DATA_VIEW_GROUP_SHOW,
|
|
174
|
+
DATA_VIEW_HIDDEN_GROUPS,
|
|
175
|
+
DATA_VIEW_GROUP_COLLAPSE,
|
|
176
|
+
DATA_VIEW_GROUP_EXPAND,
|
|
177
|
+
DATA_VIEW_OPEN_IN,
|
|
178
|
+
DATA_VIEW_OPEN_IN_SIDE,
|
|
179
|
+
DATA_VIEW_OPEN_IN_CENTER,
|
|
180
|
+
DATA_VIEW_OPEN_IN_FULL,
|
|
181
|
+
];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { viewType } from '../../core/view/data-view.js';
|
|
2
|
+
import { VIEW_NAME_CALENDAR } from '../../translations.js';
|
|
2
3
|
import { CalendarSingleView } from './calendar-view-manager.js';
|
|
3
4
|
export const calendarViewType = viewType('calendar');
|
|
4
5
|
export const calendarViewModel = calendarViewType.createModel({
|
|
5
|
-
defaultName:
|
|
6
|
+
defaultName: VIEW_NAME_CALENDAR[1],
|
|
7
|
+
defaultNameKey: VIEW_NAME_CALENDAR[0],
|
|
6
8
|
dataViewManager: CalendarSingleView,
|
|
7
9
|
defaultData: viewManager => {
|
|
8
10
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createViewConvert } from '../core/view/convert.js';
|
|
2
2
|
import { calendarViewModel } from './calendar/index.js';
|
|
3
|
+
import { flatViewConverts } from './flat/flat-converts.js';
|
|
3
4
|
import { kanbanViewModel } from './kanban/index.js';
|
|
4
5
|
import { tableViewModel } from './table/index.js';
|
|
5
6
|
const headerToCalendarCard = (header) => ({
|
|
@@ -45,4 +46,5 @@ export const viewConverts = [
|
|
|
45
46
|
sort: data.sort,
|
|
46
47
|
header: calendarCardToHeader(data.card),
|
|
47
48
|
})),
|
|
49
|
+
...flatViewConverts,
|
|
48
50
|
];
|