@orangelogic/orange-dam-content-browser-sdk 2.4.9 → 2.4.11
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 +2 -1
- package/build/OrangeDAMContentBrowserSDK.min.js +107 -107
- package/build/api/asset/asset.d.ts +8 -5
- package/build/components/content-browser/content-browser.d.ts +6 -1
- package/build/content-browser.mjs +33 -16
- package/build/index.d.ts +12 -1
- package/build/index.mjs +41 -18
- package/build/tools/fetch-and-merge-assets.d.ts +5 -2
- package/build/types/asset.d.ts +3 -0
- package/build/types/content-browser.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GetAssetsRequest } from '../../types/asset';
|
|
2
|
+
import { type TitleFallback } from '../../types/content-browser';
|
|
2
3
|
import { GetAssetLinksRequest, GetAssetLinksResponse, GetAssetsByIDsRequest, GetAssetsByIDsResponse, GetAssetsResponse, GetAssetVersionHistoryResponse, GetAvailableExtensionsResponse, GetAvailableProxiesResponse } from './asset.types';
|
|
3
4
|
export declare const DEFAULT_VIEW_SIZE = "CoreField.LargeSizePreview";
|
|
4
5
|
export declare const FIELD_ALLOW_ATS_LINK = "AllowATSLink";
|
|
@@ -24,12 +25,14 @@ export declare const FIELD_UPDATED_FILE_NAME = "CoreField.UpdatedFileName";
|
|
|
24
25
|
export declare const LIBRARY_NAME = "Library";
|
|
25
26
|
export declare const MESSAGE_NEW_LINE = "\n";
|
|
26
27
|
export declare const ORIGINAL_VIEW_SIZE = "CoreField.OriginalPreview";
|
|
28
|
+
/** The field the caption shows when the title is blank. */
|
|
29
|
+
export declare function resolveTitleFallbackField(titleFallback?: TitleFallback): "CoreField.Identifier" | "CoreField.OriginalFileName";
|
|
27
30
|
/**
|
|
28
|
-
* The caption shown under an asset.
|
|
29
|
-
* file names can carry private information (model names, shoot details)
|
|
30
|
-
*
|
|
31
|
+
* The caption shown under an asset. By default it falls back to the identifier rather than the original
|
|
32
|
+
* file name: file names can carry private information (model names, shoot details), and the host decides
|
|
33
|
+
* whether its users may see them. See L-42B0OO and L-42D2A9.
|
|
31
34
|
*/
|
|
32
|
-
export declare function resolveAssetCaption(fields: Record<string, string
|
|
35
|
+
export declare function resolveAssetCaption(fields: Record<string, string>, titleFallback?: TitleFallback): string;
|
|
33
36
|
export declare function resolveAssetExtraFilters(selectedFacets?: Record<string, string[]>): {
|
|
34
37
|
SubtypeCriteria?: string[];
|
|
35
38
|
FacetFilters?: Record<string, string[]>;
|
|
@@ -37,7 +40,7 @@ export declare function resolveAssetExtraFilters(selectedFacets?: Record<string,
|
|
|
37
40
|
export declare function apiGetAssetLinks({ assets, extension, extraFields, parameters, permanentLink, proxyPreference, transformations, useSession, }: GetAssetLinksRequest): Promise<GetAssetLinksResponse>;
|
|
38
41
|
export declare function apiGetAssetsByIDs({ extraFields, recordIds, }: GetAssetsByIDsRequest): Promise<GetAssetsByIDsResponse>;
|
|
39
42
|
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>;
|
|
43
|
+
export declare function apiGetAssets({ fields, folderId, isSeeThrough, limitedToDocTypes, pageSize, searchText, selectedFacets, sortOrder, start, titleFallback, useSession, }: GetAssetsRequest): Promise<GetAssetsResponse>;
|
|
41
44
|
export declare function apiGetAvailableProxies({ assetRecordId, siteUrl, }: {
|
|
42
45
|
assetRecordId: string;
|
|
43
46
|
siteUrl?: string;
|
|
@@ -7,7 +7,7 @@ import CxContentBrowserGrid from '../../components/content-browser-grid/content-
|
|
|
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
9
|
import CxContentBrowserTable from '../../components/content-browser-table/content-browser-table';
|
|
10
|
-
import { type AutoSelectFormat, type ContentBrowserView, type CtaTextTransform, type TableColumn, type TableRowActionPosition } from '../../types/content-browser';
|
|
10
|
+
import { type AutoSelectFormat, type ContentBrowserView, type CtaTextTransform, type TableColumn, type TableRowActionPosition, type TitleFallback } from '../../types/content-browser';
|
|
11
11
|
import { GetFolderRequest } from '../../types/folder';
|
|
12
12
|
import CxIcon from '@orangelogic/design-system/components/icon';
|
|
13
13
|
import CxIconButton from '@orangelogic/design-system/components/icon-button';
|
|
@@ -92,6 +92,11 @@ export default class CxContentBrowser extends CortexElement {
|
|
|
92
92
|
* the end of the last data column (`row-end`). Any other value gives `host-edge`.
|
|
93
93
|
*/
|
|
94
94
|
tableRowActionPosition: TableRowActionPosition;
|
|
95
|
+
/**
|
|
96
|
+
* What the asset caption shows when the asset has no title: `uniqueIdentifier` (default) or
|
|
97
|
+
* `originalFileName`. Any other value gives `uniqueIdentifier`.
|
|
98
|
+
*/
|
|
99
|
+
titleFallback: TitleFallback;
|
|
95
100
|
/** The widths the user saved for the table columns of this site, in pixels, keyed by field. */
|
|
96
101
|
private tableColumnWidths;
|
|
97
102
|
/**
|
|
@@ -6374,6 +6374,9 @@ const autoSelectFormatConverter = {
|
|
|
6374
6374
|
function isAutoSelectFormatActive(value) {
|
|
6375
6375
|
return value === true || typeof value === "string" && value.trim() !== "";
|
|
6376
6376
|
}
|
|
6377
|
+
function toTitleFallback(value) {
|
|
6378
|
+
return value === "originalFileName" ? "originalFileName" : "uniqueIdentifier";
|
|
6379
|
+
}
|
|
6377
6380
|
function toTableRowActionPosition(value) {
|
|
6378
6381
|
return value === "row-end" ? "row-end" : "host-edge";
|
|
6379
6382
|
}
|
|
@@ -14459,8 +14462,11 @@ const FIELD_SUBTYPE = "CoreField.DocSubType";
|
|
|
14459
14462
|
const FIELD_TITLE_WITH_FALLBACK = "CoreField.TitleWithFallback";
|
|
14460
14463
|
const FIELD_UPDATED_FILE_NAME = "CoreField.UpdatedFileName";
|
|
14461
14464
|
const ORIGINAL_VIEW_SIZE = "CoreField.OriginalPreview";
|
|
14462
|
-
function
|
|
14463
|
-
return
|
|
14465
|
+
function resolveTitleFallbackField(titleFallback) {
|
|
14466
|
+
return titleFallback === "originalFileName" ? FIELD_ORIGINAL_FILE_NAME : FIELD_IDENTIFIER;
|
|
14467
|
+
}
|
|
14468
|
+
function resolveAssetCaption(fields, titleFallback) {
|
|
14469
|
+
return fields[FIELD_DOC_TITLE] || fields[resolveTitleFallbackField(titleFallback)] || fields[FIELD_IDENTIFIER] || "";
|
|
14464
14470
|
}
|
|
14465
14471
|
function resolveAssetExtraFilters(selectedFacets) {
|
|
14466
14472
|
if (!selectedFacets || Object.keys(selectedFacets).length === 0) {
|
|
@@ -14852,20 +14858,22 @@ function apiGetAssets(_0) {
|
|
|
14852
14858
|
selectedFacets,
|
|
14853
14859
|
sortOrder,
|
|
14854
14860
|
start,
|
|
14861
|
+
titleFallback,
|
|
14855
14862
|
useSession
|
|
14856
14863
|
}) {
|
|
14857
14864
|
var _a2;
|
|
14858
14865
|
const validatedFields = (_a2 = fields == null ? void 0 : fields.filter((field) => field && typeof field === "string")) != null ? _a2 : [];
|
|
14866
|
+
const requestedFields = [
|
|
14867
|
+
...ASSET_LIST_FIELDS,
|
|
14868
|
+
resolveTitleFallbackField(titleFallback),
|
|
14869
|
+
...validatedFields
|
|
14870
|
+
].filter(
|
|
14871
|
+
(field, index, all3) => all3.findIndex((item) => item.toLowerCase() === field.toLowerCase()) === index
|
|
14872
|
+
);
|
|
14859
14873
|
try {
|
|
14860
14874
|
const response = yield http.request({
|
|
14861
14875
|
data: __spreadValues({
|
|
14862
|
-
Fields:
|
|
14863
|
-
...ASSET_LIST_FIELDS,
|
|
14864
|
-
...validatedFields.filter((field, index) => {
|
|
14865
|
-
const seen = [...ASSET_LIST_FIELDS, ...validatedFields.slice(0, index)];
|
|
14866
|
-
return !seen.some((item) => item.toLowerCase() === field.toLowerCase());
|
|
14867
|
-
})
|
|
14868
|
-
],
|
|
14876
|
+
Fields: requestedFields,
|
|
14869
14877
|
Limit: pageSize || void 0,
|
|
14870
14878
|
LimitedToDocTypes: limitedToDocTypes,
|
|
14871
14879
|
ObjectRecordID: folderId || void 0,
|
|
@@ -14893,14 +14901,14 @@ function apiGetAssets(_0) {
|
|
|
14893
14901
|
const mappedItems = (_b2 = (_a3 = rawResponse.contentItems) == null ? void 0 : _a3.map((item) => {
|
|
14894
14902
|
var _a4, _b3, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
|
|
14895
14903
|
let extension = (_a4 = item.fields[FIELD_EXTENSION]) != null ? _a4 : "";
|
|
14896
|
-
const name = resolveAssetCaption(item.fields);
|
|
14904
|
+
const name = resolveAssetCaption(item.fields, titleFallback);
|
|
14897
14905
|
if (extension && !extension.startsWith(".")) {
|
|
14898
14906
|
extension = "." + extension;
|
|
14899
14907
|
}
|
|
14900
14908
|
return __spreadProps(__spreadValues({}, validatedFields.reduce((acc, field) => {
|
|
14901
14909
|
var _a5, _b4;
|
|
14902
|
-
const sourceField = (_a5 =
|
|
14903
|
-
(
|
|
14910
|
+
const sourceField = (_a5 = requestedFields.find(
|
|
14911
|
+
(requestedField) => requestedField.toLowerCase() === field.toLowerCase()
|
|
14904
14912
|
)) != null ? _a5 : field;
|
|
14905
14913
|
acc[field] = (_b4 = item.fields[sourceField]) != null ? _b4 : "";
|
|
14906
14914
|
return acc;
|
|
@@ -15427,6 +15435,7 @@ class FetchAndMergeAssetsController {
|
|
|
15427
15435
|
defaultSelectedFacets,
|
|
15428
15436
|
defaultSortDirection,
|
|
15429
15437
|
defaultSortOrderName,
|
|
15438
|
+
titleFallback = "uniqueIdentifier",
|
|
15430
15439
|
token,
|
|
15431
15440
|
useSession,
|
|
15432
15441
|
useSiteSession = false
|
|
@@ -15471,6 +15480,7 @@ class FetchAndMergeAssetsController {
|
|
|
15471
15480
|
this.host = host;
|
|
15472
15481
|
this.availableDocTypes = availableDocTypes;
|
|
15473
15482
|
this.additionalFields = additionalFields != null ? additionalFields : [];
|
|
15483
|
+
this.titleFallback = titleFallback;
|
|
15474
15484
|
this.defaultFolderId = defaultFolderId;
|
|
15475
15485
|
this.defaultIsSeeThrough = defaultIsSeeThrough;
|
|
15476
15486
|
this.defaultSearchText = defaultSearchText;
|
|
@@ -15673,7 +15683,7 @@ class FetchAndMergeAssetsController {
|
|
|
15673
15683
|
}
|
|
15674
15684
|
fetchAssets(request) {
|
|
15675
15685
|
return __async(this, null, function* () {
|
|
15676
|
-
return yield apiGetAssets(request);
|
|
15686
|
+
return yield apiGetAssets(__spreadValues({ titleFallback: this.titleFallback }, request));
|
|
15677
15687
|
});
|
|
15678
15688
|
}
|
|
15679
15689
|
fetchFolders(request) {
|
|
@@ -15786,7 +15796,8 @@ class FetchAndMergeAssetsController {
|
|
|
15786
15796
|
});
|
|
15787
15797
|
this.lastRequest = request;
|
|
15788
15798
|
const assets = yield apiGetAssets(__spreadProps(__spreadValues({}, request), {
|
|
15789
|
-
sortOrder
|
|
15799
|
+
sortOrder,
|
|
15800
|
+
titleFallback: this.titleFallback
|
|
15790
15801
|
}));
|
|
15791
15802
|
if (generation !== __privateGet(this, _generation)) {
|
|
15792
15803
|
return;
|
|
@@ -15881,7 +15892,8 @@ class FetchAndMergeAssetsController {
|
|
|
15881
15892
|
FIELD_RECORD_ID,
|
|
15882
15893
|
FIELD_SUBTYPE,
|
|
15883
15894
|
FIELD_TITLE_WITH_FALLBACK,
|
|
15884
|
-
ORIGINAL_VIEW_SIZE
|
|
15895
|
+
ORIGINAL_VIEW_SIZE,
|
|
15896
|
+
...this.titleFallback === "originalFileName" ? [resolveTitleFallbackField(this.titleFallback)] : []
|
|
15885
15897
|
],
|
|
15886
15898
|
recordIds: [id]
|
|
15887
15899
|
}),
|
|
@@ -15916,7 +15928,7 @@ class FetchAndMergeAssetsController {
|
|
|
15916
15928
|
identifier: (_d2 = item[FIELD_IDENTIFIER]) != null ? _d2 : "",
|
|
15917
15929
|
imageUrl: (_e2 = item[DEFAULT_VIEW_SIZE]) != null ? _e2 : "",
|
|
15918
15930
|
inColdStorage: Boolean(item.inColdStorage),
|
|
15919
|
-
name: resolveAssetCaption(item),
|
|
15931
|
+
name: resolveAssetCaption(item, this.titleFallback),
|
|
15920
15932
|
originalUrl: (_f2 = item[ORIGINAL_VIEW_SIZE]) != null ? _f2 : "",
|
|
15921
15933
|
previewUrl: (_h = (_g = proxyData == null ? void 0 : proxyData.previewUrl) != null ? _g : item[DEFAULT_VIEW_SIZE]) != null ? _h : "",
|
|
15922
15934
|
recordId: (_i = item[FIELD_RECORD_ID]) != null ? _i : "",
|
|
@@ -16419,6 +16431,7 @@ let CxContentBrowser = class extends CortexElement {
|
|
|
16419
16431
|
this.defaultGridView = GridView.Medium;
|
|
16420
16432
|
this.tableColumns = [];
|
|
16421
16433
|
this.tableRowActionPosition = "host-edge";
|
|
16434
|
+
this.titleFallback = "uniqueIdentifier";
|
|
16422
16435
|
this.tableColumnWidths = {};
|
|
16423
16436
|
this.tableWidthQueue = Promise.resolve();
|
|
16424
16437
|
this.tableWidthTasks = 0;
|
|
@@ -16579,6 +16592,7 @@ let CxContentBrowser = class extends CortexElement {
|
|
|
16579
16592
|
defaultSelectedFacets: this.defaultSelectedFacets,
|
|
16580
16593
|
defaultSortDirection: this.defaultSortDirection,
|
|
16581
16594
|
defaultSortOrderName: this.defaultSortOrderName,
|
|
16595
|
+
titleFallback: toTitleFallback(this.titleFallback),
|
|
16582
16596
|
token: this.token,
|
|
16583
16597
|
useSession: this.useSession,
|
|
16584
16598
|
useSiteSession: this.useSiteSession
|
|
@@ -17377,6 +17391,9 @@ __decorateClass([
|
|
|
17377
17391
|
__decorateClass([
|
|
17378
17392
|
n$6({ attribute: "table-row-action-position", type: String })
|
|
17379
17393
|
], CxContentBrowser.prototype, "tableRowActionPosition", 2);
|
|
17394
|
+
__decorateClass([
|
|
17395
|
+
n$6({ attribute: "title-fallback", type: String })
|
|
17396
|
+
], CxContentBrowser.prototype, "titleFallback", 2);
|
|
17380
17397
|
__decorateClass([
|
|
17381
17398
|
r$6()
|
|
17382
17399
|
], CxContentBrowser.prototype, "tableColumnWidths", 2);
|
package/build/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import './styles.css';
|
|
|
2
2
|
export { default as CxContentBrowser } from './components/content-browser/content-browser';
|
|
3
3
|
import { AppContextType } from './AppContext';
|
|
4
4
|
import { CtaTextTransform, ImageCardDisplayInfo } from './GlobalConfigContext';
|
|
5
|
-
import { type AutoSelectFormat, TableColumn, type TableRowActionPosition } from './types/content-browser';
|
|
5
|
+
import { type AutoSelectFormat, TableColumn, type TableRowActionPosition, type TitleFallback } from './types/content-browser';
|
|
6
6
|
import { Folder, GetContentRequest, GetContentResponse, GetFoldersRequest } from './types/search';
|
|
7
7
|
type OrangeDAMContentBrowser = {
|
|
8
8
|
help: () => void;
|
|
@@ -235,6 +235,17 @@ type OrangeDAMContentBrowser = {
|
|
|
235
235
|
* Default `host-edge`.
|
|
236
236
|
*/
|
|
237
237
|
tableRowActionPosition?: TableRowActionPosition;
|
|
238
|
+
/**
|
|
239
|
+
* What the asset caption shows when the asset has no title. The title always shows when it is set.
|
|
240
|
+
*
|
|
241
|
+
* - `uniqueIdentifier` (default) - the unique identifier of the asset.
|
|
242
|
+
* - `originalFileName` - the original file name of the asset.
|
|
243
|
+
*
|
|
244
|
+
* A file name can hold private information, for example model names or shoot details. Set
|
|
245
|
+
* `originalFileName` only when every user of the host can see the file names. Any other value gives
|
|
246
|
+
* `uniqueIdentifier`.
|
|
247
|
+
*/
|
|
248
|
+
titleFallback?: TitleFallback;
|
|
238
249
|
/**
|
|
239
250
|
* Import behaviour when picking an asset, for a host that would rather not show the format
|
|
240
251
|
* picker.
|
package/build/index.mjs
CHANGED
|
@@ -6440,6 +6440,9 @@ const autoSelectFormatConverter = {
|
|
|
6440
6440
|
function isAutoSelectFormatActive(value) {
|
|
6441
6441
|
return value === true || typeof value === "string" && value.trim() !== "";
|
|
6442
6442
|
}
|
|
6443
|
+
function toTitleFallback(value) {
|
|
6444
|
+
return value === "originalFileName" ? "originalFileName" : "uniqueIdentifier";
|
|
6445
|
+
}
|
|
6443
6446
|
function toTableRowActionPosition(value) {
|
|
6444
6447
|
return value === "row-end" ? "row-end" : "host-edge";
|
|
6445
6448
|
}
|
|
@@ -14525,8 +14528,11 @@ const FIELD_SUBTYPE = "CoreField.DocSubType";
|
|
|
14525
14528
|
const FIELD_TITLE_WITH_FALLBACK = "CoreField.TitleWithFallback";
|
|
14526
14529
|
const FIELD_UPDATED_FILE_NAME = "CoreField.UpdatedFileName";
|
|
14527
14530
|
const ORIGINAL_VIEW_SIZE = "CoreField.OriginalPreview";
|
|
14528
|
-
function
|
|
14529
|
-
return
|
|
14531
|
+
function resolveTitleFallbackField(titleFallback) {
|
|
14532
|
+
return titleFallback === "originalFileName" ? FIELD_ORIGINAL_FILE_NAME : FIELD_IDENTIFIER;
|
|
14533
|
+
}
|
|
14534
|
+
function resolveAssetCaption(fields, titleFallback) {
|
|
14535
|
+
return fields[FIELD_DOC_TITLE] || fields[resolveTitleFallbackField(titleFallback)] || fields[FIELD_IDENTIFIER] || "";
|
|
14530
14536
|
}
|
|
14531
14537
|
function resolveAssetExtraFilters(selectedFacets) {
|
|
14532
14538
|
if (!selectedFacets || Object.keys(selectedFacets).length === 0) {
|
|
@@ -14918,20 +14924,22 @@ function apiGetAssets(_0) {
|
|
|
14918
14924
|
selectedFacets,
|
|
14919
14925
|
sortOrder,
|
|
14920
14926
|
start,
|
|
14927
|
+
titleFallback,
|
|
14921
14928
|
useSession
|
|
14922
14929
|
}) {
|
|
14923
14930
|
var _a2;
|
|
14924
14931
|
const validatedFields = (_a2 = fields == null ? void 0 : fields.filter((field) => field && typeof field === "string")) != null ? _a2 : [];
|
|
14932
|
+
const requestedFields = [
|
|
14933
|
+
...ASSET_LIST_FIELDS,
|
|
14934
|
+
resolveTitleFallbackField(titleFallback),
|
|
14935
|
+
...validatedFields
|
|
14936
|
+
].filter(
|
|
14937
|
+
(field, index, all3) => all3.findIndex((item) => item.toLowerCase() === field.toLowerCase()) === index
|
|
14938
|
+
);
|
|
14925
14939
|
try {
|
|
14926
14940
|
const response = yield http.request({
|
|
14927
14941
|
data: __spreadValues({
|
|
14928
|
-
Fields:
|
|
14929
|
-
...ASSET_LIST_FIELDS,
|
|
14930
|
-
...validatedFields.filter((field, index) => {
|
|
14931
|
-
const seen = [...ASSET_LIST_FIELDS, ...validatedFields.slice(0, index)];
|
|
14932
|
-
return !seen.some((item) => item.toLowerCase() === field.toLowerCase());
|
|
14933
|
-
})
|
|
14934
|
-
],
|
|
14942
|
+
Fields: requestedFields,
|
|
14935
14943
|
Limit: pageSize || void 0,
|
|
14936
14944
|
LimitedToDocTypes: limitedToDocTypes,
|
|
14937
14945
|
ObjectRecordID: folderId || void 0,
|
|
@@ -14959,14 +14967,14 @@ function apiGetAssets(_0) {
|
|
|
14959
14967
|
const mappedItems = (_b2 = (_a3 = rawResponse.contentItems) == null ? void 0 : _a3.map((item) => {
|
|
14960
14968
|
var _a4, _b3, _c2, _d2, _e3, _f2, _g, _h, _i, _j, _k, _l;
|
|
14961
14969
|
let extension = (_a4 = item.fields[FIELD_EXTENSION]) != null ? _a4 : "";
|
|
14962
|
-
const name = resolveAssetCaption(item.fields);
|
|
14970
|
+
const name = resolveAssetCaption(item.fields, titleFallback);
|
|
14963
14971
|
if (extension && !extension.startsWith(".")) {
|
|
14964
14972
|
extension = "." + extension;
|
|
14965
14973
|
}
|
|
14966
14974
|
return __spreadProps(__spreadValues({}, validatedFields.reduce((acc, field) => {
|
|
14967
14975
|
var _a5, _b4;
|
|
14968
|
-
const sourceField = (_a5 =
|
|
14969
|
-
(
|
|
14976
|
+
const sourceField = (_a5 = requestedFields.find(
|
|
14977
|
+
(requestedField) => requestedField.toLowerCase() === field.toLowerCase()
|
|
14970
14978
|
)) != null ? _a5 : field;
|
|
14971
14979
|
acc[field] = (_b4 = item.fields[sourceField]) != null ? _b4 : "";
|
|
14972
14980
|
return acc;
|
|
@@ -15493,6 +15501,7 @@ class FetchAndMergeAssetsController {
|
|
|
15493
15501
|
defaultSelectedFacets,
|
|
15494
15502
|
defaultSortDirection,
|
|
15495
15503
|
defaultSortOrderName,
|
|
15504
|
+
titleFallback = "uniqueIdentifier",
|
|
15496
15505
|
token: token2,
|
|
15497
15506
|
useSession,
|
|
15498
15507
|
useSiteSession = false
|
|
@@ -15537,6 +15546,7 @@ class FetchAndMergeAssetsController {
|
|
|
15537
15546
|
this.host = host;
|
|
15538
15547
|
this.availableDocTypes = availableDocTypes;
|
|
15539
15548
|
this.additionalFields = additionalFields != null ? additionalFields : [];
|
|
15549
|
+
this.titleFallback = titleFallback;
|
|
15540
15550
|
this.defaultFolderId = defaultFolderId;
|
|
15541
15551
|
this.defaultIsSeeThrough = defaultIsSeeThrough;
|
|
15542
15552
|
this.defaultSearchText = defaultSearchText;
|
|
@@ -15739,7 +15749,7 @@ class FetchAndMergeAssetsController {
|
|
|
15739
15749
|
}
|
|
15740
15750
|
fetchAssets(request) {
|
|
15741
15751
|
return __async(this, null, function* () {
|
|
15742
|
-
return yield apiGetAssets(request);
|
|
15752
|
+
return yield apiGetAssets(__spreadValues({ titleFallback: this.titleFallback }, request));
|
|
15743
15753
|
});
|
|
15744
15754
|
}
|
|
15745
15755
|
fetchFolders(request) {
|
|
@@ -15852,7 +15862,8 @@ class FetchAndMergeAssetsController {
|
|
|
15852
15862
|
});
|
|
15853
15863
|
this.lastRequest = request;
|
|
15854
15864
|
const assets = yield apiGetAssets(__spreadProps(__spreadValues({}, request), {
|
|
15855
|
-
sortOrder
|
|
15865
|
+
sortOrder,
|
|
15866
|
+
titleFallback: this.titleFallback
|
|
15856
15867
|
}));
|
|
15857
15868
|
if (generation !== __privateGet(this, _generation)) {
|
|
15858
15869
|
return;
|
|
@@ -15947,7 +15958,8 @@ class FetchAndMergeAssetsController {
|
|
|
15947
15958
|
FIELD_RECORD_ID,
|
|
15948
15959
|
FIELD_SUBTYPE,
|
|
15949
15960
|
FIELD_TITLE_WITH_FALLBACK,
|
|
15950
|
-
ORIGINAL_VIEW_SIZE
|
|
15961
|
+
ORIGINAL_VIEW_SIZE,
|
|
15962
|
+
...this.titleFallback === "originalFileName" ? [resolveTitleFallbackField(this.titleFallback)] : []
|
|
15951
15963
|
],
|
|
15952
15964
|
recordIds: [id]
|
|
15953
15965
|
}),
|
|
@@ -15982,7 +15994,7 @@ class FetchAndMergeAssetsController {
|
|
|
15982
15994
|
identifier: (_d2 = item[FIELD_IDENTIFIER]) != null ? _d2 : "",
|
|
15983
15995
|
imageUrl: (_e3 = item[DEFAULT_VIEW_SIZE]) != null ? _e3 : "",
|
|
15984
15996
|
inColdStorage: Boolean(item.inColdStorage),
|
|
15985
|
-
name: resolveAssetCaption(item),
|
|
15997
|
+
name: resolveAssetCaption(item, this.titleFallback),
|
|
15986
15998
|
originalUrl: (_f2 = item[ORIGINAL_VIEW_SIZE]) != null ? _f2 : "",
|
|
15987
15999
|
previewUrl: (_h = (_g = proxyData == null ? void 0 : proxyData.previewUrl) != null ? _g : item[DEFAULT_VIEW_SIZE]) != null ? _h : "",
|
|
15988
16000
|
recordId: (_i = item[FIELD_RECORD_ID]) != null ? _i : "",
|
|
@@ -16495,6 +16507,7 @@ let CxContentBrowser = class extends CortexElement {
|
|
|
16495
16507
|
this.defaultGridView = GridView$1.Medium;
|
|
16496
16508
|
this.tableColumns = [];
|
|
16497
16509
|
this.tableRowActionPosition = "host-edge";
|
|
16510
|
+
this.titleFallback = "uniqueIdentifier";
|
|
16498
16511
|
this.tableColumnWidths = {};
|
|
16499
16512
|
this.tableWidthQueue = Promise.resolve();
|
|
16500
16513
|
this.tableWidthTasks = 0;
|
|
@@ -16655,6 +16668,7 @@ let CxContentBrowser = class extends CortexElement {
|
|
|
16655
16668
|
defaultSelectedFacets: this.defaultSelectedFacets,
|
|
16656
16669
|
defaultSortDirection: this.defaultSortDirection,
|
|
16657
16670
|
defaultSortOrderName: this.defaultSortOrderName,
|
|
16671
|
+
titleFallback: toTitleFallback(this.titleFallback),
|
|
16658
16672
|
token: this.token,
|
|
16659
16673
|
useSession: this.useSession,
|
|
16660
16674
|
useSiteSession: this.useSiteSession
|
|
@@ -17453,6 +17467,9 @@ __decorateClass([
|
|
|
17453
17467
|
__decorateClass([
|
|
17454
17468
|
n$6({ attribute: "table-row-action-position", type: String })
|
|
17455
17469
|
], CxContentBrowser.prototype, "tableRowActionPosition", 2);
|
|
17470
|
+
__decorateClass([
|
|
17471
|
+
n$6({ attribute: "title-fallback", type: String })
|
|
17472
|
+
], CxContentBrowser.prototype, "titleFallback", 2);
|
|
17456
17473
|
__decorateClass([
|
|
17457
17474
|
r$6()
|
|
17458
17475
|
], CxContentBrowser.prototype, "tableColumnWidths", 2);
|
|
@@ -31718,7 +31735,8 @@ const GlobalConfigContext = reactExports.createContext({
|
|
|
31718
31735
|
defaultGridView: "",
|
|
31719
31736
|
autoSelectFormat: false,
|
|
31720
31737
|
tableColumns: [],
|
|
31721
|
-
tableRowActionPosition: "host-edge"
|
|
31738
|
+
tableRowActionPosition: "host-edge",
|
|
31739
|
+
titleFallback: "uniqueIdentifier"
|
|
31722
31740
|
});
|
|
31723
31741
|
function formatProdErrorMessage$1(code) {
|
|
31724
31742
|
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
@@ -34505,6 +34523,7 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
|
|
|
34505
34523
|
showVersions,
|
|
34506
34524
|
tableColumns,
|
|
34507
34525
|
tableRowActionPosition,
|
|
34526
|
+
titleFallback,
|
|
34508
34527
|
autoSelectFormat
|
|
34509
34528
|
} = reactExports.useContext(GlobalConfigContext);
|
|
34510
34529
|
const {
|
|
@@ -34744,6 +34763,7 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
|
|
|
34744
34763
|
"default-grid-view": defaultSettings.view,
|
|
34745
34764
|
"table-columns": tableColumns != null ? tableColumns : [],
|
|
34746
34765
|
"table-row-action-position": tableRowActionPosition != null ? tableRowActionPosition : "host-edge",
|
|
34766
|
+
"title-fallback": titleFallback != null ? titleFallback : "uniqueIdentifier",
|
|
34747
34767
|
"auto-select-format": autoSelectFormat != null ? autoSelectFormat : false,
|
|
34748
34768
|
"default-sort-order-name": defaultSettings.sortOrder,
|
|
34749
34769
|
"default-sort-direction": defaultSettings.sortDirection,
|
|
@@ -35440,6 +35460,7 @@ const ContentBrowser = {
|
|
|
35440
35460
|
{ title: "Description", field: "Document.CaptionLong" },
|
|
35441
35461
|
],
|
|
35442
35462
|
tableRowActionPosition: "host-edge", // Where the table row action shows: host-edge or row-end
|
|
35463
|
+
titleFallback: "uniqueIdentifier", // Caption when the title is blank: uniqueIdentifier or originalFileName
|
|
35443
35464
|
});`);
|
|
35444
35465
|
},
|
|
35445
35466
|
open: (_0) => __async(null, [_0], function* ({
|
|
@@ -35493,6 +35514,7 @@ const ContentBrowser = {
|
|
|
35493
35514
|
defaultGridView,
|
|
35494
35515
|
tableColumns,
|
|
35495
35516
|
tableRowActionPosition,
|
|
35517
|
+
titleFallback,
|
|
35496
35518
|
autoSelectFormat
|
|
35497
35519
|
}) {
|
|
35498
35520
|
var _a2;
|
|
@@ -35604,7 +35626,8 @@ const ContentBrowser = {
|
|
|
35604
35626
|
defaultGridView: defaultGridView != null ? defaultGridView : "",
|
|
35605
35627
|
autoSelectFormat: autoSelectFormat != null ? autoSelectFormat : false,
|
|
35606
35628
|
tableColumns: tableColumns != null ? tableColumns : [],
|
|
35607
|
-
tableRowActionPosition: tableRowActionPosition != null ? tableRowActionPosition : "host-edge"
|
|
35629
|
+
tableRowActionPosition: tableRowActionPosition != null ? tableRowActionPosition : "host-edge",
|
|
35630
|
+
titleFallback: toTitleFallback(titleFallback)
|
|
35608
35631
|
},
|
|
35609
35632
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
35610
35633
|
App,
|
|
@@ -2,7 +2,7 @@ import CortexElement from '../base/element';
|
|
|
2
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
|
-
import { Facet, SortOrder } from '../types/content-browser';
|
|
5
|
+
import { Facet, SortOrder, type TitleFallback } from '../types/content-browser';
|
|
6
6
|
import { GetFolderRequest } from '../types/folder';
|
|
7
7
|
import type { ReactiveController } from 'lit';
|
|
8
8
|
type FetchAndMergeAssetsControllerOptions = {
|
|
@@ -17,6 +17,8 @@ type FetchAndMergeAssetsControllerOptions = {
|
|
|
17
17
|
defaultSelectedFacets: Record<string, string[]>;
|
|
18
18
|
defaultSortDirection: 'ascending' | 'descending';
|
|
19
19
|
defaultSortOrderName: string;
|
|
20
|
+
/** What the asset caption shows when the asset has no title. Default `uniqueIdentifier`. */
|
|
21
|
+
titleFallback?: TitleFallback;
|
|
20
22
|
token: string;
|
|
21
23
|
useSession: string;
|
|
22
24
|
useSiteSession?: boolean;
|
|
@@ -53,6 +55,7 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
|
|
|
53
55
|
private readonly tokenRefreshTimeoutMs;
|
|
54
56
|
private readonly availableDocTypes;
|
|
55
57
|
private additionalFields;
|
|
58
|
+
private titleFallback;
|
|
56
59
|
private readonly defaultSearchText;
|
|
57
60
|
private readonly defaultSelectedFacets;
|
|
58
61
|
private readonly defaultSortOrderName;
|
|
@@ -61,7 +64,7 @@ export declare class FetchAndMergeAssetsController implements ReactiveController
|
|
|
61
64
|
private readonly defaultIsSeeThrough;
|
|
62
65
|
private requestInterceptorId;
|
|
63
66
|
private responseInterceptorId;
|
|
64
|
-
constructor(host: CortexElement, { additionalFields, availableDocTypes, baseUrl, bearerToken, defaultFolderId, defaultIsSeeThrough, defaultSearchText, defaultSelectedFacets, defaultSortDirection, defaultSortOrderName, token, useSession, useSiteSession, }: FetchAndMergeAssetsControllerOptions);
|
|
67
|
+
constructor(host: CortexElement, { additionalFields, availableDocTypes, baseUrl, bearerToken, defaultFolderId, defaultIsSeeThrough, defaultSearchText, defaultSelectedFacets, defaultSortDirection, defaultSortOrderName, titleFallback, token, useSession, useSiteSession, }: FetchAndMergeAssetsControllerOptions);
|
|
65
68
|
private waitForNewToken;
|
|
66
69
|
/**
|
|
67
70
|
* Site-session mode decides the transport (cookies on the Cortex origin vs. Token/UseSession
|
package/build/types/asset.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TitleFallback } from '../types/content-browser';
|
|
1
2
|
export type AssetVersion = {
|
|
2
3
|
createByEmail: string;
|
|
3
4
|
fileImportDate: string;
|
|
@@ -95,5 +96,7 @@ export type GetAssetsRequest = {
|
|
|
95
96
|
sortOrder?: string;
|
|
96
97
|
sortOrderName?: string;
|
|
97
98
|
start?: number;
|
|
99
|
+
/** What the caption shows when the asset has no title. Default `uniqueIdentifier`. */
|
|
100
|
+
titleFallback?: TitleFallback;
|
|
98
101
|
useSession?: string;
|
|
99
102
|
};
|
|
@@ -179,6 +179,13 @@ export type CtaTextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize'
|
|
|
179
179
|
* of the last data column (`row-end`).
|
|
180
180
|
*/
|
|
181
181
|
export type TableRowActionPosition = 'host-edge' | 'row-end';
|
|
182
|
+
/**
|
|
183
|
+
* What the asset caption shows when the asset has no title: the unique identifier (`uniqueIdentifier`), or
|
|
184
|
+
* the original file name (`originalFileName`). A file name can hold private information, so a host must opt in.
|
|
185
|
+
*/
|
|
186
|
+
export type TitleFallback = 'uniqueIdentifier' | 'originalFileName';
|
|
187
|
+
/** Reads a title fallback. Any value other than `originalFileName` gives `uniqueIdentifier`. */
|
|
188
|
+
export declare function toTitleFallback(value: unknown): TitleFallback;
|
|
182
189
|
/** Reads a row action position. Any value other than `row-end` gives `host-edge`. */
|
|
183
190
|
export declare function toTableRowActionPosition(value: unknown): TableRowActionPosition;
|
|
184
191
|
export declare enum ContentBrowserFormatDialogVariant {
|
package/package.json
CHANGED