@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,194 @@
|
|
|
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 list preset (ADR 0035 §1, B7): one line per row, the title on the left
|
|
11
|
+
* and the visible properties on the right, each drawn by the cell a table
|
|
12
|
+
* draws, so a select is the table's tag and opens the table's tag menu. An
|
|
13
|
+
* empty value draws no chip, as in Notion's list: it is set from the opened
|
|
14
|
+
* row. Narrow screens wrap the chips under the title.
|
|
15
|
+
*/
|
|
16
|
+
export class ListViewUILogic extends FlatViewUILogic {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.renderer = createUniComponentFromWebComponent(ListViewUI);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export class ListViewUI extends FlatViewUI {
|
|
23
|
+
static { this.styles = [
|
|
24
|
+
flatOpenButtonStyles,
|
|
25
|
+
flatGroupStyles,
|
|
26
|
+
groupToggleStyles,
|
|
27
|
+
css `
|
|
28
|
+
dv-list-view-ui {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.dv-list {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
padding: 4px 0 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dv-list-row {
|
|
39
|
+
position: relative;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 8px;
|
|
43
|
+
min-height: 36px;
|
|
44
|
+
padding: 2px 40px 2px 8px;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
border-bottom: 1px solid
|
|
47
|
+
${unsafeCSS(cssVarV2.layer.insideBorder.border)};
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dv-list-row-title {
|
|
52
|
+
flex: 1 1 auto;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
font-size: var(--data-view-cell-text-size);
|
|
56
|
+
line-height: var(--data-view-cell-text-line-height);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.dv-list-row-properties {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex: 0 1 auto;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: flex-end;
|
|
64
|
+
gap: 8px;
|
|
65
|
+
min-width: 0;
|
|
66
|
+
max-width: 60%;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.dv-list-row-property {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
flex: 0 1 auto;
|
|
74
|
+
min-width: 0;
|
|
75
|
+
max-width: 200px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dv-list-row .dv-flat-open {
|
|
80
|
+
top: 50%;
|
|
81
|
+
transform: translateY(-50%);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.dv-list-row:focus-within .dv-flat-open {
|
|
85
|
+
visibility: visible;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dv-list-new {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
gap: 4px;
|
|
92
|
+
min-height: 36px;
|
|
93
|
+
padding: 0 8px;
|
|
94
|
+
border: none;
|
|
95
|
+
background: transparent;
|
|
96
|
+
color: var(--affine-text-secondary-color);
|
|
97
|
+
font-family: inherit;
|
|
98
|
+
font-size: var(--data-view-cell-text-size);
|
|
99
|
+
text-align: start;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.dv-list-new svg {
|
|
104
|
+
width: 16px;
|
|
105
|
+
height: 16px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media (hover: hover) {
|
|
109
|
+
.dv-list-row:hover,
|
|
110
|
+
.dv-list-new:hover {
|
|
111
|
+
background-color: var(--affine-hover-color);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.dv-list-row:hover .dv-flat-open {
|
|
115
|
+
visibility: visible;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@media (pointer: coarse) {
|
|
120
|
+
.dv-list-row,
|
|
121
|
+
.dv-list-new {
|
|
122
|
+
min-height: 44px;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (max-width: 640px) {
|
|
127
|
+
.dv-list-row {
|
|
128
|
+
flex-wrap: wrap;
|
|
129
|
+
padding-top: 6px;
|
|
130
|
+
padding-bottom: 6px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.dv-list-row-title {
|
|
134
|
+
flex-basis: 100%;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.dv-list-row-properties {
|
|
138
|
+
flex-wrap: wrap;
|
|
139
|
+
justify-content: flex-start;
|
|
140
|
+
max-width: 100%;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`,
|
|
144
|
+
]; }
|
|
145
|
+
connectedCallback() {
|
|
146
|
+
super.connectedCallback();
|
|
147
|
+
this.dataset.testid = 'dv-list-view';
|
|
148
|
+
}
|
|
149
|
+
renderRow(rowId) {
|
|
150
|
+
const view = this.view;
|
|
151
|
+
const title = view.titleProperty$.value;
|
|
152
|
+
// A value still loading keeps its chip, as a skeleton.
|
|
153
|
+
const chips = view.bodyProperties$.value.filter(property => {
|
|
154
|
+
const cell = property.cellGetOrCreate(rowId);
|
|
155
|
+
return cell.status$?.value === 'pending' || !cell.isEmpty$.value;
|
|
156
|
+
});
|
|
157
|
+
return html `<div
|
|
158
|
+
class="dv-list-row"
|
|
159
|
+
data-testid="dv-list-row"
|
|
160
|
+
data-row-id="${rowId}"
|
|
161
|
+
@click="${this.onRowClick}"
|
|
162
|
+
>
|
|
163
|
+
<div class="dv-list-row-title">
|
|
164
|
+
${title ? this.renderCell(title, rowId, true) : nothing}
|
|
165
|
+
</div>
|
|
166
|
+
${chips.length
|
|
167
|
+
? html `<div class="dv-list-row-properties">
|
|
168
|
+
${repeat(chips, property => property.id, property => html `<div class="dv-list-row-property">
|
|
169
|
+
${this.renderCell(property, rowId)}
|
|
170
|
+
</div>`)}
|
|
171
|
+
</div>`
|
|
172
|
+
: nothing}
|
|
173
|
+
${this.renderOpenButton(rowId)}
|
|
174
|
+
</div>`;
|
|
175
|
+
}
|
|
176
|
+
renderNewRow(groupKey) {
|
|
177
|
+
if (this.view.readonly$.value)
|
|
178
|
+
return nothing;
|
|
179
|
+
return html `<button
|
|
180
|
+
class="dv-list-new"
|
|
181
|
+
data-testid="dv-flat-new"
|
|
182
|
+
@click="${() => this.logic.addRow('end', groupKey)}"
|
|
183
|
+
>
|
|
184
|
+
${PlusIcon()}<span>${this.wording(DATA_VIEW_NEW_PAGE)}</span>
|
|
185
|
+
</button>`;
|
|
186
|
+
}
|
|
187
|
+
render() {
|
|
188
|
+
return html `${this.renderHeaderWidget()}
|
|
189
|
+
${this.renderGrouped((rows, group) => html `<div class="dv-list">
|
|
190
|
+
${repeat(rows, row => row.rowId, row => this.renderRow(row.rowId))}
|
|
191
|
+
${this.renderNewRow(group?.key)}
|
|
192
|
+
</div>`)}`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listViewMeta: import("../../index.js").ViewMeta<"list", import("./define.js").ListViewData>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createIcon } from '../../core/utils/uni-icon.js';
|
|
2
|
+
import { listViewModel } from './define.js';
|
|
3
|
+
import { ListViewUILogic } from './list-view.js';
|
|
4
|
+
// One UI for both: the chips wrap under the title on a narrow screen.
|
|
5
|
+
export const listViewMeta = listViewModel.createMeta({
|
|
6
|
+
icon: createIcon('DatabaseListViewIcon'),
|
|
7
|
+
pcLogic: () => ListViewUILogic,
|
|
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: () => ListViewUILogic,
|
|
11
|
+
});
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Gets the collapsed state for a specific table group from sessionStorage.
|
|
7
|
-
* @param viewId - The ID of the table view
|
|
8
|
-
* @param groupKey - The key of the group
|
|
9
|
-
* @returns The collapsed state as a boolean, or false if not found or invalid
|
|
2
|
+
* The table's two entry points into the shared, per-device group fold
|
|
3
|
+
* (`core/group-by/collapsed-state.ts`, ADR 0035 B8), kept so the pc and
|
|
4
|
+
* mobile table groups read and write it as before.
|
|
10
5
|
*/
|
|
11
6
|
export declare function getCollapsedState(viewId: string, groupKey: string): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Sets the collapsed state for a specific table group in sessionStorage.
|
|
14
|
-
* @param viewId - The ID of the table view
|
|
15
|
-
* @param groupKey - The key of the group
|
|
16
|
-
* @param collapsed - The collapsed state to store
|
|
17
|
-
*/
|
|
18
7
|
export declare function setCollapsedState(viewId: string, groupKey: string, collapsed: boolean): void;
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
+
import { groupCollapsed$, groupCollapsedSet, } from '../../core/group-by/collapsed-state.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Gets the collapsed state for a specific table group from sessionStorage.
|
|
7
|
-
* @param viewId - The ID of the table view
|
|
8
|
-
* @param groupKey - The key of the group
|
|
9
|
-
* @returns The collapsed state as a boolean, or false if not found or invalid
|
|
3
|
+
* The table's two entry points into the shared, per-device group fold
|
|
4
|
+
* (`core/group-by/collapsed-state.ts`, ADR 0035 B8), kept so the pc and
|
|
5
|
+
* mobile table groups read and write it as before.
|
|
10
6
|
*/
|
|
11
7
|
export function getCollapsedState(viewId, groupKey) {
|
|
12
|
-
|
|
13
|
-
const value = sessionStorage.getItem(`affine:table-group:${viewId}:${groupKey}:collapsed`);
|
|
14
|
-
if (!value)
|
|
15
|
-
return false;
|
|
16
|
-
const parsed = JSON.parse(value);
|
|
17
|
-
return typeof parsed === 'boolean' ? parsed : false;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
8
|
+
return groupCollapsed$(viewId, groupKey).peek();
|
|
22
9
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Sets the collapsed state for a specific table group in sessionStorage.
|
|
25
|
-
* @param viewId - The ID of the table view
|
|
26
|
-
* @param groupKey - The key of the group
|
|
27
|
-
* @param collapsed - The collapsed state to store
|
|
28
|
-
*/
|
|
29
10
|
export function setCollapsedState(viewId, groupKey, collapsed) {
|
|
30
|
-
|
|
31
|
-
sessionStorage.setItem(`affine:table-group:${viewId}:${groupKey}:collapsed`, JSON.stringify(collapsed));
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// ignore
|
|
35
|
-
}
|
|
11
|
+
groupCollapsedSet(viewId, groupKey, collapsed);
|
|
36
12
|
}
|
|
@@ -4,6 +4,8 @@ export declare const DEFAULT_COLUMN_WIDTH = 180;
|
|
|
4
4
|
export declare const DEFAULT_COLUMN_MIN_WIDTH = 100;
|
|
5
5
|
/** column title height */
|
|
6
6
|
export declare const DEFAULT_COLUMN_TITLE_HEIGHT = 34;
|
|
7
|
+
/** A finger's minimum target on the mobile renderers (B5, ADR 0035 §1). */
|
|
8
|
+
export declare const MOBILE_TOUCH_TARGET = 44;
|
|
7
9
|
/** column title height */
|
|
8
10
|
export declare const DEFAULT_ADD_BUTTON_WIDTH = 40;
|
|
9
11
|
export declare const LEFT_TOOL_BAR_WIDTH = 24;
|
|
@@ -4,6 +4,8 @@ export const DEFAULT_COLUMN_WIDTH = 180;
|
|
|
4
4
|
export const DEFAULT_COLUMN_MIN_WIDTH = 100;
|
|
5
5
|
/** column title height */
|
|
6
6
|
export const DEFAULT_COLUMN_TITLE_HEIGHT = 34;
|
|
7
|
+
/** A finger's minimum target on the mobile renderers (B5, ADR 0035 §1). */
|
|
8
|
+
export const MOBILE_TOUCH_TARGET = 44;
|
|
7
9
|
/** column title height */
|
|
8
10
|
export const DEFAULT_ADD_BUTTON_WIDTH = 40;
|
|
9
11
|
export const LEFT_TOOL_BAR_WIDTH = 24;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { viewType } from '../../core/view/data-view.js';
|
|
2
|
+
import { VIEW_NAME_TABLE } from '../../translations.js';
|
|
2
3
|
import { TableSingleView } from './table-view-manager.js';
|
|
3
4
|
export const tableViewType = viewType('table');
|
|
4
5
|
export const tableViewModel = tableViewType.createModel({
|
|
5
|
-
defaultName:
|
|
6
|
+
defaultName: VIEW_NAME_TABLE[1],
|
|
7
|
+
defaultNameKey: VIEW_NAME_TABLE[0],
|
|
6
8
|
dataViewManager: TableSingleView,
|
|
7
9
|
defaultData: viewManager => {
|
|
8
10
|
return {
|
|
@@ -37,7 +37,7 @@ import { ShadowlessElement } from '../../../../std/index.js';
|
|
|
37
37
|
import { computed, effect, signal } from '@preact/signals-core';
|
|
38
38
|
import { css } from 'lit';
|
|
39
39
|
import { property } from 'lit/decorators.js';
|
|
40
|
-
import { renderUniLit, } from '../../../core/index.js';
|
|
40
|
+
import { renderCellStatus, renderUniLit, } from '../../../core/index.js';
|
|
41
41
|
import { TableViewAreaSelection } from '../selection.js';
|
|
42
42
|
let MobileTableCell = (() => {
|
|
43
43
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
@@ -136,6 +136,9 @@ let MobileTableCell = (() => {
|
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
const { view } = renderer;
|
|
139
|
+
const status = renderCellStatus(this.cell$.value);
|
|
140
|
+
if (status)
|
|
141
|
+
return status;
|
|
139
142
|
this.view.lockRows(this.isEditing$.value);
|
|
140
143
|
this.dataset['editing'] = `${this.isEditing$.value}`;
|
|
141
144
|
const props = {
|
|
@@ -43,7 +43,7 @@ import { styleMap } from 'lit/directives/style-map.js';
|
|
|
43
43
|
import { html } from 'lit/static-html.js';
|
|
44
44
|
import { inputConfig, typeConfig } from '../../../core/common/property-menu.js';
|
|
45
45
|
import { numberFormats } from '../../../property-presets/number/utils/formats.js';
|
|
46
|
-
import {
|
|
46
|
+
import { MOBILE_TOUCH_TARGET } from '../consts.js';
|
|
47
47
|
let MobileTableColumnHeader = (() => {
|
|
48
48
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
49
49
|
let _column_decorators;
|
|
@@ -249,7 +249,7 @@ let MobileTableColumnHeader = (() => {
|
|
|
249
249
|
render() {
|
|
250
250
|
const column = this.column;
|
|
251
251
|
const style = styleMap({
|
|
252
|
-
height:
|
|
252
|
+
height: MOBILE_TOUCH_TARGET + 'px',
|
|
253
253
|
});
|
|
254
254
|
return html `
|
|
255
255
|
<div
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ShadowlessElement } from '../../../../std/index.js';
|
|
1
|
+
import { type BlockStdScope, ShadowlessElement } from '../../../../std/index.js';
|
|
2
2
|
import type { Group } from '../../../core/group-by/trait.js';
|
|
3
3
|
import type { Row } from '../../../core/index.js';
|
|
4
4
|
import type { MobileTableViewUILogic } from './table-view-ui-logic.js';
|
|
5
5
|
declare const MobileTableGroup_base: typeof ShadowlessElement & import("../../../../global/utils/types.js").Constructor<import("../../../../global/lit/with-disposable.js").DisposableClass>;
|
|
6
6
|
export declare class MobileTableGroup extends MobileTableGroup_base {
|
|
7
7
|
static styles: import("lit").CSSResult;
|
|
8
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
9
|
+
accessor std: BlockStdScope;
|
|
8
10
|
collapsed$: import("@preact/signals-core").Signal<boolean>;
|
|
9
11
|
private storageLoaded;
|
|
10
12
|
/**
|
|
@@ -35,13 +35,17 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
import { menu, popFilterableSimpleMenu, popupTargetFromElement, } from '../../../../affine-components/context-menu/index.js';
|
|
36
36
|
import { SignalWatcher, WithDisposable } from '../../../../global/lit/index.js';
|
|
37
37
|
import { PlusIcon, ToggleDownIcon, ToggleRightIcon, } from '@blocksuite/icons/lit';
|
|
38
|
-
import { ShadowlessElement } from '../../../../std/index.js';
|
|
38
|
+
import { ShadowlessElement, stdContext } from '../../../../std/index.js';
|
|
39
|
+
import { consume } from '@lit/context';
|
|
39
40
|
import { signal } from '@preact/signals-core';
|
|
40
41
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
41
42
|
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
42
43
|
import { property } from 'lit/decorators.js';
|
|
43
44
|
import { repeat } from 'lit/directives/repeat.js';
|
|
44
45
|
import { GroupTitle } from '../../../core/group-by/group-title.js';
|
|
46
|
+
import { hideGroupAction } from '../../../core/group-by/group-visibility.js';
|
|
47
|
+
import { wordingOf } from '../../../core/utils/wording.js';
|
|
48
|
+
import { DATA_VIEW_GROUP_COLLAPSE, DATA_VIEW_GROUP_EXPAND, } from '../../../translations.js';
|
|
45
49
|
import { getCollapsedState, setCollapsedState } from '../collapsed-state.js';
|
|
46
50
|
import { LEFT_TOOL_BAR_WIDTH } from '../consts.js';
|
|
47
51
|
const styles = css `
|
|
@@ -94,6 +98,9 @@ const styles = css `
|
|
|
94
98
|
`;
|
|
95
99
|
let MobileTableGroup = (() => {
|
|
96
100
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
101
|
+
let _std_decorators;
|
|
102
|
+
let _std_initializers = [];
|
|
103
|
+
let _std_extraInitializers = [];
|
|
97
104
|
let _group_decorators;
|
|
98
105
|
let _group_initializers = [];
|
|
99
106
|
let _group_extraInitializers = [];
|
|
@@ -103,13 +110,19 @@ let MobileTableGroup = (() => {
|
|
|
103
110
|
return class MobileTableGroup extends _classSuper {
|
|
104
111
|
static {
|
|
105
112
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
113
|
+
_std_decorators = [consume({ context: stdContext })];
|
|
106
114
|
_group_decorators = [property({ attribute: false })];
|
|
107
115
|
_tableViewLogic_decorators = [property({ attribute: false })];
|
|
116
|
+
__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);
|
|
108
117
|
__esDecorate(this, null, _group_decorators, { kind: "accessor", name: "group", static: false, private: false, access: { has: obj => "group" in obj, get: obj => obj.group, set: (obj, value) => { obj.group = value; } }, metadata: _metadata }, _group_initializers, _group_extraInitializers);
|
|
109
118
|
__esDecorate(this, null, _tableViewLogic_decorators, { kind: "accessor", name: "tableViewLogic", static: false, private: false, access: { has: obj => "tableViewLogic" in obj, get: obj => obj.tableViewLogic, set: (obj, value) => { obj.tableViewLogic = value; } }, metadata: _metadata }, _tableViewLogic_initializers, _tableViewLogic_extraInitializers);
|
|
110
119
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
111
120
|
}
|
|
112
121
|
static { this.styles = styles; }
|
|
122
|
+
#std_accessor_storage;
|
|
123
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
124
|
+
get std() { return this.#std_accessor_storage; }
|
|
125
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
113
126
|
/**
|
|
114
127
|
* Read the stored collapsed state once, as soon as the group and its view
|
|
115
128
|
* are both known. Reading it earlier would key the lookup on a missing view
|
|
@@ -190,7 +203,8 @@ let MobileTableGroup = (() => {
|
|
|
190
203
|
}
|
|
191
204
|
constructor() {
|
|
192
205
|
super(...arguments);
|
|
193
|
-
this
|
|
206
|
+
this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
|
|
207
|
+
this.collapsed$ = (__runInitializers(this, _std_extraInitializers), signal(false));
|
|
194
208
|
this.storageLoaded = false;
|
|
195
209
|
this._toggleCollapse = (e) => {
|
|
196
210
|
e?.stopPropagation();
|
|
@@ -225,6 +239,7 @@ let MobileTableGroup = (() => {
|
|
|
225
239
|
});
|
|
226
240
|
},
|
|
227
241
|
}),
|
|
242
|
+
hideGroupAction(group, wordingOf(this.std)),
|
|
228
243
|
menu.action({
|
|
229
244
|
name: 'Delete Cards',
|
|
230
245
|
select: () => {
|
|
@@ -246,9 +261,9 @@ let MobileTableGroup = (() => {
|
|
|
246
261
|
class="group-toggle-btn"
|
|
247
262
|
role="button"
|
|
248
263
|
aria-expanded=${this.collapsed$.value ? 'false' : 'true'}
|
|
249
|
-
aria-label=${this.collapsed$.value
|
|
250
|
-
?
|
|
251
|
-
:
|
|
264
|
+
aria-label=${wordingOf(this.std)(this.collapsed$.value
|
|
265
|
+
? DATA_VIEW_GROUP_EXPAND
|
|
266
|
+
: DATA_VIEW_GROUP_COLLAPSE)}
|
|
252
267
|
tabindex="0"
|
|
253
268
|
@click=${this._toggleCollapse}
|
|
254
269
|
@keydown=${(e) => {
|
|
@@ -67,6 +67,8 @@ let MobileTableRow = (() => {
|
|
|
67
67
|
__esDecorate(this, null, _rowIndex_decorators, { kind: "accessor", name: "rowIndex", static: false, private: false, access: { has: obj => "rowIndex" in obj, get: obj => obj.rowIndex, set: (obj, value) => { obj.rowIndex = value; } }, metadata: _metadata }, _rowIndex_initializers, _rowIndex_extraInitializers);
|
|
68
68
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
69
69
|
}
|
|
70
|
+
// Touch targets are 44px tall (B5, ADR 0035 §1): the row, and each row op
|
|
71
|
+
// through an invisible hit area, so the ops keep their drawn size.
|
|
70
72
|
static { this.styles = css `
|
|
71
73
|
.mobile-table-row {
|
|
72
74
|
width: 100%;
|
|
@@ -74,7 +76,7 @@ let MobileTableRow = (() => {
|
|
|
74
76
|
flex-direction: row;
|
|
75
77
|
border-bottom: 1px solid ${unsafeCSS(cssVarV2.layer.insideBorder.border)};
|
|
76
78
|
position: relative;
|
|
77
|
-
min-height:
|
|
79
|
+
min-height: 44px;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
.mobile-row-ops {
|
|
@@ -83,7 +85,7 @@ let MobileTableRow = (() => {
|
|
|
83
85
|
margin-top: 5px;
|
|
84
86
|
height: max-content;
|
|
85
87
|
display: flex;
|
|
86
|
-
gap:
|
|
88
|
+
gap: 20px;
|
|
87
89
|
cursor: pointer;
|
|
88
90
|
justify-content: end;
|
|
89
91
|
right: 8px;
|
|
@@ -104,6 +106,12 @@ let MobileTableRow = (() => {
|
|
|
104
106
|
font-size: 16px;
|
|
105
107
|
color: ${unsafeCSSVarV2('icon/primary')};
|
|
106
108
|
}
|
|
109
|
+
|
|
110
|
+
.mobile-row-op::after {
|
|
111
|
+
content: '';
|
|
112
|
+
position: absolute;
|
|
113
|
+
inset: -10px;
|
|
114
|
+
}
|
|
107
115
|
`; }
|
|
108
116
|
get groupKey() {
|
|
109
117
|
return this.closest('affine-data-view-table-group')?.group?.key;
|
|
@@ -74,7 +74,7 @@ export class MobileTableViewUI extends DataViewUIBase {
|
|
|
74
74
|
this.classList.add(mobileTableViewWrapper);
|
|
75
75
|
}
|
|
76
76
|
renderTable() {
|
|
77
|
-
const groups = this.logic.view.groupTrait.
|
|
77
|
+
const groups = this.logic.view.groupTrait.visibleGroups$.value;
|
|
78
78
|
if (groups) {
|
|
79
79
|
return html `
|
|
80
80
|
<div style="display:flex;flex-direction: column;gap: 16px;">
|
|
@@ -86,6 +86,9 @@ export class MobileTableViewUI extends DataViewUIBase {
|
|
|
86
86
|
></mobile-table-group>`;
|
|
87
87
|
})}
|
|
88
88
|
${this.logic.renderAddGroup(this.logic.view.groupTrait)}
|
|
89
|
+
<dv-hidden-groups
|
|
90
|
+
.groupTrait="${this.logic.view.groupTrait}"
|
|
91
|
+
></dv-hidden-groups>
|
|
89
92
|
</div>
|
|
90
93
|
`;
|
|
91
94
|
}
|
|
@@ -37,7 +37,7 @@ import { ShadowlessElement } from '../../../../std/index.js';
|
|
|
37
37
|
import { computed, signal } from '@preact/signals-core';
|
|
38
38
|
import { css } from 'lit';
|
|
39
39
|
import { property } from 'lit/decorators.js';
|
|
40
|
-
import { renderUniLit } from '../../../core/index.js';
|
|
40
|
+
import { renderCellStatus, renderUniLit } from '../../../core/index.js';
|
|
41
41
|
import { TableViewAreaSelection, } from '../selection.js';
|
|
42
42
|
let TableViewCellContainer = (() => {
|
|
43
43
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
@@ -143,6 +143,9 @@ let TableViewCellContainer = (() => {
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
const { view } = renderer;
|
|
146
|
+
const status = renderCellStatus(this.cell$.value);
|
|
147
|
+
if (status)
|
|
148
|
+
return status;
|
|
146
149
|
this.view.lockRows(this.isEditing$.value);
|
|
147
150
|
this.dataset['editing'] = `${this.isEditing$.value}`;
|
|
148
151
|
const props = {
|
|
@@ -307,7 +307,7 @@ export class TableHotkeysController {
|
|
|
307
307
|
if (selection) {
|
|
308
308
|
context.get('keyboardState').raw.preventDefault();
|
|
309
309
|
this.selectionController.selection = TableViewRowSelection.create({
|
|
310
|
-
rows: this.logic.view.groupTrait.
|
|
310
|
+
rows: this.logic.view.groupTrait.visibleGroups$.value?.flatMap(group => group?.rows.map(row => ({
|
|
311
311
|
groupKey: group.key,
|
|
312
312
|
id: row.rowId,
|
|
313
313
|
})) ?? []) ??
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ShadowlessElement } from '../../../../std/index.js';
|
|
1
|
+
import { type BlockStdScope, ShadowlessElement } from '../../../../std/index.js';
|
|
2
2
|
import type { Group } from '../../../core/group-by/trait.js';
|
|
3
3
|
import type { Row } from '../../../core/index.js';
|
|
4
4
|
import type { TableViewUILogic } from './table-view-ui-logic.js';
|
|
5
5
|
declare const TableGroup_base: typeof ShadowlessElement & import("../../../../global/utils/types.js").Constructor<import("../../../../global/lit/with-disposable.js").DisposableClass>;
|
|
6
6
|
export declare class TableGroup extends TableGroup_base {
|
|
7
7
|
static styles: import("lit").CSSResult;
|
|
8
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
9
|
+
accessor std: BlockStdScope;
|
|
8
10
|
collapsed$: import("@preact/signals-core").Signal<boolean>;
|
|
9
11
|
private storageLoaded;
|
|
10
12
|
/**
|
|
@@ -35,16 +35,20 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
import { menu, popFilterableSimpleMenu, popupTargetFromElement, } from '../../../../affine-components/context-menu/index.js';
|
|
36
36
|
import { SignalWatcher, WithDisposable } from '../../../../global/lit/index.js';
|
|
37
37
|
import { PlusIcon, ToggleDownIcon, ToggleRightIcon, } from '@blocksuite/icons/lit';
|
|
38
|
-
import { ShadowlessElement } from '../../../../std/index.js';
|
|
38
|
+
import { ShadowlessElement, stdContext } from '../../../../std/index.js';
|
|
39
|
+
import { consume } from '@lit/context';
|
|
39
40
|
import { effect, signal } from '@preact/signals-core';
|
|
40
41
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
41
42
|
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
42
43
|
import { property, query } from 'lit/decorators.js';
|
|
43
44
|
import { repeat } from 'lit/directives/repeat.js';
|
|
44
45
|
import { GroupTitle } from '../../../core/group-by/group-title.js';
|
|
46
|
+
import { hideGroupAction } from '../../../core/group-by/group-visibility.js';
|
|
45
47
|
import { createDndContext } from '../../../core/utils/wc-dnd/dnd-context.js';
|
|
46
48
|
import { defaultActivators } from '../../../core/utils/wc-dnd/sensors/index.js';
|
|
47
49
|
import { linearMove } from '../../../core/utils/wc-dnd/utils/linear-move.js';
|
|
50
|
+
import { wordingOf } from '../../../core/utils/wording.js';
|
|
51
|
+
import { DATA_VIEW_GROUP_COLLAPSE, DATA_VIEW_GROUP_EXPAND, } from '../../../translations.js';
|
|
48
52
|
import { getCollapsedState, setCollapsedState } from '../collapsed-state.js';
|
|
49
53
|
import { LEFT_TOOL_BAR_WIDTH } from '../consts.js';
|
|
50
54
|
import { TableViewAreaSelection } from '../selection.js';
|
|
@@ -111,6 +115,9 @@ const styles = css `
|
|
|
111
115
|
`;
|
|
112
116
|
let TableGroup = (() => {
|
|
113
117
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
118
|
+
let _std_decorators;
|
|
119
|
+
let _std_initializers = [];
|
|
120
|
+
let _std_extraInitializers = [];
|
|
114
121
|
let _group_decorators;
|
|
115
122
|
let _group_initializers = [];
|
|
116
123
|
let _group_extraInitializers = [];
|
|
@@ -123,15 +130,21 @@ let TableGroup = (() => {
|
|
|
123
130
|
return class TableGroup extends _classSuper {
|
|
124
131
|
static {
|
|
125
132
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
133
|
+
_std_decorators = [consume({ context: stdContext })];
|
|
126
134
|
_group_decorators = [property({ attribute: false })];
|
|
127
135
|
_rowsContainer_decorators = [query('.affine-database-block-rows')];
|
|
128
136
|
_tableViewLogic_decorators = [property({ attribute: false })];
|
|
137
|
+
__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);
|
|
129
138
|
__esDecorate(this, null, _group_decorators, { kind: "accessor", name: "group", static: false, private: false, access: { has: obj => "group" in obj, get: obj => obj.group, set: (obj, value) => { obj.group = value; } }, metadata: _metadata }, _group_initializers, _group_extraInitializers);
|
|
130
139
|
__esDecorate(this, null, _rowsContainer_decorators, { kind: "accessor", name: "rowsContainer", static: false, private: false, access: { has: obj => "rowsContainer" in obj, get: obj => obj.rowsContainer, set: (obj, value) => { obj.rowsContainer = value; } }, metadata: _metadata }, _rowsContainer_initializers, _rowsContainer_extraInitializers);
|
|
131
140
|
__esDecorate(this, null, _tableViewLogic_decorators, { kind: "accessor", name: "tableViewLogic", static: false, private: false, access: { has: obj => "tableViewLogic" in obj, get: obj => obj.tableViewLogic, set: (obj, value) => { obj.tableViewLogic = value; } }, metadata: _metadata }, _tableViewLogic_initializers, _tableViewLogic_extraInitializers);
|
|
132
141
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
133
142
|
}
|
|
134
143
|
static { this.styles = styles; }
|
|
144
|
+
#std_accessor_storage;
|
|
145
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
146
|
+
get std() { return this.#std_accessor_storage; }
|
|
147
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
135
148
|
/**
|
|
136
149
|
* Read the stored collapsed state once, as soon as the group and its view
|
|
137
150
|
* are both known. Reading it earlier would key the lookup on a missing view
|
|
@@ -221,7 +234,8 @@ let TableGroup = (() => {
|
|
|
221
234
|
}
|
|
222
235
|
constructor() {
|
|
223
236
|
super(...arguments);
|
|
224
|
-
this
|
|
237
|
+
this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
|
|
238
|
+
this.collapsed$ = (__runInitializers(this, _std_extraInitializers), signal(false));
|
|
225
239
|
this.storageLoaded = false;
|
|
226
240
|
this._toggleCollapse = (e) => {
|
|
227
241
|
e?.stopPropagation();
|
|
@@ -282,6 +296,7 @@ let TableGroup = (() => {
|
|
|
282
296
|
});
|
|
283
297
|
},
|
|
284
298
|
}),
|
|
299
|
+
hideGroupAction(group, wordingOf(this.std)),
|
|
285
300
|
menu.action({
|
|
286
301
|
name: 'Delete Cards',
|
|
287
302
|
select: () => {
|
|
@@ -303,9 +318,9 @@ let TableGroup = (() => {
|
|
|
303
318
|
class="group-toggle-btn"
|
|
304
319
|
role="button"
|
|
305
320
|
aria-expanded=${this.collapsed$.value ? 'false' : 'true'}
|
|
306
|
-
aria-label=${this.collapsed$.value
|
|
307
|
-
?
|
|
308
|
-
:
|
|
321
|
+
aria-label=${wordingOf(this.std)(this.collapsed$.value
|
|
322
|
+
? DATA_VIEW_GROUP_EXPAND
|
|
323
|
+
: DATA_VIEW_GROUP_COLLAPSE)}
|
|
309
324
|
tabindex="0"
|
|
310
325
|
@click=${this._toggleCollapse}
|
|
311
326
|
@keydown=${(e) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PopupTarget } from '../../../../affine-components/context-menu/index.js';
|
|
2
2
|
import type { TableSelectionController } from './controller/selection.js';
|
|
3
3
|
import type { TableViewUILogic } from './table-view-ui-logic.js';
|
|
4
|
-
export declare const openDetail: (tableViewLogic: TableViewUILogic, rowId: string, selection: TableSelectionController) => void;
|
|
4
|
+
export declare const openDetail: (tableViewLogic: TableViewUILogic, rowId: string, selection: TableSelectionController, newTab?: boolean) => void;
|
|
5
5
|
export declare const popRowMenu: (tableViewLogic: TableViewUILogic, ele: PopupTarget, selectionController: TableSelectionController) => void;
|