@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,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
|
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type GeneralServiceIdentifier } from '../../../global/di/index.js';
|
|
2
|
+
import { ShadowlessElement } from '../../../std/index.js';
|
|
3
|
+
import type { ExtensionType } from '../../../store/index.js';
|
|
4
|
+
import { type ReadonlySignal } from '@preact/signals-core';
|
|
5
|
+
import { nothing } from 'lit';
|
|
6
|
+
import type { TagOptionEdits } from '../component/tags/multi-tag-select.js';
|
|
7
|
+
import type { DatabaseFlags } from '../types.js';
|
|
8
|
+
import type { Cell } from '../view-manager/cell.js';
|
|
9
|
+
import type { PropertyMetaConfig } from './property-config.js';
|
|
10
|
+
/**
|
|
11
|
+
* A cell outside any view: one property's value drawn and edited by the very
|
|
12
|
+
* cell renderer a table cell mounts (checkbox, select, multi-select, date,
|
|
13
|
+
* number, text, a link…), for a host that has a value and no table, such as
|
|
14
|
+
* the title band under a page title (ADR 0035 §11).
|
|
15
|
+
*
|
|
16
|
+
* A cell renderer is written against a `Cell` bound to a `SingleView` and a
|
|
17
|
+
* data source. Outside a view there are neither, and building a data source
|
|
18
|
+
* for one value would be a second store. What the presets actually read is
|
|
19
|
+
* small, and this seam provides exactly that and nothing more:
|
|
20
|
+
* - of the property: `name$`, `data$`, `type$`, `readonly$`, `dataUpdate`,
|
|
21
|
+
* `renderer$`, `meta$`, `dataCanSet` and `optionEdits`;
|
|
22
|
+
* - of the view: `featureFlags$` (the number format), `serviceGet` (the link
|
|
23
|
+
* cell's editor host) and `readonly$`;
|
|
24
|
+
* - of the cell: `value$` and `valueSet`, with the JSON value the raw one,
|
|
25
|
+
* which holds for every preset a standalone cell is drawn for.
|
|
26
|
+
* The rest of `SingleView` and `Row` is absent: a renderer that starts
|
|
27
|
+
* reading it fails `standalone-cell.unit.spec.ts`, which mounts every preset
|
|
28
|
+
* through this seam, rather than a host at run time.
|
|
29
|
+
*/
|
|
30
|
+
export interface StandaloneCellSource<RawValue = unknown, Data extends Record<string, unknown> = Record<string, unknown>> {
|
|
31
|
+
readonly propertyId: string;
|
|
32
|
+
readonly name$: ReadonlySignal<string>;
|
|
33
|
+
readonly data$: ReadonlySignal<Data>;
|
|
34
|
+
readonly value$: ReadonlySignal<RawValue | undefined>;
|
|
35
|
+
readonly readonly$: ReadonlySignal<boolean>;
|
|
36
|
+
/** A value the cell's editor commits; the host decides when it shows. */
|
|
37
|
+
valueSet(value: RawValue | undefined): void;
|
|
38
|
+
/**
|
|
39
|
+
* Writes the property's config (a select's options). Absent, the config is
|
|
40
|
+
* not the host's to write here: a select offers its options and creates,
|
|
41
|
+
* renames, recolours, reorders or deletes none.
|
|
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;
|
|
50
|
+
/** The view's flags (`enable_number_formatting`); absent, all off. */
|
|
51
|
+
readonly featureFlags$?: ReadonlySignal<DatabaseFlags>;
|
|
52
|
+
/** What `view.serviceGet` answers; absent, nothing. */
|
|
53
|
+
serviceGet?<T>(key: GeneralServiceIdentifier<T>): T | null;
|
|
54
|
+
}
|
|
55
|
+
/** A `Cell` for one value outside any view, drawn with `meta`'s renderer. */
|
|
56
|
+
export declare function createStandaloneCell<RawValue = unknown, Data extends Record<string, unknown> = Record<string, unknown>>(meta: PropertyMetaConfig, source: StandaloneCellSource<RawValue, Data>): Cell<RawValue, RawValue, Data>;
|
|
57
|
+
/**
|
|
58
|
+
* A property type a standalone cell can be drawn with, registered by the
|
|
59
|
+
* package that owns its renderer when that package sits above the host: the
|
|
60
|
+
* database block registers its `link` cell, which the title band (a fragment
|
|
61
|
+
* the database block depends on) cannot import. The presets of this package
|
|
62
|
+
* need no registration; a host imports them.
|
|
63
|
+
*/
|
|
64
|
+
export declare const StandaloneCellMetaProvider: import("../../../global/di/types.js").ServiceIdentifier<PropertyMetaConfig> & (<U extends PropertyMetaConfig = PropertyMetaConfig>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
|
|
65
|
+
export declare function StandaloneCellMetaExtension<Type extends string, Data extends NonNullable<unknown>, RawValue, JsonValue>(meta: PropertyMetaConfig<Type, Data, RawValue, JsonValue>): ExtensionType;
|
|
66
|
+
declare const StandaloneCellHost_base: typeof ShadowlessElement & import("../../../global/utils/types.js").Constructor<import("../../../global/lit/with-disposable.js").DisposableClass>;
|
|
67
|
+
/**
|
|
68
|
+
* The element that hosts a standalone cell: it mounts the cell renderer the
|
|
69
|
+
* way a table cell container does and owns the same edit lifecycle
|
|
70
|
+
* (`beforeEnterEditMode`, `afterEnterEditingMode`, `beforeExitEditingMode`),
|
|
71
|
+
* so a click, Enter or Space starts the renderer's own editor: the checkbox
|
|
72
|
+
* toggles, a select pops its tag menu, the date its picker, a text its input.
|
|
73
|
+
*
|
|
74
|
+
* Leaving: a popup editor (select, date) closes itself on a click away and
|
|
75
|
+
* calls `selectCurrentCell(false)`, as in the table; an editor drawn in place
|
|
76
|
+
* (an input inside this element) leaves when the focus does, Escape included.
|
|
77
|
+
* Either way the renderer's exit hook commits, exactly once.
|
|
78
|
+
*/
|
|
79
|
+
export declare class StandaloneCellHost extends StandaloneCellHost_base {
|
|
80
|
+
static styles: import("lit").CSSResult;
|
|
81
|
+
private readonly _cell$;
|
|
82
|
+
private _exiting;
|
|
83
|
+
readonly isEditing$: import("@preact/signals-core").Signal<boolean>;
|
|
84
|
+
/** Opens the renderer's editor; a checkbox toggles instead. */
|
|
85
|
+
edit(): void;
|
|
86
|
+
/** Closes the editor; the renderer's exit hook commits its value. */
|
|
87
|
+
exit(): void;
|
|
88
|
+
private readonly _selectCurrentCell;
|
|
89
|
+
connectedCallback(): void;
|
|
90
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
91
|
+
accessor cell: Cell;
|
|
92
|
+
/** Drawn while the value is empty and no editor is open. */
|
|
93
|
+
accessor placeholder: string;
|
|
94
|
+
/** Draws the value and opens no editor. */
|
|
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;
|
|
103
|
+
}
|
|
104
|
+
declare global {
|
|
105
|
+
interface HTMLElementTagNameMap {
|
|
106
|
+
'dv-standalone-cell': StandaloneCellHost;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export {};
|