@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,19 +1,55 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
1
35
|
import { menu, popMenu, popupTargetFromElement, } from '../../../../../affine-components/context-menu/index.js';
|
|
2
36
|
import { unsafeCSSVarV2 } from '../../../../../affine-shared/theme/index.js';
|
|
3
|
-
import { ArrowRightSmallIcon, DeleteIcon, DuplicateIcon, FilterIcon, GroupingIcon, InfoIcon, LayoutIcon, MoreHorizontalIcon, SortIcon, } from '@blocksuite/icons/lit';
|
|
37
|
+
import { ArrowRightSmallIcon, DeleteIcon, DuplicateIcon, FilterIcon, GroupingIcon, InfoIcon, LayoutIcon, MoreHorizontalIcon, OpenInNewIcon, SortIcon, } from '@blocksuite/icons/lit';
|
|
38
|
+
import { stdContext } from '../../../../../std/index.js';
|
|
39
|
+
import { consume } from '@lit/context';
|
|
4
40
|
import { css, html } from 'lit';
|
|
5
|
-
import { styleMap } from 'lit/directives/style-map.js';
|
|
6
|
-
import { popPropertiesSetting } from '../../../../core/common/properties.js';
|
|
7
41
|
import { filterTraitKey } from '../../../../core/filter/trait.js';
|
|
8
|
-
import { popGroupSetting, popSelectGroupByProperty, } from '../../../../core/group-by/setting.js';
|
|
9
42
|
import { groupTraitKey } from '../../../../core/group-by/trait.js';
|
|
10
|
-
import { emptyFilterGroup, popCreateFilter,
|
|
43
|
+
import { emptyFilterGroup, popCreateFilter, } from '../../../../core/index.js';
|
|
11
44
|
import { popCreateSort } from '../../../../core/sort/add-sort.js';
|
|
12
45
|
import { sortTraitKey } from '../../../../core/sort/manager.js';
|
|
13
46
|
import { createSortUtils } from '../../../../core/sort/utils.js';
|
|
47
|
+
import { englishWording, wordingOf, } from '../../../../core/utils/wording.js';
|
|
14
48
|
import { WidgetBase } from '../../../../core/widget/widget-base.js';
|
|
15
49
|
import { popFilterRoot } from '../../../quick-setting-bar/filter/root-panel-view.js';
|
|
16
50
|
import { popSortRoot } from '../../../quick-setting-bar/sort/root-panel.js';
|
|
51
|
+
import { DATA_VIEW_OPEN_IN } from '../../../../translations.js';
|
|
52
|
+
import { openInCurrent, openInOptions, openViewSetting, popViewSetting, viewSettingAvailable, } from './view-settings.js';
|
|
17
53
|
const styles = css `
|
|
18
54
|
.affine-database-toolbar-item.more-action {
|
|
19
55
|
padding: 2px;
|
|
@@ -36,31 +72,83 @@ const styles = css `
|
|
|
36
72
|
background: var(--affine-hover-color);
|
|
37
73
|
}
|
|
38
74
|
`;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
let DataViewHeaderToolsViewOptions = (() => {
|
|
76
|
+
let _classSuper = WidgetBase;
|
|
77
|
+
let _std_decorators;
|
|
78
|
+
let _std_initializers = [];
|
|
79
|
+
let _std_extraInitializers = [];
|
|
80
|
+
return class DataViewHeaderToolsViewOptions extends _classSuper {
|
|
81
|
+
constructor() {
|
|
82
|
+
super(...arguments);
|
|
83
|
+
this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
|
|
84
|
+
this.clickMoreAction = (__runInitializers(this, _std_extraInitializers), (e) => {
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
this.openMoreAction(popupTargetFromElement(e.currentTarget));
|
|
87
|
+
});
|
|
88
|
+
this.openMoreAction = (target) => {
|
|
89
|
+
popViewOptions(target, this.dataViewLogic, undefined, wordingOf(this.std));
|
|
90
|
+
};
|
|
54
91
|
}
|
|
55
|
-
|
|
92
|
+
static {
|
|
93
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
94
|
+
_std_decorators = [consume({ context: stdContext })];
|
|
95
|
+
__esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
|
|
96
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
97
|
+
}
|
|
98
|
+
static { this.styles = styles; }
|
|
99
|
+
#std_accessor_storage;
|
|
100
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
101
|
+
get std() { return this.#std_accessor_storage; }
|
|
102
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
103
|
+
/**
|
|
104
|
+
* Whether the current view offers setting `key` now (labre PRD REQ-DB-10:
|
|
105
|
+
* what a host's "This view" menu lists for the full page of a database).
|
|
106
|
+
*/
|
|
107
|
+
settingAvailable(key) {
|
|
108
|
+
return viewSettingAvailable(this.dataViewLogic, key);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Open the menu of one setting of the current view, anchored on this
|
|
112
|
+
* button, its "back" leading to the view settings: the entry the view
|
|
113
|
+
* settings menu would open, for a caller outside it (a host's menu, through
|
|
114
|
+
* the database page's view-menu commands). Nothing when not offered.
|
|
115
|
+
*/
|
|
116
|
+
openSetting(key) {
|
|
117
|
+
const target = popupTargetFromElement(this);
|
|
118
|
+
popViewSetting(target, this.dataViewLogic, key, () => this.openMoreAction(target), wordingOf(this.std));
|
|
119
|
+
}
|
|
120
|
+
render() {
|
|
121
|
+
if (this.view.readonly$.value) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return html ` <div
|
|
56
125
|
class="affine-database-toolbar-item more-action"
|
|
57
126
|
@click="${this.clickMoreAction}"
|
|
58
127
|
>
|
|
59
128
|
${MoreHorizontalIcon()}
|
|
60
129
|
</div>`;
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
})();
|
|
133
|
+
export { DataViewHeaderToolsViewOptions };
|
|
134
|
+
/**
|
|
135
|
+
* "Open pages in" (B8, PRD REQ-DB-11): a view setting shared by everyone,
|
|
136
|
+
* offered only where rows are pages, written on the pick alone.
|
|
137
|
+
*/
|
|
138
|
+
const openInMenu = (dataViewLogic, reopen, wording) => {
|
|
139
|
+
if (!viewSettingAvailable(dataViewLogic, 'open-in'))
|
|
140
|
+
return;
|
|
141
|
+
const currentChoice = openInCurrent(dataViewLogic);
|
|
142
|
+
return menu.subMenu({
|
|
143
|
+
name: wording(DATA_VIEW_OPEN_IN),
|
|
144
|
+
prefix: OpenInNewIcon(),
|
|
145
|
+
postfix: html ` <div style="font-size: 14px;">
|
|
146
|
+
${currentChoice ? wording(currentChoice.wording) : ''}
|
|
147
|
+
</div>`,
|
|
148
|
+
options: openInOptions(dataViewLogic, reopen, wording),
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
const createSettingMenus = (target, dataViewLogic, reopen, wording) => {
|
|
64
152
|
const view = dataViewLogic.view;
|
|
65
153
|
const settingItems = [];
|
|
66
154
|
settingItems.push(menu.action({
|
|
@@ -71,10 +159,7 @@ const createSettingMenus = (target, dataViewLogic, reopen) => {
|
|
|
71
159
|
</div>
|
|
72
160
|
${ArrowRightSmallIcon()}`,
|
|
73
161
|
select: () => {
|
|
74
|
-
|
|
75
|
-
view: view,
|
|
76
|
-
onBack: reopen,
|
|
77
|
-
});
|
|
162
|
+
openViewSetting(target, dataViewLogic, 'properties', reopen, wording);
|
|
78
163
|
},
|
|
79
164
|
}));
|
|
80
165
|
const filterTrait = view.traitGet(filterTraitKey);
|
|
@@ -165,25 +250,19 @@ const createSettingMenus = (target, dataViewLogic, reopen) => {
|
|
|
165
250
|
</div>
|
|
166
251
|
${ArrowRightSmallIcon()}`,
|
|
167
252
|
select: () => {
|
|
168
|
-
|
|
169
|
-
if (!groupBy) {
|
|
170
|
-
popSelectGroupByProperty(target, groupTrait, {
|
|
171
|
-
onSelect: () => popGroupSetting(target, groupTrait, reopen),
|
|
172
|
-
onBack: reopen,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
popGroupSetting(target, groupTrait, reopen);
|
|
177
|
-
}
|
|
253
|
+
openViewSetting(target, dataViewLogic, 'group', reopen, wording);
|
|
178
254
|
},
|
|
179
255
|
}));
|
|
180
256
|
}
|
|
257
|
+
const openIn = openInMenu(dataViewLogic, reopen, wording);
|
|
258
|
+
if (openIn)
|
|
259
|
+
settingItems.push(openIn);
|
|
181
260
|
return settingItems;
|
|
182
261
|
};
|
|
183
|
-
export const popViewOptions = (target, dataViewLogic, onClose) => {
|
|
262
|
+
export const popViewOptions = (target, dataViewLogic, onClose, wording = englishWording) => {
|
|
184
263
|
const view = dataViewLogic.view;
|
|
185
264
|
const reopen = () => {
|
|
186
|
-
popViewOptions(target, dataViewLogic);
|
|
265
|
+
popViewOptions(target, dataViewLogic, undefined, wording);
|
|
187
266
|
};
|
|
188
267
|
const items = [];
|
|
189
268
|
items.push(menu.input({
|
|
@@ -204,96 +283,14 @@ export const popViewOptions = (target, dataViewLogic, onClose) => {
|
|
|
204
283
|
</div>
|
|
205
284
|
${ArrowRightSmallIcon()}`,
|
|
206
285
|
select: () => {
|
|
207
|
-
|
|
208
|
-
return menu => {
|
|
209
|
-
if (!menu.search(meta.model.defaultName)) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
const isSelected = meta.type === view.manager.currentView$.value?.type;
|
|
213
|
-
const iconStyle = styleMap({
|
|
214
|
-
fontSize: '24px',
|
|
215
|
-
color: isSelected
|
|
216
|
-
? 'var(--affine-text-emphasis-color)'
|
|
217
|
-
: 'var(--affine-icon-secondary)',
|
|
218
|
-
});
|
|
219
|
-
const textStyle = styleMap({
|
|
220
|
-
fontSize: '14px',
|
|
221
|
-
lineHeight: '22px',
|
|
222
|
-
color: isSelected
|
|
223
|
-
? 'var(--affine-text-emphasis-color)'
|
|
224
|
-
: 'var(--affine-text-secondary-color)',
|
|
225
|
-
});
|
|
226
|
-
const data = {
|
|
227
|
-
content: () => html `
|
|
228
|
-
<div
|
|
229
|
-
style="color:var(--affine-text-emphasis-color);width:100%;display: flex;flex-direction: column;align-items: center;justify-content: center;padding: 6px 16px;white-space: nowrap"
|
|
230
|
-
>
|
|
231
|
-
<div style="${iconStyle}">
|
|
232
|
-
${renderUniLit(meta.renderer.icon)}
|
|
233
|
-
</div>
|
|
234
|
-
<div style="${textStyle}">${meta.model.defaultName}</div>
|
|
235
|
-
</div>
|
|
236
|
-
`,
|
|
237
|
-
select: () => {
|
|
238
|
-
const id = view.manager.currentViewId$.value;
|
|
239
|
-
// Re-picking the current layout would reset the view to the
|
|
240
|
-
// defaults of its own type, dropping widths and filters.
|
|
241
|
-
if (!id || meta.type === view.type) {
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
view.manager.viewChangeType(id, meta.type);
|
|
245
|
-
dataViewLogic.clearSelection();
|
|
246
|
-
},
|
|
247
|
-
class: {},
|
|
248
|
-
};
|
|
249
|
-
const containerStyle = styleMap({
|
|
250
|
-
flex: '1',
|
|
251
|
-
});
|
|
252
|
-
return html ` <affine-menu-button
|
|
253
|
-
style="${containerStyle}"
|
|
254
|
-
.data="${data}"
|
|
255
|
-
.menu="${menu}"
|
|
256
|
-
></affine-menu-button>`;
|
|
257
|
-
};
|
|
258
|
-
});
|
|
259
|
-
popMenu(target, {
|
|
260
|
-
options: {
|
|
261
|
-
title: {
|
|
262
|
-
onBack: reopen,
|
|
263
|
-
text: 'Layout',
|
|
264
|
-
},
|
|
265
|
-
items: [
|
|
266
|
-
menu => {
|
|
267
|
-
const result = menu.renderItems(viewTypes);
|
|
268
|
-
if (result.length) {
|
|
269
|
-
return html ` <div style="display: flex">${result}</div>`;
|
|
270
|
-
}
|
|
271
|
-
return html ``;
|
|
272
|
-
},
|
|
273
|
-
// menu.toggleSwitch({
|
|
274
|
-
// name: 'Show block icon',
|
|
275
|
-
// on: true,
|
|
276
|
-
// onChange: value => {
|
|
277
|
-
// console.log(value);
|
|
278
|
-
// },
|
|
279
|
-
// }),
|
|
280
|
-
// menu.toggleSwitch({
|
|
281
|
-
// name: 'Show Vertical lines',
|
|
282
|
-
// on: true,
|
|
283
|
-
// onChange: value => {
|
|
284
|
-
// console.log(value);
|
|
285
|
-
// },
|
|
286
|
-
// }),
|
|
287
|
-
],
|
|
288
|
-
},
|
|
289
|
-
});
|
|
286
|
+
openViewSetting(target, dataViewLogic, 'layout', reopen, wording);
|
|
290
287
|
},
|
|
291
288
|
prefix: LayoutIcon(),
|
|
292
289
|
}),
|
|
293
290
|
],
|
|
294
291
|
}));
|
|
295
292
|
items.push(menu.group({
|
|
296
|
-
items: createSettingMenus(target, dataViewLogic, reopen),
|
|
293
|
+
items: createSettingMenus(target, dataViewLogic, reopen, wording),
|
|
297
294
|
}));
|
|
298
295
|
items.push(menu.group({
|
|
299
296
|
items: [
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type MenuOptions, type PopupTarget } from '../../../../../affine-components/context-menu/index.js';
|
|
2
|
+
import type { DatabaseViewOpenIn } from '../../../../../affine-model/index.js';
|
|
3
|
+
import type { ChromeWording } from '../../../../../affine-shared/services/index.js';
|
|
4
|
+
import { type TemplateResult } from 'lit';
|
|
5
|
+
import { type DataViewUILogicBase } from '../../../../core/index.js';
|
|
6
|
+
import type { Wording } from '../../../../core/utils/wording.js';
|
|
7
|
+
/**
|
|
8
|
+
* The settings of a view that a menu entry opens on its own (labre PRD
|
|
9
|
+
* REQ-DB-10: the "This view" section of a host's header menu lists them for
|
|
10
|
+
* the full page of a database). The view settings menu (`popViewOptions`)
|
|
11
|
+
* opens the very same functions from its entries, so a host's entry and the
|
|
12
|
+
* library's own menu are one code path: same menus, same writes, same
|
|
13
|
+
* "back" to the view settings. Open: a later minor may add a key.
|
|
14
|
+
*/
|
|
15
|
+
export type ViewSettingKey = 'layout' | 'properties' | 'group' | 'open-in';
|
|
16
|
+
/**
|
|
17
|
+
* Whether the current view offers `key`: grouping needs the group trait,
|
|
18
|
+
* "Open pages in" a source whose rows are pages (B8). A read-only or
|
|
19
|
+
* fallback view offers nothing: its settings menu is not drawn either.
|
|
20
|
+
*/
|
|
21
|
+
export declare function viewSettingAvailable(dataViewLogic: DataViewUILogicBase, key: ViewSettingKey): boolean;
|
|
22
|
+
/** The current "Open pages in" choice, with its wording, for a postfix. */
|
|
23
|
+
export declare function openInCurrent(dataViewLogic: DataViewUILogicBase): {
|
|
24
|
+
mode: DatabaseViewOpenIn;
|
|
25
|
+
wording: ChromeWording;
|
|
26
|
+
icon: () => TemplateResult;
|
|
27
|
+
} | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* "Open pages in" (B8, PRD REQ-DB-11) as menu options: a view setting shared
|
|
30
|
+
* by everyone, written on the pick alone.
|
|
31
|
+
*/
|
|
32
|
+
export declare function openInOptions(dataViewLogic: DataViewUILogicBase, reopen: () => void, wording: Wording): MenuOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Open the menu of one view setting, anchored on `target`. `reopen` is the
|
|
35
|
+
* menus' "back" (the view settings menu). A setting the view does not offer
|
|
36
|
+
* opens nothing.
|
|
37
|
+
*/
|
|
38
|
+
export declare function popViewSetting(target: PopupTarget, dataViewLogic: DataViewUILogicBase, key: ViewSettingKey, reopen: () => void, wording: Wording): void;
|
|
39
|
+
/**
|
|
40
|
+
* The entries of the view settings menu: the same openers, without the
|
|
41
|
+
* availability check, since that menu decides itself which entries it draws.
|
|
42
|
+
*/
|
|
43
|
+
export declare function openViewSetting(target: PopupTarget, dataViewLogic: DataViewUILogicBase, key: ViewSettingKey, reopen: () => void, wording: Wording): void;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { menu, popMenu, } from '../../../../../affine-components/context-menu/index.js';
|
|
2
|
+
import { CenterPeekIcon, ExpandFullIcon, RightSidebarIcon, } from '@blocksuite/icons/lit';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
5
|
+
import { popPropertiesSetting } from '../../../../core/common/properties.js';
|
|
6
|
+
import { popGroupSetting, popSelectGroupByProperty, } from '../../../../core/group-by/setting.js';
|
|
7
|
+
import { groupTraitKey } from '../../../../core/group-by/trait.js';
|
|
8
|
+
import { renderUniLit, } from '../../../../core/index.js';
|
|
9
|
+
import { rowsArePages, viewOpenIn, viewOpenInSet, } from '../../../../core/view/open-in.js';
|
|
10
|
+
import { PropertiesPanelOpenerKey } from '../../../../core/view-manager/properties-panel-opener.js';
|
|
11
|
+
import { DATA_VIEW_OPEN_IN, DATA_VIEW_OPEN_IN_CENTER, DATA_VIEW_OPEN_IN_FULL, DATA_VIEW_OPEN_IN_SIDE, } from '../../../../translations.js';
|
|
12
|
+
/** The three places a row's page opens, in the stored order (ADR 0035 §8). */
|
|
13
|
+
const OPEN_IN_CHOICES = [
|
|
14
|
+
{ mode: 'side', wording: DATA_VIEW_OPEN_IN_SIDE, icon: RightSidebarIcon },
|
|
15
|
+
{ mode: 'center', wording: DATA_VIEW_OPEN_IN_CENTER, icon: CenterPeekIcon },
|
|
16
|
+
{ mode: 'full', wording: DATA_VIEW_OPEN_IN_FULL, icon: ExpandFullIcon },
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Whether the current view offers `key`: grouping needs the group trait,
|
|
20
|
+
* "Open pages in" a source whose rows are pages (B8). A read-only or
|
|
21
|
+
* fallback view offers nothing: its settings menu is not drawn either.
|
|
22
|
+
*/
|
|
23
|
+
export function viewSettingAvailable(dataViewLogic, key) {
|
|
24
|
+
const view = dataViewLogic.view;
|
|
25
|
+
if (view.readonly$.value || view.shownAsFallback$.value)
|
|
26
|
+
return false;
|
|
27
|
+
switch (key) {
|
|
28
|
+
case 'group':
|
|
29
|
+
return !!view.traitGet(groupTraitKey);
|
|
30
|
+
case 'open-in':
|
|
31
|
+
return rowsArePages(view.manager.dataSource);
|
|
32
|
+
case 'layout':
|
|
33
|
+
case 'properties':
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** The current "Open pages in" choice, with its wording, for a postfix. */
|
|
38
|
+
export function openInCurrent(dataViewLogic) {
|
|
39
|
+
const view = dataViewLogic.view;
|
|
40
|
+
const current = viewOpenIn(view.manager.dataSource.viewDataGet(view.id));
|
|
41
|
+
return OPEN_IN_CHOICES.find(choice => choice.mode === current);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* "Open pages in" (B8, PRD REQ-DB-11) as menu options: a view setting shared
|
|
45
|
+
* by everyone, written on the pick alone.
|
|
46
|
+
*/
|
|
47
|
+
export function openInOptions(dataViewLogic, reopen, wording) {
|
|
48
|
+
const view = dataViewLogic.view;
|
|
49
|
+
const current = openInCurrent(dataViewLogic)?.mode;
|
|
50
|
+
return {
|
|
51
|
+
title: { text: wording(DATA_VIEW_OPEN_IN) },
|
|
52
|
+
items: OPEN_IN_CHOICES.map(choice => menu.action({
|
|
53
|
+
name: wording(choice.wording),
|
|
54
|
+
prefix: choice.icon(),
|
|
55
|
+
isSelected: choice.mode === current,
|
|
56
|
+
select: () => {
|
|
57
|
+
viewOpenInSet(view, choice.mode);
|
|
58
|
+
reopen();
|
|
59
|
+
},
|
|
60
|
+
})),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function popLayout(target, dataViewLogic, reopen) {
|
|
64
|
+
const view = dataViewLogic.view;
|
|
65
|
+
const viewTypes = view.manager.viewMetas.map(meta => {
|
|
66
|
+
return menu => {
|
|
67
|
+
if (!menu.search(meta.model.defaultName)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const isSelected = meta.type === view.manager.currentView$.value?.type;
|
|
71
|
+
const iconStyle = styleMap({
|
|
72
|
+
fontSize: '24px',
|
|
73
|
+
color: isSelected
|
|
74
|
+
? 'var(--affine-text-emphasis-color)'
|
|
75
|
+
: 'var(--affine-icon-secondary)',
|
|
76
|
+
});
|
|
77
|
+
const textStyle = styleMap({
|
|
78
|
+
fontSize: '14px',
|
|
79
|
+
lineHeight: '22px',
|
|
80
|
+
color: isSelected
|
|
81
|
+
? 'var(--affine-text-emphasis-color)'
|
|
82
|
+
: 'var(--affine-text-secondary-color)',
|
|
83
|
+
});
|
|
84
|
+
const data = {
|
|
85
|
+
content: () => html `
|
|
86
|
+
<div
|
|
87
|
+
style="color:var(--affine-text-emphasis-color);width:100%;display: flex;flex-direction: column;align-items: center;justify-content: center;padding: 6px 16px;white-space: nowrap"
|
|
88
|
+
>
|
|
89
|
+
<div style="${iconStyle}">${renderUniLit(meta.renderer.icon)}</div>
|
|
90
|
+
<div style="${textStyle}">${meta.model.defaultName}</div>
|
|
91
|
+
</div>
|
|
92
|
+
`,
|
|
93
|
+
select: () => {
|
|
94
|
+
const id = view.manager.currentViewId$.value;
|
|
95
|
+
// Re-picking the current layout would reset the view to the
|
|
96
|
+
// defaults of its own type, dropping widths and filters.
|
|
97
|
+
if (!id || meta.type === view.type) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
dataViewLogic.eventTrace('DatabaseViewTypeChanged', {
|
|
101
|
+
fromViewType: view.type,
|
|
102
|
+
toViewType: meta.type,
|
|
103
|
+
});
|
|
104
|
+
view.manager.viewChangeType(id, meta.type);
|
|
105
|
+
dataViewLogic.clearSelection();
|
|
106
|
+
},
|
|
107
|
+
class: {},
|
|
108
|
+
};
|
|
109
|
+
const containerStyle = styleMap({
|
|
110
|
+
flex: '1',
|
|
111
|
+
});
|
|
112
|
+
return html ` <affine-menu-button
|
|
113
|
+
style="${containerStyle}"
|
|
114
|
+
.data="${data}"
|
|
115
|
+
.menu="${menu}"
|
|
116
|
+
></affine-menu-button>`;
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
popMenu(target, {
|
|
120
|
+
options: {
|
|
121
|
+
title: {
|
|
122
|
+
onBack: reopen,
|
|
123
|
+
text: 'Layout',
|
|
124
|
+
},
|
|
125
|
+
items: [
|
|
126
|
+
menu => {
|
|
127
|
+
const result = menu.renderItems(viewTypes);
|
|
128
|
+
if (result.length) {
|
|
129
|
+
return html ` <div style="display: flex">${result}</div>`;
|
|
130
|
+
}
|
|
131
|
+
return html ``;
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Open the menu of one view setting, anchored on `target`. `reopen` is the
|
|
139
|
+
* menus' "back" (the view settings menu). A setting the view does not offer
|
|
140
|
+
* opens nothing.
|
|
141
|
+
*/
|
|
142
|
+
export function popViewSetting(target, dataViewLogic, key, reopen, wording) {
|
|
143
|
+
if (!viewSettingAvailable(dataViewLogic, key))
|
|
144
|
+
return;
|
|
145
|
+
openViewSetting(target, dataViewLogic, key, reopen, wording);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The entries of the view settings menu: the same openers, without the
|
|
149
|
+
* availability check, since that menu decides itself which entries it draws.
|
|
150
|
+
*/
|
|
151
|
+
export function openViewSetting(target, dataViewLogic, key, reopen, wording) {
|
|
152
|
+
const view = dataViewLogic.view;
|
|
153
|
+
switch (key) {
|
|
154
|
+
case 'layout':
|
|
155
|
+
popLayout(target, dataViewLogic, reopen);
|
|
156
|
+
return;
|
|
157
|
+
case 'properties': {
|
|
158
|
+
const openPanel = view.serviceGet(PropertiesPanelOpenerKey);
|
|
159
|
+
if (openPanel) {
|
|
160
|
+
openPanel(view.id);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
popPropertiesSetting(target, { view, onBack: reopen });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
case 'group': {
|
|
167
|
+
const groupTrait = view.traitGet(groupTraitKey);
|
|
168
|
+
if (!groupTrait)
|
|
169
|
+
return;
|
|
170
|
+
if (!groupTrait.property$.value) {
|
|
171
|
+
popSelectGroupByProperty(target, groupTrait, {
|
|
172
|
+
onSelect: () => popGroupSetting(target, groupTrait, reopen, wording),
|
|
173
|
+
onBack: reopen,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
popGroupSetting(target, groupTrait, reopen, wording);
|
|
178
|
+
}
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
case 'open-in':
|
|
182
|
+
popMenu(target, {
|
|
183
|
+
options: openInOptions(dataViewLogic, reopen, wording),
|
|
184
|
+
});
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -1,16 +1,49 @@
|
|
|
1
1
|
import { type PopupTarget } from '../../../affine-components/context-menu/index.js';
|
|
2
|
+
import { type BlockStdScope } from '../../../std/index.js';
|
|
2
3
|
import { WidgetBase } from '../../core/widget/widget-base.js';
|
|
4
|
+
/** A finger-sized tab, "N more" and "+" on a phone (ADR 0035 §1, B5, B11). */
|
|
5
|
+
export declare const VIEWS_BAR_TOUCH_TARGET = 44;
|
|
6
|
+
/**
|
|
7
|
+
* The views bar of a database (ADR 0035 B11, labre PRD REQ-DB-7): one tab per
|
|
8
|
+
* view while the width allows, the rest under "N more", then "+".
|
|
9
|
+
*
|
|
10
|
+
* - The tabs are measured by `component-overflow` (`fitOverflow`): views keep
|
|
11
|
+
* their order, and the current view's tab is always drawn, in place of the
|
|
12
|
+
* last one that would have fitted, so the view you look at never hides.
|
|
13
|
+
* - "N more" lists the views without a tab; picking one draws it.
|
|
14
|
+
* - "+" is the bar's only creation entry. It pops the `AddViewMenu` the
|
|
15
|
+
* `core-database` bundle registers (sources) when there is one, the
|
|
16
|
+
* creatable presets otherwise. Readonly, or with creation switched off for
|
|
17
|
+
* the source (`ViewCreationOffKey`, ADR 0035 §5), there is no "+".
|
|
18
|
+
* - On a phone the tabs, "N more" and "+" are 44px tall, nothing else changes.
|
|
19
|
+
*
|
|
20
|
+
* Stays in core: a core-only host must reach every stored view (ADR 0035 §1).
|
|
21
|
+
*/
|
|
3
22
|
export declare class DataViewHeaderViews extends WidgetBase {
|
|
4
23
|
static styles: import("lit").CSSResult;
|
|
5
|
-
|
|
24
|
+
accessor std: BlockStdScope;
|
|
25
|
+
/** A popup renders outside the host, so wordings are resolved here. */
|
|
26
|
+
private wording;
|
|
27
|
+
/** The host switched view creation off for this source (ADR 0035 §5). */
|
|
28
|
+
private get creationOff();
|
|
29
|
+
/**
|
|
30
|
+
* The bar's "add a view of this preset", also handed to the bundle's "+"
|
|
31
|
+
* menu: the name is resolved here, at the gesture, and written as is
|
|
32
|
+
* (ADR 0023); `DatabaseViewAdded` is reported once (B17), `source` saying
|
|
33
|
+
* whether the gesture created the source the view reads.
|
|
34
|
+
*/
|
|
35
|
+
private readonly addView;
|
|
36
|
+
private presetItems;
|
|
6
37
|
_addViewMenu: (event: MouseEvent) => void;
|
|
7
|
-
_showMore: (event: MouseEvent) => void;
|
|
38
|
+
_showMore: (event: MouseEvent, hidden: readonly string[]) => void;
|
|
8
39
|
openViewOption: (target: PopupTarget, id: string) => void;
|
|
9
|
-
renderMore: (
|
|
40
|
+
renderMore: (_count: number, hiddenIndices: readonly number[]) => import("lit-html").TemplateResult<1>;
|
|
41
|
+
private moreLabel;
|
|
10
42
|
renderViews: () => (() => import("lit-html").TemplateResult<1>)[];
|
|
11
43
|
get readonly(): boolean;
|
|
12
44
|
private getRenderer;
|
|
13
45
|
private clickView;
|
|
46
|
+
connectedCallback(): void;
|
|
14
47
|
render(): import("lit-html").TemplateResult<1>;
|
|
15
48
|
accessor onChangeView: ((id: string) => void) | undefined;
|
|
16
49
|
}
|