@formicoidea/labre-core 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-data-view/data-view-block.js +1 -1
- package/dist/_pkgs/affine-block-database/components/title/index.js +7 -2
- package/dist/_pkgs/affine-block-database/database-block-styles.js +9 -1
- package/dist/_pkgs/affine-block-embed-doc/page-drop/page-drop.d.ts +70 -0
- package/dist/_pkgs/affine-block-embed-doc/page-drop/page-drop.js +196 -0
- package/dist/_pkgs/affine-block-embed-doc/view.js +3 -0
- package/dist/_pkgs/affine-block-frame/frame-template.d.ts +11 -0
- package/dist/_pkgs/affine-block-frame/frame-template.js +24 -4
- package/dist/_pkgs/affine-block-frame/translations.d.ts +3 -0
- package/dist/_pkgs/affine-block-frame/translations.js +7 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +9 -3
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +9 -5
- package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +55 -3
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +139 -6
- package/dist/_pkgs/affine-block-surface/renderer/notation-tint.d.ts +92 -0
- package/dist/_pkgs/affine-block-surface/renderer/notation-tint.js +113 -0
- package/dist/_pkgs/affine-block-surface/surface-block.js +2 -2
- package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
- package/dist/_pkgs/affine-components/context-menu/input.js +2 -1
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.d.ts +7 -0
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +53 -13
- package/dist/_pkgs/affine-components/drop-indicator/file-drop-manager.js +15 -0
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +4 -2
- package/dist/_pkgs/affine-inline-link/link-node/link-popup/styles.js +1 -1
- package/dist/_pkgs/affine-inline-reference/reference-node/reference-popup/reference-popup.js +9 -9
- package/dist/_pkgs/affine-shared/consts/notation.d.ts +1 -0
- package/dist/_pkgs/affine-shared/consts/notation.js +29 -0
- package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +5 -0
- package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/page-drop-service.d.ts +61 -0
- package/dist/_pkgs/affine-shared/services/page-drop-service.js +30 -0
- package/dist/_pkgs/affine-shared/styles/scrollbar-style.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +5 -5
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-auto-complete.js +2 -2
- package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +6 -6
- package/dist/_pkgs/affine-widget-keyboard-toolbar/styles.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/config.d.ts +8 -0
- package/dist/_pkgs/affine-widget-linked-doc/config.js +8 -1
- package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +40 -32
- package/dist/_pkgs/affine-widget-linked-doc/styles.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/translations.d.ts +2 -0
- package/dist/_pkgs/affine-widget-linked-doc/translations.js +6 -0
- package/dist/_pkgs/affine-widget-thread-marks/widget.d.ts +3 -1
- package/dist/_pkgs/affine-widget-thread-marks/widget.js +6 -1
- package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +2 -1
- package/dist/_pkgs/affine-widget-toolbar/utils.js +5 -2
- package/dist/_pkgs/data-view/core/common/properties.js +2 -2
- package/dist/_pkgs/data-view/core/common/property-menu.d.ts +3 -3
- package/dist/_pkgs/data-view/core/common/property-menu.js +7 -7
- package/dist/_pkgs/data-view/core/component/overflow/overflow.js +4 -1
- package/dist/_pkgs/data-view/core/group-by/renderer/base.d.ts +4 -1
- package/dist/_pkgs/data-view/core/group-by/renderer/base.js +17 -2
- package/dist/_pkgs/data-view/core/group-by/renderer/number-group.js +1 -1
- package/dist/_pkgs/data-view/core/group-by/renderer/select-group.d.ts +0 -3
- package/dist/_pkgs/data-view/core/group-by/renderer/select-group.js +63 -118
- package/dist/_pkgs/data-view/core/group-by/renderer/string-group.js +1 -1
- package/dist/_pkgs/data-view/core/group-by/setting.js +2 -2
- package/dist/_pkgs/data-view/core/utils/wording.d.ts +6 -2
- package/dist/_pkgs/data-view/core/utils/wording.js +5 -3
- package/dist/_pkgs/data-view/core/view/default-name.d.ts +6 -0
- package/dist/_pkgs/data-view/core/view/default-name.js +8 -0
- package/dist/_pkgs/data-view/translations.d.ts +47 -0
- package/dist/_pkgs/data-view/translations.js +124 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +102 -124
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +4 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/header.js +17 -9
- package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +20 -11
- package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.d.ts +17 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.js +31 -6
- package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +4 -2
- package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.d.ts +3 -1
- package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.js +23 -3
- package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.d.ts +3 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.js +37 -5
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +3 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +99 -35
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +30 -22
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +8 -6
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +15 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { type MenuConfig, type PopupTarget } from '../../../affine-components/co
|
|
|
2
2
|
import { type Wording } from '../utils/wording.js';
|
|
3
3
|
import type { Property } from '../view-manager/property.js';
|
|
4
4
|
import type { SingleView } from '../view-manager/single-view.js';
|
|
5
|
-
export declare const inputConfig: (property: Property) => (menu: import("../../../affine-components/context-menu/menu.js").Menu) => import("lit-html").TemplateResult<1> | undefined;
|
|
5
|
+
export declare const inputConfig: (property: Property, wording?: Wording) => (menu: import("../../../affine-components/context-menu/menu.js").Menu) => import("lit-html").TemplateResult<1> | undefined;
|
|
6
6
|
export declare const typeConfig: (property: Property, wording?: Wording) => (menu: import("../../../affine-components/context-menu/menu.js").Menu, index: number) => import("lit-html").TemplateResult | undefined;
|
|
7
7
|
/** What a property menu's opener adds around the shared entries. */
|
|
8
8
|
export type PropertyMenuSlots = {
|
|
@@ -28,8 +28,8 @@ export type PropertyMenuSlots = {
|
|
|
28
28
|
* ponytail: "Number Format" stays a table slot (its bar is a table/pc
|
|
29
29
|
* element, behind `enable_number_formatting`, off in Labre), so the
|
|
30
30
|
* properties list does not offer it. Move the bar to core and the entry into
|
|
31
|
-
* this list when the flag ships. The virtual
|
|
32
|
-
*
|
|
31
|
+
* this list when the flag ships. The virtual table header still spells its
|
|
32
|
+
* own copy of these entries; point it here in a dedicated pass.
|
|
33
33
|
*/
|
|
34
34
|
export declare const propertyMenuItems: (property: Property, slots?: PropertyMenuSlots) => MenuConfig[];
|
|
35
35
|
export declare const popPropertyMenu: (target: PopupTarget, property: Property, slots?: PropertyMenuSlots) => import("../../../affine-components/context-menu/menu-renderer.js").MenuHandler;
|
|
@@ -2,10 +2,10 @@ import { menu, popMenu, } from '../../../affine-components/context-menu/index.js
|
|
|
2
2
|
import { TOOLBAR_DELETE, TOOLBAR_DUPLICATE, } from '../../../affine-shared/services/index.js';
|
|
3
3
|
import { DeleteIcon, DuplicateIcon, ViewIcon } from '@blocksuite/icons/lit';
|
|
4
4
|
import { html } from 'lit/static-html.js';
|
|
5
|
-
import { DATA_VIEW_PROPERTY_HIDE_IN_VIEW, DATA_VIEW_PROPERTY_TYPE, } from '../../translations.js';
|
|
5
|
+
import { DATA_VIEW_PROPERTY_HIDE_IN_VIEW, DATA_VIEW_PROPERTY_NAME, DATA_VIEW_PROPERTY_TYPE, DATA_VIEW_PROPERTY_TYPE_ENTRY, } from '../../translations.js';
|
|
6
6
|
import { renderUniLit } from '../utils/uni-component/index.js';
|
|
7
7
|
import { englishWording } from '../utils/wording.js';
|
|
8
|
-
export const inputConfig = (property) => {
|
|
8
|
+
export const inputConfig = (property, wording = englishWording) => {
|
|
9
9
|
return menu.input({
|
|
10
10
|
prefix: html `
|
|
11
11
|
<div class="affine-database-column-type-menu-icon">
|
|
@@ -13,7 +13,7 @@ export const inputConfig = (property) => {
|
|
|
13
13
|
</div>
|
|
14
14
|
`,
|
|
15
15
|
initialValue: property.name$.value,
|
|
16
|
-
placeholder:
|
|
16
|
+
placeholder: wording(DATA_VIEW_PROPERTY_NAME),
|
|
17
17
|
// Persist on blur so the typed name survives the menu being dismissed by
|
|
18
18
|
// a click outside, which never fires the completion path.
|
|
19
19
|
onBlur: text => {
|
|
@@ -25,7 +25,7 @@ export const typeConfig = (property, wording = englishWording) => {
|
|
|
25
25
|
return menu.group({
|
|
26
26
|
items: [
|
|
27
27
|
menu.subMenu({
|
|
28
|
-
name:
|
|
28
|
+
name: wording(DATA_VIEW_PROPERTY_TYPE_ENTRY),
|
|
29
29
|
hide: () => !property.typeCanSet,
|
|
30
30
|
postfix: html ` <div
|
|
31
31
|
class="affine-database-column-type-icon"
|
|
@@ -75,13 +75,13 @@ export const typeConfig = (property, wording = englishWording) => {
|
|
|
75
75
|
* ponytail: "Number Format" stays a table slot (its bar is a table/pc
|
|
76
76
|
* element, behind `enable_number_formatting`, off in Labre), so the
|
|
77
77
|
* properties list does not offer it. Move the bar to core and the entry into
|
|
78
|
-
* this list when the flag ships. The virtual
|
|
79
|
-
*
|
|
78
|
+
* this list when the flag ships. The virtual table header still spells its
|
|
79
|
+
* own copy of these entries; point it here in a dedicated pass.
|
|
80
80
|
*/
|
|
81
81
|
export const propertyMenuItems = (property, slots = {}) => {
|
|
82
82
|
const wording = slots.wording ?? englishWording;
|
|
83
83
|
return [
|
|
84
|
-
inputConfig(property),
|
|
84
|
+
inputConfig(property, wording),
|
|
85
85
|
typeConfig(property, wording),
|
|
86
86
|
...(slots.afterType ?? []),
|
|
87
87
|
menu.group({
|
|
@@ -136,7 +136,10 @@ let Overflow = (() => {
|
|
|
136
136
|
const moreWidth = moreButton?.getBoundingClientRect().width;
|
|
137
137
|
if (moreWidth !== undefined)
|
|
138
138
|
this.moreExtraWidth = moreWidth;
|
|
139
|
-
|
|
139
|
+
// The natural width: a host may let a drawn item give way (the views
|
|
140
|
+
// bar clips its pinned tab), and a shrunk width fed back here would make
|
|
141
|
+
// room that is not there, then take it back, pass after pass.
|
|
142
|
+
const widths = Array.from(this.items, item => item.scrollWidth);
|
|
140
143
|
const drawn = fitOverflow({
|
|
141
144
|
widths,
|
|
142
145
|
container: this.getBoundingClientRect().width,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { ShadowlessElement } from '../../../../std/index.js';
|
|
1
|
+
import { type BlockStdScope, ShadowlessElement } from '../../../../std/index.js';
|
|
2
2
|
import type { Group } from '../trait.js';
|
|
3
3
|
import type { GroupRenderProps } from '../types.js';
|
|
4
4
|
declare const BaseGroup_base: typeof ShadowlessElement & import("../../../../global/utils/types.js").Constructor<import("../../../../global/lit/with-disposable.js").DisposableClass>;
|
|
5
5
|
export declare class BaseGroup<JsonValue, Data extends Record<string, unknown>> extends BaseGroup_base implements GroupRenderProps<JsonValue, Data> {
|
|
6
6
|
accessor group: Group<unknown, JsonValue, Data>;
|
|
7
7
|
accessor readonly: boolean;
|
|
8
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
9
|
+
accessor std: BlockStdScope;
|
|
10
|
+
get ungrouped(): string;
|
|
8
11
|
updateData(data: Data): void;
|
|
9
12
|
updateValue(value: JsonValue): void;
|
|
10
13
|
get value(): JsonValue;
|
|
@@ -33,8 +33,11 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
35
|
import { SignalWatcher, WithDisposable } from '../../../../global/lit/index.js';
|
|
36
|
-
import { ShadowlessElement } from '../../../../std/index.js';
|
|
36
|
+
import { ShadowlessElement, stdContext } from '../../../../std/index.js';
|
|
37
|
+
import { consume } from '@lit/context';
|
|
37
38
|
import { property } from 'lit/decorators.js';
|
|
39
|
+
import { DATA_VIEW_UNGROUPED } from '../../../translations.js';
|
|
40
|
+
import { wordingOf } from '../../utils/wording.js';
|
|
38
41
|
let BaseGroup = (() => {
|
|
39
42
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
40
43
|
let _group_decorators;
|
|
@@ -43,13 +46,18 @@ let BaseGroup = (() => {
|
|
|
43
46
|
let _readonly_decorators;
|
|
44
47
|
let _readonly_initializers = [];
|
|
45
48
|
let _readonly_extraInitializers = [];
|
|
49
|
+
let _std_decorators;
|
|
50
|
+
let _std_initializers = [];
|
|
51
|
+
let _std_extraInitializers = [];
|
|
46
52
|
return class BaseGroup extends _classSuper {
|
|
47
53
|
static {
|
|
48
54
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
49
55
|
_group_decorators = [property({ attribute: false })];
|
|
50
56
|
_readonly_decorators = [property({ attribute: false })];
|
|
57
|
+
_std_decorators = [consume({ context: stdContext })];
|
|
51
58
|
__esDecorate(this, null, _group_decorators, { kind: "accessor", name: "group", static: false, private: false, access: { has: obj => "group" in obj, get: obj => obj.group, set: (obj, value) => { obj.group = value; } }, metadata: _metadata }, _group_initializers, _group_extraInitializers);
|
|
52
59
|
__esDecorate(this, null, _readonly_decorators, { kind: "accessor", name: "readonly", static: false, private: false, access: { has: obj => "readonly" in obj, get: obj => obj.readonly, set: (obj, value) => { obj.readonly = value; } }, metadata: _metadata }, _readonly_initializers, _readonly_extraInitializers);
|
|
60
|
+
__esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
|
|
53
61
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
54
62
|
}
|
|
55
63
|
#group_accessor_storage = __runInitializers(this, _group_initializers, void 0);
|
|
@@ -58,6 +66,13 @@ let BaseGroup = (() => {
|
|
|
58
66
|
#readonly_accessor_storage = (__runInitializers(this, _group_extraInitializers), __runInitializers(this, _readonly_initializers, void 0));
|
|
59
67
|
get readonly() { return this.#readonly_accessor_storage; }
|
|
60
68
|
set readonly(value) { this.#readonly_accessor_storage = value; }
|
|
69
|
+
#std_accessor_storage = (__runInitializers(this, _readonly_extraInitializers), __runInitializers(this, _std_initializers, void 0));
|
|
70
|
+
/** Absent outside an editor host: the wordings read English. */
|
|
71
|
+
get std() { return this.#std_accessor_storage; }
|
|
72
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
73
|
+
get ungrouped() {
|
|
74
|
+
return wordingOf(this.std)(DATA_VIEW_UNGROUPED);
|
|
75
|
+
}
|
|
61
76
|
updateData(data) {
|
|
62
77
|
this.group.manager.updateData(data);
|
|
63
78
|
}
|
|
@@ -75,7 +90,7 @@ let BaseGroup = (() => {
|
|
|
75
90
|
}
|
|
76
91
|
constructor() {
|
|
77
92
|
super(...arguments);
|
|
78
|
-
__runInitializers(this,
|
|
93
|
+
__runInitializers(this, _std_extraInitializers);
|
|
79
94
|
}
|
|
80
95
|
};
|
|
81
96
|
})();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type BlockStdScope } from '../../../../std/index.js';
|
|
2
1
|
import type { SelectTag } from '../../logical/index.js';
|
|
3
2
|
import { BaseGroup } from './base.js';
|
|
4
3
|
export declare class SelectGroupView extends BaseGroup<string, {
|
|
@@ -6,8 +5,6 @@ export declare class SelectGroupView extends BaseGroup<string, {
|
|
|
6
5
|
}> {
|
|
7
6
|
static styles: import("lit").CSSResult;
|
|
8
7
|
private readonly _click;
|
|
9
|
-
/** Absent outside an editor host: the colour names read English. */
|
|
10
|
-
accessor std: BlockStdScope;
|
|
11
8
|
get tag(): {
|
|
12
9
|
id: string;
|
|
13
10
|
value: string;
|
|
@@ -1,59 +1,41 @@
|
|
|
1
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
1
|
import { menu, popMenu, popupTargetFromElement, } from '../../../../affine-components/context-menu/index.js';
|
|
36
|
-
import { stdContext } from '../../../../std/index.js';
|
|
37
|
-
import { consume } from '@lit/context';
|
|
38
2
|
import { css, html } from 'lit';
|
|
39
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
40
4
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
41
5
|
import { selectOptionColorGrid } from '../../component/tags/color-menu.js';
|
|
42
6
|
import { wordingOf } from '../../utils/wording.js';
|
|
43
7
|
import { BaseGroup } from './base.js';
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
8
|
+
export class SelectGroupView extends BaseGroup {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this._click = (e) => {
|
|
12
|
+
if (this.readonly) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
popMenu(popupTargetFromElement(this), {
|
|
17
|
+
options: {
|
|
18
|
+
items: [
|
|
19
|
+
menu.input({
|
|
20
|
+
initialValue: this.tag?.value ?? '',
|
|
21
|
+
onChange: text => {
|
|
22
|
+
this.updateTag({ value: text });
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
...selectOptionColorGrid({
|
|
26
|
+
current: this.tag?.color,
|
|
27
|
+
say: wordingOf(this.std),
|
|
28
|
+
std: this.std,
|
|
29
|
+
select: color => {
|
|
30
|
+
this.updateTag({ color });
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static { this.styles = css `
|
|
57
39
|
data-view-group-title-select-view {
|
|
58
40
|
overflow: hidden;
|
|
59
41
|
}
|
|
@@ -77,78 +59,41 @@ let SelectGroupView = (() => {
|
|
|
77
59
|
white-space: nowrap;
|
|
78
60
|
}
|
|
79
61
|
`; }
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
render() {
|
|
88
|
-
const tag = this.tag;
|
|
89
|
-
if (!tag) {
|
|
90
|
-
return html ` <div
|
|
62
|
+
get tag() {
|
|
63
|
+
return this.data.options?.find(v => v.id === this.value);
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const tag = this.tag;
|
|
67
|
+
if (!tag) {
|
|
68
|
+
return html ` <div
|
|
91
69
|
style="font-size: 14px;color: var(--affine-text-primary-color);line-height: 22px;"
|
|
92
70
|
>
|
|
93
|
-
|
|
71
|
+
${this.ungrouped}
|
|
94
72
|
</div>`;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
73
|
+
}
|
|
74
|
+
const style = styleMap({
|
|
75
|
+
backgroundColor: tag.color,
|
|
76
|
+
});
|
|
77
|
+
const classList = classMap({
|
|
78
|
+
'data-view-group-title-select-view': true,
|
|
79
|
+
readonly: this.readonly,
|
|
80
|
+
});
|
|
81
|
+
return html ` <div @click="${this._click}" class="${classList}">
|
|
104
82
|
<div class="tag" style="${style}">${tag.value}</div>
|
|
105
83
|
</div>`;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
return v;
|
|
118
|
-
}),
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
constructor() {
|
|
122
|
-
super(...arguments);
|
|
123
|
-
this._click = (e) => {
|
|
124
|
-
if (this.readonly) {
|
|
125
|
-
return;
|
|
84
|
+
}
|
|
85
|
+
updateTag(tag) {
|
|
86
|
+
this.updateData?.({
|
|
87
|
+
...this.data,
|
|
88
|
+
options: this.data.options.map(v => {
|
|
89
|
+
if (v.id === this.value) {
|
|
90
|
+
return {
|
|
91
|
+
...v,
|
|
92
|
+
...tag,
|
|
93
|
+
};
|
|
126
94
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
initialValue: this.tag?.value ?? '',
|
|
133
|
-
onChange: text => {
|
|
134
|
-
this.updateTag({ value: text });
|
|
135
|
-
},
|
|
136
|
-
}),
|
|
137
|
-
...selectOptionColorGrid({
|
|
138
|
-
current: this.tag?.color,
|
|
139
|
-
say: wordingOf(this.std),
|
|
140
|
-
std: this.std,
|
|
141
|
-
select: color => {
|
|
142
|
-
this.updateTag({ color });
|
|
143
|
-
},
|
|
144
|
-
}),
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
|
|
150
|
-
__runInitializers(this, _std_extraInitializers);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
})();
|
|
154
|
-
export { SelectGroupView };
|
|
95
|
+
return v;
|
|
96
|
+
}),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -91,7 +91,7 @@ let GroupSetting = (() => {
|
|
|
91
91
|
width: 4px;
|
|
92
92
|
height: 12px;
|
|
93
93
|
border-radius: 1px;
|
|
94
|
-
background-color:
|
|
94
|
+
background-color: var(--affine-border-color);
|
|
95
95
|
position: absolute;
|
|
96
96
|
left: 4px;
|
|
97
97
|
top: 0;
|
|
@@ -100,7 +100,7 @@ let GroupSetting = (() => {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
.group-item:hover .group-item-drag-bar {
|
|
103
|
-
background-color:
|
|
103
|
+
background-color: var(--affine-placeholder-color);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
.group-item-visibility {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { type ChromeWording } from '../../../affine-shared/services/index.js';
|
|
1
|
+
import { type ChromeWording, type TranslationParams } from '../../../affine-shared/services/index.js';
|
|
2
2
|
import type { BlockStdScope } from '../../../std/index.js';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `params` fills `{{name}}` placeholders; the host pluralises on `count`, the
|
|
5
|
+
* English fallback stays neutral.
|
|
6
|
+
*/
|
|
7
|
+
export type Wording = (wording: ChromeWording, params?: TranslationParams) => string;
|
|
4
8
|
/**
|
|
5
9
|
* Resolve the data-view's wordings through the translation seam when an
|
|
6
10
|
* editor is there (`stdContext`), in English otherwise (a unit test, a
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { translateKey, } from '../../../affine-shared/services/index.js';
|
|
1
|
+
import { fillPlaceholders, translateKey, } from '../../../affine-shared/services/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Resolve the data-view's wordings through the translation seam when an
|
|
4
4
|
* editor is there (`stdContext`), in English otherwise (a unit test, a
|
|
5
5
|
* standalone mount). A popup renders outside the host, so its opener
|
|
6
6
|
* resolves the words and hands this function down.
|
|
7
7
|
*/
|
|
8
|
-
export const wordingOf = (std) => ([key, fallback]) => std
|
|
9
|
-
|
|
8
|
+
export const wordingOf = (std) => ([key, fallback], params) => std
|
|
9
|
+
? translateKey(std, key, fallback, params)
|
|
10
|
+
: fillPlaceholders(fallback, params);
|
|
11
|
+
export const englishWording = ([, fallback], params) => fillPlaceholders(fallback, params);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BlockStdScope } from '../../../std/index.js';
|
|
2
|
+
import type { Wording } from '../utils/wording.js';
|
|
2
3
|
import type { DataViewModel } from './data-view.js';
|
|
3
4
|
/**
|
|
4
5
|
* The name a view created now is given: the preset's `defaultNameKey`
|
|
@@ -8,3 +9,8 @@ import type { DataViewModel } from './data-view.js';
|
|
|
8
9
|
* and the preset's seed never changes (ADR 0023). Never call it on load.
|
|
9
10
|
*/
|
|
10
11
|
export declare function viewDefaultName(meta: Pick<DataViewModel, 'model'>, std: BlockStdScope | undefined): string;
|
|
12
|
+
/**
|
|
13
|
+
* A preset's name as a menu shows it (the view settings' "Layout"), through
|
|
14
|
+
* the opener's words; the English `defaultName` without a key.
|
|
15
|
+
*/
|
|
16
|
+
export declare function viewPresetName(meta: Pick<DataViewModel, 'model'>, wording: Wording): string;
|
|
@@ -12,3 +12,11 @@ export function viewDefaultName(meta, std) {
|
|
|
12
12
|
return defaultName;
|
|
13
13
|
return translateKey(std, defaultNameKey, defaultName);
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* A preset's name as a menu shows it (the view settings' "Layout"), through
|
|
17
|
+
* the opener's words; the English `defaultName` without a key.
|
|
18
|
+
*/
|
|
19
|
+
export function viewPresetName(meta, wording) {
|
|
20
|
+
const { defaultName, defaultNameKey } = meta.model;
|
|
21
|
+
return defaultNameKey ? wording([defaultNameKey, defaultName]) : defaultName;
|
|
22
|
+
}
|
|
@@ -85,5 +85,52 @@ export declare const DATA_VIEW_PROPERTY_HIDE_IN_VIEW: ChromeWording;
|
|
|
85
85
|
* property's menu.
|
|
86
86
|
*/
|
|
87
87
|
export declare const DATA_VIEW_PROPERTY_TYPE: ChromeWording;
|
|
88
|
+
/** The toolbar button and a group's footer row that add a row. */
|
|
89
|
+
export declare const DATA_VIEW_NEW_RECORD: ChromeWording;
|
|
90
|
+
/** The same button on a phone, where the toolbar has no room for two words. */
|
|
91
|
+
export declare const DATA_VIEW_NEW_RECORD_SHORT: ChromeWording;
|
|
92
|
+
/**
|
|
93
|
+
* The title of the group holding the rows with no value. Display only: the
|
|
94
|
+
* stored group key stays `'Ungroups'` (`core/group-by/define.ts`).
|
|
95
|
+
*/
|
|
96
|
+
export declare const DATA_VIEW_UNGROUPED: ChromeWording;
|
|
97
|
+
/** The filter bar's button, and the filter group panel's. */
|
|
98
|
+
export declare const DATA_VIEW_ADD_FILTER: ChromeWording;
|
|
99
|
+
export declare const DATA_VIEW_SEARCH_PLACEHOLDER: ChromeWording;
|
|
100
|
+
/** Read after an "Esc" key cap in the search box's clear tooltip. */
|
|
101
|
+
export declare const DATA_VIEW_SEARCH_CLEAR_HINT: ChromeWording;
|
|
102
|
+
/** The title of the view's settings (its "..." button). */
|
|
103
|
+
export declare const DATA_VIEW_VIEW_SETTINGS: ChromeWording;
|
|
104
|
+
/**
|
|
105
|
+
* The view settings' entries. "Layout" and "Group" are the full page's
|
|
106
|
+
* "This view" entries for the same settings (`VIEW_MENU_LAYOUT`,
|
|
107
|
+
* `VIEW_MENU_GROUP` in `@labre/core-database`): one chrome word, one key,
|
|
108
|
+
* declared here because core draws them too.
|
|
109
|
+
*/
|
|
110
|
+
export declare const DATA_VIEW_LAYOUT: ChromeWording;
|
|
111
|
+
export declare const DATA_VIEW_GROUP: ChromeWording;
|
|
112
|
+
/**
|
|
113
|
+
* The selection pane's "Filter" (`@labre/affine-widget-edgeless-toolbar`):
|
|
114
|
+
* one chrome word, one key, declared there, so not listed below.
|
|
115
|
+
*/
|
|
116
|
+
export declare const DATA_VIEW_FILTER: ChromeWording;
|
|
117
|
+
export declare const DATA_VIEW_SORT: ChromeWording;
|
|
118
|
+
/** Beside "Properties": how many the view shows (`count`). */
|
|
119
|
+
export declare const DATA_VIEW_PROPERTIES_SHOWN: ChromeWording;
|
|
120
|
+
/** Beside "Filter" and "Sort": how many the view has (`count`, 1 or more). */
|
|
121
|
+
export declare const DATA_VIEW_FILTER_COUNT: ChromeWording;
|
|
122
|
+
export declare const DATA_VIEW_SORT_COUNT: ChromeWording;
|
|
123
|
+
/** The title of a property's menu on a phone (its column header). */
|
|
124
|
+
export declare const DATA_VIEW_PROPERTY_SETTINGS: ChromeWording;
|
|
125
|
+
/** A property's menu: the name field's placeholder. */
|
|
126
|
+
export declare const DATA_VIEW_PROPERTY_NAME: ChromeWording;
|
|
127
|
+
/** A property's menu: the entry opening the type picker. */
|
|
128
|
+
export declare const DATA_VIEW_PROPERTY_TYPE_ENTRY: ChromeWording;
|
|
129
|
+
/**
|
|
130
|
+
* The table header's menu: a new property beside this one. Its "Move left"
|
|
131
|
+
* and "Move right" are the views bar's (`VIEWS_BAR_MOVE_LEFT`, `…_RIGHT`).
|
|
132
|
+
*/
|
|
133
|
+
export declare const DATA_VIEW_INSERT_LEFT: ChromeWording;
|
|
134
|
+
export declare const DATA_VIEW_INSERT_RIGHT: ChromeWording;
|
|
88
135
|
/** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
|
|
89
136
|
export declare const DATA_VIEW_WORDINGS: readonly ChromeWording[];
|