@formicoidea/labre-core 1.1.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/architecture/code.c4 +37 -34
- package/dist/_pkgs/affine-components/context-menu/input.d.ts +6 -0
- package/dist/_pkgs/affine-components/context-menu/input.js +3 -0
- package/dist/_pkgs/affine-components/context-menu/menu-all.d.ts +1 -0
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.d.ts +3 -1
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +9 -1
- package/dist/_pkgs/affine-components/context-menu/menu.d.ts +7 -0
- package/dist/_pkgs/affine-components/context-menu/menu.js +5 -0
- package/dist/_pkgs/affine-components/context-menu/sub-menu.d.ts +16 -1
- package/dist/_pkgs/affine-components/context-menu/sub-menu.js +32 -5
- package/dist/_pkgs/affine-database-block/configs/slash-menu.js +14 -6
- package/dist/_pkgs/affine-database-block/database-block-styles.js +4 -3
- package/dist/_pkgs/affine-database-block/database-block.js +6 -18
- package/dist/_pkgs/affine-database-block/database-dnd-preview-block.js +5 -1
- package/dist/_pkgs/affine-database-block/detail-panel/block-renderer.js +5 -2
- package/dist/_pkgs/affine-database-block/detail-panel/note-renderer.js +3 -2
- package/dist/_pkgs/affine-database-block/external-data-source.d.ts +10 -0
- package/dist/_pkgs/affine-database-block/external-data-source.js +24 -0
- package/dist/_pkgs/affine-database-block/properties/created-time/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/link/cell-renderer.js +3 -2
- package/dist/_pkgs/affine-database-block/properties/link/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/rich-text/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/text/hosted.js +1 -0
- package/dist/_pkgs/affine-database-block/properties/title/define.js +3 -1
- package/dist/_pkgs/affine-database-block/properties/title/hosted.js +1 -0
- package/dist/_pkgs/affine-database-block/service/new-row-menu.d.ts +1 -1
- package/dist/_pkgs/affine-database-block/service/new-row-menu.js +1 -1
- package/dist/_pkgs/affine-database-block/translations.d.ts +11 -0
- package/dist/_pkgs/affine-database-block/translations.js +57 -0
- package/dist/_pkgs/affine-database-block/views/index.d.ts +7 -9
- package/dist/_pkgs/affine-database-block/views/index.js +7 -10
- package/dist/_pkgs/affine-database-engine/core/common/properties.js +7 -7
- package/dist/_pkgs/affine-database-engine/core/common/property-menu.d.ts +18 -2
- package/dist/_pkgs/affine-database-engine/core/common/property-menu.js +78 -27
- package/dist/_pkgs/affine-database-engine/core/data-source/base.d.ts +11 -0
- package/dist/_pkgs/affine-database-engine/core/data-source/base.js +3 -0
- package/dist/_pkgs/affine-database-engine/core/detail/detail.js +8 -5
- package/dist/_pkgs/affine-database-engine/core/detail/field.js +14 -7
- package/dist/_pkgs/affine-database-engine/core/filter/add-filter.js +4 -2
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/boolean.js +7 -4
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/create.d.ts +9 -1
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/create.js +2 -0
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/date.js +7 -4
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/multi-tag.js +17 -8
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/number.js +6 -6
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/string.js +19 -12
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/tag.js +9 -4
- package/dist/_pkgs/affine-database-engine/core/filter/filter-fn/unknown.js +7 -4
- package/dist/_pkgs/affine-database-engine/core/filter/literal/define.js +6 -4
- package/dist/_pkgs/affine-database-engine/core/filter/literal/matcher.d.ts +2 -1
- package/dist/_pkgs/affine-database-engine/core/filter/literal/matcher.js +3 -2
- package/dist/_pkgs/affine-database-engine/core/filter/literal/types.d.ts +4 -1
- package/dist/_pkgs/affine-database-engine/core/filter/literal/types.js +1 -1
- package/dist/_pkgs/affine-database-engine/core/group-by/define.js +11 -9
- package/dist/_pkgs/affine-database-engine/core/group-by/group-title.js +16 -6
- package/dist/_pkgs/affine-database-engine/core/group-by/locate-row.d.ts +16 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/locate-row.js +32 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/renderer/date-group.js +10 -3
- package/dist/_pkgs/affine-database-engine/core/group-by/setting.d.ts +2 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/setting.js +40 -28
- package/dist/_pkgs/affine-database-engine/core/group-by/trait.d.ts +3 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/trait.js +8 -0
- package/dist/_pkgs/affine-database-engine/core/group-by/types.d.ts +3 -1
- package/dist/_pkgs/affine-database-engine/core/group-by/types.js +1 -1
- package/dist/_pkgs/affine-database-engine/core/property/types.d.ts +7 -0
- package/dist/_pkgs/affine-database-engine/core/property/types.js +1 -1
- package/dist/_pkgs/affine-database-engine/core/sort/add-sort.js +3 -1
- package/dist/_pkgs/affine-database-engine/core/statistics/any.js +43 -21
- package/dist/_pkgs/affine-database-engine/core/statistics/checkbox.js +29 -14
- package/dist/_pkgs/affine-database-engine/core/statistics/number.js +54 -31
- package/dist/_pkgs/affine-database-engine/core/statistics/types.d.ts +8 -0
- package/dist/_pkgs/affine-database-engine/core/statistics/types.js +2 -1
- package/dist/_pkgs/affine-database-engine/core/utils/wording.d.ts +20 -1
- package/dist/_pkgs/affine-database-engine/core/utils/wording.js +24 -0
- package/dist/_pkgs/affine-database-engine/core/view-manager/property.d.ts +7 -0
- package/dist/_pkgs/affine-database-engine/core/view-manager/property.js +29 -5
- package/dist/_pkgs/affine-database-engine/core/view-manager/single-view.d.ts +14 -0
- package/dist/_pkgs/affine-database-engine/core/view-manager/single-view.js +11 -0
- package/dist/_pkgs/affine-database-engine/property-presets/checkbox/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/date/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/multi-select/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/number/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/number/utils/formats.d.ts +3 -0
- package/dist/_pkgs/affine-database-engine/property-presets/number/utils/formats.js +56 -9
- package/dist/_pkgs/affine-database-engine/property-presets/progress/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/select/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/property-presets/text/define.js +3 -1
- package/dist/_pkgs/affine-database-engine/translations.d.ts +133 -5
- package/dist/_pkgs/affine-database-engine/translations.js +625 -9
- package/dist/_pkgs/affine-database-engine/view-presets/convert.js +0 -28
- package/dist/_pkgs/affine-database-engine/view-presets/effect.js +0 -2
- package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-converts.js +2 -4
- package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-view-ui.d.ts +57 -0
- package/dist/_pkgs/affine-database-engine/view-presets/flat/flat-view-ui.js +113 -4
- package/dist/_pkgs/affine-database-engine/view-presets/gallery/gallery-view.js +2 -1
- package/dist/_pkgs/affine-database-engine/view-presets/index.d.ts +0 -2
- package/dist/_pkgs/affine-database-engine/view-presets/index.js +0 -3
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/kanban-view-manager.js +2 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/group.js +7 -5
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/kanban-view-ui-logic.d.ts +5 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/kanban-view-ui-logic.js +25 -3
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/mobile/menu.js +12 -6
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/controller/selection.d.ts +8 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/controller/selection.js +35 -12
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/group.js +7 -5
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/header.js +5 -1
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/kanban-view-ui-logic.d.ts +5 -0
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/kanban-view-ui-logic.js +8 -4
- package/dist/_pkgs/affine-database-engine/view-presets/kanban/pc/menu.js +12 -6
- package/dist/_pkgs/affine-database-engine/view-presets/list/list-view.js +2 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/column-header.js +6 -4
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/group.js +6 -5
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/header.js +2 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/table-view-ui-logic.d.ts +4 -3
- package/dist/_pkgs/affine-database-engine/view-presets/table/mobile/table-view-ui-logic.js +29 -5
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/controller/clipboard.js +6 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/controller/selection.js +2 -0
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/group.js +6 -5
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/column-header.js +11 -7
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/database-header-column.js +16 -12
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/header/number-format-bar.js +4 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/menu.js +9 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/table-view-ui-logic.d.ts +8 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc/table-view-ui-logic.js +29 -7
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/clipboard.js +6 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/controller/selection.js +2 -0
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/group-footer.js +5 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.d.ts +1 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +14 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-header.js +5 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/group-title.js +5 -3
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/column-header.js +17 -10
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/number-format-bar.js +4 -2
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/group/top/header/single-column-header.js +20 -14
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/row/menu.js +9 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/table-view-ui-logic.d.ts +6 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/pc-virtual/table-view-ui-logic.js +30 -3
- package/dist/_pkgs/affine-database-engine/view-presets/table/stats/column-stats-column.d.ts +1 -1
- package/dist/_pkgs/affine-database-engine/view-presets/table/stats/column-stats-column.js +14 -6
- package/dist/_pkgs/affine-database-engine/view-presets/table/table-view-manager.js +2 -0
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/condition-view.d.ts +2 -0
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/condition-view.js +13 -6
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/group-panel-view.js +20 -13
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/filter/root-panel-view.js +10 -5
- package/dist/_pkgs/affine-database-engine/widget-presets/quick-setting-bar/sort/root-panel.js +8 -5
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/search/search.js +2 -2
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/table-add-row/add-row.d.ts +6 -0
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/table-add-row/add-row.js +49 -4
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/view-options/view-settings.d.ts +3 -3
- package/dist/_pkgs/affine-database-engine/widget-presets/tools/presets/view-options/view-settings.js +3 -3
- package/dist/_pkgs/affine-database-engine/widget-presets/views-bar/views-view.js +5 -0
- package/dist/_pkgs/affine-database-view-block/configs/slash-menu.js +6 -3
- package/dist/_pkgs/affine-database-view-block/data-view-block.js +5 -4
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +3 -2
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +3 -2
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +67 -2
- package/package.json +1 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/calendar-view-manager.d.ts +0 -70
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/calendar-view-manager.js +0 -449
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/define.d.ts +0 -10
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/define.js +0 -29
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/effect.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/effect.js +0 -4
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/index.d.ts +0 -6
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/index.js +0 -6
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/layout.d.ts +0 -37
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/layout.js +0 -138
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/actions.d.ts +0 -7
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/actions.js +0 -64
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/dnd.d.ts +0 -32
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/dnd.js +0 -159
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/effect.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/effect.js +0 -7
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/hit-test.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/hit-test.js +0 -28
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/styles.d.ts +0 -1
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/styles.js +0 -707
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/view.d.ts +0 -89
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/pc/view.js +0 -849
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/renderer.d.ts +0 -2
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/renderer.js +0 -8
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/source.d.ts +0 -8
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/source.js +0 -3
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/types.d.ts +0 -79
- package/dist/_pkgs/affine-database-engine/view-presets/calendar/types.js +0 -1
|
@@ -92,9 +92,14 @@ const GroupTitleMobile = (groupData, ops) => {
|
|
|
92
92
|
${ops.readonly
|
|
93
93
|
? nothing
|
|
94
94
|
: html ` <div class="group-header-ops">
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
${groupData.property.view.rowsLocked$.value
|
|
96
|
+
? nothing
|
|
97
|
+
: html `<div
|
|
98
|
+
@click="${ops.clickAdd}"
|
|
99
|
+
class="group-header-op add-card"
|
|
100
|
+
>
|
|
101
|
+
${PlusIcon()}
|
|
102
|
+
</div>`}
|
|
98
103
|
<div @click="${ops.clickOps}" class="group-header-op">
|
|
99
104
|
${MoreHorizontalIcon()}
|
|
100
105
|
</div>
|
|
@@ -199,9 +204,14 @@ export const GroupTitle = (groupData, ops) => {
|
|
|
199
204
|
${ops.readonly
|
|
200
205
|
? nothing
|
|
201
206
|
: html ` <div class="group-header-ops">
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
${groupData.property.view.rowsLocked$.value
|
|
208
|
+
? nothing
|
|
209
|
+
: html `<div
|
|
210
|
+
@click="${ops.clickAdd}"
|
|
211
|
+
class="group-header-op add-card"
|
|
212
|
+
>
|
|
213
|
+
${PlusIcon()}
|
|
214
|
+
</div>`}
|
|
205
215
|
<div @click="${ops.clickOps}" class="group-header-op">
|
|
206
216
|
${MoreHorizontalIcon()}
|
|
207
217
|
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Row } from '../view-manager/row.js';
|
|
2
|
+
import type { GroupTrait } from './trait.js';
|
|
3
|
+
/** Where a view draws a row: its group (`undefined` ungrouped), its index. */
|
|
4
|
+
export type RowLocation = {
|
|
5
|
+
groupKey: string | undefined;
|
|
6
|
+
rowIndex: number;
|
|
7
|
+
rowId: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Where `rowId` is drawn, in the coordinates a table or a kanban selection
|
|
11
|
+
* names: the visible group holding it and its index there. `undefined` when
|
|
12
|
+
* no unfolded group draws it (filtered out, or in a hidden or folded group).
|
|
13
|
+
*/
|
|
14
|
+
export declare function locateRow(groupTrait: GroupTrait, rows: readonly Row[], rowId: string): RowLocation | undefined;
|
|
15
|
+
/** The first row a view draws, top of its first unfolded group. */
|
|
16
|
+
export declare function firstDrawnRow(groupTrait: GroupTrait, rows: readonly Row[]): RowLocation | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The visible, unfolded groups of a view in drawing order, or the view's own
|
|
3
|
+
* rows as one keyless group when it is not grouped.
|
|
4
|
+
*/
|
|
5
|
+
function drawnGroups(groupTrait, rows) {
|
|
6
|
+
const groups = groupTrait.visibleGroups$.peek();
|
|
7
|
+
if (!groups)
|
|
8
|
+
return [{ key: undefined, rows }];
|
|
9
|
+
return groups.filter(group => !groupTrait.collapsed$(group.key).peek());
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Where `rowId` is drawn, in the coordinates a table or a kanban selection
|
|
13
|
+
* names: the visible group holding it and its index there. `undefined` when
|
|
14
|
+
* no unfolded group draws it (filtered out, or in a hidden or folded group).
|
|
15
|
+
*/
|
|
16
|
+
export function locateRow(groupTrait, rows, rowId) {
|
|
17
|
+
for (const group of drawnGroups(groupTrait, rows)) {
|
|
18
|
+
const rowIndex = group.rows.findIndex(row => row.rowId === rowId);
|
|
19
|
+
if (rowIndex >= 0)
|
|
20
|
+
return { groupKey: group.key, rowIndex, rowId };
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
/** The first row a view draws, top of its first unfolded group. */
|
|
25
|
+
export function firstDrawnRow(groupTrait, rows) {
|
|
26
|
+
for (const group of drawnGroups(groupTrait, rows)) {
|
|
27
|
+
const first = group.rows[0];
|
|
28
|
+
if (first)
|
|
29
|
+
return { groupKey: group.key, rowIndex: 0, rowId: first.rowId };
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
@@ -36,6 +36,8 @@ import { SignalWatcher, WithDisposable } from '../../../../global/lit/index.js';
|
|
|
36
36
|
import { ShadowlessElement } from '../../../../std/index.js';
|
|
37
37
|
import { css, html } from 'lit';
|
|
38
38
|
import { property } from 'lit/decorators.js';
|
|
39
|
+
import { DATA_VIEW_GROUP_NO_VALUE, DATA_VIEW_UNGROUPED, } from '../../../translations.js';
|
|
40
|
+
import { wordingFrom } from '../../utils/wording.js';
|
|
39
41
|
let DateGroupView = (() => {
|
|
40
42
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
41
43
|
let _group_decorators;
|
|
@@ -78,12 +80,17 @@ let DateGroupView = (() => {
|
|
|
78
80
|
get group() { return this.#group_accessor_storage; }
|
|
79
81
|
set group(value) { this.#group_accessor_storage = value; }
|
|
80
82
|
render() {
|
|
81
|
-
const
|
|
83
|
+
const wording = wordingFrom(this);
|
|
84
|
+
// Read for its signal: a date group renames itself when the day turns.
|
|
85
|
+
this.group.name$.value;
|
|
86
|
+
const name = this.group.nameIn(wording);
|
|
82
87
|
// Use contextual name based on the property when value is null
|
|
83
88
|
const displayName = name ||
|
|
84
89
|
(this.group.value === null
|
|
85
|
-
?
|
|
86
|
-
|
|
90
|
+
? wording(DATA_VIEW_GROUP_NO_VALUE, {
|
|
91
|
+
name: this.group.property.name$.value,
|
|
92
|
+
})
|
|
93
|
+
: wording(DATA_VIEW_UNGROUPED));
|
|
87
94
|
return html `<div class="dv-date-group">
|
|
88
95
|
<span>${displayName}</span>
|
|
89
96
|
</div>`;
|
|
@@ -23,6 +23,8 @@ export declare const selectGroupByProperty: (group: GroupTrait, ops?: {
|
|
|
23
23
|
onSelect?: (id?: string) => void;
|
|
24
24
|
onClose?: () => void;
|
|
25
25
|
onBack?: () => void;
|
|
26
|
+
/** The opener's words; English without it. */
|
|
27
|
+
wording?: Wording;
|
|
26
28
|
}) => MenuOptions;
|
|
27
29
|
export declare const popSelectGroupByProperty: (target: PopupTarget, group: GroupTrait, ops?: {
|
|
28
30
|
onSelect?: () => void;
|
|
@@ -40,16 +40,17 @@ import { computed } from '@preact/signals-core';
|
|
|
40
40
|
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
41
41
|
import { property, query } from 'lit/decorators.js';
|
|
42
42
|
import { repeat } from 'lit/directives/repeat.js';
|
|
43
|
-
import { DATA_VIEW_GROUP_HIDE, DATA_VIEW_GROUP_SHOW, } from '../../translations.js';
|
|
43
|
+
import { DATA_VIEW_GROUP_HIDE, DATA_VIEW_GROUP_SHOW, DATA_VIEW_GROUP, DATA_VIEW_GROUP_BY, DATA_VIEW_GROUP_REMOVE, DATA_VIEW_GROUP_DATES_BY, DATA_VIEW_GROUP_ORDER, DATA_VIEW_GROUP_OLDEST_FIRST, DATA_VIEW_GROUP_NEWEST_FIRST, DATA_VIEW_GROUP_DATE_RELATIVE, DATA_VIEW_GROUP_DATE_DAY, DATA_VIEW_GROUP_DATE_WEEK_MON, DATA_VIEW_GROUP_DATE_WEEK_SUN, DATA_VIEW_GROUP_DATE_MONTH, DATA_VIEW_GROUP_DATE_YEAR, DATA_VIEW_GROUPS, } from '../../translations.js';
|
|
44
44
|
import { KanbanSingleView } from '../../view-presets/kanban/kanban-view-manager.js';
|
|
45
45
|
import { dataViewCssVariable } from '../common/css-variable.js';
|
|
46
46
|
import { renderUniLit } from '../utils/uni-component/uni-component.js';
|
|
47
|
-
import { englishWording } from '../utils/wording.js';
|
|
47
|
+
import { englishWording, wordingFrom } from '../utils/wording.js';
|
|
48
48
|
import { dragHandler } from '../utils/wc-dnd/dnd-context.js';
|
|
49
49
|
import { defaultActivators } from '../utils/wc-dnd/sensors/index.js';
|
|
50
50
|
import { createSortContext, sortable, } from '../utils/wc-dnd/sort/sort-context.js';
|
|
51
51
|
import { verticalListSortingStrategy } from '../utils/wc-dnd/sort/strategies/index.js';
|
|
52
52
|
import { getGroupByService } from './matcher.js';
|
|
53
|
+
import {} from '../../../affine-shared/services/index.js';
|
|
53
54
|
let GroupSetting = (() => {
|
|
54
55
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
55
56
|
let _groupTrait_decorators;
|
|
@@ -185,7 +186,7 @@ let GroupSetting = (() => {
|
|
|
185
186
|
<div
|
|
186
187
|
style="padding: 0 4px; font-size: 12px;color: var(--affine-text-secondary-color);line-height: 20px;"
|
|
187
188
|
>
|
|
188
|
-
|
|
189
|
+
${this.wording(DATA_VIEW_GROUPS)}
|
|
189
190
|
</div>
|
|
190
191
|
<div></div>
|
|
191
192
|
</div>
|
|
@@ -276,28 +277,31 @@ export { GroupSetting };
|
|
|
276
277
|
* them. Keys match the group-by config names registered in `define.ts`.
|
|
277
278
|
*/
|
|
278
279
|
const dateGroupModes = [
|
|
279
|
-
{ name: 'date-relative', label:
|
|
280
|
-
{ name: 'date-day', label:
|
|
281
|
-
{ name: 'date-week-mon', label:
|
|
282
|
-
{ name: 'date-week-sun', label:
|
|
283
|
-
{ name: 'date-month', label:
|
|
284
|
-
{ name: 'date-year', label:
|
|
280
|
+
{ name: 'date-relative', label: DATA_VIEW_GROUP_DATE_RELATIVE },
|
|
281
|
+
{ name: 'date-day', label: DATA_VIEW_GROUP_DATE_DAY },
|
|
282
|
+
{ name: 'date-week-mon', label: DATA_VIEW_GROUP_DATE_WEEK_MON },
|
|
283
|
+
{ name: 'date-week-sun', label: DATA_VIEW_GROUP_DATE_WEEK_SUN },
|
|
284
|
+
{ name: 'date-month', label: DATA_VIEW_GROUP_DATE_MONTH },
|
|
285
|
+
{ name: 'date-year', label: DATA_VIEW_GROUP_DATE_YEAR },
|
|
285
286
|
];
|
|
286
|
-
const dateGroupModeLabel = (name) =>
|
|
287
|
-
const
|
|
287
|
+
const dateGroupModeLabel = (wording, name) => {
|
|
288
|
+
const mode = dateGroupModes.find(mode => mode.name === name);
|
|
289
|
+
return mode ? wording(mode.label) : '';
|
|
290
|
+
};
|
|
291
|
+
const dateGroupSettingItems = (group, reopen, wording) => [
|
|
288
292
|
menu.subMenu({
|
|
289
|
-
name:
|
|
293
|
+
name: wording(DATA_VIEW_GROUP_DATES_BY),
|
|
290
294
|
postfix: html `
|
|
291
295
|
<div
|
|
292
296
|
style="font-size: 12px;line-height: 20px;color: var(--affine-text-secondary-color);margin-right: 4px;margin-left: 8px;"
|
|
293
297
|
>
|
|
294
|
-
${dateGroupModeLabel(group.groupInfo$.value?.config.name)}
|
|
298
|
+
${dateGroupModeLabel(wording, group.groupInfo$.value?.config.name)}
|
|
295
299
|
</div>
|
|
296
300
|
`,
|
|
297
301
|
options: {
|
|
298
|
-
title: { text:
|
|
302
|
+
title: { text: wording(DATA_VIEW_GROUP_DATES_BY) },
|
|
299
303
|
items: dateGroupModes.map(mode => menu.action({
|
|
300
|
-
name: mode.label,
|
|
304
|
+
name: wording(mode.label),
|
|
301
305
|
isSelected: group.groupInfo$.value?.config.name === mode.name,
|
|
302
306
|
select: () => {
|
|
303
307
|
group.changeGroupMode(mode.name);
|
|
@@ -307,19 +311,21 @@ const dateGroupSettingItems = (group, reopen) => [
|
|
|
307
311
|
},
|
|
308
312
|
}),
|
|
309
313
|
menu.subMenu({
|
|
310
|
-
name:
|
|
314
|
+
name: wording(DATA_VIEW_GROUP_ORDER),
|
|
311
315
|
postfix: html `
|
|
312
316
|
<div
|
|
313
317
|
style="font-size: 12px;line-height: 20px;color: var(--affine-text-secondary-color);margin-right: 4px;margin-left: 8px;"
|
|
314
318
|
>
|
|
315
|
-
${group.sortAsc$.value
|
|
319
|
+
${wording(group.sortAsc$.value
|
|
320
|
+
? DATA_VIEW_GROUP_OLDEST_FIRST
|
|
321
|
+
: DATA_VIEW_GROUP_NEWEST_FIRST)}
|
|
316
322
|
</div>
|
|
317
323
|
`,
|
|
318
324
|
options: {
|
|
319
|
-
title: { text:
|
|
325
|
+
title: { text: wording(DATA_VIEW_GROUP_ORDER) },
|
|
320
326
|
items: [
|
|
321
327
|
menu.action({
|
|
322
|
-
name:
|
|
328
|
+
name: wording(DATA_VIEW_GROUP_OLDEST_FIRST),
|
|
323
329
|
isSelected: group.sortAsc$.value,
|
|
324
330
|
select: () => {
|
|
325
331
|
group.setDateSortOrder(true);
|
|
@@ -327,7 +333,7 @@ const dateGroupSettingItems = (group, reopen) => [
|
|
|
327
333
|
},
|
|
328
334
|
}),
|
|
329
335
|
menu.action({
|
|
330
|
-
name:
|
|
336
|
+
name: wording(DATA_VIEW_GROUP_NEWEST_FIRST),
|
|
331
337
|
isSelected: !group.sortAsc$.value,
|
|
332
338
|
select: () => {
|
|
333
339
|
group.setDateSortOrder(false);
|
|
@@ -340,10 +346,11 @@ const dateGroupSettingItems = (group, reopen) => [
|
|
|
340
346
|
];
|
|
341
347
|
export const selectGroupByProperty = (group, ops) => {
|
|
342
348
|
const view = group.view;
|
|
349
|
+
const wording = ops?.wording ?? englishWording;
|
|
343
350
|
return {
|
|
344
351
|
onClose: ops?.onClose,
|
|
345
352
|
title: {
|
|
346
|
-
text:
|
|
353
|
+
text: wording(DATA_VIEW_GROUP_BY),
|
|
347
354
|
onBack: ops?.onBack,
|
|
348
355
|
},
|
|
349
356
|
items: [
|
|
@@ -378,7 +385,7 @@ export const selectGroupByProperty = (group, ops) => {
|
|
|
378
385
|
prefix: DeleteIcon(),
|
|
379
386
|
hide: () => view instanceof KanbanSingleView || group.property$.value == null,
|
|
380
387
|
class: { 'delete-item': true },
|
|
381
|
-
name:
|
|
388
|
+
name: wording(DATA_VIEW_GROUP_REMOVE),
|
|
382
389
|
select: () => {
|
|
383
390
|
group.changeGroup(undefined);
|
|
384
391
|
ops?.onSelect?.();
|
|
@@ -391,7 +398,10 @@ export const selectGroupByProperty = (group, ops) => {
|
|
|
391
398
|
};
|
|
392
399
|
export const popSelectGroupByProperty = (target, group, ops) => {
|
|
393
400
|
popMenu(target, {
|
|
394
|
-
options: selectGroupByProperty(group,
|
|
401
|
+
options: selectGroupByProperty(group, {
|
|
402
|
+
...ops,
|
|
403
|
+
wording: wordingFrom(target.element),
|
|
404
|
+
}),
|
|
395
405
|
});
|
|
396
406
|
};
|
|
397
407
|
export const popGroupSetting = (target, group, onBack, wording) => {
|
|
@@ -405,17 +415,18 @@ export const popGroupSetting = (target, group, onBack, wording) => {
|
|
|
405
415
|
return;
|
|
406
416
|
}
|
|
407
417
|
const icon = groupProperty.icon;
|
|
418
|
+
const say = wording ?? englishWording;
|
|
408
419
|
const menuHandler = popMenu(target, {
|
|
409
420
|
options: {
|
|
410
421
|
title: {
|
|
411
|
-
text:
|
|
422
|
+
text: say(DATA_VIEW_GROUP),
|
|
412
423
|
onBack: onBack,
|
|
413
424
|
},
|
|
414
425
|
items: [
|
|
415
426
|
menu.group({
|
|
416
427
|
items: [
|
|
417
428
|
menu.subMenu({
|
|
418
|
-
name:
|
|
429
|
+
name: say(DATA_VIEW_GROUP_BY),
|
|
419
430
|
postfix: html `
|
|
420
431
|
<div
|
|
421
432
|
style="display:flex;align-items:center;gap: 4px;font-size: 12px;line-height: 20px;color: var(--affine-text-secondary-color);margin-right: 4px;margin-left: 8px;"
|
|
@@ -426,10 +437,11 @@ export const popGroupSetting = (target, group, onBack, wording) => {
|
|
|
426
437
|
`,
|
|
427
438
|
label: () => html `
|
|
428
439
|
<div style="color: var(--affine-text-secondary-color);">
|
|
429
|
-
|
|
440
|
+
${say(DATA_VIEW_GROUP_BY)}
|
|
430
441
|
</div>
|
|
431
442
|
`,
|
|
432
443
|
options: selectGroupByProperty(group, {
|
|
444
|
+
wording: say,
|
|
433
445
|
onSelect: () => {
|
|
434
446
|
menuHandler.close();
|
|
435
447
|
popGroupSetting(target, group, onBack, wording);
|
|
@@ -443,7 +455,7 @@ export const popGroupSetting = (target, group, onBack, wording) => {
|
|
|
443
455
|
? dateGroupSettingItems(group, () => {
|
|
444
456
|
menuHandler.close();
|
|
445
457
|
popGroupSetting(target, group, onBack, wording);
|
|
446
|
-
})
|
|
458
|
+
}, say)
|
|
447
459
|
: [],
|
|
448
460
|
}),
|
|
449
461
|
menu.group({
|
|
@@ -463,7 +475,7 @@ export const popGroupSetting = (target, group, onBack, wording) => {
|
|
|
463
475
|
menu.group({
|
|
464
476
|
items: [
|
|
465
477
|
menu.action({
|
|
466
|
-
name:
|
|
478
|
+
name: say(DATA_VIEW_GROUP_REMOVE),
|
|
467
479
|
prefix: DeleteIcon(),
|
|
468
480
|
class: { 'delete-item': true },
|
|
469
481
|
// Every layout but the kanban, which is a grouping (B8).
|
|
@@ -6,6 +6,7 @@ import type { Property } from '../view-manager/property.js';
|
|
|
6
6
|
import type { Row } from '../view-manager/row.js';
|
|
7
7
|
import type { SingleView } from '../view-manager/single-view.js';
|
|
8
8
|
import type { GroupByConfig } from './types.js';
|
|
9
|
+
import { type Wording } from '../utils/wording.js';
|
|
9
10
|
export type GroupInfo<RawValue = unknown, JsonValue = unknown, Data extends Record<string, unknown> = Record<string, unknown>> = {
|
|
10
11
|
config: GroupByConfig;
|
|
11
12
|
property: Property<RawValue, JsonValue, Data>;
|
|
@@ -20,6 +21,8 @@ export declare class Group<RawValue = unknown, JsonValue = unknown, Data extends
|
|
|
20
21
|
constructor(key: string, value: JsonValue, groupInfo: GroupInfo<RawValue, JsonValue, Data>, manager: GroupTrait);
|
|
21
22
|
get property(): Property<RawValue, JsonValue, Data>;
|
|
22
23
|
name$: ReadonlySignal<string>;
|
|
24
|
+
/** {@link name$} in the words `wording` resolves (a date group's "Today"). */
|
|
25
|
+
nameIn(wording: Wording): string;
|
|
23
26
|
private get config();
|
|
24
27
|
get tType(): TypeInstance;
|
|
25
28
|
get view(): import("../../../affine-shared/types/uni-component.js").UniComponent<import("./types.js").GroupRenderProps<unknown, {}>>;
|
|
@@ -7,6 +7,7 @@ import { groupCollapsed$, groupCollapsedSet } from './collapsed-state.js';
|
|
|
7
7
|
import { compareDateKeys } from './compare-date-keys.js';
|
|
8
8
|
import { defaultGroupBy } from './default.js';
|
|
9
9
|
import { findGroupByConfigByName, getGroupByService } from './matcher.js';
|
|
10
|
+
import {} from '../utils/wording.js';
|
|
10
11
|
export class Group {
|
|
11
12
|
constructor(key, value, groupInfo, manager) {
|
|
12
13
|
this.key = key;
|
|
@@ -25,6 +26,13 @@ export class Group {
|
|
|
25
26
|
get property() {
|
|
26
27
|
return this.groupInfo.property;
|
|
27
28
|
}
|
|
29
|
+
/** {@link name$} in the words `wording` resolves (a date group's "Today"). */
|
|
30
|
+
nameIn(wording) {
|
|
31
|
+
const type = this.property.dataType$.value;
|
|
32
|
+
if (!type)
|
|
33
|
+
return '';
|
|
34
|
+
return this.groupInfo.config.groupName(type, this.value, wording);
|
|
35
|
+
}
|
|
28
36
|
get config() {
|
|
29
37
|
return this.groupInfo.config;
|
|
30
38
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UniComponent } from '../../../affine-shared/types/index.js';
|
|
2
2
|
import type { TypeInstance, ValueTypeOf } from '../logical/type.js';
|
|
3
3
|
import type { Group } from './trait.js';
|
|
4
|
+
import { type Wording } from '../utils/wording.js';
|
|
4
5
|
export interface GroupRenderProps<JsonValue = unknown, Data extends Record<string, unknown> = Record<string, unknown>> {
|
|
5
6
|
group: Group<unknown, JsonValue, Data>;
|
|
6
7
|
readonly: boolean;
|
|
@@ -9,7 +10,8 @@ type AddToGroup<GroupValue, MatchType> = (value: GroupValue | null, oldValue: Va
|
|
|
9
10
|
export type GroupByConfig<Data extends NonNullable<unknown> = NonNullable<unknown>, MatchType extends TypeInstance = TypeInstance, GroupValue = unknown> = {
|
|
10
11
|
name: string;
|
|
11
12
|
matchType: MatchType;
|
|
12
|
-
|
|
13
|
+
/** `wording` names a group in the host's words; English when absent. */
|
|
14
|
+
groupName: (type: MatchType, value: GroupValue | null, wording?: Wording) => string;
|
|
13
15
|
defaultKeys: (type: MatchType) => {
|
|
14
16
|
key: string;
|
|
15
17
|
value: GroupValue | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import {} from '../utils/wording.js';
|
|
@@ -2,6 +2,7 @@ import type { Disposable } from '../../../global/disposable/index.js';
|
|
|
2
2
|
import type { ZodType } from 'zod';
|
|
3
3
|
import type { DataSource } from '../data-source/base.js';
|
|
4
4
|
import type { TypeInstance } from '../logical/type.js';
|
|
5
|
+
import { type ChromeWording } from '../../../affine-shared/services/index.js';
|
|
5
6
|
export type WithCommonPropertyConfig<T = {}> = T & {
|
|
6
7
|
dataSource: DataSource;
|
|
7
8
|
};
|
|
@@ -10,6 +11,12 @@ export type GetRawValueFromConfig<T> = T extends PropertyConfig<any, infer R, an
|
|
|
10
11
|
export type GetJsonValueFromConfig<T> = T extends PropertyConfig<any, any, infer R> ? R : never;
|
|
11
12
|
export type PropertyConfig<Data, RawValue = unknown, JsonValue = unknown> = {
|
|
12
13
|
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* {@link name} as a key with its English fallback (#572): the type's name
|
|
16
|
+
* in the host's language, in every type menu and as the name a new
|
|
17
|
+
* property is given (written resolved, at the gesture).
|
|
18
|
+
*/
|
|
19
|
+
nameWording?: ChromeWording;
|
|
13
20
|
hide?: boolean;
|
|
14
21
|
propertyData: {
|
|
15
22
|
schema: ZodType<Data>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import {} from '../../../affine-shared/services/index.js';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { menu, popMenu, } from '../../../affine-components/context-menu/index.js';
|
|
2
2
|
import { renderUniLit } from '../utils/index.js';
|
|
3
|
+
import { DATA_VIEW_SORT_NEW } from '../../translations.js';
|
|
4
|
+
import { wordingFrom } from '../utils/wording.js';
|
|
3
5
|
export const popCreateSort = (target, props) => {
|
|
4
6
|
popMenu(target, {
|
|
5
7
|
options: {
|
|
6
8
|
onClose: props.onClose,
|
|
7
9
|
title: {
|
|
8
|
-
text:
|
|
10
|
+
text: wordingFrom(target.element)(DATA_VIEW_SORT_NEW),
|
|
9
11
|
onBack: props.onBack,
|
|
10
12
|
},
|
|
11
13
|
items: [
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { t } from '../logical/index.js';
|
|
2
2
|
import { createStatisticConfig } from './create.js';
|
|
3
|
+
import { DATA_VIEW_STATS_GROUP_COUNT, DATA_VIEW_STATS_COUNT_ALL, DATA_VIEW_STATS_COUNT_VALUES, DATA_VIEW_STATS_COUNT_UNIQUE, DATA_VIEW_STATS_COUNT_EMPTY, DATA_VIEW_STATS_COUNT_NOT_EMPTY, DATA_VIEW_STATS_PERCENT_EMPTY, DATA_VIEW_STATS_PERCENT_NOT_EMPTY, DATA_VIEW_STATS_ALL, DATA_VIEW_STATS_VALUES, DATA_VIEW_STATS_UNIQUE, DATA_VIEW_STATS_NOT_EMPTY, DATA_VIEW_NUMBER_FORMAT_PERCENT, DATA_VIEW_EMPTY_VALUE, } from '../../translations.js';
|
|
3
4
|
export const anyTypeStatsFunctions = [
|
|
4
5
|
createStatisticConfig({
|
|
5
|
-
group:
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
7
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
8
|
+
menuName: DATA_VIEW_STATS_COUNT_ALL[1],
|
|
9
|
+
menuWording: DATA_VIEW_STATS_COUNT_ALL,
|
|
10
|
+
displayName: DATA_VIEW_STATS_ALL[1],
|
|
11
|
+
displayWording: DATA_VIEW_STATS_ALL,
|
|
8
12
|
type: 'count-all',
|
|
9
13
|
dataType: t.unknown.instance(),
|
|
10
14
|
impl: data => {
|
|
@@ -12,9 +16,12 @@ export const anyTypeStatsFunctions = [
|
|
|
12
16
|
},
|
|
13
17
|
}),
|
|
14
18
|
createStatisticConfig({
|
|
15
|
-
group:
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
20
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
21
|
+
menuName: DATA_VIEW_STATS_COUNT_VALUES[1],
|
|
22
|
+
menuWording: DATA_VIEW_STATS_COUNT_VALUES,
|
|
23
|
+
displayName: DATA_VIEW_STATS_VALUES[1],
|
|
24
|
+
displayWording: DATA_VIEW_STATS_VALUES,
|
|
18
25
|
type: 'count-values',
|
|
19
26
|
dataType: t.unknown.instance(),
|
|
20
27
|
impl: data => {
|
|
@@ -28,9 +35,12 @@ export const anyTypeStatsFunctions = [
|
|
|
28
35
|
},
|
|
29
36
|
}),
|
|
30
37
|
createStatisticConfig({
|
|
31
|
-
group:
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
39
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
40
|
+
menuName: DATA_VIEW_STATS_COUNT_UNIQUE[1],
|
|
41
|
+
menuWording: DATA_VIEW_STATS_COUNT_UNIQUE,
|
|
42
|
+
displayName: DATA_VIEW_STATS_UNIQUE[1],
|
|
43
|
+
displayWording: DATA_VIEW_STATS_UNIQUE,
|
|
34
44
|
type: 'count-unique-values',
|
|
35
45
|
dataType: t.unknown.instance(),
|
|
36
46
|
impl: data => {
|
|
@@ -46,9 +56,12 @@ export const anyTypeStatsFunctions = [
|
|
|
46
56
|
},
|
|
47
57
|
}),
|
|
48
58
|
createStatisticConfig({
|
|
49
|
-
group:
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
60
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
61
|
+
menuName: DATA_VIEW_STATS_COUNT_EMPTY[1],
|
|
62
|
+
menuWording: DATA_VIEW_STATS_COUNT_EMPTY,
|
|
63
|
+
displayName: DATA_VIEW_EMPTY_VALUE[1],
|
|
64
|
+
displayWording: DATA_VIEW_EMPTY_VALUE,
|
|
52
65
|
type: 'count-empty',
|
|
53
66
|
dataType: t.unknown.instance(),
|
|
54
67
|
impl: (data, { meta, dataSource }) => {
|
|
@@ -57,9 +70,12 @@ export const anyTypeStatsFunctions = [
|
|
|
57
70
|
},
|
|
58
71
|
}),
|
|
59
72
|
createStatisticConfig({
|
|
60
|
-
group:
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
74
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
75
|
+
menuName: DATA_VIEW_STATS_COUNT_NOT_EMPTY[1],
|
|
76
|
+
menuWording: DATA_VIEW_STATS_COUNT_NOT_EMPTY,
|
|
77
|
+
displayName: DATA_VIEW_STATS_NOT_EMPTY[1],
|
|
78
|
+
displayWording: DATA_VIEW_STATS_NOT_EMPTY,
|
|
63
79
|
type: 'count-not-empty',
|
|
64
80
|
dataType: t.unknown.instance(),
|
|
65
81
|
impl: (data, { meta, dataSource }) => {
|
|
@@ -68,9 +84,12 @@ export const anyTypeStatsFunctions = [
|
|
|
68
84
|
},
|
|
69
85
|
}),
|
|
70
86
|
createStatisticConfig({
|
|
71
|
-
group:
|
|
72
|
-
|
|
73
|
-
|
|
87
|
+
group: DATA_VIEW_NUMBER_FORMAT_PERCENT[1],
|
|
88
|
+
groupWording: DATA_VIEW_NUMBER_FORMAT_PERCENT,
|
|
89
|
+
menuName: DATA_VIEW_STATS_PERCENT_EMPTY[1],
|
|
90
|
+
menuWording: DATA_VIEW_STATS_PERCENT_EMPTY,
|
|
91
|
+
displayName: DATA_VIEW_EMPTY_VALUE[1],
|
|
92
|
+
displayWording: DATA_VIEW_EMPTY_VALUE,
|
|
74
93
|
type: 'percent-empty',
|
|
75
94
|
dataType: t.unknown.instance(),
|
|
76
95
|
impl: (data, { meta, dataSource }) => {
|
|
@@ -81,9 +100,12 @@ export const anyTypeStatsFunctions = [
|
|
|
81
100
|
},
|
|
82
101
|
}),
|
|
83
102
|
createStatisticConfig({
|
|
84
|
-
group:
|
|
85
|
-
|
|
86
|
-
|
|
103
|
+
group: DATA_VIEW_NUMBER_FORMAT_PERCENT[1],
|
|
104
|
+
groupWording: DATA_VIEW_NUMBER_FORMAT_PERCENT,
|
|
105
|
+
menuName: DATA_VIEW_STATS_PERCENT_NOT_EMPTY[1],
|
|
106
|
+
menuWording: DATA_VIEW_STATS_PERCENT_NOT_EMPTY,
|
|
107
|
+
displayName: DATA_VIEW_STATS_NOT_EMPTY[1],
|
|
108
|
+
displayWording: DATA_VIEW_STATS_NOT_EMPTY,
|
|
87
109
|
type: 'percent-not-empty',
|
|
88
110
|
dataType: t.unknown.instance(),
|
|
89
111
|
impl: (data, { meta, dataSource }) => {
|
|
@@ -1,44 +1,56 @@
|
|
|
1
1
|
import { t } from '../logical/index.js';
|
|
2
2
|
import { createStatisticConfig } from './create.js';
|
|
3
|
+
import { DATA_VIEW_STATS_GROUP_COUNT, DATA_VIEW_STATS_COUNT_UNCHECKED, DATA_VIEW_STATS_COUNT_CHECKED, DATA_VIEW_STATS_PERCENT_UNCHECKED, DATA_VIEW_STATS_PERCENT_CHECKED, DATA_VIEW_STATS_UNCHECKED, DATA_VIEW_STATS_CHECKED, DATA_VIEW_NUMBER_FORMAT_PERCENT, } from '../../translations.js';
|
|
3
4
|
export const checkboxTypeStatsFunctions = [
|
|
4
5
|
createStatisticConfig({
|
|
5
|
-
group:
|
|
6
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
7
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
6
8
|
type: 'count-values',
|
|
7
9
|
dataType: t.boolean.instance(),
|
|
8
10
|
}),
|
|
9
11
|
createStatisticConfig({
|
|
10
|
-
group:
|
|
12
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
13
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
11
14
|
type: 'count-unique-values',
|
|
12
15
|
dataType: t.boolean.instance(),
|
|
13
16
|
}),
|
|
14
17
|
createStatisticConfig({
|
|
15
|
-
group:
|
|
18
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
19
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
16
20
|
type: 'count-empty',
|
|
17
21
|
dataType: t.boolean.instance(),
|
|
18
|
-
menuName:
|
|
19
|
-
|
|
22
|
+
menuName: DATA_VIEW_STATS_COUNT_UNCHECKED[1],
|
|
23
|
+
menuWording: DATA_VIEW_STATS_COUNT_UNCHECKED,
|
|
24
|
+
displayName: DATA_VIEW_STATS_UNCHECKED[1],
|
|
25
|
+
displayWording: DATA_VIEW_STATS_UNCHECKED,
|
|
20
26
|
impl: data => {
|
|
21
27
|
const emptyList = data.filter(value => !value);
|
|
22
28
|
return emptyList.length.toString();
|
|
23
29
|
},
|
|
24
30
|
}),
|
|
25
31
|
createStatisticConfig({
|
|
26
|
-
group:
|
|
32
|
+
group: DATA_VIEW_STATS_GROUP_COUNT[1],
|
|
33
|
+
groupWording: DATA_VIEW_STATS_GROUP_COUNT,
|
|
27
34
|
type: 'count-not-empty',
|
|
28
35
|
dataType: t.boolean.instance(),
|
|
29
|
-
menuName:
|
|
30
|
-
|
|
36
|
+
menuName: DATA_VIEW_STATS_COUNT_CHECKED[1],
|
|
37
|
+
menuWording: DATA_VIEW_STATS_COUNT_CHECKED,
|
|
38
|
+
displayName: DATA_VIEW_STATS_CHECKED[1],
|
|
39
|
+
displayWording: DATA_VIEW_STATS_CHECKED,
|
|
31
40
|
impl: data => {
|
|
32
41
|
const notEmptyList = data.filter(value => !!value);
|
|
33
42
|
return notEmptyList.length.toString();
|
|
34
43
|
},
|
|
35
44
|
}),
|
|
36
45
|
createStatisticConfig({
|
|
37
|
-
group:
|
|
46
|
+
group: DATA_VIEW_NUMBER_FORMAT_PERCENT[1],
|
|
47
|
+
groupWording: DATA_VIEW_NUMBER_FORMAT_PERCENT,
|
|
38
48
|
type: 'percent-empty',
|
|
39
49
|
dataType: t.boolean.instance(),
|
|
40
|
-
menuName:
|
|
41
|
-
|
|
50
|
+
menuName: DATA_VIEW_STATS_PERCENT_UNCHECKED[1],
|
|
51
|
+
menuWording: DATA_VIEW_STATS_PERCENT_UNCHECKED,
|
|
52
|
+
displayName: DATA_VIEW_STATS_UNCHECKED[1],
|
|
53
|
+
displayWording: DATA_VIEW_STATS_UNCHECKED,
|
|
42
54
|
impl: data => {
|
|
43
55
|
if (data.length === 0)
|
|
44
56
|
return '';
|
|
@@ -47,11 +59,14 @@ export const checkboxTypeStatsFunctions = [
|
|
|
47
59
|
},
|
|
48
60
|
}),
|
|
49
61
|
createStatisticConfig({
|
|
50
|
-
group:
|
|
62
|
+
group: DATA_VIEW_NUMBER_FORMAT_PERCENT[1],
|
|
63
|
+
groupWording: DATA_VIEW_NUMBER_FORMAT_PERCENT,
|
|
51
64
|
type: 'percent-not-empty',
|
|
52
65
|
dataType: t.boolean.instance(),
|
|
53
|
-
menuName:
|
|
54
|
-
|
|
66
|
+
menuName: DATA_VIEW_STATS_PERCENT_CHECKED[1],
|
|
67
|
+
menuWording: DATA_VIEW_STATS_PERCENT_CHECKED,
|
|
68
|
+
displayName: DATA_VIEW_STATS_CHECKED[1],
|
|
69
|
+
displayWording: DATA_VIEW_STATS_CHECKED,
|
|
55
70
|
impl: data => {
|
|
56
71
|
if (data.length === 0)
|
|
57
72
|
return '';
|