@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
|
@@ -0,0 +1,266 @@
|
|
|
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
|
+
};
|
|
35
|
+
import { popFilterableSimpleMenu, popupTargetFromElement, } from '../../../affine-components/context-menu/index.js';
|
|
36
|
+
import { translateKey } from '../../../affine-shared/services/index.js';
|
|
37
|
+
import { OPEN_LABEL } from '../../../affine-components/translations.js';
|
|
38
|
+
import { CenterPeekIcon } from '@blocksuite/icons/lit';
|
|
39
|
+
import { stdContext } from '../../../std/index.js';
|
|
40
|
+
import { consume } from '@lit/context';
|
|
41
|
+
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
42
|
+
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
43
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
44
|
+
import { renderCellStatus } from '../../core/component/cell-status/cell-status.js';
|
|
45
|
+
import { GroupTitle } from '../../core/group-by/group-title.js';
|
|
46
|
+
import { hideGroupAction, renderGroupToggle, } from '../../core/group-by/group-visibility.js';
|
|
47
|
+
import { isNewTabClick } from '../../core/utils/new-tab-click.js';
|
|
48
|
+
import { renderUniLit } from '../../core/utils/uni-component/uni-component.js';
|
|
49
|
+
import { DataViewUIBase, DataViewUILogicBase, } from '../../core/view/data-view-base.js';
|
|
50
|
+
/**
|
|
51
|
+
* The UI logic both ungrouped presets share. Neither has a selection model of
|
|
52
|
+
* its own: a cell edits through the cell host (`dv-standalone-cell`), with the
|
|
53
|
+
* very renderer and popups a table cell mounts, and a click anywhere else on
|
|
54
|
+
* a card or a row opens the row through the root's detail panel, the path
|
|
55
|
+
* the table's and the kanban's open buttons take. Grouped (B8), each group
|
|
56
|
+
* draws under the table's group header; drag and drop of rows between groups
|
|
57
|
+
* is not offered: a row changes group by editing its value.
|
|
58
|
+
*/
|
|
59
|
+
export class FlatViewUILogic extends DataViewUILogicBase {
|
|
60
|
+
constructor() {
|
|
61
|
+
super(...arguments);
|
|
62
|
+
this.clearSelection = () => { };
|
|
63
|
+
this.focusFirstCell = () => { };
|
|
64
|
+
this.showIndicator = (_evt) => false;
|
|
65
|
+
this.hideIndicator = () => { };
|
|
66
|
+
this.moveTo = (_id, _evt) => { };
|
|
67
|
+
this.addRow = (position, groupKey) => {
|
|
68
|
+
if (this.view.readonly$.value)
|
|
69
|
+
return;
|
|
70
|
+
const rowId = this.view.rowAdd(position, groupKey);
|
|
71
|
+
if (rowId)
|
|
72
|
+
this.openRow(rowId);
|
|
73
|
+
return rowId;
|
|
74
|
+
};
|
|
75
|
+
/** A Ctrl/Cmd click asks the host for a new tab (ADR 0035 §9a). */
|
|
76
|
+
this.openRow = (rowId, newTab = false) => {
|
|
77
|
+
this.root.openDetailPanel({ view: this.view, rowId, newTab });
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let FlatViewUI = (() => {
|
|
82
|
+
let _classSuper = DataViewUIBase;
|
|
83
|
+
let _std_decorators;
|
|
84
|
+
let _std_initializers = [];
|
|
85
|
+
let _std_extraInitializers = [];
|
|
86
|
+
return class FlatViewUI extends _classSuper {
|
|
87
|
+
constructor() {
|
|
88
|
+
super(...arguments);
|
|
89
|
+
this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
|
|
90
|
+
this.onRowClick = (__runInitializers(this, _std_extraInitializers), (event) => {
|
|
91
|
+
const rowId = event.currentTarget.dataset.rowId;
|
|
92
|
+
if (rowId)
|
|
93
|
+
this.logic.openRow(rowId, isNewTabClick(event));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
static {
|
|
97
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
98
|
+
_std_decorators = [consume({ context: stdContext })];
|
|
99
|
+
__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);
|
|
100
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
101
|
+
}
|
|
102
|
+
#std_accessor_storage;
|
|
103
|
+
/** Absent outside an editor (a unit test): the wordings read English. */
|
|
104
|
+
get std() { return this.#std_accessor_storage; }
|
|
105
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
106
|
+
wording([key, fallback]) {
|
|
107
|
+
return this.std ? translateKey(this.std, key, fallback) : fallback;
|
|
108
|
+
}
|
|
109
|
+
get view() {
|
|
110
|
+
return this.logic.view;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* One property's value, drawn and edited by the cell renderer a table cell
|
|
114
|
+
* mounts. `readonly` draws the value only and lets a click through to the
|
|
115
|
+
* card or row, which is how the title opens its row.
|
|
116
|
+
*/
|
|
117
|
+
renderCell(property, rowId, readonly = false) {
|
|
118
|
+
const view = this.view;
|
|
119
|
+
const cell = property.cellGetOrCreate(rowId);
|
|
120
|
+
// As a table cell: a value not yet hydrated mounts no renderer, so nothing
|
|
121
|
+
// can be edited over it (ADR 0035 §9e).
|
|
122
|
+
const status = renderCellStatus(cell);
|
|
123
|
+
if (status) {
|
|
124
|
+
return html `<span data-property-id="${property.id}">${status}</span>`;
|
|
125
|
+
}
|
|
126
|
+
return html `<dv-standalone-cell
|
|
127
|
+
data-property-id="${property.id}"
|
|
128
|
+
.cell="${cell}"
|
|
129
|
+
.readonly="${readonly ||
|
|
130
|
+
view.readonly$.value ||
|
|
131
|
+
property.readonly$.value}"
|
|
132
|
+
.onEditingChange="${(editing) => view.lockRows(editing)}"
|
|
133
|
+
></dv-standalone-cell>`;
|
|
134
|
+
}
|
|
135
|
+
renderOpenButton(rowId) {
|
|
136
|
+
const label = this.wording(OPEN_LABEL);
|
|
137
|
+
return html `<button
|
|
138
|
+
class="dv-flat-open"
|
|
139
|
+
data-testid="dv-flat-open"
|
|
140
|
+
aria-label="${label}"
|
|
141
|
+
title="${label}"
|
|
142
|
+
@click="${(event) => {
|
|
143
|
+
event.stopPropagation();
|
|
144
|
+
this.logic.openRow(rowId, isNewTabClick(event));
|
|
145
|
+
}}"
|
|
146
|
+
>
|
|
147
|
+
${CenterPeekIcon()}
|
|
148
|
+
</button>`;
|
|
149
|
+
}
|
|
150
|
+
renderHeaderWidget() {
|
|
151
|
+
const headerWidget = this.logic.headerWidget;
|
|
152
|
+
if (!headerWidget)
|
|
153
|
+
return nothing;
|
|
154
|
+
return renderUniLit(headerWidget, { dataViewLogic: this.logic });
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The view's rows through `renderBody`: once, or once per visible group
|
|
158
|
+
* under its header, then the hidden groups (B8, PRD REQ-DB-13 and 16). A
|
|
159
|
+
* folded group keeps its header only.
|
|
160
|
+
*/
|
|
161
|
+
renderGrouped(renderBody) {
|
|
162
|
+
const trait = this.view.groupTrait;
|
|
163
|
+
const groups = trait.visibleGroups$.value;
|
|
164
|
+
if (!groups)
|
|
165
|
+
return renderBody(this.view.rows$.value);
|
|
166
|
+
return html `${repeat(groups, group => group.key, group => this.renderGroup(group, renderBody))} <dv-hidden-groups .groupTrait="${trait}"></dv-hidden-groups>`;
|
|
167
|
+
}
|
|
168
|
+
renderGroup(group, renderBody) {
|
|
169
|
+
const collapsed = group.manager.collapsed$(group.key).value;
|
|
170
|
+
const wording = (pair) => this.wording(pair);
|
|
171
|
+
return html `<section
|
|
172
|
+
class="dv-flat-group"
|
|
173
|
+
data-testid="dv-flat-group"
|
|
174
|
+
data-group-key="${group.key}"
|
|
175
|
+
>
|
|
176
|
+
<div class="dv-flat-group-header">
|
|
177
|
+
${renderGroupToggle(group, wording)}
|
|
178
|
+
<div class="dv-flat-group-title">
|
|
179
|
+
${GroupTitle(group, {
|
|
180
|
+
readonly: this.view.readonly$.value,
|
|
181
|
+
clickAdd: () => this.logic.addRow('start', group.key),
|
|
182
|
+
clickOps: (event) => {
|
|
183
|
+
popFilterableSimpleMenu(popupTargetFromElement(event.currentTarget), [hideGroupAction(group, wording)]);
|
|
184
|
+
},
|
|
185
|
+
})}
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
${collapsed ? nothing : renderBody(group.rows, group)}
|
|
189
|
+
</section>`;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
})();
|
|
193
|
+
export { FlatViewUI };
|
|
194
|
+
/** The group header both presets draw, the table's title and count. */
|
|
195
|
+
export const flatGroupStyles = css `
|
|
196
|
+
.dv-flat-group {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
padding-top: 8px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.dv-flat-group-header {
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
gap: 4px;
|
|
206
|
+
min-height: 32px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.dv-flat-group-title {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex: 1 1 auto;
|
|
212
|
+
align-items: center;
|
|
213
|
+
gap: 8px;
|
|
214
|
+
min-width: 0;
|
|
215
|
+
overflow: hidden;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.dv-flat-group-header:hover .group-header-op,
|
|
219
|
+
.dv-flat-group-header:focus-within .group-header-op {
|
|
220
|
+
visibility: visible;
|
|
221
|
+
opacity: 1;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@media (pointer: coarse) {
|
|
225
|
+
.dv-flat-group-header {
|
|
226
|
+
min-height: 44px;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
`;
|
|
230
|
+
/** The open button both presets draw, shown on hover or keyboard focus. */
|
|
231
|
+
export const flatOpenButtonStyles = css `
|
|
232
|
+
.dv-flat-open {
|
|
233
|
+
position: absolute;
|
|
234
|
+
top: 6px;
|
|
235
|
+
right: 6px;
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
justify-content: center;
|
|
239
|
+
width: 24px;
|
|
240
|
+
height: 24px;
|
|
241
|
+
padding: 0;
|
|
242
|
+
border: 1px solid ${unsafeCSS(cssVarV2.layer.insideBorder.border)};
|
|
243
|
+
border-radius: 4px;
|
|
244
|
+
background-color: var(--affine-background-primary-color);
|
|
245
|
+
color: var(--affine-icon-color);
|
|
246
|
+
cursor: pointer;
|
|
247
|
+
visibility: hidden;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.dv-flat-open svg {
|
|
251
|
+
width: 16px;
|
|
252
|
+
height: 16px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.dv-flat-open:focus-visible {
|
|
256
|
+
visibility: visible;
|
|
257
|
+
outline: 2px solid var(--affine-primary-color);
|
|
258
|
+
outline-offset: 1px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@media (hover: hover) {
|
|
262
|
+
.dv-flat-open:hover {
|
|
263
|
+
background-color: var(--affine-hover-color);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlatSingleView, type FlatViewDataType } from '../flat/flat-view-manager.js';
|
|
2
|
+
export declare const galleryViewType: {
|
|
3
|
+
type: "gallery";
|
|
4
|
+
createModel: <Data extends import("../../index.js").DataViewDataType>(model: import("../../index.js").DataViewModelConfig<Data>) => import("../../index.js").DataViewModel<"gallery", Data> & {
|
|
5
|
+
createMeta: (renderer: import("../../index.js").DataViewRendererConfig) => import("../../index.js").ViewMeta<"gallery", Data>;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export type GalleryViewData = FlatViewDataType<typeof galleryViewType.type>;
|
|
9
|
+
export declare class GallerySingleView extends FlatSingleView<GalleryViewData> {
|
|
10
|
+
get type(): string;
|
|
11
|
+
}
|
|
12
|
+
export declare const galleryViewModel: import("../../index.js").DataViewModel<"gallery", GalleryViewData> & {
|
|
13
|
+
createMeta: (renderer: import("../../index.js").DataViewRendererConfig) => import("../../index.js").ViewMeta<"gallery", GalleryViewData>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { viewType } from '../../core/view/data-view.js';
|
|
2
|
+
import { VIEW_NAME_GALLERY } from '../../translations.js';
|
|
3
|
+
import { FlatSingleView, flatViewDefaultData, } from '../flat/flat-view-manager.js';
|
|
4
|
+
export const galleryViewType = viewType('gallery');
|
|
5
|
+
export class GallerySingleView extends FlatSingleView {
|
|
6
|
+
get type() {
|
|
7
|
+
return this.data$.value?.mode ?? galleryViewType.type;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export const galleryViewModel = galleryViewType.createModel({
|
|
11
|
+
defaultName: VIEW_NAME_GALLERY[1],
|
|
12
|
+
defaultNameKey: VIEW_NAME_GALLERY[0],
|
|
13
|
+
dataViewManager: GallerySingleView,
|
|
14
|
+
defaultData: flatViewDefaultData,
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function galleryEffects(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FlatViewUI, FlatViewUILogic } from '../flat/flat-view-ui.js';
|
|
2
|
+
import type { GallerySingleView } from './define.js';
|
|
3
|
+
/**
|
|
4
|
+
* The gallery preset (ADR 0035 §1, B6): one card per row, its title then its
|
|
5
|
+
* visible properties, each drawn by the cell a table draws. A card is a
|
|
6
|
+
* kanban card out of its column, flat as every document surface is (DESIGN.md,
|
|
7
|
+
* the Flat-Page Rule): a hairline, no shadow.
|
|
8
|
+
*
|
|
9
|
+
* ponytail: no cover image on the card. The product asks for none in v2.0
|
|
10
|
+
* (PRD REQ-DB-1 to 16); the upgrade is a stored `header.coverColumn`, as the
|
|
11
|
+
* kanban's, drawn above the title with the image property's renderer.
|
|
12
|
+
*/
|
|
13
|
+
export declare class GalleryViewUILogic extends FlatViewUILogic<GallerySingleView> {
|
|
14
|
+
renderer: import("../../../affine-shared/types/uni-component.js").UniComponent<unknown, {}>;
|
|
15
|
+
}
|
|
16
|
+
export declare class GalleryViewUI extends FlatViewUI<GalleryViewUILogic> {
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
private renderCard;
|
|
20
|
+
private renderNewCard;
|
|
21
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
'dv-gallery-view-ui': GalleryViewUI;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { PlusIcon } from '@blocksuite/icons/lit';
|
|
2
|
+
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
3
|
+
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
4
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
5
|
+
import { groupToggleStyles } from '../../core/group-by/group-visibility.js';
|
|
6
|
+
import { createUniComponentFromWebComponent } from '../../core/utils/uni-component/uni-component.js';
|
|
7
|
+
import { DATA_VIEW_NEW_PAGE } from '../../translations.js';
|
|
8
|
+
import { flatGroupStyles, flatOpenButtonStyles, FlatViewUI, FlatViewUILogic, } from '../flat/flat-view-ui.js';
|
|
9
|
+
/**
|
|
10
|
+
* The gallery preset (ADR 0035 §1, B6): one card per row, its title then its
|
|
11
|
+
* visible properties, each drawn by the cell a table draws. A card is a
|
|
12
|
+
* kanban card out of its column, flat as every document surface is (DESIGN.md,
|
|
13
|
+
* the Flat-Page Rule): a hairline, no shadow.
|
|
14
|
+
*
|
|
15
|
+
* ponytail: no cover image on the card. The product asks for none in v2.0
|
|
16
|
+
* (PRD REQ-DB-1 to 16); the upgrade is a stored `header.coverColumn`, as the
|
|
17
|
+
* kanban's, drawn above the title with the image property's renderer.
|
|
18
|
+
*/
|
|
19
|
+
export class GalleryViewUILogic extends FlatViewUILogic {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.renderer = createUniComponentFromWebComponent(GalleryViewUI);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class GalleryViewUI extends FlatViewUI {
|
|
26
|
+
static { this.styles = [
|
|
27
|
+
flatOpenButtonStyles,
|
|
28
|
+
flatGroupStyles,
|
|
29
|
+
groupToggleStyles,
|
|
30
|
+
css `
|
|
31
|
+
dv-gallery-view-ui {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dv-gallery {
|
|
36
|
+
display: grid;
|
|
37
|
+
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
38
|
+
gap: 12px;
|
|
39
|
+
padding: 4px 0 8px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dv-gallery-card {
|
|
43
|
+
position: relative;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: 2px;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
min-height: 72px;
|
|
49
|
+
padding: 8px;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
border: 1px solid ${unsafeCSS(cssVarV2.layer.insideBorder.border)};
|
|
52
|
+
border-radius: 8px;
|
|
53
|
+
background-color: var(--affine-background-primary-color);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dv-gallery-card-title {
|
|
58
|
+
padding: 2px 32px 4px 4px;
|
|
59
|
+
font-weight: 500;
|
|
60
|
+
font-size: var(--data-view-cell-text-size);
|
|
61
|
+
line-height: var(--data-view-cell-text-line-height);
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.dv-gallery-card-property {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: 8px;
|
|
69
|
+
min-height: 28px;
|
|
70
|
+
padding: 0 4px;
|
|
71
|
+
border-radius: 4px;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.dv-gallery-card-property-icon {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
color: var(--affine-icon-color);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dv-gallery-card-property-icon svg {
|
|
82
|
+
width: 16px;
|
|
83
|
+
height: 16px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.dv-gallery-card-property dv-standalone-cell {
|
|
87
|
+
flex: 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dv-gallery-card:focus-within .dv-flat-open {
|
|
91
|
+
visibility: visible;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.dv-gallery-new {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
gap: 4px;
|
|
99
|
+
min-height: 72px;
|
|
100
|
+
border: 1px dashed ${unsafeCSS(cssVarV2.layer.insideBorder.border)};
|
|
101
|
+
border-radius: 8px;
|
|
102
|
+
background: transparent;
|
|
103
|
+
color: var(--affine-text-secondary-color);
|
|
104
|
+
font-family: inherit;
|
|
105
|
+
font-size: var(--data-view-cell-text-size);
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.dv-gallery-new svg {
|
|
110
|
+
width: 16px;
|
|
111
|
+
height: 16px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@media (hover: hover) {
|
|
115
|
+
.dv-gallery-card:hover,
|
|
116
|
+
.dv-gallery-new:hover,
|
|
117
|
+
.dv-gallery-card-property:hover {
|
|
118
|
+
background-color: var(--affine-hover-color);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.dv-gallery-card:hover .dv-flat-open {
|
|
122
|
+
visibility: visible;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (pointer: coarse) {
|
|
127
|
+
.dv-gallery-card-property {
|
|
128
|
+
min-height: 44px;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`,
|
|
132
|
+
]; }
|
|
133
|
+
connectedCallback() {
|
|
134
|
+
super.connectedCallback();
|
|
135
|
+
this.dataset.testid = 'dv-gallery-view';
|
|
136
|
+
}
|
|
137
|
+
renderCard(rowId) {
|
|
138
|
+
const view = this.view;
|
|
139
|
+
const title = view.titleProperty$.value;
|
|
140
|
+
return html `<div
|
|
141
|
+
class="dv-gallery-card"
|
|
142
|
+
data-testid="dv-gallery-card"
|
|
143
|
+
data-row-id="${rowId}"
|
|
144
|
+
@click="${this.onRowClick}"
|
|
145
|
+
>
|
|
146
|
+
${title
|
|
147
|
+
? html `<div class="dv-gallery-card-title">
|
|
148
|
+
${this.renderCell(title, rowId, true)}
|
|
149
|
+
</div>`
|
|
150
|
+
: nothing}
|
|
151
|
+
${repeat(view.bodyProperties$.value, property => property.id, property => html `<div class="dv-gallery-card-property">
|
|
152
|
+
<uni-lit
|
|
153
|
+
class="dv-gallery-card-property-icon"
|
|
154
|
+
.uni="${property.icon}"
|
|
155
|
+
></uni-lit>
|
|
156
|
+
${this.renderCell(property, rowId)}
|
|
157
|
+
</div>`)}
|
|
158
|
+
${this.renderOpenButton(rowId)}
|
|
159
|
+
</div>`;
|
|
160
|
+
}
|
|
161
|
+
renderNewCard(groupKey) {
|
|
162
|
+
if (this.view.readonly$.value)
|
|
163
|
+
return nothing;
|
|
164
|
+
return html `<button
|
|
165
|
+
class="dv-gallery-new"
|
|
166
|
+
data-testid="dv-flat-new"
|
|
167
|
+
@click="${() => this.logic.addRow('end', groupKey)}"
|
|
168
|
+
>
|
|
169
|
+
${PlusIcon()}<span>${this.wording(DATA_VIEW_NEW_PAGE)}</span>
|
|
170
|
+
</button>`;
|
|
171
|
+
}
|
|
172
|
+
render() {
|
|
173
|
+
return html `${this.renderHeaderWidget()}
|
|
174
|
+
${this.renderGrouped((rows, group) => html `<div class="dv-gallery">
|
|
175
|
+
${repeat(rows, row => row.rowId, row => this.renderCard(row.rowId))}
|
|
176
|
+
${this.renderNewCard(group?.key)}
|
|
177
|
+
</div>`)}`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const galleryViewMeta: import("../../index.js").ViewMeta<"gallery", import("./define.js").GalleryViewData>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createIcon } from '../../core/utils/uni-icon.js';
|
|
2
|
+
import { galleryViewModel } from './define.js';
|
|
3
|
+
import { GalleryViewUILogic } from './gallery-view.js';
|
|
4
|
+
// One UI for both: the cards reflow, and a tap opens the row or edits a value.
|
|
5
|
+
export const galleryViewMeta = galleryViewModel.createMeta({
|
|
6
|
+
icon: createIcon('GridIcon'),
|
|
7
|
+
pcLogic: () => GalleryViewUILogic,
|
|
8
|
+
// Named, not left to the pc fallback: a touch screen draws this UI on
|
|
9
|
+
// purpose (B5, `mobile-editing.unit.spec.ts`).
|
|
10
|
+
mobileLogic: () => GalleryViewUILogic,
|
|
11
|
+
});
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export * from './calendar/index.js';
|
|
2
2
|
export * from './convert.js';
|
|
3
|
+
export * from './flat/flat-view-manager.js';
|
|
4
|
+
export * from './gallery/index.js';
|
|
3
5
|
export * from './kanban/index.js';
|
|
6
|
+
export * from './list/index.js';
|
|
4
7
|
export * from './table/index.js';
|
|
5
8
|
export declare const viewPresets: {
|
|
6
9
|
tableViewMeta: import("../index.js").ViewMeta<"table", import("./index.js").TableViewData>;
|
|
7
10
|
kanbanViewMeta: import("../index.js").ViewMeta<"kanban", import("./index.js").KanbanViewData>;
|
|
8
11
|
calendarViewMeta: import("../index.js").ViewMeta<"calendar", import("./index.js").CalendarViewData>;
|
|
12
|
+
galleryViewMeta: import("../index.js").ViewMeta<"gallery", import("./index.js").GalleryViewData>;
|
|
13
|
+
listViewMeta: import("../index.js").ViewMeta<"list", import("./index.js").ListViewData>;
|
|
9
14
|
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { calendarViewMeta } from './calendar/index.js';
|
|
2
|
+
import { galleryViewMeta } from './gallery/index.js';
|
|
2
3
|
import { kanbanViewMeta } from './kanban/index.js';
|
|
4
|
+
import { listViewMeta } from './list/index.js';
|
|
3
5
|
import { tableViewMeta } from './table/index.js';
|
|
4
6
|
export * from './calendar/index.js';
|
|
5
7
|
export * from './convert.js';
|
|
8
|
+
export * from './flat/flat-view-manager.js';
|
|
9
|
+
export * from './gallery/index.js';
|
|
6
10
|
export * from './kanban/index.js';
|
|
11
|
+
export * from './list/index.js';
|
|
7
12
|
export * from './table/index.js';
|
|
8
13
|
export const viewPresets = {
|
|
9
14
|
tableViewMeta: tableViewMeta,
|
|
10
15
|
kanbanViewMeta: kanbanViewMeta,
|
|
11
16
|
calendarViewMeta: calendarViewMeta,
|
|
17
|
+
galleryViewMeta: galleryViewMeta,
|
|
18
|
+
listViewMeta: listViewMeta,
|
|
12
19
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { BlockSuiteError, ErrorCode } from '../../../global/exceptions/index.js';
|
|
2
2
|
import { defaultGroupBy, getGroupByService, t } from '../../core/index.js';
|
|
3
3
|
import { viewType } from '../../core/view/data-view.js';
|
|
4
|
+
import { VIEW_NAME_KANBAN } from '../../translations.js';
|
|
4
5
|
import { KanbanSingleView } from './kanban-view-manager.js';
|
|
5
6
|
export const kanbanViewType = viewType('kanban');
|
|
6
7
|
export const kanbanViewModel = kanbanViewType.createModel({
|
|
7
|
-
defaultName:
|
|
8
|
+
defaultName: VIEW_NAME_KANBAN[1],
|
|
9
|
+
defaultNameKey: VIEW_NAME_KANBAN[0],
|
|
8
10
|
dataViewManager: KanbanSingleView,
|
|
9
11
|
defaultData: viewManager => {
|
|
10
12
|
const groupByService = getGroupByService(viewManager.dataSource);
|
|
@@ -4,7 +4,8 @@ import { evalFilter } from '../../core/filter/eval.js';
|
|
|
4
4
|
import { generateDefaultValues } from '../../core/filter/generate-default-values.js';
|
|
5
5
|
import { FilterTrait, filterTraitKey } from '../../core/filter/trait.js';
|
|
6
6
|
import { emptyFilterGroup } from '../../core/filter/utils.js';
|
|
7
|
-
import {
|
|
7
|
+
import { groupPropertiesOps } from '../../core/group-by/group-properties.js';
|
|
8
|
+
import { GroupTrait, groupTraitKey } from '../../core/group-by/trait.js';
|
|
8
9
|
import { fromJson } from '../../core/property/utils.js';
|
|
9
10
|
import { PropertyBase } from '../../core/view-manager/property.js';
|
|
10
11
|
import { SingleViewBase } from '../../core/view-manager/single-view.js';
|
|
@@ -52,58 +53,9 @@ export class KanbanSingleView extends SingleViewBase {
|
|
|
52
53
|
};
|
|
53
54
|
});
|
|
54
55
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return sortByManually(rows, v => v.rowId, property?.manuallyCardSort ?? []);
|
|
59
|
-
},
|
|
60
|
-
changeGroupSort: keys => {
|
|
61
|
-
const map = new Map(this.view?.groupProperties.map(v => [v.key, v]));
|
|
62
|
-
this.dataUpdate(() => {
|
|
63
|
-
return {
|
|
64
|
-
groupProperties: keys.map(key => {
|
|
65
|
-
const property = map.get(key);
|
|
66
|
-
if (property) {
|
|
67
|
-
return property;
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
key,
|
|
71
|
-
hide: false,
|
|
72
|
-
manuallyCardSort: [],
|
|
73
|
-
};
|
|
74
|
-
}),
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
changeRowSort: (groupKeys, groupKey, keys) => {
|
|
79
|
-
const map = new Map(this.view?.groupProperties.map(v => [v.key, v]));
|
|
80
|
-
this.dataUpdate(() => {
|
|
81
|
-
return {
|
|
82
|
-
groupProperties: groupKeys.map(key => {
|
|
83
|
-
if (key === groupKey) {
|
|
84
|
-
const group = map.get(key);
|
|
85
|
-
return group
|
|
86
|
-
? {
|
|
87
|
-
...group,
|
|
88
|
-
manuallyCardSort: keys,
|
|
89
|
-
}
|
|
90
|
-
: {
|
|
91
|
-
key,
|
|
92
|
-
hide: false,
|
|
93
|
-
manuallyCardSort: keys,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
return (map.get(key) ?? {
|
|
98
|
-
key,
|
|
99
|
-
hide: false,
|
|
100
|
-
manuallyCardSort: [],
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}),
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
},
|
|
56
|
+
...groupPropertiesOps(() => this.view?.groupProperties ?? [], groupProperties => {
|
|
57
|
+
this.dataUpdate(() => ({ groupProperties }));
|
|
58
|
+
}),
|
|
107
59
|
}));
|
|
108
60
|
this.mainProperties$ = computed(() => {
|
|
109
61
|
return (this.data$.value?.header ?? {
|