@formicoidea/labre-core 0.47.1 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-data-view/configs/slash-menu.js +3 -1
- package/dist/_pkgs/affine-block-data-view/view.d.ts +17 -1
- package/dist/_pkgs/affine-block-data-view/view.js +21 -2
- package/dist/_pkgs/affine-block-database/commands.d.ts +2 -2
- package/dist/_pkgs/affine-block-database/commands.js +3 -3
- package/dist/_pkgs/affine-block-database/components/values-banner.d.ts +28 -0
- package/dist/_pkgs/affine-block-database/components/values-banner.js +199 -0
- package/dist/_pkgs/affine-block-database/configs/slash-menu.d.ts +6 -1
- package/dist/_pkgs/affine-block-database/configs/slash-menu.js +57 -70
- package/dist/_pkgs/affine-block-database/data-source.d.ts +9 -5
- package/dist/_pkgs/affine-block-database/data-source.js +11 -7
- package/dist/_pkgs/affine-block-database/database-block-styles.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/database-block-styles.js +15 -0
- package/dist/_pkgs/affine-block-database/database-block.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/database-block.js +141 -19
- package/dist/_pkgs/affine-block-database/effects.js +2 -0
- package/dist/_pkgs/affine-block-database/external-data-source.d.ts +69 -2
- package/dist/_pkgs/affine-block-database/external-data-source.js +88 -16
- package/dist/_pkgs/affine-block-database/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/index.js +2 -0
- package/dist/_pkgs/affine-block-database/linked-view.d.ts +38 -0
- package/dist/_pkgs/affine-block-database/linked-view.js +109 -0
- package/dist/_pkgs/affine-block-database/properties/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/properties/index.js +2 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.d.ts +15 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.js +24 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.d.ts +16 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.js +42 -0
- package/dist/_pkgs/affine-block-database/service/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-database/service/index.js +3 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.d.ts +49 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.js +21 -0
- package/dist/_pkgs/affine-block-database/service/open-row.d.ts +77 -0
- package/dist/_pkgs/affine-block-database/service/open-row.js +62 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.js +33 -0
- package/dist/_pkgs/affine-block-database/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/translations.js +35 -0
- package/dist/_pkgs/affine-block-database/view-creation.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/view-creation.js +14 -0
- package/dist/_pkgs/affine-block-database/view.d.ts +31 -1
- package/dist/_pkgs/affine-block-database/view.js +48 -4
- package/dist/_pkgs/affine-block-database/views/index.d.ts +30 -3
- package/dist/_pkgs/affine-block-database/views/index.js +44 -3
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.d.ts +25 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.js +71 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/slash-menu.js +3 -11
- package/dist/_pkgs/affine-components/date-picker/date-picker.d.ts +20 -0
- package/dist/_pkgs/affine-components/date-picker/date-picker.js +60 -26
- package/dist/_pkgs/affine-components/date-picker/style.js +1 -0
- package/dist/_pkgs/affine-components/translations.d.ts +4 -0
- package/dist/_pkgs/affine-components/translations.js +26 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +18 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +41 -2
- package/dist/_pkgs/affine-fragment-doc-title/index.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-doc-title/index.js +1 -1
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.d.ts +30 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +137 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/format.d.ts +7 -19
- package/dist/_pkgs/affine-fragment-doc-title/title-band/format.js +0 -38
- package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.d.ts +19 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.js +61 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +33 -18
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +263 -205
- package/dist/_pkgs/affine-fragment-doc-title/translations.d.ts +7 -4
- package/dist/_pkgs/affine-fragment-doc-title/translations.js +12 -9
- package/dist/_pkgs/affine-model/blocks/database/types.d.ts +16 -0
- package/dist/_pkgs/affine-model/blocks/database/types.js +5 -1
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +139 -0
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.js +22 -0
- package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/linked-doc-creation-service.d.ts +15 -6
- package/dist/_pkgs/affine-shared/services/telemetry-service/database.d.ts +59 -0
- package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +34 -7
- package/dist/_pkgs/affine-shared/utils/model/doc.d.ts +10 -2
- package/dist/_pkgs/affine-shared/utils/model/doc.js +17 -7
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +2 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +16 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +10 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +23 -0
- package/dist/_pkgs/data-view/core/component/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/component/index.js +1 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.d.ts +26 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.js +48 -0
- package/dist/_pkgs/data-view/core/component/overflow/overflow.d.ts +26 -3
- package/dist/_pkgs/data-view/core/component/overflow/overflow.js +84 -31
- package/dist/_pkgs/data-view/core/component/tags/colors.d.ts +7 -0
- package/dist/_pkgs/data-view/core/component/tags/colors.js +22 -10
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +25 -2
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +81 -32
- package/dist/_pkgs/data-view/core/data-source/base.d.ts +5 -1
- package/dist/_pkgs/data-view/core/data-source/base.js +7 -1
- package/dist/_pkgs/data-view/core/data-source/hydration.d.ts +44 -0
- package/dist/_pkgs/data-view/core/data-source/hydration.js +31 -0
- package/dist/_pkgs/data-view/core/data-source/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/data-source/index.js +1 -0
- package/dist/_pkgs/data-view/core/data-view.d.ts +22 -2
- package/dist/_pkgs/data-view/core/data-view.js +14 -0
- package/dist/_pkgs/data-view/core/effect.js +4 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.d.ts +3 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.js +59 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.d.ts +21 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.js +38 -0
- package/dist/_pkgs/data-view/core/group-by/group-title.js +4 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.d.ts +40 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.js +291 -0
- package/dist/_pkgs/data-view/core/group-by/setting.d.ts +11 -3
- package/dist/_pkgs/data-view/core/group-by/setting.js +81 -8
- package/dist/_pkgs/data-view/core/group-by/trait.d.ts +22 -0
- package/dist/_pkgs/data-view/core/group-by/trait.js +62 -1
- package/dist/_pkgs/data-view/core/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/index.js +3 -0
- package/dist/_pkgs/data-view/core/property/base-cell.d.ts +15 -1
- package/dist/_pkgs/data-view/core/property/base-cell.js +28 -3
- package/dist/_pkgs/data-view/core/property/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/property/index.js +1 -0
- package/dist/_pkgs/data-view/core/property/standalone-cell.d.ts +109 -0
- package/dist/_pkgs/data-view/core/property/standalone-cell.js +324 -0
- package/dist/_pkgs/data-view/core/telemetry.d.ts +16 -0
- package/dist/_pkgs/data-view/core/telemetry.js +22 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.d.ts +2 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.js +4 -0
- package/dist/_pkgs/data-view/core/utils/wording.d.ts +11 -0
- package/dist/_pkgs/data-view/core/utils/wording.js +9 -0
- package/dist/_pkgs/data-view/core/view/data-view.d.ts +7 -0
- package/dist/_pkgs/data-view/core/view/default-name.d.ts +10 -0
- package/dist/_pkgs/data-view/core/view/default-name.js +14 -0
- package/dist/_pkgs/data-view/core/view/index.d.ts +2 -0
- package/dist/_pkgs/data-view/core/view/index.js +2 -0
- package/dist/_pkgs/data-view/core/view/open-in.d.ts +27 -0
- package/dist/_pkgs/data-view/core/view/open-in.js +39 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.d.ts +5 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.js +11 -0
- package/dist/_pkgs/data-view/core/view-manager/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/view-manager/index.js +3 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.d.ts +18 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.js +2 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.d.ts +8 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.js +9 -0
- package/dist/_pkgs/data-view/core/view-manager/property.d.ts +14 -0
- package/dist/_pkgs/data-view/core/view-manager/single-view.d.ts +28 -1
- package/dist/_pkgs/data-view/core/view-manager/single-view.js +45 -1
- package/dist/_pkgs/data-view/core/view-manager/view-creation.d.ts +49 -0
- package/dist/_pkgs/data-view/core/view-manager/view-creation.js +40 -0
- package/dist/_pkgs/data-view/core/view-manager/view-manager.d.ts +6 -2
- package/dist/_pkgs/data-view/core/view-manager/view-manager.js +2 -2
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.d.ts +2 -0
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.js +11 -2
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/text/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/translations.d.ts +55 -0
- package/dist/_pkgs/data-view/translations.js +181 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/convert.js +2 -0
- package/dist/_pkgs/data-view/view-presets/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.js +35 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.d.ts +79 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.js +194 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +56 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +266 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.d.ts +27 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +179 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/index.d.ts +5 -0
- package/dist/_pkgs/data-view/view-presets/index.js +7 -0
- package/dist/_pkgs/data-view/view-presets/kanban/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +5 -53
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +8 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +6 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.js +52 -6
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +2 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +4 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.js +51 -6
- package/dist/_pkgs/data-view/view-presets/kanban/pc/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/list/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/list/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/list/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/list/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.d.ts +24 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.js +194 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +3 -14
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +6 -30
- package/dist/_pkgs/data-view/view-presets/table/consts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/table/consts.js +2 -0
- package/dist/_pkgs/data-view/view-presets/table/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +10 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.d.ts +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +3 -2
- package/dist/_pkgs/data-view/view-presets/table/pc/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +22 -19
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/table-view-ui-logic.js +7 -2
- package/dist/_pkgs/data-view/view-presets/table/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +5 -53
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +1 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +60 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.d.ts +18 -1
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +121 -124
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +43 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +187 -0
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.d.ts +36 -3
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +187 -59
- package/dist/extensions/view.d.ts +2 -2
- package/dist/extensions/view.js +10 -3
- package/dist/flags.d.ts +8 -4
- package/dist/flags.js +8 -4
- package/dist/frameworks.d.ts +27 -0
- package/dist/frameworks.js +28 -0
- package/dist/translations.js +13 -1
- package/package.json +5 -1
|
@@ -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;
|
|
@@ -2,12 +2,13 @@ import { menu, popFilterableSimpleMenu, } from '../../../../affine-components/co
|
|
|
2
2
|
import { CopyIcon, DeleteIcon, ExpandFullIcon, MoveLeftIcon, MoveRightIcon, } from '@blocksuite/icons/lit';
|
|
3
3
|
import { html } from 'lit';
|
|
4
4
|
import { TableViewRowSelection } from '../selection.js';
|
|
5
|
-
export const openDetail = (tableViewLogic, rowId, selection) => {
|
|
5
|
+
export const openDetail = (tableViewLogic, rowId, selection, newTab = false) => {
|
|
6
6
|
const old = selection.selection;
|
|
7
7
|
selection.selection = undefined;
|
|
8
8
|
tableViewLogic.root.openDetailPanel({
|
|
9
9
|
view: selection.logic.view,
|
|
10
10
|
rowId: rowId,
|
|
11
|
+
newTab,
|
|
11
12
|
onClose: () => {
|
|
12
13
|
selection.selection = old;
|
|
13
14
|
},
|
|
@@ -44,6 +44,7 @@ import { styleMap } from 'lit/directives/style-map.js';
|
|
|
44
44
|
import { html } from 'lit/static-html.js';
|
|
45
45
|
import { TableViewRowSelection, } from '../../selection.js';
|
|
46
46
|
import { cellDivider } from '../../styles.js';
|
|
47
|
+
import { isNewTabClick } from '../../../../core/utils/new-tab-click.js';
|
|
47
48
|
import { openDetail, popRowMenu } from '../menu.js';
|
|
48
49
|
let TableRowView = (() => {
|
|
49
50
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
@@ -203,14 +204,14 @@ let TableRowView = (() => {
|
|
|
203
204
|
</div>
|
|
204
205
|
</div>`}
|
|
205
206
|
${repeat(view.properties$.value, v => v.id, (column, i) => {
|
|
206
|
-
const clickDetail = () => {
|
|
207
|
+
const clickDetail = (event) => {
|
|
207
208
|
if (!this.selectionController) {
|
|
208
209
|
return;
|
|
209
210
|
}
|
|
210
211
|
this.setSelection(TableViewRowSelection.create({
|
|
211
212
|
rows: [{ id: this.rowId, groupKey: this.groupKey }],
|
|
212
213
|
}));
|
|
213
|
-
openDetail(this.tableViewLogic, this.rowId, this.selectionController);
|
|
214
|
+
openDetail(this.tableViewLogic, this.rowId, this.selectionController, isNewTabClick(event));
|
|
214
215
|
};
|
|
215
216
|
const openMenu = (e) => {
|
|
216
217
|
if (!this.selectionController) {
|
|
@@ -116,7 +116,7 @@ export class TableViewUI extends DataViewUIBase {
|
|
|
116
116
|
this.dataset['testid'] = 'dv-table-view';
|
|
117
117
|
}
|
|
118
118
|
renderTable() {
|
|
119
|
-
const groups = this.logic.view.groupTrait.
|
|
119
|
+
const groups = this.logic.view.groupTrait.visibleGroups$.value;
|
|
120
120
|
if (groups) {
|
|
121
121
|
return html `
|
|
122
122
|
<div class="${tableGroupsContainerStyle}">
|
|
@@ -128,6 +128,9 @@ export class TableViewUI extends DataViewUIBase {
|
|
|
128
128
|
></affine-data-view-table-group>`;
|
|
129
129
|
})}
|
|
130
130
|
${this.logic.renderAddGroup(this.logic.view.groupTrait)}
|
|
131
|
+
<dv-hidden-groups
|
|
132
|
+
.groupTrait="${this.logic.view.groupTrait}"
|
|
133
|
+
></dv-hidden-groups>
|
|
131
134
|
</div>
|
|
132
135
|
`;
|
|
133
136
|
}
|
|
@@ -309,7 +309,7 @@ export class TableHotkeysController {
|
|
|
309
309
|
if (selection) {
|
|
310
310
|
context.get('keyboardState').raw.preventDefault();
|
|
311
311
|
this.selectionController.selection = TableViewRowSelection.create({
|
|
312
|
-
rows: this.logic.view.groupTrait.
|
|
312
|
+
rows: this.logic.view.groupTrait.visibleGroups$.value?.flatMap(group => group?.rows.map(row => ({
|
|
313
313
|
groupKey: group.key,
|
|
314
314
|
id: row.rowId,
|
|
315
315
|
})) ?? []) ??
|
package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js
CHANGED
|
@@ -42,7 +42,7 @@ import { computed, signal } from '@preact/signals-core';
|
|
|
42
42
|
import { css, html } from 'lit';
|
|
43
43
|
import { property } from 'lit/decorators.js';
|
|
44
44
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
45
|
-
import { typeSystem } from '../../../../../../core/index.js';
|
|
45
|
+
import { typeSystem, VALUES_PENDING_MARK, valuesReady, } from '../../../../../../core/index.js';
|
|
46
46
|
import { statsFunctions } from '../../../../../../core/statistics/index.js';
|
|
47
47
|
const styles = css `
|
|
48
48
|
.stats-cell {
|
|
@@ -255,6 +255,10 @@ let VirtualDatabaseColumnStatsCell = (() => {
|
|
|
255
255
|
if (!func) {
|
|
256
256
|
return null;
|
|
257
257
|
}
|
|
258
|
+
const dataSource = this.column.view.manager.dataSource;
|
|
259
|
+
if (!valuesReady(dataSource)) {
|
|
260
|
+
return { name: func.displayName, value: VALUES_PENDING_MARK };
|
|
261
|
+
}
|
|
258
262
|
return {
|
|
259
263
|
name: func.displayName,
|
|
260
264
|
value: func.impl?.(this.values$.value, {
|
|
@@ -2,9 +2,12 @@ import { MoreHorizontalIcon, PlusIcon } from '@blocksuite/icons/lit';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { nothing } from 'lit';
|
|
4
4
|
import { html } from 'lit/static-html.js';
|
|
5
|
-
import { renderUniLit, } from '../../../../../core/index.js';
|
|
5
|
+
import { renderUniLit, VALUES_PENDING_MARK, valuesReady, } from '../../../../../core/index.js';
|
|
6
6
|
import { groupHeaderCount, groupHeaderIcon, groupHeaderOp, groupHeaderOps, groupHeaderTitle, groupTitleRow, show, } from './group-title-css.js';
|
|
7
7
|
function GroupHeaderCount(group) {
|
|
8
|
+
if (!valuesReady(group.property.view.manager.dataSource)) {
|
|
9
|
+
return html ` <div class="${groupHeaderCount}">${VALUES_PENDING_MARK}</div>`;
|
|
10
|
+
}
|
|
8
11
|
const cards = group.rows;
|
|
9
12
|
if (!cards.length) {
|
|
10
13
|
return;
|
|
@@ -19,9 +22,9 @@ export const GroupTitle = (groupData, ops) => {
|
|
|
19
22
|
}
|
|
20
23
|
const icon = groupData.value == null
|
|
21
24
|
? ''
|
|
22
|
-
: html ` <uni-lit
|
|
23
|
-
class="${groupHeaderIcon}"
|
|
24
|
-
.uni="${groupData.property.icon}"
|
|
25
|
+
: html ` <uni-lit
|
|
26
|
+
class="${groupHeaderIcon}"
|
|
27
|
+
.uni="${groupData.property.icon}"
|
|
25
28
|
></uni-lit>`;
|
|
26
29
|
const props = {
|
|
27
30
|
group: groupData,
|
|
@@ -29,25 +32,25 @@ export const GroupTitle = (groupData, ops) => {
|
|
|
29
32
|
};
|
|
30
33
|
const showColumnName = groupData.property.type$.value === 'checkbox';
|
|
31
34
|
const columnName = showColumnName
|
|
32
|
-
? html `<span class="${groupHeaderTitle}"
|
|
33
|
-
>${groupData.property.name$.value}</span
|
|
35
|
+
? html `<span class="${groupHeaderTitle}"
|
|
36
|
+
>${groupData.property.name$.value}</span
|
|
34
37
|
>`
|
|
35
38
|
: nothing;
|
|
36
39
|
const opsClass = clsx(ops.groupHover && show, groupHeaderOps);
|
|
37
|
-
return html `
|
|
38
|
-
<div class="${groupTitleRow}">
|
|
39
|
-
${icon} ${renderUniLit(view, props)} ${columnName}
|
|
40
|
-
${GroupHeaderCount(groupData)}
|
|
41
|
-
</div>
|
|
40
|
+
return html `
|
|
41
|
+
<div class="${groupTitleRow}">
|
|
42
|
+
${icon} ${renderUniLit(view, props)} ${columnName}
|
|
43
|
+
${GroupHeaderCount(groupData)}
|
|
44
|
+
</div>
|
|
42
45
|
${!ops.readonly
|
|
43
|
-
? html ` <div class="${opsClass}">
|
|
44
|
-
<div @click="${ops.clickAdd}" class="${groupHeaderOp}">
|
|
45
|
-
${PlusIcon()}
|
|
46
|
-
</div>
|
|
47
|
-
<div @click="${ops.clickOps}" class="${groupHeaderOp}">
|
|
48
|
-
${MoreHorizontalIcon()}
|
|
49
|
-
</div>
|
|
46
|
+
? html ` <div class="${opsClass}">
|
|
47
|
+
<div @click="${ops.clickAdd}" class="${groupHeaderOp}">
|
|
48
|
+
${PlusIcon()}
|
|
49
|
+
</div>
|
|
50
|
+
<div @click="${ops.clickOps}" class="${groupHeaderOp}">
|
|
51
|
+
${MoreHorizontalIcon()}
|
|
52
|
+
</div>
|
|
50
53
|
</div>`
|
|
51
|
-
: nothing}
|
|
54
|
+
: nothing}
|
|
52
55
|
`;
|
|
53
56
|
};
|
|
@@ -38,7 +38,7 @@ import { ShadowlessElement } from '../../../../../std/index.js';
|
|
|
38
38
|
import { computed, effect, signal } from '@preact/signals-core';
|
|
39
39
|
import { css } from 'lit';
|
|
40
40
|
import { property } from 'lit/decorators.js';
|
|
41
|
-
import { renderUniLit } from '../../../../core/index.js';
|
|
41
|
+
import { renderCellStatus, renderUniLit } from '../../../../core/index.js';
|
|
42
42
|
import { TableViewAreaSelection, TableViewRowSelection, } from '../../selection.js';
|
|
43
43
|
import { popRowMenu } from './menu.js';
|
|
44
44
|
import { rowSelectedBg } from './row-header-css.js';
|
|
@@ -133,6 +133,9 @@ let DatabaseCellContainer = (() => {
|
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
const { view } = renderer;
|
|
136
|
+
const status = renderCellStatus(this.cell$.value);
|
|
137
|
+
if (status)
|
|
138
|
+
return status;
|
|
136
139
|
this.view.lockRows(this.isEditing$.value);
|
|
137
140
|
this.dataset['editing'] = `${this.isEditing$.value}`;
|
|
138
141
|
const props = {
|
|
@@ -51,7 +51,12 @@ export class VirtualTableViewUILogic extends DataViewUILogicBase {
|
|
|
51
51
|
});
|
|
52
52
|
this.groups$ = computed(() => {
|
|
53
53
|
const groupTrait = this.groupTrait$.value;
|
|
54
|
-
|
|
54
|
+
// ponytail: the virtual grid drops hidden groups but lists none at its
|
|
55
|
+
// end and folds nothing (B8); it is off by default
|
|
56
|
+
// (`enable_table_virtual_scroll`). Upgrade: a last grid row drawing
|
|
57
|
+
// <dv-hidden-groups>, and the fold of `TableGroup` in its group header.
|
|
58
|
+
const groups = groupTrait?.visibleGroups$.value;
|
|
59
|
+
if (!groups) {
|
|
55
60
|
return [
|
|
56
61
|
{
|
|
57
62
|
id: '',
|
|
@@ -59,7 +64,7 @@ export class VirtualTableViewUILogic extends DataViewUILogicBase {
|
|
|
59
64
|
},
|
|
60
65
|
];
|
|
61
66
|
}
|
|
62
|
-
return
|
|
67
|
+
return groups.map(group => ({
|
|
63
68
|
id: group.key,
|
|
64
69
|
rows: group.rows.map(v => v.rowId),
|
|
65
70
|
}));
|
|
@@ -42,7 +42,7 @@ import { computed, signal } from '@preact/signals-core';
|
|
|
42
42
|
import { css, html } from 'lit';
|
|
43
43
|
import { property } from 'lit/decorators.js';
|
|
44
44
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
45
|
-
import { typeSystem } from '../../../core/index.js';
|
|
45
|
+
import { typeSystem, VALUES_PENDING_MARK, valuesReady, } from '../../../core/index.js';
|
|
46
46
|
import { statsFunctions } from '../../../core/statistics/index.js';
|
|
47
47
|
const styles = css `
|
|
48
48
|
.stats-cell {
|
|
@@ -255,6 +255,10 @@ let DatabaseColumnStatsCell = (() => {
|
|
|
255
255
|
if (!func) {
|
|
256
256
|
return null;
|
|
257
257
|
}
|
|
258
|
+
const dataSource = this.column.view.manager.dataSource;
|
|
259
|
+
if (!valuesReady(dataSource)) {
|
|
260
|
+
return { name: func.displayName, value: VALUES_PENDING_MARK };
|
|
261
|
+
}
|
|
258
262
|
return {
|
|
259
263
|
name: func.displayName,
|
|
260
264
|
value: func.impl?.(this.values$.value, {
|
|
@@ -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 { SortManager, sortTraitKey } from '../../core/sort/manager.js';
|
|
10
11
|
import { PropertyBase } from '../../core/view-manager/property.js';
|
|
@@ -79,58 +80,9 @@ export class TableSingleView extends SingleViewBase {
|
|
|
79
80
|
};
|
|
80
81
|
});
|
|
81
82
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return sortByManually(rows, v => v.rowId, property?.manuallyCardSort ?? []);
|
|
86
|
-
},
|
|
87
|
-
changeGroupSort: keys => {
|
|
88
|
-
const map = new Map(this.groupProperties.map(v => [v.key, v]));
|
|
89
|
-
this.dataUpdate(() => {
|
|
90
|
-
return {
|
|
91
|
-
groupProperties: keys.map(key => {
|
|
92
|
-
const property = map.get(key);
|
|
93
|
-
if (property) {
|
|
94
|
-
return property;
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
key,
|
|
98
|
-
hide: false,
|
|
99
|
-
manuallyCardSort: [],
|
|
100
|
-
};
|
|
101
|
-
}),
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
},
|
|
105
|
-
changeRowSort: (groupKeys, groupKey, keys) => {
|
|
106
|
-
const map = new Map(this.groupProperties.map(v => [v.key, v]));
|
|
107
|
-
this.dataUpdate(() => {
|
|
108
|
-
return {
|
|
109
|
-
groupProperties: groupKeys.map(key => {
|
|
110
|
-
if (key === groupKey) {
|
|
111
|
-
const group = map.get(key);
|
|
112
|
-
return group
|
|
113
|
-
? {
|
|
114
|
-
...group,
|
|
115
|
-
manuallyCardSort: keys,
|
|
116
|
-
}
|
|
117
|
-
: {
|
|
118
|
-
key,
|
|
119
|
-
hide: false,
|
|
120
|
-
manuallyCardSort: keys,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
return (map.get(key) ?? {
|
|
125
|
-
key,
|
|
126
|
-
hide: false,
|
|
127
|
-
manuallyCardSort: [],
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}),
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
},
|
|
83
|
+
...groupPropertiesOps(() => this.groupProperties, groupProperties => {
|
|
84
|
+
this.dataUpdate(() => ({ groupProperties }));
|
|
85
|
+
}),
|
|
134
86
|
}));
|
|
135
87
|
this.mainProperties$ = computed(() => {
|
|
136
88
|
return (this.data$.value?.header ?? {
|
|
@@ -2,6 +2,7 @@ import { WidgetBase } from '../../../../core/widget/widget-base.js';
|
|
|
2
2
|
export declare class DataViewHeaderToolsAddRow extends WidgetBase {
|
|
3
3
|
static styles: import("lit").CSSResult;
|
|
4
4
|
private readonly onAddNewRecord;
|
|
5
|
+
private readonly onOpenMenu;
|
|
5
6
|
private get readonly$();
|
|
6
7
|
render(): import("lit-html").TemplateResult<1> | undefined;
|
|
7
8
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { unsafeCSSVarV2 } from '../../../../../affine-shared/theme/index.js';
|
|
2
2
|
import { IS_MOBILE } from '../../../../../global/env/index.js';
|
|
3
|
-
import { PlusIcon } from '@blocksuite/icons/lit';
|
|
3
|
+
import { ArrowDownSmallIcon, PlusIcon } from '@blocksuite/icons/lit';
|
|
4
4
|
import { css, html } from 'lit';
|
|
5
|
+
import { NewRowMenuOpenerKey } from '../../../../core/view-manager/new-row-menu-opener.js';
|
|
5
6
|
import { WidgetBase } from '../../../../core/widget/widget-base.js';
|
|
6
7
|
const styles = css `
|
|
7
8
|
.new-record {
|
|
@@ -12,6 +13,37 @@ const styles = css `
|
|
|
12
13
|
font-size: 20px;
|
|
13
14
|
color: ${unsafeCSSVarV2('icon/primary')};
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
/* A split button only when the host offers a menu beside "New"
|
|
18
|
+
(NewRowMenuOpenerKey): without it, the single button above. */
|
|
19
|
+
.new-record-split {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: stretch;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.new-record-split .new-record {
|
|
25
|
+
border-top-right-radius: 0;
|
|
26
|
+
border-bottom-right-radius: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.new-record-split .new-record-more {
|
|
30
|
+
border-left: none;
|
|
31
|
+
border-top-left-radius: 0;
|
|
32
|
+
border-bottom-left-radius: 0;
|
|
33
|
+
padding: 4px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (pointer: coarse) {
|
|
37
|
+
.new-record-split .new-record,
|
|
38
|
+
.new-record-split .new-record-more {
|
|
39
|
+
min-height: 44px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.new-record-split .new-record-more {
|
|
43
|
+
min-width: 44px;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
15
47
|
`;
|
|
16
48
|
export class DataViewHeaderToolsAddRow extends WidgetBase {
|
|
17
49
|
constructor() {
|
|
@@ -21,6 +53,14 @@ export class DataViewHeaderToolsAddRow extends WidgetBase {
|
|
|
21
53
|
return;
|
|
22
54
|
this.dataViewLogic.addRow?.('start');
|
|
23
55
|
};
|
|
56
|
+
this.onOpenMenu = (event) => {
|
|
57
|
+
event.stopPropagation();
|
|
58
|
+
if (this.readonly$.value)
|
|
59
|
+
return;
|
|
60
|
+
this.view
|
|
61
|
+
.serviceGet(NewRowMenuOpenerKey)
|
|
62
|
+
?.open(event.currentTarget, this.view.id);
|
|
63
|
+
};
|
|
24
64
|
}
|
|
25
65
|
static { this.styles = styles; }
|
|
26
66
|
get readonly$() {
|
|
@@ -30,7 +70,7 @@ export class DataViewHeaderToolsAddRow extends WidgetBase {
|
|
|
30
70
|
if (this.readonly$.value) {
|
|
31
71
|
return;
|
|
32
72
|
}
|
|
33
|
-
|
|
73
|
+
const button = html ` <data-view-component-button
|
|
34
74
|
class="affine-database-toolbar-item new-record"
|
|
35
75
|
.onClick="${this.onAddNewRecord}"
|
|
36
76
|
.icon="${PlusIcon()}"
|
|
@@ -39,5 +79,23 @@ export class DataViewHeaderToolsAddRow extends WidgetBase {
|
|
|
39
79
|
: html `<span style="font-weight: 500">New Record</span>`}"
|
|
40
80
|
>
|
|
41
81
|
</data-view-component-button>`;
|
|
82
|
+
const opener = this.view.serviceGet(NewRowMenuOpenerKey);
|
|
83
|
+
if (!opener || opener.canOpen?.(this.view.id) === false)
|
|
84
|
+
return button;
|
|
85
|
+
const label = opener.label();
|
|
86
|
+
return html `<div class="new-record-split">
|
|
87
|
+
${button}
|
|
88
|
+
<data-view-component-button
|
|
89
|
+
class="affine-database-toolbar-item new-record-more"
|
|
90
|
+
data-testid="database-new-record-more"
|
|
91
|
+
role="button"
|
|
92
|
+
aria-haspopup="menu"
|
|
93
|
+
aria-label="${label}"
|
|
94
|
+
title="${label}"
|
|
95
|
+
.onClick="${this.onOpenMenu}"
|
|
96
|
+
.icon="${ArrowDownSmallIcon()}"
|
|
97
|
+
>
|
|
98
|
+
</data-view-component-button>
|
|
99
|
+
</div>`;
|
|
42
100
|
}
|
|
43
101
|
}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import { type PopupTarget } from '../../../../../affine-components/context-menu/index.js';
|
|
2
|
+
import { type BlockStdScope } from '../../../../../std/index.js';
|
|
2
3
|
import { type DataViewUILogicBase } from '../../../../core/index.js';
|
|
4
|
+
import { type Wording } from '../../../../core/utils/wording.js';
|
|
3
5
|
import { WidgetBase } from '../../../../core/widget/widget-base.js';
|
|
6
|
+
import { type ViewSettingKey } from './view-settings.js';
|
|
4
7
|
export declare class DataViewHeaderToolsViewOptions extends WidgetBase {
|
|
5
8
|
static styles: import("lit").CSSResult;
|
|
9
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
10
|
+
accessor std: BlockStdScope;
|
|
6
11
|
clickMoreAction: (e: MouseEvent) => void;
|
|
7
12
|
openMoreAction: (target: PopupTarget) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the current view offers setting `key` now (labre PRD REQ-DB-10:
|
|
15
|
+
* what a host's "This view" menu lists for the full page of a database).
|
|
16
|
+
*/
|
|
17
|
+
settingAvailable(key: ViewSettingKey): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Open the menu of one setting of the current view, anchored on this
|
|
20
|
+
* button, its "back" leading to the view settings: the entry the view
|
|
21
|
+
* settings menu would open, for a caller outside it (a host's menu, through
|
|
22
|
+
* the database page's view-menu commands). Nothing when not offered.
|
|
23
|
+
*/
|
|
24
|
+
openSetting(key: ViewSettingKey): void;
|
|
8
25
|
render(): import("lit-html").TemplateResult<1> | undefined;
|
|
9
26
|
}
|
|
10
27
|
declare global {
|
|
@@ -12,4 +29,4 @@ declare global {
|
|
|
12
29
|
'data-view-header-tools-view-options': DataViewHeaderToolsViewOptions;
|
|
13
30
|
}
|
|
14
31
|
}
|
|
15
|
-
export declare const popViewOptions: (target: PopupTarget, dataViewLogic: DataViewUILogicBase, onClose?: () => void) => void;
|
|
32
|
+
export declare const popViewOptions: (target: PopupTarget, dataViewLogic: DataViewUILogicBase, onClose?: () => void, wording?: Wording) => void;
|