@formicoidea/labre-core 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/architecture/code.c4 +37 -34
  2. package/architecture/likec4.config.json +3 -3
  3. package/dist/_pkgs/affine-block-surface/extensions/reading-toolbar.js +12 -12
  4. package/dist/_pkgs/affine-components/context-menu/menu-renderer.d.ts +3 -1
  5. package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +9 -1
  6. package/dist/_pkgs/affine-components/context-menu/menu.d.ts +7 -0
  7. package/dist/_pkgs/affine-components/context-menu/menu.js +5 -0
  8. package/dist/_pkgs/affine-components/context-menu/sub-menu.d.ts +16 -1
  9. package/dist/_pkgs/affine-components/context-menu/sub-menu.js +32 -5
  10. package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
  11. package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
  12. package/dist/_pkgs/affine-database-block/configs/slash-menu.js +14 -6
  13. package/dist/_pkgs/affine-database-block/database-block-styles.js +4 -3
  14. package/dist/_pkgs/affine-database-block/database-block.js +6 -18
  15. package/dist/_pkgs/affine-database-block/database-dnd-preview-block.js +5 -1
  16. package/dist/_pkgs/affine-database-block/detail-panel/block-renderer.js +5 -2
  17. package/dist/_pkgs/affine-database-block/detail-panel/note-renderer.js +3 -2
  18. package/dist/_pkgs/affine-database-block/external-data-source.d.ts +10 -0
  19. package/dist/_pkgs/affine-database-block/external-data-source.js +24 -0
  20. package/dist/_pkgs/affine-database-block/properties/created-time/define.js +3 -1
  21. package/dist/_pkgs/affine-database-block/properties/link/cell-renderer.js +3 -2
  22. package/dist/_pkgs/affine-database-block/properties/link/define.js +3 -1
  23. package/dist/_pkgs/affine-database-block/properties/rich-text/define.js +3 -1
  24. package/dist/_pkgs/affine-database-block/properties/text/hosted.js +1 -0
  25. package/dist/_pkgs/affine-database-block/properties/title/define.js +3 -1
  26. package/dist/_pkgs/affine-database-block/properties/title/hosted.js +1 -0
  27. package/dist/_pkgs/affine-database-block/service/new-row-menu.d.ts +1 -1
  28. package/dist/_pkgs/affine-database-block/service/new-row-menu.js +1 -1
  29. package/dist/_pkgs/affine-database-block/translations.d.ts +11 -0
  30. package/dist/_pkgs/affine-database-block/translations.js +57 -0
  31. package/dist/_pkgs/affine-database-block/views/index.d.ts +7 -9
  32. package/dist/_pkgs/affine-database-block/views/index.js +7 -10
  33. package/dist/_pkgs/affine-database-engine/core/common/properties.js +7 -7
  34. package/dist/_pkgs/affine-database-engine/core/common/property-menu.d.ts +18 -2
  35. package/dist/_pkgs/affine-database-engine/core/common/property-menu.js +78 -27
  36. package/dist/_pkgs/affine-database-engine/core/data-source/base.d.ts +11 -0
  37. package/dist/_pkgs/affine-database-engine/core/data-source/base.js +3 -0
  38. package/dist/_pkgs/affine-database-engine/core/detail/detail.js +8 -5
  39. package/dist/_pkgs/affine-database-engine/core/detail/field.js +14 -7
  40. package/dist/_pkgs/affine-database-engine/core/filter/add-filter.js +4 -2
  41. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/boolean.js +7 -4
  42. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/create.d.ts +9 -1
  43. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/create.js +2 -0
  44. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/date.js +7 -4
  45. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/multi-tag.js +17 -8
  46. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/number.js +6 -6
  47. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/string.js +19 -12
  48. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/tag.js +9 -4
  49. package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/unknown.js +7 -4
  50. package/dist/_pkgs/affine-database-engine/core/filter/literal/define.js +6 -4
  51. package/dist/_pkgs/affine-database-engine/core/filter/literal/matcher.d.ts +2 -1
  52. package/dist/_pkgs/affine-database-engine/core/filter/literal/matcher.js +3 -2
  53. package/dist/_pkgs/affine-database-engine/core/filter/literal/types.d.ts +4 -1
  54. package/dist/_pkgs/affine-database-engine/core/filter/literal/types.js +1 -1
  55. package/dist/_pkgs/affine-database-engine/core/group-by/define.js +11 -9
  56. package/dist/_pkgs/affine-database-engine/core/group-by/group-title.js +16 -6
  57. package/dist/_pkgs/affine-database-engine/core/group-by/locate-row.d.ts +16 -0
  58. package/dist/_pkgs/affine-database-engine/core/group-by/locate-row.js +32 -0
  59. package/dist/_pkgs/affine-database-engine/core/group-by/renderer/date-group.js +10 -3
  60. package/dist/_pkgs/affine-database-engine/core/group-by/setting.d.ts +2 -0
  61. package/dist/_pkgs/affine-database-engine/core/group-by/setting.js +40 -28
  62. package/dist/_pkgs/affine-database-engine/core/group-by/trait.d.ts +3 -0
  63. package/dist/_pkgs/affine-database-engine/core/group-by/trait.js +8 -0
  64. package/dist/_pkgs/affine-database-engine/core/group-by/types.d.ts +3 -1
  65. package/dist/_pkgs/affine-database-engine/core/group-by/types.js +1 -1
  66. package/dist/_pkgs/affine-database-engine/core/property/types.d.ts +7 -0
  67. package/dist/_pkgs/affine-database-engine/core/property/types.js +1 -1
  68. package/dist/_pkgs/affine-database-engine/core/sort/add-sort.js +3 -1
  69. package/dist/_pkgs/affine-database-engine/core/statistics/any.js +43 -21
  70. package/dist/_pkgs/affine-database-engine/core/statistics/checkbox.js +29 -14
  71. package/dist/_pkgs/affine-database-engine/core/statistics/number.js +54 -31
  72. package/dist/_pkgs/affine-database-engine/core/statistics/types.d.ts +8 -0
  73. package/dist/_pkgs/affine-database-engine/core/statistics/types.js +2 -1
  74. package/dist/_pkgs/affine-database-engine/core/utils/wording.d.ts +20 -1
  75. package/dist/_pkgs/affine-database-engine/core/utils/wording.js +24 -0
  76. package/dist/_pkgs/affine-database-engine/core/view-manager/property.d.ts +7 -0
  77. package/dist/_pkgs/affine-database-engine/core/view-manager/property.js +29 -5
  78. package/dist/_pkgs/affine-database-engine/core/view-manager/single-view.d.ts +14 -0
  79. package/dist/_pkgs/affine-database-engine/core/view-manager/single-view.js +11 -0
  80. package/dist/_pkgs/affine-database-engine/property-presets/checkbox/define.js +3 -1
  81. package/dist/_pkgs/affine-database-engine/property-presets/date/define.js +3 -1
  82. package/dist/_pkgs/affine-database-engine/property-presets/multi-select/define.js +3 -1
  83. package/dist/_pkgs/affine-database-engine/property-presets/number/define.js +3 -1
  84. package/dist/_pkgs/affine-database-engine/property-presets/number/utils/formats.d.ts +3 -0
  85. package/dist/_pkgs/affine-database-engine/property-presets/number/utils/formats.js +56 -9
  86. package/dist/_pkgs/affine-database-engine/property-presets/progress/define.js +3 -1
  87. package/dist/_pkgs/affine-database-engine/property-presets/select/define.js +3 -1
  88. package/dist/_pkgs/affine-database-engine/property-presets/text/define.js +3 -1
  89. package/dist/_pkgs/affine-database-engine/translations.d.ts +133 -5
  90. package/dist/_pkgs/affine-database-engine/translations.js +625 -9
  91. package/dist/_pkgs/affine-database-engine/view-presets/convert.js +0 -28
  92. package/dist/_pkgs/affine-database-engine/view-presets/effect.js +0 -2
  93. package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-converts.js +2 -4
  94. package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-view-ui.d.ts +57 -0
  95. package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-view-ui.js +113 -4
  96. package/dist/_pkgs/affine-database-engine/view-presets/gallery/gallery-view.js +2 -1
  97. package/dist/_pkgs/affine-database-engine/view-presets/index.d.ts +0 -2
  98. package/dist/_pkgs/affine-database-engine/view-presets/index.js +0 -3
  99. package/dist/_pkgs/affine-database-engine/view-presets/kanban/kanban-view-manager.js +2 -0
  100. package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/group.js +7 -5
  101. package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/kanban-view-ui-logic.d.ts +5 -0
  102. package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/kanban-view-ui-logic.js +25 -3
  103. package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/menu.js +12 -6
  104. package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/controller/selection.d.ts +8 -0
  105. package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/controller/selection.js +35 -12
  106. package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/group.js +7 -5
  107. package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/header.js +5 -1
  108. package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/kanban-view-ui-logic.d.ts +5 -0
  109. package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/kanban-view-ui-logic.js +8 -4
  110. package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/menu.js +12 -6
  111. package/dist/_pkgs/affine-database-engine/view-presets/list/list-view.js +2 -1
  112. package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/column-header.js +6 -4
  113. package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/group.js +6 -5
  114. package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/header.js +2 -2
  115. package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/table-view-ui-logic.d.ts +4 -3
  116. package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/table-view-ui-logic.js +29 -5
  117. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/controller/clipboard.js +6 -2
  118. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/controller/selection.js +2 -0
  119. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/group.js +6 -5
  120. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/column-header.js +11 -7
  121. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/database-header-column.js +16 -12
  122. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/number-format-bar.js +4 -2
  123. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/menu.js +9 -6
  124. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/table-view-ui-logic.d.ts +8 -1
  125. package/dist/_pkgs/affine-database-engine/view-presets/table/pc/table-view-ui-logic.js +29 -7
  126. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/clipboard.js +6 -2
  127. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/selection.js +2 -0
  128. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/group-footer.js +5 -2
  129. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.d.ts +1 -1
  130. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +14 -6
  131. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-header.js +5 -2
  132. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-title.js +5 -3
  133. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/column-header.js +17 -10
  134. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/number-format-bar.js +4 -2
  135. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/single-column-header.js +20 -14
  136. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/row/menu.js +9 -6
  137. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/table-view-ui-logic.d.ts +6 -1
  138. package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/table-view-ui-logic.js +30 -3
  139. package/dist/_pkgs/affine-database-engine/view-presets/table/stats/column-stats-column.d.ts +1 -1
  140. package/dist/_pkgs/affine-database-engine/view-presets/table/stats/column-stats-column.js +14 -6
  141. package/dist/_pkgs/affine-database-engine/view-presets/table/table-view-manager.js +2 -0
  142. package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/condition-view.d.ts +2 -0
  143. package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/condition-view.js +13 -6
  144. package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/group-panel-view.js +20 -13
  145. package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/root-panel-view.js +10 -5
  146. package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/sort/root-panel.js +8 -5
  147. package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/search/search.js +2 -2
  148. package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/table-add-row/add-row.d.ts +6 -0
  149. package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/table-add-row/add-row.js +49 -4
  150. package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/view-options/view-settings.d.ts +3 -3
  151. package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/view-options/view-settings.js +3 -3
  152. package/dist/_pkgs/affine-database-engine/widget-presets/views-bar/views-view.js +5 -0
  153. package/dist/_pkgs/affine-database-view-block/configs/slash-menu.js +6 -3
  154. package/dist/_pkgs/affine-database-view-block/data-view-block.js +5 -4
  155. package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +3 -2
  156. package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +3 -2
  157. package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +31 -0
  158. package/dist/_pkgs/affine-widget-edgeless-zoom-toolbar/index.js +26 -26
  159. package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
  160. package/dist/_pkgs/affine-widget-page-dragging-area/index.js +10 -10
  161. package/dist/_pkgs/affine-widget-viewport-overlay/index.js +13 -13
  162. package/package.json +1 -1
  163. package/dist/_pkgs/affine-database-engine/view-presets/calendar/calendar-view-manager.d.ts +0 -70
  164. package/dist/_pkgs/affine-database-engine/view-presets/calendar/calendar-view-manager.js +0 -449
  165. package/dist/_pkgs/affine-database-engine/view-presets/calendar/define.d.ts +0 -10
  166. package/dist/_pkgs/affine-database-engine/view-presets/calendar/define.js +0 -29
  167. package/dist/_pkgs/affine-database-engine/view-presets/calendar/effect.d.ts +0 -1
  168. package/dist/_pkgs/affine-database-engine/view-presets/calendar/effect.js +0 -4
  169. package/dist/_pkgs/affine-database-engine/view-presets/calendar/index.d.ts +0 -6
  170. package/dist/_pkgs/affine-database-engine/view-presets/calendar/index.js +0 -6
  171. package/dist/_pkgs/affine-database-engine/view-presets/calendar/layout.d.ts +0 -37
  172. package/dist/_pkgs/affine-database-engine/view-presets/calendar/layout.js +0 -138
  173. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/actions.d.ts +0 -7
  174. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/actions.js +0 -64
  175. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/dnd.d.ts +0 -32
  176. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/dnd.js +0 -159
  177. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/effect.d.ts +0 -1
  178. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/effect.js +0 -7
  179. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/hit-test.d.ts +0 -1
  180. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/hit-test.js +0 -28
  181. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/styles.d.ts +0 -1
  182. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/styles.js +0 -707
  183. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/view.d.ts +0 -89
  184. package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/view.js +0 -849
  185. package/dist/_pkgs/affine-database-engine/view-presets/calendar/renderer.d.ts +0 -2
  186. package/dist/_pkgs/affine-database-engine/view-presets/calendar/renderer.js +0 -8
  187. package/dist/_pkgs/affine-database-engine/view-presets/calendar/source.d.ts +0 -8
  188. package/dist/_pkgs/affine-database-engine/view-presets/calendar/source.js +0 -3
  189. package/dist/_pkgs/affine-database-engine/view-presets/calendar/types.d.ts +0 -79
  190. package/dist/_pkgs/affine-database-engine/view-presets/calendar/types.js +0 -1
@@ -1,41 +1,55 @@
1
1
  import { t } from '../logical/index.js';
2
2
  import { createStatisticConfig } from './create.js';
3
+ import { DATA_VIEW_STATS_GROUP_MORE, DATA_VIEW_STATS_SUM, DATA_VIEW_STATS_AVERAGE, DATA_VIEW_STATS_MEDIAN, DATA_VIEW_STATS_MIN, DATA_VIEW_STATS_MAX, DATA_VIEW_STATS_RANGE, } from '../../translations.js';
4
+ import {} from '../utils/wording.js';
5
+ import { LINE_STYLE_NONE } from '../../../affine-components/translations.js';
6
+ /** The footer's "None", for a column with no number. */
7
+ const none = (wording) => wording ? wording(LINE_STYLE_NONE) : LINE_STYLE_NONE[1];
3
8
  export const numberStatsFunctions = [
4
9
  createStatisticConfig({
5
- group: 'More options',
6
- menuName: 'Sum',
10
+ group: DATA_VIEW_STATS_GROUP_MORE[1],
11
+ groupWording: DATA_VIEW_STATS_GROUP_MORE,
12
+ menuName: DATA_VIEW_STATS_SUM[1],
13
+ menuWording: DATA_VIEW_STATS_SUM,
7
14
  type: 'sum',
8
- displayName: 'Sum',
15
+ displayName: DATA_VIEW_STATS_SUM[1],
16
+ displayWording: DATA_VIEW_STATS_SUM,
9
17
  dataType: t.number.instance(),
10
- impl: data => {
18
+ impl: (data, { wording }) => {
11
19
  const numbers = withoutNull(data);
12
20
  if (numbers.length === 0) {
13
- return 'None';
21
+ return none(wording);
14
22
  }
15
23
  return parseFloat(numbers.reduce((a, b) => a + b, 0).toFixed(2)).toString();
16
24
  },
17
25
  }),
18
26
  createStatisticConfig({
19
- group: 'More options',
20
- menuName: 'Average',
21
- displayName: 'Average',
27
+ group: DATA_VIEW_STATS_GROUP_MORE[1],
28
+ groupWording: DATA_VIEW_STATS_GROUP_MORE,
29
+ menuName: DATA_VIEW_STATS_AVERAGE[1],
30
+ menuWording: DATA_VIEW_STATS_AVERAGE,
31
+ displayName: DATA_VIEW_STATS_AVERAGE[1],
32
+ displayWording: DATA_VIEW_STATS_AVERAGE,
22
33
  type: 'average',
23
34
  dataType: t.number.instance(),
24
- impl: data => {
35
+ impl: (data, { wording }) => {
25
36
  const numbers = withoutNull(data);
26
37
  if (numbers.length === 0) {
27
- return 'None';
38
+ return none(wording);
28
39
  }
29
40
  return parseFloat((numbers.reduce((a, b) => a + b, 0) / numbers.length).toFixed(2)).toString();
30
41
  },
31
42
  }),
32
43
  createStatisticConfig({
33
- group: 'More options',
34
- menuName: 'Median',
35
- displayName: 'Median',
44
+ group: DATA_VIEW_STATS_GROUP_MORE[1],
45
+ groupWording: DATA_VIEW_STATS_GROUP_MORE,
46
+ menuName: DATA_VIEW_STATS_MEDIAN[1],
47
+ menuWording: DATA_VIEW_STATS_MEDIAN,
48
+ displayName: DATA_VIEW_STATS_MEDIAN[1],
49
+ displayWording: DATA_VIEW_STATS_MEDIAN,
36
50
  type: 'median',
37
51
  dataType: t.number.instance(),
38
- impl: data => {
52
+ impl: (data, { wording }) => {
39
53
  const arr = withoutNull(data).sort((a, b) => a - b);
40
54
  let result = undefined;
41
55
  if (arr.length % 2 === 1) {
@@ -46,19 +60,22 @@ export const numberStatsFunctions = [
46
60
  const a = arr[index];
47
61
  const b = arr[index - 1];
48
62
  if (a == null || b == null)
49
- return 'None';
63
+ return none(wording);
50
64
  result = parseFloat(((a + b) / 2).toFixed(2));
51
65
  }
52
- return result?.toString() ?? 'None';
66
+ return result?.toString() ?? none(wording);
53
67
  },
54
68
  }),
55
69
  createStatisticConfig({
56
- group: 'More options',
57
- menuName: 'Min',
58
- displayName: 'Min',
70
+ group: DATA_VIEW_STATS_GROUP_MORE[1],
71
+ groupWording: DATA_VIEW_STATS_GROUP_MORE,
72
+ menuName: DATA_VIEW_STATS_MIN[1],
73
+ menuWording: DATA_VIEW_STATS_MIN,
74
+ displayName: DATA_VIEW_STATS_MIN[1],
75
+ displayWording: DATA_VIEW_STATS_MIN,
59
76
  type: 'min',
60
77
  dataType: t.number.instance(),
61
- impl: data => {
78
+ impl: (data, { wording }) => {
62
79
  let min = null;
63
80
  for (const num of data) {
64
81
  if (num != null) {
@@ -70,16 +87,19 @@ export const numberStatsFunctions = [
70
87
  }
71
88
  }
72
89
  }
73
- return min?.toString() ?? 'None';
90
+ return min?.toString() ?? none(wording);
74
91
  },
75
92
  }),
76
93
  createStatisticConfig({
77
- group: 'More options',
78
- menuName: 'Max',
79
- displayName: 'Max',
94
+ group: DATA_VIEW_STATS_GROUP_MORE[1],
95
+ groupWording: DATA_VIEW_STATS_GROUP_MORE,
96
+ menuName: DATA_VIEW_STATS_MAX[1],
97
+ menuWording: DATA_VIEW_STATS_MAX,
98
+ displayName: DATA_VIEW_STATS_MAX[1],
99
+ displayWording: DATA_VIEW_STATS_MAX,
80
100
  type: 'max',
81
101
  dataType: t.number.instance(),
82
- impl: data => {
102
+ impl: (data, { wording }) => {
83
103
  let max = null;
84
104
  for (const num of data) {
85
105
  if (num != null) {
@@ -91,16 +111,19 @@ export const numberStatsFunctions = [
91
111
  }
92
112
  }
93
113
  }
94
- return max?.toString() ?? 'None';
114
+ return max?.toString() ?? none(wording);
95
115
  },
96
116
  }),
97
117
  createStatisticConfig({
98
- group: 'More options',
99
- menuName: 'Range',
100
- displayName: 'Range',
118
+ group: DATA_VIEW_STATS_GROUP_MORE[1],
119
+ groupWording: DATA_VIEW_STATS_GROUP_MORE,
120
+ menuName: DATA_VIEW_STATS_RANGE[1],
121
+ menuWording: DATA_VIEW_STATS_RANGE,
122
+ displayName: DATA_VIEW_STATS_RANGE[1],
123
+ displayWording: DATA_VIEW_STATS_RANGE,
101
124
  type: 'range',
102
125
  dataType: t.number.instance(),
103
- impl: data => {
126
+ impl: (data, { wording }) => {
104
127
  let min = null;
105
128
  let max = null;
106
129
  for (const num of data) {
@@ -120,7 +143,7 @@ export const numberStatsFunctions = [
120
143
  }
121
144
  }
122
145
  if (min == null || max == null) {
123
- return 'None';
146
+ return none(wording);
124
147
  }
125
148
  return parseFloat((max - min).toFixed(2)).toString();
126
149
  },
@@ -1,14 +1,22 @@
1
1
  import type { DataSource } from '../data-source/index.js';
2
2
  import type { TypeInstance, ValueTypeOf } from '../logical/type.js';
3
3
  import type { PropertyMetaConfig } from '../property/property-config.js';
4
+ import { type ChromeWording } from '../../../affine-shared/services/index.js';
5
+ import { type Wording } from '../utils/wording.js';
4
6
  export type StatisticsConfig<T extends TypeInstance = TypeInstance> = {
5
7
  group: string;
8
+ /** {@link group}, {@link menuName}, {@link displayName} as keys (#572). */
9
+ groupWording?: ChromeWording;
6
10
  type: string;
7
11
  dataType: T;
8
12
  menuName?: string;
13
+ menuWording?: ChromeWording;
9
14
  displayName?: string;
15
+ displayWording?: ChromeWording;
10
16
  impl?: (data: ReadonlyArray<ValueTypeOf<T> | undefined>, info: {
11
17
  meta: PropertyMetaConfig;
12
18
  dataSource: DataSource;
19
+ /** The footer's words; absent, English. */
20
+ wording?: Wording;
13
21
  }) => string;
14
22
  };
@@ -1 +1,2 @@
1
- export {};
1
+ import {} from '../../../affine-shared/services/index.js';
2
+ import {} from '../utils/wording.js';
@@ -1,5 +1,5 @@
1
1
  import { type ChromeWording, type TranslationParams } from '../../../affine-shared/services/index.js';
2
- import type { BlockStdScope } from '../../../std/index.js';
2
+ import { type BlockStdScope } from '../../../std/index.js';
3
3
  /**
4
4
  * `params` fills `{{name}}` placeholders; the host pluralises on `count`, the
5
5
  * English fallback stays neutral.
@@ -13,3 +13,22 @@ export type Wording = (wording: ChromeWording, params?: TranslationParams) => st
13
13
  */
14
14
  export declare const wordingOf: (std: BlockStdScope | undefined) => Wording;
15
15
  export declare const englishWording: Wording;
16
+ /**
17
+ * The editor an element sits in, asked the way a `@consume` asks: a menu or
18
+ * a cell built by a function with only its anchor in hand resolves its words
19
+ * from there. Outside an editor (a unit test, a host panel that provides no
20
+ * `std`), English.
21
+ */
22
+ export declare const stdAround: (element: Element | null | undefined) => BlockStdScope | undefined;
23
+ /** {@link wordingOf} the editor `element` sits in. */
24
+ export declare const wordingFrom: (element: Element | null | undefined) => Wording;
25
+ /**
26
+ * A label declared with an optional wording beside its English text (a
27
+ * filter, a property type, a statistic): the wording when there is one, the
28
+ * text otherwise.
29
+ */
30
+ export declare const propertyTypeName: (wording: Wording, config: {
31
+ name: string;
32
+ nameWording?: ChromeWording;
33
+ }) => string;
34
+ export declare const sayLabel: (wording: Wording, label: string, pair: ChromeWording | undefined) => string;
@@ -1,4 +1,6 @@
1
1
  import { fillPlaceholders, translateKey, } from '../../../affine-shared/services/index.js';
2
+ import { stdContext } from '../../../std/index.js';
3
+ import { ContextEvent } from '@lit/context';
2
4
  /**
3
5
  * Resolve the data-view's wordings through the translation seam when an
4
6
  * editor is there (`stdContext`), in English otherwise (a unit test, a
@@ -9,3 +11,25 @@ export const wordingOf = (std) => ([key, fallback], params) => std
9
11
  ? translateKey(std, key, fallback, params)
10
12
  : fillPlaceholders(fallback, params);
11
13
  export const englishWording = ([, fallback], params) => fillPlaceholders(fallback, params);
14
+ /**
15
+ * The editor an element sits in, asked the way a `@consume` asks: a menu or
16
+ * a cell built by a function with only its anchor in hand resolves its words
17
+ * from there. Outside an editor (a unit test, a host panel that provides no
18
+ * `std`), English.
19
+ */
20
+ export const stdAround = (element) => {
21
+ let std;
22
+ element?.dispatchEvent(new ContextEvent(stdContext, element, value => {
23
+ std = value;
24
+ }));
25
+ return std;
26
+ };
27
+ /** {@link wordingOf} the editor `element` sits in. */
28
+ export const wordingFrom = (element) => wordingOf(stdAround(element));
29
+ /**
30
+ * A label declared with an optional wording beside its English text (a
31
+ * filter, a property type, a statistic): the wording when there is one, the
32
+ * text otherwise.
33
+ */
34
+ export const propertyTypeName = (wording, config) => sayLabel(wording, config.name, config.nameWording);
35
+ export const sayLabel = (wording, label, pair) => (pair ? wording(pair) : label);
@@ -46,6 +46,11 @@ export interface Property<RawValue = unknown, JsonValue = unknown, Data extends
46
46
  get typeCanSet(): boolean;
47
47
  readonly name$: ReadonlySignal<string>;
48
48
  nameSet(name: string): void;
49
+ /**
50
+ * Whether `nameSet` writes anything; absent means it does. False while
51
+ * the source's properties are locked (`SingleView.propertiesLocked$`).
52
+ */
53
+ readonly nameCanSet?: boolean;
49
54
  readonly hide$: ReadonlySignal<boolean>;
50
55
  hideSet(hide: boolean): void;
51
56
  get hideCanSet(): boolean;
@@ -71,6 +76,7 @@ export declare abstract class PropertyBase<RawValue = unknown, JsonValue = unkno
71
76
  readonly$: ReadonlySignal<boolean>;
72
77
  type$: ReadonlySignal<string>;
73
78
  renderer$: ReadonlySignal<CellRenderer<{}, unknown, unknown> | undefined>;
79
+ private get locked();
74
80
  get delete(): (() => void) | undefined;
75
81
  get duplicate(): (() => void) | undefined;
76
82
  abstract move(position: InsertToPosition): void;
@@ -87,6 +93,7 @@ export declare abstract class PropertyBase<RawValue = unknown, JsonValue = unkno
87
93
  get canDelete(): boolean;
88
94
  get canDuplicate(): boolean;
89
95
  get typeCanSet(): boolean;
96
+ get nameCanSet(): boolean;
90
97
  get hideCanSet(): boolean;
91
98
  cellGetOrCreate(rowId: string): Cell<RawValue, JsonValue, Data>;
92
99
  dataUpdate(updater: PropertyDataUpdater<Data>): void;
@@ -1,10 +1,25 @@
1
1
  import { computed } from '@preact/signals-core';
2
2
  export class PropertyBase {
3
+ /*
4
+ * A source whose properties its host locked (ADR 0035 amendment of
5
+ * 2026-10-29) refuses each of these writes here, not only in the menus
6
+ * that hide them: every menu, header and panel of every preset edits a
7
+ * property through this class. Cell values never pass here.
8
+ */
9
+ get locked() {
10
+ return this.view.propertiesLocked$.peek();
11
+ }
3
12
  get delete() {
4
- return () => this.dataSource.propertyDelete(this.id);
13
+ return () => {
14
+ if (this.locked)
15
+ return;
16
+ this.dataSource.propertyDelete(this.id);
17
+ };
5
18
  }
6
19
  get duplicate() {
7
20
  return () => {
21
+ if (this.locked)
22
+ return;
8
23
  const id = this.dataSource.propertyDuplicate(this.id);
9
24
  if (!id) {
10
25
  return;
@@ -25,7 +40,11 @@ export class PropertyBase {
25
40
  return this.propertyId;
26
41
  }
27
42
  get typeSet() {
28
- return type => this.dataSource.propertyTypeSet(this.id, type);
43
+ return type => {
44
+ if (this.locked)
45
+ return;
46
+ this.dataSource.propertyTypeSet(this.id, type);
47
+ };
29
48
  }
30
49
  constructor(view, propertyId) {
31
50
  this.view = view;
@@ -94,13 +113,16 @@ export class PropertyBase {
94
113
  return this.view.manager.dataSource;
95
114
  }
96
115
  get canDelete() {
97
- return this.dataSource.propertyCanDelete(this.id);
116
+ return !this.locked && this.dataSource.propertyCanDelete(this.id);
98
117
  }
99
118
  get canDuplicate() {
100
- return this.dataSource.propertyCanDuplicate(this.id);
119
+ return !this.locked && this.dataSource.propertyCanDuplicate(this.id);
101
120
  }
102
121
  get typeCanSet() {
103
- return this.dataSource.propertyTypeCanSet(this.id);
122
+ return !this.locked && this.dataSource.propertyTypeCanSet(this.id);
123
+ }
124
+ get nameCanSet() {
125
+ return !this.locked;
104
126
  }
105
127
  get hideCanSet() {
106
128
  return this.type$.value !== 'title';
@@ -116,6 +138,8 @@ export class PropertyBase {
116
138
  });
117
139
  }
118
140
  nameSet(name) {
141
+ if (this.locked)
142
+ return;
119
143
  this.dataSource.propertyNameSet(this.id, name);
120
144
  }
121
145
  stringValueGet(rowId) {
@@ -35,6 +35,18 @@ export interface SingleView {
35
35
  * the view is drawn, its settings are read-only, its data is never written.
36
36
  */
37
37
  readonly shownAsFallback$: ReadonlySignal<boolean>;
38
+ /**
39
+ * The source's properties are locked by its host (ADR 0035 amendment of
40
+ * 2026-10-29): `propertyAdd` adds nothing, and every property says it
41
+ * cannot be renamed, retyped, duplicated or deleted. Per-view settings
42
+ * (hide, order, width, filters, sorts, groups, colours) are unaffected.
43
+ */
44
+ readonly propertiesLocked$: ReadonlySignal<boolean>;
45
+ /**
46
+ * The source takes no new row (same amendment): `rowAdd` adds nothing
47
+ * and answers `''`. Existing rows stay editable and deletable.
48
+ */
49
+ readonly rowsLocked$: ReadonlySignal<boolean>;
38
50
  delete(): void;
39
51
  duplicate(): void;
40
52
  readonly name$: ReadonlySignal<string>;
@@ -95,6 +107,8 @@ export declare abstract class SingleViewBase<ViewData extends DataViewDataType =
95
107
  abstract properties$: ReadonlySignal<Property[]>;
96
108
  abstract propertiesRaw$: ReadonlySignal<Property[]>;
97
109
  abstract readonly$: ReadonlySignal<boolean>;
110
+ readonly propertiesLocked$: ReadonlySignal<boolean>;
111
+ readonly rowsLocked$: ReadonlySignal<boolean>;
98
112
  rowsRaw$: ReadonlySignal<Row[]>;
99
113
  rows$: ReadonlySignal<Row[]>;
100
114
  rowsDelete(rows: string[]): void;
@@ -81,6 +81,8 @@ export class SingleViewBase {
81
81
  this.propertyMap$ = computed(() => {
82
82
  return Object.fromEntries(this.properties$.value.map(v => [v.id, v]));
83
83
  });
84
+ this.propertiesLocked$ = computed(() => this.dataSource.propertiesLocked$?.value ?? false);
85
+ this.rowsLocked$ = computed(() => this.dataSource.rowsLocked$?.value ?? false);
84
86
  this.rowsRaw$ = computed(() => {
85
87
  return this.dataSource.rows$.value.map(id => this.rowGetOrCreate(id));
86
88
  });
@@ -159,6 +161,11 @@ export class SingleViewBase {
159
161
  });
160
162
  }
161
163
  propertyAdd(position, ops) {
164
+ // Refused here, not only hidden: every gesture that adds a property
165
+ // (a header's "+", "Insert left", the properties list, the record
166
+ // detail) passes through this method.
167
+ if (this.propertiesLocked$.peek())
168
+ return;
162
169
  const id = this.dataSource.propertyAdd(position, ops);
163
170
  if (!id) {
164
171
  return;
@@ -168,6 +175,10 @@ export class SingleViewBase {
168
175
  return id;
169
176
  }
170
177
  rowAdd(insertPosition) {
178
+ // `''` rather than `undefined`: the signature is one hosts call, and a
179
+ // return type never gains a case in a minor. Callers test the id.
180
+ if (this.rowsLocked$.peek())
181
+ return '';
171
182
  this.lockRows(false);
172
183
  return this.dataSource.rowAdd(insertPosition);
173
184
  }
@@ -1,6 +1,7 @@
1
1
  import zod from 'zod';
2
2
  import { t } from '../../core/logical/type-presets.js';
3
3
  import { propertyType } from '../../core/property/property-config.js';
4
+ import { DATA_VIEW_TYPE_CHECKBOX } from '../../translations.js';
4
5
  export const checkboxPropertyType = propertyType('checkbox');
5
6
  const FALSE_VALUES = new Set([
6
7
  'false',
@@ -17,7 +18,8 @@ const FALSE_VALUES = new Set([
17
18
  '关闭',
18
19
  ]);
19
20
  export const checkboxPropertyModelConfig = checkboxPropertyType.modelConfig({
20
- name: 'Checkbox',
21
+ name: DATA_VIEW_TYPE_CHECKBOX[1],
22
+ nameWording: DATA_VIEW_TYPE_CHECKBOX,
21
23
  propertyData: {
22
24
  schema: zod.object({}),
23
25
  default: () => ({}),
@@ -3,9 +3,11 @@ import { parse } from 'date-fns/parse';
3
3
  import zod from 'zod';
4
4
  import { t } from '../../core/logical/type-presets.js';
5
5
  import { propertyType } from '../../core/property/property-config.js';
6
+ import { DATA_VIEW_TYPE_DATE } from '../../translations.js';
6
7
  export const datePropertyType = propertyType('date');
7
8
  export const datePropertyModelConfig = datePropertyType.modelConfig({
8
- name: 'Date',
9
+ name: DATA_VIEW_TYPE_DATE[1],
10
+ nameWording: DATA_VIEW_TYPE_DATE,
9
11
  propertyData: {
10
12
  schema: zod.object({}),
11
13
  default: () => ({}),
@@ -4,9 +4,11 @@ import { getTagColor } from '../../core/component/tags/colors.js';
4
4
  import { t } from '../../core/index.js';
5
5
  import { propertyType } from '../../core/property/property-config.js';
6
6
  import { SelectPropertySchema } from '../select/define.js';
7
+ import { DATA_VIEW_TYPE_MULTI_SELECT } from '../../translations.js';
7
8
  export const multiSelectPropertyType = propertyType('multi-select');
8
9
  export const multiSelectPropertyModelConfig = multiSelectPropertyType.modelConfig({
9
- name: 'Multi-select',
10
+ name: DATA_VIEW_TYPE_MULTI_SELECT[1],
11
+ nameWording: DATA_VIEW_TYPE_MULTI_SELECT,
10
12
  propertyData: {
11
13
  schema: SelectPropertySchema,
12
14
  default: () => ({
@@ -3,9 +3,11 @@ import { t } from '../../core/logical/type-presets.js';
3
3
  import { propertyType } from '../../core/property/property-config.js';
4
4
  import { NumberPropertySchema } from './types.js';
5
5
  import { parseNumber } from './utils/formatter.js';
6
+ import { DATA_VIEW_TYPE_NUMBER } from '../../translations.js';
6
7
  export const numberPropertyType = propertyType('number');
7
8
  export const numberPropertyModelConfig = numberPropertyType.modelConfig({
8
- name: 'Number',
9
+ name: DATA_VIEW_TYPE_NUMBER[1],
10
+ nameWording: DATA_VIEW_TYPE_NUMBER,
9
11
  propertyData: {
10
12
  schema: NumberPropertySchema,
11
13
  default: () => ({ decimal: 0, format: 'number' }),
@@ -1,7 +1,10 @@
1
1
  import type { NumberFormat } from './formatter.js';
2
+ import { type ChromeWording } from '../../../../affine-shared/services/index.js';
2
3
  export type NumberCellFormat = {
3
4
  type: NumberFormat;
4
5
  label: string;
6
+ /** {@link label} as a key (#572). */
7
+ labelWording: ChromeWording;
5
8
  symbol: string;
6
9
  };
7
10
  export declare const numberFormats: NumberCellFormat[];
@@ -1,11 +1,58 @@
1
+ import { DATA_VIEW_NUMBER_FORMAT_COMMAS, DATA_VIEW_NUMBER_FORMAT_PERCENT, DATA_VIEW_NUMBER_FORMAT_YEN, DATA_VIEW_NUMBER_FORMAT_CNY, DATA_VIEW_NUMBER_FORMAT_INR, DATA_VIEW_NUMBER_FORMAT_USD, DATA_VIEW_NUMBER_FORMAT_EUR, DATA_VIEW_NUMBER_FORMAT_GBP, DATA_VIEW_TYPE_NUMBER, } from '../../../translations.js';
2
+ import {} from '../../../../affine-shared/services/index.js';
1
3
  export const numberFormats = [
2
- { type: 'number', label: 'Number', symbol: '#' },
3
- { type: 'numberWithCommas', label: 'Number With Commas', symbol: '#' },
4
- { type: 'percent', label: 'Percent', symbol: '%' },
5
- { type: 'currencyYen', label: 'Japanese Yen', symbol: '¥' },
6
- { type: 'currencyCNY', label: 'Chinese Yuan', symbol: '¥' },
7
- { type: 'currencyINR', label: 'Indian Rupee', symbol: '₹' },
8
- { type: 'currencyUSD', label: 'US Dollar', symbol: '$' },
9
- { type: 'currencyEUR', label: 'Euro', symbol: '€' },
10
- { type: 'currencyGBP', label: 'British Pound', symbol: '£' },
4
+ {
5
+ type: 'number',
6
+ label: DATA_VIEW_TYPE_NUMBER[1],
7
+ labelWording: DATA_VIEW_TYPE_NUMBER,
8
+ symbol: '#',
9
+ },
10
+ {
11
+ type: 'numberWithCommas',
12
+ label: DATA_VIEW_NUMBER_FORMAT_COMMAS[1],
13
+ labelWording: DATA_VIEW_NUMBER_FORMAT_COMMAS,
14
+ symbol: '#',
15
+ },
16
+ {
17
+ type: 'percent',
18
+ label: DATA_VIEW_NUMBER_FORMAT_PERCENT[1],
19
+ labelWording: DATA_VIEW_NUMBER_FORMAT_PERCENT,
20
+ symbol: '%',
21
+ },
22
+ {
23
+ type: 'currencyYen',
24
+ label: DATA_VIEW_NUMBER_FORMAT_YEN[1],
25
+ labelWording: DATA_VIEW_NUMBER_FORMAT_YEN,
26
+ symbol: '¥',
27
+ },
28
+ {
29
+ type: 'currencyCNY',
30
+ label: DATA_VIEW_NUMBER_FORMAT_CNY[1],
31
+ labelWording: DATA_VIEW_NUMBER_FORMAT_CNY,
32
+ symbol: '¥',
33
+ },
34
+ {
35
+ type: 'currencyINR',
36
+ label: DATA_VIEW_NUMBER_FORMAT_INR[1],
37
+ labelWording: DATA_VIEW_NUMBER_FORMAT_INR,
38
+ symbol: '₹',
39
+ },
40
+ {
41
+ type: 'currencyUSD',
42
+ label: DATA_VIEW_NUMBER_FORMAT_USD[1],
43
+ labelWording: DATA_VIEW_NUMBER_FORMAT_USD,
44
+ symbol: '$',
45
+ },
46
+ {
47
+ type: 'currencyEUR',
48
+ label: DATA_VIEW_NUMBER_FORMAT_EUR[1],
49
+ labelWording: DATA_VIEW_NUMBER_FORMAT_EUR,
50
+ symbol: '€',
51
+ },
52
+ {
53
+ type: 'currencyGBP',
54
+ label: DATA_VIEW_NUMBER_FORMAT_GBP[1],
55
+ labelWording: DATA_VIEW_NUMBER_FORMAT_GBP,
56
+ symbol: '£',
57
+ },
11
58
  ];
@@ -1,9 +1,11 @@
1
1
  import zod from 'zod';
2
2
  import { t } from '../../core/logical/type-presets.js';
3
3
  import { propertyType } from '../../core/property/property-config.js';
4
+ import { DATA_VIEW_TYPE_PROGRESS } from '../../translations.js';
4
5
  export const progressPropertyType = propertyType('progress');
5
6
  export const progressPropertyModelConfig = progressPropertyType.modelConfig({
6
- name: 'Progress',
7
+ name: DATA_VIEW_TYPE_PROGRESS[1],
8
+ nameWording: DATA_VIEW_TYPE_PROGRESS,
7
9
  propertyData: {
8
10
  schema: zod.object({}),
9
11
  default: () => ({}),
@@ -3,12 +3,14 @@ import zod from 'zod';
3
3
  import { getTagColor } from '../../core/component/tags/colors.js';
4
4
  import { SelectTagSchema, t } from '../../core/index.js';
5
5
  import { propertyType } from '../../core/property/property-config.js';
6
+ import { DATA_VIEW_TYPE_SELECT } from '../../translations.js';
6
7
  export const selectPropertyType = propertyType('select');
7
8
  export const SelectPropertySchema = zod.object({
8
9
  options: zod.array(SelectTagSchema),
9
10
  });
10
11
  export const selectPropertyModelConfig = selectPropertyType.modelConfig({
11
- name: 'Select',
12
+ name: DATA_VIEW_TYPE_SELECT[1],
13
+ nameWording: DATA_VIEW_TYPE_SELECT,
12
14
  propertyData: {
13
15
  schema: SelectPropertySchema,
14
16
  default: () => ({
@@ -1,9 +1,11 @@
1
1
  import zod from 'zod';
2
2
  import { t } from '../../core/index.js';
3
3
  import { propertyType } from '../../core/property/property-config.js';
4
+ import { DATA_VIEW_TYPE_PLAIN_TEXT } from '../../translations.js';
4
5
  export const textPropertyType = propertyType('text');
5
6
  export const textPropertyModelConfig = textPropertyType.modelConfig({
6
- name: 'Plain-Text',
7
+ name: DATA_VIEW_TYPE_PLAIN_TEXT[1],
8
+ nameWording: DATA_VIEW_TYPE_PLAIN_TEXT,
7
9
  propertyData: {
8
10
  schema: zod.object({}),
9
11
  default: () => ({}),