@orangelogic/orange-dam-content-browser-sdk 2.4.3 → 2.4.4-table-view-beta-3
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 +629 -331
- package/build/api/asset/asset.d.ts +2 -1
- package/build/api/asset/asset.types.d.ts +9 -0
- package/build/components/content-browser/content-browser.d.ts +42 -2
- package/build/components/content-browser-asset-card/content-browser-asset-card.d.ts +25 -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-table/content-browser-table.d.ts +268 -0
- package/build/components/content-browser-table/content-browser-table.styles.d.ts +2 -0
- package/build/content-browser.mjs +2054 -517
- 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 +20 -0
- package/build/events/index.d.ts +1 -0
- package/build/index.d.ts +36 -2
- package/build/index.html +4 -0
- package/build/index.mjs +1978 -423
- package/build/tools/fetch-and-merge-assets.d.ts +15 -3
- package/build/types/asset.d.ts +5 -0
- package/build/types/content-browser.d.ts +74 -0
- package/package.json +1 -1
|
@@ -36,7 +36,8 @@ export declare function resolveAssetExtraFilters(selectedFacets?: Record<string,
|
|
|
36
36
|
};
|
|
37
37
|
export declare function apiGetAssetLinks({ assets, extension, extraFields, parameters, permanentLink, proxyPreference, transformations, useSession, }: GetAssetLinksRequest): Promise<GetAssetLinksResponse>;
|
|
38
38
|
export declare function apiGetAssetsByIDs({ extraFields, recordIds, }: GetAssetsByIDsRequest): Promise<GetAssetsByIDsResponse>;
|
|
39
|
-
export declare
|
|
39
|
+
export declare const ASSET_LIST_FIELDS: string[];
|
|
40
|
+
export declare function apiGetAssets({ fields, folderId, isSeeThrough, limitedToDocTypes, pageSize, searchText, selectedFacets, sortOrder, start, useSession, }: GetAssetsRequest): Promise<GetAssetsResponse>;
|
|
40
41
|
export declare function apiGetAvailableProxies({ assetRecordId, siteUrl, }: {
|
|
41
42
|
assetRecordId: string;
|
|
42
43
|
siteUrl?: string;
|
|
@@ -57,11 +57,20 @@ export type GetAssetsRawResponse = {
|
|
|
57
57
|
contentItems?: ContentItem[];
|
|
58
58
|
facets: Facet[];
|
|
59
59
|
totalCount: number;
|
|
60
|
+
/** Absent on a Cortex build older than L-42BJ3T. */
|
|
61
|
+
unreadableFields?: string[];
|
|
60
62
|
};
|
|
61
63
|
export type GetAssetsResponse = {
|
|
62
64
|
facets: Facet[];
|
|
63
65
|
items: Array<Asset & Record<string, string | boolean>>;
|
|
64
66
|
totalCount: number;
|
|
67
|
+
/**
|
|
68
|
+
* The requested fields, spelled as sent, that the user cannot read on this page of records. Cortex
|
|
69
|
+
* still sends each one on every item, with an empty value, except a field that the
|
|
70
|
+
* `DbBOFieldSecurity_BO.Data.ObjectsInfoRetriever_IgnoredFields` parameter lists, which keeps its
|
|
71
|
+
* value. Empty when Cortex flags none, or when Cortex is too old to flag any.
|
|
72
|
+
*/
|
|
73
|
+
unreadableFields: string[];
|
|
65
74
|
};
|
|
66
75
|
export type GetAvailableProxiesRequest = {
|
|
67
76
|
assetRecordId: 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;
|
|
@@ -57,6 +60,10 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
57
60
|
*/
|
|
58
61
|
canPinAsset: boolean;
|
|
59
62
|
canUseProxies: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Host-level import behaviour; forwarded to the format dialog. See `AutoSelectFormat`.
|
|
65
|
+
*/
|
|
66
|
+
autoSelectFormat: AutoSelectFormat;
|
|
60
67
|
/**
|
|
61
68
|
* Pick-only mode: no available-proxies lookup, no transformation on confirm. The preview popup
|
|
62
69
|
* shows the asset's LargeSizePreview and confirming emits the asset straight to the host.
|
|
@@ -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[]>;
|
|
@@ -104,6 +117,20 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
104
117
|
private initialFolderPending;
|
|
105
118
|
private initialFolderTimeout;
|
|
106
119
|
willUpdate(changedProperties: PropertyValues): void;
|
|
120
|
+
/**
|
|
121
|
+
* Never trust the host's value: it also arrives by direct property assignment, past the converter.
|
|
122
|
+
* Entries are checked one by one, not just the outer array — `field` is dereferenced while the
|
|
123
|
+
* fetch controller is being built, where a throw leaves the controller unassigned and the picker
|
|
124
|
+
* blank. `title` is only rendered, and Lit renders a nullish one as nothing, so a column is not
|
|
125
|
+
* worth dropping over it.
|
|
126
|
+
*/
|
|
127
|
+
private get tableColumnList();
|
|
128
|
+
/**
|
|
129
|
+
* This reads the configured columns, not the shown ones. The shown columns can change with each
|
|
130
|
+
* response, and a table view that goes away with them flips the view and its page size. When
|
|
131
|
+
* Cortex flags each column, the rows stay with only the filler and the CTA column.
|
|
132
|
+
*/
|
|
133
|
+
private get canUseTable();
|
|
107
134
|
runFirstUpdated(): void;
|
|
108
135
|
connectedCallback(): void;
|
|
109
136
|
disconnectedCallback(): void;
|
|
@@ -115,8 +142,20 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
115
142
|
* pin/unpin request (see `cx-content-browser-pin-asset-change`) to reflect the result.
|
|
116
143
|
*/
|
|
117
144
|
setIsAssetPinned(isAssetPinned: boolean): void;
|
|
145
|
+
/**
|
|
146
|
+
* The asset a click is still working on, or undefined. The two private flags below drive the
|
|
147
|
+
* guards; this drives the UI, and is a separate field because they are plain fields rather than
|
|
148
|
+
* reactive state.
|
|
149
|
+
*
|
|
150
|
+
* Cleared the moment the format dialog actually opens: from there the dialog's own confirm button
|
|
151
|
+
* carries the pending state, and two spinners for one operation reads as two operations. It
|
|
152
|
+
* survives when no dialog opens, which is the auto-confirm path, where the CTA is the only thing
|
|
153
|
+
* the user can be told anything by.
|
|
154
|
+
*/
|
|
155
|
+
private busyAssetId;
|
|
118
156
|
private openFormatDialog;
|
|
119
157
|
handleLastRequestChange(): Promise<void>;
|
|
158
|
+
handleTableColumnsChange(): void;
|
|
120
159
|
handleAuthChange(): void;
|
|
121
160
|
handleSiteSessionChange(): void;
|
|
122
161
|
private handleSortOrderChange;
|
|
@@ -138,6 +177,7 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
138
177
|
*/
|
|
139
178
|
private handlePinAssetChange;
|
|
140
179
|
private handleProxyConfirm;
|
|
180
|
+
private reportProxyConfirmFailure;
|
|
141
181
|
private handleFormatConfirm;
|
|
142
182
|
private handleFormatDialogClose;
|
|
143
183
|
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';
|
|
@@ -10,10 +11,19 @@ import CxSpace from '@orangelogic/design-system/components/space';
|
|
|
10
11
|
import CxTag from '@orangelogic/design-system/components/tag';
|
|
11
12
|
import CxTypography from '@orangelogic/design-system/components/typography';
|
|
12
13
|
import CxContentBrowserAssetPreview from '../content-browser-asset-preview/content-browser-asset-preview';
|
|
14
|
+
/**
|
|
15
|
+
* Grid view is pointer-only by design: the card is not focusable, and its CTA overlay is
|
|
16
|
+
* `aria-hidden` with a `tabindex="-1"` button because the overlay only restates what clicking the
|
|
17
|
+
* card already does. This diverges deliberately from `cx-content-browser-table`, whose rows are
|
|
18
|
+
* focusable and announce their CTA — the grid's keyboard gap predates the table view and closing it
|
|
19
|
+
* would change focus and screen-reader behaviour for every existing host. Revisit together with the
|
|
20
|
+
* grid's own keyboard support rather than per-feature.
|
|
21
|
+
*/
|
|
13
22
|
export default class CxContentBrowserAssetCard extends CortexElement {
|
|
14
23
|
static readonly styles: CSSResultGroup;
|
|
15
24
|
static readonly dependencies: {
|
|
16
25
|
'cx-array-line-clamp': typeof CxArrayLineClamp;
|
|
26
|
+
'cx-button': typeof CxButton;
|
|
17
27
|
'cx-card': typeof CxCard;
|
|
18
28
|
'cx-checkbox': typeof CxCheckbox;
|
|
19
29
|
'cx-content-browser-asset-preview': typeof CxContentBrowserAssetPreview;
|
|
@@ -22,6 +32,20 @@ export default class CxContentBrowserAssetCard extends CortexElement {
|
|
|
22
32
|
'cx-tag': typeof CxTag;
|
|
23
33
|
'cx-typography': typeof CxTypography;
|
|
24
34
|
};
|
|
35
|
+
private readonly localize;
|
|
36
|
+
/**
|
|
37
|
+
* Show the hover overlay that says clicking this card inserts. Set when the host has asked to
|
|
38
|
+
* skip the format picker: without the dialog a click hands the asset over immediately, and the
|
|
39
|
+
* card would otherwise carry no sign of that.
|
|
40
|
+
*/
|
|
41
|
+
showCta: boolean;
|
|
42
|
+
ctaText: string;
|
|
43
|
+
ctaTextTransform: CtaTextTransform;
|
|
44
|
+
/**
|
|
45
|
+
* This card's insert is still running: hold the overlay open and spin its CTA, so the feedback
|
|
46
|
+
* does not vanish the moment the pointer leaves.
|
|
47
|
+
*/
|
|
48
|
+
busy: boolean;
|
|
25
49
|
imageUrl: string;
|
|
26
50
|
originalUrl: string;
|
|
27
51
|
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;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { type PropertyValues } from 'lit';
|
|
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 CxContentBrowserNoResult from '../content-browser-no-result/content-browser-no-result';
|
|
10
|
+
import type { CSSResultGroup } from 'lit';
|
|
11
|
+
declare const CxTable: typeof import("node_modules/@orangelogic/design-system/library/packages/hybrid/table-core/src").default;
|
|
12
|
+
type CxTableElement = InstanceType<typeof CxTable>;
|
|
13
|
+
type TableColumnDefinition = NonNullable<CxTableElement['columns']>[number];
|
|
14
|
+
/** `cx-table`'s own row height, the one every other Cortex table renders at. */
|
|
15
|
+
export declare const ROW_HEIGHT = 48;
|
|
16
|
+
/** Narrow enough to be a deliberate choice, wide enough that a column never becomes a sliver. */
|
|
17
|
+
export declare const MIN_COLUMN_WIDTH = 48;
|
|
18
|
+
/** The trailing column that holds each row's CTA, keyed apart from every `column<n>` data column. */
|
|
19
|
+
export declare const CTA_FIELD = "cta";
|
|
20
|
+
/** The empty column before the CTA column that takes the width no other column takes. */
|
|
21
|
+
export declare const FILLER_FIELD = "filler";
|
|
22
|
+
type ColumnSizing = Pick<TableColumnDefinition, 'minWidth' | 'width' | 'widthGrow'>;
|
|
23
|
+
/**
|
|
24
|
+
* Maps a host column's `width`, authored as a CSS grid track, onto Tabulator column sizing under the
|
|
25
|
+
* `fitColumns` layout: a pixel length is a fixed width, a percentage is a fixed share of the table
|
|
26
|
+
* width in whole percents (`12.5%` is 12%), converted to pixels once when the table builds its
|
|
27
|
+
* columns, or once it is shown if it built them hidden, and not resized afterward, a `<flex>` share
|
|
28
|
+
* is `widthGrow`, and a `minmax()` keeps a pixel minimum above `MIN_COLUMN_WIDTH`. Any other track
|
|
29
|
+
* takes an equal share of the free space.
|
|
30
|
+
* Every column floors at `MIN_COLUMN_WIDTH` (48px). The one exception is a pixel width above 0 and
|
|
31
|
+
* below 48px, which renders as set. A width of 0 (`0px`, or a `0fr` share) renders at 48px.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toColumnSizing(track: string | undefined): ColumnSizing;
|
|
34
|
+
/**
|
|
35
|
+
* Column values ride on the asset under the Cortex field name as requested (see `apiGetAssets`),
|
|
36
|
+
* which `Asset` cannot declare because the field set is the host's, not the SDK's. Read as an own
|
|
37
|
+
* property: a field named after an `Object.prototype` member (`toString`, `constructor`) would
|
|
38
|
+
* otherwise read back the inherited function.
|
|
39
|
+
*/
|
|
40
|
+
export declare function readCellValue(asset: Asset, field: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* @summary Table layout for the Content Browser: one row per asset, host-configured metadata columns
|
|
43
|
+
* instead of a thumbnail, rendered by the design system's `cx-table`.
|
|
44
|
+
*
|
|
45
|
+
* @description Renders the same asset list the grid does and emits the same item events, so an asset
|
|
46
|
+
* with no rendition — a text fragment, `digitized = 0` — is browsable and selectable by its
|
|
47
|
+
* identifying fields. It fetches nothing of its own: a row exists, and a cell has a value, only
|
|
48
|
+
* because the search response the grid also consumes carried it.
|
|
49
|
+
*
|
|
50
|
+
* @event cx-content-browser-grid-click - Emitted when a row's CTA button is activated, by a click or
|
|
51
|
+
* from the keyboard: once for a double click on it, and never for a click or a double click on the
|
|
52
|
+
* row itself.
|
|
53
|
+
* @event cx-content-browser-grid-resize - Emitted when the number of rows the visible scrollport can
|
|
54
|
+
* show changes, and again once a restarted list's rows are in, so the host can grow the page size.
|
|
55
|
+
* A count measured while a page of the shown list loads is emitted once the load ends and any
|
|
56
|
+
* rows it brings are in. A count measured after the load ends is emitted at once, and it can come
|
|
57
|
+
* before the rows of a new list are in.
|
|
58
|
+
* @event cx-content-browser-grid-scroll-end - Emitted while `has-more` is set, no page is loading, and
|
|
59
|
+
* the last row comes into view: by scrolling the table's own scrollport, or by scrolling the page when
|
|
60
|
+
* a table taller than the viewport holds its rows without overflowing and so never scrolls itself.
|
|
61
|
+
* @event cx-content-browser-table-column-resize - Emitted when a host-configured column settles on a
|
|
62
|
+
* new width: a drag of its divider released, or a double click on the divider that fits the column to
|
|
63
|
+
* its content. Never emitted for the empty filler column or the CTA column, which have no divider.
|
|
64
|
+
* `detail.width` is the column's width in whole pixels; `undefined` is never emitted. Resized widths
|
|
65
|
+
* are session-only -- the SDK has no storage that survives a reload -- so this event is the host's
|
|
66
|
+
* only chance to persist them.
|
|
67
|
+
*/
|
|
68
|
+
export default class CxContentBrowserTable extends CortexElement {
|
|
69
|
+
#private;
|
|
70
|
+
static readonly styles: CSSResultGroup;
|
|
71
|
+
static readonly dependencies: {
|
|
72
|
+
'cx-button': typeof CxButton;
|
|
73
|
+
'cx-content-browser-no-result': typeof CxContentBrowserNoResult;
|
|
74
|
+
'cx-line-clamp': typeof CxLineClamp;
|
|
75
|
+
'cx-progress-bar': typeof CxProgressBar;
|
|
76
|
+
'cx-resize-observer': typeof CxResizeObserver;
|
|
77
|
+
'cx-table': typeof import("node_modules/@orangelogic/design-system/library/packages/hybrid/table-core/src").default;
|
|
78
|
+
};
|
|
79
|
+
private readonly localize;
|
|
80
|
+
private readonly containerEl;
|
|
81
|
+
private readonly tableEl;
|
|
82
|
+
assets: Asset[];
|
|
83
|
+
columns: TableColumn[];
|
|
84
|
+
ctaText: string;
|
|
85
|
+
ctaTextTransform: CtaTextTransform;
|
|
86
|
+
empty: boolean;
|
|
87
|
+
hasMore: boolean;
|
|
88
|
+
loading: boolean;
|
|
89
|
+
selectedAssetId: string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* The asset whose insert is still running, so its row keeps the CTA on screen and spinning.
|
|
92
|
+
*/
|
|
93
|
+
busyAssetId: string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Fields of `columns`, compared exactly, whose columns the table does not show. A hidden column
|
|
96
|
+
* keeps its place, its cell values and a dragged width, so it comes back with the rows and the
|
|
97
|
+
* scroll position unchanged. The filler and the CTA column always show, so when each host column
|
|
98
|
+
* is hidden, the rows stay with only their CTA.
|
|
99
|
+
*/
|
|
100
|
+
hiddenFields: string[];
|
|
101
|
+
assetMap: Map<string, Asset>;
|
|
102
|
+
private get tabulator();
|
|
103
|
+
/** Tabulator's row holder: the one element that scrolls the rows. */
|
|
104
|
+
private get scrollport();
|
|
105
|
+
private get hasMultilineColumn();
|
|
106
|
+
private resolveColumnSizing;
|
|
107
|
+
/** Each host column's row key, in order: a field the host repeats takes a key per occurrence. */
|
|
108
|
+
private resolveColumnKeys;
|
|
109
|
+
private buildColumnDefinitions;
|
|
110
|
+
private buildDataColumnDefinitions;
|
|
111
|
+
/**
|
|
112
|
+
* `fitColumns` gives the free space only to columns with no fixed width, and a drag fixes the width
|
|
113
|
+
* of the column it resizes. Once every data column has one, this column takes the space they leave,
|
|
114
|
+
* which would otherwise show blank, and keeps the CTA at the right edge. The CTA column cannot do it
|
|
115
|
+
* itself: its floor is the button's measured width, and Tabulator reads a floor only as it builds the
|
|
116
|
+
* column.
|
|
117
|
+
*/
|
|
118
|
+
private buildFillerColumnDefinition;
|
|
119
|
+
/**
|
|
120
|
+
* A button of our own in a formatter cell rather than a `cx-table` hover-menu action: a row action
|
|
121
|
+
* renders an icon, with its label only as a tooltip.
|
|
122
|
+
*/
|
|
123
|
+
private buildCtaColumnDefinition;
|
|
124
|
+
private get ctaLabel();
|
|
125
|
+
private renderCta;
|
|
126
|
+
private isCtaShown;
|
|
127
|
+
/** In place, never rebuilt: a new button would drop the keyboard focus the old one held. */
|
|
128
|
+
private paintCta;
|
|
129
|
+
private paintRowCta;
|
|
130
|
+
private paintAssetCta;
|
|
131
|
+
private trackPointer;
|
|
132
|
+
private setHoveredRow;
|
|
133
|
+
/**
|
|
134
|
+
* Tabulator takes a row that scrolls out of its render window off the page, and a row taken off
|
|
135
|
+
* the page gets no `mouseleave` to hide its CTA, nor need its button get a `focusout` for the
|
|
136
|
+
* focus it drops.
|
|
137
|
+
*/
|
|
138
|
+
private releaseDetachedCta;
|
|
139
|
+
/**
|
|
140
|
+
* The label is the host's, so no fixed width fits it: the column takes the rendered button's
|
|
141
|
+
* width plus whatever its cell puts around the button.
|
|
142
|
+
*/
|
|
143
|
+
private fitCtaColumn;
|
|
144
|
+
/** Lays the columns and the rendered rows out again. */
|
|
145
|
+
private redrawTable;
|
|
146
|
+
/**
|
|
147
|
+
* Tabulator renders the rows again -- for an appended page, a redraw of its own or one of ours --
|
|
148
|
+
* by taking every rendered row off the page and back, which drops the keyboard focus, so the CTA
|
|
149
|
+
* that held it gets it back.
|
|
150
|
+
*/
|
|
151
|
+
private handleRenderStarted;
|
|
152
|
+
private handleRenderComplete;
|
|
153
|
+
private toRow;
|
|
154
|
+
private findRow;
|
|
155
|
+
/**
|
|
156
|
+
* `aria-current`, not `aria-selected`: this is a `grid` with no selection model of its own. The
|
|
157
|
+
* Tabulator selection is there only for `cx-table`'s selected-row style: `selectableRows` stays at
|
|
158
|
+
* its `highlight` default, so a click never selects a row by itself.
|
|
159
|
+
*/
|
|
160
|
+
private markCurrentRow;
|
|
161
|
+
private getPercentColumns;
|
|
162
|
+
/**
|
|
163
|
+
* Tabulator converts a percentage to pixels once, as it builds the column, but `fitColumns` goes on
|
|
164
|
+
* budgeting the column at that share of the table's current width, which leaves the flexible columns
|
|
165
|
+
* a gap or an overflow at any other width: the column is budgeted at the width it was built at. A
|
|
166
|
+
* table hidden as it builds its columns has no width to take a share of, and Tabulator floors every
|
|
167
|
+
* share at the column's minimum: those shares are converted once the table is shown.
|
|
168
|
+
*/
|
|
169
|
+
private pinPercentWidths;
|
|
170
|
+
/** At the first width the table has, as Tabulator converts a share when it builds the column. */
|
|
171
|
+
private convertPendingPercentWidths;
|
|
172
|
+
/**
|
|
173
|
+
* `content-browser` hands over the whole list on every page, so a list that only grows by a page
|
|
174
|
+
* is appended: reassigning it would call `setData`, which scrolls the table back to the top. Any
|
|
175
|
+
* other list -- a new search, sort, filter or folder, or a refetch that brings the assets the rows
|
|
176
|
+
* show as new objects -- replaces the rows.
|
|
177
|
+
*/
|
|
178
|
+
private syncRows;
|
|
179
|
+
private handleTableBuilt;
|
|
180
|
+
/**
|
|
181
|
+
* `setData` replaces the rows only once its debounce runs out, and Tabulator emits `dataLoaded` just
|
|
182
|
+
* before it does. Until then, the old rows stay on the page with their hover and focus.
|
|
183
|
+
*/
|
|
184
|
+
private handleDataLoaded;
|
|
185
|
+
/**
|
|
186
|
+
* Every `setColumns` builds the columns again from the host definitions, which keep the
|
|
187
|
+
* percentage: `cx-table` calls it from its own `tableBuilt` handler, after this component's has
|
|
188
|
+
* run, and again for every new column set.
|
|
189
|
+
*/
|
|
190
|
+
private handleColumnsLoaded;
|
|
191
|
+
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
192
|
+
/**
|
|
193
|
+
* Through Tabulator's own column visibility: new definitions would reach it through `setColumns`,
|
|
194
|
+
* and the rows would have to be rebuilt, which scrolls back to the top.
|
|
195
|
+
*/
|
|
196
|
+
private applyHiddenFields;
|
|
197
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
198
|
+
/** A column the host stops configuring starts again from the host's width if it comes back. */
|
|
199
|
+
private forgetRemovedColumnWidths;
|
|
200
|
+
/** Once `cx-table` has taken the new column definitions. */
|
|
201
|
+
private rebuildRows;
|
|
202
|
+
handleAssetsChange(previous?: unknown): void;
|
|
203
|
+
handleLoadingChange(): Promise<void>;
|
|
204
|
+
handleSelectedAssetIdChange(previous?: unknown): void;
|
|
205
|
+
handleBusyAssetIdChange(previous?: unknown): void;
|
|
206
|
+
handleCtaTextChange(): void;
|
|
207
|
+
/** Every CTA shares the label, so one on the page measures the column for all of them. */
|
|
208
|
+
private fitRenderedCta;
|
|
209
|
+
private readonly handleNoHoverChange;
|
|
210
|
+
/** In place, as a relabel is: a CTA built again would drop the keyboard focus the old one held. */
|
|
211
|
+
private setNoHover;
|
|
212
|
+
connectedCallback(): void;
|
|
213
|
+
disconnectedCallback(): void;
|
|
214
|
+
private handleResize;
|
|
215
|
+
/**
|
|
216
|
+
* `cx-table` lays its columns and rows out again for a new container size only until the first
|
|
217
|
+
* drag of a column divider. After it, the columns keep the old width and the rows fill only the old
|
|
218
|
+
* height, which leaves a blank area right of the columns or under the rows.
|
|
219
|
+
*/
|
|
220
|
+
private refitToContainer;
|
|
221
|
+
private readonly debouncedRedrawTable;
|
|
222
|
+
private readonly debouncedCalculatePageSize;
|
|
223
|
+
private calculatePageSize;
|
|
224
|
+
/** Counts the rows the last measured height shows, and tells the host when the count changes. */
|
|
225
|
+
private reportRowCount;
|
|
226
|
+
/**
|
|
227
|
+
* Only once the restarted rows are in: the host asks for the next page at once, and a page that
|
|
228
|
+
* lands while `setData` waits replaces the rows again and holds them back for another half second.
|
|
229
|
+
* A measurement still in its debounce reports in the same count, because a second count inside the
|
|
230
|
+
* host's 200 ms fetch debounce cancels the page the first count asked for.
|
|
231
|
+
*/
|
|
232
|
+
private reportRestartedRowCount;
|
|
233
|
+
/**
|
|
234
|
+
* Once the load ends and any rows it brings are in, the count measured meanwhile can ask for the
|
|
235
|
+
* page after it. A table that is not built yet reports it at once.
|
|
236
|
+
*/
|
|
237
|
+
private reportHeldRowCount;
|
|
238
|
+
/**
|
|
239
|
+
* The rows never size the container (see the styles), so this is the height the host gives the
|
|
240
|
+
* picker, and it can run past the viewport. No scrollport shows more rows than the viewport, so
|
|
241
|
+
* while the rows do not overflow the scrollport the count stops there, and the page scrolls to the
|
|
242
|
+
* rest, where the last row coming into view asks for more (`observeLastRow`). One that overflows,
|
|
243
|
+
* or holds no rows yet, measures the space its container gives it and is used as is.
|
|
244
|
+
*/
|
|
245
|
+
private resolveVisibleHeight;
|
|
246
|
+
private isSizedByRows;
|
|
247
|
+
/**
|
|
248
|
+
* A scrollport that holds its rows without overflowing never scrolls, so its own scroll never
|
|
249
|
+
* reaches the end: the page scrolls instead. Once the table is taller than the viewport its count
|
|
250
|
+
* is capped and stops fetching, which leaves the last row coming into view as the only sign the
|
|
251
|
+
* user wants more.
|
|
252
|
+
*/
|
|
253
|
+
private observeLastRow;
|
|
254
|
+
private readonly debouncedHandleLastRowVisible;
|
|
255
|
+
private handleLastRowVisible;
|
|
256
|
+
private insertAsset;
|
|
257
|
+
private handleColumnResized;
|
|
258
|
+
private handleScrollVertical;
|
|
259
|
+
private readonly debouncedHandleScrollEnd;
|
|
260
|
+
private handleScrollEnd;
|
|
261
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
262
|
+
}
|
|
263
|
+
declare global {
|
|
264
|
+
interface HTMLElementTagNameMap {
|
|
265
|
+
'cx-content-browser-table': CxContentBrowserTable;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
export {};
|