@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,11 @@
1
+ import { type ChromeWording } from '../../../affine-shared/services/index.js';
2
+ import type { BlockStdScope } from '../../../std/index.js';
3
+ export type Wording = (wording: ChromeWording) => string;
4
+ /**
5
+ * Resolve the data-view's wordings through the translation seam when an
6
+ * editor is there (`stdContext`), in English otherwise (a unit test, a
7
+ * standalone mount). A popup renders outside the host, so its opener
8
+ * resolves the words and hands this function down.
9
+ */
10
+ export declare const wordingOf: (std: BlockStdScope | undefined) => Wording;
11
+ export declare const englishWording: Wording;
@@ -0,0 +1,9 @@
1
+ import { translateKey, } from '../../../affine-shared/services/index.js';
2
+ /**
3
+ * Resolve the data-view's wordings through the translation seam when an
4
+ * editor is there (`stdContext`), in English otherwise (a unit test, a
5
+ * standalone mount). A popup renders outside the host, so its opener
6
+ * resolves the words and hands this function down.
7
+ */
8
+ export const wordingOf = (std) => ([key, fallback]) => std ? translateKey(std, key, fallback) : fallback;
9
+ export const englishWording = ([, fallback]) => fallback;
@@ -14,7 +14,14 @@ export type DefaultViewDataType = BasicViewDataType & {
14
14
  export type DataViewDataType = DefaultViewDataType;
15
15
  export type DataViewMode = string;
16
16
  export interface DataViewModelConfig<Data extends DataViewDataType = DataViewDataType> {
17
+ /**
18
+ * The English name a new view of this preset is given, and the fallback of
19
+ * {@link defaultNameKey}. A seed: never translated in place, the creation
20
+ * site writes the resolved name (`viewDefaultName`).
21
+ */
17
22
  defaultName: string;
23
+ /** The `com.labre.*` key of {@link defaultName}; absent, it is shown as is. */
24
+ defaultNameKey?: string;
18
25
  dataViewManager: new (viewManager: ViewManager, viewId: string) => SingleView;
19
26
  defaultData: (viewManager: ViewManager) => Omit<Data, 'id' | 'name' | 'mode'>;
20
27
  }
@@ -0,0 +1,10 @@
1
+ import type { BlockStdScope } from '../../../std/index.js';
2
+ import type { DataViewModel } from './data-view.js';
3
+ /**
4
+ * The name a view created now is given: the preset's `defaultNameKey`
5
+ * resolved through the host's catalogue, its English `defaultName` without
6
+ * an editor (`std` absent) or without a key. A creation site writes what
7
+ * this returns, at the gesture, so the stored name is the one the author saw
8
+ * and the preset's seed never changes (ADR 0023). Never call it on load.
9
+ */
10
+ export declare function viewDefaultName(meta: Pick<DataViewModel, 'model'>, std: BlockStdScope | undefined): string;
@@ -0,0 +1,14 @@
1
+ import { translateKey } from '../../../affine-shared/services/index.js';
2
+ /**
3
+ * The name a view created now is given: the preset's `defaultNameKey`
4
+ * resolved through the host's catalogue, its English `defaultName` without
5
+ * an editor (`std` absent) or without a key. A creation site writes what
6
+ * this returns, at the gesture, so the stored name is the one the author saw
7
+ * and the preset's seed never changes (ADR 0023). Never call it on load.
8
+ */
9
+ export function viewDefaultName(meta, std) {
10
+ const { defaultName, defaultNameKey } = meta.model;
11
+ if (!std || !defaultNameKey)
12
+ return defaultName;
13
+ return translateKey(std, defaultNameKey, defaultName);
14
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './convert.js';
2
2
  export * from './data-view.js';
3
3
  export * from './data-view-base.js';
4
+ export * from './default-name.js';
4
5
  export * from './types.js';
6
+ export * from './open-in.js';
@@ -1,4 +1,6 @@
1
1
  export * from './convert.js';
2
2
  export * from './data-view.js';
3
3
  export * from './data-view-base.js';
4
+ export * from './default-name.js';
4
5
  export * from './types.js';
6
+ export * from './open-in.js';
@@ -0,0 +1,27 @@
1
+ import { type DatabaseViewOpenIn } from '../../../affine-model/index.js';
2
+ import type { DataSource } from '../data-source/base.js';
3
+ import type { SingleView } from '../view-manager/single-view.js';
4
+ /**
5
+ * Where a view opens its rows' pages (ADR 0035 §8, B8; PRD REQ-DB-11): the
6
+ * stored `openIn` of the view, a setting every reader of the view shares.
7
+ * Absent, or a value this build does not know (the list is append-only),
8
+ * reads `side`. The row-open seam (§9a, B9) reads it; this file only reads
9
+ * and writes the setting.
10
+ */
11
+ export declare const DEFAULT_OPEN_IN: DatabaseViewOpenIn;
12
+ export declare function viewOpenIn(data: object | undefined): DatabaseViewOpenIn;
13
+ /**
14
+ * Record a choice of the view settings. Written on that gesture only, and not
15
+ * when it changes nothing: picking "Side peek" on a view that stores no
16
+ * `openIn` leaves the field absent. A read-only view and a fallback view
17
+ * (ADR 0035 §6) are never written. Returns whether it wrote.
18
+ */
19
+ export declare function viewOpenInSet(view: SingleView, openIn: DatabaseViewOpenIn): boolean;
20
+ /**
21
+ * Whether the source says its rows are pages (`rowsAreDocuments`, on the
22
+ * hosted source of `blocks/database`, ADR 0035 §9a). Only then does a row
23
+ * open where `openIn` says, so only then is the setting offered: a
24
+ * block-backed row keeps the detail panel whatever the view stores. Read
25
+ * structurally because the flag is declared above this package.
26
+ */
27
+ export declare function rowsArePages(dataSource: DataSource): boolean;
@@ -0,0 +1,39 @@
1
+ import { DATABASE_VIEW_OPEN_IN, } from '../../../affine-model/index.js';
2
+ /**
3
+ * Where a view opens its rows' pages (ADR 0035 §8, B8; PRD REQ-DB-11): the
4
+ * stored `openIn` of the view, a setting every reader of the view shares.
5
+ * Absent, or a value this build does not know (the list is append-only),
6
+ * reads `side`. The row-open seam (§9a, B9) reads it; this file only reads
7
+ * and writes the setting.
8
+ */
9
+ export const DEFAULT_OPEN_IN = 'side';
10
+ export function viewOpenIn(data) {
11
+ const stored = data?.openIn;
12
+ return DATABASE_VIEW_OPEN_IN.find(mode => mode === stored) ?? DEFAULT_OPEN_IN;
13
+ }
14
+ /**
15
+ * Record a choice of the view settings. Written on that gesture only, and not
16
+ * when it changes nothing: picking "Side peek" on a view that stores no
17
+ * `openIn` leaves the field absent. A read-only view and a fallback view
18
+ * (ADR 0035 §6) are never written. Returns whether it wrote.
19
+ */
20
+ export function viewOpenInSet(view, openIn) {
21
+ if (view.readonly$.peek() || view.shownAsFallback$.peek())
22
+ return false;
23
+ const dataSource = view.manager.dataSource;
24
+ if (viewOpenIn(dataSource.viewDataGet(view.id)) === openIn)
25
+ return false;
26
+ dataSource.viewDataUpdate(view.id, () => ({ openIn }));
27
+ return true;
28
+ }
29
+ /**
30
+ * Whether the source says its rows are pages (`rowsAreDocuments`, on the
31
+ * hosted source of `blocks/database`, ADR 0035 §9a). Only then does a row
32
+ * open where `openIn` says, so only then is the setting offered: a
33
+ * block-backed row keeps the detail panel whatever the view stores. Read
34
+ * structurally because the flag is declared above this package.
35
+ */
36
+ export function rowsArePages(dataSource) {
37
+ return (dataSource.rowsAreDocuments ===
38
+ true);
39
+ }
@@ -1,4 +1,5 @@
1
1
  import { type ReadonlySignal } from '@preact/signals-core';
2
+ import { type CellStatus } from '../data-source/hydration.js';
2
3
  import type { Property } from './property.js';
3
4
  import type { Row } from './row.js';
4
5
  import type { SingleView } from './single-view.js';
@@ -12,6 +13,8 @@ export interface Cell<RawValue = unknown, JsonValue = unknown, Data extends Reco
12
13
  readonly value$: ReadonlySignal<RawValue | undefined>;
13
14
  readonly jsonValue$: ReadonlySignal<JsonValue | undefined>;
14
15
  readonly stringValue$: ReadonlySignal<string | undefined>;
16
+ /** Whether the value is the source's real one yet (ADR 0035 §9e). */
17
+ readonly status$?: ReadonlySignal<CellStatus>;
15
18
  valueSet(value: RawValue | undefined): void;
16
19
  jsonValueSet(value: JsonValue | undefined): void;
17
20
  }
@@ -21,6 +24,7 @@ export declare class CellBase<RawValue = unknown, JsonValue = unknown, Data exte
21
24
  rowId: string;
22
25
  get dataSource(): import("../index.js").DataSource;
23
26
  meta$: ReadonlySignal<import("../index.js").PropertyMetaConfig | undefined>;
27
+ status$: ReadonlySignal<CellStatus>;
24
28
  value$: ReadonlySignal<RawValue>;
25
29
  isEmpty$: ReadonlySignal<boolean>;
26
30
  jsonValue$: ReadonlySignal<JsonValue | undefined>;
@@ -29,6 +33,7 @@ export declare class CellBase<RawValue = unknown, JsonValue = unknown, Data exte
29
33
  get property(): Property<RawValue, JsonValue, Data>;
30
34
  get row(): Row;
31
35
  constructor(view: SingleView, propertyId: string, rowId: string);
36
+ private get _writable();
32
37
  valueSet(value: RawValue | undefined): void;
33
38
  jsonValueSet(value: JsonValue | undefined): void;
34
39
  }
@@ -1,4 +1,5 @@
1
1
  import { computed } from '@preact/signals-core';
2
+ import { cellStatusOf } from '../data-source/hydration.js';
2
3
  import { fromJson } from '../property/utils.js';
3
4
  export class CellBase {
4
5
  get dataSource() {
@@ -17,6 +18,7 @@ export class CellBase {
17
18
  this.meta$ = computed(() => {
18
19
  return this.dataSource.propertyMetaGet(this.property.type$.value);
19
20
  });
21
+ this.status$ = computed(() => cellStatusOf(this.dataSource, this.rowId, this.propertyId));
20
22
  this.value$ = computed(() => {
21
23
  return this.view.manager.dataSource.cellValueGet(this.rowId, this.propertyId);
22
24
  });
@@ -51,10 +53,19 @@ export class CellBase {
51
53
  });
52
54
  });
53
55
  }
56
+ // A value the source has not delivered (or failed to) is never written
57
+ // over: a paste, a fill or a kanban drop on such a cell does nothing.
58
+ get _writable() {
59
+ return this.status$.peek() === 'ready';
60
+ }
54
61
  valueSet(value) {
62
+ if (!this._writable)
63
+ return;
55
64
  this.view.manager.dataSource.cellValueChange(this.rowId, this.propertyId, value);
56
65
  }
57
66
  jsonValueSet(value) {
67
+ if (!this._writable)
68
+ return;
58
69
  const meta = this.property.meta$.value;
59
70
  if (!meta) {
60
71
  return;
@@ -3,3 +3,6 @@ export * from './property.js';
3
3
  export * from './row.js';
4
4
  export * from './single-view.js';
5
5
  export * from './view-manager.js';
6
+ export * from './properties-panel-opener.js';
7
+ export * from './view-creation.js';
8
+ export * from './new-row-menu-opener.js';
@@ -3,3 +3,6 @@ export * from './property.js';
3
3
  export * from './row.js';
4
4
  export * from './single-view.js';
5
5
  export * from './view-manager.js';
6
+ export * from './properties-panel-opener.js';
7
+ export * from './view-creation.js';
8
+ export * from './new-row-menu-opener.js';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Set on a data source (`serviceSet`) by the block that hosts its views when
3
+ * the host offers a menu beside "New" (templates and options, ADR 0035
4
+ * amendment of 2026-10-14). The header's "New" then draws a chevron that
5
+ * calls `open`; the main part still adds a row through `addRow`, as without
6
+ * it. Absent, "New" is the single button of 0.48, nothing else drawn.
7
+ *
8
+ * `label` is resolved by the block, which owns the wording and the
9
+ * translation seam, so data-view declares no key for a host's menu.
10
+ */
11
+ export interface NewRowMenuOpener {
12
+ label(): string;
13
+ /** Asked at every render of "New"; `false` draws no chevron for this
14
+ * view. Absent, the chevron is drawn. */
15
+ canOpen?(viewId: string): boolean;
16
+ open(anchor: HTMLElement, viewId: string): void;
17
+ }
18
+ export declare const NewRowMenuOpenerKey: import("../../../global/di/types.js").ServiceIdentifier<NewRowMenuOpener> & (<U extends NewRowMenuOpener = NewRowMenuOpener>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
@@ -0,0 +1,2 @@
1
+ import { createIdentifier } from '../../../global/di/index.js';
2
+ export const NewRowMenuOpenerKey = createIdentifier('data-view-new-row-menu-opener');
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Set on a data source (`serviceSet`) by the block that hosts its views when
3
+ * the editor has a properties panel (ADR 0035 §9b, issue B10): the view
4
+ * options' "Properties" then opens that panel on the view instead of the
5
+ * popover. Absent, the popover, as in 0.48: the only way back to a hidden
6
+ * property must always exist, and here it is the panel or the popover.
7
+ */
8
+ export declare const PropertiesPanelOpenerKey: import("../../../global/di/types.js").ServiceIdentifier<(viewId: string) => void> & (<U extends (viewId: string) => void = (viewId: string) => void>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
@@ -0,0 +1,9 @@
1
+ import { createIdentifier } from '../../../global/di/index.js';
2
+ /**
3
+ * Set on a data source (`serviceSet`) by the block that hosts its views when
4
+ * the editor has a properties panel (ADR 0035 §9b, issue B10): the view
5
+ * options' "Properties" then opens that panel on the view instead of the
6
+ * popover. Absent, the popover, as in 0.48: the only way back to a hidden
7
+ * property must always exist, and here it is the panel or the popover.
8
+ */
9
+ export const PropertiesPanelOpenerKey = createIdentifier('data-view-properties-panel-opener');
@@ -1,6 +1,7 @@
1
1
  import type { UniComponent } from '../../../affine-shared/types/index.js';
2
2
  import type { InsertToPosition } from '../../../affine-shared/utils/index.js';
3
3
  import { type ReadonlySignal } from '@preact/signals-core';
4
+ import type { TagOptionEdits } from '../component/tags/multi-tag-select.js';
4
5
  import type { TypeInstance } from '../logical/type.js';
5
6
  import type { CellRenderer, PropertyMetaConfig } from '../property/index.js';
6
7
  import type { PropertyDataUpdater } from '../types.js';
@@ -33,6 +34,13 @@ export interface Property<RawValue = unknown, JsonValue = unknown, Data extends
33
34
  * creates, edits and reorders no option (`standalone-cell.ts`).
34
35
  */
35
36
  readonly dataCanSet?: boolean;
37
+ /**
38
+ * Which option edits a select's `dataUpdate` stands for when it writes
39
+ * (`TagOptionEdits`); absent means all of them. A standalone cell whose
40
+ * host writes options one create or rename at a time says
41
+ * `'create-rename'`, and the tag menu offers no delete, colour or reorder.
42
+ */
43
+ readonly optionEdits?: TagOptionEdits;
36
44
  readonly type$: ReadonlySignal<string>;
37
45
  readonly typeSet?: (type: string) => void;
38
46
  get typeCanSet(): boolean;
@@ -1,6 +1,7 @@
1
1
  import type { InsertToPosition } from '../../../affine-shared/utils/index.js';
2
2
  import type { GeneralServiceIdentifier } from '../../../global/di/index.js';
3
3
  import { type ReadonlySignal } from '@preact/signals-core';
4
+ import type { DataSource } from '../data-source/base.js';
4
5
  import type { Variable } from '../expression/types.js';
5
6
  import type { PropertyMetaConfig } from '../property/property-config.js';
6
7
  import type { TraitKey } from '../traits/key.js';
@@ -10,6 +11,14 @@ import { type Cell } from './cell.js';
10
11
  import type { Property } from './property.js';
11
12
  import { type Row } from './row.js';
12
13
  import type { ViewManager } from './view-manager.js';
14
+ /**
15
+ * True when a stored `mode` has no preset of its own and the source draws it
16
+ * through another one (ADR 0035 §6: a `timeline`, a mode from a newer
17
+ * client, an import). The one spelling of the rule, read by
18
+ * `SingleView.shownAsFallback$` and by the views bar's tabs, which must not
19
+ * build a view per tab to ask.
20
+ */
21
+ export declare function modeShownAsFallback(dataSource: Pick<DataSource, 'viewMetaGet'>, mode: string): boolean;
13
22
  export type MainProperties = {
14
23
  titleColumn?: string;
15
24
  iconColumn?: string;
@@ -21,6 +30,11 @@ export interface SingleView {
21
30
  readonly manager: ViewManager;
22
31
  readonly meta: ViewMeta;
23
32
  readonly readonly$: ReadonlySignal<boolean>;
33
+ /**
34
+ * The stored mode has no preset here and `meta` is the source's fallback:
35
+ * the view is drawn, its settings are read-only, its data is never written.
36
+ */
37
+ readonly shownAsFallback$: ReadonlySignal<boolean>;
24
38
  delete(): void;
25
39
  duplicate(): void;
26
40
  readonly name$: ReadonlySignal<string>;
@@ -57,6 +71,19 @@ export declare abstract class SingleViewBase<ViewData extends DataViewDataType =
57
71
  id: string;
58
72
  private readonly searchString;
59
73
  private readonly traitMap;
74
+ /** The view data exactly as stored, whatever its mode. */
75
+ private readonly storedData$;
76
+ /**
77
+ * {@link modeShownAsFallback} for this view. Read from the stored mode,
78
+ * never from `type`, which a preset may derive from {@link data$}.
79
+ */
80
+ readonly shownAsFallback$: ReadonlySignal<boolean>;
81
+ /**
82
+ * A fallback view reads the preset's DEFAULT data, keeping only its id,
83
+ * name and stored mode: the stored keys belong to a preset this client does
84
+ * not have, so neither a filter nor a column list is trusted from them, and
85
+ * the preset draws the source's properties as a fresh view would.
86
+ */
60
87
  data$: ReadonlySignal<ViewData | undefined>;
61
88
  abstract detailProperties$: ReadonlySignal<Property[]>;
62
89
  protected lockRows$: import("@preact/signals-core").Signal<boolean>;
@@ -79,7 +106,7 @@ export declare abstract class SingleViewBase<ViewData extends DataViewDataType =
79
106
  icon: import("../../../affine-shared/types/uni-component.js").UniComponent | undefined;
80
107
  propertyType: string;
81
108
  }[]>;
82
- protected get dataSource(): import("../index.js").DataSource;
109
+ protected get dataSource(): DataSource;
83
110
  get featureFlags$(): ReadonlySignal<DatabaseFlags>;
84
111
  get isLocked(): boolean;
85
112
  get meta(): ViewMeta;
@@ -2,6 +2,16 @@ import { computed, signal } from '@preact/signals-core';
2
2
  import { computedLock } from '../utils/lock.js';
3
3
  import { CellBase } from './cell.js';
4
4
  import { RowBase } from './row.js';
5
+ /**
6
+ * True when a stored `mode` has no preset of its own and the source draws it
7
+ * through another one (ADR 0035 §6: a `timeline`, a mode from a newer
8
+ * client, an import). The one spelling of the rule, read by
9
+ * `SingleView.shownAsFallback$` and by the views bar's tabs, which must not
10
+ * build a view per tab to ask.
11
+ */
12
+ export function modeShownAsFallback(dataSource, mode) {
13
+ return dataSource.viewMetaGet(mode).type !== mode;
14
+ }
5
15
  export class SingleViewBase {
6
16
  rowsDelete(rows) {
7
17
  this.lockRows(false);
@@ -27,9 +37,37 @@ export class SingleViewBase {
27
37
  this.id = id;
28
38
  this.searchString = signal('');
29
39
  this.traitMap = new Map();
30
- this.data$ = computed(() => {
40
+ /** The view data exactly as stored, whatever its mode. */
41
+ this.storedData$ = computed(() => {
31
42
  return this.dataSource.viewDataGet(this.id);
32
43
  });
44
+ /**
45
+ * {@link modeShownAsFallback} for this view. Read from the stored mode,
46
+ * never from `type`, which a preset may derive from {@link data$}.
47
+ */
48
+ this.shownAsFallback$ = computed(() => {
49
+ const mode = this.storedData$.value?.mode;
50
+ return mode != null && modeShownAsFallback(this.dataSource, mode);
51
+ });
52
+ /**
53
+ * A fallback view reads the preset's DEFAULT data, keeping only its id,
54
+ * name and stored mode: the stored keys belong to a preset this client does
55
+ * not have, so neither a filter nor a column list is trusted from them, and
56
+ * the preset draws the source's properties as a fresh view would.
57
+ */
58
+ this.data$ = computed(() => {
59
+ const stored = this.storedData$.value;
60
+ if (!stored || !this.shownAsFallback$.value) {
61
+ return stored;
62
+ }
63
+ const meta = this.dataSource.viewMetaGet(stored.mode);
64
+ return {
65
+ ...meta.model.defaultData(this.manager),
66
+ id: stored.id,
67
+ name: stored.name,
68
+ mode: stored.mode,
69
+ };
70
+ });
33
71
  this.lockRows$ = signal(false);
34
72
  this.isLocked$ = computed(() => {
35
73
  return this.lockRows$.value;
@@ -96,6 +134,12 @@ export class SingleViewBase {
96
134
  return this.dataSource.serviceGetOrCreate(key, create);
97
135
  }
98
136
  dataUpdate(updater) {
137
+ // A fallback view's stored data is never rewritten (ADR 0035 §6): every
138
+ // setting it shows is the fallback preset's default, and writing one back
139
+ // would mix that preset's keys into another mode's data. Cells are the
140
+ // source's, not the view's, and stay writable.
141
+ if (this.shownAsFallback$.peek())
142
+ return;
99
143
  this.dataSource.viewDataUpdate(this.id, updater);
100
144
  }
101
145
  delete() {
@@ -0,0 +1,49 @@
1
+ import type { MenuConfig } from '../../../affine-components/context-menu/index.js';
2
+ import type { BlockStdScope } from '../../../std/index.js';
3
+ import { type ExtensionType } from '../../../store/index.js';
4
+ import type { DataSource } from '../data-source/base.js';
5
+ import type { ViewManager } from './view-manager.js';
6
+ /**
7
+ * Set to `true` on a data source (`serviceSet`) whose host switched off the
8
+ * tooling that CREATES views: the views bar then offers no "+" and no
9
+ * "Create …" (ADR 0035 §5, ADR 0009). Absent means offered, so every source
10
+ * that never sets it keeps its 0.48 views bar. The stored views keep
11
+ * rendering, switching layout and being deleted: only creation is tooling.
12
+ */
13
+ export declare const ViewCreationOffKey: import("../../../global/di/types.js").ServiceIdentifier<true> & (<U extends true = true>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
14
+ /**
15
+ * "Duplicate as table": the way out of a view shown through a fallback
16
+ * preset (`SingleView.shownAsFallback$`). Adds a view of the preset that drew
17
+ * it, under the same name, with that preset's default data, and selects it;
18
+ * the stored view is left exactly as it was, so a client that knows its mode
19
+ * still reads it. Returns the new view's id, or `undefined` when there is no
20
+ * such view or it is not a fallback.
21
+ */
22
+ export declare function duplicateAsShownPreset(manager: ViewManager, viewId: string): string | undefined;
23
+ /** What the views bar hands an {@link AddViewMenu} when "+" is clicked. */
24
+ export interface AddViewMenuContext {
25
+ /** The editor the bar is mounted in; absent outside one. */
26
+ std: BlockStdScope | undefined;
27
+ dataSource: DataSource;
28
+ viewManager: ViewManager;
29
+ /**
30
+ * The bar's own "add a view of this preset": adds it with the preset's
31
+ * default data and its name resolved at the gesture, selects it and traces
32
+ * `DatabaseViewAdded` once, `source` (default `existing`) saying whether the
33
+ * gesture created the source the view reads. Returns its id.
34
+ */
35
+ addView: (type: string, source?: 'existing' | 'new') => string;
36
+ }
37
+ /**
38
+ * The "+" menu of the views bar, when something above data-view knows more
39
+ * than the presets (ADR 0035 §1, B11): the `core-database` bundle registers
40
+ * one from its tooling extension to offer "on an existing source" and "with
41
+ * a new source". It is a registry between library packages, never filled by
42
+ * a host. Absent, or answering `undefined` for a data source it does not
43
+ * handle, the bar offers the creatable presets, as in 0.48.
44
+ */
45
+ export interface AddViewMenu {
46
+ items(context: AddViewMenuContext): MenuConfig[] | undefined;
47
+ }
48
+ export declare const AddViewMenuIdentifier: import("../../../global/di/types.js").ServiceIdentifier<AddViewMenu> & (<U extends AddViewMenu = AddViewMenu>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
49
+ export declare function AddViewMenuExtension(menu: AddViewMenu): ExtensionType;
@@ -0,0 +1,40 @@
1
+ import { createIdentifier } from '../../../global/di/index.js';
2
+ import { nanoid } from '../../../store/index.js';
3
+ /**
4
+ * Set to `true` on a data source (`serviceSet`) whose host switched off the
5
+ * tooling that CREATES views: the views bar then offers no "+" and no
6
+ * "Create …" (ADR 0035 §5, ADR 0009). Absent means offered, so every source
7
+ * that never sets it keeps its 0.48 views bar. The stored views keep
8
+ * rendering, switching layout and being deleted: only creation is tooling.
9
+ */
10
+ export const ViewCreationOffKey = createIdentifier('data-view-view-creation-off');
11
+ /**
12
+ * "Duplicate as table": the way out of a view shown through a fallback
13
+ * preset (`SingleView.shownAsFallback$`). Adds a view of the preset that drew
14
+ * it, under the same name, with that preset's default data, and selects it;
15
+ * the stored view is left exactly as it was, so a client that knows its mode
16
+ * still reads it. Returns the new view's id, or `undefined` when there is no
17
+ * such view or it is not a fallback.
18
+ */
19
+ export function duplicateAsShownPreset(manager, viewId) {
20
+ const view = manager.viewGet(viewId);
21
+ if (!view || !view.shownAsFallback$.peek())
22
+ return;
23
+ const meta = view.meta;
24
+ const id = manager.dataSource.viewDataAdd({
25
+ ...meta.model.defaultData(manager),
26
+ id: nanoid(),
27
+ name: view.name$.peek(),
28
+ mode: meta.type,
29
+ });
30
+ manager.setCurrentView(id);
31
+ return id;
32
+ }
33
+ export const AddViewMenuIdentifier = createIdentifier('DataViewAddViewMenu');
34
+ export function AddViewMenuExtension(menu) {
35
+ return {
36
+ setup: di => {
37
+ di.override(AddViewMenuIdentifier, () => menu);
38
+ },
39
+ };
40
+ }
@@ -12,7 +12,11 @@ export interface ViewManager {
12
12
  setCurrentView(id: string): void;
13
13
  views$: ReadonlySignal<string[]>;
14
14
  viewGet(id: string): SingleView | undefined;
15
- viewAdd(type: DataViewMode): string;
15
+ /**
16
+ * `name` is what the creation site resolved (`viewDefaultName`); absent,
17
+ * the preset's English `defaultName` is written, as in 0.48.
18
+ */
19
+ viewAdd(type: DataViewMode, name?: string): string;
16
20
  viewDelete(id: string): void;
17
21
  viewDuplicate(id: string): void;
18
22
  viewDataGet(id: string): DataViewDataType | undefined;
@@ -30,7 +34,7 @@ export declare class ViewManagerBase implements ViewManager {
30
34
  constructor(dataSource: DataSource);
31
35
  moveTo(id: string, position: InsertToPosition): void;
32
36
  setCurrentView(id: string | undefined): void;
33
- viewAdd(type: DataViewMode): string;
37
+ viewAdd(type: DataViewMode, name?: string): string;
34
38
  viewChangeType(id: string, type: string): void;
35
39
  viewDataGet(id: string): DataViewDataType | undefined;
36
40
  viewDelete(id: string): void;
@@ -29,13 +29,13 @@ export class ViewManagerBase {
29
29
  setCurrentView(id) {
30
30
  this._currentViewId$.value = id;
31
31
  }
32
- viewAdd(type) {
32
+ viewAdd(type, name) {
33
33
  const meta = this.dataSource.viewMetaGet(type);
34
34
  const data = meta.model.defaultData(this);
35
35
  const id = this.dataSource.viewDataAdd({
36
36
  ...data,
37
37
  id: nanoid(),
38
- name: meta.model.defaultName,
38
+ name: name ?? meta.model.defaultName,
39
39
  mode: type,
40
40
  });
41
41
  this.setCurrentView(id);
@@ -1,6 +1,8 @@
1
1
  import { BaseCellRenderer } from '../../core/property/index.js';
2
2
  export declare class DateCell extends BaseCellRenderer<number, number> {
3
3
  private _prevPortalAbortController;
4
+ /** The picker opens in a popup: its words and locale are resolved here. */
5
+ private createDatePicker;
4
6
  private readonly openDatePicker;
5
7
  private readonly updateValue;
6
8
  tempValue$: import("@preact/signals-core").Signal<Date | undefined>;
@@ -1,5 +1,6 @@
1
1
  import { popMenu, popupTargetFromElement, } from '../../../affine-components/context-menu/index.js';
2
2
  import { DatePicker } from '../../../affine-components/date-picker/index.js';
3
+ import { formatLocale } from '../../../affine-shared/services/index.js';
3
4
  import { createLitPortal } from '../../../affine-components/portal/index.js';
4
5
  import { IS_MOBILE } from '../../../global/env/index.js';
5
6
  import { flip, offset } from '@floating-ui/dom';
@@ -40,7 +41,7 @@ export class DateCell extends BaseCellRenderer {
40
41
  ${this.formattedTempValue$.value}
41
42
  </div>`,
42
43
  () => {
43
- const datePicker = new DatePicker();
44
+ const datePicker = this.createDatePicker();
44
45
  datePicker.padding = 0;
45
46
  datePicker.value = this.tempValue$.value?.getTime() ?? Date.now();
46
47
  datePicker.onChange = (date) => {
@@ -71,7 +72,7 @@ export class DateCell extends BaseCellRenderer {
71
72
  middleware: [offset(10), flip()],
72
73
  },
73
74
  template: () => {
74
- const datePicker = new DatePicker();
75
+ const datePicker = this.createDatePicker();
75
76
  datePicker.value = this.tempValue$.value?.getTime() ?? Date.now();
76
77
  datePicker.popup = true;
77
78
  datePicker.onClear = () => {
@@ -114,6 +115,14 @@ export class DateCell extends BaseCellRenderer {
114
115
  this.format(this.value ? new Date(this.value) : undefined));
115
116
  });
116
117
  }
118
+ /** The picker opens in a popup: its words and locale are resolved here. */
119
+ createDatePicker() {
120
+ const datePicker = new DatePicker();
121
+ datePicker.wording = this.wording;
122
+ if (this.chromeStd)
123
+ datePicker.locale = formatLocale(this.chromeStd);
124
+ return datePicker;
125
+ }
117
126
  format(value) {
118
127
  return value ? format(value, 'yyyy/MM/dd') : '';
119
128
  }
@@ -17,6 +17,7 @@ export class MultiSelectCell extends BaseCellRenderer {
17
17
  name: this.cell.property.name$.value,
18
18
  options: this.options$,
19
19
  onOptionsChange: this.property.dataCanSet === false ? undefined : this._onOptionsChange,
20
+ optionEdits: this.property.optionEdits,
20
21
  value: this._value$,
21
22
  onChange: v => {
22
23
  this.valueSetImmediate(v);
@@ -24,6 +25,7 @@ export class MultiSelectCell extends BaseCellRenderer {
24
25
  onComplete: this._editComplete,
25
26
  minWidth: 400,
26
27
  initialDraftText,
28
+ wording: this.wording,
27
29
  });
28
30
  };
29
31
  this._editComplete = () => {
@@ -17,6 +17,7 @@ export class SelectCell extends BaseCellRenderer {
17
17
  mode: 'single',
18
18
  options: this.options$,
19
19
  onOptionsChange: this.property.dataCanSet === false ? undefined : this._onOptionsChange,
20
+ optionEdits: this.property.optionEdits,
20
21
  value: this._value$,
21
22
  onChange: v => {
22
23
  this.valueSetImmediate(v[0]);
@@ -24,6 +25,7 @@ export class SelectCell extends BaseCellRenderer {
24
25
  onComplete: this._editComplete,
25
26
  minWidth: 400,
26
27
  initialDraftText,
28
+ wording: this.wording,
27
29
  });
28
30
  };
29
31
  this._editComplete = () => {