@formicoidea/labre-core 0.48.0 → 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 +44 -5
- 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-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/title-band/band-cell.d.ts +8 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +12 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +5 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +44 -4
- 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/telemetry-service/database.d.ts +59 -0
- package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +24 -0
- 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 +18 -0
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +63 -21
- 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 +2 -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/standalone-cell.d.ts +15 -1
- package/dist/_pkgs/data-view/core/property/standalone-cell.js +19 -1
- 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 +8 -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 +2 -0
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +2 -0
- 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,11 +1,19 @@
|
|
|
1
1
|
import { type MenuOptions, type PopupTarget } from '../../../affine-components/context-menu/index.js';
|
|
2
2
|
import { ShadowlessElement } from '../../../std/index.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type Wording } from '../utils/wording.js';
|
|
4
|
+
import type { Group, GroupTrait } from './trait.js';
|
|
4
5
|
declare const GroupSetting_base: typeof ShadowlessElement & import("../../../global/utils/types.js").Constructor<import("../../../global/lit/with-disposable.js").DisposableClass>;
|
|
5
6
|
export declare class GroupSetting extends GroupSetting_base {
|
|
6
7
|
static styles: import("lit").CSSResult;
|
|
7
8
|
accessor groupTrait: GroupTrait;
|
|
8
|
-
|
|
9
|
+
/** Resolved by the menu's opener: a popup renders outside the host. */
|
|
10
|
+
accessor wording: Wording;
|
|
11
|
+
/**
|
|
12
|
+
* The eye of a group (B8): hide it from the view for everyone, or show it
|
|
13
|
+
* again. A hidden group keeps its row here, in its place in the order.
|
|
14
|
+
*/
|
|
15
|
+
private renderVisibility;
|
|
16
|
+
groups$: import("@preact/signals-core").ReadonlySignal<Group<unknown, unknown, Record<string, unknown>>[] | undefined>;
|
|
9
17
|
sortContext: import("../utils/wc-dnd/sort/sort-context.js").SortContext;
|
|
10
18
|
connectedCallback(): void;
|
|
11
19
|
protected render(): unknown;
|
|
@@ -21,5 +29,5 @@ export declare const popSelectGroupByProperty: (target: PopupTarget, group: Grou
|
|
|
21
29
|
onClose?: () => void;
|
|
22
30
|
onBack?: () => void;
|
|
23
31
|
}) => void;
|
|
24
|
-
export declare const popGroupSetting: (target: PopupTarget, group: GroupTrait, onBack: () => void) => void;
|
|
32
|
+
export declare const popGroupSetting: (target: PopupTarget, group: GroupTrait, onBack: () => void, wording?: Wording) => void;
|
|
25
33
|
export {};
|
|
@@ -34,16 +34,17 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
};
|
|
35
35
|
import { menu, popMenu, } from '../../../affine-components/context-menu/index.js';
|
|
36
36
|
import { SignalWatcher, WithDisposable } from '../../../global/lit/index.js';
|
|
37
|
-
import { DeleteIcon } from '@blocksuite/icons/lit';
|
|
37
|
+
import { DeleteIcon, InvisibleIcon, ViewIcon } from '@blocksuite/icons/lit';
|
|
38
38
|
import { ShadowlessElement } from '../../../std/index.js';
|
|
39
39
|
import { computed } from '@preact/signals-core';
|
|
40
|
-
import { css, html, unsafeCSS } from 'lit';
|
|
40
|
+
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
41
41
|
import { property, query } from 'lit/decorators.js';
|
|
42
42
|
import { repeat } from 'lit/directives/repeat.js';
|
|
43
|
+
import { DATA_VIEW_GROUP_HIDE, DATA_VIEW_GROUP_SHOW, } from '../../translations.js';
|
|
43
44
|
import { KanbanSingleView } from '../../view-presets/kanban/kanban-view-manager.js';
|
|
44
|
-
import { TableSingleView } from '../../view-presets/table/table-view-manager.js';
|
|
45
45
|
import { dataViewCssVariable } from '../common/css-variable.js';
|
|
46
46
|
import { renderUniLit } from '../utils/uni-component/uni-component.js';
|
|
47
|
+
import { englishWording } from '../utils/wording.js';
|
|
47
48
|
import { dragHandler } from '../utils/wc-dnd/dnd-context.js';
|
|
48
49
|
import { defaultActivators } from '../utils/wc-dnd/sensors/index.js';
|
|
49
50
|
import { createSortContext, sortable, } from '../utils/wc-dnd/sort/sort-context.js';
|
|
@@ -54,6 +55,9 @@ let GroupSetting = (() => {
|
|
|
54
55
|
let _groupTrait_decorators;
|
|
55
56
|
let _groupTrait_initializers = [];
|
|
56
57
|
let _groupTrait_extraInitializers = [];
|
|
58
|
+
let _wording_decorators;
|
|
59
|
+
let _wording_initializers = [];
|
|
60
|
+
let _wording_extraInitializers = [];
|
|
57
61
|
let _groupContainer_decorators;
|
|
58
62
|
let _groupContainer_initializers = [];
|
|
59
63
|
let _groupContainer_extraInitializers = [];
|
|
@@ -61,8 +65,10 @@ let GroupSetting = (() => {
|
|
|
61
65
|
static {
|
|
62
66
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
63
67
|
_groupTrait_decorators = [property({ attribute: false })];
|
|
68
|
+
_wording_decorators = [property({ attribute: false })];
|
|
64
69
|
_groupContainer_decorators = [query('.group-sort-setting')];
|
|
65
70
|
__esDecorate(this, null, _groupTrait_decorators, { kind: "accessor", name: "groupTrait", static: false, private: false, access: { has: obj => "groupTrait" in obj, get: obj => obj.groupTrait, set: (obj, value) => { obj.groupTrait = value; } }, metadata: _metadata }, _groupTrait_initializers, _groupTrait_extraInitializers);
|
|
71
|
+
__esDecorate(this, null, _wording_decorators, { kind: "accessor", name: "wording", static: false, private: false, access: { has: obj => "wording" in obj, get: obj => obj.wording, set: (obj, value) => { obj.wording = value; } }, metadata: _metadata }, _wording_initializers, _wording_extraInitializers);
|
|
66
72
|
__esDecorate(this, null, _groupContainer_decorators, { kind: "accessor", name: "groupContainer", static: false, private: false, access: { has: obj => "groupContainer" in obj, get: obj => obj.groupContainer, set: (obj, value) => { obj.groupContainer = value; } }, metadata: _metadata }, _groupContainer_initializers, _groupContainer_extraInitializers);
|
|
67
73
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68
74
|
}
|
|
@@ -96,10 +102,73 @@ let GroupSetting = (() => {
|
|
|
96
102
|
.group-item:hover .group-item-drag-bar {
|
|
97
103
|
background-color: #c0bfc1;
|
|
98
104
|
}
|
|
105
|
+
|
|
106
|
+
.group-item-visibility {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-shrink: 0;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: center;
|
|
111
|
+
width: 24px;
|
|
112
|
+
height: 24px;
|
|
113
|
+
margin-left: auto;
|
|
114
|
+
padding: 0;
|
|
115
|
+
border: none;
|
|
116
|
+
border-radius: 4px;
|
|
117
|
+
background: transparent;
|
|
118
|
+
color: var(--affine-icon-color);
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.group-item-visibility svg {
|
|
123
|
+
width: 16px;
|
|
124
|
+
height: 16px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.group-item-visibility:hover {
|
|
128
|
+
background-color: var(--affine-hover-color);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@media (pointer: coarse) {
|
|
132
|
+
.group-item {
|
|
133
|
+
align-items: center;
|
|
134
|
+
min-height: 44px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.group-item-visibility {
|
|
138
|
+
width: 44px;
|
|
139
|
+
height: 44px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
99
142
|
`; }
|
|
100
143
|
#groupTrait_accessor_storage;
|
|
101
144
|
get groupTrait() { return this.#groupTrait_accessor_storage; }
|
|
102
145
|
set groupTrait(value) { this.#groupTrait_accessor_storage = value; }
|
|
146
|
+
#wording_accessor_storage;
|
|
147
|
+
/** Resolved by the menu's opener: a popup renders outside the host. */
|
|
148
|
+
get wording() { return this.#wording_accessor_storage; }
|
|
149
|
+
set wording(value) { this.#wording_accessor_storage = value; }
|
|
150
|
+
/**
|
|
151
|
+
* The eye of a group (B8): hide it from the view for everyone, or show it
|
|
152
|
+
* again. A hidden group keeps its row here, in its place in the order.
|
|
153
|
+
*/
|
|
154
|
+
renderVisibility(group) {
|
|
155
|
+
const trait = this.groupTrait;
|
|
156
|
+
if (!trait.groupsCanHide || trait.view.readonly$.value)
|
|
157
|
+
return nothing;
|
|
158
|
+
const hidden = trait.hiddenGroups$.value.includes(group);
|
|
159
|
+
const label = this.wording(hidden ? DATA_VIEW_GROUP_SHOW : DATA_VIEW_GROUP_HIDE);
|
|
160
|
+
return html `<button
|
|
161
|
+
class="group-item-visibility"
|
|
162
|
+
data-testid="dv-group-visibility"
|
|
163
|
+
aria-label="${label}"
|
|
164
|
+
title="${label}"
|
|
165
|
+
aria-pressed="${hidden ? 'true' : 'false'}"
|
|
166
|
+
@pointerdown="${(event) => event.stopPropagation()}"
|
|
167
|
+
@click="${() => trait.groupHideSet(group.key, !hidden)}"
|
|
168
|
+
>
|
|
169
|
+
${hidden ? InvisibleIcon() : ViewIcon()}
|
|
170
|
+
</button>`;
|
|
171
|
+
}
|
|
103
172
|
connectedCallback() {
|
|
104
173
|
super.connectedCallback();
|
|
105
174
|
this._disposables.addFromEvent(this, 'pointerdown', e => {
|
|
@@ -146,6 +215,7 @@ let GroupSetting = (() => {
|
|
|
146
215
|
style="position:absolute;left: 0;top: 0;right: 0;bottom: 0;"
|
|
147
216
|
></div>
|
|
148
217
|
</div>
|
|
218
|
+
${this.renderVisibility(group)}
|
|
149
219
|
</div>`;
|
|
150
220
|
})}
|
|
151
221
|
</div>
|
|
@@ -157,7 +227,8 @@ let GroupSetting = (() => {
|
|
|
157
227
|
constructor() {
|
|
158
228
|
super(...arguments);
|
|
159
229
|
this.#groupTrait_accessor_storage = __runInitializers(this, _groupTrait_initializers, void 0);
|
|
160
|
-
this
|
|
230
|
+
this.#wording_accessor_storage = (__runInitializers(this, _groupTrait_extraInitializers), __runInitializers(this, _wording_initializers, englishWording));
|
|
231
|
+
this.groups$ = (__runInitializers(this, _wording_extraInitializers), computed(() => {
|
|
161
232
|
return this.groupTrait.groupsDataList$.value;
|
|
162
233
|
}));
|
|
163
234
|
this.sortContext = createSortContext({
|
|
@@ -323,7 +394,7 @@ export const popSelectGroupByProperty = (target, group, ops) => {
|
|
|
323
394
|
options: selectGroupByProperty(group, ops),
|
|
324
395
|
});
|
|
325
396
|
};
|
|
326
|
-
export const popGroupSetting = (target, group, onBack) => {
|
|
397
|
+
export const popGroupSetting = (target, group, onBack, wording) => {
|
|
327
398
|
const view = group.view;
|
|
328
399
|
const groupProperty = group.property$.value;
|
|
329
400
|
if (groupProperty == null) {
|
|
@@ -361,7 +432,7 @@ export const popGroupSetting = (target, group, onBack) => {
|
|
|
361
432
|
options: selectGroupByProperty(group, {
|
|
362
433
|
onSelect: () => {
|
|
363
434
|
menuHandler.close();
|
|
364
|
-
popGroupSetting(target, group, onBack);
|
|
435
|
+
popGroupSetting(target, group, onBack, wording);
|
|
365
436
|
},
|
|
366
437
|
}),
|
|
367
438
|
}),
|
|
@@ -371,7 +442,7 @@ export const popGroupSetting = (target, group, onBack) => {
|
|
|
371
442
|
items: group.isDateGroup$.value
|
|
372
443
|
? dateGroupSettingItems(group, () => {
|
|
373
444
|
menuHandler.close();
|
|
374
|
-
popGroupSetting(target, group, onBack);
|
|
445
|
+
popGroupSetting(target, group, onBack, wording);
|
|
375
446
|
})
|
|
376
447
|
: [],
|
|
377
448
|
}),
|
|
@@ -384,6 +455,7 @@ export const popGroupSetting = (target, group, onBack) => {
|
|
|
384
455
|
menu => html ` <data-view-group-setting
|
|
385
456
|
@mouseenter="${() => menu.closeSubMenu()}"
|
|
386
457
|
.groupTrait="${group}"
|
|
458
|
+
.wording="${wording ?? englishWording}"
|
|
387
459
|
.columnId="${groupProperty.id}"
|
|
388
460
|
></data-view-group-setting>`,
|
|
389
461
|
],
|
|
@@ -394,7 +466,8 @@ export const popGroupSetting = (target, group, onBack) => {
|
|
|
394
466
|
name: 'Remove grouping',
|
|
395
467
|
prefix: DeleteIcon(),
|
|
396
468
|
class: { 'delete-item': true },
|
|
397
|
-
|
|
469
|
+
// Every layout but the kanban, which is a grouping (B8).
|
|
470
|
+
hide: () => view instanceof KanbanSingleView,
|
|
398
471
|
select: () => {
|
|
399
472
|
group.changeGroup(undefined);
|
|
400
473
|
},
|
|
@@ -57,6 +57,25 @@ export declare class GroupTrait {
|
|
|
57
57
|
} | undefined>;
|
|
58
58
|
groupDataMap$: ReadonlySignal<Record<string, Group<unknown, unknown, Record<string, unknown>>> | undefined>;
|
|
59
59
|
groupsDataList$: ReadonlySignal<Group<unknown, unknown, Record<string, unknown>>[] | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* The groups a view draws: every group but the ones its stored
|
|
62
|
+
* `groupProperties` hide (ADR 0035 §8, B8). `groupsDataList$` keeps them
|
|
63
|
+
* all, because a reorder or a card move writes an entry for every key and
|
|
64
|
+
* must not drop a hidden group's.
|
|
65
|
+
*/
|
|
66
|
+
visibleGroups$: ReadonlySignal<Group<unknown, unknown, Record<string, unknown>>[] | undefined>;
|
|
67
|
+
/** The hidden groups, listed at the end of the view to be shown again. */
|
|
68
|
+
hiddenGroups$: ReadonlySignal<Group<unknown, unknown, Record<string, unknown>>[]>;
|
|
69
|
+
/** Whether the view stores hidden groups (every preset of 0.49 does). */
|
|
70
|
+
get groupsCanHide(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Hide or show a group for everyone: a view setting, written to the view's
|
|
73
|
+
* `groupProperties` on the gesture, never when nothing changes.
|
|
74
|
+
*/
|
|
75
|
+
groupHideSet(groupKey: string, hide: boolean): void;
|
|
76
|
+
/** Whether a group is folded: personal, on this device, never stored. */
|
|
77
|
+
collapsed$(groupKey: string): ReadonlySignal<boolean>;
|
|
78
|
+
collapsedSet(groupKey: string, collapsed: boolean): void;
|
|
60
79
|
updateData: (data: NonNullable<unknown>) => void;
|
|
61
80
|
get addGroup(): ((config: import("../index.js").WithCommonPropertyConfig<{
|
|
62
81
|
text: string;
|
|
@@ -69,6 +88,9 @@ export declare class GroupTrait {
|
|
|
69
88
|
sortRow: (groupKey: string, rows: Row[]) => Row[];
|
|
70
89
|
changeGroupSort: (keys: string[]) => void;
|
|
71
90
|
changeRowSort: (groupKeys: string[], groupKey: string, keys: string[]) => void;
|
|
91
|
+
/** Absent: the view hides no group (ops written before 0.49). */
|
|
92
|
+
groupHidden?: (groupKey: string) => boolean;
|
|
93
|
+
groupHideSet?: (groupKeys: string[], groupKey: string, hide: boolean) => void;
|
|
72
94
|
});
|
|
73
95
|
/**
|
|
74
96
|
* Whether the current grouping reads a date property, and so offers grains
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { insertPositionToIndex, } from '../../../affine-shared/utils/index.js';
|
|
2
2
|
import { computed, effect, signal, } from '@preact/signals-core';
|
|
3
|
+
import { traceViewEvent } from '../telemetry.js';
|
|
3
4
|
import { createTraitKey } from '../traits/key.js';
|
|
4
5
|
import { computedLock } from '../utils/lock.js';
|
|
6
|
+
import { groupCollapsed$, groupCollapsedSet } from './collapsed-state.js';
|
|
5
7
|
import { compareDateKeys } from './compare-date-keys.js';
|
|
6
8
|
import { defaultGroupBy } from './default.js';
|
|
7
9
|
import { findGroupByConfigByName, getGroupByService } from './matcher.js';
|
|
@@ -74,6 +76,28 @@ export const reorderGroupKeys = (keys, groupKey, position) => {
|
|
|
74
76
|
return reordered;
|
|
75
77
|
};
|
|
76
78
|
export class GroupTrait {
|
|
79
|
+
/** Whether the view stores hidden groups (every preset of 0.49 does). */
|
|
80
|
+
get groupsCanHide() {
|
|
81
|
+
return this.ops.groupHideSet != null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Hide or show a group for everyone: a view setting, written to the view's
|
|
85
|
+
* `groupProperties` on the gesture, never when nothing changes.
|
|
86
|
+
*/
|
|
87
|
+
groupHideSet(groupKey, hide) {
|
|
88
|
+
const set = this.ops.groupHideSet;
|
|
89
|
+
const groups = this.groupsDataList$.value;
|
|
90
|
+
if (!set || !groups || this.view.readonly$.value)
|
|
91
|
+
return;
|
|
92
|
+
set(groups.map(group => group.key), groupKey, hide);
|
|
93
|
+
}
|
|
94
|
+
/** Whether a group is folded: personal, on this device, never stored. */
|
|
95
|
+
collapsed$(groupKey) {
|
|
96
|
+
return groupCollapsed$(this.view.id, groupKey);
|
|
97
|
+
}
|
|
98
|
+
collapsedSet(groupKey, collapsed) {
|
|
99
|
+
groupCollapsedSet(this.view.id, groupKey, collapsed);
|
|
100
|
+
}
|
|
77
101
|
get addGroup() {
|
|
78
102
|
return this.property$.value?.meta$.value?.config.addGroup;
|
|
79
103
|
}
|
|
@@ -167,6 +191,27 @@ export class GroupTrait {
|
|
|
167
191
|
.map(key => groupMap[key])
|
|
168
192
|
.filter((v) => v != null);
|
|
169
193
|
}), this.view.isLocked$);
|
|
194
|
+
/**
|
|
195
|
+
* The groups a view draws: every group but the ones its stored
|
|
196
|
+
* `groupProperties` hide (ADR 0035 §8, B8). `groupsDataList$` keeps them
|
|
197
|
+
* all, because a reorder or a card move writes an entry for every key and
|
|
198
|
+
* must not drop a hidden group's.
|
|
199
|
+
*/
|
|
200
|
+
this.visibleGroups$ = computed(() => {
|
|
201
|
+
const groups = this.groupsDataList$.value;
|
|
202
|
+
const hidden = this.ops.groupHidden;
|
|
203
|
+
if (!groups || !hidden)
|
|
204
|
+
return groups;
|
|
205
|
+
return groups.filter(group => !hidden(group.key));
|
|
206
|
+
});
|
|
207
|
+
/** The hidden groups, listed at the end of the view to be shown again. */
|
|
208
|
+
this.hiddenGroups$ = computed(() => {
|
|
209
|
+
const groups = this.groupsDataList$.value;
|
|
210
|
+
const hidden = this.ops.groupHidden;
|
|
211
|
+
if (!groups || !hidden)
|
|
212
|
+
return [];
|
|
213
|
+
return groups.filter(group => hidden(group.key));
|
|
214
|
+
});
|
|
170
215
|
this.updateData = (data) => {
|
|
171
216
|
const property = this.property$.value;
|
|
172
217
|
if (!property) {
|
|
@@ -199,10 +244,17 @@ export class GroupTrait {
|
|
|
199
244
|
* year — keeping the reading direction.
|
|
200
245
|
*/
|
|
201
246
|
changeGroupMode(modeName) {
|
|
202
|
-
const
|
|
247
|
+
const property = this.property$.value;
|
|
248
|
+
const propertyId = property?.id;
|
|
203
249
|
if (!propertyId) {
|
|
204
250
|
return;
|
|
205
251
|
}
|
|
252
|
+
if (this.groupBy$.value?.name !== modeName) {
|
|
253
|
+
traceViewEvent(this.view, 'DatabaseGroupChanged', {
|
|
254
|
+
groupBy: modeName,
|
|
255
|
+
propertyType: property.type$.value,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
206
258
|
this.ops.groupBySet({
|
|
207
259
|
type: 'groupBy',
|
|
208
260
|
columnId: propertyId,
|
|
@@ -248,6 +300,9 @@ export class GroupTrait {
|
|
|
248
300
|
}
|
|
249
301
|
changeGroup(columnId) {
|
|
250
302
|
if (columnId == null) {
|
|
303
|
+
if (this.groupBy$.value) {
|
|
304
|
+
traceViewEvent(this.view, 'DatabaseGroupChanged', { groupBy: 'none' });
|
|
305
|
+
}
|
|
251
306
|
this.ops.groupBySet(undefined);
|
|
252
307
|
return;
|
|
253
308
|
}
|
|
@@ -258,6 +313,12 @@ export class GroupTrait {
|
|
|
258
313
|
if (groupBy) {
|
|
259
314
|
groupBy.sort = { desc: !this.sortAsc$.value };
|
|
260
315
|
}
|
|
316
|
+
if (groupBy && columnId !== this.groupBy$.value?.columnId) {
|
|
317
|
+
traceViewEvent(this.view, 'DatabaseGroupChanged', {
|
|
318
|
+
groupBy: groupBy.name,
|
|
319
|
+
propertyType: column.type$.value,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
261
322
|
this.ops.groupBySet(groupBy);
|
|
262
323
|
}
|
|
263
324
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export * from './common/index.js';
|
|
2
2
|
export * from './component/index.js';
|
|
3
3
|
export { DataSourceBase } from './data-source/base.js';
|
|
4
|
+
export * from './data-source/hydration.js';
|
|
4
5
|
export { DataViewRootUILogic } from './data-view.js';
|
|
6
|
+
export { isNewTabClick } from './utils/new-tab-click.js';
|
|
5
7
|
export * from './filter/index.js';
|
|
6
8
|
export * from './group-by/index.js';
|
|
7
9
|
export * from './logical/index.js';
|
|
8
10
|
export * from './property/index.js';
|
|
11
|
+
export * from './telemetry.js';
|
|
9
12
|
export type { DataViewSelection } from './types.js';
|
|
10
13
|
export * from './types.js';
|
|
11
14
|
export * from './utils/index.js';
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export * from './common/index.js';
|
|
2
2
|
export * from './component/index.js';
|
|
3
3
|
export { DataSourceBase } from './data-source/base.js';
|
|
4
|
+
export * from './data-source/hydration.js';
|
|
4
5
|
export { DataViewRootUILogic } from './data-view.js';
|
|
6
|
+
export { isNewTabClick } from './utils/new-tab-click.js';
|
|
5
7
|
export * from './filter/index.js';
|
|
6
8
|
export * from './group-by/index.js';
|
|
7
9
|
export * from './logical/index.js';
|
|
8
10
|
export * from './property/index.js';
|
|
11
|
+
export * from './telemetry.js';
|
|
9
12
|
export * from './types.js';
|
|
10
13
|
export * from './utils/index.js';
|
|
11
14
|
export * from './view/index.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ChromeWording, type TranslationParams } from '../../../affine-shared/services/index.js';
|
|
2
|
+
import { type BlockStdScope, ShadowlessElement } from '../../../std/index.js';
|
|
2
3
|
import { type ReadonlySignal } from '@preact/signals-core';
|
|
3
4
|
import type { PropertyValues } from 'lit';
|
|
4
5
|
import type { Cell } from '../view-manager/cell.js';
|
|
@@ -7,6 +8,19 @@ declare const BaseCellRenderer_base: typeof ShadowlessElement & import("../../..
|
|
|
7
8
|
export declare abstract class BaseCellRenderer<RawValue = unknown, JsonValue = unknown, Data extends Record<string, unknown> = Record<string, unknown>> extends BaseCellRenderer_base implements DataViewCellLifeCycle, CellRenderProps<Data, RawValue, JsonValue> {
|
|
8
9
|
get expose(): this;
|
|
9
10
|
accessor cell: Cell<RawValue, JsonValue, Data>;
|
|
11
|
+
/**
|
|
12
|
+
* The editor the cell renders in, for its chrome wordings only; absent
|
|
13
|
+
* outside one (a test, a detached mount), and then every wording is its
|
|
14
|
+
* English fallback. Not `std`: database cells already read theirs from
|
|
15
|
+
* the data source's host.
|
|
16
|
+
*/
|
|
17
|
+
accessor chromeStd: BlockStdScope;
|
|
18
|
+
/**
|
|
19
|
+
* A wording resolved here, while the cell is in the editor's DOM: the
|
|
20
|
+
* popups a cell opens (the tag menu, the date picker) render outside it
|
|
21
|
+
* and receive the resolved text.
|
|
22
|
+
*/
|
|
23
|
+
readonly wording: (wording: ChromeWording, params?: TranslationParams) => string;
|
|
10
24
|
readonly$: ReadonlySignal<boolean>;
|
|
11
25
|
value$: ReadonlySignal<RawValue | undefined>;
|
|
12
26
|
get property(): import("../index.js").Property<RawValue, JsonValue, Data>;
|
|
@@ -32,8 +32,10 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
+
import { fillPlaceholders, translateKey, } from '../../../affine-shared/services/index.js';
|
|
35
36
|
import { SignalWatcher, WithDisposable } from '../../../global/lit/index.js';
|
|
36
|
-
import { ShadowlessElement } from '../../../std/index.js';
|
|
37
|
+
import { ShadowlessElement, stdContext } from '../../../std/index.js';
|
|
38
|
+
import { consume } from '@lit/context';
|
|
37
39
|
import { computed } from '@preact/signals-core';
|
|
38
40
|
import { property } from 'lit/decorators.js';
|
|
39
41
|
let BaseCellRenderer = (() => {
|
|
@@ -41,6 +43,9 @@ let BaseCellRenderer = (() => {
|
|
|
41
43
|
let _cell_decorators;
|
|
42
44
|
let _cell_initializers = [];
|
|
43
45
|
let _cell_extraInitializers = [];
|
|
46
|
+
let _chromeStd_decorators;
|
|
47
|
+
let _chromeStd_initializers = [];
|
|
48
|
+
let _chromeStd_extraInitializers = [];
|
|
44
49
|
let _isEditing$_decorators;
|
|
45
50
|
let _isEditing$_initializers = [];
|
|
46
51
|
let _isEditing$_extraInitializers = [];
|
|
@@ -51,9 +56,11 @@ let BaseCellRenderer = (() => {
|
|
|
51
56
|
static {
|
|
52
57
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
53
58
|
_cell_decorators = [property({ attribute: false })];
|
|
59
|
+
_chromeStd_decorators = [consume({ context: stdContext })];
|
|
54
60
|
_isEditing$_decorators = [property({ attribute: false })];
|
|
55
61
|
_selectCurrentCell_decorators = [property({ attribute: false })];
|
|
56
62
|
__esDecorate(this, null, _cell_decorators, { kind: "accessor", name: "cell", static: false, private: false, access: { has: obj => "cell" in obj, get: obj => obj.cell, set: (obj, value) => { obj.cell = value; } }, metadata: _metadata }, _cell_initializers, _cell_extraInitializers);
|
|
63
|
+
__esDecorate(this, null, _chromeStd_decorators, { kind: "accessor", name: "chromeStd", static: false, private: false, access: { has: obj => "chromeStd" in obj, get: obj => obj.chromeStd, set: (obj, value) => { obj.chromeStd = value; } }, metadata: _metadata }, _chromeStd_initializers, _chromeStd_extraInitializers);
|
|
57
64
|
__esDecorate(this, null, _isEditing$_decorators, { kind: "accessor", name: "isEditing$", static: false, private: false, access: { has: obj => "isEditing$" in obj, get: obj => obj.isEditing$, set: (obj, value) => { obj.isEditing$ = value; } }, metadata: _metadata }, _isEditing$_initializers, _isEditing$_extraInitializers);
|
|
58
65
|
__esDecorate(this, null, _selectCurrentCell_decorators, { kind: "accessor", name: "selectCurrentCell", static: false, private: false, access: { has: obj => "selectCurrentCell" in obj, get: obj => obj.selectCurrentCell, set: (obj, value) => { obj.selectCurrentCell = value; } }, metadata: _metadata }, _selectCurrentCell_initializers, _selectCurrentCell_extraInitializers);
|
|
59
66
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -64,6 +71,15 @@ let BaseCellRenderer = (() => {
|
|
|
64
71
|
#cell_accessor_storage;
|
|
65
72
|
get cell() { return this.#cell_accessor_storage; }
|
|
66
73
|
set cell(value) { this.#cell_accessor_storage = value; }
|
|
74
|
+
#chromeStd_accessor_storage;
|
|
75
|
+
/**
|
|
76
|
+
* The editor the cell renders in, for its chrome wordings only; absent
|
|
77
|
+
* outside one (a test, a detached mount), and then every wording is its
|
|
78
|
+
* English fallback. Not `std`: database cells already read theirs from
|
|
79
|
+
* the data source's host.
|
|
80
|
+
*/
|
|
81
|
+
get chromeStd() { return this.#chromeStd_accessor_storage; }
|
|
82
|
+
set chromeStd(value) { this.#chromeStd_accessor_storage = value; }
|
|
67
83
|
get property() {
|
|
68
84
|
return this.cell.property;
|
|
69
85
|
}
|
|
@@ -149,9 +165,18 @@ let BaseCellRenderer = (() => {
|
|
|
149
165
|
constructor() {
|
|
150
166
|
super(...arguments);
|
|
151
167
|
this.#cell_accessor_storage = __runInitializers(this, _cell_initializers, void 0);
|
|
152
|
-
this
|
|
168
|
+
this.#chromeStd_accessor_storage = (__runInitializers(this, _cell_extraInitializers), __runInitializers(this, _chromeStd_initializers, void 0));
|
|
169
|
+
/**
|
|
170
|
+
* A wording resolved here, while the cell is in the editor's DOM: the
|
|
171
|
+
* popups a cell opens (the tag menu, the date picker) render outside it
|
|
172
|
+
* and receive the resolved text.
|
|
173
|
+
*/
|
|
174
|
+
this.wording = (__runInitializers(this, _chromeStd_extraInitializers), (wording, params) => this.chromeStd
|
|
175
|
+
? translateKey(this.chromeStd, ...wording, params)
|
|
176
|
+
: fillPlaceholders(wording[1], params));
|
|
177
|
+
this.readonly$ = computed(() => {
|
|
153
178
|
return this.cell.property.readonly$.value;
|
|
154
|
-
})
|
|
179
|
+
});
|
|
155
180
|
this.value$ = computed(() => {
|
|
156
181
|
return this.cell.value$.value;
|
|
157
182
|
});
|
|
@@ -3,6 +3,7 @@ import { ShadowlessElement } from '../../../std/index.js';
|
|
|
3
3
|
import type { ExtensionType } from '../../../store/index.js';
|
|
4
4
|
import { type ReadonlySignal } from '@preact/signals-core';
|
|
5
5
|
import { nothing } from 'lit';
|
|
6
|
+
import type { TagOptionEdits } from '../component/tags/multi-tag-select.js';
|
|
6
7
|
import type { DatabaseFlags } from '../types.js';
|
|
7
8
|
import type { Cell } from '../view-manager/cell.js';
|
|
8
9
|
import type { PropertyMetaConfig } from './property-config.js';
|
|
@@ -17,7 +18,7 @@ import type { PropertyMetaConfig } from './property-config.js';
|
|
|
17
18
|
* for one value would be a second store. What the presets actually read is
|
|
18
19
|
* small, and this seam provides exactly that and nothing more:
|
|
19
20
|
* - of the property: `name$`, `data$`, `type$`, `readonly$`, `dataUpdate`,
|
|
20
|
-
* `renderer$`, `meta$`, and `
|
|
21
|
+
* `renderer$`, `meta$`, `dataCanSet` and `optionEdits`;
|
|
21
22
|
* - of the view: `featureFlags$` (the number format), `serviceGet` (the link
|
|
22
23
|
* cell's editor host) and `readonly$`;
|
|
23
24
|
* - of the cell: `value$` and `valueSet`, with the JSON value the raw one,
|
|
@@ -40,6 +41,12 @@ export interface StandaloneCellSource<RawValue = unknown, Data extends Record<st
|
|
|
40
41
|
* renames, recolours, reorders or deletes none.
|
|
41
42
|
*/
|
|
42
43
|
dataSet?(data: Data): void;
|
|
44
|
+
/**
|
|
45
|
+
* Which option edits `dataSet` stands for; absent, all. `'create-rename'`:
|
|
46
|
+
* a select creates and renames options and deletes, recolours and
|
|
47
|
+
* reorders none (`TagOptionEdits`).
|
|
48
|
+
*/
|
|
49
|
+
readonly optionEdits?: TagOptionEdits;
|
|
43
50
|
/** The view's flags (`enable_number_formatting`); absent, all off. */
|
|
44
51
|
readonly featureFlags$?: ReadonlySignal<DatabaseFlags>;
|
|
45
52
|
/** What `view.serviceGet` answers; absent, nothing. */
|
|
@@ -86,6 +93,13 @@ export declare class StandaloneCellHost extends StandaloneCellHost_base {
|
|
|
86
93
|
accessor placeholder: string;
|
|
87
94
|
/** Draws the value and opens no editor. */
|
|
88
95
|
accessor readonly: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Told when the editor opens and closes. The gallery and list presets host
|
|
98
|
+
* a view's own cells here and lock the view's rows while one edits, as a
|
|
99
|
+
* table or kanban cell does (`view.lockRows`), so a value that changes the
|
|
100
|
+
* sort or the filter does not move or drop the row under the editor.
|
|
101
|
+
*/
|
|
102
|
+
accessor onEditingChange: ((editing: boolean) => void) | undefined;
|
|
89
103
|
}
|
|
90
104
|
declare global {
|
|
91
105
|
interface HTMLElementTagNameMap {
|
|
@@ -83,6 +83,7 @@ class StandaloneCell {
|
|
|
83
83
|
meta$: signal(meta),
|
|
84
84
|
renderer$: signal(meta.renderer.cellRenderer),
|
|
85
85
|
dataCanSet: !!source.dataSet,
|
|
86
|
+
optionEdits: source.optionEdits,
|
|
86
87
|
dataUpdate: (updater) => {
|
|
87
88
|
if (!source.dataSet)
|
|
88
89
|
return;
|
|
@@ -153,15 +154,20 @@ let StandaloneCellHost = (() => {
|
|
|
153
154
|
let _readonly_decorators;
|
|
154
155
|
let _readonly_initializers = [];
|
|
155
156
|
let _readonly_extraInitializers = [];
|
|
157
|
+
let _onEditingChange_decorators;
|
|
158
|
+
let _onEditingChange_initializers = [];
|
|
159
|
+
let _onEditingChange_extraInitializers = [];
|
|
156
160
|
return class StandaloneCellHost extends _classSuper {
|
|
157
161
|
static {
|
|
158
162
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
159
163
|
_cell_decorators = [property({ attribute: false })];
|
|
160
164
|
_placeholder_decorators = [property({ attribute: false })];
|
|
161
165
|
_readonly_decorators = [property({ attribute: false })];
|
|
166
|
+
_onEditingChange_decorators = [property({ attribute: false })];
|
|
162
167
|
__esDecorate(this, null, _cell_decorators, { kind: "accessor", name: "cell", static: false, private: false, access: { has: obj => "cell" in obj, get: obj => obj.cell, set: (obj, value) => { obj.cell = value; } }, metadata: _metadata }, _cell_initializers, _cell_extraInitializers);
|
|
163
168
|
__esDecorate(this, null, _placeholder_decorators, { kind: "accessor", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
|
|
164
169
|
__esDecorate(this, null, _readonly_decorators, { kind: "accessor", name: "readonly", static: false, private: false, access: { has: obj => "readonly" in obj, get: obj => obj.readonly, set: (obj, value) => { obj.readonly = value; } }, metadata: _metadata }, _readonly_initializers, _readonly_extraInitializers);
|
|
170
|
+
__esDecorate(this, null, _onEditingChange_decorators, { kind: "accessor", name: "onEditingChange", static: false, private: false, access: { has: obj => "onEditingChange" in obj, get: obj => obj.onEditingChange, set: (obj, value) => { obj.onEditingChange = value; } }, metadata: _metadata }, _onEditingChange_initializers, _onEditingChange_extraInitializers);
|
|
165
171
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
166
172
|
}
|
|
167
173
|
static { this.styles = css `
|
|
@@ -199,6 +205,7 @@ let StandaloneCellHost = (() => {
|
|
|
199
205
|
if (!cell?.beforeEnterEditMode())
|
|
200
206
|
return;
|
|
201
207
|
this.isEditing$.value = true;
|
|
208
|
+
this.onEditingChange?.(true);
|
|
202
209
|
requestAnimationFrame(() => {
|
|
203
210
|
if (this.isEditing$.peek())
|
|
204
211
|
cell.afterEnterEditingMode();
|
|
@@ -217,6 +224,7 @@ let StandaloneCellHost = (() => {
|
|
|
217
224
|
this._exiting = false;
|
|
218
225
|
}
|
|
219
226
|
this.isEditing$.value = false;
|
|
227
|
+
this.onEditingChange?.(false);
|
|
220
228
|
}
|
|
221
229
|
connectedCallback() {
|
|
222
230
|
super.connectedCallback();
|
|
@@ -285,6 +293,15 @@ let StandaloneCellHost = (() => {
|
|
|
285
293
|
/** Draws the value and opens no editor. */
|
|
286
294
|
get readonly() { return this.#readonly_accessor_storage; }
|
|
287
295
|
set readonly(value) { this.#readonly_accessor_storage = value; }
|
|
296
|
+
#onEditingChange_accessor_storage;
|
|
297
|
+
/**
|
|
298
|
+
* Told when the editor opens and closes. The gallery and list presets host
|
|
299
|
+
* a view's own cells here and lock the view's rows while one edits, as a
|
|
300
|
+
* table or kanban cell does (`view.lockRows`), so a value that changes the
|
|
301
|
+
* sort or the filter does not move or drop the row under the editor.
|
|
302
|
+
*/
|
|
303
|
+
get onEditingChange() { return this.#onEditingChange_accessor_storage; }
|
|
304
|
+
set onEditingChange(value) { this.#onEditingChange_accessor_storage = value; }
|
|
288
305
|
constructor() {
|
|
289
306
|
super(...arguments);
|
|
290
307
|
this._cell$ = signal();
|
|
@@ -299,7 +316,8 @@ let StandaloneCellHost = (() => {
|
|
|
299
316
|
this.#cell_accessor_storage = __runInitializers(this, _cell_initializers, void 0);
|
|
300
317
|
this.#placeholder_accessor_storage = (__runInitializers(this, _cell_extraInitializers), __runInitializers(this, _placeholder_initializers, ''));
|
|
301
318
|
this.#readonly_accessor_storage = (__runInitializers(this, _placeholder_extraInitializers), __runInitializers(this, _readonly_initializers, false));
|
|
302
|
-
__runInitializers(this, _readonly_extraInitializers);
|
|
319
|
+
this.#onEditingChange_accessor_storage = (__runInitializers(this, _readonly_extraInitializers), __runInitializers(this, _onEditingChange_initializers, undefined));
|
|
320
|
+
__runInitializers(this, _onEditingChange_extraInitializers);
|
|
303
321
|
}
|
|
304
322
|
};
|
|
305
323
|
})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DatabaseAllEvents, DatabaseAllViewEvents, EventTraceFn } from '../../affine-shared/services/index.js';
|
|
2
|
+
import type { SingleView } from './view-manager/single-view.js';
|
|
3
|
+
/**
|
|
4
|
+
* The tracer a database host gives its data source (`serviceSet`), the same
|
|
5
|
+
* function it passes the root as `config.eventTrace`. It exists for the
|
|
6
|
+
* gestures whose code holds a view or a trait but no UI logic (the group-by
|
|
7
|
+
* menus build from a `GroupTrait`): they report through the view's source.
|
|
8
|
+
* Absent, nothing is reported (a standalone data view, a test).
|
|
9
|
+
*/
|
|
10
|
+
export declare const DataViewEventTraceKey: import("../../global/di/types.js").ServiceIdentifier<EventTraceFn<DatabaseAllEvents>> & (<U extends EventTraceFn<DatabaseAllEvents> = EventTraceFn<DatabaseAllEvents>>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
|
|
11
|
+
/**
|
|
12
|
+
* Report a view-level event from code that only holds the view, with the
|
|
13
|
+
* same `viewId` / `viewType` params `DataViewUILogicBase.eventTrace` adds.
|
|
14
|
+
* Ids only (telemetry README, "Databases").
|
|
15
|
+
*/
|
|
16
|
+
export declare function traceViewEvent<K extends keyof DatabaseAllViewEvents>(view: SingleView, key: K, params: DatabaseAllViewEvents[K]): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createIdentifier } from '../../global/di/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The tracer a database host gives its data source (`serviceSet`), the same
|
|
4
|
+
* function it passes the root as `config.eventTrace`. It exists for the
|
|
5
|
+
* gestures whose code holds a view or a trait but no UI logic (the group-by
|
|
6
|
+
* menus build from a `GroupTrait`): they report through the view's source.
|
|
7
|
+
* Absent, nothing is reported (a standalone data view, a test).
|
|
8
|
+
*/
|
|
9
|
+
export const DataViewEventTraceKey = createIdentifier('data-view-event-trace');
|
|
10
|
+
/**
|
|
11
|
+
* Report a view-level event from code that only holds the view, with the
|
|
12
|
+
* same `viewId` / `viewType` params `DataViewUILogicBase.eventTrace` adds.
|
|
13
|
+
* Ids only (telemetry README, "Databases").
|
|
14
|
+
*/
|
|
15
|
+
export function traceViewEvent(view, key, params) {
|
|
16
|
+
const trace = view.manager.dataSource.serviceGet(DataViewEventTraceKey);
|
|
17
|
+
trace?.(key, {
|
|
18
|
+
...params,
|
|
19
|
+
viewId: view.id,
|
|
20
|
+
viewType: view.type,
|
|
21
|
+
});
|
|
22
|
+
}
|