@orangelogic/orange-dam-content-browser-sdk 2.3.6 → 2.3.7-table-view-beta-2
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/build/GlobalConfigContext.d.ts +3 -0
- package/build/OrangeDAMContentBrowserSDK.min.js +782 -326
- package/build/api/asset/asset.d.ts +2 -1
- package/build/components/content-browser/content-browser.d.ts +37 -2
- package/build/components/content-browser-asset-card/content-browser-asset-card.d.ts +17 -1
- package/build/components/content-browser-control-bar/content-browser-control-bar.d.ts +1 -0
- package/build/components/content-browser-control-view/content-browser-control-view.d.ts +5 -2
- package/build/components/content-browser-format-dialog/content-browser-format-dialog.d.ts +27 -1
- package/build/components/content-browser-grid/content-browser-grid.d.ts +5 -1
- package/build/components/content-browser-grid/scroll-anchor-controller.d.ts +12 -1
- package/build/components/content-browser-table/content-browser-table.d.ts +178 -0
- package/build/components/content-browser-table/content-browser-table.styles.d.ts +2 -0
- package/build/content-browser.mjs +1725 -474
- package/build/events/cx-content-browser-control-view-change.d.ts +2 -2
- package/build/events/cx-content-browser-request-change.d.ts +2 -2
- package/build/events/cx-content-browser-table-column-resize.d.ts +16 -0
- package/build/events/index.d.ts +1 -0
- package/build/index.d.ts +29 -2
- package/build/index.html +4 -0
- package/build/index.mjs +1694 -425
- package/build/tools/fetch-and-merge-assets.d.ts +10 -1
- package/build/types/asset.d.ts +5 -0
- package/build/types/content-browser.d.ts +53 -0
- package/package.json +1 -1
|
@@ -30,7 +30,8 @@ export declare function resolveAssetExtraFilters(selectedFacets?: Record<string,
|
|
|
30
30
|
};
|
|
31
31
|
export declare function apiGetAssetLinks({ assets, extension, extraFields, parameters, permanentLink, proxyPreference, transformations, useSession, }: GetAssetLinksRequest): Promise<GetAssetLinksResponse>;
|
|
32
32
|
export declare function apiGetAssetsByIDs({ extraFields, recordIds, }: GetAssetsByIDsRequest): Promise<GetAssetsByIDsResponse>;
|
|
33
|
-
export declare
|
|
33
|
+
export declare const ASSET_LIST_FIELDS: string[];
|
|
34
|
+
export declare function apiGetAssets({ fields, folderId, isSeeThrough, limitedToDocTypes, pageSize, searchText, selectedFacets, sortOrder, start, useSession, }: GetAssetsRequest): Promise<GetAssetsResponse>;
|
|
34
35
|
export declare function apiGetAvailableProxies({ assetRecordId, siteUrl, }: {
|
|
35
36
|
assetRecordId: string;
|
|
36
37
|
siteUrl?: string;
|
|
@@ -6,7 +6,8 @@ import CxContentBrowserFormatDialog from '../../components/content-browser-forma
|
|
|
6
6
|
import CxContentBrowserGrid from '../../components/content-browser-grid/content-browser-grid';
|
|
7
7
|
import CxContentBrowserHeader from '../../components/content-browser-header/content-browser-header';
|
|
8
8
|
import CxContentBrowserNoResult from '../../components/content-browser-no-result/content-browser-no-result';
|
|
9
|
-
import
|
|
9
|
+
import CxContentBrowserTable from '../../components/content-browser-table/content-browser-table';
|
|
10
|
+
import { type AutoSelectFormat, type ContentBrowserView, type CtaTextTransform, type TableColumn } from '../../types/content-browser';
|
|
10
11
|
import { GetFolderRequest } from '../../types/folder';
|
|
11
12
|
import CxIcon from '@orangelogic/design-system/components/icon';
|
|
12
13
|
import CxIconButton from '@orangelogic/design-system/components/icon-button';
|
|
@@ -18,6 +19,7 @@ export declare const COMPUTED_FIELDS: string[];
|
|
|
18
19
|
* @summary CxContentBrowser
|
|
19
20
|
*/
|
|
20
21
|
export default class CxContentBrowser extends CortexElement {
|
|
22
|
+
#private;
|
|
21
23
|
static readonly styles: CSSResultGroup;
|
|
22
24
|
static readonly dependencies: {
|
|
23
25
|
'cx-content-browser-browser': typeof CxContentBrowserBrowser;
|
|
@@ -26,6 +28,7 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
26
28
|
'cx-content-browser-grid': typeof CxContentBrowserGrid;
|
|
27
29
|
'cx-content-browser-header': typeof CxContentBrowserHeader;
|
|
28
30
|
'cx-content-browser-no-result': typeof CxContentBrowserNoResult;
|
|
31
|
+
'cx-content-browser-table': typeof CxContentBrowserTable;
|
|
29
32
|
'cx-icon': typeof CxIcon;
|
|
30
33
|
'cx-icon-button': typeof CxIconButton;
|
|
31
34
|
'cx-resize-observer': typeof CxResizeObserver;
|
|
@@ -62,6 +65,10 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
62
65
|
* shows the asset's LargeSizePreview and confirming emits the asset straight to the host.
|
|
63
66
|
* Implies `can-use-proxies=false`.
|
|
64
67
|
*/
|
|
68
|
+
/**
|
|
69
|
+
* Host-level import behaviour; forwarded to the format dialog. See `AutoSelectFormat`.
|
|
70
|
+
*/
|
|
71
|
+
autoSelectFormat: AutoSelectFormat;
|
|
65
72
|
simplePick: boolean;
|
|
66
73
|
canViewVersions: boolean;
|
|
67
74
|
canTrack: boolean;
|
|
@@ -69,7 +76,13 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
69
76
|
ctaText: string;
|
|
70
77
|
ctaTextTransform: CtaTextTransform;
|
|
71
78
|
extraFields: string[];
|
|
72
|
-
defaultGridView:
|
|
79
|
+
defaultGridView: ContentBrowserView;
|
|
80
|
+
/**
|
|
81
|
+
* Columns of the table view, defined by the host: a title, the Cortex field the column reads, and
|
|
82
|
+
* its styling. The table view is offered only while this is non-empty — an empty table is not a
|
|
83
|
+
* view mode — and the fields are read once, when the fetch controller is created.
|
|
84
|
+
*/
|
|
85
|
+
tableColumns: TableColumn[];
|
|
73
86
|
defaultSortOrderName: string;
|
|
74
87
|
defaultSortDirection: 'ascending' | 'descending';
|
|
75
88
|
defaultSelectedFacets: Record<string, string[]>;
|
|
@@ -97,6 +110,15 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
97
110
|
private defaultPageSize;
|
|
98
111
|
private fetchAndMergeAssetsController;
|
|
99
112
|
willUpdate(changedProperties: PropertyValues): void;
|
|
113
|
+
/**
|
|
114
|
+
* Never trust the host's value: it also arrives by direct property assignment, past the converter.
|
|
115
|
+
* Entries are checked one by one, not just the outer array — `field` is dereferenced while the
|
|
116
|
+
* fetch controller is being built, where a throw leaves the controller unassigned and the picker
|
|
117
|
+
* blank. `title` is only rendered, and Lit renders a nullish one as nothing, so a column is not
|
|
118
|
+
* worth dropping over it.
|
|
119
|
+
*/
|
|
120
|
+
private get tableColumnList();
|
|
121
|
+
private get canUseTable();
|
|
100
122
|
runFirstUpdated(): void;
|
|
101
123
|
fetchAssets(request: GetAssetsRequest): Promise<import("../../api/asset/asset.types").GetAssetsResponse>;
|
|
102
124
|
fetchFolders(request: GetFolderRequest): Promise<import("../../types/folder").GetFolderResponse>;
|
|
@@ -106,8 +128,20 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
106
128
|
* pin/unpin request (see `cx-content-browser-pin-asset-change`) to reflect the result.
|
|
107
129
|
*/
|
|
108
130
|
setIsAssetPinned(isAssetPinned: boolean): void;
|
|
131
|
+
/**
|
|
132
|
+
* The asset a click is still working on, or undefined. The two private flags below drive the
|
|
133
|
+
* guards; this drives the UI, and is a separate field because they are plain fields rather than
|
|
134
|
+
* reactive state.
|
|
135
|
+
*
|
|
136
|
+
* Cleared the moment the format dialog actually opens: from there the dialog's own confirm button
|
|
137
|
+
* carries the pending state, and two spinners for one operation reads as two operations. It
|
|
138
|
+
* survives when no dialog opens, which is the auto-confirm path, where the CTA is the only thing
|
|
139
|
+
* the user can be told anything by.
|
|
140
|
+
*/
|
|
141
|
+
private busyAssetId;
|
|
109
142
|
private openFormatDialog;
|
|
110
143
|
handleLastRequestChange(): Promise<void>;
|
|
144
|
+
handleTableColumnsChange(): void;
|
|
111
145
|
handleAuthChange(): void;
|
|
112
146
|
handleSiteSessionChange(): void;
|
|
113
147
|
private handleSortOrderChange;
|
|
@@ -127,6 +161,7 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
127
161
|
*/
|
|
128
162
|
private handlePinAssetChange;
|
|
129
163
|
private handleProxyConfirm;
|
|
164
|
+
private reportProxyConfirmFailure;
|
|
130
165
|
private handleFormatConfirm;
|
|
131
166
|
private handleFormatDialogClose;
|
|
132
167
|
private handleSelectedAsset;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CSSResultGroup } from 'lit';
|
|
2
2
|
import CortexElement from '../../base/element';
|
|
3
3
|
import { MediaType } from '../../types/asset';
|
|
4
|
-
import { GridView } from '../../types/content-browser';
|
|
4
|
+
import { type CtaTextTransform, GridView } from '../../types/content-browser';
|
|
5
5
|
import CxArrayLineClamp from '@orangelogic/design-system/components/array-line-clamp';
|
|
6
|
+
import CxButton from '@orangelogic/design-system/components/button';
|
|
6
7
|
import CxCard from '@orangelogic/design-system/components/card';
|
|
7
8
|
import CxCheckbox from '@orangelogic/design-system/components/checkbox';
|
|
8
9
|
import CxLineClamp from '@orangelogic/design-system/components/line-clamp';
|
|
@@ -14,6 +15,7 @@ export default class CxContentBrowserAssetCard extends CortexElement {
|
|
|
14
15
|
static readonly styles: CSSResultGroup;
|
|
15
16
|
static readonly dependencies: {
|
|
16
17
|
'cx-array-line-clamp': typeof CxArrayLineClamp;
|
|
18
|
+
'cx-button': typeof CxButton;
|
|
17
19
|
'cx-card': typeof CxCard;
|
|
18
20
|
'cx-checkbox': typeof CxCheckbox;
|
|
19
21
|
'cx-content-browser-asset-preview': typeof CxContentBrowserAssetPreview;
|
|
@@ -22,6 +24,20 @@ export default class CxContentBrowserAssetCard extends CortexElement {
|
|
|
22
24
|
'cx-tag': typeof CxTag;
|
|
23
25
|
'cx-typography': typeof CxTypography;
|
|
24
26
|
};
|
|
27
|
+
private readonly localize;
|
|
28
|
+
/**
|
|
29
|
+
* Show the hover overlay that says clicking this card inserts. Set when the host has asked to
|
|
30
|
+
* skip the format picker: without the dialog a click hands the asset over immediately, and the
|
|
31
|
+
* card would otherwise carry no sign of that.
|
|
32
|
+
*/
|
|
33
|
+
showCta: boolean;
|
|
34
|
+
ctaText: string;
|
|
35
|
+
ctaTextTransform: CtaTextTransform;
|
|
36
|
+
/**
|
|
37
|
+
* This card's insert is still running: hold the overlay open and spin its CTA, so the feedback
|
|
38
|
+
* does not vanish the moment the pointer leaves.
|
|
39
|
+
*/
|
|
40
|
+
busy: boolean;
|
|
25
41
|
imageUrl: string;
|
|
26
42
|
originalUrl: string;
|
|
27
43
|
scrubUrl: string;
|
|
@@ -10,7 +10,7 @@ import CxSpace from '@orangelogic/design-system/components/space';
|
|
|
10
10
|
import CxSwitch from '@orangelogic/design-system/components/switch';
|
|
11
11
|
import CxTooltip from '@orangelogic/design-system/components/tooltip';
|
|
12
12
|
import CortexElement from '../../base/element';
|
|
13
|
-
import {
|
|
13
|
+
import { type ContentBrowserView, ControlOption } from '../../types/content-browser';
|
|
14
14
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
15
15
|
/**
|
|
16
16
|
* @summary DAM view control toolbar for selecting asset view modes and toggling options.
|
|
@@ -41,14 +41,17 @@ export default class CxContentBrowserControlView extends CortexElement {
|
|
|
41
41
|
'cx-tooltip': typeof CxTooltip;
|
|
42
42
|
};
|
|
43
43
|
private readonly localize;
|
|
44
|
-
view:
|
|
44
|
+
view: ContentBrowserView;
|
|
45
45
|
views: ControlOption[];
|
|
46
46
|
isSeeThrough: boolean;
|
|
47
47
|
isMobile: boolean;
|
|
48
|
+
canUseTable: boolean;
|
|
48
49
|
private selectedView;
|
|
50
|
+
private get isTable();
|
|
49
51
|
runConnectedCallback(): void;
|
|
50
52
|
private handleSeeThroughClick;
|
|
51
53
|
private handleViewSelect;
|
|
54
|
+
private renderTableOption;
|
|
52
55
|
handleViewChange(): void;
|
|
53
56
|
render(): TemplateResult;
|
|
54
57
|
}
|
|
@@ -15,7 +15,7 @@ import CxTypography from '@orangelogic/design-system/components/typography';
|
|
|
15
15
|
import CxContentBrowserAssetPreview from '../content-browser-asset-preview/content-browser-asset-preview';
|
|
16
16
|
import CxContentBrowserAssetProxySelector from '../content-browser-asset-proxy-selector/content-browser-asset-proxy-selector';
|
|
17
17
|
import CxContentBrowserAssetVersionHistory from '../content-browser-asset-version-history/content-browser-asset-version-history';
|
|
18
|
-
import { type Parameter, type Transformation, type CtaTextTransform, ContentBrowserFormatDialogVariant } from '../../types/content-browser';
|
|
18
|
+
import { type Parameter, type Transformation, type CtaTextTransform, type AutoSelectFormat, ContentBrowserFormatDialogVariant } from '../../types/content-browser';
|
|
19
19
|
export default class CxContentBrowserFormatDialog extends CortexElement {
|
|
20
20
|
static readonly styles: CSSResultGroup;
|
|
21
21
|
static readonly dependencies: {
|
|
@@ -47,6 +47,12 @@ export default class CxContentBrowserFormatDialog extends CortexElement {
|
|
|
47
47
|
canPinAsset: boolean;
|
|
48
48
|
canTrack: boolean;
|
|
49
49
|
canUseProxies: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Skip the format picker and insert directly — see `resolveAutoSelection` for what each value
|
|
52
|
+
* does. Off by default: this changes what a click does, so a host opts in rather than
|
|
53
|
+
* inheriting it.
|
|
54
|
+
*/
|
|
55
|
+
autoSelectFormat: AutoSelectFormat;
|
|
50
56
|
/**
|
|
51
57
|
* Pick-only mode. Suppresses the custom-format editor entirely: cx-asset-link-format issues its
|
|
52
58
|
* own transformasset request as soon as it is in the DOM, so hiding it with CSS is not enough.
|
|
@@ -92,7 +98,19 @@ export default class CxContentBrowserFormatDialog extends CortexElement {
|
|
|
92
98
|
trackingParameters: Parameter[];
|
|
93
99
|
private get shouldAppendAutoExtension();
|
|
94
100
|
private get canUseATS();
|
|
101
|
+
private filterProxies;
|
|
95
102
|
handleSupportedExtensionsChange(): void;
|
|
103
|
+
/**
|
|
104
|
+
* What `autoSelectFormat` resolves to for this asset: the proxy to insert with, or `undefined`
|
|
105
|
+
* when the dialog should open as usual.
|
|
106
|
+
*
|
|
107
|
+
* `{ proxy: undefined }` is deliberate rather than a miss — with the picker switched off there is
|
|
108
|
+
* no format to name and the original file is the only outcome, which is `handleProxyConfirm`'s
|
|
109
|
+
* no-proxy branch. With the picker on a proxy must actually resolve: confirming none emits
|
|
110
|
+
* nothing and would turn the click into a silent no-op, so both an empty proxy list and a format
|
|
111
|
+
* name that matches nothing fall back to the dialog.
|
|
112
|
+
*/
|
|
113
|
+
private resolveAutoSelection;
|
|
96
114
|
open({ asset, isFavorite, isAssetPinned, proxies, }: {
|
|
97
115
|
asset: Asset & {
|
|
98
116
|
previewUrl: string;
|
|
@@ -102,6 +120,14 @@ export default class CxContentBrowserFormatDialog extends CortexElement {
|
|
|
102
120
|
proxies: AvailableProxy[];
|
|
103
121
|
}): void;
|
|
104
122
|
hide(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Show a dialog that `open()` skipped through the auto-confirm shortcut. The asset, proxies and
|
|
125
|
+
* resolved selection are still in place, so this lands the user on exactly the dialog the
|
|
126
|
+
* shortcut spared them, with its confirm button live again to retry.
|
|
127
|
+
*/
|
|
128
|
+
revealAfterAutoConfirm(): void;
|
|
129
|
+
/** Whether the dialog is actually on screen — false when `open()` took the auto-confirm path. */
|
|
130
|
+
get isDialogOpen(): boolean;
|
|
105
131
|
setVersionHistory(versions: AssetVersion[]): void;
|
|
106
132
|
setIsFavorite(isFavorite: boolean): void;
|
|
107
133
|
setIsAssetPinned(isAssetPinned: boolean): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@lit-labs/virtualizer';
|
|
2
2
|
import CortexElement from '../../base/element';
|
|
3
3
|
import { Asset } from '../../types/asset';
|
|
4
|
-
import { GridView } from '../../types/content-browser';
|
|
4
|
+
import { GridView, type CtaTextTransform } from '../../types/content-browser';
|
|
5
5
|
import CxProgressBar from '@orangelogic/design-system/components/progress-bar';
|
|
6
6
|
import CxResizeObserver from '@orangelogic/design-system/components/resize-observer';
|
|
7
7
|
import CxContentBrowserAssetCard from '../content-browser-asset-card/content-browser-asset-card';
|
|
@@ -28,6 +28,10 @@ export default class CxContentBrowserGrid extends CortexElement {
|
|
|
28
28
|
showSize: boolean;
|
|
29
29
|
showDimensions: boolean;
|
|
30
30
|
showTags: boolean;
|
|
31
|
+
showCta: boolean;
|
|
32
|
+
ctaText: string;
|
|
33
|
+
ctaTextTransform: CtaTextTransform;
|
|
34
|
+
busyAssetId: string | undefined;
|
|
31
35
|
selectedAssetId: string | undefined;
|
|
32
36
|
assetMap: Map<string, Asset>;
|
|
33
37
|
columnWidth: number;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
-
type
|
|
2
|
+
type ScrollAnchorLayoutSource = {
|
|
3
3
|
layoutComplete?: Promise<unknown>;
|
|
4
4
|
};
|
|
5
|
+
type ScrollAnchorContainer = HTMLElement & ScrollAnchorLayoutSource;
|
|
5
6
|
type ScrollAnchorControllerOptions = {
|
|
6
7
|
getContainer: () => ScrollAnchorContainer | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Distance from the scroller's content origin down to the top of row 0 -- the height of whatever
|
|
10
|
+
* leads the content, such as a sticky header. Defaults to 0: the rows start at the origin.
|
|
11
|
+
*/
|
|
12
|
+
getContentOffset?: () => number;
|
|
7
13
|
getItemIndexById: (id: string) => number;
|
|
14
|
+
/**
|
|
15
|
+
* The object whose `layoutComplete` a restore waits on. Defaults to the container, which carries
|
|
16
|
+
* it when the virtualizer is itself the scroller.
|
|
17
|
+
*/
|
|
18
|
+
getLayoutSource?: () => ScrollAnchorLayoutSource | undefined;
|
|
8
19
|
itemSelector: string;
|
|
9
20
|
};
|
|
10
21
|
export default class ScrollAnchorController implements ReactiveController {
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import '@lit-labs/virtualizer';
|
|
2
|
+
import CortexElement from '../../base/element';
|
|
3
|
+
import { Asset } from '../../types/asset';
|
|
4
|
+
import { type CtaTextTransform, TableColumn } from '../../types/content-browser';
|
|
5
|
+
import CxButton from '@orangelogic/design-system/components/button';
|
|
6
|
+
import CxLineClamp from '@orangelogic/design-system/components/line-clamp';
|
|
7
|
+
import CxProgressBar from '@orangelogic/design-system/components/progress-bar';
|
|
8
|
+
import CxResizeObserver from '@orangelogic/design-system/components/resize-observer';
|
|
9
|
+
import CxTypography from '@orangelogic/design-system/components/typography';
|
|
10
|
+
import CxContentBrowserNoResult from '../content-browser-no-result/content-browser-no-result';
|
|
11
|
+
import type { CSSResultGroup } from 'lit';
|
|
12
|
+
export declare const ROW_HEIGHT = 40;
|
|
13
|
+
/**
|
|
14
|
+
* The action column is an explicit track, not an implicit one. Left implicit, the grid sizes it
|
|
15
|
+
* from content *after* distributing free space, so a host's fractional track (`minmax(0, 2fr)` on
|
|
16
|
+
* Title) is computed against a width the button then eats into and the last text column is clipped.
|
|
17
|
+
* `max-content` is stable across rows because every row's button carries the same label.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ACTION_COLUMN_TRACK = "max-content";
|
|
20
|
+
/** Narrow enough to be a deliberate choice, wide enough that a column never becomes a sliver. */
|
|
21
|
+
export declare const MIN_COLUMN_WIDTH = 48;
|
|
22
|
+
/**
|
|
23
|
+
* The widest a column may be dragged. The table scrolls horizontally, so there is no layout-derived
|
|
24
|
+
* maximum any more, but a bound is still needed twice over: a stray pointer event must not be able
|
|
25
|
+
* to produce an absurd track, and the separator has to report a real `aria-valuemax`. Fixed rather
|
|
26
|
+
* than measured, so the range is a constant and render costs no layout read.
|
|
27
|
+
*/
|
|
28
|
+
export declare const MAX_COLUMN_WIDTH = 2000;
|
|
29
|
+
/** Keyboard resize step, in pixels; Shift takes the larger one. */
|
|
30
|
+
export declare const COLUMN_RESIZE_STEP = 8;
|
|
31
|
+
export declare const COLUMN_RESIZE_STEP_LARGE = 32;
|
|
32
|
+
/**
|
|
33
|
+
* The header and the virtualized rows are separate grids that must always resolve the same track
|
|
34
|
+
* list. Publishing it as one custom property on the host keeps them in step, and lets a drag
|
|
35
|
+
* repaint by writing a single property instead of re-rendering every visible row.
|
|
36
|
+
*/
|
|
37
|
+
export declare const TABLE_COLUMNS_PROPERTY = "--cx-content-browser-table-columns";
|
|
38
|
+
/**
|
|
39
|
+
* Raises a flexible track's base size to `MIN_COLUMN_WIDTH`.
|
|
40
|
+
*
|
|
41
|
+
* `min-width: min-content` on the grids is what carries the table past its scrollport, but it also
|
|
42
|
+
* means the grid is sized under a min-content constraint, and a flexible track resolves to its
|
|
43
|
+
* *base* size under one. `minmax(0, 1fr)` has a base size of 0, so every flexible column collapsed
|
|
44
|
+
* the moment the table overflowed: its title and cells clipped away and its resize handle trapped
|
|
45
|
+
* inside a zero-width clipping cell, where the pointer cannot reach it to drag the column back.
|
|
46
|
+
* Flooring the base at the width a drag already refuses to go below keeps the column reachable, and
|
|
47
|
+
* covers a host-authored `minmax(0, 2fr)` or bare `2fr` the same way it covers the default.
|
|
48
|
+
*/
|
|
49
|
+
export declare function floorFlexibleTrack(track: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Column values ride on the asset under the Cortex field name as requested (see `apiGetAssets`),
|
|
52
|
+
* which `Asset` cannot declare because the field set is the host's, not the SDK's.
|
|
53
|
+
*/
|
|
54
|
+
export declare function readCellValue(asset: Asset, field: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* @summary Table layout for the Content Browser: one row per asset, host-configured metadata columns
|
|
57
|
+
* instead of a thumbnail.
|
|
58
|
+
*
|
|
59
|
+
* @description Renders the same asset list the grid does and emits the same item events, so an asset
|
|
60
|
+
* with no rendition — a text fragment, `digitized = 0` — is browsable and selectable by its
|
|
61
|
+
* identifying fields. It fetches nothing of its own: a row exists, and a cell has a value, only
|
|
62
|
+
* because the search response the grid also consumes carried it.
|
|
63
|
+
*
|
|
64
|
+
* @event cx-content-browser-grid-click - Emitted when a row is activated by click or keyboard.
|
|
65
|
+
* @event cx-content-browser-grid-resize - Emitted with the visible row count so the host can grow the page size.
|
|
66
|
+
* @event cx-content-browser-grid-scroll-end - Emitted when the row list is scrolled to the end.
|
|
67
|
+
* @event cx-content-browser-table-column-resize - Emitted when a column settles on a new width: a
|
|
68
|
+
* drag released, a keyboard step, or a reset by double click or Home. `detail.width` is the pixel
|
|
69
|
+
* width, or `undefined` when the column was reset to the track the host configured. Resized widths
|
|
70
|
+
* are session-only -- the SDK has no storage that survives a reload -- so this event is the host's
|
|
71
|
+
* only chance to persist them.
|
|
72
|
+
*/
|
|
73
|
+
export default class CxContentBrowserTable extends CortexElement {
|
|
74
|
+
#private;
|
|
75
|
+
static readonly styles: CSSResultGroup;
|
|
76
|
+
static readonly dependencies: {
|
|
77
|
+
'cx-button': typeof CxButton;
|
|
78
|
+
'cx-content-browser-no-result': typeof CxContentBrowserNoResult;
|
|
79
|
+
'cx-line-clamp': typeof CxLineClamp;
|
|
80
|
+
'cx-progress-bar': typeof CxProgressBar;
|
|
81
|
+
'cx-resize-observer': typeof CxResizeObserver;
|
|
82
|
+
'cx-typography': typeof CxTypography;
|
|
83
|
+
};
|
|
84
|
+
private readonly localize;
|
|
85
|
+
private readonly containerEl;
|
|
86
|
+
private readonly headEl;
|
|
87
|
+
private readonly bodyEl;
|
|
88
|
+
assets: Asset[];
|
|
89
|
+
columns: TableColumn[];
|
|
90
|
+
ctaText: string;
|
|
91
|
+
ctaTextTransform: CtaTextTransform;
|
|
92
|
+
empty: boolean;
|
|
93
|
+
hasMore: boolean;
|
|
94
|
+
loading: boolean;
|
|
95
|
+
selectedAssetId: string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* The asset whose insert is still running, so its row keeps the CTA on screen and spinning.
|
|
98
|
+
*/
|
|
99
|
+
busyAssetId: string | undefined;
|
|
100
|
+
assetMap: Map<string, Asset>;
|
|
101
|
+
/** Widths the user has dragged, in pixels, keyed by the column's Cortex field. */
|
|
102
|
+
private columnWidths;
|
|
103
|
+
private readonly scrollAnchorController;
|
|
104
|
+
constructor();
|
|
105
|
+
/** One authored track per configured column, in order. The action track is not one of them. */
|
|
106
|
+
private buildColumnTracks;
|
|
107
|
+
private buildTemplateColumns;
|
|
108
|
+
private get templateColumns();
|
|
109
|
+
private resolveColumnWidth;
|
|
110
|
+
private clampColumnWidth;
|
|
111
|
+
private commitColumnWidth;
|
|
112
|
+
/**
|
|
113
|
+
* Kept off the reactive path: its only effect is the cursor, the text selection and the handle
|
|
114
|
+
* colour, while a reactive toggle would rebind `renderItem` and re-render every visible row twice
|
|
115
|
+
* per drag.
|
|
116
|
+
*/
|
|
117
|
+
private setResizingClass;
|
|
118
|
+
private bindFallbackListeners;
|
|
119
|
+
private releaseFallbackListeners;
|
|
120
|
+
/**
|
|
121
|
+
* With the fallback bound, an event dispatched at the handle reaches the handle's own binding and
|
|
122
|
+
* then the document one, running every terminal handler twice. The fallback owns the whole drag on
|
|
123
|
+
* that path, so the element-level delivery is dropped.
|
|
124
|
+
*/
|
|
125
|
+
private isHandledByFallback;
|
|
126
|
+
/** Every trace of a drag: the state the track-list publish is gated on, the cursor, the fallback. */
|
|
127
|
+
private endResize;
|
|
128
|
+
private handleResizeStart;
|
|
129
|
+
/**
|
|
130
|
+
* The track list a running drag owns, built against the columns rendering right now: the committed
|
|
131
|
+
* widths with the drag's own preview over the top. Falls back to the committed list when no drag is
|
|
132
|
+
* running, so one expression covers both.
|
|
133
|
+
*/
|
|
134
|
+
private get previewTemplateColumns();
|
|
135
|
+
/** Repaints the drag with one property write: no re-render, no layout read. */
|
|
136
|
+
private previewColumnWidth;
|
|
137
|
+
private handleResizeMove;
|
|
138
|
+
private handleResizeEnd;
|
|
139
|
+
/**
|
|
140
|
+
* A gesture the user agent took away was never a decision: restore the committed track list and
|
|
141
|
+
* tell the host nothing.
|
|
142
|
+
*/
|
|
143
|
+
private handleResizeCancel;
|
|
144
|
+
private handleResizeKeyDown;
|
|
145
|
+
private handleResizeReset;
|
|
146
|
+
private renderResizeHandle;
|
|
147
|
+
handleColumnsChange(): void;
|
|
148
|
+
updated(): void;
|
|
149
|
+
disconnectedCallback(): void;
|
|
150
|
+
handleAssetsChange(): void;
|
|
151
|
+
private handleResize;
|
|
152
|
+
private readonly debouncedCalculatePageSize;
|
|
153
|
+
private calculatePageSize;
|
|
154
|
+
private selectRow;
|
|
155
|
+
private handleRowClick;
|
|
156
|
+
private handleActionClick;
|
|
157
|
+
private handleRowKeyDown;
|
|
158
|
+
/**
|
|
159
|
+
* @param assetId - omitted for the header's sizing twin, which is inert and never announced.
|
|
160
|
+
*/
|
|
161
|
+
private renderActionButton;
|
|
162
|
+
/**
|
|
163
|
+
* Bound fresh on every render at the call site, deliberately. `lit-virtualizer` re-runs this only
|
|
164
|
+
* when `items` or `renderItem` change identity, and the selected id lives on neither — with a
|
|
165
|
+
* stable reference the rows keep their first render and the selected row is never marked. A new
|
|
166
|
+
* `items` array alone does not do it; the function identity is what the virtualizer acts on.
|
|
167
|
+
*/
|
|
168
|
+
private renderRow;
|
|
169
|
+
private handleScroll;
|
|
170
|
+
private readonly debouncedHandleScrollEnd;
|
|
171
|
+
private handleScrollEnd;
|
|
172
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
173
|
+
}
|
|
174
|
+
declare global {
|
|
175
|
+
interface HTMLElementTagNameMap {
|
|
176
|
+
'cx-content-browser-table': CxContentBrowserTable;
|
|
177
|
+
}
|
|
178
|
+
}
|