@orangelogic/design-system 3.19.0 → 3.21.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/library/chunks/{_baseXor.DixEm6JQ.js → _baseXor.BCxbgizO.js} +2 -2
- package/library/chunks/{asset-link-format.ttcRQgDc.js → asset-link-format.DjxLUjGN.js} +619 -611
- package/library/chunks/{button.D1YIxtv-.js → button.CklW2xIt.js} +3 -3
- package/library/chunks/button.styles.D3GdfF7I.js +5 -0
- package/library/chunks/{color-swatch-group.Bumfw-G2.js → color-swatch-group.B_eqaBlU.js} +3354 -2925
- package/library/chunks/color.CIHdfM_a.js +187 -0
- package/library/chunks/{confirm-popover.CJXyEa5A.js → confirm-popover.T7M1IynK.js} +4 -4
- package/library/chunks/content-builder.CBBdfVOl.js +55 -0
- package/library/chunks/{dialog.BbQ4Du0M.js → dialog.ATeOYqwC.js} +2 -2
- package/library/chunks/{document-viewer.C9tM2Gc7.js → document-viewer.DcR3RRh7.js} +10 -9
- package/library/chunks/{dom.DL-cNKsj.js → dom.D0lSUoEI.js} +1 -1
- package/library/chunks/{dot-pagination.CJRAtM51.js → dot-pagination.BrDTro_E.js} +1 -1
- package/library/chunks/{folder-select.BAPsI-gg.js → folder-select.ChVr6nVx.js} +5 -5
- package/library/chunks/{form.DN2v7-DH.js → form.LpappO1d.js} +1 -1
- package/library/chunks/{header.BioJzPlg.js → header.BeRkHwrR.js} +132 -90
- package/library/chunks/{i18n.rtxrs1c1.js → i18n.CcvOGKg6.js} +85 -5
- package/library/chunks/{icon-button.CbUddcgI.js → icon-button.CXELPgXm.js} +1 -1
- package/library/chunks/{iframe.y7iCAVZP.js → iframe.CT5jmGYk.js} +1 -1
- package/library/chunks/{image.A2hE1WoV.js → image.CqTbFbtg.js} +322 -222
- package/library/chunks/index.DgCcXGmO.js +1126 -0
- package/library/chunks/{input.D1FFprPl.js → input.DRdoQJOD.js} +2 -2
- package/library/chunks/{markdown.Dd_GFJK8.js → markdown.BF9bqmMv.js} +3 -3
- package/library/chunks/{menu-item.0TbnDEDp.js → menu-item.C0sQ8KjF.js} +1 -1
- package/library/chunks/{option.CyorNG0S.js → option.mXqrZbpB.js} +1 -1
- package/library/chunks/{pagination.D0BeaEIi.js → pagination.C5DtaMQU.js} +36 -32
- package/library/chunks/{position-picker.DjnhxIKF.js → position-picker.qkbJlboF.js} +12 -0
- package/library/chunks/responsive.BmBJSzC4.js +17 -0
- package/library/chunks/{string.Demn8Xmk.js → string.CfI2ejyR.js} +3 -3
- package/library/chunks/{tab-group.C98CWzEH.js → tab-group.OEwvRv7m.js} +312 -310
- package/library/chunks/toast.D3AW3RWv.js +94 -0
- package/library/chunks/transformation.BwQ_H-4q.js +351 -0
- package/library/chunks/{tree.B7IKBX3n.js → tree.DlO3BFjn.js} +4 -7
- package/library/chunks/{types.DVZ_cbKn.js → types.VFIFor5z.js} +58039 -35788
- package/library/chunks/typography.BLYdTF0n.js +102 -0
- package/library/components/alert.js +2 -2
- package/library/components/asset-link-format.js +6 -6
- package/library/components/atoms.js +161 -159
- package/library/components/audio.js +4 -4
- package/library/components/bicolor-picker.js +2 -2
- package/library/components/border-input-group.js +2 -2
- package/library/components/box.d.ts +3 -0
- package/library/components/box.js +22 -0
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +4 -4
- package/library/components/card.js +7 -7
- package/library/components/checkbox.js +1 -1
- package/library/components/color-picker.js +36 -32
- package/library/components/color-swatch-group.js +8 -7
- package/library/components/color-swatch.js +246 -22
- package/library/components/confirm-popover.js +5 -5
- package/library/components/copy-button.js +2 -2
- package/library/components/corner-position-input-group.js +3 -3
- package/library/components/date-calendar.js +1 -1
- package/library/components/details.js +19 -19
- package/library/components/dialog.js +3 -3
- package/library/components/diff.js +1 -1
- package/library/components/document-viewer.js +4 -4
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +2 -2
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +95 -92
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +12 -12
- package/library/components/folder-select.js +5 -5
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +1 -1
- package/library/components/header.js +6 -3
- package/library/components/icon-button.js +2 -2
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +1 -1
- package/library/components/image.js +4 -3
- package/library/components/input.js +3 -3
- package/library/components/line-clamp.js +1 -1
- package/library/components/markdown.js +4 -4
- package/library/components/masonry.js +70 -56
- package/library/components/menu-item.js +2 -2
- package/library/components/menu.js +2 -2
- package/library/components/molecules.js +4 -4
- package/library/components/mutation-observer.js +25 -23
- package/library/components/option.js +2 -2
- package/library/components/organisms.js +2 -2
- package/library/components/padding-input-group.js +1 -1
- package/library/components/pagination.js +7 -7
- package/library/components/popup.js +1 -1
- package/library/components/position-picker.js +2 -2
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/radio-button.js +1 -1
- package/library/components/radio-card.js +1 -1
- package/library/components/radio-group.js +1 -1
- package/library/components/range.js +2 -2
- package/library/components/rating.js +1 -1
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +4 -4
- package/library/components/shadow-input-group.js +1 -1
- package/library/components/share-option-list.js +3 -3
- package/library/components/sidebar.js +1 -1
- package/library/components/size-input-group.js +3 -3
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +1 -1
- package/library/components/switch.js +1 -1
- package/library/components/tab-group.js +6 -6
- package/library/components/tab-panel.js +1 -1
- package/library/components/tab.js +16 -16
- package/library/components/tag.js +2 -2
- package/library/components/textarea.js +1 -1
- package/library/components/timecode.js +2 -2
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +2 -2
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +3 -3
- package/library/components/types.js +495 -487
- package/library/components/typography.js +3 -2
- package/library/components/video.js +4232 -4211
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/audio/audio.d.ts +0 -1
- package/library/packages/atoms/src/components/box/box.d.ts +26 -0
- package/library/packages/atoms/src/components/box/box.styles.d.ts +7 -0
- package/library/packages/atoms/src/components/button/button.d.ts +4 -0
- package/library/packages/atoms/src/components/card/card.d.ts +1 -0
- package/library/packages/atoms/src/components/color-picker/color-picker.d.ts +11 -0
- package/library/packages/atoms/src/components/copy-button/copy-button.d.ts +1 -0
- package/library/packages/atoms/src/components/details/details.d.ts +6 -1
- package/library/packages/atoms/src/components/header/header.d.ts +38 -2
- package/library/packages/atoms/src/components/image/image.d.ts +14 -0
- package/library/packages/atoms/src/components/mutation-observer/mutation-observer.d.ts +1 -1
- package/library/packages/atoms/src/components/radio-card/radio-card.d.ts +1 -0
- package/library/packages/atoms/src/components/tab/tab.d.ts +17 -0
- package/library/packages/atoms/src/components/tree/tree.d.ts +2 -2
- package/library/packages/atoms/src/components/typography/typography.d.ts +31 -0
- package/library/packages/atoms/src/components/video/video.d.ts +18 -1
- package/library/packages/atoms/src/index.d.ts +1 -0
- package/library/packages/events/src/cx-color-swatch-picker-columns-change.d.ts +15 -0
- package/library/packages/events/src/events.d.ts +1 -0
- package/library/packages/hybrid/table-core/src/table/components/table-toolbar/table-dropdown-filter.d.ts +2 -0
- package/library/packages/hybrid/table-core/src/table/table.d.ts +45 -5
- package/library/packages/molecules/src/color-swatch/color-swatch.d.ts +35 -1
- package/library/packages/molecules/src/data-tab-group/data-tab-group.d.ts +30 -1
- package/library/packages/molecules/src/details-group/details-group.d.ts +105 -3
- package/library/packages/molecules/src/dynamic-select/dynamic-select.d.ts +5 -0
- package/library/packages/molecules/src/font-picker/font-picker.d.ts +3 -0
- package/library/packages/molecules/src/gallery-item/gallery-item.d.ts +10 -0
- package/library/packages/molecules/src/index.d.ts +0 -1
- package/library/packages/molecules/src/masonry/masonry.d.ts +5 -0
- package/library/packages/organisms/src/color-swatch-group/color-swatch-group.constants.d.ts +37 -45
- package/library/packages/organisms/src/color-swatch-group/color-swatch-group.d.ts +210 -10
- package/library/packages/organisms/src/content-builder/blocks/audio/audio.d.ts +0 -1
- package/library/packages/organisms/src/content-builder/blocks/font-kit-advanced/font-kit-advanced.utils.d.ts +85 -0
- package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +26 -33
- package/library/packages/organisms/src/content-builder/components/block-picker/block-picker.d.ts +24 -8
- package/library/packages/organisms/src/content-builder/components/color-swatch-picker/color-swatch-picker.d.ts +70 -1
- package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +1 -22
- package/library/packages/organisms/src/content-builder/components/config-manager/config-manager.d.ts +7 -0
- package/library/packages/organisms/src/content-builder/components/gallery-config/gallery-config.d.ts +6 -0
- package/library/packages/organisms/src/content-builder/components/gallery-picker/gallery-picker.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/accordion.d.ts +7 -0
- package/library/packages/organisms/src/content-builder/configs/audio.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/button.d.ts +2 -1
- package/library/packages/organisms/src/content-builder/configs/carousel.d.ts +11 -1
- package/library/packages/organisms/src/content-builder/configs/color-swatches.d.ts +19 -1
- package/library/packages/organisms/src/content-builder/configs/column-group.d.ts +11 -2
- package/library/packages/organisms/src/content-builder/configs/column.d.ts +13 -3
- package/library/packages/organisms/src/content-builder/configs/dam-view.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/divider.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/document-viewer.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/font-kit-advanced.d.ts +19 -0
- package/library/packages/organisms/src/content-builder/configs/font-kit.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/gallery.d.ts +15 -1
- package/library/packages/organisms/src/content-builder/configs/header.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/image.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/index.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/search-box.d.ts +5 -1
- package/library/packages/organisms/src/content-builder/configs/tab-group.d.ts +7 -4
- package/library/packages/organisms/src/content-builder/configs/timeline.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/video.d.ts +3 -0
- package/library/packages/organisms/src/content-builder/configs-controller.d.ts +155 -13
- package/library/packages/organisms/src/content-builder/content-builder-config.d.ts +60 -0
- package/library/packages/organisms/src/content-builder/content-builder-constants.d.ts +24 -9
- package/library/packages/organisms/src/content-builder/content-builder.d.ts +121 -151
- package/library/packages/organisms/src/content-builder/content-builder.sections.utils.d.ts +78 -0
- package/library/packages/organisms/src/content-builder/content-builder.utils.d.ts +33 -22
- package/library/packages/organisms/src/content-builder/plugins/font-kit-advanced.d.ts +5 -0
- package/library/packages/organisms/src/content-builder/plugins/gallery.d.ts +6 -0
- package/library/packages/organisms/src/content-builder/plugins/header.d.ts +7 -1
- package/library/packages/organisms/src/content-builder/plugins/index.d.ts +2 -1
- package/library/packages/organisms/src/content-builder/plugins/rich-text-editor/components/rte-bubble-menu/rte-bubble-menu.d.ts +21 -1
- package/library/packages/organisms/src/content-builder/plugins/rich-text-editor/extensions/index.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/plugins/rich-text-editor/rte-configs.d.ts +14 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/section-fragment-component.d.ts +22 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/section-host-mounting.d.ts +15 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/sections-canvas-patches.d.ts +20 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/sections-plugin.d.ts +7 -0
- package/library/packages/organisms/src/content-builder/plugins/toolbar.d.ts +10 -1
- package/library/packages/organisms/src/content-builder/plugins/utils/block-width.d.ts +20 -0
- package/library/packages/organisms/src/content-builder/styleController.d.ts +9 -5
- package/library/packages/organisms/src/content-builder-viewer/content-builder-viewer.d.ts +3 -10
- package/library/packages/organisms/src/form/control-renderer/control-renderer.d.ts +170 -0
- package/library/packages/organisms/src/form/control-renderer/control-renderer.styles.d.ts +9 -0
- package/library/packages/organisms/src/list-editor/list-editor.d.ts +181 -6
- package/library/packages/tools/src/fetch-image/fetch-image.d.ts +12 -0
- package/library/packages/tools/src/tiptap/extensions/metafield/index.d.ts +12 -0
- package/library/packages/tools/src/tiptap/utils/md/schema.d.ts +1 -1
- package/library/packages/types/src/asset-link-format.d.ts +0 -1
- package/library/packages/types/src/button.d.ts +1 -1
- package/library/packages/types/src/color-swatch-group.d.ts +56 -0
- package/library/packages/types/src/color-swatch.d.ts +22 -0
- package/library/packages/types/src/column.d.ts +13 -0
- package/library/packages/types/src/content-builder.d.ts +69 -4
- package/library/packages/types/src/details-group.d.ts +80 -0
- package/library/packages/types/src/font-kit-advanced.d.ts +28 -0
- package/library/packages/types/src/font-kit.d.ts +19 -0
- package/library/packages/types/src/font-picker.d.ts +2 -0
- package/library/packages/types/src/gallery-item.d.ts +3 -1
- package/library/packages/types/src/gallery.d.ts +2 -1
- package/library/packages/types/src/index.d.ts +1 -0
- package/library/packages/types/src/masonry.d.ts +1 -0
- package/library/packages/types/src/position-picker.d.ts +6 -0
- package/library/packages/types/src/sb-button.d.ts +7 -0
- package/library/packages/types/src/search-box.d.ts +4 -0
- package/library/packages/utils/src/color/color.d.ts +27 -3
- package/library/packages/utils/src/custom-element/i18n.d.ts +86 -2
- package/library/packages/utils/src/font/font.d.ts +12 -0
- package/library/packages/utils/src/transformation/transformation.d.ts +11 -5
- package/library/react-web-component.d.ts +510 -160
- package/library/utils.js +418 -399
- package/package.json +1 -1
- package/library/chunks/button.styles.BWgHrfLD.js +0 -5
- package/library/chunks/color-swatch.DdsUysbF.js +0 -223
- package/library/chunks/color.LzSGBy7o.js +0 -164
- package/library/chunks/index.Coy2OPB4.js +0 -20122
- package/library/chunks/toast.BxiewnAG.js +0 -109
- package/library/chunks/transformation.CjWnFhab.js +0 -386
- package/library/chunks/typography.T72DuoCa.js +0 -52
- package/library/packages/molecules/src/search-box/search-box.d.ts +0 -114
- package/library/packages/organisms/src/content-builder/plugins/wrapper-container.d.ts +0 -15
- /package/library/packages/{molecules/src/search-box/search-box.styles.d.ts → organisms/src/content-builder-viewer/content-builder-viewer.styles.d.ts} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Editor } from 'grapesjs';
|
|
2
|
+
|
|
3
|
+
/** Model property holding the section id. Serialized with the project, read back on save. */
|
|
4
|
+
export declare const SECTION_ID_PROP = "sectionId";
|
|
5
|
+
/** Model property holding the host container selector the fragment mounts into. */
|
|
6
|
+
export declare const SECTION_SELECTOR_PROP = "containerSelector";
|
|
7
|
+
/** Registers the fragment type once per editor. */
|
|
8
|
+
export declare function registerSectionFragmentType(editor: Editor): void;
|
|
9
|
+
export declare function isSectionFragment(component?: Component | null): boolean;
|
|
10
|
+
/** Section id carried by a fragment. */
|
|
11
|
+
export declare function getSectionId(fragment: Component): string;
|
|
12
|
+
/** Every section fragment under the wrapper, in wrapper order. */
|
|
13
|
+
export declare function getSectionFragments(editor: Editor): Component[];
|
|
14
|
+
export declare function getSectionFragment(editor: Editor, sectionId: string): Component | undefined;
|
|
15
|
+
/** The fragment a component belongs to — itself when it is one — or `undefined` outside any section. */
|
|
16
|
+
export declare function getSectionOf(component?: Component | null): Component | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The cell that receives blocks at the top of a section root: the first `BlockCell` whose parent is
|
|
19
|
+
* the root (page content), falling back to the first cell anywhere below it (hero: cell inside its
|
|
20
|
+
* column group).
|
|
21
|
+
*/
|
|
22
|
+
export declare function getRootCell(root: Component): Component | undefined;
|
package/library/packages/organisms/src/content-builder/plugins/sections/section-host-mounting.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from 'grapesjs';
|
|
2
|
+
|
|
3
|
+
/** `querySelector` that never throws on a malformed selector coming from configuration. */
|
|
4
|
+
export declare function resolveHost(doc: Document, selector: string): HTMLElement | null;
|
|
5
|
+
/**
|
|
6
|
+
* Puts the fragment element inside its host container. Returns `true` when the fragment is (now)
|
|
7
|
+
* mounted in its host, `false` when the element or host is not available yet.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mountFragmentIntoHost(fragment: Component): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Re-mounts fragments whose host was replaced by the page (SPA refresh, VForm re-render). The
|
|
12
|
+
* callback is coalesced per task so a burst of mutations — including the ones our own
|
|
13
|
+
* `replaceChildren` produces — triggers one pass, which is a no-op once everything is mounted.
|
|
14
|
+
*/
|
|
15
|
+
export declare function observeHostReplacement(doc: Document, remountAll: () => void): MutationObserver;
|
package/library/packages/organisms/src/content-builder/plugins/sections/sections-canvas-patches.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor } from 'grapesjs';
|
|
2
|
+
|
|
3
|
+
/** Hides the wrapper element: its children are mounted in section hosts, it must not take space. */
|
|
4
|
+
export declare function parkWrapperElement(editor: Editor): void;
|
|
5
|
+
/**
|
|
6
|
+
* Block-manager drops are captured on the wrapper element by default; the sections live outside it,
|
|
7
|
+
* so the same `Droppable` is re-bound to the frame body (in-canvas moves already use the body).
|
|
8
|
+
*/
|
|
9
|
+
export declare function rebindBlockDropsToBody(editor: Editor): void;
|
|
10
|
+
/**
|
|
11
|
+
* Drag autoscroll measures the wrapper element's height for its lower bound; with a parked wrapper
|
|
12
|
+
* that is zero. Measure the document instead so authors can autoscroll through every section.
|
|
13
|
+
*/
|
|
14
|
+
export declare function widenAutoscrollToBody(editor: Editor): void;
|
|
15
|
+
/**
|
|
16
|
+
* Restricts grapesjs' `select-comp` click handling to targets inside a section host, so clicking the
|
|
17
|
+
* page chrome around the sections never selects anything. Also skips clicks on a column group while
|
|
18
|
+
* one of its columns is being resized.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scopeSelectClicksToHosts(editor: Editor, hostSelector: string): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContentBuilderSection } from '../../../../../types/src/content-builder';
|
|
2
|
+
import { Editor } from 'grapesjs';
|
|
3
|
+
|
|
4
|
+
/** Selector list matching every section host container. */
|
|
5
|
+
export declare function buildHostSelector(sections: ContentBuilderSection[]): string;
|
|
6
|
+
declare const SectionsPlugin: (sections: ContentBuilderSection[]) => (editor: Editor) => void;
|
|
7
|
+
export default SectionsPlugin;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { ToolbarItem } from '../../../../types/src/content-builder';
|
|
2
2
|
import { LocalizeController } from '../../../../utils/src/custom-element/i18n';
|
|
3
|
-
import { Editor } from 'grapesjs';
|
|
3
|
+
import { Component, Editor } from 'grapesjs';
|
|
4
4
|
|
|
5
5
|
declare const toolbar: (localize: LocalizeController, toolbarConfigs?: {
|
|
6
6
|
allowDuplicateBlocks?: boolean;
|
|
7
7
|
}) => ToolbarItem[];
|
|
8
|
+
export declare const addColumnItem: (localize: LocalizeController, command: ToolbarItem['command']) => ToolbarItem;
|
|
9
|
+
/** Appends the column with its text block, instead of opening the picker. */
|
|
10
|
+
export declare const fontKitAddColumnItem: (localize: LocalizeController, templateRow: Component) => ToolbarItem;
|
|
11
|
+
/**
|
|
12
|
+
* Reads as a remove but unticks the part's Elements checkbox, leaving the block
|
|
13
|
+
* in place. The id cannot be `remove`: `applyComponentFlagsToToolbar` strips
|
|
14
|
+
* that one for a block with `removable: false`, which these are.
|
|
15
|
+
*/
|
|
16
|
+
export declare const fontKitRemoveElementItems: (localize: LocalizeController, fontKit: Component, toggleAttribute: string) => ToolbarItem[];
|
|
8
17
|
export declare const execCommand: (event: MouseEvent, editor: Editor, command: any) => void;
|
|
9
18
|
export declare const generateToolbar: (items: any[], editor: Editor, dividerIndices?: number[]) => any[];
|
|
10
19
|
export default toolbar;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as CxColumn } from '../../blocks/column/column';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The width a block's percentage `width` should be measured against.
|
|
5
|
+
*
|
|
6
|
+
* Blocks sit inside `cx-column`, so a raw percentage resolves against the column. Once a
|
|
7
|
+
* page sets `--content-builder-viewer-content-max-width`, non-full-bleed blocks are
|
|
8
|
+
* constrained to a narrower content band instead, and a percentage stored against the
|
|
9
|
+
* column would no longer match what renders. Read mode already clamps to the band via
|
|
10
|
+
* CSS; this keeps the editor's px/% conversion on the same reference so the resize
|
|
11
|
+
* handle and the width field agree with the page.
|
|
12
|
+
*
|
|
13
|
+
* Full-bleed blocks span the whole viewer, so they keep measuring the column.
|
|
14
|
+
*
|
|
15
|
+
* @param el - The block being measured.
|
|
16
|
+
* @param column - The `cx-column` the block belongs to.
|
|
17
|
+
* @param canvasWindow - The canvas window, needed for `getComputedStyle`.
|
|
18
|
+
* @returns The reference width in CSS pixels.
|
|
19
|
+
*/
|
|
20
|
+
export default function getBlockReferenceWidth(el: Element, column: CxColumn, canvasWindow: Window): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropertyConfig } from '../../../types/src/content-builder';
|
|
2
|
-
import { FontTypeface } from '../../../types/src/font-picker';
|
|
2
|
+
import { FontFamily, FontTypeface } from '../../../types/src/font-picker';
|
|
3
3
|
import { LocalizeController } from '../../../utils/src/custom-element/i18n';
|
|
4
4
|
import { STYLE_CONTROL } from './content-builder-constants';
|
|
5
5
|
|
|
@@ -21,8 +21,8 @@ export default class StyleController {
|
|
|
21
21
|
default?: any;
|
|
22
22
|
max?: number | undefined;
|
|
23
23
|
min?: number | undefined;
|
|
24
|
-
placeholder?: string;
|
|
25
24
|
text?: string | undefined;
|
|
25
|
+
placeholder?: string;
|
|
26
26
|
category?: (string | import('grapesjs').BlockCategoryProperties) | undefined;
|
|
27
27
|
command?: string | ((editor: import('grapesjs').Editor, trait: import('grapesjs').Trait) => any) | undefined;
|
|
28
28
|
step?: number | undefined;
|
|
@@ -98,6 +98,8 @@ export default class StyleController {
|
|
|
98
98
|
fontPickerConfigs?: {
|
|
99
99
|
api: () => Promise<FontTypeface[]>;
|
|
100
100
|
familyKey: string;
|
|
101
|
+
inheritedFamilies?: FontFamily[];
|
|
102
|
+
inheritedOptionLabel?: string;
|
|
101
103
|
styleKey: string;
|
|
102
104
|
weightKey?: string;
|
|
103
105
|
};
|
|
@@ -125,7 +127,7 @@ export default class StyleController {
|
|
|
125
127
|
options: import('../../../types/src/content-builder').Option[];
|
|
126
128
|
type: "unit";
|
|
127
129
|
};
|
|
128
|
-
validation?: (record: Record<string, unknown
|
|
130
|
+
validation?: (record: Record<string, unknown>, siblings?: Array<Record<string, unknown>>) => string;
|
|
129
131
|
};
|
|
130
132
|
itemsPerRow?: number;
|
|
131
133
|
listEditorConfigs?: {
|
|
@@ -135,7 +137,7 @@ export default class StyleController {
|
|
|
135
137
|
displayField?: string;
|
|
136
138
|
editDialogLabel: string;
|
|
137
139
|
noHeader?: boolean;
|
|
138
|
-
sampleItem: Record<string,
|
|
140
|
+
sampleItem: Record<string, unknown>;
|
|
139
141
|
};
|
|
140
142
|
mask?: string;
|
|
141
143
|
maskBlocks?: Record<string, unknown>;
|
|
@@ -182,10 +184,12 @@ export default class StyleController {
|
|
|
182
184
|
/**
|
|
183
185
|
* Builds the controls for a font picker.
|
|
184
186
|
*/
|
|
185
|
-
getFontPickerControls<T = Record<string, any>>({ api, familyKey, styleKey, type, weightKey, ...control }: Omit<Partial<PropertyConfig<T>>, 'api' | 'controlType' | 'fontPickerConfigs'> & {
|
|
187
|
+
getFontPickerControls<T = Record<string, any>>({ api, familyKey, inheritedFamilies, inheritedOptionLabel, styleKey, type, weightKey, ...control }: Omit<Partial<PropertyConfig<T>>, 'api' | 'controlType' | 'fontPickerConfigs'> & {
|
|
186
188
|
api: () => Promise<FontTypeface[]>;
|
|
187
189
|
familyKey: string;
|
|
188
190
|
id: string;
|
|
191
|
+
inheritedFamilies?: FontFamily[];
|
|
192
|
+
inheritedOptionLabel?: string;
|
|
189
193
|
name: string;
|
|
190
194
|
styleKey: string;
|
|
191
195
|
weightKey?: string;
|
|
@@ -9,9 +9,8 @@ import { default as CortexLightElement } from '../../../base/src/cortex-light-el
|
|
|
9
9
|
* call, and for blocks needing the team-space list (`cx-sb-button`, `cx-sb-image`,
|
|
10
10
|
* `cx-sb-video` linking to a space, and `cx-gallery` showing space cards), fetching
|
|
11
11
|
* the space list once and assigning it as `spaces`. It also distributes its
|
|
12
|
-
* `securityBypassToken` to
|
|
13
|
-
*
|
|
14
|
-
* image block takes its URL from the batch instead. Renders no UI. Blocks skip their own fetch whenever an ancestor supplies
|
|
12
|
+
* `securityBypassToken` to every record-id child (including `cx-timeline`, for
|
|
13
|
+
* expired-URL recovery only) so their own runtime Search calls are authorised. Renders no UI. Blocks skip their own fetch whenever an ancestor supplies
|
|
15
14
|
* it, so they must sit inside this element for that to apply — in the editor that means
|
|
16
15
|
* inside the canvas document.
|
|
17
16
|
*
|
|
@@ -20,6 +19,7 @@ import { default as CortexLightElement } from '../../../base/src/cortex-light-el
|
|
|
20
19
|
*/
|
|
21
20
|
export default class CxContentBuilderViewer extends CortexLightElement {
|
|
22
21
|
#private;
|
|
22
|
+
static styles: import('lit').CSSResult[];
|
|
23
23
|
/**
|
|
24
24
|
* Page-scoped security-bypass token, stamped by the server on this element in read-mode HTML.
|
|
25
25
|
* The viewer uses it for its batched Search call and distributes it to its record-id children
|
|
@@ -46,13 +46,6 @@ export default class CxContentBuilderViewer extends CortexLightElement {
|
|
|
46
46
|
private getPrimaryRecordId;
|
|
47
47
|
/** Every field a block could map from fetched asset data. */
|
|
48
48
|
private getRequestedFields;
|
|
49
|
-
/**
|
|
50
|
-
* Proxy fields that can serve as an image's delivery URL. A hand-picked format names one
|
|
51
|
-
* proxy; `Auto` is decided by the extension this same response carries, so both candidates
|
|
52
|
-
* are requested up front rather than in a follow-up call. The original-file proxy always
|
|
53
|
-
* comes with the transcoded fallback, which is what a non-image original falls back to.
|
|
54
|
-
*/
|
|
55
|
-
private getImagePathFields;
|
|
56
49
|
private buildFetchPlan;
|
|
57
50
|
private fetchAllAssetData;
|
|
58
51
|
private applyFetchedData;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { AssetFormatValue } from '../../../../types/src/asset-format-picker';
|
|
2
|
+
import { Asset, AssetTypeString, PropertyConfig } from '../../../../types/src/content-builder';
|
|
3
|
+
import { StyleProps } from 'grapesjs';
|
|
4
|
+
import { ReactiveControllerHost } from 'lit';
|
|
5
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
6
|
+
|
|
7
|
+
/** Where a decoded value is written to: a block attribute, a style, a property, or nothing. */
|
|
8
|
+
export type ControlValueType = 'attribute' | 'style' | 'property' | 'decorative';
|
|
9
|
+
/**
|
|
10
|
+
* Ambient host state that the control branches read at render time.
|
|
11
|
+
*
|
|
12
|
+
* Every field is optional so a consumer supplies only what the control types it actually
|
|
13
|
+
* renders need. Missing fields are defaulted in the private `context` getter; the class
|
|
14
|
+
* doc lists which branch degrades without which field.
|
|
15
|
+
*/
|
|
16
|
+
export type ControlRendererContext = {
|
|
17
|
+
allowedFolders?: string[];
|
|
18
|
+
baseUrl?: string;
|
|
19
|
+
blockAttributes?: Record<string, any>;
|
|
20
|
+
blockStyles?: StyleProps;
|
|
21
|
+
boundary?: HTMLElement;
|
|
22
|
+
defaultLanguage?: string;
|
|
23
|
+
isAfterShow?: boolean;
|
|
24
|
+
onConfigureWorkflow?: (id?: string) => Promise<string>;
|
|
25
|
+
onRequestAsset?: (type: AssetTypeString, multiple?: boolean, accepts?: string[], restrictType?: AssetTypeString) => Promise<Asset | Record<string, Asset>>;
|
|
26
|
+
onRequestAssetFormat?: (assetId: string, value?: AssetFormatValue) => Promise<AssetFormatValue | null | undefined>;
|
|
27
|
+
onRequestDownloadFormat?: (assetIds: string[], formats?: Record<string, string[]>) => Promise<Record<string, string[]>>;
|
|
28
|
+
/**
|
|
29
|
+
* The list's other rows inside a list editor's dialog, so an
|
|
30
|
+
* `inputConfigs.validation` can reject duplicates. `cx-config-form` has no
|
|
31
|
+
* siblings and leaves it empty.
|
|
32
|
+
*/
|
|
33
|
+
siblingRecords?: Array<Record<string, unknown>>;
|
|
34
|
+
sortedLanguages?: string[];
|
|
35
|
+
token?: string;
|
|
36
|
+
traits?: PropertyConfig[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Writes one decoded value to the consumer's storage.
|
|
40
|
+
*
|
|
41
|
+
* `cx-config-form` routes this to block attributes / styles / properties and emits
|
|
42
|
+
* `cx-content-builder-form-change`. `cx-list-editor` writes into the edited item and
|
|
43
|
+
* ignores `type`, since an item row is a single flat record.
|
|
44
|
+
*/
|
|
45
|
+
export type ControlCommit = (params: {
|
|
46
|
+
callback?: PropertyConfig['callback'];
|
|
47
|
+
/** Skip the consumer's `await host.updateComplete` — the `switch` + attribute path. */
|
|
48
|
+
immediate?: boolean;
|
|
49
|
+
key: string;
|
|
50
|
+
type: ControlValueType;
|
|
51
|
+
value: unknown;
|
|
52
|
+
}) => Promise<void> | void;
|
|
53
|
+
export type ControlRendererOptions = {
|
|
54
|
+
commit: ControlCommit;
|
|
55
|
+
/** Live consumer state. Re-invoked at every read site — never cache the result. */
|
|
56
|
+
getContext: () => ControlRendererContext;
|
|
57
|
+
/** Renders a `group` trait's children. Omit when the consumer has no `group` support. */
|
|
58
|
+
renderChildren?: (children: PropertyConfig[], parent: PropertyConfig) => unknown;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @summary Renders a content-builder `PropertyConfig` as a form control, and decodes the value
|
|
62
|
+
* that control emits back into key/value writes.
|
|
63
|
+
*
|
|
64
|
+
* Shared by `cx-config-form` (the block settings panel) and `cx-list-editor` (the add/edit item
|
|
65
|
+
* dialog) so the control types are implemented once.
|
|
66
|
+
*
|
|
67
|
+
* Two layers, usable independently:
|
|
68
|
+
* - `renderControl()` dispatches on `trait.controlType` and returns the control's template. It
|
|
69
|
+
* never writes anything; it calls the injected `handleChange` with a per-controlType payload.
|
|
70
|
+
* - `createChangeHandler()` builds the `handleChange` that decodes that payload and calls
|
|
71
|
+
* `options.commit`.
|
|
72
|
+
*
|
|
73
|
+
* The rendered `cx-*` tags are bare tag names: this module imports no component class for them.
|
|
74
|
+
* Each consumer declares the tags it needs in its own `static dependencies`, which is what lets
|
|
75
|
+
* `cx-list-editor` reuse the renderer without pulling in every picker.
|
|
76
|
+
*
|
|
77
|
+
* Context fields and the branches that read them:
|
|
78
|
+
*
|
|
79
|
+
* | Field | Read by | Missing means |
|
|
80
|
+
* | --- | --- | --- |
|
|
81
|
+
* | `onRequestAsset` | gallery / image / other / all / audio / video / icon picker | picker opens no DAM dialog |
|
|
82
|
+
* | `boundary` | asset-transformation, folder / gallery / page / color-swatch picker, list-editor | popup clipping only |
|
|
83
|
+
* | `blockStyles` | corner-position-input-group, font-picker | offsets read 0px, default font family |
|
|
84
|
+
* | `blockAttributes` | default input validation, image-picker record id | validation sees an empty record |
|
|
85
|
+
* | `sortedLanguages`, `defaultLanguage` | list-editor, color-swatch-picker | no translation tab |
|
|
86
|
+
* | `traits` | audio / video picker | no sibling asset-format-picker lookup |
|
|
87
|
+
* | `token`, `baseUrl` | asset-transformation | dialog cannot fetch the asset |
|
|
88
|
+
* | `onRequestDownloadFormat` | download-format-picker | picker inert |
|
|
89
|
+
* | `onRequestAssetFormat` | asset-format-picker | picker inert |
|
|
90
|
+
* | `onConfigureWorkflow` | dam-custom-toolbar-buttons | configure-workflow inert |
|
|
91
|
+
* | `isAfterShow` | color-swatch-picker | the swatch table never loads |
|
|
92
|
+
* | `allowedFolders` | folder-picker with `useAllowedFolders` | unrestricted root |
|
|
93
|
+
*/
|
|
94
|
+
export declare class ControlRenderer {
|
|
95
|
+
private readonly host;
|
|
96
|
+
private readonly options;
|
|
97
|
+
private readonly localize;
|
|
98
|
+
private apiSearchAssets;
|
|
99
|
+
private apiGetTeamSpaceFontFamily;
|
|
100
|
+
private readonly pendingGalleryPickerSaves;
|
|
101
|
+
private readonly fontFamiliesCache;
|
|
102
|
+
/** Space font name per control, to store the space-default option explicitly. */
|
|
103
|
+
private readonly spaceFontFamilyCache;
|
|
104
|
+
private readonly pendingFontFamilyFetches;
|
|
105
|
+
private readonly typeSubtypeOptionsCache;
|
|
106
|
+
private readonly pendingTypeSubtypeOptionsFetches;
|
|
107
|
+
/**
|
|
108
|
+
* Monotonic request counter per `srcKey`, so a slow format lookup cannot write
|
|
109
|
+
* its URL over a newer format's. Keyed by `srcKey` because that is the
|
|
110
|
+
* attribute being written — two traits writing different keys never race.
|
|
111
|
+
*/
|
|
112
|
+
private readonly srcResolveVersions;
|
|
113
|
+
constructor(host: ReactiveControllerHost & HTMLElement, options: ControlRendererOptions);
|
|
114
|
+
/**
|
|
115
|
+
* Builds the `handleChange` for one trait: it decodes the payload that the matching
|
|
116
|
+
* `renderControl` branch emits, then commits one or more key/value writes.
|
|
117
|
+
*/
|
|
118
|
+
createChangeHandler({ key, trait, type, }: {
|
|
119
|
+
key: string;
|
|
120
|
+
trait: PropertyConfig;
|
|
121
|
+
type: ControlValueType;
|
|
122
|
+
}): (newValue: unknown, ...args: unknown[]) => Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Reads the consumer's live state and fills in defaults.
|
|
125
|
+
*
|
|
126
|
+
* Deliberately a getter, invoked at each read site: the default input branch validates
|
|
127
|
+
* against `blockAttributes` after an `await`, so snapshotting the context into a local
|
|
128
|
+
* would turn a live read into a stale one.
|
|
129
|
+
*/
|
|
130
|
+
private get context();
|
|
131
|
+
private handleConfigChange;
|
|
132
|
+
private handleAttributeChange;
|
|
133
|
+
/** Claims the next request slot for `srcKey`; call before the first await. */
|
|
134
|
+
private claimSrcResolveVersion;
|
|
135
|
+
/**
|
|
136
|
+
* Resolves a format URL and returns it only if no newer request for the same
|
|
137
|
+
* `srcKey` was claimed while this one was in flight.
|
|
138
|
+
*
|
|
139
|
+
* The version must be claimed by the caller before its first await: the
|
|
140
|
+
* transformation, format and manual-format commits each suspend on the host
|
|
141
|
+
* update, so a confirmation that pauses there would otherwise claim a newer
|
|
142
|
+
* version on resume and overwrite the confirmation that already committed.
|
|
143
|
+
*/
|
|
144
|
+
private resolveLatestAssetFormatSrc;
|
|
145
|
+
/**
|
|
146
|
+
* Resolves the delivery URL to persist for an asset under a given format.
|
|
147
|
+
*
|
|
148
|
+
* A blank `format` means `Auto`, which is what a reset leaves behind: the proxy is then
|
|
149
|
+
* derived from the asset's own extension and size (`resolveAutoFormat`), matching what
|
|
150
|
+
* the block computes at runtime. Without this the reset would keep whichever URL the
|
|
151
|
+
* previous hand-picked format wrote.
|
|
152
|
+
*
|
|
153
|
+
* `TRX` proxies serve the asset's original file. When that file is not something a
|
|
154
|
+
* browser can display — its extension says so, or its doc type does — fall back to the
|
|
155
|
+
* `TR1` transformation proxy, which is always transcoded to a raster format. Mirrors the
|
|
156
|
+
* same fallback in `FetchImageController` (used by the gallery/timeline blocks) and
|
|
157
|
+
* `cx-asset-transformation-dialog`.
|
|
158
|
+
*/
|
|
159
|
+
private resolveAssetFormatSrc;
|
|
160
|
+
renderControl({ blockAttributes, container, currentValue, disabled, handleChange, key, label, trait, }: {
|
|
161
|
+
blockAttributes: Record<string, any>;
|
|
162
|
+
container?: Ref<HTMLElement>;
|
|
163
|
+
currentValue: unknown;
|
|
164
|
+
disabled?: boolean;
|
|
165
|
+
handleChange: (newValue: unknown, ...args: unknown[]) => Promise<void>;
|
|
166
|
+
key: string;
|
|
167
|
+
label?: string | false;
|
|
168
|
+
trait: PropertyConfig;
|
|
169
|
+
}): import('lit').TemplateResult<1>;
|
|
170
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for the markup that `ControlRenderer.renderControl()` emits.
|
|
3
|
+
*
|
|
4
|
+
* Every consumer of `ControlRenderer` must include this sheet in its `static styles`,
|
|
5
|
+
* otherwise the shared controls render unstyled. The `config-form__*` class prefix is kept
|
|
6
|
+
* from when these rules lived in `config-form.styles.ts` so the moved markup is untouched.
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: import('lit').CSSResult;
|
|
9
|
+
export default _default;
|
|
@@ -1,24 +1,56 @@
|
|
|
1
1
|
import { default as CxButton } from '../../../atoms/src/components/button/button.ts';
|
|
2
|
+
import { default as CxButtonGroup } from '../../../atoms/src/components/button-group/button-group.ts';
|
|
3
|
+
import { default as CxCard } from '../../../atoms/src/components/card/card.ts';
|
|
4
|
+
import { default as CxCheckbox } from '../../../atoms/src/components/checkbox/checkbox.ts';
|
|
2
5
|
import { default as CxDialog } from '../../../atoms/src/components/dialog/dialog.ts';
|
|
6
|
+
import { default as CxDivider } from '../../../atoms/src/components/divider/divider.ts';
|
|
7
|
+
import { default as CxDropdown } from '../../../atoms/src/components/dropdown/dropdown.ts';
|
|
3
8
|
import { default as CxGrid } from '../../../atoms/src/components/grid/grid.ts';
|
|
4
9
|
import { default as CxGridItem } from '../../../atoms/src/components/grid-item/grid-item.ts';
|
|
10
|
+
import { default as CxIcon } from '../../../atoms/src/components/icon/icon.ts';
|
|
5
11
|
import { default as CxInput } from '../../../atoms/src/components/input/input.ts';
|
|
6
12
|
import { default as CxLineClamp } from '../../../atoms/src/components/line-clamp/line-clamp.ts';
|
|
13
|
+
import { default as CxMenu } from '../../../atoms/src/components/menu/menu.ts';
|
|
14
|
+
import { default as CxMenuItem } from '../../../atoms/src/components/menu-item/menu-item.ts';
|
|
7
15
|
import { default as CxOption } from '../../../atoms/src/components/option/option.ts';
|
|
8
16
|
import { default as CxRadio } from '../../../atoms/src/components/radio/radio.ts';
|
|
17
|
+
import { default as CxRadioCard } from '../../../atoms/src/components/radio-card/radio-card.ts';
|
|
9
18
|
import { default as CxRadioGroup } from '../../../atoms/src/components/radio-group/radio-group.ts';
|
|
10
19
|
import { default as CxSelect } from '../../../atoms/src/components/select/select.ts';
|
|
11
20
|
import { default as CxSpace } from '../../../atoms/src/components/space/space.ts';
|
|
21
|
+
import { default as CxSwitch } from '../../../atoms/src/components/switch/switch.ts';
|
|
12
22
|
import { default as CxTab } from '../../../atoms/src/components/tab/tab.ts';
|
|
13
23
|
import { default as CxTabGroup } from '../../../atoms/src/components/tab-group/tab-group.ts';
|
|
14
24
|
import { default as CxTabPanel } from '../../../atoms/src/components/tab-panel/tab-panel.ts';
|
|
25
|
+
import { default as CxTextarea } from '../../../atoms/src/components/textarea/textarea.ts';
|
|
26
|
+
import { default as CxTooltip } from '../../../atoms/src/components/tooltip/tooltip.ts';
|
|
15
27
|
import { default as CxTypography } from '../../../atoms/src/components/typography/typography.ts';
|
|
28
|
+
import { default as CxVisuallyHidden } from '../../../atoms/src/components/visually-hidden/visually-hidden.ts';
|
|
16
29
|
import { default as CortexElement } from '../../../base/src/cortex-element.ts';
|
|
30
|
+
import { default as CxAssetFormatPicker } from '../../../molecules/src/asset-format-picker/asset-format-picker.ts';
|
|
17
31
|
import { default as CxAssetPicker } from '../../../molecules/src/asset-picker/asset-picker.ts';
|
|
32
|
+
import { default as CxBicolorPicker } from '../../../molecules/src/bicolor-picker/bicolor-picker.ts';
|
|
33
|
+
import { default as CxBorderInputGroup } from '../../../molecules/src/border-input-group/border-input-group.ts';
|
|
34
|
+
import { default as CxConfirmPopover } from '../../../molecules/src/confirm-popover/confirm-popover.ts';
|
|
35
|
+
import { default as CxCornerPositionInputGroup } from '../../../molecules/src/corner-position-input-group/corner-position-input-group.ts';
|
|
36
|
+
import { default as CxDownloadFormatPicker } from '../../../molecules/src/download-format-picker/download-format-picker.ts';
|
|
18
37
|
import { default as CxDynamicSelect } from '../../../molecules/src/dynamic-select/dynamic-select.ts';
|
|
38
|
+
import { default as CxFontPicker } from '../../../molecules/src/font-picker/font-picker.ts';
|
|
39
|
+
import { default as CxIconPicker } from '../../../molecules/src/icon-picker/icon-picker.ts';
|
|
40
|
+
import { default as CxPaddingInputGroup } from '../../../molecules/src/padding-input-group/padding-input-group.ts';
|
|
41
|
+
import { default as CxPositionPicker } from '../../../molecules/src/position-picker/position-picker.ts';
|
|
42
|
+
import { default as CxShadowInputGroup } from '../../../molecules/src/shadow-input-group/shadow-input-group.ts';
|
|
43
|
+
import { default as CxSizeInputGroup } from '../../../molecules/src/size-input-group/size-input-group.ts';
|
|
44
|
+
import { default as CxTypeSubtypeSelect } from '../../../molecules/src/type-subtype-select/type-subtype-select.ts';
|
|
45
|
+
import { default as CxAssetTransformationDialog } from '../asset-transformation-dialog/asset-transformation-dialog.ts';
|
|
19
46
|
import { default as CxTable } from '../../../hybrid/table-core/src/index.ts';
|
|
47
|
+
import { AssetFormatValue } from '../../../types/src/asset-format-picker';
|
|
20
48
|
import { Asset, AssetTypeString } from '../../../types/src/content-builder';
|
|
21
|
-
import { CSSResultGroup } from 'lit';
|
|
49
|
+
import { CSSResultGroup, TemplateResult } from 'lit';
|
|
50
|
+
import { CxColorSwatchPicker } from '../content-builder/components/color-swatch-picker';
|
|
51
|
+
import { CxFolderPicker } from '../content-builder/components/folder-picker';
|
|
52
|
+
import { default as CxGalleryPicker } from '../content-builder/components/gallery-picker/gallery-picker';
|
|
53
|
+
import { default as CxPagePicker } from '../content-builder/components/page-picker/page-picker';
|
|
22
54
|
|
|
23
55
|
export declare const columnDefaults: {
|
|
24
56
|
resizable: boolean;
|
|
@@ -32,37 +64,115 @@ declare enum TabType {
|
|
|
32
64
|
*/
|
|
33
65
|
export default class CxListEditor extends CortexElement {
|
|
34
66
|
static readonly styles: CSSResultGroup;
|
|
67
|
+
/**
|
|
68
|
+
* Mirrors `cx-config-form`'s dependency set, because the add/edit dialog renders its
|
|
69
|
+
* controls through the shared `ControlRenderer` and can therefore emit any control type.
|
|
70
|
+
*
|
|
71
|
+
* Two of the config-form tags are deliberately absent:
|
|
72
|
+
* - `cx-dam-custom-toolbar-buttons-editor` imports `cx-list-editor`, so declaring it here
|
|
73
|
+
* would be a module cycle.
|
|
74
|
+
* - `cx-list-editor` itself, since a list editor nested in its own row dialog has no way
|
|
75
|
+
* to receive `columns` / `sampleItem`.
|
|
76
|
+
*
|
|
77
|
+
* `getColumnTrait()` maps both of those control types to a plain input so a column config
|
|
78
|
+
* naming them degrades predictably instead of rendering an unupgraded element.
|
|
79
|
+
*/
|
|
35
80
|
static readonly dependencies: {
|
|
81
|
+
'cx-asset-format-picker': typeof CxAssetFormatPicker;
|
|
36
82
|
'cx-asset-picker': typeof CxAssetPicker;
|
|
83
|
+
'cx-asset-transformation-dialog': typeof CxAssetTransformationDialog;
|
|
84
|
+
'cx-bicolor-picker': typeof CxBicolorPicker;
|
|
85
|
+
'cx-border-input-group': typeof CxBorderInputGroup;
|
|
37
86
|
'cx-button': typeof CxButton;
|
|
87
|
+
'cx-button-group': typeof CxButtonGroup;
|
|
88
|
+
'cx-card': typeof CxCard;
|
|
89
|
+
'cx-checkbox': typeof CxCheckbox;
|
|
90
|
+
'cx-color-swatch-picker': typeof CxColorSwatchPicker;
|
|
91
|
+
'cx-confirm-popover': typeof CxConfirmPopover;
|
|
92
|
+
'cx-corner-position-input-group': typeof CxCornerPositionInputGroup;
|
|
38
93
|
'cx-dialog': typeof CxDialog;
|
|
94
|
+
'cx-divider': typeof CxDivider;
|
|
95
|
+
'cx-download-format-picker': typeof CxDownloadFormatPicker;
|
|
96
|
+
'cx-dropdown': typeof CxDropdown;
|
|
39
97
|
'cx-dynamic-select': typeof CxDynamicSelect;
|
|
98
|
+
'cx-folder-picker': typeof CxFolderPicker;
|
|
99
|
+
'cx-font-picker': typeof CxFontPicker;
|
|
100
|
+
'cx-gallery-picker': typeof CxGalleryPicker;
|
|
40
101
|
'cx-grid': typeof CxGrid;
|
|
41
102
|
'cx-grid-item': typeof CxGridItem;
|
|
103
|
+
'cx-icon': typeof CxIcon;
|
|
104
|
+
'cx-icon-picker': typeof CxIconPicker;
|
|
42
105
|
'cx-input': typeof CxInput;
|
|
43
106
|
'cx-line-clamp': typeof CxLineClamp;
|
|
107
|
+
'cx-menu': typeof CxMenu;
|
|
108
|
+
'cx-menu-item': typeof CxMenuItem;
|
|
44
109
|
'cx-option': typeof CxOption;
|
|
110
|
+
'cx-padding-input-group': typeof CxPaddingInputGroup;
|
|
111
|
+
'cx-page-picker': typeof CxPagePicker;
|
|
112
|
+
'cx-position-picker': typeof CxPositionPicker;
|
|
45
113
|
'cx-radio': typeof CxRadio;
|
|
114
|
+
'cx-radio-card': typeof CxRadioCard;
|
|
46
115
|
'cx-radio-group': typeof CxRadioGroup;
|
|
47
116
|
'cx-select': typeof CxSelect;
|
|
117
|
+
'cx-shadow-input-group': typeof CxShadowInputGroup;
|
|
118
|
+
'cx-size-input-group': typeof CxSizeInputGroup;
|
|
48
119
|
'cx-space': typeof CxSpace;
|
|
120
|
+
'cx-switch': typeof CxSwitch;
|
|
49
121
|
'cx-tab': typeof CxTab;
|
|
50
122
|
'cx-tab-group': typeof CxTabGroup;
|
|
51
123
|
'cx-tab-panel': typeof CxTabPanel;
|
|
52
124
|
'cx-table': typeof CxTable;
|
|
125
|
+
'cx-textarea': typeof CxTextarea;
|
|
126
|
+
'cx-tooltip': typeof CxTooltip;
|
|
127
|
+
'cx-type-subtype-select': typeof CxTypeSubtypeSelect;
|
|
53
128
|
'cx-typography': typeof CxTypography;
|
|
129
|
+
'cx-visually-hidden': typeof CxVisuallyHidden;
|
|
54
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* Control types the shared renderer supports but this component cannot host: both render a
|
|
133
|
+
* `cx-list-editor`, which would nest a list editor inside its own row dialog, and the
|
|
134
|
+
* toolbar-buttons editor imports this module so it cannot be a dependency here.
|
|
135
|
+
*/
|
|
136
|
+
private static readonly UNSUPPORTED_CONTROL_TYPES;
|
|
55
137
|
private readonly localize;
|
|
138
|
+
/**
|
|
139
|
+
* Renders the add/edit dialog's controls. Shared with `cx-config-form` so every
|
|
140
|
+
* content-builder control type is implemented once.
|
|
141
|
+
*
|
|
142
|
+
* `commit` collapses the renderer's attribute / style / property distinction: an item row
|
|
143
|
+
* is a single flat record, so every write lands on `editedItem` under its own key.
|
|
144
|
+
*
|
|
145
|
+
* Values are stored as the renderer emits them, without stringifying. That keeps a
|
|
146
|
+
* `switch` column a real boolean, which is what lets the renderer's checked state fall
|
|
147
|
+
* through to plain truthiness instead of needing `checkedValue` / `uncheckedValue`.
|
|
148
|
+
*/
|
|
149
|
+
private readonly controlRenderer;
|
|
56
150
|
dialog: CxDialog;
|
|
57
151
|
table: CxTable;
|
|
58
|
-
|
|
152
|
+
/**
|
|
153
|
+
* The rows being edited.
|
|
154
|
+
*
|
|
155
|
+
* Field values keep whatever JSON type they were authored or edited with — a `switch`
|
|
156
|
+
* column round-trips a real boolean, not the string `'true'`. The attribute form is JSON,
|
|
157
|
+
* so the type survives serializing to a block attribute and parsing back.
|
|
158
|
+
*/
|
|
159
|
+
data: Array<Record<string, unknown>>;
|
|
59
160
|
canAdd: boolean;
|
|
60
161
|
addDialogLabel: string;
|
|
61
162
|
editDialogLabel: string;
|
|
62
163
|
displayField: string;
|
|
63
164
|
descriptionField: string;
|
|
64
165
|
addItemText: string;
|
|
65
|
-
sampleItem: Record<string,
|
|
166
|
+
sampleItem: Record<string, unknown>;
|
|
167
|
+
/**
|
|
168
|
+
* Values from the surrounding scope, keyed by column `field`, shown when an item has not
|
|
169
|
+
* overridden that field. For the content builder these are the block's own styles and
|
|
170
|
+
* attributes, so a section's controls start out showing what the block applies to it.
|
|
171
|
+
*
|
|
172
|
+
* Display only: nothing here is written into the item. The item stays unset until the user
|
|
173
|
+
* changes the control, which is what keeps it inheriting when the block value later changes.
|
|
174
|
+
*/
|
|
175
|
+
inheritedValues: Record<string, unknown>;
|
|
66
176
|
useEvents: boolean;
|
|
67
177
|
sortable: boolean;
|
|
68
178
|
loadingEvent: string;
|
|
@@ -89,11 +199,48 @@ export default class CxListEditor extends CortexElement {
|
|
|
89
199
|
* @default undefined
|
|
90
200
|
*/
|
|
91
201
|
onRequestAsset: ((type: AssetTypeString, multiple?: boolean, accepts?: string[]) => Promise<Asset | Record<string, Asset>>) | undefined;
|
|
92
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Base URL forwarded to the dialog's `cx-asset-transformation-dialog`.
|
|
204
|
+
* Only needed when a column uses the `asset-transformation` control.
|
|
205
|
+
*/
|
|
206
|
+
baseUrl: string;
|
|
207
|
+
/**
|
|
208
|
+
* Auth token forwarded to the dialog's `cx-asset-transformation-dialog`.
|
|
209
|
+
* Only needed when a column uses the `asset-transformation` control.
|
|
210
|
+
*/
|
|
211
|
+
token: string;
|
|
212
|
+
/**
|
|
213
|
+
* Restricts the dialog's `cx-folder-picker` to these folders.
|
|
214
|
+
* Only applies when a column sets `folderPickerConfigs.useAllowedFolders`.
|
|
215
|
+
*/
|
|
216
|
+
allowedFolders: string[];
|
|
217
|
+
/**
|
|
218
|
+
* Function forwarded to the dialog's `cx-download-format-picker`.
|
|
219
|
+
* @default undefined
|
|
220
|
+
*/
|
|
221
|
+
onRequestDownloadFormat: ((assetIds: string[], formats?: Record<string, string[]>) => Promise<Record<string, string[]>>) | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Function forwarded to the dialog's `cx-asset-format-picker`.
|
|
224
|
+
* @default undefined
|
|
225
|
+
*/
|
|
226
|
+
onRequestAssetFormat: ((assetId: string, value?: AssetFormatValue) => Promise<AssetFormatValue | null | undefined>) | undefined;
|
|
227
|
+
editedItem: Record<string, unknown> | null;
|
|
93
228
|
isAdding: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* True once the add/edit dialog has finished opening. The `color-swatch-picker` control
|
|
231
|
+
* defers loading its table until then, so it must be threaded into the renderer context.
|
|
232
|
+
*/
|
|
233
|
+
private isDialogAfterShow;
|
|
94
234
|
private columnsMap;
|
|
95
235
|
private sortedEntries;
|
|
96
236
|
private translatableControls;
|
|
237
|
+
/**
|
|
238
|
+
* `columns` adapted to traits, rebuilt only when `columns` changes.
|
|
239
|
+
*
|
|
240
|
+
* The audio/video-picker controls look up a sibling `asset-format-picker` trait, so the
|
|
241
|
+
* renderer needs the whole set. Building it per read would be quadratic in column count.
|
|
242
|
+
*/
|
|
243
|
+
private columnTraits;
|
|
97
244
|
private disableCloseConfigDialog;
|
|
98
245
|
get tabs(): TabType[];
|
|
99
246
|
handleColumnsChange(): void;
|
|
@@ -108,9 +255,37 @@ export default class CxListEditor extends CortexElement {
|
|
|
108
255
|
private handleTableRowMoved;
|
|
109
256
|
private handleAssetRequestStatus;
|
|
110
257
|
handleLoadingEventChange(): Promise<void>;
|
|
111
|
-
private
|
|
258
|
+
private handleDialogAfterShow;
|
|
259
|
+
private handleDialogAfterHide;
|
|
260
|
+
/**
|
|
261
|
+
* Adapts one column config into the `PropertyConfig` the shared renderer consumes.
|
|
262
|
+
*
|
|
263
|
+
* The column is spread through untouched, so a column can set any renderer option
|
|
264
|
+
* (`options`, `api`, `clearable`, `selectConfigs`, …) directly. Only the fields the
|
|
265
|
+
* list editor has to own are overridden.
|
|
266
|
+
*/
|
|
267
|
+
private getColumnTrait;
|
|
268
|
+
/**
|
|
269
|
+
* Evaluates a column's `show`, which is either a literal or a predicate over the item being
|
|
270
|
+
* edited — the same contract `cx-config-form` uses for block traits. Because this runs from
|
|
271
|
+
* the `editedItem` watcher, toggling one control re-evaluates the rest.
|
|
272
|
+
*/
|
|
273
|
+
private isColumnVisible;
|
|
274
|
+
/**
|
|
275
|
+
* Resolves what a column's control displays: the item's own value, else the inherited
|
|
276
|
+
* value from the surrounding scope, else the column default.
|
|
277
|
+
*
|
|
278
|
+
* `undefined` and `''` count as not overridden — an emptied control means "inherit". A
|
|
279
|
+
* `false` from a switch does not, so the check is explicit rather than a falsy test.
|
|
280
|
+
*/
|
|
281
|
+
private getColumnValue;
|
|
282
|
+
private renderColumnControl;
|
|
283
|
+
/** Renders the children of a `group` column, which are traits rather than columns. */
|
|
284
|
+
private renderGroupChildren;
|
|
285
|
+
/** A horizontal group child's width as a percentage, or 0 when it has none. */
|
|
286
|
+
private resolveChildWidth;
|
|
112
287
|
private renderControls;
|
|
113
|
-
render():
|
|
288
|
+
render(): TemplateResult<1>;
|
|
114
289
|
}
|
|
115
290
|
declare global {
|
|
116
291
|
interface HTMLElementTagNameMap {
|