@formicoidea/labre-core 1.1.0 → 2.0.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/architecture/code.c4 +37 -34
- package/architecture/likec4.config.json +3 -3
- package/dist/_pkgs/affine-block-surface/extensions/reading-toolbar.js +12 -12
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.d.ts +3 -1
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +9 -1
- package/dist/_pkgs/affine-components/context-menu/menu.d.ts +7 -0
- package/dist/_pkgs/affine-components/context-menu/menu.js +5 -0
- package/dist/_pkgs/affine-components/context-menu/sub-menu.d.ts +16 -1
- package/dist/_pkgs/affine-components/context-menu/sub-menu.js +32 -5
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
- package/dist/_pkgs/affine-database-block/configs/slash-menu.js +14 -6
- package/dist/_pkgs/affine-database-block/database-block-styles.js +4 -3
- package/dist/_pkgs/affine-database-block/database-block.js +6 -18
- package/dist/_pkgs/affine-database-block/database-dnd-preview-block.js +5 -1
- package/dist/_pkgs/affine-database-block/detail-panel/block-renderer.js +5 -2
- package/dist/_pkgs/affine-database-block/detail-panel/note-renderer.js +3 -2
- package/dist/_pkgs/affine-database-block/external-data-source.d.ts +10 -0
- package/dist/_pkgs/affine-database-block/external-data-source.js +24 -0
- package/dist/_pkgs/affine-database-block/properties/created-time/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/link/cell-renderer.js +3 -2
- package/dist/_pkgs/affine-database-block/properties/link/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/rich-text/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/text/hosted.js +1 -0
- package/dist/_pkgs/affine-database-block/properties/title/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/title/hosted.js +1 -0
- package/dist/_pkgs/affine-database-block/service/new-row-menu.d.ts +1 -1
- package/dist/_pkgs/affine-database-block/service/new-row-menu.js +1 -1
- package/dist/_pkgs/affine-database-block/translations.d.ts +11 -0
- package/dist/_pkgs/affine-database-block/translations.js +57 -0
- package/dist/_pkgs/affine-database-block/views/index.d.ts +7 -9
- package/dist/_pkgs/affine-database-block/views/index.js +7 -10
- package/dist/_pkgs/affine-database-engine/core/common/properties.js +7 -7
- package/dist/_pkgs/affine-database-engine/core/common/property-menu.d.ts +18 -2
- package/dist/_pkgs/affine-database-engine/core/common/property-menu.js +78 -27
- package/dist/_pkgs/affine-database-engine/core/data-source/base.d.ts +11 -0
- package/dist/_pkgs/affine-database-engine/core/data-source/base.js +3 -0
- package/dist/_pkgs/affine-database-engine/core/detail/detail.js +8 -5
- package/dist/_pkgs/affine-database-engine/core/detail/field.js +14 -7
- package/dist/_pkgs/affine-database-engine/core/filter/add-filter.js +4 -2
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/boolean.js +7 -4
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/create.d.ts +9 -1
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/create.js +2 -0
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/date.js +7 -4
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/multi-tag.js +17 -8
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/number.js +6 -6
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/string.js +19 -12
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/tag.js +9 -4
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/unknown.js +7 -4
- package/dist/_pkgs/affine-database-engine/core/filter/literal/define.js +6 -4
- package/dist/_pkgs/affine-database-engine/core/filter/literal/matcher.d.ts +2 -1
- package/dist/_pkgs/affine-database-engine/core/filter/literal/matcher.js +3 -2
- package/dist/_pkgs/affine-database-engine/core/filter/literal/types.d.ts +4 -1
- package/dist/_pkgs/affine-database-engine/core/filter/literal/types.js +1 -1
- package/dist/_pkgs/affine-database-engine/core/group-by/define.js +11 -9
- package/dist/_pkgs/affine-database-engine/core/group-by/group-title.js +16 -6
- package/dist/_pkgs/affine-database-engine/core/group-by/locate-row.d.ts +16 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/locate-row.js +32 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/renderer/date-group.js +10 -3
- package/dist/_pkgs/affine-database-engine/core/group-by/setting.d.ts +2 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/setting.js +40 -28
- package/dist/_pkgs/affine-database-engine/core/group-by/trait.d.ts +3 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/trait.js +8 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/types.d.ts +3 -1
- package/dist/_pkgs/affine-database-engine/core/group-by/types.js +1 -1
- package/dist/_pkgs/affine-database-engine/core/property/types.d.ts +7 -0
- package/dist/_pkgs/affine-database-engine/core/property/types.js +1 -1
- package/dist/_pkgs/affine-database-engine/core/sort/add-sort.js +3 -1
- package/dist/_pkgs/affine-database-engine/core/statistics/any.js +43 -21
- package/dist/_pkgs/affine-database-engine/core/statistics/checkbox.js +29 -14
- package/dist/_pkgs/affine-database-engine/core/statistics/number.js +54 -31
- package/dist/_pkgs/affine-database-engine/core/statistics/types.d.ts +8 -0
- package/dist/_pkgs/affine-database-engine/core/statistics/types.js +2 -1
- package/dist/_pkgs/affine-database-engine/core/utils/wording.d.ts +20 -1
- package/dist/_pkgs/affine-database-engine/core/utils/wording.js +24 -0
- package/dist/_pkgs/affine-database-engine/core/view-manager/property.d.ts +7 -0
- package/dist/_pkgs/affine-database-engine/core/view-manager/property.js +29 -5
- package/dist/_pkgs/affine-database-engine/core/view-manager/single-view.d.ts +14 -0
- package/dist/_pkgs/affine-database-engine/core/view-manager/single-view.js +11 -0
- package/dist/_pkgs/affine-database-engine/property-presets/checkbox/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/date/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/multi-select/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/number/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/number/utils/formats.d.ts +3 -0
- package/dist/_pkgs/affine-database-engine/property-presets/number/utils/formats.js +56 -9
- package/dist/_pkgs/affine-database-engine/property-presets/progress/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/select/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/text/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/translations.d.ts +133 -5
- package/dist/_pkgs/affine-database-engine/translations.js +625 -9
- package/dist/_pkgs/affine-database-engine/view-presets/convert.js +0 -28
- package/dist/_pkgs/affine-database-engine/view-presets/effect.js +0 -2
- package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-converts.js +2 -4
- package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-view-ui.d.ts +57 -0
- package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-view-ui.js +113 -4
- package/dist/_pkgs/affine-database-engine/view-presets/gallery/gallery-view.js +2 -1
- package/dist/_pkgs/affine-database-engine/view-presets/index.d.ts +0 -2
- package/dist/_pkgs/affine-database-engine/view-presets/index.js +0 -3
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/kanban-view-manager.js +2 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/group.js +7 -5
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/kanban-view-ui-logic.d.ts +5 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/kanban-view-ui-logic.js +25 -3
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/menu.js +12 -6
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/controller/selection.d.ts +8 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/controller/selection.js +35 -12
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/group.js +7 -5
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/header.js +5 -1
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/kanban-view-ui-logic.d.ts +5 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/kanban-view-ui-logic.js +8 -4
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/menu.js +12 -6
- package/dist/_pkgs/affine-database-engine/view-presets/list/list-view.js +2 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/column-header.js +6 -4
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/group.js +6 -5
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/header.js +2 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/table-view-ui-logic.d.ts +4 -3
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/table-view-ui-logic.js +29 -5
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/controller/clipboard.js +6 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/controller/selection.js +2 -0
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/group.js +6 -5
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/column-header.js +11 -7
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/database-header-column.js +16 -12
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/number-format-bar.js +4 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/menu.js +9 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/table-view-ui-logic.d.ts +8 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/table-view-ui-logic.js +29 -7
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/clipboard.js +6 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/selection.js +2 -0
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/group-footer.js +5 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.d.ts +1 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +14 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-header.js +5 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-title.js +5 -3
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/column-header.js +17 -10
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/number-format-bar.js +4 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/single-column-header.js +20 -14
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/row/menu.js +9 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/table-view-ui-logic.d.ts +6 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/table-view-ui-logic.js +30 -3
- package/dist/_pkgs/affine-database-engine/view-presets/table/stats/column-stats-column.d.ts +1 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/stats/column-stats-column.js +14 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/table-view-manager.js +2 -0
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/condition-view.d.ts +2 -0
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/condition-view.js +13 -6
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/group-panel-view.js +20 -13
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/root-panel-view.js +10 -5
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/sort/root-panel.js +8 -5
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/search/search.js +2 -2
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/table-add-row/add-row.d.ts +6 -0
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/table-add-row/add-row.js +49 -4
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/view-options/view-settings.d.ts +3 -3
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/view-options/view-settings.js +3 -3
- package/dist/_pkgs/affine-database-engine/widget-presets/views-bar/views-view.js +5 -0
- package/dist/_pkgs/affine-database-view-block/configs/slash-menu.js +6 -3
- package/dist/_pkgs/affine-database-view-block/data-view-block.js +5 -4
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +3 -2
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +3 -2
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +31 -0
- package/dist/_pkgs/affine-widget-edgeless-zoom-toolbar/index.js +26 -26
- package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
- package/dist/_pkgs/affine-widget-page-dragging-area/index.js +10 -10
- package/dist/_pkgs/affine-widget-viewport-overlay/index.js +13 -13
- package/package.json +1 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/calendar-view-manager.d.ts +0 -70
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/calendar-view-manager.js +0 -449
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/define.d.ts +0 -10
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/define.js +0 -29
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/effect.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/effect.js +0 -4
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/index.d.ts +0 -6
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/index.js +0 -6
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/layout.d.ts +0 -37
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/layout.js +0 -138
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/actions.d.ts +0 -7
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/actions.js +0 -64
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/dnd.d.ts +0 -32
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/dnd.js +0 -159
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/effect.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/effect.js +0 -7
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/hit-test.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/hit-test.js +0 -28
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/styles.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/styles.js +0 -707
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/view.d.ts +0 -89
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/view.js +0 -849
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/renderer.d.ts +0 -2
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/renderer.js +0 -8
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/source.d.ts +0 -8
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/source.js +0 -3
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/types.d.ts +0 -79
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/types.js +0 -1
|
@@ -2,6 +2,9 @@ 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
|
+
import { DATA_VIEW_ROWS_DELETE, DATA_VIEW_ROW_EXPAND, DATA_VIEW_ROW_INSERT_BEFORE, DATA_VIEW_ROW_INSERT_AFTER, DATA_VIEW_ROW_DELETE, } from '../../../translations.js';
|
|
6
|
+
import { TOOLBAR_COPY } from '../../../../affine-shared/services/index.js';
|
|
7
|
+
import { wordingFrom } from '../../../core/utils/wording.js';
|
|
5
8
|
export const openDetail = (tableViewLogic, rowId, selection, newTab = false) => {
|
|
6
9
|
const old = selection.selection;
|
|
7
10
|
selection.selection = undefined;
|
|
@@ -26,7 +29,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
26
29
|
name: '',
|
|
27
30
|
items: [
|
|
28
31
|
menu.action({
|
|
29
|
-
name:
|
|
32
|
+
name: wordingFrom(ele.element)(TOOLBAR_COPY),
|
|
30
33
|
prefix: html ` <div
|
|
31
34
|
style="transform: rotate(90deg);display:flex;align-items:center;"
|
|
32
35
|
>
|
|
@@ -42,7 +45,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
42
45
|
name: '',
|
|
43
46
|
items: [
|
|
44
47
|
menu.action({
|
|
45
|
-
name:
|
|
48
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROWS_DELETE),
|
|
46
49
|
class: {
|
|
47
50
|
'delete-item': true,
|
|
48
51
|
},
|
|
@@ -62,7 +65,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
62
65
|
return;
|
|
63
66
|
popFilterableSimpleMenu(ele, [
|
|
64
67
|
menu.action({
|
|
65
|
-
name:
|
|
68
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_EXPAND),
|
|
66
69
|
prefix: ExpandFullIcon(),
|
|
67
70
|
select: () => {
|
|
68
71
|
openDetail(tableViewLogic, row.id, selectionController);
|
|
@@ -72,7 +75,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
72
75
|
name: '',
|
|
73
76
|
items: [
|
|
74
77
|
menu.action({
|
|
75
|
-
name:
|
|
78
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_INSERT_BEFORE),
|
|
76
79
|
prefix: html ` <div
|
|
77
80
|
style="transform: rotate(90deg);display:flex;align-items:center;"
|
|
78
81
|
>
|
|
@@ -83,7 +86,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
83
86
|
},
|
|
84
87
|
}),
|
|
85
88
|
menu.action({
|
|
86
|
-
name:
|
|
89
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_INSERT_AFTER),
|
|
87
90
|
prefix: html ` <div
|
|
88
91
|
style="transform: rotate(90deg);display:flex;align-items:center;"
|
|
89
92
|
>
|
|
@@ -98,7 +101,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
98
101
|
menu.group({
|
|
99
102
|
items: [
|
|
100
103
|
menu.action({
|
|
101
|
-
name:
|
|
104
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_DELETE),
|
|
102
105
|
class: { 'delete-item': true },
|
|
103
106
|
prefix: DeleteIcon(),
|
|
104
107
|
select: () => {
|
|
@@ -2,7 +2,7 @@ import type { InsertToPosition } from '../../../../affine-shared/utils/index.js'
|
|
|
2
2
|
import type { TemplateResult } from 'lit';
|
|
3
3
|
import type { GroupTrait } from '../../../core/group-by/trait.js';
|
|
4
4
|
import { DataViewUIBase, DataViewUILogicBase } from '../../../core/view/data-view-base.js';
|
|
5
|
-
import type
|
|
5
|
+
import { type TableViewSelectionWithType } from '../selection.js';
|
|
6
6
|
import type { TableSingleView } from '../table-view-manager.js';
|
|
7
7
|
import { TableClipboardController } from './controller/clipboard.js';
|
|
8
8
|
import { TableDragController } from './controller/drag.js';
|
|
@@ -18,7 +18,14 @@ export declare class TableViewUILogic extends DataViewUILogicBase<TableSingleVie
|
|
|
18
18
|
selectionController: TableSelectionController;
|
|
19
19
|
private get readonly();
|
|
20
20
|
clearSelection: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* "New" adds the row and puts its title in editing, as the table's own
|
|
23
|
+
* "New record" footer does: it no longer opens the row (product owner,
|
|
24
|
+
* recette P3-15). Nothing is written but the row.
|
|
25
|
+
*/
|
|
21
26
|
addRow: (position: InsertToPosition) => string | undefined;
|
|
27
|
+
/** Selects the title cell of `rowId` in editing, once the row is drawn. */
|
|
28
|
+
editRowTitle(rowId: string): void;
|
|
22
29
|
focusFirstCell: () => void;
|
|
23
30
|
showIndicator: (evt: MouseEvent) => boolean;
|
|
24
31
|
hideIndicator: () => void;
|
|
@@ -5,14 +5,18 @@ import { ref } from 'lit/directives/ref.js';
|
|
|
5
5
|
import { repeat } from 'lit/directives/repeat.js';
|
|
6
6
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
7
7
|
import { html } from 'lit/static-html.js';
|
|
8
|
+
import { locateRow } from '../../../core/group-by/locate-row.js';
|
|
8
9
|
import { createUniComponentFromWebComponent, renderUniLit, } from '../../../core/index.js';
|
|
9
10
|
import { PageLayoutKey } from '../../../core/view-manager/page-layout.js';
|
|
10
11
|
import { DataViewUIBase, DataViewUILogicBase, } from '../../../core/view/data-view-base.js';
|
|
12
|
+
import { TableViewAreaSelection, } from '../selection.js';
|
|
11
13
|
import { TableClipboardController } from './controller/clipboard.js';
|
|
12
14
|
import { TableDragController } from './controller/drag.js';
|
|
13
15
|
import { TableHotkeysController } from './controller/hotkeys.js';
|
|
14
16
|
import { TableSelectionController } from './controller/selection.js';
|
|
15
17
|
import { addGroupIconStyle, addGroupStyle, tableGroupsContainerStyle, tableScrollContainerStyle, tableViewStyle, tableWrapperStyle, } from './table-view-style.js';
|
|
18
|
+
import { DATA_VIEW_GROUP_NEW } from '../../../translations.js';
|
|
19
|
+
import { wordingFrom } from '../../../core/utils/wording.js';
|
|
16
20
|
export class TableViewUILogic extends DataViewUILogicBase {
|
|
17
21
|
constructor() {
|
|
18
22
|
super(...arguments);
|
|
@@ -26,16 +30,17 @@ export class TableViewUILogic extends DataViewUILogicBase {
|
|
|
26
30
|
this.clearSelection = () => {
|
|
27
31
|
this.selectionController.clear();
|
|
28
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* "New" adds the row and puts its title in editing, as the table's own
|
|
35
|
+
* "New record" footer does: it no longer opens the row (product owner,
|
|
36
|
+
* recette P3-15). Nothing is written but the row.
|
|
37
|
+
*/
|
|
29
38
|
this.addRow = (position) => {
|
|
30
39
|
if (this.readonly)
|
|
31
40
|
return;
|
|
32
41
|
const rowId = this.view.rowAdd(position);
|
|
33
|
-
if (rowId)
|
|
34
|
-
this.
|
|
35
|
-
view: this.view,
|
|
36
|
-
rowId,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
42
|
+
if (rowId)
|
|
43
|
+
this.editRowTitle(rowId);
|
|
39
44
|
return rowId;
|
|
40
45
|
};
|
|
41
46
|
this.focusFirstCell = () => {
|
|
@@ -95,7 +100,7 @@ export class TableViewUILogic extends DataViewUILogicBase {
|
|
|
95
100
|
return html ` <div style="display:flex;">
|
|
96
101
|
<div class="${addGroupStyle}" @click="${add}">
|
|
97
102
|
<div class="${addGroupIconStyle}">${AddCursorIcon()}</div>
|
|
98
|
-
<div
|
|
103
|
+
<div>${wordingFrom(this.ui$.value)(DATA_VIEW_GROUP_NEW)}</div>
|
|
99
104
|
</div>
|
|
100
105
|
</div>`;
|
|
101
106
|
};
|
|
@@ -104,6 +109,23 @@ export class TableViewUILogic extends DataViewUILogicBase {
|
|
|
104
109
|
get readonly() {
|
|
105
110
|
return this.view.readonly$.value;
|
|
106
111
|
}
|
|
112
|
+
/** Selects the title cell of `rowId` in editing, once the row is drawn. */
|
|
113
|
+
editRowTitle(rowId) {
|
|
114
|
+
requestAnimationFrame(() => {
|
|
115
|
+
const view = this.view;
|
|
116
|
+
const at = locateRow(view.groupTrait, view.rows$.peek(), rowId);
|
|
117
|
+
const columnIndex = view.properties$
|
|
118
|
+
.peek()
|
|
119
|
+
.findIndex(property => property.type$.peek() === 'title');
|
|
120
|
+
if (!at || columnIndex < 0)
|
|
121
|
+
return;
|
|
122
|
+
this.selectionController.selection = TableViewAreaSelection.create({
|
|
123
|
+
groupKey: at.groupKey,
|
|
124
|
+
focus: { rowIndex: at.rowIndex, columnIndex },
|
|
125
|
+
isEditing: true,
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
107
129
|
}
|
|
108
130
|
export class TableViewUI extends DataViewUIBase {
|
|
109
131
|
connectedCallback() {
|
package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/clipboard.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DisposableGroup } from '../../../../../global/disposable/index.js';
|
|
2
2
|
import { TableViewAreaSelection, TableViewRowSelection, } from '../../selection.js';
|
|
3
|
+
import { DATA_VIEW_CELLS_COPIED, DATA_VIEW_ROWS_COPIED, } from '../../../../translations.js';
|
|
4
|
+
import { wordingFrom } from '../../../../core/utils/wording.js';
|
|
3
5
|
const BLOCKSUITE_DATABASE_TABLE = 'blocksuite/database/table';
|
|
4
6
|
const TEXT = 'text/plain';
|
|
5
7
|
export class TableClipboardController {
|
|
@@ -51,11 +53,13 @@ export class TableClipboardController {
|
|
|
51
53
|
})
|
|
52
54
|
.then(() => {
|
|
53
55
|
if (area[0]?.row) {
|
|
54
|
-
this.notification.toast(
|
|
56
|
+
this.notification.toast(wordingFrom(this.logic.ui$.value)(DATA_VIEW_ROWS_COPIED, {
|
|
57
|
+
count: area.length,
|
|
58
|
+
}));
|
|
55
59
|
}
|
|
56
60
|
else {
|
|
57
61
|
const count = area.flatMap(row => row.cells).length;
|
|
58
|
-
this.notification.toast(
|
|
62
|
+
this.notification.toast(wordingFrom(this.logic.ui$.value)(DATA_VIEW_CELLS_COPIED, { count }));
|
|
59
63
|
}
|
|
60
64
|
})
|
|
61
65
|
.catch(console.error);
|
package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/selection.js
CHANGED
|
@@ -231,6 +231,8 @@ export class TableSelectionController {
|
|
|
231
231
|
}
|
|
232
232
|
insertTo(groupKey, rowId, before) {
|
|
233
233
|
const id = this.view.rowAdd({ before, id: rowId });
|
|
234
|
+
if (!id)
|
|
235
|
+
return;
|
|
234
236
|
if (groupKey != null) {
|
|
235
237
|
this.view.groupTrait.moveCardTo(id, undefined, groupKey, {
|
|
236
238
|
before,
|
package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/group-footer.js
CHANGED
|
@@ -40,6 +40,8 @@ import { html } from 'lit';
|
|
|
40
40
|
import { property } from 'lit/decorators.js';
|
|
41
41
|
import { TableViewAreaSelection } from '../../../selection.js';
|
|
42
42
|
import * as styles from './group-footer-css.js';
|
|
43
|
+
import { DATA_VIEW_NEW_RECORD } from '../../../../../translations.js';
|
|
44
|
+
import { wordingFrom } from '../../../../../core/utils/wording.js';
|
|
43
45
|
let TableGroupFooter = (() => {
|
|
44
46
|
let _classSuper = WithDisposable(ShadowlessElement);
|
|
45
47
|
let _tableViewLogic_decorators;
|
|
@@ -112,7 +114,8 @@ let TableGroupFooter = (() => {
|
|
|
112
114
|
}
|
|
113
115
|
render() {
|
|
114
116
|
return html `
|
|
115
|
-
${this.tableViewManager.readonly$.value
|
|
117
|
+
${this.tableViewManager.readonly$.value ||
|
|
118
|
+
this.tableViewManager.rowsLocked$.value
|
|
116
119
|
? null
|
|
117
120
|
: html `
|
|
118
121
|
<div
|
|
@@ -125,7 +128,7 @@ let TableGroupFooter = (() => {
|
|
|
125
128
|
role="button"
|
|
126
129
|
>
|
|
127
130
|
${PlusIcon()}<span class="${styles.addRowText}"
|
|
128
|
-
|
|
131
|
+
>${wordingFrom(this)(DATA_VIEW_NEW_RECORD)}</span
|
|
129
132
|
>
|
|
130
133
|
</div>
|
|
131
134
|
</div>
|
|
@@ -12,7 +12,7 @@ export declare class VirtualDatabaseColumnStatsCell extends VirtualDatabaseColum
|
|
|
12
12
|
statsFunc$: import("@preact/signals-core").ReadonlySignal<StatisticsConfig | undefined>;
|
|
13
13
|
values$: import("@preact/signals-core").Signal<unknown[]>;
|
|
14
14
|
statsResult$: import("@preact/signals-core").ReadonlySignal<{
|
|
15
|
-
name: string
|
|
15
|
+
name: string;
|
|
16
16
|
value: string;
|
|
17
17
|
} | null>;
|
|
18
18
|
subscriptionMap: Map<unknown, () => void>;
|
|
@@ -44,6 +44,9 @@ import { property } from 'lit/decorators.js';
|
|
|
44
44
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
45
45
|
import { typeSystem, VALUES_PENDING_MARK, valuesReady, } from '../../../../../../core/index.js';
|
|
46
46
|
import { statsFunctions } from '../../../../../../core/statistics/index.js';
|
|
47
|
+
import { sayLabel, wordingFrom } from '../../../../../../core/utils/wording.js';
|
|
48
|
+
import { DATA_VIEW_STATS_CALCULATE } from '../../../../../../translations.js';
|
|
49
|
+
import { LINE_STYLE_NONE } from '../../../../../../../affine-components/translations.js';
|
|
47
50
|
const styles = css `
|
|
48
51
|
.stats-cell {
|
|
49
52
|
cursor: pointer;
|
|
@@ -158,7 +161,8 @@ let VirtualDatabaseColumnStatsCell = (() => {
|
|
|
158
161
|
>
|
|
159
162
|
<div class="content">
|
|
160
163
|
${!this.statsResult$.value
|
|
161
|
-
? html
|
|
164
|
+
? html `${wordingFrom(this)(DATA_VIEW_STATS_CALCULATE)}
|
|
165
|
+
${ArrowDownSmallIcon()}`
|
|
162
166
|
: html `
|
|
163
167
|
<span class="label">${this.statsResult$.value.name}</span>
|
|
164
168
|
<span class="value">${this.statsResult$.value.value} </span>
|
|
@@ -205,14 +209,15 @@ let VirtualDatabaseColumnStatsCell = (() => {
|
|
|
205
209
|
return groups;
|
|
206
210
|
});
|
|
207
211
|
this.openMenu = (ev) => {
|
|
212
|
+
const wording = wordingFrom(this);
|
|
208
213
|
const menus = Object.entries(this.groups$.value).map(([group, funcs]) => {
|
|
209
214
|
return menu.subMenu({
|
|
210
|
-
name: group,
|
|
215
|
+
name: sayLabel(wording, group, Object.values(funcs)[0]?.groupWording),
|
|
211
216
|
options: {
|
|
212
217
|
items: Object.values(funcs).map(func => {
|
|
213
218
|
return menu.action({
|
|
214
219
|
isSelected: func.type === this.column.statCalcOp$.value,
|
|
215
|
-
name: func.menuName ?? func.type,
|
|
220
|
+
name: sayLabel(wording, func.menuName ?? func.type, func.menuWording),
|
|
216
221
|
select: () => {
|
|
217
222
|
this.column.updateStatCalcOp(func.type);
|
|
218
223
|
},
|
|
@@ -226,7 +231,7 @@ let VirtualDatabaseColumnStatsCell = (() => {
|
|
|
226
231
|
items: [
|
|
227
232
|
menu.action({
|
|
228
233
|
isSelected: !this.column.statCalcOp$.value,
|
|
229
|
-
name:
|
|
234
|
+
name: wording(LINE_STYLE_NONE),
|
|
230
235
|
select: () => {
|
|
231
236
|
this.column.updateStatCalcOp();
|
|
232
237
|
},
|
|
@@ -256,14 +261,17 @@ let VirtualDatabaseColumnStatsCell = (() => {
|
|
|
256
261
|
return null;
|
|
257
262
|
}
|
|
258
263
|
const dataSource = this.column.view.manager.dataSource;
|
|
264
|
+
const wording = wordingFrom(this);
|
|
265
|
+
const name = sayLabel(wording, func.displayName ?? '', func.displayWording);
|
|
259
266
|
if (!valuesReady(dataSource)) {
|
|
260
|
-
return { name
|
|
267
|
+
return { name, value: VALUES_PENDING_MARK };
|
|
261
268
|
}
|
|
262
269
|
return {
|
|
263
|
-
name
|
|
270
|
+
name,
|
|
264
271
|
value: func.impl?.(this.values$.value, {
|
|
265
272
|
meta,
|
|
266
273
|
dataSource: this.column.view.manager.dataSource,
|
|
274
|
+
wording,
|
|
267
275
|
}) ?? '',
|
|
268
276
|
};
|
|
269
277
|
});
|
package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-header.js
CHANGED
|
@@ -41,6 +41,9 @@ import { property } from 'lit/decorators.js';
|
|
|
41
41
|
import { TableViewAreaSelection } from '../../../selection.js';
|
|
42
42
|
import * as styles from './group-header-css.js';
|
|
43
43
|
import { GroupTitle } from './group-title.js';
|
|
44
|
+
import { DATA_VIEW_GROUP_DELETE_CARDS } from '../../../../../translations.js';
|
|
45
|
+
import { wordingFrom } from '../../../../../core/utils/wording.js';
|
|
46
|
+
import { TOOLBAR_UNGROUP } from '../../../../../../affine-shared/services/index.js';
|
|
44
47
|
let TableGroupHeader = (() => {
|
|
45
48
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
46
49
|
let _tableViewLogic_decorators;
|
|
@@ -89,7 +92,7 @@ let TableGroupHeader = (() => {
|
|
|
89
92
|
const ele = e.currentTarget;
|
|
90
93
|
popFilterableSimpleMenu(popupTargetFromElement(ele), [
|
|
91
94
|
menu.action({
|
|
92
|
-
name:
|
|
95
|
+
name: wordingFrom(this)(TOOLBAR_UNGROUP),
|
|
93
96
|
hide: () => group.value == null,
|
|
94
97
|
select: () => {
|
|
95
98
|
group.rows.forEach(row => {
|
|
@@ -98,7 +101,7 @@ let TableGroupHeader = (() => {
|
|
|
98
101
|
},
|
|
99
102
|
}),
|
|
100
103
|
menu.action({
|
|
101
|
-
name:
|
|
104
|
+
name: wordingFrom(this)(DATA_VIEW_GROUP_DELETE_CARDS),
|
|
102
105
|
select: () => {
|
|
103
106
|
this.tableViewManager.rowsDelete(group.rows.map(row => row.rowId));
|
|
104
107
|
this.requestUpdate();
|
package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-title.js
CHANGED
|
@@ -44,9 +44,11 @@ export const GroupTitle = (groupData, ops) => {
|
|
|
44
44
|
</div>
|
|
45
45
|
${!ops.readonly
|
|
46
46
|
? html ` <div class="${opsClass}">
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
${groupData.property.view.rowsLocked$.value
|
|
48
|
+
? nothing
|
|
49
|
+
: html `<div @click="${ops.clickAdd}" class="${groupHeaderOp}">
|
|
50
|
+
${PlusIcon()}
|
|
51
|
+
</div>`}
|
|
50
52
|
<div @click="${ops.clickOps}" class="${groupHeaderOp}">
|
|
51
53
|
${MoreHorizontalIcon()}
|
|
52
54
|
</div>
|
|
@@ -46,6 +46,8 @@ import { renderUniLit } from '../../../../../../core/index.js';
|
|
|
46
46
|
import { LEFT_TOOL_BAR_WIDTH } from '../../../../consts.js';
|
|
47
47
|
import { cellDivider } from '../../../../styles.js';
|
|
48
48
|
import * as styles from './column-header-css.js';
|
|
49
|
+
import { propertyTypeName, wordingFrom, } from '../../../../../../core/utils/wording.js';
|
|
50
|
+
import { DATA_VIEW_PROPERTY_TYPE } from '../../../../../../translations.js';
|
|
49
51
|
const leftBarStyle = css({
|
|
50
52
|
width: LEFT_TOOL_BAR_WIDTH,
|
|
51
53
|
});
|
|
@@ -94,12 +96,16 @@ let VirtualTableHeader = (() => {
|
|
|
94
96
|
<div class="${cellDivider}" style="height: auto;"></div>
|
|
95
97
|
`;
|
|
96
98
|
})}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
${this.tableViewManager.propertiesLocked$.value
|
|
100
|
+
? // The column keeps its place, so the header stays aligned.
|
|
101
|
+
html `<div class="${styles.headerAddColumnButton}"></div>`
|
|
102
|
+
: html `<div
|
|
103
|
+
@click="${this._onAddColumn}"
|
|
104
|
+
class="${styles.headerAddColumnButton}"
|
|
105
|
+
data-testid="dv-table-add-column"
|
|
106
|
+
>
|
|
107
|
+
${PlusIcon()}
|
|
108
|
+
</div>`}
|
|
103
109
|
<div class="scale-div" style="width: 1px;height: 1px;"></div>
|
|
104
110
|
</div>
|
|
105
111
|
`;
|
|
@@ -116,24 +122,25 @@ let VirtualTableHeader = (() => {
|
|
|
116
122
|
constructor() {
|
|
117
123
|
super(...arguments);
|
|
118
124
|
this._onAddColumn = (e) => {
|
|
119
|
-
if (this.readonly)
|
|
125
|
+
if (this.readonly || this.tableViewManager.propertiesLocked$.value)
|
|
120
126
|
return;
|
|
121
127
|
const ele = e.currentTarget;
|
|
128
|
+
const wording = wordingFrom(ele);
|
|
122
129
|
popMenu(popupTargetFromElement(ele), {
|
|
123
130
|
options: {
|
|
124
131
|
title: {
|
|
125
|
-
text:
|
|
132
|
+
text: wording(DATA_VIEW_PROPERTY_TYPE),
|
|
126
133
|
},
|
|
127
134
|
items: [
|
|
128
135
|
menu.group({
|
|
129
136
|
items: this.tableViewManager.propertyMetas$.value.map(config => {
|
|
130
137
|
return menu.action({
|
|
131
|
-
name: config.config
|
|
138
|
+
name: propertyTypeName(wording, config.config),
|
|
132
139
|
prefix: renderUniLit(config.renderer.icon),
|
|
133
140
|
select: () => {
|
|
134
141
|
const id = this.tableViewManager.propertyAdd('end', {
|
|
135
142
|
type: config.type,
|
|
136
|
-
name: config.config
|
|
143
|
+
name: propertyTypeName(wording, config.config),
|
|
137
144
|
});
|
|
138
145
|
if (id) {
|
|
139
146
|
requestAnimationFrame(() => {
|
|
@@ -37,6 +37,8 @@ import { cssVarV2 } from '@toeverything/theme/v2';
|
|
|
37
37
|
import { css, html, LitElement, unsafeCSS } from 'lit';
|
|
38
38
|
import { property } from 'lit/decorators.js';
|
|
39
39
|
import { formatNumber } from '../../../../../../property-presets/number/utils/formatter.js';
|
|
40
|
+
import { DATA_VIEW_DECIMALS_DECREASE, DATA_VIEW_DECIMALS_INCREASE, } from '../../../../../../translations.js';
|
|
41
|
+
import { wordingFrom } from '../../../../../../core/utils/wording.js';
|
|
40
42
|
const IncreaseDecimalPlacesIcon = html `
|
|
41
43
|
<svg
|
|
42
44
|
width="24"
|
|
@@ -133,7 +135,7 @@ let DatabaseNumberFormatBar = (() => {
|
|
|
133
135
|
<div class="number-format-decimal-places">
|
|
134
136
|
<button
|
|
135
137
|
class="number-format-toolbar-button"
|
|
136
|
-
aria-label="
|
|
138
|
+
aria-label="${wordingFrom(this)(DATA_VIEW_DECIMALS_DECREASE)}"
|
|
137
139
|
@click=${this._decrementDecimalPlaces}
|
|
138
140
|
>
|
|
139
141
|
${DecreaseDecimalPlacesIcon}
|
|
@@ -141,7 +143,7 @@ let DatabaseNumberFormatBar = (() => {
|
|
|
141
143
|
|
|
142
144
|
<button
|
|
143
145
|
class="number-format-toolbar-button"
|
|
144
|
-
aria-label="
|
|
146
|
+
aria-label="${wordingFrom(this)(DATA_VIEW_DECIMALS_INCREASE)}"
|
|
145
147
|
@click=${this._incrementDecimalPlaces}
|
|
146
148
|
>
|
|
147
149
|
${IncreaseDecimalPlacesIcon}
|
|
@@ -53,6 +53,9 @@ import { numberFormats } from '../../../../../../property-presets/number/utils/f
|
|
|
53
53
|
import { createDefaultShowQuickSettingBar, ShowQuickSettingBarKey, } from '../../../../../../widget-presets/quick-setting-bar/context.js';
|
|
54
54
|
import { DEFAULT_COLUMN_TITLE_HEIGHT } from '../../../../consts.js';
|
|
55
55
|
import { getTableGroupRect, getVerticalIndicator, startDragWidthAdjustmentBar, } from './vertical-indicator.js';
|
|
56
|
+
import { propertyTypeName, wordingFrom, } from '../../../../../../core/utils/wording.js';
|
|
57
|
+
import { DATA_VIEW_NUMBER_FORMAT, DATA_VIEW_FILTER, DATA_VIEW_SORT_ASCENDING, DATA_VIEW_SORT_DESCENDING, DATA_VIEW_INSERT_LEFT, DATA_VIEW_INSERT_RIGHT, VIEWS_BAR_MOVE_LEFT, VIEWS_BAR_MOVE_RIGHT, DATA_VIEW_PROPERTY_HIDE_IN_VIEW, } from '../../../../../../translations.js';
|
|
58
|
+
import { TOOLBAR_DUPLICATE, TOOLBAR_DELETE, } from '../../../../../../../affine-shared/services/index.js';
|
|
56
59
|
let DatabaseHeaderColumn = (() => {
|
|
57
60
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
58
61
|
let _column_decorators;
|
|
@@ -141,7 +144,7 @@ let DatabaseHeaderColumn = (() => {
|
|
|
141
144
|
...(enableNumberFormatting
|
|
142
145
|
? [
|
|
143
146
|
menu.subMenu({
|
|
144
|
-
name:
|
|
147
|
+
name: wordingFrom(this)(DATA_VIEW_NUMBER_FORMAT),
|
|
145
148
|
hide: () => !this.column.dataUpdate ||
|
|
146
149
|
this.column.type$.value !== 'number',
|
|
147
150
|
options: {
|
|
@@ -155,7 +158,7 @@ let DatabaseHeaderColumn = (() => {
|
|
|
155
158
|
style="font-size: var(--affine-font-base); scale: 1.2;"
|
|
156
159
|
>${format.symbol}</span
|
|
157
160
|
>`,
|
|
158
|
-
name: format.
|
|
161
|
+
name: wordingFrom(this)(format.labelWording),
|
|
159
162
|
select: () => {
|
|
160
163
|
if (data.format === format.type)
|
|
161
164
|
return;
|
|
@@ -174,7 +177,7 @@ let DatabaseHeaderColumn = (() => {
|
|
|
174
177
|
menu.group({
|
|
175
178
|
items: [
|
|
176
179
|
menu.action({
|
|
177
|
-
name:
|
|
180
|
+
name: wordingFrom(this)(DATA_VIEW_PROPERTY_HIDE_IN_VIEW),
|
|
178
181
|
prefix: ViewIcon(),
|
|
179
182
|
hide: () => !this.column.hideCanSet,
|
|
180
183
|
select: () => {
|
|
@@ -186,17 +189,17 @@ let DatabaseHeaderColumn = (() => {
|
|
|
186
189
|
menu.group({
|
|
187
190
|
items: [
|
|
188
191
|
menu.action({
|
|
189
|
-
name:
|
|
192
|
+
name: wordingFrom(this)(DATA_VIEW_FILTER),
|
|
190
193
|
prefix: FilterIcon(),
|
|
191
194
|
select: () => this._addFilter(),
|
|
192
195
|
}),
|
|
193
196
|
menu.action({
|
|
194
|
-
name:
|
|
197
|
+
name: wordingFrom(this)(DATA_VIEW_SORT_ASCENDING),
|
|
195
198
|
prefix: SortIcon(),
|
|
196
199
|
select: () => this._addSort(false),
|
|
197
200
|
}),
|
|
198
201
|
menu.action({
|
|
199
|
-
name:
|
|
202
|
+
name: wordingFrom(this)(DATA_VIEW_SORT_DESCENDING),
|
|
200
203
|
prefix: SortIcon(),
|
|
201
204
|
select: () => this._addSort(true),
|
|
202
205
|
}),
|
|
@@ -205,7 +208,8 @@ let DatabaseHeaderColumn = (() => {
|
|
|
205
208
|
menu.group({
|
|
206
209
|
items: [
|
|
207
210
|
menu.action({
|
|
208
|
-
name:
|
|
211
|
+
name: wordingFrom(this)(DATA_VIEW_INSERT_LEFT),
|
|
212
|
+
hide: () => this.tableViewManager.propertiesLocked$.value,
|
|
209
213
|
prefix: InsertLeftIcon(),
|
|
210
214
|
select: () => {
|
|
211
215
|
this.tableViewManager.propertyAdd({
|
|
@@ -227,7 +231,8 @@ let DatabaseHeaderColumn = (() => {
|
|
|
227
231
|
},
|
|
228
232
|
}),
|
|
229
233
|
menu.action({
|
|
230
|
-
name:
|
|
234
|
+
name: wordingFrom(this)(DATA_VIEW_INSERT_RIGHT),
|
|
235
|
+
hide: () => this.tableViewManager.propertiesLocked$.value,
|
|
231
236
|
prefix: InsertRightIcon(),
|
|
232
237
|
select: () => {
|
|
233
238
|
this.tableViewManager.propertyAdd({
|
|
@@ -249,7 +254,7 @@ let DatabaseHeaderColumn = (() => {
|
|
|
249
254
|
},
|
|
250
255
|
}),
|
|
251
256
|
menu.action({
|
|
252
|
-
name:
|
|
257
|
+
name: wordingFrom(this)(VIEWS_BAR_MOVE_LEFT),
|
|
253
258
|
prefix: MoveLeftIcon(),
|
|
254
259
|
hide: () => this.column.isFirst$.value,
|
|
255
260
|
select: () => {
|
|
@@ -264,7 +269,7 @@ let DatabaseHeaderColumn = (() => {
|
|
|
264
269
|
},
|
|
265
270
|
}),
|
|
266
271
|
menu.action({
|
|
267
|
-
name:
|
|
272
|
+
name: wordingFrom(this)(VIEWS_BAR_MOVE_RIGHT),
|
|
268
273
|
prefix: MoveRightIcon(),
|
|
269
274
|
hide: () => this.column.isLast$.value,
|
|
270
275
|
select: () => {
|
|
@@ -283,7 +288,7 @@ let DatabaseHeaderColumn = (() => {
|
|
|
283
288
|
menu.group({
|
|
284
289
|
items: [
|
|
285
290
|
menu.action({
|
|
286
|
-
name:
|
|
291
|
+
name: wordingFrom(this)(TOOLBAR_DUPLICATE),
|
|
287
292
|
prefix: DuplicateIcon(),
|
|
288
293
|
hide: () => !this.column.canDuplicate,
|
|
289
294
|
select: () => {
|
|
@@ -291,7 +296,7 @@ let DatabaseHeaderColumn = (() => {
|
|
|
291
296
|
},
|
|
292
297
|
}),
|
|
293
298
|
menu.action({
|
|
294
|
-
name:
|
|
299
|
+
name: wordingFrom(this)(TOOLBAR_DELETE),
|
|
295
300
|
prefix: DeleteIcon(),
|
|
296
301
|
hide: () => !this.column.canDelete,
|
|
297
302
|
select: () => {
|
|
@@ -403,15 +408,16 @@ let DatabaseHeaderColumn = (() => {
|
|
|
403
408
|
if (this.tableViewManager.readonly$.value) {
|
|
404
409
|
return;
|
|
405
410
|
}
|
|
406
|
-
if (this.column.type$.value === 'title') {
|
|
411
|
+
if (this.column.type$.value === 'title' || !this.column.typeCanSet) {
|
|
407
412
|
return;
|
|
408
413
|
}
|
|
409
414
|
event.stopPropagation();
|
|
415
|
+
const wording = wordingFrom(this);
|
|
410
416
|
popMenu(popupTargetFromElement(this), {
|
|
411
417
|
options: {
|
|
412
418
|
items: this.tableViewManager.propertyMetas$.value.map(config => {
|
|
413
419
|
return menu.action({
|
|
414
|
-
name: config.config
|
|
420
|
+
name: propertyTypeName(wording, config.config),
|
|
415
421
|
isSelected: config.type === this.column.type$.value,
|
|
416
422
|
prefix: renderUniLit(config.renderer.icon),
|
|
417
423
|
select: () => {
|
|
@@ -2,6 +2,9 @@ import { menu, popFilterableSimpleMenu, } from '../../../../../affine-components
|
|
|
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
|
+
import { DATA_VIEW_ROWS_DELETE, DATA_VIEW_ROW_EXPAND, DATA_VIEW_ROW_INSERT_BEFORE, DATA_VIEW_ROW_INSERT_AFTER, DATA_VIEW_ROW_DELETE, } from '../../../../translations.js';
|
|
6
|
+
import { TOOLBAR_COPY } from '../../../../../affine-shared/services/index.js';
|
|
7
|
+
import { wordingFrom } from '../../../../core/utils/wording.js';
|
|
5
8
|
export const openDetail = (tableViewLogic, rowId, selection) => {
|
|
6
9
|
const old = selection.selection;
|
|
7
10
|
selection.selection = undefined;
|
|
@@ -25,7 +28,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
25
28
|
name: '',
|
|
26
29
|
items: [
|
|
27
30
|
menu.action({
|
|
28
|
-
name:
|
|
31
|
+
name: wordingFrom(ele.element)(TOOLBAR_COPY),
|
|
29
32
|
prefix: html ` <div
|
|
30
33
|
style="transform: rotate(90deg);display:flex;align-items:center;"
|
|
31
34
|
>
|
|
@@ -41,7 +44,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
41
44
|
name: '',
|
|
42
45
|
items: [
|
|
43
46
|
menu.action({
|
|
44
|
-
name:
|
|
47
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROWS_DELETE),
|
|
45
48
|
class: {
|
|
46
49
|
'delete-item': true,
|
|
47
50
|
},
|
|
@@ -61,7 +64,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
61
64
|
return;
|
|
62
65
|
popFilterableSimpleMenu(ele, [
|
|
63
66
|
menu.action({
|
|
64
|
-
name:
|
|
67
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_EXPAND),
|
|
65
68
|
prefix: ExpandFullIcon(),
|
|
66
69
|
select: () => {
|
|
67
70
|
openDetail(tableViewLogic, row.id, selectionController);
|
|
@@ -71,7 +74,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
71
74
|
name: '',
|
|
72
75
|
items: [
|
|
73
76
|
menu.action({
|
|
74
|
-
name:
|
|
77
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_INSERT_BEFORE),
|
|
75
78
|
prefix: html ` <div
|
|
76
79
|
style="transform: rotate(90deg);display:flex;align-items:center;"
|
|
77
80
|
>
|
|
@@ -82,7 +85,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
82
85
|
},
|
|
83
86
|
}),
|
|
84
87
|
menu.action({
|
|
85
|
-
name:
|
|
88
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_INSERT_AFTER),
|
|
86
89
|
prefix: html ` <div
|
|
87
90
|
style="transform: rotate(90deg);display:flex;align-items:center;"
|
|
88
91
|
>
|
|
@@ -97,7 +100,7 @@ export const popRowMenu = (tableViewLogic, ele, selectionController) => {
|
|
|
97
100
|
menu.group({
|
|
98
101
|
items: [
|
|
99
102
|
menu.action({
|
|
100
|
-
name:
|
|
103
|
+
name: wordingFrom(ele.element)(DATA_VIEW_ROW_DELETE),
|
|
101
104
|
class: { 'delete-item': true },
|
|
102
105
|
prefix: DeleteIcon(),
|
|
103
106
|
select: () => {
|
package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/table-view-ui-logic.d.ts
CHANGED
|
@@ -26,7 +26,12 @@ export declare class VirtualTableViewUILogic extends DataViewUILogicBase<TableSi
|
|
|
26
26
|
rows: string[];
|
|
27
27
|
}[]>;
|
|
28
28
|
clearSelection: () => void;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* "New" adds the row and puts its title in editing, as the table's own
|
|
31
|
+
* "New record" footer does: it no longer opens the row (product owner,
|
|
32
|
+
* recette P3-15). Nothing is written but the row.
|
|
33
|
+
*/
|
|
34
|
+
addRow: (position: InsertToPosition) => string | undefined;
|
|
30
35
|
focusFirstCell: () => void;
|
|
31
36
|
showIndicator: (evt: MouseEvent) => boolean;
|
|
32
37
|
hideIndicator: () => void;
|