@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
|
@@ -34,21 +34,23 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
};
|
|
35
35
|
import { menu, popMenu, popupTargetFromElement, } from '../../../../../affine-components/context-menu/index.js';
|
|
36
36
|
import { SignalWatcher, WithDisposable } from '../../../../../global/lit/index.js';
|
|
37
|
-
import {
|
|
38
|
-
import { ShadowlessElement } from '../../../../../std/index.js';
|
|
37
|
+
import { FilterIcon, InsertLeftIcon, InsertRightIcon, MoveLeftIcon, MoveRightIcon, SortIcon, } from '@blocksuite/icons/lit';
|
|
38
|
+
import { ShadowlessElement, stdContext } from '../../../../../std/index.js';
|
|
39
|
+
import { consume } from '@lit/context';
|
|
39
40
|
import { css } from 'lit';
|
|
40
41
|
import { property } from 'lit/decorators.js';
|
|
41
42
|
import { classMap } from 'lit/directives/class-map.js';
|
|
42
43
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
43
44
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
44
45
|
import { html } from 'lit/static-html.js';
|
|
45
|
-
import {
|
|
46
|
+
import { popPropertyMenu } from '../../../../core/common/property-menu.js';
|
|
46
47
|
import { filterTraitKey } from '../../../../core/filter/trait.js';
|
|
47
48
|
import { firstFilterByRef } from '../../../../core/filter/utils.js';
|
|
48
49
|
import { renderUniLit } from '../../../../core/index.js';
|
|
49
50
|
import { sortTraitKey } from '../../../../core/sort/manager.js';
|
|
50
51
|
import { createSortUtils } from '../../../../core/sort/utils.js';
|
|
51
52
|
import { draggable, dragHandler, droppable, } from '../../../../core/utils/wc-dnd/dnd-context.js';
|
|
53
|
+
import { wordingOf } from '../../../../core/utils/wording.js';
|
|
52
54
|
import { numberFormats } from '../../../../property-presets/number/utils/formats.js';
|
|
53
55
|
import { createDefaultShowQuickSettingBar, ShowQuickSettingBarKey, } from '../../../../widget-presets/quick-setting-bar/context.js';
|
|
54
56
|
import { DEFAULT_COLUMN_TITLE_HEIGHT } from '../../consts.js';
|
|
@@ -58,6 +60,9 @@ let DatabaseHeaderColumn = (() => {
|
|
|
58
60
|
let _column_decorators;
|
|
59
61
|
let _column_initializers = [];
|
|
60
62
|
let _column_extraInitializers = [];
|
|
63
|
+
let _std_decorators;
|
|
64
|
+
let _std_initializers = [];
|
|
65
|
+
let _std_extraInitializers = [];
|
|
61
66
|
let _grabStatus_decorators;
|
|
62
67
|
let _grabStatus_initializers = [];
|
|
63
68
|
let _grabStatus_extraInitializers = [];
|
|
@@ -68,9 +73,11 @@ let DatabaseHeaderColumn = (() => {
|
|
|
68
73
|
static {
|
|
69
74
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
70
75
|
_column_decorators = [property({ attribute: false })];
|
|
76
|
+
_std_decorators = [consume({ context: stdContext })];
|
|
71
77
|
_grabStatus_decorators = [property({ attribute: false })];
|
|
72
78
|
_tableViewLogic_decorators = [property({ attribute: false })];
|
|
73
79
|
__esDecorate(this, null, _column_decorators, { kind: "accessor", name: "column", static: false, private: false, access: { has: obj => "column" in obj, get: obj => obj.column, set: (obj, value) => { obj.column = value; } }, metadata: _metadata }, _column_initializers, _column_extraInitializers);
|
|
80
|
+
__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);
|
|
74
81
|
__esDecorate(this, null, _grabStatus_decorators, { kind: "accessor", name: "grabStatus", static: false, private: false, access: { has: obj => "grabStatus" in obj, get: obj => obj.grabStatus, set: (obj, value) => { obj.grabStatus = value; } }, metadata: _metadata }, _grabStatus_initializers, _grabStatus_extraInitializers);
|
|
75
82
|
__esDecorate(this, null, _tableViewLogic_decorators, { kind: "accessor", name: "tableViewLogic", static: false, private: false, access: { has: obj => "tableViewLogic" in obj, get: obj => obj.tableViewLogic, set: (obj, value) => { obj.tableViewLogic = value; } }, metadata: _metadata }, _tableViewLogic_initializers, _tableViewLogic_extraInitializers);
|
|
76
83
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -132,179 +139,141 @@ let DatabaseHeaderColumn = (() => {
|
|
|
132
139
|
}
|
|
133
140
|
popMenu(ele) {
|
|
134
141
|
const enableNumberFormatting = this.tableViewManager.featureFlags$.value.enable_number_formatting;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.column
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
select: () => {
|
|
211
|
-
this.tableViewManager.propertyAdd({
|
|
212
|
-
id: this.column.id,
|
|
213
|
-
before: true,
|
|
214
|
-
});
|
|
215
|
-
Promise.resolve()
|
|
216
|
-
.then(() => {
|
|
217
|
-
const pre = this.previousElementSibling?.previousElementSibling;
|
|
218
|
-
if (pre instanceof DatabaseHeaderColumn) {
|
|
219
|
-
pre.editTitle();
|
|
220
|
-
pre.scrollIntoView({
|
|
221
|
-
inline: 'nearest',
|
|
222
|
-
block: 'nearest',
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
})
|
|
226
|
-
.catch(console.error);
|
|
227
|
-
},
|
|
228
|
-
}),
|
|
229
|
-
menu.action({
|
|
230
|
-
name: 'Insert Right Column',
|
|
231
|
-
prefix: InsertRightIcon(),
|
|
232
|
-
select: () => {
|
|
233
|
-
this.tableViewManager.propertyAdd({
|
|
234
|
-
id: this.column.id,
|
|
235
|
-
before: false,
|
|
236
|
-
});
|
|
237
|
-
Promise.resolve()
|
|
238
|
-
.then(() => {
|
|
239
|
-
const next = this.nextElementSibling?.nextElementSibling;
|
|
240
|
-
if (next instanceof DatabaseHeaderColumn) {
|
|
241
|
-
next.editTitle();
|
|
242
|
-
next.scrollIntoView({
|
|
243
|
-
inline: 'nearest',
|
|
244
|
-
block: 'nearest',
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
})
|
|
248
|
-
.catch(console.error);
|
|
249
|
-
},
|
|
250
|
-
}),
|
|
251
|
-
menu.action({
|
|
252
|
-
name: 'Move Left',
|
|
253
|
-
prefix: MoveLeftIcon(),
|
|
254
|
-
hide: () => this.column.isFirst$.value,
|
|
255
|
-
select: () => {
|
|
256
|
-
const prev = this.column.prev$.value;
|
|
257
|
-
if (!prev) {
|
|
258
|
-
return;
|
|
142
|
+
popPropertyMenu(popupTargetFromElement(ele ?? this), this.column, {
|
|
143
|
+
wording: wordingOf(this.std),
|
|
144
|
+
afterType: [
|
|
145
|
+
...(enableNumberFormatting
|
|
146
|
+
? [
|
|
147
|
+
menu.subMenu({
|
|
148
|
+
name: 'Number Format',
|
|
149
|
+
hide: () => !this.column.dataUpdate ||
|
|
150
|
+
this.column.type$.value !== 'number',
|
|
151
|
+
options: {
|
|
152
|
+
items: [
|
|
153
|
+
numberFormatConfig(this.column),
|
|
154
|
+
...numberFormats.map(format => {
|
|
155
|
+
const data = this.column.data$.value;
|
|
156
|
+
return menu.action({
|
|
157
|
+
isSelected: data.format === format.type,
|
|
158
|
+
prefix: html `<span
|
|
159
|
+
style="font-size: var(--affine-font-base); scale: 1.2;"
|
|
160
|
+
>${format.symbol}</span
|
|
161
|
+
>`,
|
|
162
|
+
name: format.label,
|
|
163
|
+
select: () => {
|
|
164
|
+
if (data.format === format.type)
|
|
165
|
+
return;
|
|
166
|
+
this.column.dataUpdate(() => ({
|
|
167
|
+
format: format.type,
|
|
168
|
+
}));
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
}),
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
]
|
|
176
|
+
: []),
|
|
177
|
+
],
|
|
178
|
+
beforeOperations: [
|
|
179
|
+
menu.group({
|
|
180
|
+
items: [
|
|
181
|
+
menu.action({
|
|
182
|
+
name: 'Filter',
|
|
183
|
+
prefix: FilterIcon(),
|
|
184
|
+
select: () => this._addFilter(),
|
|
185
|
+
}),
|
|
186
|
+
menu.action({
|
|
187
|
+
name: 'Sort Ascending',
|
|
188
|
+
prefix: SortIcon(),
|
|
189
|
+
select: () => this._addSort(false),
|
|
190
|
+
}),
|
|
191
|
+
menu.action({
|
|
192
|
+
name: 'Sort Descending',
|
|
193
|
+
prefix: SortIcon(),
|
|
194
|
+
select: () => this._addSort(true),
|
|
195
|
+
}),
|
|
196
|
+
],
|
|
197
|
+
}),
|
|
198
|
+
menu.group({
|
|
199
|
+
items: [
|
|
200
|
+
menu.action({
|
|
201
|
+
name: 'Insert Left Column',
|
|
202
|
+
prefix: InsertLeftIcon(),
|
|
203
|
+
select: () => {
|
|
204
|
+
this.tableViewManager.propertyAdd({
|
|
205
|
+
id: this.column.id,
|
|
206
|
+
before: true,
|
|
207
|
+
});
|
|
208
|
+
Promise.resolve()
|
|
209
|
+
.then(() => {
|
|
210
|
+
const pre = this.previousElementSibling?.previousElementSibling;
|
|
211
|
+
if (pre instanceof DatabaseHeaderColumn) {
|
|
212
|
+
pre.editTitle();
|
|
213
|
+
pre.scrollIntoView({
|
|
214
|
+
inline: 'nearest',
|
|
215
|
+
block: 'nearest',
|
|
216
|
+
});
|
|
259
217
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
218
|
+
})
|
|
219
|
+
.catch(console.error);
|
|
220
|
+
},
|
|
221
|
+
}),
|
|
222
|
+
menu.action({
|
|
223
|
+
name: 'Insert Right Column',
|
|
224
|
+
prefix: InsertRightIcon(),
|
|
225
|
+
select: () => {
|
|
226
|
+
this.tableViewManager.propertyAdd({
|
|
227
|
+
id: this.column.id,
|
|
228
|
+
before: false,
|
|
229
|
+
});
|
|
230
|
+
Promise.resolve()
|
|
231
|
+
.then(() => {
|
|
232
|
+
const next = this.nextElementSibling?.nextElementSibling;
|
|
233
|
+
if (next instanceof DatabaseHeaderColumn) {
|
|
234
|
+
next.editTitle();
|
|
235
|
+
next.scrollIntoView({
|
|
236
|
+
inline: 'nearest',
|
|
237
|
+
block: 'nearest',
|
|
238
|
+
});
|
|
274
239
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
240
|
+
})
|
|
241
|
+
.catch(console.error);
|
|
242
|
+
},
|
|
243
|
+
}),
|
|
244
|
+
menu.action({
|
|
245
|
+
name: 'Move Left',
|
|
246
|
+
prefix: MoveLeftIcon(),
|
|
247
|
+
hide: () => this.column.isFirst$.value,
|
|
248
|
+
select: () => {
|
|
249
|
+
const prev = this.column.prev$.value;
|
|
250
|
+
if (!prev) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this.column.move({
|
|
254
|
+
id: prev.id,
|
|
255
|
+
before: true,
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
}),
|
|
259
|
+
menu.action({
|
|
260
|
+
name: 'Move Right',
|
|
261
|
+
prefix: MoveRightIcon(),
|
|
262
|
+
hide: () => this.column.isLast$.value,
|
|
263
|
+
select: () => {
|
|
264
|
+
const next = this.column.next$.value;
|
|
265
|
+
if (!next) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
this.column.move({
|
|
269
|
+
id: next.id,
|
|
270
|
+
before: false,
|
|
271
|
+
});
|
|
272
|
+
},
|
|
273
|
+
}),
|
|
274
|
+
],
|
|
275
|
+
}),
|
|
276
|
+
],
|
|
308
277
|
});
|
|
309
278
|
}
|
|
310
279
|
widthDragStart(event) {
|
|
@@ -385,6 +354,10 @@ let DatabaseHeaderColumn = (() => {
|
|
|
385
354
|
#column_accessor_storage;
|
|
386
355
|
get column() { return this.#column_accessor_storage; }
|
|
387
356
|
set column(value) { this.#column_accessor_storage = value; }
|
|
357
|
+
#std_accessor_storage;
|
|
358
|
+
/** Absent outside an editor (a unit test): the menu reads English. */
|
|
359
|
+
get std() { return this.#std_accessor_storage; }
|
|
360
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
388
361
|
#grabStatus_accessor_storage;
|
|
389
362
|
get grabStatus() { return this.#grabStatus_accessor_storage; }
|
|
390
363
|
set grabStatus(value) { this.#grabStatus_accessor_storage = value; }
|
|
@@ -461,7 +434,8 @@ let DatabaseHeaderColumn = (() => {
|
|
|
461
434
|
this._clickColumn();
|
|
462
435
|
};
|
|
463
436
|
this.#column_accessor_storage = __runInitializers(this, _column_initializers, void 0);
|
|
464
|
-
this.#
|
|
437
|
+
this.#std_accessor_storage = (__runInitializers(this, _column_extraInitializers), __runInitializers(this, _std_initializers, void 0));
|
|
438
|
+
this.#grabStatus_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _grabStatus_initializers, 'grabEnd'));
|
|
465
439
|
this.#tableViewLogic_accessor_storage = (__runInitializers(this, _grabStatus_extraInitializers), __runInitializers(this, _tableViewLogic_initializers, void 0));
|
|
466
440
|
__runInitializers(this, _tableViewLogic_extraInitializers);
|
|
467
441
|
}
|
|
@@ -45,6 +45,7 @@ import { html } from 'lit/static-html.js';
|
|
|
45
45
|
import { TableViewRowSelection, } from '../../selection.js';
|
|
46
46
|
import { cellDivider } from '../../styles.js';
|
|
47
47
|
import { isNewTabClick } from '../../../../core/utils/new-tab-click.js';
|
|
48
|
+
import { paintRowColor, ROW_COLOR_PROPERTY, viewRowColor, } from '../../../../core/view/color-rules.js';
|
|
48
49
|
import { openDetail, popRowMenu } from '../menu.js';
|
|
49
50
|
let TableRowView = (() => {
|
|
50
51
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
@@ -69,6 +70,10 @@ let TableRowView = (() => {
|
|
|
69
70
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
70
71
|
}
|
|
71
72
|
static { this.styles = css `
|
|
73
|
+
/* A colour rule (ADR 0036) first, so the selection below still wins. */
|
|
74
|
+
.affine-database-block-row {
|
|
75
|
+
background-color: var(${unsafeCSS(ROW_COLOR_PROPERTY)}, transparent);
|
|
76
|
+
}
|
|
72
77
|
.affine-database-block-row:has(.row-select-checkbox.selected) {
|
|
73
78
|
background: var(--affine-primary-color-04);
|
|
74
79
|
}
|
|
@@ -180,6 +185,7 @@ let TableRowView = (() => {
|
|
|
180
185
|
}
|
|
181
186
|
render() {
|
|
182
187
|
const view = this.view;
|
|
188
|
+
paintRowColor(this, viewRowColor(view, this.rowId));
|
|
183
189
|
return html `
|
|
184
190
|
${view.readonly$.value
|
|
185
191
|
? nothing
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PopupTarget } from '../../../../../affine-components/context-menu/index.js';
|
|
2
|
+
import type { DataViewUILogicBase } from '../../../../core/index.js';
|
|
3
|
+
import type { Wording } from '../../../../core/utils/wording.js';
|
|
4
|
+
/** The list of a view's rules, in order, and "Add a color rule". */
|
|
5
|
+
export declare function popColorRules(target: PopupTarget, dataViewLogic: DataViewUILogicBase, reopen: () => void, wording: Wording): void;
|
|
6
|
+
/**
|
|
7
|
+
* One rule: its conditions (the view filter's editor), its colour (the
|
|
8
|
+
* options' palette), its place in the order, its removal. `back` is the
|
|
9
|
+
* rule list. A rule a peer removed meanwhile shows an empty condition and
|
|
10
|
+
* writes nothing (`colorRuleUpdate` finds no rule by that id).
|
|
11
|
+
*/
|
|
12
|
+
export declare function popColorRule(target: PopupTarget, dataViewLogic: DataViewUILogicBase, ruleId: string, back: () => void, wording: Wording): void;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { menu, popMenu, popupTargetFromElement, subMenuMiddleware, } from '../../../../../affine-components/context-menu/index.js';
|
|
2
|
+
import { TOOLBAR_DELETE } from '../../../../../affine-shared/services/index.js';
|
|
3
|
+
import { ArrowDownSmallIcon, ArrowRightSmallIcon, ArrowUpSmallIcon, DeleteIcon, PlusIcon, } from '@blocksuite/icons/lit';
|
|
4
|
+
import { computed } from '@preact/signals-core';
|
|
5
|
+
import { html } from 'lit';
|
|
6
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
7
|
+
import { selectOptionColorGrid } from '../../../../core/component/tags/color-menu.js';
|
|
8
|
+
import { selectOptionColors } from '../../../../core/component/tags/colors.js';
|
|
9
|
+
import { popCreateFilter } from '../../../../core/filter/add-filter.js';
|
|
10
|
+
import { emptyFilterGroup } from '../../../../core/filter/utils.js';
|
|
11
|
+
import { colorRuleAdd, colorRuleDelete, colorRuleMove, colorRulePaint, colorRuleUpdate, viewColorRules, } from '../../../../core/view/color-rules.js';
|
|
12
|
+
import { DATA_VIEW_COLOR_RULE, DATA_VIEW_COLOR_RULE_ADD_CONDITION, DATA_VIEW_COLOR_RULE_MOVE_DOWN, DATA_VIEW_COLOR_RULE_MOVE_UP, DATA_VIEW_COLOR_RULE_NO_CONDITION, DATA_VIEW_COLOR_RULES, DATA_VIEW_COLOR_RULES_ADD, } from '../../../../translations.js';
|
|
13
|
+
/**
|
|
14
|
+
* The editor of a view's conditional colours (ADR 0036, labre PRD
|
|
15
|
+
* REQ-DB-10): a view setting, opened from the view settings menu and from
|
|
16
|
+
* the full page's "This view" (`openViewSetting(…, 'color-rules')`). Made of
|
|
17
|
+
* what the view's filter and an option's colour already use, nothing drawn
|
|
18
|
+
* anew: the rule list is a menu, a rule's condition is edited by the view
|
|
19
|
+
* filter's own `<filter-root-view>` and `popCreateFilter`, its colour picked
|
|
20
|
+
* from the select options' swatch grid (`selectOptionColorGrid`).
|
|
21
|
+
*/
|
|
22
|
+
function swatch(color) {
|
|
23
|
+
const paint = colorRulePaint(color);
|
|
24
|
+
return html ` <div
|
|
25
|
+
style=${styleMap({
|
|
26
|
+
backgroundColor: paint ?? 'transparent',
|
|
27
|
+
border: paint ? 'none' : '1px dashed var(--affine-border-color)',
|
|
28
|
+
boxSizing: 'border-box',
|
|
29
|
+
borderRadius: '50%',
|
|
30
|
+
width: '20px',
|
|
31
|
+
height: '20px',
|
|
32
|
+
flexShrink: '0',
|
|
33
|
+
})}
|
|
34
|
+
></div>`;
|
|
35
|
+
}
|
|
36
|
+
/** The property names a rule reads, in the order its conditions name them. */
|
|
37
|
+
function ruleSummary(filter, vars, wording) {
|
|
38
|
+
const names = [];
|
|
39
|
+
const walk = (condition) => {
|
|
40
|
+
if (condition.type === 'group') {
|
|
41
|
+
condition.conditions.forEach(walk);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const name = vars.find(v => v.id === condition.left.name)?.name;
|
|
45
|
+
if (name && !names.includes(name))
|
|
46
|
+
names.push(name);
|
|
47
|
+
};
|
|
48
|
+
filter.conditions.forEach(walk);
|
|
49
|
+
return names.length
|
|
50
|
+
? names.join(', ')
|
|
51
|
+
: wording(DATA_VIEW_COLOR_RULE_NO_CONDITION);
|
|
52
|
+
}
|
|
53
|
+
function colorName(color, wording) {
|
|
54
|
+
const item = selectOptionColors.find(entry => entry.color === colorRulePaint(color));
|
|
55
|
+
if (!item)
|
|
56
|
+
return '';
|
|
57
|
+
return item.wording ? wording(item.wording) : item.name;
|
|
58
|
+
}
|
|
59
|
+
/** The list of a view's rules, in order, and "Add a color rule". */
|
|
60
|
+
export function popColorRules(target, dataViewLogic, reopen, wording) {
|
|
61
|
+
const view = dataViewLogic.view;
|
|
62
|
+
const rules = viewColorRules(view.manager.dataSource.viewDataGet(view.id));
|
|
63
|
+
const self = () => popColorRules(target, dataViewLogic, reopen, wording);
|
|
64
|
+
popMenu(target, {
|
|
65
|
+
options: {
|
|
66
|
+
title: { text: wording(DATA_VIEW_COLOR_RULES), onBack: reopen },
|
|
67
|
+
items: [
|
|
68
|
+
menu.group({
|
|
69
|
+
items: rules.map(rule => menu.action({
|
|
70
|
+
name: ruleSummary(rule.filter, view.vars$.value, wording),
|
|
71
|
+
prefix: swatch(rule.color),
|
|
72
|
+
postfix: html `<div style="font-size: 14px;">
|
|
73
|
+
${colorName(rule.color, wording)}
|
|
74
|
+
</div>
|
|
75
|
+
${ArrowRightSmallIcon()}`,
|
|
76
|
+
testId: 'dv-color-rule',
|
|
77
|
+
select: () => {
|
|
78
|
+
popColorRule(target, dataViewLogic, rule.id, self, wording);
|
|
79
|
+
},
|
|
80
|
+
})),
|
|
81
|
+
}),
|
|
82
|
+
menu.group({
|
|
83
|
+
items: [
|
|
84
|
+
menu.action({
|
|
85
|
+
name: wording(DATA_VIEW_COLOR_RULES_ADD),
|
|
86
|
+
prefix: PlusIcon(),
|
|
87
|
+
testId: 'dv-color-rule-add',
|
|
88
|
+
select: () => {
|
|
89
|
+
popCreateFilter(target, {
|
|
90
|
+
vars: view.vars$,
|
|
91
|
+
onBack: self,
|
|
92
|
+
onSelect: filter => {
|
|
93
|
+
const id = colorRuleAdd(view, filter);
|
|
94
|
+
if (id)
|
|
95
|
+
popColorRule(target, dataViewLogic, id, self, wording);
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
],
|
|
101
|
+
}),
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* One rule: its conditions (the view filter's editor), its colour (the
|
|
108
|
+
* options' palette), its place in the order, its removal. `back` is the
|
|
109
|
+
* rule list. A rule a peer removed meanwhile shows an empty condition and
|
|
110
|
+
* writes nothing (`colorRuleUpdate` finds no rule by that id).
|
|
111
|
+
*/
|
|
112
|
+
export function popColorRule(target, dataViewLogic, ruleId, back, wording) {
|
|
113
|
+
const view = dataViewLogic.view;
|
|
114
|
+
const dataSource = view.manager.dataSource;
|
|
115
|
+
const rule$ = computed(() => viewColorRules(dataSource.viewDataGet(view.id)).find(rule => rule.id === ruleId));
|
|
116
|
+
const filter$ = computed(() => rule$.value?.filter ?? emptyFilterGroup);
|
|
117
|
+
const setFilter = (filter) => {
|
|
118
|
+
colorRuleUpdate(view, ruleId, { filter });
|
|
119
|
+
};
|
|
120
|
+
const self = () => popColorRule(target, dataViewLogic, ruleId, back, wording);
|
|
121
|
+
const rules = viewColorRules(dataSource.viewDataGet(view.id));
|
|
122
|
+
const index = rules.findIndex(rule => rule.id === ruleId);
|
|
123
|
+
popMenu(target, {
|
|
124
|
+
options: {
|
|
125
|
+
title: { text: wording(DATA_VIEW_COLOR_RULE), onBack: back },
|
|
126
|
+
items: [
|
|
127
|
+
menu.group({
|
|
128
|
+
items: [
|
|
129
|
+
() => html `<filter-root-view
|
|
130
|
+
data-testid="dv-color-rule-conditions"
|
|
131
|
+
.onBack="${back}"
|
|
132
|
+
.vars="${view.vars$}"
|
|
133
|
+
.filterGroup="${filter$}"
|
|
134
|
+
.onChange="${setFilter}"
|
|
135
|
+
></filter-root-view>`,
|
|
136
|
+
],
|
|
137
|
+
}),
|
|
138
|
+
menu.group({
|
|
139
|
+
items: [
|
|
140
|
+
menu.action({
|
|
141
|
+
name: wording(DATA_VIEW_COLOR_RULE_ADD_CONDITION),
|
|
142
|
+
prefix: PlusIcon(),
|
|
143
|
+
select: ele => {
|
|
144
|
+
popCreateFilter(popupTargetFromElement(ele), {
|
|
145
|
+
vars: view.vars$,
|
|
146
|
+
onSelect: filter => {
|
|
147
|
+
const value = filter$.peek();
|
|
148
|
+
setFilter({
|
|
149
|
+
...value,
|
|
150
|
+
conditions: [...value.conditions, filter],
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
}, { middleware: subMenuMiddleware });
|
|
154
|
+
return false;
|
|
155
|
+
},
|
|
156
|
+
}),
|
|
157
|
+
],
|
|
158
|
+
}),
|
|
159
|
+
menu.group({
|
|
160
|
+
name: 'color',
|
|
161
|
+
items: selectOptionColorGrid({
|
|
162
|
+
current: colorRulePaint(rule$.peek()?.color ?? ''),
|
|
163
|
+
say: wording,
|
|
164
|
+
std: dataViewLogic.root.dataViewRenderer?.std,
|
|
165
|
+
select: color => {
|
|
166
|
+
colorRuleUpdate(view, ruleId, { color });
|
|
167
|
+
self();
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
}),
|
|
171
|
+
menu.group({
|
|
172
|
+
items: [
|
|
173
|
+
menu.action({
|
|
174
|
+
name: wording(DATA_VIEW_COLOR_RULE_MOVE_UP),
|
|
175
|
+
prefix: ArrowUpSmallIcon(),
|
|
176
|
+
hide: () => index <= 0,
|
|
177
|
+
select: () => {
|
|
178
|
+
colorRuleMove(view, ruleId, -1);
|
|
179
|
+
self();
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
menu.action({
|
|
183
|
+
name: wording(DATA_VIEW_COLOR_RULE_MOVE_DOWN),
|
|
184
|
+
prefix: ArrowDownSmallIcon(),
|
|
185
|
+
hide: () => index < 0 || index >= rules.length - 1,
|
|
186
|
+
select: () => {
|
|
187
|
+
colorRuleMove(view, ruleId, 1);
|
|
188
|
+
self();
|
|
189
|
+
},
|
|
190
|
+
}),
|
|
191
|
+
menu.action({
|
|
192
|
+
name: wording(TOOLBAR_DELETE),
|
|
193
|
+
prefix: DeleteIcon(),
|
|
194
|
+
class: { 'delete-item': true },
|
|
195
|
+
testId: 'dv-color-rule-delete',
|
|
196
|
+
select: () => {
|
|
197
|
+
colorRuleDelete(view, ruleId);
|
|
198
|
+
back();
|
|
199
|
+
},
|
|
200
|
+
}),
|
|
201
|
+
],
|
|
202
|
+
}),
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}
|