@orangelogic/orange-dam-content-browser-sdk 2.3.7-table-view-beta-2 → 2.3.7
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 +0 -3
- package/build/OrangeDAMContentBrowserSDK.min.js +326 -782
- package/build/api/asset/asset.d.ts +7 -2
- package/build/components/content-browser/content-browser.d.ts +2 -37
- package/build/components/content-browser-asset-card/content-browser-asset-card.d.ts +1 -17
- package/build/components/content-browser-control-bar/content-browser-control-bar.d.ts +0 -1
- package/build/components/content-browser-control-view/content-browser-control-view.d.ts +2 -5
- package/build/components/content-browser-format-dialog/content-browser-format-dialog.d.ts +1 -27
- package/build/components/content-browser-grid/content-browser-grid.d.ts +1 -5
- package/build/components/content-browser-grid/scroll-anchor-controller.d.ts +1 -12
- package/build/content-browser.mjs +506 -1754
- 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/index.d.ts +0 -1
- package/build/index.d.ts +2 -29
- package/build/index.html +0 -4
- package/build/index.mjs +440 -1706
- package/build/tools/fetch-and-merge-assets.d.ts +1 -10
- package/build/types/asset.d.ts +0 -5
- package/build/types/content-browser.d.ts +0 -53
- package/package.json +1 -1
- package/build/components/content-browser-table/content-browser-table.d.ts +0 -178
- package/build/components/content-browser-table/content-browser-table.styles.d.ts +0 -2
- package/build/events/cx-content-browser-table-column-resize.d.ts +0 -16
|
@@ -6,8 +6,6 @@ import { Facet, SortOrder } from '../types/content-browser';
|
|
|
6
6
|
import { GetFolderRequest } from '../types/folder';
|
|
7
7
|
import type { ReactiveController } from 'lit';
|
|
8
8
|
type FetchAndMergeAssetsControllerOptions = {
|
|
9
|
-
/** Cortex fields the table-view columns read, requested on every search alongside the fixed set. */
|
|
10
|
-
additionalFields?: string[];
|
|
11
9
|
availableDocTypes: string[];
|
|
12
10
|
baseUrl: string;
|
|
13
11
|
defaultFolderId: string;
|
|
@@ -46,7 +44,6 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
|
|
|
46
44
|
private resolvePendingTokenRefresh;
|
|
47
45
|
private readonly tokenRefreshTimeoutMs;
|
|
48
46
|
private readonly availableDocTypes;
|
|
49
|
-
private additionalFields;
|
|
50
47
|
private readonly defaultSearchText;
|
|
51
48
|
private readonly defaultSelectedFacets;
|
|
52
49
|
private readonly defaultSortOrderName;
|
|
@@ -55,7 +52,7 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
|
|
|
55
52
|
private readonly defaultIsSeeThrough;
|
|
56
53
|
private requestInterceptorId;
|
|
57
54
|
private responseInterceptorId;
|
|
58
|
-
constructor(host: CortexElement, {
|
|
55
|
+
constructor(host: CortexElement, { availableDocTypes, baseUrl, defaultFolderId, defaultIsSeeThrough, defaultSearchText, defaultSelectedFacets, defaultSortDirection, defaultSortOrderName, token, useSession, useSiteSession, }: FetchAndMergeAssetsControllerOptions);
|
|
59
56
|
private waitForNewToken;
|
|
60
57
|
/**
|
|
61
58
|
* Site-session mode decides the transport (cookies on the Cortex origin vs. Token/UseSession
|
|
@@ -67,12 +64,6 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
|
|
|
67
64
|
* step with the UI instead of serving requests through the mode the controller was built with.
|
|
68
65
|
*/
|
|
69
66
|
updateSiteSession(useSiteSession: boolean, baseUrl: string, token: string, useSession: string): void;
|
|
70
|
-
/**
|
|
71
|
-
* Table columns are host configuration and can be reconfigured after mount, unlike the rest of
|
|
72
|
-
* these options — every later fetch must ask for the current field list, not the one that
|
|
73
|
-
* happened to be set when the controller was constructed.
|
|
74
|
-
*/
|
|
75
|
-
updateAdditionalFields(additionalFields: string[]): void;
|
|
76
67
|
updateAuth(token: string, useSession: string): void;
|
|
77
68
|
private fetchInitialData;
|
|
78
69
|
private _debounceTimeout;
|
package/build/types/asset.d.ts
CHANGED
|
@@ -80,11 +80,6 @@ export type GetAssetLinksRequest = {
|
|
|
80
80
|
useRepresentative?: boolean;
|
|
81
81
|
};
|
|
82
82
|
export type GetAssetsRequest = {
|
|
83
|
-
/**
|
|
84
|
-
* Extra Cortex fields to request alongside the fixed set, returned on each item under the field
|
|
85
|
-
* name as sent. Used by the table view to resolve host-configured columns.
|
|
86
|
-
*/
|
|
87
|
-
fields?: string[];
|
|
88
83
|
folderId?: string;
|
|
89
84
|
isSeeThrough?: boolean;
|
|
90
85
|
limitedToDocTypes?: string[];
|
|
@@ -39,34 +39,6 @@ export declare enum GridView {
|
|
|
39
39
|
Medium = "medium",
|
|
40
40
|
Small = "small"
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
43
|
-
* The table layout. `GridView` members are the grid's pixel-width presets, so a layout that is not
|
|
44
|
-
* a grid at all cannot be one of them.
|
|
45
|
-
*/
|
|
46
|
-
export declare const TABLE_VIEW = "table";
|
|
47
|
-
/** What the content browser is currently rendering: one of the grid size presets, or the table. */
|
|
48
|
-
export type ContentBrowserView = GridView | typeof TABLE_VIEW;
|
|
49
|
-
export type TableColumnAlign = 'center' | 'left' | 'right';
|
|
50
|
-
/**
|
|
51
|
-
* One column of the table view. The host owns the column set: the SDK ships the mechanism and no
|
|
52
|
-
* default column list, so nothing here is guessed from the asset's doc type.
|
|
53
|
-
*/
|
|
54
|
-
export type TableColumn = {
|
|
55
|
-
/** Horizontal alignment of the cell text. Default `left`. */
|
|
56
|
-
align?: TableColumnAlign;
|
|
57
|
-
/**
|
|
58
|
-
* Cortex field the column reads, e.g. `CoreField.Identifier` or `Dell.Snippet`. It is appended to
|
|
59
|
-
* the field list of the same search call the grid uses, so what a given caller gets back is decided
|
|
60
|
-
* server-side — the SDK neither filters nor resolves fields of its own.
|
|
61
|
-
*/
|
|
62
|
-
field: string;
|
|
63
|
-
/** Lines a cell shows before the text is clamped. Default 1. */
|
|
64
|
-
lines?: number;
|
|
65
|
-
/** Column header text. */
|
|
66
|
-
title: string;
|
|
67
|
-
/** CSS grid track for the column, e.g. `200px`, `2fr`, `minmax(120px, 1fr)`. Default `minmax(0, 1fr)`. */
|
|
68
|
-
width?: string;
|
|
69
|
-
};
|
|
70
42
|
export declare const ASSET_SIZE: {
|
|
71
43
|
small: {
|
|
72
44
|
maxWidth: number;
|
|
@@ -141,31 +113,6 @@ export type FocusMode = {
|
|
|
141
113
|
value: string;
|
|
142
114
|
};
|
|
143
115
|
export type DefaultFocusMode = 'manual' | 'center';
|
|
144
|
-
/**
|
|
145
|
-
* Import behaviour when the host would rather not show the format picker.
|
|
146
|
-
*
|
|
147
|
-
* - `false` — the format dialog opens as usual.
|
|
148
|
-
* - `true` — insert with the first available format, without showing the dialog.
|
|
149
|
-
* - a format name — insert with that format, matched case-insensitively against a proxy's
|
|
150
|
-
* `proxyName` or `proxyLabel`. A name matching nothing opens the dialog as usual.
|
|
151
|
-
*/
|
|
152
|
-
export type AutoSelectFormat = boolean | string;
|
|
153
|
-
/**
|
|
154
|
-
* React 19 sets a hyphenated prop as an attribute rather than a property, so the union has to
|
|
155
|
-
* survive a round trip through a string: `"true"`/`"false"` are the booleans, anything else is a
|
|
156
|
-
* format name. A bare attribute means `true`, matching how a boolean attribute normally reads.
|
|
157
|
-
*/
|
|
158
|
-
export declare const autoSelectFormatConverter: {
|
|
159
|
-
fromAttribute: (value: string | null) => AutoSelectFormat;
|
|
160
|
-
toAttribute: (value: AutoSelectFormat) => string | null;
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Whether `autoSelectFormat` is switched on at all — a blank string is off, not a format named " ".
|
|
164
|
-
*
|
|
165
|
-
* Config-level, not per-asset: it says the host has asked to skip the picker, not that this
|
|
166
|
-
* particular asset will skip it. A named format that no proxy matches still opens the dialog.
|
|
167
|
-
*/
|
|
168
|
-
export declare function isAutoSelectFormatActive(value: AutoSelectFormat): boolean;
|
|
169
116
|
export type CtaTextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
170
117
|
export declare enum ContentBrowserFormatDialogVariant {
|
|
171
118
|
Dialog = "dialog",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangelogic/orange-dam-content-browser-sdk",
|
|
3
|
-
"version": "2.3.7
|
|
3
|
+
"version": "2.3.7",
|
|
4
4
|
"description": "OrangeDAM Content Browser SDK source code",
|
|
5
5
|
"main": "./build/OrangeDAMContentBrowserSDK.min.js",
|
|
6
6
|
"module": "./build/index.mjs",
|
|
@@ -1,178 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface CxContentBrowserTableColumnResizeEvent extends CustomEvent<{
|
|
2
|
-
field: string;
|
|
3
|
-
width: number | undefined;
|
|
4
|
-
}> {
|
|
5
|
-
detail: {
|
|
6
|
-
/** The Cortex field the resized column maps to, as the host configured it. */
|
|
7
|
-
field: string;
|
|
8
|
-
/** Resolved width in pixels, or `undefined` when the column was reset to its configured width. */
|
|
9
|
-
width: number | undefined;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
declare global {
|
|
13
|
-
interface GlobalEventHandlersEventMap {
|
|
14
|
-
'cx-content-browser-table-column-resize': CxContentBrowserTableColumnResizeEvent;
|
|
15
|
-
}
|
|
16
|
-
}
|