@formicoidea/labre-core 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/_pkgs/affine-block-data-view/configs/slash-menu.js +3 -1
  2. package/dist/_pkgs/affine-block-data-view/view.d.ts +17 -1
  3. package/dist/_pkgs/affine-block-data-view/view.js +21 -2
  4. package/dist/_pkgs/affine-block-database/commands.d.ts +2 -2
  5. package/dist/_pkgs/affine-block-database/commands.js +3 -3
  6. package/dist/_pkgs/affine-block-database/components/values-banner.d.ts +28 -0
  7. package/dist/_pkgs/affine-block-database/components/values-banner.js +199 -0
  8. package/dist/_pkgs/affine-block-database/configs/slash-menu.d.ts +6 -1
  9. package/dist/_pkgs/affine-block-database/configs/slash-menu.js +57 -70
  10. package/dist/_pkgs/affine-block-database/data-source.d.ts +9 -5
  11. package/dist/_pkgs/affine-block-database/data-source.js +11 -7
  12. package/dist/_pkgs/affine-block-database/database-block-styles.d.ts +2 -0
  13. package/dist/_pkgs/affine-block-database/database-block-styles.js +15 -0
  14. package/dist/_pkgs/affine-block-database/database-block.d.ts +23 -0
  15. package/dist/_pkgs/affine-block-database/database-block.js +141 -19
  16. package/dist/_pkgs/affine-block-database/effects.js +2 -0
  17. package/dist/_pkgs/affine-block-database/external-data-source.d.ts +69 -2
  18. package/dist/_pkgs/affine-block-database/external-data-source.js +88 -16
  19. package/dist/_pkgs/affine-block-database/index.d.ts +2 -0
  20. package/dist/_pkgs/affine-block-database/index.js +2 -0
  21. package/dist/_pkgs/affine-block-database/linked-view.d.ts +38 -0
  22. package/dist/_pkgs/affine-block-database/linked-view.js +109 -0
  23. package/dist/_pkgs/affine-block-database/properties/index.d.ts +2 -0
  24. package/dist/_pkgs/affine-block-database/properties/index.js +2 -0
  25. package/dist/_pkgs/affine-block-database/properties/text/hosted.d.ts +15 -0
  26. package/dist/_pkgs/affine-block-database/properties/text/hosted.js +24 -0
  27. package/dist/_pkgs/affine-block-database/properties/title/hosted.d.ts +16 -0
  28. package/dist/_pkgs/affine-block-database/properties/title/hosted.js +42 -0
  29. package/dist/_pkgs/affine-block-database/service/index.d.ts +3 -0
  30. package/dist/_pkgs/affine-block-database/service/index.js +3 -0
  31. package/dist/_pkgs/affine-block-database/service/new-row-menu.d.ts +49 -0
  32. package/dist/_pkgs/affine-block-database/service/new-row-menu.js +21 -0
  33. package/dist/_pkgs/affine-block-database/service/open-row.d.ts +77 -0
  34. package/dist/_pkgs/affine-block-database/service/open-row.js +62 -0
  35. package/dist/_pkgs/affine-block-database/service/properties-panel.d.ts +23 -0
  36. package/dist/_pkgs/affine-block-database/service/properties-panel.js +33 -0
  37. package/dist/_pkgs/affine-block-database/translations.d.ts +10 -0
  38. package/dist/_pkgs/affine-block-database/translations.js +35 -0
  39. package/dist/_pkgs/affine-block-database/view-creation.d.ts +10 -0
  40. package/dist/_pkgs/affine-block-database/view-creation.js +14 -0
  41. package/dist/_pkgs/affine-block-database/view.d.ts +31 -1
  42. package/dist/_pkgs/affine-block-database/view.js +44 -5
  43. package/dist/_pkgs/affine-block-database/views/index.d.ts +30 -3
  44. package/dist/_pkgs/affine-block-database/views/index.js +44 -3
  45. package/dist/_pkgs/affine-components/date-picker/date-picker.d.ts +20 -0
  46. package/dist/_pkgs/affine-components/date-picker/date-picker.js +60 -26
  47. package/dist/_pkgs/affine-components/date-picker/style.js +1 -0
  48. package/dist/_pkgs/affine-components/translations.d.ts +4 -0
  49. package/dist/_pkgs/affine-components/translations.js +26 -0
  50. package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +18 -0
  51. package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +41 -2
  52. package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.d.ts +8 -0
  53. package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +12 -0
  54. package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +5 -0
  55. package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +44 -4
  56. package/dist/_pkgs/affine-model/blocks/database/types.d.ts +16 -0
  57. package/dist/_pkgs/affine-model/blocks/database/types.js +5 -1
  58. package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +139 -0
  59. package/dist/_pkgs/affine-shared/services/data-source-picker-service.js +22 -0
  60. package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
  61. package/dist/_pkgs/affine-shared/services/index.js +1 -0
  62. package/dist/_pkgs/affine-shared/services/telemetry-service/database.d.ts +59 -0
  63. package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +24 -0
  64. package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +2 -0
  65. package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +16 -0
  66. package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +10 -0
  67. package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +23 -0
  68. package/dist/_pkgs/data-view/core/component/index.d.ts +1 -0
  69. package/dist/_pkgs/data-view/core/component/index.js +1 -0
  70. package/dist/_pkgs/data-view/core/component/overflow/fit.d.ts +26 -0
  71. package/dist/_pkgs/data-view/core/component/overflow/fit.js +48 -0
  72. package/dist/_pkgs/data-view/core/component/overflow/overflow.d.ts +26 -3
  73. package/dist/_pkgs/data-view/core/component/overflow/overflow.js +84 -31
  74. package/dist/_pkgs/data-view/core/component/tags/colors.d.ts +7 -0
  75. package/dist/_pkgs/data-view/core/component/tags/colors.js +22 -10
  76. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +18 -0
  77. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +63 -21
  78. package/dist/_pkgs/data-view/core/data-source/base.d.ts +5 -1
  79. package/dist/_pkgs/data-view/core/data-source/base.js +7 -1
  80. package/dist/_pkgs/data-view/core/data-source/hydration.d.ts +44 -0
  81. package/dist/_pkgs/data-view/core/data-source/hydration.js +31 -0
  82. package/dist/_pkgs/data-view/core/data-source/index.d.ts +1 -0
  83. package/dist/_pkgs/data-view/core/data-source/index.js +1 -0
  84. package/dist/_pkgs/data-view/core/data-view.d.ts +22 -2
  85. package/dist/_pkgs/data-view/core/data-view.js +14 -0
  86. package/dist/_pkgs/data-view/core/effect.js +2 -0
  87. package/dist/_pkgs/data-view/core/group-by/collapsed-state.d.ts +3 -0
  88. package/dist/_pkgs/data-view/core/group-by/collapsed-state.js +59 -0
  89. package/dist/_pkgs/data-view/core/group-by/group-properties.d.ts +21 -0
  90. package/dist/_pkgs/data-view/core/group-by/group-properties.js +38 -0
  91. package/dist/_pkgs/data-view/core/group-by/group-title.js +4 -0
  92. package/dist/_pkgs/data-view/core/group-by/group-visibility.d.ts +40 -0
  93. package/dist/_pkgs/data-view/core/group-by/group-visibility.js +291 -0
  94. package/dist/_pkgs/data-view/core/group-by/setting.d.ts +11 -3
  95. package/dist/_pkgs/data-view/core/group-by/setting.js +81 -8
  96. package/dist/_pkgs/data-view/core/group-by/trait.d.ts +22 -0
  97. package/dist/_pkgs/data-view/core/group-by/trait.js +62 -1
  98. package/dist/_pkgs/data-view/core/index.d.ts +3 -0
  99. package/dist/_pkgs/data-view/core/index.js +3 -0
  100. package/dist/_pkgs/data-view/core/property/base-cell.d.ts +15 -1
  101. package/dist/_pkgs/data-view/core/property/base-cell.js +28 -3
  102. package/dist/_pkgs/data-view/core/property/standalone-cell.d.ts +15 -1
  103. package/dist/_pkgs/data-view/core/property/standalone-cell.js +19 -1
  104. package/dist/_pkgs/data-view/core/telemetry.d.ts +16 -0
  105. package/dist/_pkgs/data-view/core/telemetry.js +22 -0
  106. package/dist/_pkgs/data-view/core/utils/new-tab-click.d.ts +2 -0
  107. package/dist/_pkgs/data-view/core/utils/new-tab-click.js +4 -0
  108. package/dist/_pkgs/data-view/core/utils/wording.d.ts +11 -0
  109. package/dist/_pkgs/data-view/core/utils/wording.js +9 -0
  110. package/dist/_pkgs/data-view/core/view/data-view.d.ts +7 -0
  111. package/dist/_pkgs/data-view/core/view/default-name.d.ts +10 -0
  112. package/dist/_pkgs/data-view/core/view/default-name.js +14 -0
  113. package/dist/_pkgs/data-view/core/view/index.d.ts +2 -0
  114. package/dist/_pkgs/data-view/core/view/index.js +2 -0
  115. package/dist/_pkgs/data-view/core/view/open-in.d.ts +27 -0
  116. package/dist/_pkgs/data-view/core/view/open-in.js +39 -0
  117. package/dist/_pkgs/data-view/core/view-manager/cell.d.ts +5 -0
  118. package/dist/_pkgs/data-view/core/view-manager/cell.js +11 -0
  119. package/dist/_pkgs/data-view/core/view-manager/index.d.ts +3 -0
  120. package/dist/_pkgs/data-view/core/view-manager/index.js +3 -0
  121. package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.d.ts +18 -0
  122. package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.js +2 -0
  123. package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.d.ts +8 -0
  124. package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.js +9 -0
  125. package/dist/_pkgs/data-view/core/view-manager/property.d.ts +8 -0
  126. package/dist/_pkgs/data-view/core/view-manager/single-view.d.ts +28 -1
  127. package/dist/_pkgs/data-view/core/view-manager/single-view.js +45 -1
  128. package/dist/_pkgs/data-view/core/view-manager/view-creation.d.ts +49 -0
  129. package/dist/_pkgs/data-view/core/view-manager/view-creation.js +40 -0
  130. package/dist/_pkgs/data-view/core/view-manager/view-manager.d.ts +6 -2
  131. package/dist/_pkgs/data-view/core/view-manager/view-manager.js +2 -2
  132. package/dist/_pkgs/data-view/property-presets/date/cell-renderer.d.ts +2 -0
  133. package/dist/_pkgs/data-view/property-presets/date/cell-renderer.js +11 -2
  134. package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +2 -0
  135. package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +2 -0
  136. package/dist/_pkgs/data-view/translations.d.ts +55 -0
  137. package/dist/_pkgs/data-view/translations.js +181 -0
  138. package/dist/_pkgs/data-view/view-presets/calendar/define.js +3 -1
  139. package/dist/_pkgs/data-view/view-presets/convert.js +2 -0
  140. package/dist/_pkgs/data-view/view-presets/effect.js +4 -0
  141. package/dist/_pkgs/data-view/view-presets/flat/flat-converts.d.ts +2 -0
  142. package/dist/_pkgs/data-view/view-presets/flat/flat-converts.js +35 -0
  143. package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.d.ts +79 -0
  144. package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.js +194 -0
  145. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +56 -0
  146. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +266 -0
  147. package/dist/_pkgs/data-view/view-presets/gallery/define.d.ts +14 -0
  148. package/dist/_pkgs/data-view/view-presets/gallery/define.js +15 -0
  149. package/dist/_pkgs/data-view/view-presets/gallery/effect.d.ts +1 -0
  150. package/dist/_pkgs/data-view/view-presets/gallery/effect.js +4 -0
  151. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.d.ts +27 -0
  152. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +179 -0
  153. package/dist/_pkgs/data-view/view-presets/gallery/index.d.ts +2 -0
  154. package/dist/_pkgs/data-view/view-presets/gallery/index.js +2 -0
  155. package/dist/_pkgs/data-view/view-presets/gallery/renderer.d.ts +1 -0
  156. package/dist/_pkgs/data-view/view-presets/gallery/renderer.js +11 -0
  157. package/dist/_pkgs/data-view/view-presets/index.d.ts +5 -0
  158. package/dist/_pkgs/data-view/view-presets/index.js +7 -0
  159. package/dist/_pkgs/data-view/view-presets/kanban/define.js +3 -1
  160. package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +5 -53
  161. package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +8 -1
  162. package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +6 -1
  163. package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.d.ts +4 -2
  164. package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.js +52 -6
  165. package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +5 -1
  166. package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +2 -0
  167. package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +4 -0
  168. package/dist/_pkgs/data-view/view-presets/kanban/pc/group.d.ts +4 -2
  169. package/dist/_pkgs/data-view/view-presets/kanban/pc/group.js +51 -6
  170. package/dist/_pkgs/data-view/view-presets/kanban/pc/kanban-view-ui-logic.js +5 -1
  171. package/dist/_pkgs/data-view/view-presets/list/define.d.ts +14 -0
  172. package/dist/_pkgs/data-view/view-presets/list/define.js +15 -0
  173. package/dist/_pkgs/data-view/view-presets/list/effect.d.ts +1 -0
  174. package/dist/_pkgs/data-view/view-presets/list/effect.js +4 -0
  175. package/dist/_pkgs/data-view/view-presets/list/index.d.ts +2 -0
  176. package/dist/_pkgs/data-view/view-presets/list/index.js +2 -0
  177. package/dist/_pkgs/data-view/view-presets/list/list-view.d.ts +24 -0
  178. package/dist/_pkgs/data-view/view-presets/list/list-view.js +194 -0
  179. package/dist/_pkgs/data-view/view-presets/list/renderer.d.ts +1 -0
  180. package/dist/_pkgs/data-view/view-presets/list/renderer.js +11 -0
  181. package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +3 -14
  182. package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +6 -30
  183. package/dist/_pkgs/data-view/view-presets/table/consts.d.ts +2 -0
  184. package/dist/_pkgs/data-view/view-presets/table/consts.js +2 -0
  185. package/dist/_pkgs/data-view/view-presets/table/define.js +3 -1
  186. package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +4 -1
  187. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +2 -2
  188. package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +3 -1
  189. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +20 -5
  190. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +10 -2
  191. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +4 -1
  192. package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +4 -1
  193. package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +1 -1
  194. package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +3 -1
  195. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +20 -5
  196. package/dist/_pkgs/data-view/view-presets/table/pc/menu.d.ts +1 -1
  197. package/dist/_pkgs/data-view/view-presets/table/pc/menu.js +2 -1
  198. package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +3 -2
  199. package/dist/_pkgs/data-view/view-presets/table/pc/table-view-ui-logic.js +4 -1
  200. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +1 -1
  201. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +5 -1
  202. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +22 -19
  203. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +4 -1
  204. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/table-view-ui-logic.js +7 -2
  205. package/dist/_pkgs/data-view/view-presets/table/stats/column-stats-column.js +5 -1
  206. package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +5 -53
  207. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +1 -0
  208. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +60 -2
  209. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.d.ts +18 -1
  210. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +121 -124
  211. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +43 -0
  212. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +187 -0
  213. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.d.ts +36 -3
  214. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +187 -59
  215. package/dist/extensions/view.d.ts +2 -2
  216. package/dist/extensions/view.js +10 -3
  217. package/dist/flags.d.ts +8 -4
  218. package/dist/flags.js +8 -4
  219. package/dist/frameworks.d.ts +27 -0
  220. package/dist/frameworks.js +28 -0
  221. package/dist/translations.js +13 -1
  222. package/package.json +5 -1
@@ -0,0 +1,55 @@
1
+ import type { ChromeWording } from '../affine-shared/services/index.js';
2
+ /**
3
+ * The view engine's own wordings. Most of the data-view's chrome is still a
4
+ * deferred surface of the literal ratchet (`DEFERRED_DIRS` in
5
+ * `affine/all/src/__tests__/translations/literals.unit.spec.ts`); what is
6
+ * declared here is what was written after that decision, keyed from the start.
7
+ */
8
+ /** Beside the view's name in its tab: the stored mode is drawn as a table. */
9
+ export declare const VIEW_SHOWN_AS_TABLE: ChromeWording;
10
+ /**
11
+ * The view menu's way out of such a view: a new table view, same name, the
12
+ * stored one left untouched.
13
+ */
14
+ export declare const VIEW_DUPLICATE_AS_TABLE: ChromeWording;
15
+ /**
16
+ * The "New page" card of a gallery and row of a list: adds a row, opens it.
17
+ * Their open button says the components' "Open" (`OPEN_LABEL`), one chrome
18
+ * word, one key.
19
+ */
20
+ export declare const DATA_VIEW_NEW_PAGE: ChromeWording;
21
+ export declare const VIEW_NAME_TABLE: ChromeWording;
22
+ export declare const VIEW_NAME_KANBAN: ChromeWording;
23
+ export declare const VIEW_NAME_CALENDAR: ChromeWording;
24
+ export declare const VIEW_NAME_GALLERY: ChromeWording;
25
+ export declare const VIEW_NAME_LIST: ChromeWording;
26
+ export declare const TAG_SELECT_PLACEHOLDER: ChromeWording;
27
+ export declare const TAG_SELECT_TIP: ChromeWording;
28
+ export declare const TAG_SELECT_CREATE: ChromeWording;
29
+ export declare const TAG_COLOR_TEAL: ChromeWording;
30
+ /** The button standing for the views whose tabs do not fit; `count` of them. */
31
+ export declare const VIEWS_BAR_MORE: ChromeWording;
32
+ /** The "+" after the tabs, as its label and tooltip. */
33
+ export declare const VIEWS_BAR_ADD_VIEW: ChromeWording;
34
+ /** A tab's menu: the name field. */
35
+ export declare const VIEWS_BAR_VIEW_NAME: ChromeWording;
36
+ /** A tab's menu: opens the view's settings. */
37
+ export declare const VIEWS_BAR_EDIT_VIEW: ChromeWording;
38
+ export declare const VIEWS_BAR_MOVE_LEFT: ChromeWording;
39
+ export declare const VIEWS_BAR_MOVE_RIGHT: ChromeWording;
40
+ /** A group's menu entry: a view setting, shared by everyone (PRD REQ-DB-16). */
41
+ export declare const DATA_VIEW_GROUP_HIDE: ChromeWording;
42
+ /** A hidden group's button, in the list at the end of the view. */
43
+ export declare const DATA_VIEW_GROUP_SHOW: ChromeWording;
44
+ /** The heading of the hidden groups, listed at the end of the view. */
45
+ export declare const DATA_VIEW_HIDDEN_GROUPS: ChromeWording;
46
+ /** A group's fold toggle: personal, kept on this device only. */
47
+ export declare const DATA_VIEW_GROUP_COLLAPSE: ChromeWording;
48
+ export declare const DATA_VIEW_GROUP_EXPAND: ChromeWording;
49
+ /** The view setting naming where a row's page opens (`openIn`). */
50
+ export declare const DATA_VIEW_OPEN_IN: ChromeWording;
51
+ export declare const DATA_VIEW_OPEN_IN_SIDE: ChromeWording;
52
+ export declare const DATA_VIEW_OPEN_IN_CENTER: ChromeWording;
53
+ export declare const DATA_VIEW_OPEN_IN_FULL: ChromeWording;
54
+ /** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
55
+ export declare const DATA_VIEW_WORDINGS: readonly ChromeWording[];
@@ -0,0 +1,181 @@
1
+ /**
2
+ * The view engine's own wordings. Most of the data-view's chrome is still a
3
+ * deferred surface of the literal ratchet (`DEFERRED_DIRS` in
4
+ * `affine/all/src/__tests__/translations/literals.unit.spec.ts`); what is
5
+ * declared here is what was written after that decision, keyed from the start.
6
+ */
7
+ /* ── A view whose mode has no preset here (ADR 0035 §6) ───────────────── */
8
+ /** Beside the view's name in its tab: the stored mode is drawn as a table. */
9
+ export const VIEW_SHOWN_AS_TABLE = [
10
+ 'com.labre.data-view.view.shown-as-table',
11
+ 'Shown as a table',
12
+ ];
13
+ /**
14
+ * The view menu's way out of such a view: a new table view, same name, the
15
+ * stored one left untouched.
16
+ */
17
+ export const VIEW_DUPLICATE_AS_TABLE = [
18
+ 'com.labre.data-view.view.duplicate-as-table',
19
+ 'Duplicate as table',
20
+ ];
21
+ /* ── The gallery and list presets (ADR 0035 §1, B6 and B7) ───────────── */
22
+ /**
23
+ * The "New page" card of a gallery and row of a list: adds a row, opens it.
24
+ * Their open button says the components' "Open" (`OPEN_LABEL`), one chrome
25
+ * word, one key.
26
+ */
27
+ export const DATA_VIEW_NEW_PAGE = [
28
+ 'com.labre.data-view.new-page',
29
+ 'New page',
30
+ ];
31
+ /* ── A view's name when it is created ─────────────────────────────────── */
32
+ /*
33
+ * The name a new view is given. Each preset's `defaultName` is the English
34
+ * fallback and its `defaultNameKey` the key; the creation site writes the
35
+ * name resolved at the gesture (`viewDefaultName`), so a document keeps the
36
+ * words its author saw and a stored name is never re-translated. A model
37
+ * default never changes to translate a seed (ADR 0023).
38
+ */
39
+ export const VIEW_NAME_TABLE = [
40
+ 'com.labre.data-view.view.default-name.table',
41
+ 'Table View',
42
+ ];
43
+ export const VIEW_NAME_KANBAN = [
44
+ 'com.labre.data-view.view.default-name.kanban',
45
+ 'Kanban View',
46
+ ];
47
+ export const VIEW_NAME_CALENDAR = [
48
+ 'com.labre.data-view.view.default-name.calendar',
49
+ 'Calendar View',
50
+ ];
51
+ export const VIEW_NAME_GALLERY = [
52
+ 'com.labre.data-view.view.default-name.gallery',
53
+ 'Gallery View',
54
+ ];
55
+ export const VIEW_NAME_LIST = [
56
+ 'com.labre.data-view.view.default-name.list',
57
+ 'List View',
58
+ ];
59
+ /* ── The tag menu (select and multi-select cells, the chips band) ─────── */
60
+ export const TAG_SELECT_PLACEHOLDER = [
61
+ 'com.labre.data-view.tag.placeholder',
62
+ 'Type here...',
63
+ ];
64
+ export const TAG_SELECT_TIP = [
65
+ 'com.labre.data-view.tag.tip',
66
+ 'Select tag or create one',
67
+ ];
68
+ export const TAG_SELECT_CREATE = [
69
+ 'com.labre.data-view.tag.create',
70
+ 'Create',
71
+ ];
72
+ /*
73
+ * The colours an option can take, as the option menu lists them: the
74
+ * palette's own names (`PALETTE_NAME_*`, one word, one key), and teal, which
75
+ * the canvas palette does not have.
76
+ */
77
+ export const TAG_COLOR_TEAL = [
78
+ 'com.labre.data-view.tag.color.teal',
79
+ 'Teal',
80
+ ];
81
+ /* ── The views bar (ADR 0035 B11, labre PRD REQ-DB-7) ─────────────────── */
82
+ /** The button standing for the views whose tabs do not fit; `count` of them. */
83
+ export const VIEWS_BAR_MORE = [
84
+ 'com.labre.data-view.views-bar.more',
85
+ '{{count}} more',
86
+ ];
87
+ /** The "+" after the tabs, as its label and tooltip. */
88
+ export const VIEWS_BAR_ADD_VIEW = [
89
+ 'com.labre.data-view.views-bar.add-view',
90
+ 'New view',
91
+ ];
92
+ /** A tab's menu: the name field. */
93
+ export const VIEWS_BAR_VIEW_NAME = [
94
+ 'com.labre.data-view.views-bar.view-name',
95
+ 'View name',
96
+ ];
97
+ /** A tab's menu: opens the view's settings. */
98
+ export const VIEWS_BAR_EDIT_VIEW = [
99
+ 'com.labre.data-view.views-bar.edit-view',
100
+ 'Edit view',
101
+ ];
102
+ export const VIEWS_BAR_MOVE_LEFT = [
103
+ 'com.labre.data-view.views-bar.move-left',
104
+ 'Move left',
105
+ ];
106
+ export const VIEWS_BAR_MOVE_RIGHT = [
107
+ 'com.labre.data-view.views-bar.move-right',
108
+ 'Move right',
109
+ ];
110
+ /* ── Grouping and row opening, per view (ADR 0035 §8, B8) ───────────── */
111
+ /** A group's menu entry: a view setting, shared by everyone (PRD REQ-DB-16). */
112
+ export const DATA_VIEW_GROUP_HIDE = [
113
+ 'com.labre.data-view.group.hide',
114
+ 'Hide group',
115
+ ];
116
+ /** A hidden group's button, in the list at the end of the view. */
117
+ export const DATA_VIEW_GROUP_SHOW = [
118
+ 'com.labre.data-view.group.show',
119
+ 'Show group',
120
+ ];
121
+ /** The heading of the hidden groups, listed at the end of the view. */
122
+ export const DATA_VIEW_HIDDEN_GROUPS = [
123
+ 'com.labre.data-view.group.hidden',
124
+ 'Hidden groups',
125
+ ];
126
+ /** A group's fold toggle: personal, kept on this device only. */
127
+ export const DATA_VIEW_GROUP_COLLAPSE = [
128
+ 'com.labre.data-view.group.collapse',
129
+ 'Collapse group',
130
+ ];
131
+ export const DATA_VIEW_GROUP_EXPAND = [
132
+ 'com.labre.data-view.group.expand',
133
+ 'Expand group',
134
+ ];
135
+ /** The view setting naming where a row's page opens (`openIn`). */
136
+ export const DATA_VIEW_OPEN_IN = [
137
+ 'com.labre.data-view.open-in',
138
+ 'Open pages in',
139
+ ];
140
+ export const DATA_VIEW_OPEN_IN_SIDE = [
141
+ 'com.labre.data-view.open-in.side',
142
+ 'Side peek',
143
+ ];
144
+ export const DATA_VIEW_OPEN_IN_CENTER = [
145
+ 'com.labre.data-view.open-in.center',
146
+ 'Center peek',
147
+ ];
148
+ export const DATA_VIEW_OPEN_IN_FULL = [
149
+ 'com.labre.data-view.open-in.full',
150
+ 'Full page',
151
+ ];
152
+ /** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
153
+ export const DATA_VIEW_WORDINGS = [
154
+ VIEW_SHOWN_AS_TABLE,
155
+ VIEW_DUPLICATE_AS_TABLE,
156
+ DATA_VIEW_NEW_PAGE,
157
+ VIEW_NAME_TABLE,
158
+ VIEW_NAME_KANBAN,
159
+ VIEW_NAME_CALENDAR,
160
+ VIEW_NAME_GALLERY,
161
+ VIEW_NAME_LIST,
162
+ TAG_SELECT_PLACEHOLDER,
163
+ TAG_SELECT_TIP,
164
+ TAG_SELECT_CREATE,
165
+ TAG_COLOR_TEAL,
166
+ VIEWS_BAR_MORE,
167
+ VIEWS_BAR_ADD_VIEW,
168
+ VIEWS_BAR_VIEW_NAME,
169
+ VIEWS_BAR_EDIT_VIEW,
170
+ VIEWS_BAR_MOVE_LEFT,
171
+ VIEWS_BAR_MOVE_RIGHT,
172
+ DATA_VIEW_GROUP_HIDE,
173
+ DATA_VIEW_GROUP_SHOW,
174
+ DATA_VIEW_HIDDEN_GROUPS,
175
+ DATA_VIEW_GROUP_COLLAPSE,
176
+ DATA_VIEW_GROUP_EXPAND,
177
+ DATA_VIEW_OPEN_IN,
178
+ DATA_VIEW_OPEN_IN_SIDE,
179
+ DATA_VIEW_OPEN_IN_CENTER,
180
+ DATA_VIEW_OPEN_IN_FULL,
181
+ ];
@@ -1,8 +1,10 @@
1
1
  import { viewType } from '../../core/view/data-view.js';
2
+ import { VIEW_NAME_CALENDAR } from '../../translations.js';
2
3
  import { CalendarSingleView } from './calendar-view-manager.js';
3
4
  export const calendarViewType = viewType('calendar');
4
5
  export const calendarViewModel = calendarViewType.createModel({
5
- defaultName: 'Calendar View',
6
+ defaultName: VIEW_NAME_CALENDAR[1],
7
+ defaultNameKey: VIEW_NAME_CALENDAR[0],
6
8
  dataViewManager: CalendarSingleView,
7
9
  defaultData: viewManager => {
8
10
  return {
@@ -1,5 +1,6 @@
1
1
  import { createViewConvert } from '../core/view/convert.js';
2
2
  import { calendarViewModel } from './calendar/index.js';
3
+ import { flatViewConverts } from './flat/flat-converts.js';
3
4
  import { kanbanViewModel } from './kanban/index.js';
4
5
  import { tableViewModel } from './table/index.js';
5
6
  const headerToCalendarCard = (header) => ({
@@ -45,4 +46,5 @@ export const viewConverts = [
45
46
  sort: data.sort,
46
47
  header: calendarCardToHeader(data.card),
47
48
  })),
49
+ ...flatViewConverts,
48
50
  ];
@@ -1,8 +1,12 @@
1
1
  import { calendarEffects } from './calendar/effect.js';
2
+ import { galleryEffects } from './gallery/effect.js';
2
3
  import { kanbanEffects } from './kanban/effect.js';
4
+ import { listEffects } from './list/effect.js';
3
5
  import { tableEffects } from './table/effect.js';
4
6
  export function viewPresetsEffects() {
5
7
  calendarEffects();
8
+ galleryEffects();
6
9
  kanbanEffects();
10
+ listEffects();
7
11
  tableEffects();
8
12
  }
@@ -0,0 +1,2 @@
1
+ import type { ViewConvertConfig } from '../../core/view/convert.js';
2
+ export declare const flatViewConverts: ViewConvertConfig[];
@@ -0,0 +1,35 @@
1
+ import { calendarViewModel } from '../calendar/define.js';
2
+ import { galleryViewModel } from '../gallery/define.js';
3
+ import { kanbanViewModel } from '../kanban/define.js';
4
+ import { listViewModel } from '../list/define.js';
5
+ import { tableViewModel } from '../table/define.js';
6
+ /**
7
+ * A layout switch into or out of a gallery or a list keeps the filter, the
8
+ * sort and the grouping (B8: every layout groups, as table and kanban already
9
+ * kept `groupBy` between them); the properties shown are the target layout's
10
+ * own default, as when Notion switches a view's layout. A source with no
11
+ * grouping leaves the target's default: a kanban still gets its own. Calendar
12
+ * is a source only: nothing converts into it (ADR 0035 §6).
13
+ */
14
+ const keepFilterSortAndGroup = (data) => {
15
+ const { filter, sort, groupBy } = data;
16
+ // View data is an open record per mode: the target model types the rest.
17
+ return {
18
+ ...(filter ? { filter } : {}),
19
+ ...(sort ? { sort } : {}),
20
+ ...(groupBy ? { groupBy } : {}),
21
+ };
22
+ };
23
+ const flatModels = [galleryViewModel, listViewModel];
24
+ const convert = (from, to) => ({
25
+ from,
26
+ to,
27
+ convert: keepFilterSortAndGroup,
28
+ });
29
+ export const flatViewConverts = [
30
+ ...[tableViewModel, kanbanViewModel, calendarViewModel, ...flatModels]
31
+ .flatMap(from => flatModels.map(to => [from.type, to.type]))
32
+ .filter(([from, to]) => from !== to)
33
+ .map(([from, to]) => convert(from, to)),
34
+ ...flatModels.flatMap(from => [tableViewModel, kanbanViewModel].map(to => convert(from.type, to.type))),
35
+ ];
@@ -0,0 +1,79 @@
1
+ import { type InsertToPosition } from '../../../affine-shared/utils/index.js';
2
+ import type { GroupBy, GroupProperty } from '../../core/common/types.js';
3
+ import { FilterTrait } from '../../core/filter/trait.js';
4
+ import type { FilterGroup } from '../../core/filter/types.js';
5
+ import { GroupTrait } from '../../core/group-by/trait.js';
6
+ import type { Sort } from '../../core/sort/types.js';
7
+ import type { BasicViewDataType } from '../../core/view/data-view.js';
8
+ import { PropertyBase } from '../../core/view-manager/property.js';
9
+ import type { Row } from '../../core/view-manager/row.js';
10
+ import { SingleViewBase } from '../../core/view-manager/single-view.js';
11
+ import type { ViewManager } from '../../core/view-manager/view-manager.js';
12
+ /**
13
+ * A property's place in a gallery or list view: the shape table and kanban
14
+ * already store, `columns[].hide` (ADR 0035 §8), so per-view visibility reads
15
+ * and writes the same way in every preset.
16
+ */
17
+ export type FlatViewColumn = {
18
+ id: string;
19
+ hide?: boolean;
20
+ };
21
+ export type FlatViewDataType<Mode extends string = string> = BasicViewDataType<Mode, {
22
+ columns: FlatViewColumn[];
23
+ filter: FilterGroup;
24
+ sort?: Sort;
25
+ groupBy?: GroupBy;
26
+ groupProperties?: GroupProperty[];
27
+ }>;
28
+ /**
29
+ * What a new gallery or list view stores: its title shown, every other
30
+ * property hidden until the user shows it, as Notion does for these two
31
+ * layouts. Written once, by the gesture that creates the view; a stored view
32
+ * is never rewritten on load.
33
+ */
34
+ export declare const flatViewDefaultData: (viewManager: ViewManager) => {
35
+ columns: FlatViewColumn[];
36
+ filter: FilterGroup;
37
+ };
38
+ /**
39
+ * The manager both ungrouped presets share, gallery and list (ADR 0035 §1,
40
+ * B6 and B7): the table's per-view property order and visibility, filter and
41
+ * sort, and its row creation from the filter's default values, without the
42
+ * table's widths and statistics. Grouping (B8) is the table's too: the same
43
+ * stored `groupBy` and `groupProperties`, the same trait and ops.
44
+ */
45
+ export declare abstract class FlatSingleView<ViewData extends FlatViewDataType = FlatViewDataType> extends SingleViewBase<ViewData> {
46
+ propertiesRaw$: import("@preact/signals-core").ReadonlySignal<FlatProperty[]>;
47
+ properties$: import("@preact/signals-core").ReadonlySignal<FlatProperty[]>;
48
+ detailProperties$: import("@preact/signals-core").ReadonlySignal<FlatProperty[]>;
49
+ /** The title, drawn first on a card or a row whatever the columns say. */
50
+ titleProperty$: import("@preact/signals-core").ReadonlySignal<FlatProperty | undefined>;
51
+ /** The visible properties drawn after the title. */
52
+ bodyProperties$: import("@preact/signals-core").ReadonlySignal<FlatProperty[]>;
53
+ mainProperties$: import("@preact/signals-core").ReadonlySignal<{
54
+ titleColumn: string | undefined;
55
+ iconColumn: string;
56
+ }>;
57
+ readonly$: import("@preact/signals-core").ReadonlySignal<boolean>;
58
+ private readonly filter$;
59
+ private readonly sortList$;
60
+ filterTrait: FilterTrait;
61
+ private readonly sortManager;
62
+ private readonly groupBy$;
63
+ groupTrait: GroupTrait;
64
+ /** Every property's column entry, so a first hide stores the full order. */
65
+ readonly columnsData$: import("@preact/signals-core").ReadonlySignal<FlatViewColumn[]>;
66
+ isShow(rowId: string): boolean;
67
+ propertyGetOrCreate(propertyId: string): FlatProperty;
68
+ /** A row added from a group's "New page" takes that group's value. */
69
+ rowAdd(insertPosition: InsertToPosition | number, groupKey?: string): string;
70
+ protected rowsMapping(rows: Row[]): Row[];
71
+ }
72
+ export declare class FlatProperty extends PropertyBase {
73
+ private readonly flatView;
74
+ hide$: import("@preact/signals-core").ReadonlySignal<boolean>;
75
+ viewData$: import("@preact/signals-core").ReadonlySignal<FlatViewColumn | undefined>;
76
+ constructor(flatView: FlatSingleView, propertyId: string);
77
+ hideSet(hide: boolean): void;
78
+ move(position: InsertToPosition): void;
79
+ }
@@ -0,0 +1,194 @@
1
+ import { insertPositionToIndex, } from '../../../affine-shared/utils/index.js';
2
+ import { computed } from '@preact/signals-core';
3
+ import { evalFilter } from '../../core/filter/eval.js';
4
+ import { generateDefaultValues } from '../../core/filter/generate-default-values.js';
5
+ import { FilterTrait, filterTraitKey } from '../../core/filter/trait.js';
6
+ import { emptyFilterGroup } from '../../core/filter/utils.js';
7
+ import { groupPropertiesOps } from '../../core/group-by/group-properties.js';
8
+ import { GroupTrait, groupTraitKey } from '../../core/group-by/trait.js';
9
+ import { fromJson } from '../../core/property/utils.js';
10
+ import { SortManager, sortTraitKey } from '../../core/sort/manager.js';
11
+ import { PropertyBase } from '../../core/view-manager/property.js';
12
+ import { SingleViewBase } from '../../core/view-manager/single-view.js';
13
+ /**
14
+ * What a new gallery or list view stores: its title shown, every other
15
+ * property hidden until the user shows it, as Notion does for these two
16
+ * layouts. Written once, by the gesture that creates the view; a stored view
17
+ * is never rewritten on load.
18
+ */
19
+ export const flatViewDefaultData = (viewManager) => {
20
+ const dataSource = viewManager.dataSource;
21
+ return {
22
+ columns: dataSource.properties$.value.map(id => ({
23
+ id,
24
+ hide: dataSource.propertyTypeGet(id) !== 'title',
25
+ })),
26
+ filter: { type: 'group', op: 'and', conditions: [] },
27
+ };
28
+ };
29
+ /**
30
+ * The manager both ungrouped presets share, gallery and list (ADR 0035 §1,
31
+ * B6 and B7): the table's per-view property order and visibility, filter and
32
+ * sort, and its row creation from the filter's default values, without the
33
+ * table's widths and statistics. Grouping (B8) is the table's too: the same
34
+ * stored `groupBy` and `groupProperties`, the same trait and ops.
35
+ */
36
+ export class FlatSingleView extends SingleViewBase {
37
+ constructor() {
38
+ super(...arguments);
39
+ this.propertiesRaw$ = computed(() => {
40
+ const needShow = new Set(this.dataSource.properties$.value);
41
+ const result = [];
42
+ this.data$.value?.columns.forEach(v => {
43
+ if (needShow.has(v.id)) {
44
+ result.push(v.id);
45
+ needShow.delete(v.id);
46
+ }
47
+ });
48
+ result.push(...needShow);
49
+ return result.map(id => this.propertyGetOrCreate(id));
50
+ });
51
+ this.properties$ = computed(() => {
52
+ return this.propertiesRaw$.value.filter(property => !property.hide$.value);
53
+ });
54
+ this.detailProperties$ = computed(() => {
55
+ return this.propertiesRaw$.value.filter(property => property.type$.value !== 'title');
56
+ });
57
+ /** The title, drawn first on a card or a row whatever the columns say. */
58
+ this.titleProperty$ = computed(() => {
59
+ return this.properties$.value.find(property => property.type$.value === 'title');
60
+ });
61
+ /** The visible properties drawn after the title. */
62
+ this.bodyProperties$ = computed(() => {
63
+ return this.properties$.value.filter(property => property.type$.value !== 'title');
64
+ });
65
+ this.mainProperties$ = computed(() => ({
66
+ titleColumn: this.propertiesRaw$.value.find(property => property.type$.value === 'title')?.id,
67
+ iconColumn: 'type',
68
+ }));
69
+ this.readonly$ = computed(() => {
70
+ return this.manager.readonly$.value;
71
+ });
72
+ this.filter$ = computed(() => {
73
+ return this.data$.value?.filter ?? emptyFilterGroup;
74
+ });
75
+ this.sortList$ = computed(() => {
76
+ return this.data$.value?.sort;
77
+ });
78
+ this.filterTrait = this.traitSet(filterTraitKey, new FilterTrait(this.filter$, this, {
79
+ filterSet: (filter) => {
80
+ this.dataUpdate(() => ({ filter }));
81
+ },
82
+ }));
83
+ this.sortManager = this.traitSet(sortTraitKey, new SortManager(this.sortList$, this, {
84
+ setSortList: sortList => {
85
+ this.dataUpdate(data => ({
86
+ sort: {
87
+ ...data.sort,
88
+ ...sortList,
89
+ },
90
+ }));
91
+ },
92
+ }));
93
+ this.groupBy$ = computed(() => {
94
+ return this.data$.value?.groupBy;
95
+ });
96
+ this.groupTrait = this.traitSet(groupTraitKey, new GroupTrait(this.groupBy$, this, {
97
+ groupBySet: groupBy => {
98
+ this.dataUpdate(() => ({ groupBy }));
99
+ },
100
+ ...groupPropertiesOps(() => this.data$.value?.groupProperties ?? [], groupProperties => {
101
+ this.dataUpdate(() => ({ groupProperties }));
102
+ }),
103
+ }));
104
+ /** Every property's column entry, so a first hide stores the full order. */
105
+ this.columnsData$ = computed(() => {
106
+ return this.propertiesRaw$.value.map(property => ({
107
+ id: property.id,
108
+ hide: property.hide$.value,
109
+ }));
110
+ });
111
+ }
112
+ isShow(rowId) {
113
+ const filter = this.filter$.value;
114
+ if (!filter.conditions.length)
115
+ return true;
116
+ // Hidden properties included, as in the table: hiding a property must not
117
+ // silently drop the condition on it.
118
+ const rowMap = Object.fromEntries(this.propertiesRaw$.value.map(property => [
119
+ property.id,
120
+ property.cellGetOrCreate(rowId).jsonValue$.value,
121
+ ]));
122
+ return evalFilter(filter, rowMap);
123
+ }
124
+ propertyGetOrCreate(propertyId) {
125
+ return new FlatProperty(this, propertyId);
126
+ }
127
+ /** A row added from a group's "New page" takes that group's value. */
128
+ rowAdd(insertPosition, groupKey) {
129
+ const id = super.rowAdd(insertPosition);
130
+ if (!id)
131
+ return id;
132
+ const filter = this.filter$.value;
133
+ const defaultValues = filter.conditions.length
134
+ ? generateDefaultValues(filter, this.vars$.value)
135
+ : {};
136
+ Object.entries(defaultValues).forEach(([propertyId, jsonValue]) => {
137
+ const property = this.propertyGetOrCreate(propertyId);
138
+ const propertyMeta = property.meta$.value;
139
+ if (!propertyMeta)
140
+ return;
141
+ const value = fromJson(propertyMeta.config, {
142
+ value: jsonValue,
143
+ data: property.data$.value,
144
+ dataSource: this.dataSource,
145
+ });
146
+ this.cellGetOrCreate(id, propertyId).valueSet(value);
147
+ });
148
+ // After the filter's defaults, as in the table: the group clicked wins.
149
+ if (groupKey != null)
150
+ this.groupTrait.addToGroup(id, groupKey);
151
+ return id;
152
+ }
153
+ rowsMapping(rows) {
154
+ return this.sortManager.sort(super.rowsMapping(rows));
155
+ }
156
+ }
157
+ export class FlatProperty extends PropertyBase {
158
+ constructor(flatView, propertyId) {
159
+ super(flatView, propertyId);
160
+ this.flatView = flatView;
161
+ this.hide$ = computed(() => {
162
+ const hideFromViewData = this.viewData$.value?.hide;
163
+ if (hideFromViewData != null) {
164
+ return hideFromViewData;
165
+ }
166
+ const defaultShow = this.meta$.value?.config.fixed?.defaultShow;
167
+ if (defaultShow != null) {
168
+ return !defaultShow;
169
+ }
170
+ return false;
171
+ });
172
+ this.viewData$ = computed(() => {
173
+ return this.flatView.data$.value?.columns.find(v => v.id === this.id);
174
+ });
175
+ }
176
+ hideSet(hide) {
177
+ this.flatView.dataUpdate(() => ({
178
+ columns: this.flatView.columnsData$.value.map(v => v.id === this.id ? { ...v, hide } : v),
179
+ }));
180
+ }
181
+ move(position) {
182
+ this.flatView.dataUpdate(() => {
183
+ const columns = [...this.flatView.columnsData$.value];
184
+ const index = columns.findIndex(v => v.id === this.id);
185
+ if (index < 0)
186
+ return {};
187
+ const [column] = columns.splice(index, 1);
188
+ if (!column)
189
+ return {};
190
+ columns.splice(insertPositionToIndex(position, columns), 0, column);
191
+ return { columns };
192
+ });
193
+ }
194
+ }
@@ -0,0 +1,56 @@
1
+ import type { ChromeWording } from '../../../affine-shared/services/index.js';
2
+ import type { UniComponent } from '../../../affine-shared/types/index.js';
3
+ import type { InsertToPosition } from '../../../affine-shared/utils/index.js';
4
+ import type { BlockStdScope } from '../../../std/index.js';
5
+ import { nothing } from 'lit';
6
+ import type { Group } from '../../core/group-by/trait.js';
7
+ import { DataViewUIBase, DataViewUILogicBase } from '../../core/view/data-view-base.js';
8
+ import type { Property } from '../../core/view-manager/property.js';
9
+ import type { Row } from '../../core/view-manager/row.js';
10
+ import type { FlatSingleView } from './flat-view-manager.js';
11
+ /**
12
+ * The UI logic both ungrouped presets share. Neither has a selection model of
13
+ * its own: a cell edits through the cell host (`dv-standalone-cell`), with the
14
+ * very renderer and popups a table cell mounts, and a click anywhere else on
15
+ * a card or a row opens the row through the root's detail panel, the path
16
+ * the table's and the kanban's open buttons take. Grouped (B8), each group
17
+ * draws under the table's group header; drag and drop of rows between groups
18
+ * is not offered: a row changes group by editing its value.
19
+ */
20
+ export declare abstract class FlatViewUILogic<View extends FlatSingleView = FlatSingleView> extends DataViewUILogicBase<View> {
21
+ clearSelection: () => void;
22
+ focusFirstCell: () => void;
23
+ showIndicator: (_evt: MouseEvent) => boolean;
24
+ hideIndicator: () => void;
25
+ moveTo: (_id: string, _evt: MouseEvent) => void;
26
+ addRow: (position: InsertToPosition, groupKey?: string) => string | undefined;
27
+ abstract renderer: UniComponent<unknown>;
28
+ /** A Ctrl/Cmd click asks the host for a new tab (ADR 0035 §9a). */
29
+ openRow: (rowId: string, newTab?: boolean) => void;
30
+ }
31
+ export declare abstract class FlatViewUI<Logic extends FlatViewUILogic = FlatViewUILogic> extends DataViewUIBase<Logic> {
32
+ /** Absent outside an editor (a unit test): the wordings read English. */
33
+ accessor std: BlockStdScope;
34
+ protected wording([key, fallback]: ChromeWording): string;
35
+ protected get view(): FlatSingleView<import("./flat-view-manager.js").FlatViewDataType<string>>;
36
+ /**
37
+ * One property's value, drawn and edited by the cell renderer a table cell
38
+ * mounts. `readonly` draws the value only and lets a click through to the
39
+ * card or row, which is how the title opens its row.
40
+ */
41
+ protected renderCell(property: Property, rowId: string, readonly?: boolean): import("lit-html").TemplateResult<1>;
42
+ protected renderOpenButton(rowId: string): import("lit-html").TemplateResult<1>;
43
+ protected renderHeaderWidget(): import("lit-html").TemplateResult | typeof nothing;
44
+ /**
45
+ * The view's rows through `renderBody`: once, or once per visible group
46
+ * under its header, then the hidden groups (B8, PRD REQ-DB-13 and 16). A
47
+ * folded group keeps its header only.
48
+ */
49
+ protected renderGrouped(renderBody: (rows: Row[], group?: Group) => unknown): unknown;
50
+ private renderGroup;
51
+ protected readonly onRowClick: (event: MouseEvent) => void;
52
+ }
53
+ /** The group header both presets draw, the table's title and count. */
54
+ export declare const flatGroupStyles: import("lit").CSSResult;
55
+ /** The open button both presets draw, shown on hover or keyboard focus. */
56
+ export declare const flatOpenButtonStyles: import("lit").CSSResult;