@formicoidea/labre-core 0.49.0 → 0.51.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-attachment/asset-picker.d.ts +24 -0
- package/dist/_pkgs/affine-block-attachment/asset-picker.js +87 -0
- package/dist/_pkgs/affine-block-attachment/configs/slash-menu.js +3 -20
- package/dist/_pkgs/affine-block-attachment/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-attachment/index.js +1 -0
- package/dist/_pkgs/affine-block-attachment/utils.d.ts +9 -1
- package/dist/_pkgs/affine-block-attachment/utils.js +9 -0
- package/dist/_pkgs/affine-block-bookmark/adapters/markdown/markdown.js +14 -1
- package/dist/_pkgs/affine-block-bookmark/adapters/notion-html.js +5 -1
- package/dist/_pkgs/affine-block-database/adapters/markdown.js +5 -3
- package/dist/_pkgs/affine-block-embed/common/adapters/html.js +5 -3
- package/dist/_pkgs/affine-block-embed/common/adapters/markdown.js +11 -0
- package/dist/_pkgs/affine-block-frame/frame-template.d.ts +58 -0
- package/dist/_pkgs/affine-block-frame/frame-template.js +207 -0
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +19 -3
- package/dist/_pkgs/affine-block-frame/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-frame/index.js +1 -0
- package/dist/_pkgs/affine-block-frame/translations.d.ts +7 -0
- package/dist/_pkgs/affine-block-frame/translations.js +16 -1
- package/dist/_pkgs/affine-block-frame/view.js +6 -0
- package/dist/_pkgs/affine-block-image/asset-picker.d.ts +63 -0
- package/dist/_pkgs/affine-block-image/asset-picker.js +183 -0
- package/dist/_pkgs/affine-block-image/commands/insert-images.d.ts +5 -0
- package/dist/_pkgs/affine-block-image/commands/insert-images.js +8 -8
- package/dist/_pkgs/affine-block-image/components/page-image-block.d.ts +11 -0
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +81 -12
- package/dist/_pkgs/affine-block-image/configs/replace-action.d.ts +9 -0
- package/dist/_pkgs/affine-block-image/configs/replace-action.js +27 -0
- package/dist/_pkgs/affine-block-image/configs/toolbar.js +6 -0
- package/dist/_pkgs/affine-block-image/crop/crop-controller.d.ts +46 -0
- package/dist/_pkgs/affine-block-image/crop/crop-controller.js +104 -0
- package/dist/_pkgs/affine-block-image/crop/crop-math.d.ts +70 -0
- package/dist/_pkgs/affine-block-image/crop/crop-math.js +141 -0
- package/dist/_pkgs/affine-block-image/crop/crop-overlay.d.ts +57 -0
- package/dist/_pkgs/affine-block-image/crop/crop-overlay.js +343 -0
- package/dist/_pkgs/affine-block-image/crop/crop-toolbar.d.ts +12 -0
- package/dist/_pkgs/affine-block-image/crop/crop-toolbar.js +78 -0
- package/dist/_pkgs/affine-block-image/crop/write-crop.d.ts +16 -0
- package/dist/_pkgs/affine-block-image/crop/write-crop.js +57 -0
- package/dist/_pkgs/affine-block-image/edgeless-clipboard-config.js +4 -1
- package/dist/_pkgs/affine-block-image/effects.js +2 -0
- package/dist/_pkgs/affine-block-image/image-block.d.ts +2 -0
- package/dist/_pkgs/affine-block-image/image-block.js +2 -0
- package/dist/_pkgs/affine-block-image/image-edgeless-block.d.ts +2 -0
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +36 -8
- package/dist/_pkgs/affine-block-image/image-resize-manager.js +15 -0
- package/dist/_pkgs/affine-block-image/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-image/index.js +1 -0
- package/dist/_pkgs/affine-block-image/translations.d.ts +15 -0
- package/dist/_pkgs/affine-block-image/translations.js +43 -0
- package/dist/_pkgs/affine-block-image/utils.d.ts +13 -0
- package/dist/_pkgs/affine-block-image/utils.js +10 -1
- package/dist/_pkgs/affine-block-root/clipboard/page-clipboard.js +5 -0
- package/dist/_pkgs/affine-block-root/commands/page-export-commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/commands/page-export-commands.js +71 -0
- package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/index.js +1 -0
- package/dist/_pkgs/affine-block-root/view.js +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.d.ts +30 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.js +44 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.d.ts +26 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.js +82 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.js +91 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.d.ts +50 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.js +732 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.js +15 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +7 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +7 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +60 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.d.ts +6 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.js +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +28 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +66 -6
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +2 -7
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +2 -6
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-export.d.ts +84 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-export.js +150 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +24 -2
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +23 -2
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +4 -1
- package/dist/_pkgs/affine-block-surface/extensions/legend-role.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend-role.js +20 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +2 -19
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +2 -18
- package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.d.ts +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.js +235 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +9 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +17 -13
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +52 -80
- package/dist/_pkgs/affine-block-surface/extensions/xml-element.d.ts +98 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-element.js +261 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-reader.d.ts +238 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-reader.js +570 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +1 -1
- package/dist/_pkgs/affine-block-surface/interchange-headless.d.ts +29 -0
- package/dist/_pkgs/affine-block-surface/interchange-headless.js +32 -0
- package/dist/_pkgs/affine-block-surface/view.js +22 -2
- package/dist/_pkgs/affine-block-table/adapters/utils.js +24 -1
- package/dist/_pkgs/affine-components/color-picker/color-panel.d.ts +11 -0
- package/dist/_pkgs/affine-components/color-picker/color-panel.js +87 -12
- package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +8 -0
- package/dist/_pkgs/affine-components/color-picker/framework-palette.js +11 -3
- package/dist/_pkgs/affine-components/color-picker/icons.d.ts +9 -0
- package/dist/_pkgs/affine-components/color-picker/icons.js +12 -0
- package/dist/_pkgs/affine-gfx-note/toolbar/note-menu.js +5 -8
- package/dist/_pkgs/affine-gfx-template/contribute.d.ts +14 -4
- package/dist/_pkgs/affine-gfx-template/contribute.js +47 -6
- package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.d.ts +7 -2
- package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.js +14 -40
- package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.d.ts +4 -4
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +9 -9
- package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +2 -4
- package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
- package/dist/_pkgs/affine-gfx-template/translations.js +9 -0
- package/dist/_pkgs/affine-inline-footnote/adapters/markdown/inline-delta.js +6 -0
- package/dist/_pkgs/affine-inline-footnote/adapters/markdown/markdown-inline.js +7 -0
- package/dist/_pkgs/affine-inline-link/adapters/html/html-inline.js +4 -1
- package/dist/_pkgs/affine-inline-link/adapters/html/inline-delta.js +3 -1
- package/dist/_pkgs/affine-inline-link/adapters/markdown/inline-delta.js +4 -1
- package/dist/_pkgs/affine-inline-link/adapters/notion-html/html-inline.js +2 -1
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.d.ts +7 -0
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +37 -0
- package/dist/_pkgs/affine-inline-link/link-node/index.d.ts +1 -0
- package/dist/_pkgs/affine-inline-link/link-node/index.js +1 -0
- package/dist/_pkgs/affine-inline-link/link-node/propose-views.d.ts +22 -0
- package/dist/_pkgs/affine-inline-link/link-node/propose-views.js +59 -0
- package/dist/_pkgs/affine-model/blocks/database/types.d.ts +28 -0
- package/dist/_pkgs/affine-model/blocks/image/image-crop.d.ts +48 -0
- package/dist/_pkgs/affine-model/blocks/image/image-crop.js +78 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.d.ts +6 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/image/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/blocks/image/index.js +1 -0
- package/dist/_pkgs/affine-model/consts/shape.d.ts +2 -0
- package/dist/_pkgs/affine-model/consts/shape.js +5 -0
- package/dist/_pkgs/affine-model/elements/bpmn/consts.d.ts +31 -0
- package/dist/_pkgs/affine-model/elements/bpmn/consts.js +31 -0
- package/dist/_pkgs/affine-model/elements/bpmn/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +0 -25
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -25
- package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +0 -2
- package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -2
- package/dist/_pkgs/affine-model/elements/uml/consts.d.ts +133 -0
- package/dist/_pkgs/affine-model/elements/uml/consts.js +107 -0
- package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +1 -79
- package/dist/_pkgs/affine-model/elements/uml/diagram.js +1 -53
- package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +0 -15
- package/dist/_pkgs/affine-model/elements/uml/fragment.js +1 -15
- package/dist/_pkgs/affine-model/elements/uml/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/uml/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +0 -20
- package/dist/_pkgs/affine-model/elements/uml/partition.js +1 -20
- package/dist/_pkgs/affine-model/elements/uml/region.d.ts +0 -11
- package/dist/_pkgs/affine-model/elements/uml/region.js +1 -11
- package/dist/_pkgs/affine-model/headless.d.ts +19 -0
- package/dist/_pkgs/affine-model/headless.js +19 -0
- package/dist/_pkgs/affine-shared/headless.d.ts +10 -0
- package/dist/_pkgs/affine-shared/headless.js +10 -0
- package/dist/_pkgs/affine-shared/services/asset-picker-service.d.ts +63 -0
- package/dist/_pkgs/affine-shared/services/asset-picker-service.js +20 -0
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +6 -3
- package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +83 -0
- package/dist/_pkgs/affine-shared/services/frame-template-service.js +17 -0
- package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
- package/dist/_pkgs/affine-shared/services/index.js +2 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +6 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +10 -0
- package/dist/_pkgs/affine-widget-drag-handle/watchers/drag-event-watcher.js +8 -3
- package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +4 -16
- package/dist/_pkgs/affine-widget-linked-doc/transformers/html.d.ts +7 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/html.js +25 -24
- package/dist/_pkgs/affine-widget-linked-doc/transformers/index.d.ts +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +7 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +26 -25
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +23 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +14 -0
- package/dist/_pkgs/data-view/core/common/properties.d.ts +29 -0
- package/dist/_pkgs/data-view/core/common/properties.js +110 -8
- package/dist/_pkgs/data-view/core/common/property-menu.d.ts +44 -1
- package/dist/_pkgs/data-view/core/common/property-menu.js +100 -3
- package/dist/_pkgs/data-view/core/component/tags/color-carousel.d.ts +41 -0
- package/dist/_pkgs/data-view/core/component/tags/color-carousel.js +199 -0
- package/dist/_pkgs/data-view/core/component/tags/color-menu.d.ts +49 -0
- package/dist/_pkgs/data-view/core/component/tags/color-menu.js +123 -0
- package/dist/_pkgs/data-view/core/component/tags/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/component/tags/index.js +3 -0
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +8 -1
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +21 -20
- package/dist/_pkgs/data-view/core/component/tags/softened-colors.d.ts +42 -0
- package/dist/_pkgs/data-view/core/component/tags/softened-colors.js +79 -0
- package/dist/_pkgs/data-view/core/data-view.d.ts +8 -1
- package/dist/_pkgs/data-view/core/data-view.js +18 -2
- package/dist/_pkgs/data-view/core/effect.js +2 -1
- package/dist/_pkgs/data-view/core/filter/eval.d.ts +6 -1
- package/dist/_pkgs/data-view/core/filter/eval.js +7 -2
- package/dist/_pkgs/data-view/core/group-by/renderer/select-group.d.ts +3 -0
- package/dist/_pkgs/data-view/core/group-by/renderer/select-group.js +119 -71
- package/dist/_pkgs/data-view/core/view/color-rules.d.ts +85 -0
- package/dist/_pkgs/data-view/core/view/color-rules.js +165 -0
- package/dist/_pkgs/data-view/core/view/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/view/index.js +1 -0
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +1 -0
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +1 -0
- package/dist/_pkgs/data-view/translations.d.ts +34 -0
- package/dist/_pkgs/data-view/translations.js +80 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +7 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +6 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +6 -1
- package/dist/_pkgs/data-view/view-presets/list/list-view.js +4 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +3 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.js +149 -175
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +6 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.d.ts +12 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.js +206 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +16 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +4 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +11 -2
- package/dist/commands.js +5 -2
- package/dist/host-panels.d.ts +21 -1
- package/dist/host-panels.js +50 -10
- package/dist/interchange.d.ts +1 -0
- package/dist/interchange.js +1 -0
- package/dist/model/headless.d.ts +1 -0
- package/dist/model/headless.js +1 -0
- package/dist/shared/headless.d.ts +1 -0
- package/dist/shared/headless.js +1 -0
- package/dist/translations.js +8 -1
- package/package.json +13 -1
|
@@ -32,3 +32,26 @@ export declare const parseMatter: (contents: string) => {
|
|
|
32
32
|
metadata: Record<string, FrontmatterValue>;
|
|
33
33
|
} | null;
|
|
34
34
|
export declare function download(blob: Blob, name: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* A page exported to a file, before anything is done with it: the bytes and
|
|
37
|
+
* the name a download would give them. What `exportDoc` downloads, and what
|
|
38
|
+
* the `page.export.*` view actions hand to the host instead.
|
|
39
|
+
*/
|
|
40
|
+
export interface DocExportFile {
|
|
41
|
+
blob: Blob;
|
|
42
|
+
/** Sanitised, extension included: `Order to cash.md` or `Order to cash.zip`. */
|
|
43
|
+
filename: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Pack an adapter's output: the document alone when it references no asset,
|
|
47
|
+
* else a zip holding it as `index.<ext>` beside an `assets/` folder — the
|
|
48
|
+
* relative paths the Markdown and HTML adapters write for images point there.
|
|
49
|
+
*/
|
|
50
|
+
export declare function packDocExport(result: {
|
|
51
|
+
file: string;
|
|
52
|
+
assetsIds: string[];
|
|
53
|
+
}, assets: Map<string, Blob>, { name, extension, mime }: {
|
|
54
|
+
name: string;
|
|
55
|
+
extension: string;
|
|
56
|
+
mime: string;
|
|
57
|
+
}): Promise<DocExportFile>;
|
|
@@ -214,3 +214,17 @@ export function download(blob, name) {
|
|
|
214
214
|
element.remove();
|
|
215
215
|
URL.revokeObjectURL(fileURL);
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Pack an adapter's output: the document alone when it references no asset,
|
|
219
|
+
* else a zip holding it as `index.<ext>` beside an `assets/` folder — the
|
|
220
|
+
* relative paths the Markdown and HTML adapters write for images point there.
|
|
221
|
+
*/
|
|
222
|
+
export async function packDocExport(result, assets, { name, extension, mime }) {
|
|
223
|
+
const content = new Blob([result.file], { type: mime });
|
|
224
|
+
if (result.assetsIds.length === 0) {
|
|
225
|
+
return { blob: content, filename: `${name}${extension}` };
|
|
226
|
+
}
|
|
227
|
+
const zip = await createAssetsArchive(assets, result.assetsIds);
|
|
228
|
+
await zip.file(`index${extension}`, content);
|
|
229
|
+
return { blob: await zip.generate(), filename: `${name}.zip` };
|
|
230
|
+
}
|
|
@@ -2,18 +2,46 @@ import { type PopupTarget } from '../../../affine-components/context-menu/index.
|
|
|
2
2
|
import { ShadowlessElement } from '../../../std/index.js';
|
|
3
3
|
import type { Property } from '../view-manager/property.js';
|
|
4
4
|
import type { SingleView } from '../view-manager/single-view.js';
|
|
5
|
+
import { type Wording } from '../utils/wording.js';
|
|
5
6
|
declare const DataViewPropertiesSettingView_base: typeof ShadowlessElement & import("../../../global/utils/types.js").Constructor<import("../../../global/lit/with-disposable.js").DisposableClass>;
|
|
7
|
+
/**
|
|
8
|
+
* The properties of a view, as the view options' "Properties" and the
|
|
9
|
+
* database's side panel (`affine-database-properties-panel`) both draw
|
|
10
|
+
* them: one row per property of the source, in this view's order.
|
|
11
|
+
*
|
|
12
|
+
* - The eye hides or shows the property in this view only, the drag bar
|
|
13
|
+
* reorders it in this view only.
|
|
14
|
+
* - A click on the row opens the property's own menu, the one the table's
|
|
15
|
+
* column header opens (`propertyMenuItems`): rename, type, duplicate
|
|
16
|
+
* and delete write the data source, so every view sees them. Kanban,
|
|
17
|
+
* gallery and list have no column header; this row is their way in.
|
|
18
|
+
* - "New property" adds one at the end of the source through the type
|
|
19
|
+
* picker of the virtual table header and the record detail, then opens
|
|
20
|
+
* its menu for the rename.
|
|
21
|
+
*
|
|
22
|
+
* Read-only (the view or its source), a click opens nothing and "New
|
|
23
|
+
* property" is not drawn, as the header does. The title follows the menu's
|
|
24
|
+
* own rules (no type change, no hide, no delete).
|
|
25
|
+
*/
|
|
6
26
|
export declare class DataViewPropertiesSettingView extends DataViewPropertiesSettingView_base {
|
|
7
27
|
static styles: import("lit").CSSResult;
|
|
8
28
|
accessor view: SingleView;
|
|
9
29
|
items$: import("@preact/signals-core").ReadonlySignal<string[]>;
|
|
30
|
+
private readonly _openMenu;
|
|
31
|
+
private readonly _newProperty;
|
|
10
32
|
renderProperty: (property: Property) => import("lit-html").TemplateResult<1>;
|
|
33
|
+
private _renderNewProperty;
|
|
11
34
|
sortContext: import("../utils/wc-dnd/sort/sort-context.js").SortContext;
|
|
12
35
|
private itemsGroup;
|
|
13
36
|
connectedCallback(): void;
|
|
14
37
|
render(): import("lit-html").TemplateResult<1>;
|
|
15
38
|
accessor groupContainer: HTMLElement;
|
|
16
39
|
accessor onBack: (() => void) | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The list draws inside a popup or a host's panel, outside the editor's
|
|
42
|
+
* context: its opener resolves the words (`wordingOf(std)`).
|
|
43
|
+
*/
|
|
44
|
+
accessor wording: Wording;
|
|
17
45
|
}
|
|
18
46
|
declare global {
|
|
19
47
|
interface HTMLElementTagNameMap {
|
|
@@ -24,5 +52,6 @@ export declare const popPropertiesSetting: (target: PopupTarget, props: {
|
|
|
24
52
|
view: SingleView;
|
|
25
53
|
onClose?: () => void;
|
|
26
54
|
onBack?: () => void;
|
|
55
|
+
wording?: Wording;
|
|
27
56
|
}) => void;
|
|
28
57
|
export {};
|
|
@@ -32,20 +32,42 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { menu, popMenu, } from '../../../affine-components/context-menu/index.js';
|
|
35
|
+
import { menu, popMenu, popupTargetFromElement, } from '../../../affine-components/context-menu/index.js';
|
|
36
36
|
import { SignalWatcher, WithDisposable } from '../../../global/lit/index.js';
|
|
37
|
-
import { InvisibleIcon, ViewIcon } from '@blocksuite/icons/lit';
|
|
37
|
+
import { InvisibleIcon, PlusIcon, ViewIcon } from '@blocksuite/icons/lit';
|
|
38
38
|
import { ShadowlessElement } from '../../../std/index.js';
|
|
39
39
|
import { computed } from '@preact/signals-core';
|
|
40
40
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
41
|
-
import { css, html, unsafeCSS } from 'lit';
|
|
41
|
+
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
42
42
|
import { property, query } from 'lit/decorators.js';
|
|
43
43
|
import { classMap } from 'lit/directives/class-map.js';
|
|
44
44
|
import { repeat } from 'lit/directives/repeat.js';
|
|
45
|
+
import { DATA_VIEW_NEW_PROPERTY, DATA_VIEW_PROPERTIES, DATA_VIEW_PROPERTY_TYPE, } from '../../translations.js';
|
|
45
46
|
import { dragHandler } from '../utils/wc-dnd/dnd-context.js';
|
|
46
47
|
import { defaultActivators } from '../utils/wc-dnd/sensors/index.js';
|
|
47
48
|
import { createSortContext, sortable, } from '../utils/wc-dnd/sort/sort-context.js';
|
|
48
49
|
import { verticalListSortingStrategy } from '../utils/wc-dnd/sort/strategies/index.js';
|
|
50
|
+
import { englishWording } from '../utils/wording.js';
|
|
51
|
+
import { popNewPropertyMenu, popPropertyMenu } from './property-menu.js';
|
|
52
|
+
/**
|
|
53
|
+
* The properties of a view, as the view options' "Properties" and the
|
|
54
|
+
* database's side panel (`affine-database-properties-panel`) both draw
|
|
55
|
+
* them: one row per property of the source, in this view's order.
|
|
56
|
+
*
|
|
57
|
+
* - The eye hides or shows the property in this view only, the drag bar
|
|
58
|
+
* reorders it in this view only.
|
|
59
|
+
* - A click on the row opens the property's own menu, the one the table's
|
|
60
|
+
* column header opens (`propertyMenuItems`): rename, type, duplicate
|
|
61
|
+
* and delete write the data source, so every view sees them. Kanban,
|
|
62
|
+
* gallery and list have no column header; this row is their way in.
|
|
63
|
+
* - "New property" adds one at the end of the source through the type
|
|
64
|
+
* picker of the virtual table header and the record detail, then opens
|
|
65
|
+
* its menu for the rename.
|
|
66
|
+
*
|
|
67
|
+
* Read-only (the view or its source), a click opens nothing and "New
|
|
68
|
+
* property" is not drawn, as the header does. The title follows the menu's
|
|
69
|
+
* own rules (no type change, no hide, no delete).
|
|
70
|
+
*/
|
|
49
71
|
let DataViewPropertiesSettingView = (() => {
|
|
50
72
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
51
73
|
let _view_decorators;
|
|
@@ -57,15 +79,20 @@ let DataViewPropertiesSettingView = (() => {
|
|
|
57
79
|
let _onBack_decorators;
|
|
58
80
|
let _onBack_initializers = [];
|
|
59
81
|
let _onBack_extraInitializers = [];
|
|
82
|
+
let _wording_decorators;
|
|
83
|
+
let _wording_initializers = [];
|
|
84
|
+
let _wording_extraInitializers = [];
|
|
60
85
|
return class DataViewPropertiesSettingView extends _classSuper {
|
|
61
86
|
static {
|
|
62
87
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
63
88
|
_view_decorators = [property({ attribute: false })];
|
|
64
89
|
_groupContainer_decorators = [query('.properties-group')];
|
|
65
90
|
_onBack_decorators = [property({ attribute: false })];
|
|
91
|
+
_wording_decorators = [property({ attribute: false })];
|
|
66
92
|
__esDecorate(this, null, _view_decorators, { kind: "accessor", name: "view", static: false, private: false, access: { has: obj => "view" in obj, get: obj => obj.view, set: (obj, value) => { obj.view = value; } }, metadata: _metadata }, _view_initializers, _view_extraInitializers);
|
|
67
93
|
__esDecorate(this, null, _groupContainer_decorators, { kind: "accessor", name: "groupContainer", static: false, private: false, access: { has: obj => "groupContainer" in obj, get: obj => obj.groupContainer, set: (obj, value) => { obj.groupContainer = value; } }, metadata: _metadata }, _groupContainer_initializers, _groupContainer_extraInitializers);
|
|
68
94
|
__esDecorate(this, null, _onBack_decorators, { kind: "accessor", name: "onBack", static: false, private: false, access: { has: obj => "onBack" in obj, get: obj => obj.onBack, set: (obj, value) => { obj.onBack = value; } }, metadata: _metadata }, _onBack_initializers, _onBack_extraInitializers);
|
|
95
|
+
__esDecorate(this, null, _wording_decorators, { kind: "accessor", name: "wording", static: false, private: false, access: { has: obj => "wording" in obj, get: obj => obj.wording, set: (obj, value) => { obj.wording = value; } }, metadata: _metadata }, _wording_initializers, _wording_extraInitializers);
|
|
69
96
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
70
97
|
}
|
|
71
98
|
static { this.styles = css `
|
|
@@ -170,10 +197,36 @@ let DataViewPropertiesSettingView = (() => {
|
|
|
170
197
|
line-height: 22px;
|
|
171
198
|
flex: 1;
|
|
172
199
|
}
|
|
200
|
+
|
|
201
|
+
.property-item:hover {
|
|
202
|
+
background-color: var(--affine-hover-color);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.property-item-new {
|
|
206
|
+
color: var(--affine-text-secondary-color);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.property-item-new .property-item-icon {
|
|
210
|
+
padding-left: 12px;
|
|
211
|
+
}
|
|
173
212
|
`; }
|
|
174
213
|
#view_accessor_storage;
|
|
175
214
|
get view() { return this.#view_accessor_storage; }
|
|
176
215
|
set view(value) { this.#view_accessor_storage = value; }
|
|
216
|
+
_renderNewProperty() {
|
|
217
|
+
if (this.view.readonly$.value)
|
|
218
|
+
return nothing;
|
|
219
|
+
return html `<div
|
|
220
|
+
class="property-item property-item-new"
|
|
221
|
+
data-testid="data-view-properties-new"
|
|
222
|
+
@click="${this._newProperty}"
|
|
223
|
+
>
|
|
224
|
+
<div class="property-item-icon">${PlusIcon()}</div>
|
|
225
|
+
<div class="property-item-name">
|
|
226
|
+
${this.wording(DATA_VIEW_NEW_PROPERTY)}
|
|
227
|
+
</div>
|
|
228
|
+
</div>`;
|
|
229
|
+
}
|
|
177
230
|
itemsGroup() {
|
|
178
231
|
return this.view.propertiesRaw$.value;
|
|
179
232
|
}
|
|
@@ -189,6 +242,7 @@ let DataViewPropertiesSettingView = (() => {
|
|
|
189
242
|
<div class="properties-group">
|
|
190
243
|
${repeat(items, v => v.id, this.renderProperty)}
|
|
191
244
|
</div>
|
|
245
|
+
${this._renderNewProperty()}
|
|
192
246
|
`;
|
|
193
247
|
}
|
|
194
248
|
#groupContainer_accessor_storage;
|
|
@@ -197,15 +251,49 @@ let DataViewPropertiesSettingView = (() => {
|
|
|
197
251
|
#onBack_accessor_storage;
|
|
198
252
|
get onBack() { return this.#onBack_accessor_storage; }
|
|
199
253
|
set onBack(value) { this.#onBack_accessor_storage = value; }
|
|
254
|
+
#wording_accessor_storage;
|
|
255
|
+
/**
|
|
256
|
+
* The list draws inside a popup or a host's panel, outside the editor's
|
|
257
|
+
* context: its opener resolves the words (`wordingOf(std)`).
|
|
258
|
+
*/
|
|
259
|
+
get wording() { return this.#wording_accessor_storage; }
|
|
260
|
+
set wording(value) { this.#wording_accessor_storage = value; }
|
|
200
261
|
constructor() {
|
|
201
262
|
super(...arguments);
|
|
202
263
|
this.#view_accessor_storage = __runInitializers(this, _view_initializers, void 0);
|
|
203
264
|
this.items$ = (__runInitializers(this, _view_extraInitializers), computed(() => {
|
|
204
265
|
return this.view.propertiesRaw$.value.map(property => property.id);
|
|
205
266
|
}));
|
|
267
|
+
this._openMenu = (property, row) => {
|
|
268
|
+
if (this.view.readonly$.value)
|
|
269
|
+
return;
|
|
270
|
+
popPropertyMenu(popupTargetFromElement(row), property, {
|
|
271
|
+
wording: this.wording,
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
this._newProperty = (event) => {
|
|
275
|
+
if (this.view.readonly$.value)
|
|
276
|
+
return;
|
|
277
|
+
const button = event.currentTarget;
|
|
278
|
+
popNewPropertyMenu(popupTargetFromElement(button), this.view, {
|
|
279
|
+
title: this.wording(DATA_VIEW_PROPERTY_TYPE),
|
|
280
|
+
onAdd: id => {
|
|
281
|
+
this.updateComplete
|
|
282
|
+
.then(() => {
|
|
283
|
+
const row = this.querySelector(`.property-item[data-property-id="${CSS.escape(id)}"]`);
|
|
284
|
+
row?.scrollIntoView({ block: 'nearest' });
|
|
285
|
+
this._openMenu(this.view.propertyGetOrCreate(id), row ?? button);
|
|
286
|
+
})
|
|
287
|
+
.catch(console.error);
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
};
|
|
206
291
|
this.renderProperty = (property) => {
|
|
207
292
|
const icon = property.hide$.value ? InvisibleIcon() : ViewIcon();
|
|
208
|
-
|
|
293
|
+
// The eye and the drag bar keep their own gesture: the row's click is
|
|
294
|
+
// the property's menu, so they stop it.
|
|
295
|
+
const changeVisible = (event) => {
|
|
296
|
+
event.stopPropagation();
|
|
209
297
|
if (property.hideCanSet) {
|
|
210
298
|
property.hideSet(!property.hide$.value);
|
|
211
299
|
}
|
|
@@ -218,11 +306,23 @@ let DataViewPropertiesSettingView = (() => {
|
|
|
218
306
|
${dragHandler(property.id)}
|
|
219
307
|
${sortable(property.id)}
|
|
220
308
|
class="property-item"
|
|
309
|
+
data-testid="data-view-property-item"
|
|
310
|
+
data-property-id="${property.id}"
|
|
311
|
+
@click="${(event) => this._openMenu(property, event.currentTarget)}"
|
|
221
312
|
>
|
|
222
|
-
<div
|
|
313
|
+
<div
|
|
314
|
+
class="property-item-drag-bar"
|
|
315
|
+
@click="${(event) => event.stopPropagation()}"
|
|
316
|
+
></div>
|
|
223
317
|
<uni-lit class="property-item-icon" .uni="${property.icon}"></uni-lit>
|
|
224
318
|
<div class="property-item-name">${property.name$.value}</div>
|
|
225
|
-
<div
|
|
319
|
+
<div
|
|
320
|
+
class="${classList}"
|
|
321
|
+
data-testid="data-view-property-visibility"
|
|
322
|
+
@click="${changeVisible}"
|
|
323
|
+
>
|
|
324
|
+
${icon}
|
|
325
|
+
</div>
|
|
226
326
|
</div>`;
|
|
227
327
|
};
|
|
228
328
|
this.sortContext = createSortContext({
|
|
@@ -259,7 +359,8 @@ let DataViewPropertiesSettingView = (() => {
|
|
|
259
359
|
});
|
|
260
360
|
this.#groupContainer_accessor_storage = __runInitializers(this, _groupContainer_initializers, void 0);
|
|
261
361
|
this.#onBack_accessor_storage = (__runInitializers(this, _groupContainer_extraInitializers), __runInitializers(this, _onBack_initializers, undefined));
|
|
262
|
-
__runInitializers(this, _onBack_extraInitializers);
|
|
362
|
+
this.#wording_accessor_storage = (__runInitializers(this, _onBack_extraInitializers), __runInitializers(this, _wording_initializers, englishWording));
|
|
363
|
+
__runInitializers(this, _wording_extraInitializers);
|
|
263
364
|
}
|
|
264
365
|
};
|
|
265
366
|
})();
|
|
@@ -268,7 +369,7 @@ export const popPropertiesSetting = (target, props) => {
|
|
|
268
369
|
popMenu(target, {
|
|
269
370
|
options: {
|
|
270
371
|
title: {
|
|
271
|
-
text:
|
|
372
|
+
text: (props.wording ?? englishWording)(DATA_VIEW_PROPERTIES),
|
|
272
373
|
onBack: props.onBack,
|
|
273
374
|
postfix: () => {
|
|
274
375
|
const items = props.view.propertiesRaw$.value;
|
|
@@ -293,6 +394,7 @@ export const popPropertiesSetting = (target, props) => {
|
|
|
293
394
|
items: [
|
|
294
395
|
() => html ` <data-view-properties-setting
|
|
295
396
|
.view="${props.view}"
|
|
397
|
+
.wording="${props.wording ?? englishWording}"
|
|
296
398
|
></data-view-properties-setting>`,
|
|
297
399
|
],
|
|
298
400
|
}),
|
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
import { type MenuConfig, type PopupTarget } from '../../../affine-components/context-menu/index.js';
|
|
2
|
+
import { type Wording } from '../utils/wording.js';
|
|
1
3
|
import type { Property } from '../view-manager/property.js';
|
|
4
|
+
import type { SingleView } from '../view-manager/single-view.js';
|
|
2
5
|
export declare const inputConfig: (property: Property) => (menu: import("../../../affine-components/context-menu/menu.js").Menu) => import("lit-html").TemplateResult<1> | undefined;
|
|
3
|
-
export declare const typeConfig: (property: Property) => (menu: import("../../../affine-components/context-menu/menu.js").Menu, index: number) => import("lit-html").TemplateResult | undefined;
|
|
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
|
+
/** What a property menu's opener adds around the shared entries. */
|
|
8
|
+
export type PropertyMenuSlots = {
|
|
9
|
+
/** Right after the type (the table's "Number Format"). */
|
|
10
|
+
afterType?: MenuConfig[];
|
|
11
|
+
/** Between "Hide In View" and the duplicate/delete group. */
|
|
12
|
+
beforeOperations?: MenuConfig[];
|
|
13
|
+
/** The opener's words (`wordingOf(std)`); English without it. */
|
|
14
|
+
wording?: Wording;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The edit menu of one property: the very menu the table's column header
|
|
18
|
+
* opens, rename and type first, duplicate and delete last. Every opener
|
|
19
|
+
* reads it from here (the table header with its own filter, sort, insert
|
|
20
|
+
* and move entries in `slots`; the properties list of every view as is), so
|
|
21
|
+
* the title keeps the header's rules wherever it is edited: no type change,
|
|
22
|
+
* no hide, no delete, because `typeCanSet`, `hideCanSet` and `canDelete` say
|
|
23
|
+
* so. Rename, type, duplicate and delete write the data source, every view
|
|
24
|
+
* at once; "Hide In View" writes this view only.
|
|
25
|
+
*
|
|
26
|
+
* The caller checks `readonly$` before opening it, as the header does.
|
|
27
|
+
*
|
|
28
|
+
* ponytail: "Number Format" stays a table slot (its bar is a table/pc
|
|
29
|
+
* element, behind `enable_number_formatting`, off in Labre), so the
|
|
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 and mobile table headers still
|
|
32
|
+
* spell their own copy of these entries; point them here in a dedicated pass.
|
|
33
|
+
*/
|
|
34
|
+
export declare const propertyMenuItems: (property: Property, slots?: PropertyMenuSlots) => MenuConfig[];
|
|
35
|
+
export declare const popPropertyMenu: (target: PopupTarget, property: Property, slots?: PropertyMenuSlots) => import("../../../affine-components/context-menu/menu-renderer.js").MenuHandler;
|
|
36
|
+
/**
|
|
37
|
+
* The type picker of a new property, as the virtual table header's "+" and
|
|
38
|
+
* the record detail's "Add property" draw it: one entry per type the source
|
|
39
|
+
* offers, named after the type. The property is added at the end of the
|
|
40
|
+
* source (every view), under the type's own name, and `onAdd` gets its id
|
|
41
|
+
* so the opener can open its menu for the rename.
|
|
42
|
+
*/
|
|
43
|
+
export declare const popNewPropertyMenu: (target: PopupTarget, view: SingleView, options: {
|
|
44
|
+
title: string;
|
|
45
|
+
onAdd: (id: string) => void;
|
|
46
|
+
}) => import("../../../affine-components/context-menu/menu-renderer.js").MenuHandler;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { menu } from '../../../affine-components/context-menu/index.js';
|
|
1
|
+
import { menu, popMenu, } from '../../../affine-components/context-menu/index.js';
|
|
2
|
+
import { TOOLBAR_DELETE, TOOLBAR_DUPLICATE, } from '../../../affine-shared/services/index.js';
|
|
3
|
+
import { DeleteIcon, DuplicateIcon, ViewIcon } from '@blocksuite/icons/lit';
|
|
2
4
|
import { html } from 'lit/static-html.js';
|
|
5
|
+
import { DATA_VIEW_PROPERTY_HIDE_IN_VIEW, DATA_VIEW_PROPERTY_TYPE, } from '../../translations.js';
|
|
3
6
|
import { renderUniLit } from '../utils/uni-component/index.js';
|
|
7
|
+
import { englishWording } from '../utils/wording.js';
|
|
4
8
|
export const inputConfig = (property) => {
|
|
5
9
|
return menu.input({
|
|
6
10
|
prefix: html `
|
|
@@ -17,7 +21,7 @@ export const inputConfig = (property) => {
|
|
|
17
21
|
},
|
|
18
22
|
});
|
|
19
23
|
};
|
|
20
|
-
export const typeConfig = (property) => {
|
|
24
|
+
export const typeConfig = (property, wording = englishWording) => {
|
|
21
25
|
return menu.group({
|
|
22
26
|
items: [
|
|
23
27
|
menu.subMenu({
|
|
@@ -32,7 +36,7 @@ export const typeConfig = (property) => {
|
|
|
32
36
|
</div>`,
|
|
33
37
|
options: {
|
|
34
38
|
title: {
|
|
35
|
-
text:
|
|
39
|
+
text: wording(DATA_VIEW_PROPERTY_TYPE),
|
|
36
40
|
},
|
|
37
41
|
items: [
|
|
38
42
|
menu.group({
|
|
@@ -56,3 +60,96 @@ export const typeConfig = (property) => {
|
|
|
56
60
|
],
|
|
57
61
|
});
|
|
58
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* The edit menu of one property: the very menu the table's column header
|
|
65
|
+
* opens, rename and type first, duplicate and delete last. Every opener
|
|
66
|
+
* reads it from here (the table header with its own filter, sort, insert
|
|
67
|
+
* and move entries in `slots`; the properties list of every view as is), so
|
|
68
|
+
* the title keeps the header's rules wherever it is edited: no type change,
|
|
69
|
+
* no hide, no delete, because `typeCanSet`, `hideCanSet` and `canDelete` say
|
|
70
|
+
* so. Rename, type, duplicate and delete write the data source, every view
|
|
71
|
+
* at once; "Hide In View" writes this view only.
|
|
72
|
+
*
|
|
73
|
+
* The caller checks `readonly$` before opening it, as the header does.
|
|
74
|
+
*
|
|
75
|
+
* ponytail: "Number Format" stays a table slot (its bar is a table/pc
|
|
76
|
+
* element, behind `enable_number_formatting`, off in Labre), so the
|
|
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 and mobile table headers still
|
|
79
|
+
* spell their own copy of these entries; point them here in a dedicated pass.
|
|
80
|
+
*/
|
|
81
|
+
export const propertyMenuItems = (property, slots = {}) => {
|
|
82
|
+
const wording = slots.wording ?? englishWording;
|
|
83
|
+
return [
|
|
84
|
+
inputConfig(property),
|
|
85
|
+
typeConfig(property, wording),
|
|
86
|
+
...(slots.afterType ?? []),
|
|
87
|
+
menu.group({
|
|
88
|
+
items: [
|
|
89
|
+
menu.action({
|
|
90
|
+
name: wording(DATA_VIEW_PROPERTY_HIDE_IN_VIEW),
|
|
91
|
+
prefix: ViewIcon(),
|
|
92
|
+
hide: () => !property.hideCanSet,
|
|
93
|
+
select: () => {
|
|
94
|
+
property.hideSet(true);
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
],
|
|
98
|
+
}),
|
|
99
|
+
...(slots.beforeOperations ?? []),
|
|
100
|
+
menu.group({
|
|
101
|
+
items: [
|
|
102
|
+
menu.action({
|
|
103
|
+
name: wording(TOOLBAR_DUPLICATE),
|
|
104
|
+
prefix: DuplicateIcon(),
|
|
105
|
+
hide: () => !property.canDuplicate,
|
|
106
|
+
select: () => {
|
|
107
|
+
property.duplicate?.();
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
menu.action({
|
|
111
|
+
name: wording(TOOLBAR_DELETE),
|
|
112
|
+
prefix: DeleteIcon(),
|
|
113
|
+
hide: () => !property.canDelete,
|
|
114
|
+
select: () => {
|
|
115
|
+
property.delete?.();
|
|
116
|
+
},
|
|
117
|
+
class: {
|
|
118
|
+
'delete-item': true,
|
|
119
|
+
},
|
|
120
|
+
}),
|
|
121
|
+
],
|
|
122
|
+
}),
|
|
123
|
+
];
|
|
124
|
+
};
|
|
125
|
+
export const popPropertyMenu = (target, property, slots) => popMenu(target, {
|
|
126
|
+
options: { items: propertyMenuItems(property, slots) },
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* The type picker of a new property, as the virtual table header's "+" and
|
|
130
|
+
* the record detail's "Add property" draw it: one entry per type the source
|
|
131
|
+
* offers, named after the type. The property is added at the end of the
|
|
132
|
+
* source (every view), under the type's own name, and `onAdd` gets its id
|
|
133
|
+
* so the opener can open its menu for the rename.
|
|
134
|
+
*/
|
|
135
|
+
export const popNewPropertyMenu = (target, view, options) => popMenu(target, {
|
|
136
|
+
options: {
|
|
137
|
+
title: { text: options.title },
|
|
138
|
+
items: [
|
|
139
|
+
menu.group({
|
|
140
|
+
items: view.propertyMetas$.value.map(meta => menu.action({
|
|
141
|
+
name: meta.config.name,
|
|
142
|
+
prefix: renderUniLit(meta.renderer.icon),
|
|
143
|
+
select: () => {
|
|
144
|
+
const id = view.propertyAdd('end', {
|
|
145
|
+
type: meta.type,
|
|
146
|
+
name: meta.config.name,
|
|
147
|
+
});
|
|
148
|
+
if (id)
|
|
149
|
+
options.onAdd(id);
|
|
150
|
+
},
|
|
151
|
+
})),
|
|
152
|
+
}),
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type PaletteCarouselDirection, type PaletteGroup } from '../../../../affine-components/color-picker/index.js';
|
|
2
|
+
import type { BlockStdScope } from '../../../../std/index.js';
|
|
3
|
+
import { LitElement, nothing } from 'lit';
|
|
4
|
+
/**
|
|
5
|
+
* The database colour grid when it has more than one page (ADR 0036
|
|
6
|
+
* amendment of 2026-10-14, "framework pages"): the canvas carousel's own
|
|
7
|
+
* header, list and page (`renderPaletteCarousel`, `paletteCarouselPage`,
|
|
8
|
+
* ADR 0027) above the same `<edgeless-color-panel>` a single page shows.
|
|
9
|
+
*
|
|
10
|
+
* An element, not a render helper as on the canvas: a menu entry is a
|
|
11
|
+
* function the menu calls again on every render, so the page on screen and
|
|
12
|
+
* the open list need a home that outlives one call. Nothing here is
|
|
13
|
+
* persisted; a pick bubbles as the panel's own `select` event.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DataViewColorCarousel extends LitElement {
|
|
16
|
+
static styles: import("lit").CSSResult[];
|
|
17
|
+
/** The page on screen: the one the user paged to, else the current colour's. */
|
|
18
|
+
get pageIndex(): number;
|
|
19
|
+
private _refocusHeader;
|
|
20
|
+
private readonly _page;
|
|
21
|
+
/**
|
|
22
|
+
* Closing the list removes the button that had the focus; the keyboard
|
|
23
|
+
* path goes on from the header, one Tab away from the new page's grid.
|
|
24
|
+
*/
|
|
25
|
+
private readonly _toggle;
|
|
26
|
+
updated(): void;
|
|
27
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
28
|
+
accessor current: string | null;
|
|
29
|
+
accessor direction: PaletteCarouselDirection;
|
|
30
|
+
/** The pages, the ten chip colours first (`selectOptionColorPages`). */
|
|
31
|
+
accessor groups: readonly PaletteGroup[];
|
|
32
|
+
accessor listOpen: boolean;
|
|
33
|
+
accessor pickedIndex: number | undefined;
|
|
34
|
+
/** Only for the header's own wording ("Choose a palette"). */
|
|
35
|
+
accessor std: BlockStdScope | undefined;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
'dv-color-carousel': DataViewColorCarousel;
|
|
40
|
+
}
|
|
41
|
+
}
|