@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.
@@ -1,11 +1,13 @@
1
1
  import CortexElement from '../base/element';
2
- import { GetAssetLinksRequest, GetAvailableExtensionsResponse } from '../api/asset/asset.types';
2
+ import { GetAssetLinksRequest, GetAssetsResponse, GetAvailableExtensionsResponse } from '../api/asset/asset.types';
3
3
  import { Asset, GetAssetsRequest, MediaType } from '../types/asset';
4
4
  import { UserInfo } from '../types/auth';
5
5
  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[];
9
11
  availableDocTypes: string[];
10
12
  baseUrl: string;
11
13
  defaultFolderId: string;
@@ -29,6 +31,8 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
29
31
  private facets;
30
32
  private items;
31
33
  private totalCount;
34
+ /** The requested fields, spelled as Cortex sent them, that the user cannot read on the rows in `items`. */
35
+ private unreadableFields;
32
36
  private lastRequest;
33
37
  private sortOrders;
34
38
  private parameters;
@@ -44,6 +48,7 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
44
48
  private resolvePendingTokenRefresh;
45
49
  private readonly tokenRefreshTimeoutMs;
46
50
  private readonly availableDocTypes;
51
+ private additionalFields;
47
52
  private readonly defaultSearchText;
48
53
  private readonly defaultSelectedFacets;
49
54
  private readonly defaultSortOrderName;
@@ -52,7 +57,7 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
52
57
  private readonly defaultIsSeeThrough;
53
58
  private requestInterceptorId;
54
59
  private responseInterceptorId;
55
- constructor(host: CortexElement, { availableDocTypes, baseUrl, defaultFolderId, defaultIsSeeThrough, defaultSearchText, defaultSelectedFacets, defaultSortDirection, defaultSortOrderName, token, useSession, useSiteSession, }: FetchAndMergeAssetsControllerOptions);
60
+ constructor(host: CortexElement, { additionalFields, availableDocTypes, baseUrl, defaultFolderId, defaultIsSeeThrough, defaultSearchText, defaultSelectedFacets, defaultSortDirection, defaultSortOrderName, token, useSession, useSiteSession, }: FetchAndMergeAssetsControllerOptions);
56
61
  private waitForNewToken;
57
62
  /**
58
63
  * Site-session mode decides the transport (cookies on the Cortex origin vs. Token/UseSession
@@ -64,13 +69,19 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
64
69
  * step with the UI instead of serving requests through the mode the controller was built with.
65
70
  */
66
71
  updateSiteSession(useSiteSession: boolean, baseUrl: string, token: string, useSession: string): void;
72
+ /**
73
+ * Table columns are host configuration and can be reconfigured after mount, unlike the rest of
74
+ * these options — every later fetch must ask for the current field list, not the one that
75
+ * happened to be set when the controller was constructed.
76
+ */
77
+ updateAdditionalFields(additionalFields: string[]): void;
67
78
  updateAuth(token: string, useSession: string): void;
68
79
  private fetchInitialData;
69
80
  private _debounceTimeout;
70
81
  private _debouncePromise;
71
82
  private _debounceResolve;
72
83
  private mapAvailableExtensions;
73
- fetchAssets(request: GetAssetsRequest): Promise<import("../api/asset/asset.types").GetAssetsResponse>;
84
+ fetchAssets(request: GetAssetsRequest): Promise<GetAssetsResponse>;
74
85
  fetchFolders(request: GetFolderRequest): Promise<import("../types/folder").GetFolderResponse>;
75
86
  /**
76
87
  * A folder switch (or any refetch) can return a facet list that no longer includes a
@@ -128,6 +139,7 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
128
139
  request: GetAssetsRequest | null;
129
140
  sortOrders: Record<string, SortOrder[]>;
130
141
  totalCount: number;
142
+ unreadableFields: string[];
131
143
  userInfo: UserInfo | null;
132
144
  };
133
145
  hostConnected(): void;
@@ -80,6 +80,11 @@ 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[];
83
88
  folderId?: string;
84
89
  isSeeThrough?: boolean;
85
90
  limitedToDocTypes?: string[];
@@ -39,6 +39,49 @@ 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. Surrounding whitespace
61
+ * is trimmed, and the trimmed name is what the duplicate-column check compares. When Cortex flags
62
+ * the field as one the user cannot read, the table does not show the column, as the DAM does. The
63
+ * field stays in the request, so that the next response can flag it again.
64
+ */
65
+ field: string;
66
+ /** Lines a cell shows before the text is clamped. Default 1. */
67
+ lines?: number;
68
+ /** Column header text. */
69
+ title: string;
70
+ /**
71
+ * Column width, written as a CSS grid track. A length in pixels (`200px`) is a fixed width. A
72
+ * percentage (`25%`) is a fixed share of the table's width, in whole percents (a fraction is
73
+ * dropped, so `12.5%` is 12%), converted to pixels once when the table builds its columns; it
74
+ * does not follow later resizes of the table. A `<flex>` value (`2fr`) is a share of the width
75
+ * left over. A `minmax()` keeps a pixel minimum above 48px: `minmax(120px, 1fr)` is a share that
76
+ * never narrows below 120px, and `minmax(100px, 200px)` is a fixed 200px width that a drag can
77
+ * narrow to 100px. Any other form (`10rem`, `auto`, `max-content`) takes an equal flexible share.
78
+ * Default `minmax(0, 1fr)`. No column narrows below 48px, in the layout or in a drag, so a
79
+ * percentage share narrower than 48px renders at 48px. The one exception is a pixel width above 0
80
+ * and below 48px, which renders as set. A width of 0 (`0px`, or a `0fr` share) renders at 48px. A
81
+ * column has no maximum width.
82
+ */
83
+ width?: string;
84
+ };
42
85
  export declare const ASSET_SIZE: {
43
86
  small: {
44
87
  maxWidth: number;
@@ -113,8 +156,39 @@ export type FocusMode = {
113
156
  value: string;
114
157
  };
115
158
  export type DefaultFocusMode = 'manual' | 'center';
159
+ /**
160
+ * Import behaviour when the host would rather not show the format picker.
161
+ *
162
+ * - `false` — the format dialog opens as usual.
163
+ * - `true` — insert with the first available format, without showing the dialog.
164
+ * - a format name — insert with that format, matched case-insensitively against a proxy's
165
+ * `proxyName` or `proxyLabel`. A name matching nothing opens the dialog as usual.
166
+ */
167
+ export type AutoSelectFormat = boolean | string;
168
+ /**
169
+ * Serves markup hosts: `<cx-content-browser auto-select-format="WEB">`. The union has to survive a
170
+ * round trip through a string, so `"true"`/`"false"` are the booleans and anything else is a format
171
+ * name; a bare attribute means `true`, matching how a boolean attribute normally reads.
172
+ *
173
+ * React hosts bypass this entirely — `CortexElement.createProperty` aliases the attribute name onto
174
+ * the prototype, so react-dom finds `'auto-select-format' in element` and assigns the property with
175
+ * its real type rather than setting an attribute.
176
+ */
177
+ export declare const autoSelectFormatConverter: {
178
+ fromAttribute: (value: string | null) => AutoSelectFormat;
179
+ toAttribute: (value: AutoSelectFormat) => string | null;
180
+ };
181
+ /**
182
+ * Whether `autoSelectFormat` is switched on at all — a blank string is off, not a format named " ".
183
+ *
184
+ * Config-level, not per-asset: it says the host has asked to skip the picker, not that this
185
+ * particular asset will skip it. A named format that no proxy matches still opens the dialog.
186
+ */
187
+ export declare function isAutoSelectFormatActive(value: AutoSelectFormat): boolean;
116
188
  export type CtaTextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
117
189
  export declare enum ContentBrowserFormatDialogVariant {
118
190
  Dialog = "dialog",
119
191
  Drawer = "drawer"
120
192
  }
193
+ /** Two Cortex field names name one field when these keys are equal: the table trims and ignores case. */
194
+ export declare function toFieldKey(field: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangelogic/orange-dam-content-browser-sdk",
3
- "version": "2.4.3",
3
+ "version": "2.4.4-table-view-beta-3",
4
4
  "description": "OrangeDAM Content Browser SDK source code",
5
5
  "main": "./build/OrangeDAMContentBrowserSDK.min.js",
6
6
  "module": "./build/index.mjs",