@formicoidea/labre-core 0.53.0 → 0.54.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.
Files changed (85) hide show
  1. package/dist/_pkgs/affine-block-data-view/data-view-block.js +1 -1
  2. package/dist/_pkgs/affine-block-database/components/title/index.js +7 -2
  3. package/dist/_pkgs/affine-block-database/database-block-styles.js +9 -1
  4. package/dist/_pkgs/affine-block-embed-doc/page-drop/page-drop.d.ts +70 -0
  5. package/dist/_pkgs/affine-block-embed-doc/page-drop/page-drop.js +196 -0
  6. package/dist/_pkgs/affine-block-embed-doc/view.js +3 -0
  7. package/dist/_pkgs/affine-block-frame/frame-template.d.ts +11 -0
  8. package/dist/_pkgs/affine-block-frame/frame-template.js +24 -4
  9. package/dist/_pkgs/affine-block-frame/translations.d.ts +3 -0
  10. package/dist/_pkgs/affine-block-frame/translations.js +7 -0
  11. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +9 -3
  12. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +9 -5
  13. package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
  14. package/dist/_pkgs/affine-block-surface/index.js +1 -0
  15. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +55 -3
  16. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +139 -6
  17. package/dist/_pkgs/affine-block-surface/renderer/notation-tint.d.ts +92 -0
  18. package/dist/_pkgs/affine-block-surface/renderer/notation-tint.js +113 -0
  19. package/dist/_pkgs/affine-block-surface/surface-block.js +2 -2
  20. package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
  21. package/dist/_pkgs/affine-components/context-menu/input.js +2 -1
  22. package/dist/_pkgs/affine-components/context-menu/menu-renderer.d.ts +7 -0
  23. package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +53 -13
  24. package/dist/_pkgs/affine-components/drop-indicator/file-drop-manager.js +15 -0
  25. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +4 -2
  26. package/dist/_pkgs/affine-inline-link/link-node/link-popup/styles.js +1 -1
  27. package/dist/_pkgs/affine-inline-reference/reference-node/reference-popup/reference-popup.js +9 -9
  28. package/dist/_pkgs/affine-shared/consts/notation.d.ts +1 -0
  29. package/dist/_pkgs/affine-shared/consts/notation.js +29 -0
  30. package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +5 -0
  31. package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
  32. package/dist/_pkgs/affine-shared/services/index.js +1 -0
  33. package/dist/_pkgs/affine-shared/services/page-drop-service.d.ts +61 -0
  34. package/dist/_pkgs/affine-shared/services/page-drop-service.js +30 -0
  35. package/dist/_pkgs/affine-shared/styles/scrollbar-style.js +1 -1
  36. package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +5 -5
  37. package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-auto-complete.js +2 -2
  38. package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +6 -6
  39. package/dist/_pkgs/affine-widget-keyboard-toolbar/styles.js +1 -1
  40. package/dist/_pkgs/affine-widget-linked-doc/config.d.ts +8 -0
  41. package/dist/_pkgs/affine-widget-linked-doc/config.js +8 -1
  42. package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +40 -32
  43. package/dist/_pkgs/affine-widget-linked-doc/styles.js +1 -1
  44. package/dist/_pkgs/affine-widget-linked-doc/translations.d.ts +2 -0
  45. package/dist/_pkgs/affine-widget-linked-doc/translations.js +6 -0
  46. package/dist/_pkgs/affine-widget-thread-marks/widget.d.ts +3 -1
  47. package/dist/_pkgs/affine-widget-thread-marks/widget.js +6 -1
  48. package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +2 -1
  49. package/dist/_pkgs/affine-widget-toolbar/utils.js +5 -2
  50. package/dist/_pkgs/data-view/core/common/properties.js +2 -2
  51. package/dist/_pkgs/data-view/core/common/property-menu.d.ts +3 -3
  52. package/dist/_pkgs/data-view/core/common/property-menu.js +7 -7
  53. package/dist/_pkgs/data-view/core/component/overflow/overflow.js +4 -1
  54. package/dist/_pkgs/data-view/core/group-by/renderer/base.d.ts +4 -1
  55. package/dist/_pkgs/data-view/core/group-by/renderer/base.js +17 -2
  56. package/dist/_pkgs/data-view/core/group-by/renderer/number-group.js +1 -1
  57. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.d.ts +0 -3
  58. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.js +63 -118
  59. package/dist/_pkgs/data-view/core/group-by/renderer/string-group.js +1 -1
  60. package/dist/_pkgs/data-view/core/group-by/setting.js +2 -2
  61. package/dist/_pkgs/data-view/core/utils/wording.d.ts +6 -2
  62. package/dist/_pkgs/data-view/core/utils/wording.js +5 -3
  63. package/dist/_pkgs/data-view/core/view/default-name.d.ts +6 -0
  64. package/dist/_pkgs/data-view/core/view/default-name.js +8 -0
  65. package/dist/_pkgs/data-view/translations.d.ts +47 -0
  66. package/dist/_pkgs/data-view/translations.js +124 -0
  67. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.d.ts +3 -1
  68. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +102 -124
  69. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +4 -2
  70. package/dist/_pkgs/data-view/view-presets/table/mobile/header.js +17 -9
  71. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +20 -11
  72. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.d.ts +17 -0
  73. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.js +31 -6
  74. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +2 -2
  75. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +4 -2
  76. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.d.ts +3 -1
  77. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.js +23 -3
  78. package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.d.ts +3 -0
  79. package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.js +37 -5
  80. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +3 -0
  81. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +99 -35
  82. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +30 -22
  83. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +8 -6
  84. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +15 -0
  85. package/package.json +1 -1
@@ -218,11 +218,123 @@ export const DATA_VIEW_PROPERTY_TYPE = [
218
218
  'com.labre.data-view.property.type',
219
219
  'Property type',
220
220
  ];
221
+ /* ── The table's chrome on every device (P7, mobile base views) ──────── */
222
+ /** The toolbar button and a group's footer row that add a row. */
223
+ export const DATA_VIEW_NEW_RECORD = [
224
+ 'com.labre.data-view.new-record',
225
+ 'New Record',
226
+ ];
227
+ /** The same button on a phone, where the toolbar has no room for two words. */
228
+ export const DATA_VIEW_NEW_RECORD_SHORT = [
229
+ 'com.labre.data-view.new-record.short',
230
+ 'New',
231
+ ];
232
+ /**
233
+ * The title of the group holding the rows with no value. Display only: the
234
+ * stored group key stays `'Ungroups'` (`core/group-by/define.ts`).
235
+ */
236
+ export const DATA_VIEW_UNGROUPED = [
237
+ 'com.labre.data-view.group.ungrouped',
238
+ 'Ungroups',
239
+ ];
240
+ /** The filter bar's button, and the filter group panel's. */
241
+ export const DATA_VIEW_ADD_FILTER = [
242
+ 'com.labre.data-view.filter.add',
243
+ 'Add filter',
244
+ ];
245
+ export const DATA_VIEW_SEARCH_PLACEHOLDER = [
246
+ 'com.labre.data-view.search.placeholder',
247
+ 'Search...',
248
+ ];
249
+ /** Read after an "Esc" key cap in the search box's clear tooltip. */
250
+ export const DATA_VIEW_SEARCH_CLEAR_HINT = [
251
+ 'com.labre.data-view.search.clear-hint',
252
+ 'to clear all',
253
+ ];
254
+ /* ── The view settings and a property's settings (P7, phone sheets) ──── */
255
+ /** The title of the view's settings (its "..." button). */
256
+ export const DATA_VIEW_VIEW_SETTINGS = [
257
+ 'com.labre.data-view.view-settings',
258
+ 'View settings',
259
+ ];
260
+ /**
261
+ * The view settings' entries. "Layout" and "Group" are the full page's
262
+ * "This view" entries for the same settings (`VIEW_MENU_LAYOUT`,
263
+ * `VIEW_MENU_GROUP` in `@labre/core-database`): one chrome word, one key,
264
+ * declared here because core draws them too.
265
+ */
266
+ export const DATA_VIEW_LAYOUT = [
267
+ 'com.labre.database.view-menu.layout',
268
+ 'Layout',
269
+ ];
270
+ export const DATA_VIEW_GROUP = [
271
+ 'com.labre.database.view-menu.group',
272
+ 'Group',
273
+ ];
274
+ /**
275
+ * The selection pane's "Filter" (`@labre/affine-widget-edgeless-toolbar`):
276
+ * one chrome word, one key, declared there, so not listed below.
277
+ */
278
+ export const DATA_VIEW_FILTER = [
279
+ 'com.labre.selection-pane.filter',
280
+ 'Filter',
281
+ ];
282
+ export const DATA_VIEW_SORT = [
283
+ 'com.labre.data-view.sort',
284
+ 'Sort',
285
+ ];
286
+ /** Beside "Properties": how many the view shows (`count`). */
287
+ export const DATA_VIEW_PROPERTIES_SHOWN = [
288
+ 'com.labre.data-view.properties.shown',
289
+ '{{count}} shown',
290
+ ];
291
+ /** Beside "Filter" and "Sort": how many the view has (`count`, 1 or more). */
292
+ export const DATA_VIEW_FILTER_COUNT = [
293
+ 'com.labre.data-view.filter.count',
294
+ '{{count}} filter(s)',
295
+ ];
296
+ export const DATA_VIEW_SORT_COUNT = [
297
+ 'com.labre.data-view.sort.count',
298
+ '{{count}} sort(s)',
299
+ ];
300
+ /** The title of a property's menu on a phone (its column header). */
301
+ export const DATA_VIEW_PROPERTY_SETTINGS = [
302
+ 'com.labre.data-view.property.settings',
303
+ 'Property settings',
304
+ ];
305
+ /** A property's menu: the name field's placeholder. */
306
+ export const DATA_VIEW_PROPERTY_NAME = [
307
+ 'com.labre.data-view.property.name',
308
+ 'Property name',
309
+ ];
310
+ /** A property's menu: the entry opening the type picker. */
311
+ export const DATA_VIEW_PROPERTY_TYPE_ENTRY = [
312
+ 'com.labre.data-view.property.type-entry',
313
+ 'Type',
314
+ ];
315
+ /**
316
+ * The table header's menu: a new property beside this one. Its "Move left"
317
+ * and "Move right" are the views bar's (`VIEWS_BAR_MOVE_LEFT`, `…_RIGHT`).
318
+ */
319
+ export const DATA_VIEW_INSERT_LEFT = [
320
+ 'com.labre.data-view.property.insert-left',
321
+ 'Insert left column',
322
+ ];
323
+ export const DATA_VIEW_INSERT_RIGHT = [
324
+ 'com.labre.data-view.property.insert-right',
325
+ 'Insert right column',
326
+ ];
221
327
  /** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
222
328
  export const DATA_VIEW_WORDINGS = [
223
329
  VIEW_SHOWN_AS_TABLE,
224
330
  VIEW_DUPLICATE_AS_TABLE,
225
331
  DATA_VIEW_NEW_PAGE,
332
+ DATA_VIEW_NEW_RECORD,
333
+ DATA_VIEW_NEW_RECORD_SHORT,
334
+ DATA_VIEW_UNGROUPED,
335
+ DATA_VIEW_ADD_FILTER,
336
+ DATA_VIEW_SEARCH_PLACEHOLDER,
337
+ DATA_VIEW_SEARCH_CLEAR_HINT,
226
338
  VIEW_NAME_TABLE,
227
339
  VIEW_NAME_KANBAN,
228
340
  VIEW_NAME_CALENDAR,
@@ -258,4 +370,16 @@ export const DATA_VIEW_WORDINGS = [
258
370
  DATA_VIEW_NEW_PROPERTY,
259
371
  DATA_VIEW_PROPERTY_TYPE,
260
372
  DATA_VIEW_PROPERTY_HIDE_IN_VIEW,
373
+ DATA_VIEW_VIEW_SETTINGS,
374
+ DATA_VIEW_LAYOUT,
375
+ DATA_VIEW_GROUP,
376
+ DATA_VIEW_SORT,
377
+ DATA_VIEW_PROPERTIES_SHOWN,
378
+ DATA_VIEW_FILTER_COUNT,
379
+ DATA_VIEW_SORT_COUNT,
380
+ DATA_VIEW_PROPERTY_SETTINGS,
381
+ DATA_VIEW_PROPERTY_NAME,
382
+ DATA_VIEW_PROPERTY_TYPE_ENTRY,
383
+ DATA_VIEW_INSERT_LEFT,
384
+ DATA_VIEW_INSERT_RIGHT,
261
385
  ];
@@ -1,4 +1,4 @@
1
- import { ShadowlessElement } from '../../../../std/index.js';
1
+ import { type BlockStdScope, ShadowlessElement } from '../../../../std/index.js';
2
2
  import type { TableProperty, TableSingleView } from '../table-view-manager.js';
3
3
  declare const MobileTableColumnHeader_base: typeof ShadowlessElement & import("../../../../global/utils/types.js").Constructor<import("../../../../global/lit/with-disposable.js").DisposableClass>;
4
4
  export declare class MobileTableColumnHeader extends MobileTableColumnHeader_base {
@@ -7,6 +7,8 @@ export declare class MobileTableColumnHeader extends MobileTableColumnHeader_bas
7
7
  editTitle: () => void;
8
8
  private popMenu;
9
9
  render(): import("lit-html").TemplateResult;
10
+ /** Absent outside an editor host: the menu reads English. */
11
+ accessor std: BlockStdScope;
10
12
  accessor column: TableProperty;
11
13
  accessor tableViewManager: TableSingleView;
12
14
  }
@@ -35,17 +35,23 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { menu, popMenu, popupTargetFromElement, } from '../../../../affine-components/context-menu/index.js';
36
36
  import { unsafeCSSVarV2 } from '../../../../affine-shared/theme/index.js';
37
37
  import { SignalWatcher, WithDisposable } from '../../../../global/lit/index.js';
38
- import { DeleteIcon, DuplicateIcon, InsertLeftIcon, InsertRightIcon, MoveLeftIcon, MoveRightIcon, ViewIcon, } from '@blocksuite/icons/lit';
39
- import { ShadowlessElement } from '../../../../std/index.js';
38
+ import { InsertLeftIcon, InsertRightIcon, MoveLeftIcon, MoveRightIcon, } from '@blocksuite/icons/lit';
39
+ import { ShadowlessElement, stdContext } from '../../../../std/index.js';
40
+ import { consume } from '@lit/context';
40
41
  import { css } from 'lit';
41
42
  import { property } from 'lit/decorators.js';
42
43
  import { styleMap } from 'lit/directives/style-map.js';
43
44
  import { html } from 'lit/static-html.js';
44
- import { inputConfig, typeConfig } from '../../../core/common/property-menu.js';
45
+ import { propertyMenuItems } from '../../../core/common/property-menu.js';
46
+ import { wordingOf } from '../../../core/utils/wording.js';
45
47
  import { numberFormats } from '../../../property-presets/number/utils/formats.js';
48
+ import { DATA_VIEW_INSERT_LEFT, DATA_VIEW_INSERT_RIGHT, DATA_VIEW_PROPERTY_SETTINGS, VIEWS_BAR_MOVE_LEFT, VIEWS_BAR_MOVE_RIGHT, } from '../../../translations.js';
46
49
  import { MOBILE_TOUCH_TARGET } from '../consts.js';
47
50
  let MobileTableColumnHeader = (() => {
48
51
  let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
52
+ let _std_decorators;
53
+ let _std_initializers = [];
54
+ let _std_extraInitializers = [];
49
55
  let _column_decorators;
50
56
  let _column_initializers = [];
51
57
  let _column_extraInitializers = [];
@@ -55,8 +61,10 @@ let MobileTableColumnHeader = (() => {
55
61
  return class MobileTableColumnHeader extends _classSuper {
56
62
  static {
57
63
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
64
+ _std_decorators = [consume({ context: stdContext })];
58
65
  _column_decorators = [property({ attribute: false })];
59
66
  _tableViewManager_decorators = [property({ attribute: false })];
67
+ __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);
60
68
  __esDecorate(this, null, _column_decorators, { kind: "accessor", name: "column", static: false, private: false, access: { has: obj => "column" in obj, get: obj => obj.column, set: (obj, value) => { obj.column = value; } }, metadata: _metadata }, _column_initializers, _column_extraInitializers);
61
69
  __esDecorate(this, null, _tableViewManager_decorators, { kind: "accessor", name: "tableViewManager", static: false, private: false, access: { has: obj => "tableViewManager" in obj, get: obj => obj.tableViewManager, set: (obj, value) => { obj.tableViewManager = value; } }, metadata: _metadata }, _tableViewManager_initializers, _tableViewManager_extraInitializers);
62
70
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
@@ -84,16 +92,15 @@ let MobileTableColumnHeader = (() => {
84
92
  `; }
85
93
  popMenu(ele) {
86
94
  const enableNumberFormatting = this.tableViewManager.featureFlags$.value.enable_number_formatting;
95
+ const wording = wordingOf(this.std);
87
96
  popMenu(popupTargetFromElement(ele ?? this), {
88
97
  options: {
89
98
  title: {
90
- text: 'Property settings',
99
+ text: wording(DATA_VIEW_PROPERTY_SETTINGS),
91
100
  },
92
- items: [
93
- inputConfig(this.column),
94
- typeConfig(this.column),
95
- // Number format begin
96
- ...(enableNumberFormatting
101
+ items: propertyMenuItems(this.column, {
102
+ wording,
103
+ afterType: enableNumberFormatting
97
104
  ? [
98
105
  menu.subMenu({
99
106
  name: 'Number Format',
@@ -127,122 +134,88 @@ let MobileTableColumnHeader = (() => {
127
134
  },
128
135
  }),
129
136
  ]
130
- : []),
131
- // Number format end
132
- menu.group({
133
- items: [
134
- menu.action({
135
- name: 'Hide In View',
136
- prefix: ViewIcon(),
137
- hide: () => !this.column.hideCanSet,
138
- select: () => {
139
- this.column.hideSet(true);
140
- },
141
- }),
142
- ],
143
- }),
144
- menu.group({
145
- items: [
146
- menu.action({
147
- name: 'Insert Left Column',
148
- prefix: InsertLeftIcon(),
149
- select: () => {
150
- this.tableViewManager.propertyAdd({
151
- id: this.column.id,
152
- before: true,
153
- });
154
- Promise.resolve()
155
- .then(() => {
156
- const pre = this.previousElementSibling?.previousElementSibling;
157
- if (pre instanceof MobileTableColumnHeader) {
158
- pre.editTitle();
159
- pre.scrollIntoView({
160
- inline: 'nearest',
161
- block: 'nearest',
162
- });
137
+ : [],
138
+ beforeOperations: [
139
+ menu.group({
140
+ items: [
141
+ menu.action({
142
+ name: wording(DATA_VIEW_INSERT_LEFT),
143
+ prefix: InsertLeftIcon(),
144
+ select: () => {
145
+ this.tableViewManager.propertyAdd({
146
+ id: this.column.id,
147
+ before: true,
148
+ });
149
+ Promise.resolve()
150
+ .then(() => {
151
+ const pre = this.previousElementSibling?.previousElementSibling;
152
+ if (pre instanceof MobileTableColumnHeader) {
153
+ pre.editTitle();
154
+ pre.scrollIntoView({
155
+ inline: 'nearest',
156
+ block: 'nearest',
157
+ });
158
+ }
159
+ })
160
+ .catch(console.error);
161
+ },
162
+ }),
163
+ menu.action({
164
+ name: wording(DATA_VIEW_INSERT_RIGHT),
165
+ prefix: InsertRightIcon(),
166
+ select: () => {
167
+ this.tableViewManager.propertyAdd({
168
+ id: this.column.id,
169
+ before: false,
170
+ });
171
+ Promise.resolve()
172
+ .then(() => {
173
+ const next = this.nextElementSibling?.nextElementSibling;
174
+ if (next instanceof MobileTableColumnHeader) {
175
+ next.editTitle();
176
+ next.scrollIntoView({
177
+ inline: 'nearest',
178
+ block: 'nearest',
179
+ });
180
+ }
181
+ })
182
+ .catch(console.error);
183
+ },
184
+ }),
185
+ menu.action({
186
+ name: wording(VIEWS_BAR_MOVE_LEFT),
187
+ prefix: MoveLeftIcon(),
188
+ hide: () => this.column.isFirst$.value,
189
+ select: () => {
190
+ const pre = this.column.prev$.value;
191
+ if (!pre) {
192
+ return;
163
193
  }
164
- })
165
- .catch(console.error);
166
- },
167
- }),
168
- menu.action({
169
- name: 'Insert Right Column',
170
- prefix: InsertRightIcon(),
171
- select: () => {
172
- this.tableViewManager.propertyAdd({
173
- id: this.column.id,
174
- before: false,
175
- });
176
- Promise.resolve()
177
- .then(() => {
178
- const next = this.nextElementSibling?.nextElementSibling;
179
- if (next instanceof MobileTableColumnHeader) {
180
- next.editTitle();
181
- next.scrollIntoView({
182
- inline: 'nearest',
183
- block: 'nearest',
184
- });
194
+ this.column.move({
195
+ id: pre.id,
196
+ before: true,
197
+ });
198
+ },
199
+ }),
200
+ menu.action({
201
+ name: wording(VIEWS_BAR_MOVE_RIGHT),
202
+ prefix: MoveRightIcon(),
203
+ hide: () => this.column.isLast$.value,
204
+ select: () => {
205
+ const next = this.column.next$.value;
206
+ if (!next) {
207
+ return;
185
208
  }
186
- })
187
- .catch(console.error);
188
- },
189
- }),
190
- menu.action({
191
- name: 'Move Left',
192
- prefix: MoveLeftIcon(),
193
- hide: () => this.column.isFirst$.value,
194
- select: () => {
195
- const pre = this.column.prev$.value;
196
- if (!pre) {
197
- return;
198
- }
199
- this.column.move({
200
- id: pre.id,
201
- before: true,
202
- });
203
- },
204
- }),
205
- menu.action({
206
- name: 'Move Right',
207
- prefix: MoveRightIcon(),
208
- hide: () => this.column.isLast$.value,
209
- select: () => {
210
- const next = this.column.next$.value;
211
- if (!next) {
212
- return;
213
- }
214
- this.column.move({
215
- id: next.id,
216
- before: false,
217
- });
218
- },
219
- }),
220
- ],
221
- }),
222
- menu.group({
223
- items: [
224
- menu.action({
225
- name: 'Duplicate',
226
- prefix: DuplicateIcon(),
227
- hide: () => !this.column.canDuplicate,
228
- select: () => {
229
- this.column.duplicate?.();
230
- },
231
- }),
232
- menu.action({
233
- name: 'Delete',
234
- prefix: DeleteIcon(),
235
- hide: () => !this.column.canDelete,
236
- select: () => {
237
- this.column.delete?.();
238
- },
239
- class: {
240
- 'delete-item': true,
241
- },
242
- }),
243
- ],
244
- }),
245
- ],
209
+ this.column.move({
210
+ id: next.id,
211
+ before: false,
212
+ });
213
+ },
214
+ }),
215
+ ],
216
+ }),
217
+ ],
218
+ }),
246
219
  },
247
220
  });
248
221
  }
@@ -265,6 +238,10 @@ let MobileTableColumnHeader = (() => {
265
238
  </div>
266
239
  `;
267
240
  }
241
+ #std_accessor_storage;
242
+ /** Absent outside an editor host: the menu reads English. */
243
+ get std() { return this.#std_accessor_storage; }
244
+ set std(value) { this.#std_accessor_storage = value; }
268
245
  #column_accessor_storage;
269
246
  get column() { return this.#column_accessor_storage; }
270
247
  set column(value) { this.#column_accessor_storage = value; }
@@ -282,7 +259,8 @@ let MobileTableColumnHeader = (() => {
282
259
  this.editTitle = () => {
283
260
  this._clickColumn();
284
261
  };
285
- this.#column_accessor_storage = __runInitializers(this, _column_initializers, void 0);
262
+ this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
263
+ this.#column_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _column_initializers, void 0));
286
264
  this.#tableViewManager_accessor_storage = (__runInitializers(this, _column_extraInitializers), __runInitializers(this, _tableViewManager_initializers, void 0));
287
265
  __runInitializers(this, _tableViewManager_extraInitializers);
288
266
  }
@@ -45,7 +45,7 @@ import { repeat } from 'lit/directives/repeat.js';
45
45
  import { GroupTitle } from '../../../core/group-by/group-title.js';
46
46
  import { hideGroupAction } from '../../../core/group-by/group-visibility.js';
47
47
  import { wordingOf } from '../../../core/utils/wording.js';
48
- import { DATA_VIEW_GROUP_COLLAPSE, DATA_VIEW_GROUP_EXPAND, } from '../../../translations.js';
48
+ import { DATA_VIEW_GROUP_COLLAPSE, DATA_VIEW_GROUP_EXPAND, DATA_VIEW_NEW_RECORD, } from '../../../translations.js';
49
49
  import { getCollapsedState, setCollapsedState } from '../collapsed-state.js';
50
50
  import { LEFT_TOOL_BAR_WIDTH } from '../consts.js';
51
51
  const styles = css `
@@ -168,7 +168,9 @@ let MobileTableGroup = (() => {
168
168
  data-test-id="affine-database-add-row-button"
169
169
  role="button"
170
170
  >
171
- ${PlusIcon()}<span style="font-size: 12px">New Record</span>
171
+ ${PlusIcon()}<span style="font-size: 12px"
172
+ >${wordingOf(this.std)(DATA_VIEW_NEW_RECORD)}</span
173
+ >
172
174
  </div>
173
175
  </div>`}
174
176
  `;
@@ -42,6 +42,7 @@ import { repeat } from 'lit/directives/repeat.js';
42
42
  import { styleMap } from 'lit/directives/style-map.js';
43
43
  import { html } from 'lit/static-html.js';
44
44
  import { cellDivider } from '../styles.js';
45
+ import { mobileStickyTitle } from './table-view-style.js';
45
46
  let MobileTableHeader = (() => {
46
47
  let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
47
48
  let _renderGroupHeader_decorators;
@@ -85,16 +86,23 @@ let MobileTableHeader = (() => {
85
86
  width: `${column.width$.value}px`,
86
87
  border: index === 0 ? 'none' : undefined,
87
88
  });
89
+ const isTitle = this.tableViewManager.mainProperties$.value.titleColumn ===
90
+ column.id;
88
91
  return html `
89
- <mobile-table-column-header
90
- style="${style}"
91
- data-column-id="${column.id}"
92
- data-column-index="${index}"
93
- class="mobile-table-cell"
94
- .column="${column}"
95
- .tableViewManager="${this.tableViewManager}"
96
- ></mobile-table-column-header>
97
- <div class="${cellDivider}" style="height: auto;"></div>
92
+ <div
93
+ class="${isTitle ? mobileStickyTitle : ''}"
94
+ style="display: flex;"
95
+ >
96
+ <mobile-table-column-header
97
+ style="${style}"
98
+ data-column-id="${column.id}"
99
+ data-column-index="${index}"
100
+ class="mobile-table-cell"
101
+ .column="${column}"
102
+ .tableViewManager="${this.tableViewManager}"
103
+ ></mobile-table-column-header>
104
+ <div class="${cellDivider}" style="height: auto;"></div>
105
+ </div>
98
106
  `;
99
107
  })}
100
108
  <div @click="${this._onAddColumn}" class="mobile-table-add-column">
@@ -46,6 +46,9 @@ import { html } from 'lit/static-html.js';
46
46
  import { paintRowColor, ROW_COLOR_PROPERTY, viewRowColor, } from '../../../core/view/color-rules.js';
47
47
  import { cellDivider } from '../styles.js';
48
48
  import { popMobileRowMenu } from './menu.js';
49
+ import { mobileStickyTitle } from './table-view-style.js';
50
+ /** Two 24px ops, the 20px gap between them and their 8px inset. */
51
+ const ROW_OPS_WIDTH = 24 * 2 + 20 + 8;
49
52
  let MobileTableRow = (() => {
50
53
  let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
51
54
  let _tableViewLogic_decorators;
@@ -137,13 +140,20 @@ let MobileTableRow = (() => {
137
140
  const ele = e.currentTarget;
138
141
  popMobileRowMenu(popupTargetFromElement(ele), this.rowId, this.tableViewLogic, this.view);
139
142
  };
143
+ const isTitle = column.view.mainProperties$.value.titleColumn === column.id;
144
+ const hasOps = isTitle && !column.readonly$.value;
140
145
  return html `
141
- <div style="display: flex;">
146
+ <div
147
+ class="${isTitle ? mobileStickyTitle : ''}"
148
+ style="display: flex;"
149
+ >
142
150
  <mobile-table-cell
143
151
  class="mobile-table-cell"
144
152
  style=${styleMap({
145
153
  width: `${column.width$.value}px`,
146
154
  border: i === 0 ? 'none' : undefined,
155
+ // Room for the two row ops drawn over its right end.
156
+ paddingRight: hasOps ? `${ROW_OPS_WIDTH}px` : undefined,
147
157
  })}
148
158
  .tableViewLogic="${this.tableViewLogic}"
149
159
  .column="${column}"
@@ -158,20 +168,19 @@ let MobileTableRow = (() => {
158
168
  >
159
169
  </mobile-table-cell>
160
170
  <div class="${cellDivider}"></div>
161
- </div>
162
- ${!column.readonly$.value &&
163
- column.view.mainProperties$.value.titleColumn === column.id
171
+ ${hasOps
164
172
  ? html ` <div class="mobile-row-ops">
165
- <div class="mobile-row-op" @click="${clickDetail}">
166
- ${CenterPeekIcon()}
167
- </div>
168
- ${!view.readonly$.value
173
+ <div class="mobile-row-op" @click="${clickDetail}">
174
+ ${CenterPeekIcon()}
175
+ </div>
176
+ ${!view.readonly$.value
169
177
  ? html ` <div class="mobile-row-op" @click="${openMenu}">
170
- ${MoreHorizontalIcon()}
171
- </div>`
178
+ ${MoreHorizontalIcon()}
179
+ </div>`
172
180
  : nothing}
173
- </div>`
181
+ </div>`
174
182
  : nothing}
183
+ </div>
175
184
  `;
176
185
  })}
177
186
  <div class="database-cell add-column-button"></div>
@@ -1,3 +1,20 @@
1
+ /**
2
+ * The view element itself never scrolls: the inner wrapper does.
3
+ *
4
+ * Upstream disabled horizontal scrolling of the mobile table altogether "to
5
+ * prevent crashes on iOS Safari" (AFFiNE#12203, blocksuite#8784), which left
6
+ * every column past the first unreachable on a phone. The scroll now lives on
7
+ * ONE inner element, contained (`overscroll-behavior`) so it never chains into
8
+ * the page; the host stays clipped as before.
9
+ * ponytail: unverified on a real iOS Safari here; if the crash comes back, the
10
+ * fallback is a paged column switcher, not `hidden` again.
11
+ */
12
+ export declare const mobileTableViewHost: string;
1
13
  export declare const mobileTableViewWrapper: string;
14
+ /**
15
+ * The title column stays in view while the others scroll under it: opaque,
16
+ * with the row's colour painted over the page colour.
17
+ */
18
+ export declare const mobileStickyTitle: string;
2
19
  export declare const mobileTableViewContainer: string;
3
20
  export declare const mobileCellDivider: string;
@@ -1,16 +1,41 @@
1
1
  import { css } from '@emotion/css';
2
2
  import { cssVarV2 } from '@toeverything/theme/v2';
3
+ import { ROW_COLOR_PROPERTY } from '../../../core/view/color-rules.js';
4
+ /**
5
+ * The view element itself never scrolls: the inner wrapper does.
6
+ *
7
+ * Upstream disabled horizontal scrolling of the mobile table altogether "to
8
+ * prevent crashes on iOS Safari" (AFFiNE#12203, blocksuite#8784), which left
9
+ * every column past the first unreachable on a phone. The scroll now lives on
10
+ * ONE inner element, contained (`overscroll-behavior`) so it never chains into
11
+ * the page; the host stays clipped as before.
12
+ * ponytail: unverified on a real iOS Safari here; if the crash comes back, the
13
+ * fallback is a paged column switcher, not `hidden` again.
14
+ */
15
+ export const mobileTableViewHost = css({
16
+ position: 'relative',
17
+ width: '100%',
18
+ overflowX: 'hidden',
19
+ overflowY: 'hidden',
20
+ });
3
21
  export const mobileTableViewWrapper = css({
4
22
  position: 'relative',
5
23
  width: '100%',
6
24
  paddingBottom: '4px',
7
- /**
8
- * Disable horizontal scrolling to prevent crashes on iOS Safari
9
- * See https://github.com/toeverything/AFFiNE/pull/12203
10
- * and https://github.com/toeverything/blocksuite/pull/8784
11
- */
12
- overflowX: 'hidden',
25
+ overflowX: 'auto',
13
26
  overflowY: 'hidden',
27
+ overscrollBehaviorX: 'contain',
28
+ });
29
+ /**
30
+ * The title column stays in view while the others scroll under it: opaque,
31
+ * with the row's colour painted over the page colour.
32
+ */
33
+ export const mobileStickyTitle = css({
34
+ position: 'sticky',
35
+ left: 0,
36
+ zIndex: 1,
37
+ backgroundColor: 'var(--affine-background-primary-color)',
38
+ backgroundImage: `linear-gradient(var(${ROW_COLOR_PROPERTY}, transparent), var(${ROW_COLOR_PROPERTY}, transparent))`,
14
39
  });
15
40
  export const mobileTableViewContainer = css({
16
41
  position: 'relative',
@@ -7,7 +7,7 @@ import { html } from 'lit/static-html.js';
7
7
  import { createUniComponentFromWebComponent, renderUniLit, } from '../../../core/index.js';
8
8
  import { DataViewUIBase, DataViewUILogicBase, } from '../../../core/view/data-view-base.js';
9
9
  import { LEFT_TOOL_BAR_WIDTH } from '../consts.js';
10
- import { mobileTableViewContainer, mobileTableViewWrapper, } from './table-view-style.js';
10
+ import { mobileTableViewContainer, mobileTableViewHost, mobileTableViewWrapper, } from './table-view-style.js';
11
11
  export class MobileTableViewUILogic extends DataViewUILogicBase {
12
12
  constructor() {
13
13
  super(...arguments);
@@ -71,7 +71,7 @@ export class MobileTableViewUI extends DataViewUIBase {
71
71
  connectedCallback() {
72
72
  super.connectedCallback();
73
73
  this.logic.ui$.value = this;
74
- this.classList.add(mobileTableViewWrapper);
74
+ this.classList.add(mobileTableViewHost);
75
75
  }
76
76
  renderTable() {
77
77
  const groups = this.logic.view.groupTrait.visibleGroups$.value;