@formicoidea/labre-core 0.48.0 → 0.49.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/configs/slash-menu.js +3 -1
- package/dist/_pkgs/affine-block-data-view/view.d.ts +17 -1
- package/dist/_pkgs/affine-block-data-view/view.js +21 -2
- package/dist/_pkgs/affine-block-database/commands.d.ts +2 -2
- package/dist/_pkgs/affine-block-database/commands.js +3 -3
- package/dist/_pkgs/affine-block-database/components/values-banner.d.ts +28 -0
- package/dist/_pkgs/affine-block-database/components/values-banner.js +199 -0
- package/dist/_pkgs/affine-block-database/configs/slash-menu.d.ts +6 -1
- package/dist/_pkgs/affine-block-database/configs/slash-menu.js +57 -70
- package/dist/_pkgs/affine-block-database/data-source.d.ts +9 -5
- package/dist/_pkgs/affine-block-database/data-source.js +11 -7
- package/dist/_pkgs/affine-block-database/database-block-styles.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/database-block-styles.js +15 -0
- package/dist/_pkgs/affine-block-database/database-block.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/database-block.js +141 -19
- package/dist/_pkgs/affine-block-database/effects.js +2 -0
- package/dist/_pkgs/affine-block-database/external-data-source.d.ts +69 -2
- package/dist/_pkgs/affine-block-database/external-data-source.js +88 -16
- package/dist/_pkgs/affine-block-database/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/index.js +2 -0
- package/dist/_pkgs/affine-block-database/linked-view.d.ts +38 -0
- package/dist/_pkgs/affine-block-database/linked-view.js +109 -0
- package/dist/_pkgs/affine-block-database/properties/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/properties/index.js +2 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.d.ts +15 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.js +24 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.d.ts +16 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.js +42 -0
- package/dist/_pkgs/affine-block-database/service/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-database/service/index.js +3 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.d.ts +49 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.js +21 -0
- package/dist/_pkgs/affine-block-database/service/open-row.d.ts +77 -0
- package/dist/_pkgs/affine-block-database/service/open-row.js +62 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.js +33 -0
- package/dist/_pkgs/affine-block-database/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/translations.js +35 -0
- package/dist/_pkgs/affine-block-database/view-creation.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/view-creation.js +14 -0
- package/dist/_pkgs/affine-block-database/view.d.ts +31 -1
- package/dist/_pkgs/affine-block-database/view.js +44 -5
- package/dist/_pkgs/affine-block-database/views/index.d.ts +30 -3
- package/dist/_pkgs/affine-block-database/views/index.js +44 -3
- package/dist/_pkgs/affine-components/date-picker/date-picker.d.ts +20 -0
- package/dist/_pkgs/affine-components/date-picker/date-picker.js +60 -26
- package/dist/_pkgs/affine-components/date-picker/style.js +1 -0
- package/dist/_pkgs/affine-components/translations.d.ts +4 -0
- package/dist/_pkgs/affine-components/translations.js +26 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +18 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +41 -2
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.d.ts +8 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +12 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +5 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +44 -4
- package/dist/_pkgs/affine-model/blocks/database/types.d.ts +16 -0
- package/dist/_pkgs/affine-model/blocks/database/types.js +5 -1
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +139 -0
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.js +22 -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/telemetry-service/database.d.ts +59 -0
- package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +24 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +2 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +16 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +10 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +23 -0
- package/dist/_pkgs/data-view/core/component/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/component/index.js +1 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.d.ts +26 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.js +48 -0
- package/dist/_pkgs/data-view/core/component/overflow/overflow.d.ts +26 -3
- package/dist/_pkgs/data-view/core/component/overflow/overflow.js +84 -31
- package/dist/_pkgs/data-view/core/component/tags/colors.d.ts +7 -0
- package/dist/_pkgs/data-view/core/component/tags/colors.js +22 -10
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +18 -0
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +63 -21
- package/dist/_pkgs/data-view/core/data-source/base.d.ts +5 -1
- package/dist/_pkgs/data-view/core/data-source/base.js +7 -1
- package/dist/_pkgs/data-view/core/data-source/hydration.d.ts +44 -0
- package/dist/_pkgs/data-view/core/data-source/hydration.js +31 -0
- package/dist/_pkgs/data-view/core/data-source/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/data-source/index.js +1 -0
- package/dist/_pkgs/data-view/core/data-view.d.ts +22 -2
- package/dist/_pkgs/data-view/core/data-view.js +14 -0
- package/dist/_pkgs/data-view/core/effect.js +2 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.d.ts +3 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.js +59 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.d.ts +21 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.js +38 -0
- package/dist/_pkgs/data-view/core/group-by/group-title.js +4 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.d.ts +40 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.js +291 -0
- package/dist/_pkgs/data-view/core/group-by/setting.d.ts +11 -3
- package/dist/_pkgs/data-view/core/group-by/setting.js +81 -8
- package/dist/_pkgs/data-view/core/group-by/trait.d.ts +22 -0
- package/dist/_pkgs/data-view/core/group-by/trait.js +62 -1
- package/dist/_pkgs/data-view/core/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/index.js +3 -0
- package/dist/_pkgs/data-view/core/property/base-cell.d.ts +15 -1
- package/dist/_pkgs/data-view/core/property/base-cell.js +28 -3
- package/dist/_pkgs/data-view/core/property/standalone-cell.d.ts +15 -1
- package/dist/_pkgs/data-view/core/property/standalone-cell.js +19 -1
- package/dist/_pkgs/data-view/core/telemetry.d.ts +16 -0
- package/dist/_pkgs/data-view/core/telemetry.js +22 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.d.ts +2 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.js +4 -0
- package/dist/_pkgs/data-view/core/utils/wording.d.ts +11 -0
- package/dist/_pkgs/data-view/core/utils/wording.js +9 -0
- package/dist/_pkgs/data-view/core/view/data-view.d.ts +7 -0
- package/dist/_pkgs/data-view/core/view/default-name.d.ts +10 -0
- package/dist/_pkgs/data-view/core/view/default-name.js +14 -0
- package/dist/_pkgs/data-view/core/view/index.d.ts +2 -0
- package/dist/_pkgs/data-view/core/view/index.js +2 -0
- package/dist/_pkgs/data-view/core/view/open-in.d.ts +27 -0
- package/dist/_pkgs/data-view/core/view/open-in.js +39 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.d.ts +5 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.js +11 -0
- package/dist/_pkgs/data-view/core/view-manager/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/view-manager/index.js +3 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.d.ts +18 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.js +2 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.d.ts +8 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.js +9 -0
- package/dist/_pkgs/data-view/core/view-manager/property.d.ts +8 -0
- package/dist/_pkgs/data-view/core/view-manager/single-view.d.ts +28 -1
- package/dist/_pkgs/data-view/core/view-manager/single-view.js +45 -1
- package/dist/_pkgs/data-view/core/view-manager/view-creation.d.ts +49 -0
- package/dist/_pkgs/data-view/core/view-manager/view-creation.js +40 -0
- package/dist/_pkgs/data-view/core/view-manager/view-manager.d.ts +6 -2
- package/dist/_pkgs/data-view/core/view-manager/view-manager.js +2 -2
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.d.ts +2 -0
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.js +11 -2
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +2 -0
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +2 -0
- package/dist/_pkgs/data-view/translations.d.ts +55 -0
- package/dist/_pkgs/data-view/translations.js +181 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/convert.js +2 -0
- package/dist/_pkgs/data-view/view-presets/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.js +35 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.d.ts +79 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.js +194 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +56 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +266 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.d.ts +27 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +179 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/index.d.ts +5 -0
- package/dist/_pkgs/data-view/view-presets/index.js +7 -0
- package/dist/_pkgs/data-view/view-presets/kanban/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +5 -53
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +8 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +6 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.js +52 -6
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +2 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +4 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.js +51 -6
- package/dist/_pkgs/data-view/view-presets/kanban/pc/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/list/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/list/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/list/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/list/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.d.ts +24 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.js +194 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +3 -14
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +6 -30
- package/dist/_pkgs/data-view/view-presets/table/consts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/table/consts.js +2 -0
- package/dist/_pkgs/data-view/view-presets/table/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +10 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.d.ts +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +3 -2
- package/dist/_pkgs/data-view/view-presets/table/pc/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +22 -19
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/table-view-ui-logic.js +7 -2
- package/dist/_pkgs/data-view/view-presets/table/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +5 -53
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +1 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +60 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.d.ts +18 -1
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +121 -124
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +43 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +187 -0
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.d.ts +36 -3
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +187 -59
- package/dist/extensions/view.d.ts +2 -2
- package/dist/extensions/view.js +10 -3
- package/dist/flags.d.ts +8 -4
- package/dist/flags.js +8 -4
- package/dist/frameworks.d.ts +27 -0
- package/dist/frameworks.js +28 -0
- package/dist/translations.js +13 -1
- package/package.json +5 -1
|
@@ -38,6 +38,24 @@ import { css, html } from 'lit';
|
|
|
38
38
|
import { property, query, queryAll, state } from 'lit/decorators.js';
|
|
39
39
|
import { classMap } from 'lit/directives/class-map.js';
|
|
40
40
|
import { repeat } from 'lit/directives/repeat.js';
|
|
41
|
+
import { fitOverflow } from './fit.js';
|
|
42
|
+
/**
|
|
43
|
+
* Until the "N more" button has been drawn once, its width is guessed; the
|
|
44
|
+
* next layout pass measures it and settles.
|
|
45
|
+
*/
|
|
46
|
+
const MORE_EXTRA_GUESS = 72;
|
|
47
|
+
/**
|
|
48
|
+
* Marks the element of the trailing slot that only exists while something is
|
|
49
|
+
* hidden (the "N more" button): the rest of the slot is what stays.
|
|
50
|
+
*/
|
|
51
|
+
export const OVERFLOW_MORE_ATTR = 'data-overflow-more';
|
|
52
|
+
/**
|
|
53
|
+
* A row that draws as many items as its width allows and hands the rest to
|
|
54
|
+
* a trailing slot (`renderMore`). Every item stays in the DOM, a hidden one
|
|
55
|
+
* transparent and out of the flow, so its width is measured on each pass;
|
|
56
|
+
* which ones are drawn is `fitOverflow` (`./fit.ts`), `pinned` included.
|
|
57
|
+
* Until the first measure every item is drawn.
|
|
58
|
+
*/
|
|
41
59
|
let Overflow = (() => {
|
|
42
60
|
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
|
|
43
61
|
let _items_decorators;
|
|
@@ -46,9 +64,12 @@ let Overflow = (() => {
|
|
|
46
64
|
let _more_decorators;
|
|
47
65
|
let _more_initializers = [];
|
|
48
66
|
let _more_extraInitializers = [];
|
|
49
|
-
let
|
|
50
|
-
let
|
|
51
|
-
let
|
|
67
|
+
let _drawn_decorators;
|
|
68
|
+
let _drawn_initializers = [];
|
|
69
|
+
let _drawn_extraInitializers = [];
|
|
70
|
+
let _pinned_decorators;
|
|
71
|
+
let _pinned_initializers = [];
|
|
72
|
+
let _pinned_extraInitializers = [];
|
|
52
73
|
let _renderItem_decorators;
|
|
53
74
|
let _renderItem_initializers = [];
|
|
54
75
|
let _renderItem_extraInitializers = [];
|
|
@@ -60,12 +81,14 @@ let Overflow = (() => {
|
|
|
60
81
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
61
82
|
_items_decorators = [queryAll(':scope > .component-overflow-item')];
|
|
62
83
|
_more_decorators = [query(':scope > .component-overflow-more')];
|
|
63
|
-
|
|
84
|
+
_drawn_decorators = [state()];
|
|
85
|
+
_pinned_decorators = [property({ attribute: false })];
|
|
64
86
|
_renderItem_decorators = [property({ attribute: false })];
|
|
65
87
|
_renderMore_decorators = [property({ attribute: false })];
|
|
66
88
|
__esDecorate(this, null, _items_decorators, { kind: "accessor", name: "items", static: false, private: false, access: { has: obj => "items" in obj, get: obj => obj.items, set: (obj, value) => { obj.items = value; } }, metadata: _metadata }, _items_initializers, _items_extraInitializers);
|
|
67
89
|
__esDecorate(this, null, _more_decorators, { kind: "accessor", name: "more", static: false, private: false, access: { has: obj => "more" in obj, get: obj => obj.more, set: (obj, value) => { obj.more = value; } }, metadata: _metadata }, _more_initializers, _more_extraInitializers);
|
|
68
|
-
__esDecorate(this, null,
|
|
90
|
+
__esDecorate(this, null, _drawn_decorators, { kind: "accessor", name: "drawn", static: false, private: false, access: { has: obj => "drawn" in obj, get: obj => obj.drawn, set: (obj, value) => { obj.drawn = value; } }, metadata: _metadata }, _drawn_initializers, _drawn_extraInitializers);
|
|
91
|
+
__esDecorate(this, null, _pinned_decorators, { kind: "accessor", name: "pinned", static: false, private: false, access: { has: obj => "pinned" in obj, get: obj => obj.pinned, set: (obj, value) => { obj.pinned = value; } }, metadata: _metadata }, _pinned_initializers, _pinned_extraInitializers);
|
|
69
92
|
__esDecorate(this, null, _renderItem_decorators, { kind: "accessor", name: "renderItem", static: false, private: false, access: { has: obj => "renderItem" in obj, get: obj => obj.renderItem, set: (obj, value) => { obj.renderItem = value; } }, metadata: _metadata }, _renderItem_initializers, _renderItem_extraInitializers);
|
|
70
93
|
__esDecorate(this, null, _renderMore_decorators, { kind: "accessor", name: "renderMore", static: false, private: false, access: { has: obj => "renderMore" in obj, get: obj => obj.renderMore, set: (obj, value) => { obj.renderMore = value; } }, metadata: _metadata }, _renderMore_initializers, _renderMore_extraInitializers);
|
|
71
94
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -85,6 +108,9 @@ let Overflow = (() => {
|
|
|
85
108
|
pointer-events: none;
|
|
86
109
|
position: absolute;
|
|
87
110
|
}
|
|
111
|
+
.component-overflow-more {
|
|
112
|
+
display: flex;
|
|
113
|
+
}
|
|
88
114
|
`; }
|
|
89
115
|
adjustStyle() {
|
|
90
116
|
if (this.frameId) {
|
|
@@ -105,40 +131,56 @@ let Overflow = (() => {
|
|
|
105
131
|
});
|
|
106
132
|
}
|
|
107
133
|
doAdjustStyle() {
|
|
108
|
-
const
|
|
109
|
-
this.
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
const slotWidth = this.more.getBoundingClientRect().width;
|
|
135
|
+
const moreButton = this.more.querySelector(`[${OVERFLOW_MORE_ATTR}]`);
|
|
136
|
+
const moreWidth = moreButton?.getBoundingClientRect().width;
|
|
137
|
+
if (moreWidth !== undefined)
|
|
138
|
+
this.moreExtraWidth = moreWidth;
|
|
139
|
+
const widths = Array.from(this.items, item => item.getBoundingClientRect().width);
|
|
140
|
+
const drawn = fitOverflow({
|
|
141
|
+
widths,
|
|
142
|
+
container: this.getBoundingClientRect().width,
|
|
143
|
+
trailing: slotWidth - (moreWidth ?? 0),
|
|
144
|
+
moreExtra: this.moreExtraWidth ?? MORE_EXTRA_GUESS,
|
|
145
|
+
pinned: this.pinned,
|
|
146
|
+
});
|
|
147
|
+
// Assigned only on a change: an equal array is a new identity, and a
|
|
148
|
+
// state write would re-render, re-measure and loop.
|
|
149
|
+
if (drawn.join() !== this.drawn?.join()) {
|
|
150
|
+
this.drawn = drawn;
|
|
125
151
|
}
|
|
126
|
-
|
|
152
|
+
}
|
|
153
|
+
/** The items `renderMore` holds, in order. */
|
|
154
|
+
get hiddenIndices() {
|
|
155
|
+
if (!this.drawn)
|
|
156
|
+
return [];
|
|
157
|
+
const drawn = new Set(this.drawn);
|
|
158
|
+
return this.renderItem.flatMap((_, index) => drawn.has(index) ? [] : [index]);
|
|
127
159
|
}
|
|
128
160
|
render() {
|
|
161
|
+
const drawn = this.drawn ? new Set(this.drawn) : undefined;
|
|
162
|
+
const hidden = this.hiddenIndices;
|
|
129
163
|
return html `
|
|
130
164
|
${repeat(this.renderItem, (render, index) => {
|
|
131
165
|
const className = classMap({
|
|
132
166
|
'component-overflow-item': true,
|
|
133
|
-
hidden: index
|
|
167
|
+
hidden: drawn ? !drawn.has(index) : false,
|
|
134
168
|
});
|
|
135
169
|
return html `<div class="${className}">${render()}</div>`;
|
|
136
170
|
})}
|
|
137
171
|
<div class="component-overflow-more">
|
|
138
|
-
${this.renderMore(this.
|
|
172
|
+
${this.renderMore(this.renderItem.length - hidden.length, hidden)}
|
|
139
173
|
</div>
|
|
140
174
|
`;
|
|
141
175
|
}
|
|
176
|
+
willUpdate(changed) {
|
|
177
|
+
super.willUpdate(changed);
|
|
178
|
+
// Another set of items: the drawn indices no longer name the same ones.
|
|
179
|
+
if (changed.has('renderItem') &&
|
|
180
|
+
changed.get('renderItem')?.length !== this.renderItem.length) {
|
|
181
|
+
this.drawn = undefined;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
142
184
|
updated(_changedProperties) {
|
|
143
185
|
super.updated(_changedProperties);
|
|
144
186
|
this.adjustStyle();
|
|
@@ -149,23 +191,34 @@ let Overflow = (() => {
|
|
|
149
191
|
#more_accessor_storage;
|
|
150
192
|
get more() { return this.#more_accessor_storage; }
|
|
151
193
|
set more(value) { this.#more_accessor_storage = value; }
|
|
152
|
-
#
|
|
153
|
-
|
|
154
|
-
|
|
194
|
+
#drawn_accessor_storage;
|
|
195
|
+
/** The drawn items' indices, ascending; `undefined` (all) until measured. */
|
|
196
|
+
get drawn() { return this.#drawn_accessor_storage; }
|
|
197
|
+
set drawn(value) { this.#drawn_accessor_storage = value; }
|
|
198
|
+
#pinned_accessor_storage;
|
|
199
|
+
/** The item that is always drawn (the current view); `-1` for none. */
|
|
200
|
+
get pinned() { return this.#pinned_accessor_storage; }
|
|
201
|
+
set pinned(value) { this.#pinned_accessor_storage = value; }
|
|
155
202
|
#renderItem_accessor_storage;
|
|
156
203
|
get renderItem() { return this.#renderItem_accessor_storage; }
|
|
157
204
|
set renderItem(value) { this.#renderItem_accessor_storage = value; }
|
|
158
205
|
#renderMore_accessor_storage;
|
|
206
|
+
/**
|
|
207
|
+
* The trailing slot: `count` items are drawn and `hidden` are the indices
|
|
208
|
+
* it stands for, empty when everything fits.
|
|
209
|
+
*/
|
|
159
210
|
get renderMore() { return this.#renderMore_accessor_storage; }
|
|
160
211
|
set renderMore(value) { this.#renderMore_accessor_storage = value; }
|
|
161
212
|
constructor() {
|
|
162
213
|
super(...arguments);
|
|
163
214
|
this.frameId = undefined;
|
|
164
|
-
|
|
215
|
+
/** Last measured width of the slot's `OVERFLOW_MORE_ATTR` element. */
|
|
216
|
+
this.moreExtraWidth = undefined;
|
|
165
217
|
this.#items_accessor_storage = __runInitializers(this, _items_initializers, void 0);
|
|
166
218
|
this.#more_accessor_storage = (__runInitializers(this, _items_extraInitializers), __runInitializers(this, _more_initializers, void 0));
|
|
167
|
-
this.#
|
|
168
|
-
this.#
|
|
219
|
+
this.#drawn_accessor_storage = (__runInitializers(this, _more_extraInitializers), __runInitializers(this, _drawn_initializers, undefined));
|
|
220
|
+
this.#pinned_accessor_storage = (__runInitializers(this, _drawn_extraInitializers), __runInitializers(this, _pinned_initializers, -1));
|
|
221
|
+
this.#renderItem_accessor_storage = (__runInitializers(this, _pinned_extraInitializers), __runInitializers(this, _renderItem_initializers, void 0));
|
|
169
222
|
this.#renderMore_accessor_storage = (__runInitializers(this, _renderItem_extraInitializers), __runInitializers(this, _renderMore_initializers, void 0));
|
|
170
223
|
__runInitializers(this, _renderMore_extraInitializers);
|
|
171
224
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { type ChromeWording } from '../../../../affine-shared/services/index.js';
|
|
1
2
|
export type SelectOptionColor = {
|
|
2
3
|
oldColor: string;
|
|
3
4
|
color: string;
|
|
5
|
+
/** The English name, `wording`'s fallback. */
|
|
4
6
|
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* What the option menu shows, resolved where an editor is at hand;
|
|
9
|
+
* absent (a colour list a host built in 0.48), `name` is shown.
|
|
10
|
+
*/
|
|
11
|
+
wording?: ChromeWording;
|
|
5
12
|
};
|
|
6
13
|
export declare const selectOptionColors: SelectOptionColor[];
|
|
7
14
|
export declare const getColorByColor: (color: string) => string;
|
|
@@ -1,54 +1,66 @@
|
|
|
1
|
+
import { PALETTE_NAME_BLUE, PALETTE_NAME_GREEN, PALETTE_NAME_GREY, PALETTE_NAME_MAGENTA, PALETTE_NAME_ORANGE, PALETTE_NAME_PURPLE, PALETTE_NAME_RED, PALETTE_NAME_WHITE, PALETTE_NAME_YELLOW, } from '../../../../affine-shared/services/index.js';
|
|
1
2
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
3
|
+
import { TAG_COLOR_TEAL } from '../../../translations.js';
|
|
2
4
|
export const selectOptionColors = [
|
|
3
5
|
{
|
|
4
6
|
oldColor: 'var(--affine-tag-red)',
|
|
5
7
|
color: cssVarV2('chip/label/red'),
|
|
6
|
-
name:
|
|
8
|
+
name: PALETTE_NAME_RED[1],
|
|
9
|
+
wording: PALETTE_NAME_RED,
|
|
7
10
|
},
|
|
8
11
|
{
|
|
9
12
|
oldColor: 'var(--affine-tag-pink)',
|
|
10
13
|
color: cssVarV2('chip/label/magenta'),
|
|
11
|
-
name:
|
|
14
|
+
name: PALETTE_NAME_MAGENTA[1],
|
|
15
|
+
wording: PALETTE_NAME_MAGENTA,
|
|
12
16
|
},
|
|
13
17
|
{
|
|
14
18
|
oldColor: 'var(--affine-tag-orange)',
|
|
15
19
|
color: cssVarV2('chip/label/orange'),
|
|
16
|
-
name:
|
|
20
|
+
name: PALETTE_NAME_ORANGE[1],
|
|
21
|
+
wording: PALETTE_NAME_ORANGE,
|
|
17
22
|
},
|
|
18
23
|
{
|
|
19
24
|
oldColor: 'var(--affine-tag-yellow)',
|
|
20
25
|
color: cssVarV2('chip/label/yellow'),
|
|
21
|
-
name:
|
|
26
|
+
name: PALETTE_NAME_YELLOW[1],
|
|
27
|
+
wording: PALETTE_NAME_YELLOW,
|
|
22
28
|
},
|
|
23
29
|
{
|
|
24
30
|
oldColor: 'var(--affine-tag-green)',
|
|
25
31
|
color: cssVarV2('chip/label/green'),
|
|
26
|
-
name:
|
|
32
|
+
name: PALETTE_NAME_GREEN[1],
|
|
33
|
+
wording: PALETTE_NAME_GREEN,
|
|
27
34
|
},
|
|
28
35
|
{
|
|
29
36
|
oldColor: 'var(--affine-tag-teal)',
|
|
30
37
|
color: cssVarV2('chip/label/teal'),
|
|
31
|
-
name:
|
|
38
|
+
name: TAG_COLOR_TEAL[1],
|
|
39
|
+
wording: TAG_COLOR_TEAL,
|
|
32
40
|
},
|
|
33
41
|
{
|
|
34
42
|
oldColor: 'var(--affine-tag-blue)',
|
|
35
43
|
color: cssVarV2('chip/label/blue'),
|
|
36
|
-
name:
|
|
44
|
+
name: PALETTE_NAME_BLUE[1],
|
|
45
|
+
wording: PALETTE_NAME_BLUE,
|
|
37
46
|
},
|
|
38
47
|
{
|
|
39
48
|
oldColor: 'var(--affine-tag-purple)',
|
|
40
49
|
color: cssVarV2('chip/label/purple'),
|
|
41
|
-
name:
|
|
50
|
+
name: PALETTE_NAME_PURPLE[1],
|
|
51
|
+
wording: PALETTE_NAME_PURPLE,
|
|
42
52
|
},
|
|
43
53
|
{
|
|
44
54
|
oldColor: 'var(--affine-tag-gray)',
|
|
45
55
|
color: cssVarV2('chip/label/grey'),
|
|
46
|
-
name:
|
|
56
|
+
name: PALETTE_NAME_GREY[1],
|
|
57
|
+
wording: PALETTE_NAME_GREY,
|
|
47
58
|
},
|
|
48
59
|
{
|
|
49
60
|
oldColor: 'var(--affine-tag-white)',
|
|
50
61
|
color: cssVarV2('chip/label/white'),
|
|
51
|
-
name:
|
|
62
|
+
name: PALETTE_NAME_WHITE[1],
|
|
63
|
+
wording: PALETTE_NAME_WHITE,
|
|
52
64
|
},
|
|
53
65
|
];
|
|
54
66
|
const oldColorMap = Object.fromEntries(selectOptionColors.map(tag => [tag.oldColor, tag.color]));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type PopupTarget } from '../../../../affine-components/context-menu/index.js';
|
|
2
|
+
import { type ChromeWording } from '../../../../affine-shared/services/index.js';
|
|
2
3
|
import { ShadowlessElement } from '../../../../std/index.js';
|
|
3
4
|
import { type ReadonlySignal } from '@preact/signals-core';
|
|
4
5
|
import type { SelectTag } from '../../logical/index.js';
|
|
6
|
+
export type TagOptionEdits = 'all' | 'create-rename';
|
|
5
7
|
export type TagManagerOptions = {
|
|
6
8
|
mode?: 'single' | 'multi';
|
|
7
9
|
value: ReadonlySignal<string[]>;
|
|
@@ -13,8 +15,21 @@ export type TagManagerOptions = {
|
|
|
13
15
|
* cannot write the property's config, `standalone-cell.ts`).
|
|
14
16
|
*/
|
|
15
17
|
onOptionsChange?: (options: SelectTag[]) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Which edits `onOptionsChange` takes; absent, `'all'` (the table).
|
|
20
|
+
* `'create-rename'`: "Create" and the option menu's name only, no delete,
|
|
21
|
+
* no colour and no reordering: a host that writes an option's definition
|
|
22
|
+
* one edit at a time and offers no more (the title band, ADR 0035
|
|
23
|
+
* amendment of 2026-10-14).
|
|
24
|
+
*/
|
|
25
|
+
optionEdits?: TagOptionEdits;
|
|
16
26
|
onComplete?: () => void;
|
|
17
27
|
initialDraftText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the menu's own wordings; the caller holds the editor, the
|
|
30
|
+
* popup renders outside it. Absent, the English fallbacks.
|
|
31
|
+
*/
|
|
32
|
+
wording?: (wording: ChromeWording) => string;
|
|
18
33
|
};
|
|
19
34
|
export declare function consumeTagDraftFromTableCellHost(fromElement: Element): string | undefined;
|
|
20
35
|
declare const MultiTagSelect_base: typeof ShadowlessElement & import("../../../../global/utils/types.js").Constructor<import("../../../../global/lit/with-disposable.js").DisposableClass>;
|
|
@@ -38,10 +53,13 @@ export declare class MultiTagSelect extends MultiTagSelect_base {
|
|
|
38
53
|
accessor onChange: (value: string[]) => void;
|
|
39
54
|
accessor onComplete: () => void;
|
|
40
55
|
accessor onOptionsChange: ((options: SelectTag[]) => void) | undefined;
|
|
56
|
+
accessor optionEdits: TagOptionEdits;
|
|
41
57
|
accessor options: ReadonlySignal<SelectTag[]>;
|
|
42
58
|
private readonly selectedIndex$;
|
|
43
59
|
accessor value: ReadonlySignal<string[]>;
|
|
44
60
|
accessor initialDraftText: string | undefined;
|
|
61
|
+
accessor wording: ((wording: ChromeWording) => string) | undefined;
|
|
62
|
+
private say;
|
|
45
63
|
}
|
|
46
64
|
declare global {
|
|
47
65
|
interface HTMLElementTagNameMap {
|
|
@@ -33,6 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
35
|
import { createPopup, menu, popMenu, popupTargetFromElement, } from '../../../../affine-components/context-menu/index.js';
|
|
36
|
+
import { TOOLBAR_DELETE, } from '../../../../affine-shared/services/index.js';
|
|
36
37
|
import { unsafeCSSVarV2 } from '../../../../affine-shared/theme/index.js';
|
|
37
38
|
import { rangeWrap } from '../../../../affine-shared/utils/index.js';
|
|
38
39
|
import { IS_MOBILE } from '../../../../global/env/index.js';
|
|
@@ -50,6 +51,7 @@ import { createRef, ref } from 'lit/directives/ref.js';
|
|
|
50
51
|
import { repeat } from 'lit/directives/repeat.js';
|
|
51
52
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
52
53
|
import { html } from 'lit/static-html.js';
|
|
54
|
+
import { TAG_SELECT_CREATE, TAG_SELECT_PLACEHOLDER, TAG_SELECT_TIP, } from '../../../translations.js';
|
|
53
55
|
import { stopPropagation } from '../../utils/event.js';
|
|
54
56
|
import { dragHandler } from '../../utils/wc-dnd/dnd-context.js';
|
|
55
57
|
import { defaultActivators } from '../../utils/wc-dnd/sensors/index.js';
|
|
@@ -58,6 +60,7 @@ import { verticalListSortingStrategy } from '../../utils/wc-dnd/sort/strategies/
|
|
|
58
60
|
import { arrayMove } from '../../utils/wc-dnd/utils/array-move.js';
|
|
59
61
|
import { getTagColor, selectOptionColors } from './colors.js';
|
|
60
62
|
import { selectedStyle, selectOptionContentStyle, selectOptionDragHandlerStyle, selectOptionIconStyle, selectOptionNewIconStyle, selectOptionsContainerStyle, selectOptionsTipsStyle, selectOptionStyle, tagContainerStyle, tagDeleteIconStyle, tagSelectContainerStyle, tagSelectInputContainerStyle, tagSelectInputStyle, tagTextStyle, } from './styles-css.js';
|
|
63
|
+
const englishWording = (wording) => wording[1];
|
|
61
64
|
// Parent elements that can hand over a tag draft typed in the table.
|
|
62
65
|
const TABLE_CELL_HOST_SELECTOR = 'dv-table-view-cell-container, affine-database-virtual-cell-container';
|
|
63
66
|
export function consumeTagDraftFromTableCellHost(fromElement) {
|
|
@@ -179,6 +182,9 @@ let MultiTagSelect = (() => {
|
|
|
179
182
|
let _onOptionsChange_decorators;
|
|
180
183
|
let _onOptionsChange_initializers = [];
|
|
181
184
|
let _onOptionsChange_extraInitializers = [];
|
|
185
|
+
let _optionEdits_decorators;
|
|
186
|
+
let _optionEdits_initializers = [];
|
|
187
|
+
let _optionEdits_extraInitializers = [];
|
|
182
188
|
let _options_decorators;
|
|
183
189
|
let _options_initializers = [];
|
|
184
190
|
let _options_extraInitializers = [];
|
|
@@ -188,6 +194,9 @@ let MultiTagSelect = (() => {
|
|
|
188
194
|
let _initialDraftText_decorators;
|
|
189
195
|
let _initialDraftText_initializers = [];
|
|
190
196
|
let _initialDraftText_extraInitializers = [];
|
|
197
|
+
let _wording_decorators;
|
|
198
|
+
let _wording_initializers = [];
|
|
199
|
+
let _wording_extraInitializers = [];
|
|
191
200
|
return class MultiTagSelect extends _classSuper {
|
|
192
201
|
static {
|
|
193
202
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -195,16 +204,20 @@ let MultiTagSelect = (() => {
|
|
|
195
204
|
_onChange_decorators = [property({ attribute: false })];
|
|
196
205
|
_onComplete_decorators = [property({ attribute: false })];
|
|
197
206
|
_onOptionsChange_decorators = [property({ attribute: false })];
|
|
207
|
+
_optionEdits_decorators = [property({ attribute: false })];
|
|
198
208
|
_options_decorators = [property({ attribute: false })];
|
|
199
209
|
_value_decorators = [property({ attribute: false })];
|
|
200
210
|
_initialDraftText_decorators = [property({ attribute: false })];
|
|
211
|
+
_wording_decorators = [property({ attribute: false })];
|
|
201
212
|
__esDecorate(this, null, _mode_decorators, { kind: "accessor", name: "mode", static: false, private: false, access: { has: obj => "mode" in obj, get: obj => obj.mode, set: (obj, value) => { obj.mode = value; } }, metadata: _metadata }, _mode_initializers, _mode_extraInitializers);
|
|
202
213
|
__esDecorate(this, null, _onChange_decorators, { kind: "accessor", name: "onChange", static: false, private: false, access: { has: obj => "onChange" in obj, get: obj => obj.onChange, set: (obj, value) => { obj.onChange = value; } }, metadata: _metadata }, _onChange_initializers, _onChange_extraInitializers);
|
|
203
214
|
__esDecorate(this, null, _onComplete_decorators, { kind: "accessor", name: "onComplete", static: false, private: false, access: { has: obj => "onComplete" in obj, get: obj => obj.onComplete, set: (obj, value) => { obj.onComplete = value; } }, metadata: _metadata }, _onComplete_initializers, _onComplete_extraInitializers);
|
|
204
215
|
__esDecorate(this, null, _onOptionsChange_decorators, { kind: "accessor", name: "onOptionsChange", static: false, private: false, access: { has: obj => "onOptionsChange" in obj, get: obj => obj.onOptionsChange, set: (obj, value) => { obj.onOptionsChange = value; } }, metadata: _metadata }, _onOptionsChange_initializers, _onOptionsChange_extraInitializers);
|
|
216
|
+
__esDecorate(this, null, _optionEdits_decorators, { kind: "accessor", name: "optionEdits", static: false, private: false, access: { has: obj => "optionEdits" in obj, get: obj => obj.optionEdits, set: (obj, value) => { obj.optionEdits = value; } }, metadata: _metadata }, _optionEdits_initializers, _optionEdits_extraInitializers);
|
|
205
217
|
__esDecorate(this, null, _options_decorators, { kind: "accessor", name: "options", static: false, private: false, access: { has: obj => "options" in obj, get: obj => obj.options, set: (obj, value) => { obj.options = value; } }, metadata: _metadata }, _options_initializers, _options_extraInitializers);
|
|
206
218
|
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
207
219
|
__esDecorate(this, null, _initialDraftText_decorators, { kind: "accessor", name: "initialDraftText", static: false, private: false, access: { has: obj => "initialDraftText" in obj, get: obj => obj.initialDraftText, set: (obj, value) => { obj.initialDraftText = value; } }, metadata: _metadata }, _initialDraftText_initializers, _initialDraftText_extraInitializers);
|
|
220
|
+
__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);
|
|
208
221
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
209
222
|
}
|
|
210
223
|
get text() {
|
|
@@ -223,7 +236,7 @@ let MultiTagSelect = (() => {
|
|
|
223
236
|
<input
|
|
224
237
|
class="${tagSelectInputStyle}"
|
|
225
238
|
${ref(this._selectInput)}
|
|
226
|
-
placeholder="
|
|
239
|
+
placeholder="${this.say(TAG_SELECT_PLACEHOLDER)}"
|
|
227
240
|
.value="${this.text.value}"
|
|
228
241
|
@input="${this._onInput}"
|
|
229
242
|
@keydown="${this._onInputKeydown}"
|
|
@@ -247,13 +260,14 @@ let MultiTagSelect = (() => {
|
|
|
247
260
|
}
|
|
248
261
|
renderTags() {
|
|
249
262
|
const editable = !!this.onOptionsChange;
|
|
263
|
+
const reorderable = editable && this.optionEdits === 'all';
|
|
250
264
|
return html `
|
|
251
265
|
<div
|
|
252
266
|
style="height: 0.5px;background-color: ${cssVarV2('layer/insideBorder/border')};margin: 4px 0;"
|
|
253
267
|
></div>
|
|
254
268
|
${editable
|
|
255
269
|
? html `<div class="${selectOptionsTipsStyle}">
|
|
256
|
-
|
|
270
|
+
${this.say(TAG_SELECT_TIP)}
|
|
257
271
|
</div>`
|
|
258
272
|
: nothing}
|
|
259
273
|
<div data-testid="tag-option-list" class="${selectOptionsContainerStyle}">
|
|
@@ -272,7 +286,9 @@ let MultiTagSelect = (() => {
|
|
|
272
286
|
};
|
|
273
287
|
return html `
|
|
274
288
|
<div
|
|
275
|
-
${
|
|
289
|
+
${reorderable && !select.isCreate
|
|
290
|
+
? sortable(select.id)
|
|
291
|
+
: nothing}
|
|
276
292
|
class="${classes}"
|
|
277
293
|
@mouseenter="${mouseenter}"
|
|
278
294
|
@click="${select.select}"
|
|
@@ -280,9 +296,9 @@ let MultiTagSelect = (() => {
|
|
|
280
296
|
<div class="${selectOptionContentStyle}">
|
|
281
297
|
${select.isCreate
|
|
282
298
|
? html ` <div class="${selectOptionNewIconStyle}">
|
|
283
|
-
|
|
299
|
+
${this.say(TAG_SELECT_CREATE)}
|
|
284
300
|
</div>`
|
|
285
|
-
:
|
|
301
|
+
: reorderable
|
|
286
302
|
? html `
|
|
287
303
|
<div
|
|
288
304
|
${dragHandler(select.id)}
|
|
@@ -350,6 +366,9 @@ let MultiTagSelect = (() => {
|
|
|
350
366
|
#onOptionsChange_accessor_storage;
|
|
351
367
|
get onOptionsChange() { return this.#onOptionsChange_accessor_storage; }
|
|
352
368
|
set onOptionsChange(value) { this.#onOptionsChange_accessor_storage = value; }
|
|
369
|
+
#optionEdits_accessor_storage;
|
|
370
|
+
get optionEdits() { return this.#optionEdits_accessor_storage; }
|
|
371
|
+
set optionEdits(value) { this.#optionEdits_accessor_storage = value; }
|
|
353
372
|
#options_accessor_storage;
|
|
354
373
|
get options() { return this.#options_accessor_storage; }
|
|
355
374
|
set options(value) { this.#options_accessor_storage = value; }
|
|
@@ -359,6 +378,12 @@ let MultiTagSelect = (() => {
|
|
|
359
378
|
#initialDraftText_accessor_storage;
|
|
360
379
|
get initialDraftText() { return this.#initialDraftText_accessor_storage; }
|
|
361
380
|
set initialDraftText(value) { this.#initialDraftText_accessor_storage = value; }
|
|
381
|
+
#wording_accessor_storage;
|
|
382
|
+
get wording() { return this.#wording_accessor_storage; }
|
|
383
|
+
set wording(value) { this.#wording_accessor_storage = value; }
|
|
384
|
+
say(wording) {
|
|
385
|
+
return (this.wording ?? englishWording)(wording);
|
|
386
|
+
}
|
|
362
387
|
constructor() {
|
|
363
388
|
super(...arguments);
|
|
364
389
|
this._clickItemOption = (e, id) => {
|
|
@@ -367,20 +392,27 @@ let MultiTagSelect = (() => {
|
|
|
367
392
|
if (!option) {
|
|
368
393
|
return;
|
|
369
394
|
}
|
|
395
|
+
const rename = menu.input({
|
|
396
|
+
initialValue: option.value,
|
|
397
|
+
onChange: text => {
|
|
398
|
+
this.tagManager.changeTag({
|
|
399
|
+
id: option.id,
|
|
400
|
+
value: text,
|
|
401
|
+
});
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
if (this.optionEdits === 'create-rename') {
|
|
405
|
+
popMenu(popupTargetFromElement(e.currentTarget), {
|
|
406
|
+
options: { items: [rename] },
|
|
407
|
+
});
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
370
410
|
popMenu(popupTargetFromElement(e.currentTarget), {
|
|
371
411
|
options: {
|
|
372
412
|
items: [
|
|
373
|
-
|
|
374
|
-
initialValue: option.value,
|
|
375
|
-
onChange: text => {
|
|
376
|
-
this.tagManager.changeTag({
|
|
377
|
-
id: option.id,
|
|
378
|
-
value: text,
|
|
379
|
-
});
|
|
380
|
-
},
|
|
381
|
-
}),
|
|
413
|
+
rename,
|
|
382
414
|
menu.action({
|
|
383
|
-
name:
|
|
415
|
+
name: this.say(TOOLBAR_DELETE),
|
|
384
416
|
prefix: DeleteIcon(),
|
|
385
417
|
class: {
|
|
386
418
|
'delete-item': true,
|
|
@@ -399,7 +431,7 @@ let MultiTagSelect = (() => {
|
|
|
399
431
|
height: '20px',
|
|
400
432
|
});
|
|
401
433
|
return menu.action({
|
|
402
|
-
name: item.name,
|
|
434
|
+
name: item.wording ? this.say(item.wording) : item.name,
|
|
403
435
|
prefix: html ` <div style=${styles}></div>`,
|
|
404
436
|
isSelected: option.color === item.color,
|
|
405
437
|
select: () => {
|
|
@@ -452,7 +484,10 @@ let MultiTagSelect = (() => {
|
|
|
452
484
|
onDragEnd: evt => {
|
|
453
485
|
const over = evt.over;
|
|
454
486
|
const activeId = evt.active.id;
|
|
455
|
-
if (over &&
|
|
487
|
+
if (over &&
|
|
488
|
+
over.id !== activeId &&
|
|
489
|
+
this.onOptionsChange &&
|
|
490
|
+
this.optionEdits === 'all') {
|
|
456
491
|
this.onOptionsChange(arrayMove(this.options.value, this.options.value.findIndex(v => v.id === activeId), this.options.value.findIndex(v => v.id === over.id)));
|
|
457
492
|
this.requestUpdate();
|
|
458
493
|
// const properties = this.filteredOptions$.value.map(v=>v.id);
|
|
@@ -478,17 +513,20 @@ let MultiTagSelect = (() => {
|
|
|
478
513
|
this.#onChange_accessor_storage = (__runInitializers(this, _mode_extraInitializers), __runInitializers(this, _onChange_initializers, void 0));
|
|
479
514
|
this.#onComplete_accessor_storage = (__runInitializers(this, _onChange_extraInitializers), __runInitializers(this, _onComplete_initializers, void 0));
|
|
480
515
|
this.#onOptionsChange_accessor_storage = (__runInitializers(this, _onComplete_extraInitializers), __runInitializers(this, _onOptionsChange_initializers, undefined));
|
|
481
|
-
this.#
|
|
516
|
+
this.#optionEdits_accessor_storage = (__runInitializers(this, _onOptionsChange_extraInitializers), __runInitializers(this, _optionEdits_initializers, 'all'));
|
|
517
|
+
this.#options_accessor_storage = (__runInitializers(this, _optionEdits_extraInitializers), __runInitializers(this, _options_initializers, void 0));
|
|
482
518
|
this.selectedIndex$ = (__runInitializers(this, _options_extraInitializers), signal(0));
|
|
483
519
|
this.#value_accessor_storage = __runInitializers(this, _value_initializers, void 0);
|
|
484
520
|
this.#initialDraftText_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _initialDraftText_initializers, void 0));
|
|
485
|
-
__runInitializers(this, _initialDraftText_extraInitializers);
|
|
521
|
+
this.#wording_accessor_storage = (__runInitializers(this, _initialDraftText_extraInitializers), __runInitializers(this, _wording_initializers, undefined));
|
|
522
|
+
__runInitializers(this, _wording_extraInitializers);
|
|
486
523
|
}
|
|
487
524
|
};
|
|
488
525
|
})();
|
|
489
526
|
export { MultiTagSelect };
|
|
490
527
|
const popMobileTagSelect = (target, ops) => {
|
|
491
528
|
const tagManager = new TagManager(ops);
|
|
529
|
+
const say = ops.wording ?? englishWording;
|
|
492
530
|
if (ops.initialDraftText) {
|
|
493
531
|
tagManager.text$.value = ops.initialDraftText;
|
|
494
532
|
}
|
|
@@ -525,7 +563,7 @@ const popMobileTagSelect = (target, ops) => {
|
|
|
525
563
|
<input
|
|
526
564
|
.value="${tagManager.text$.value}"
|
|
527
565
|
@input="${onInput}"
|
|
528
|
-
placeholder="
|
|
566
|
+
placeholder="${say(TAG_SELECT_PLACEHOLDER)}"
|
|
529
567
|
type="text"
|
|
530
568
|
style="outline: none;border: none;flex:1;min-width: 10px"
|
|
531
569
|
/>
|
|
@@ -546,7 +584,9 @@ const popMobileTagSelect = (target, ops) => {
|
|
|
546
584
|
return html `
|
|
547
585
|
<div style="display: flex; align-items:center;">
|
|
548
586
|
${option.isCreate
|
|
549
|
-
? html ` <div style="margin-right: 8px;">
|
|
587
|
+
? html ` <div style="margin-right: 8px;">
|
|
588
|
+
${say(TAG_SELECT_CREATE)}
|
|
589
|
+
</div>`
|
|
550
590
|
: ''}
|
|
551
591
|
<div class="${tagContainerStyle}" style=${style}>
|
|
552
592
|
<div class="${tagTextStyle}">${option.value}</div>
|
|
@@ -583,7 +623,9 @@ export const popTagSelect = (target, ops) => {
|
|
|
583
623
|
component.onChange = ops.onChange;
|
|
584
624
|
component.options = ops.options;
|
|
585
625
|
component.onOptionsChange = ops.onOptionsChange;
|
|
626
|
+
component.optionEdits = ops.optionEdits ?? 'all';
|
|
586
627
|
component.initialDraftText = ops.initialDraftText;
|
|
628
|
+
component.wording = ops.wording;
|
|
587
629
|
component.onComplete = () => {
|
|
588
630
|
ops.onComplete?.();
|
|
589
631
|
remove();
|
|
@@ -8,7 +8,8 @@ import type { DatabaseFlags } from '../types.js';
|
|
|
8
8
|
import type { ViewConvertConfig } from '../view/convert.js';
|
|
9
9
|
import type { DataViewDataType, ViewMeta } from '../view/data-view.js';
|
|
10
10
|
import type { ViewManager } from '../view-manager/view-manager.js';
|
|
11
|
-
|
|
11
|
+
import { type CellStatus, type DataSourceHydration, type ValuesState } from './hydration.js';
|
|
12
|
+
export interface DataSource extends DataSourceHydration {
|
|
12
13
|
readonly$: ReadonlySignal<boolean>;
|
|
13
14
|
properties$: ReadonlySignal<string[]>;
|
|
14
15
|
featureFlags$: ReadonlySignal<DatabaseFlags>;
|
|
@@ -65,6 +66,9 @@ export interface DataSource {
|
|
|
65
66
|
}
|
|
66
67
|
export declare const DataSourceScope: import("../../../global/di/types.js").ServiceScope;
|
|
67
68
|
export declare abstract class DataSourceBase implements DataSource {
|
|
69
|
+
/** Every cell is `ready` unless a source says otherwise (ADR 0035 §9e). */
|
|
70
|
+
cellStatus(_rowId: string, _propertyId: string): CellStatus;
|
|
71
|
+
valuesState$: ReadonlySignal<ValuesState>;
|
|
68
72
|
propertyTypeCanSet(propertyId: string): boolean;
|
|
69
73
|
propertyCanDuplicate(propertyId: string): boolean;
|
|
70
74
|
propertyCanDelete(propertyId: string): boolean;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Container, createScope, } from '../../../global/di/index.js';
|
|
2
|
-
import { computed } from '@preact/signals-core';
|
|
2
|
+
import { computed, signal } from '@preact/signals-core';
|
|
3
|
+
import { VALUES_READY, } from './hydration.js';
|
|
3
4
|
export const DataSourceScope = createScope('data-source');
|
|
4
5
|
export class DataSourceBase {
|
|
5
6
|
constructor() {
|
|
7
|
+
this.valuesState$ = signal(VALUES_READY);
|
|
6
8
|
this.container = new Container();
|
|
7
9
|
this.fixedProperties$ = computed(() => {
|
|
8
10
|
return this.allPropertyMetas$.value
|
|
@@ -13,6 +15,10 @@ export class DataSourceBase {
|
|
|
13
15
|
return new Set(this.fixedProperties$.value);
|
|
14
16
|
});
|
|
15
17
|
}
|
|
18
|
+
/** Every cell is `ready` unless a source says otherwise (ADR 0035 §9e). */
|
|
19
|
+
cellStatus(_rowId, _propertyId) {
|
|
20
|
+
return 'ready';
|
|
21
|
+
}
|
|
16
22
|
propertyTypeCanSet(propertyId) {
|
|
17
23
|
return !this.isFixedProperty(propertyId);
|
|
18
24
|
}
|